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__User__Detail__Topics__Ex...

440 lines
1.2 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[306,5,7,8,9],{"+NIl":function(rt,we,$){(function(le){le($("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(X,D){"use strict";function Y(c,d){c.cmdState.push(d)}function j(c){return c.cmdState.length>0?c.cmdState[c.cmdState.length-1]:null}function P(c){var d=c.cmdState.pop();d&&d.closeBracket()}function G(c){for(var d=c.cmdState,p=d.length-1;p>=0;p--){var l=d[p];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function W(c,d,p){return function(){this.name=c,this.bracketNo=0,this.style=d,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var n={};n.importmodule=W("importmodule","tag",["string","builtin"]),n.documentclass=W("documentclass","tag",["","atom"]),n.usepackage=W("usepackage","tag",["atom"]),n.begin=W("begin","tag",["atom"]),n.end=W("end","tag",["atom"]),n.label=W("label","tag",["atom"]),n.ref=W("ref","tag",["atom"]),n.eqref=W("eqref","tag",["atom"]),n.cite=W("cite","tag",["atom"]),n.bibitem=W("bibitem","tag",["atom"]),n.Bibitem=W("Bibitem","tag",["atom"]),n.RBibitem=W("RBibitem","tag",["atom"]),n.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(c,d){c.f=d}function b(c,d){var p;if(c.match(/^\\[a-zA-Z@]+/)){var l=c.current().slice(1);return p=n.hasOwnProperty(l)?n[l]:n.DEFAULT,p=new p,Y(d,p),L(d,g),p.style}if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/\\]/))return"tag";if(c.match("\\["))return L(d,function(o,s){return m(o,s,"\\]")}),"keyword";if(c.match("\\("))return L(d,function(o,s){return m(o,s,"\\)")}),"keyword";if(c.match("$$"))return L(d,function(o,s){return m(o,s,"$$")}),"keyword";if(c.match("$"))return L(d,function(o,s){return m(o,s,"$")}),"keyword";var h=c.next();if(h=="%")return c.skipToEnd(),"comment";if(h=="}"||h=="]"){if(p=j(d),p)p.closeBracket(h),L(d,g);else return"error";return"bracket"}else return h=="{"||h=="["?(p=n.DEFAULT,p=new p,Y(d,p),"bracket"):/\d/.test(h)?(c.eatWhile(/[\w.%]/),"atom"):(c.eatWhile(/[\w\-_]/),p=G(d),p.name=="begin"&&(p.argument=c.current()),p.styleIdentifier())}function m(c,d,p){if(c.eatSpace())return null;if(p&&c.match(p))return L(d,b),"keyword";if(c.match(/^\\[a-zA-Z@]+/))return"tag";if(c.match(/^[a-zA-Z]+/))return"variable-2";if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/]/))return"tag";if(c.match(/^[\^_&]/))return"tag";if(c.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(c.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=c.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(c.skipToEnd(),"comment"):"error"}function g(c,d){var p=c.peek(),l;return p=="{"||p=="["?(l=j(d),l.openBracket(p),c.eat(p),L(d,b),"bracket"):/[ \t\r]/.test(p)?(c.eat(p),null):(L(d,b),P(d),b(c,d))}return{startState:function(){var c=D.inMathMode?function(d,p){return m(d,p)}:b;return{cmdState:[],f:c}},copyState:function(c){return{cmdState:c.cmdState.slice(),f:c.f}},token:function(c,d){return d.f(c,d)},blankLine:function(c){c.f=b,c.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"+ua5":function(rt,we,$){},"/cxE":function(rt,we,$){"use strict";$.d(we,"f",function(){return D}),$.d(we,"g",function(){return Y}),$.d(we,"h",function(){return j}),$.d(we,"e",function(){return G}),$.d(we,"b",function(){return W}),$.d(we,"c",function(){return n}),$.d(we,"d",function(){return L}),$.d(we,"a",function(){return b});class le{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}emit(m){this.listeners.forEach(g=>{g(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const X=new le;function D(m){G(m)||X.onUnexpectedError(m);return}function Y(m){G(m)||X.onUnexpectedExternalError(m);return}function j(m){if(m instanceof Error){let{name:g,message:c}=m;const d=m.stacktrace||m.stack;return{$isError:!0,name:g,message:c,stack:d}}return m}const P="Canceled";function G(m){return m instanceof Error&&m.name===P&&m.message===P}function W(){const m=new Error(P);return m.name=m.message,m}function n(m){return m?new Error(`Illegal argument: ${m}`):new Error("Illegal argument")}function L(m){return m?new Error(`Illegal state: ${m}`):new Error("Illegal state")}class b extends Error{constructor(m){super("NotSupported");m&&(this.message=m)}}},"19Vz":function(rt,we,$){(function(le){le($("VrN/"))})(function(le){le.defineOption("placeholder","",function(W,n,L){var b=L&&L!=le.Init;if(n&&!b)W.on("blur",j),W.on("change",P),W.on("swapDoc",P),le.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Y(W)}),P(W);else if(!n&&b){W.off("blur",j),W.off("change",P),W.off("swapDoc",P),le.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),X(W);var m=W.getWrapperElement();m.className=m.className.replace(" CodeMirror-empty","")}n&&!W.hasFocus()&&j(W)});function X(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){X(W);var n=W.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.style.direction=W.getOption("direction"),n.className="CodeMirror-placeholder CodeMirror-line-like";var L=W.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),n.appendChild(L),W.display.lineSpace.insertBefore(n,W.display.lineSpace.firstChild)}function Y(W){setTimeout(function(){var n=!1,L=W.getInputField();L.nodeName=="TEXTAREA"?n=!L.value:W.lineCount()==1&&(n=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),n?D(W):X(W)},20)}function j(W){G(W)&&D(W)}function P(W){var n=W.getWrapperElement(),L=G(W);n.className=n.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(W):X(W)}function G(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(rt,we,$){(function(le){le($("VrN/"))})(function(le){"use strict";var X={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};le.defineMode("xml",function(Y,j){var P=Y.indentUnit,G={},W=j.htmlMode?X:D;for(var n in W)G[n]=W[n];for(var n in j)G[n]=j[n];var L,b;function m(u,v){function a(B){return v.tokenize=B,B(u,v)}var _=u.next();if(_=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?a(d("atom","]]>")):null:u.match("--")?a(d("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),a(p(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),v.tokenize=d("meta","?>"),"meta"):(L=u.eat("/")?"closeTag":"openTag",v.tokenize=g,"tag bracket");if(_=="&"){var N;return u.eat("#")?u.eat("x")?N=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):N=u.eatWhile(/[\d]/)&&u.eat(";"):N=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),N?"atom":"error"}else return u.eatWhile(/[^&<]/),null}m.isInText=!0;function g(u,v){var a=u.next();if(a==">"||a=="/"&&u.eat(">"))return v.tokenize=m,L=a==">"?"endTag":"selfcloseTag","tag bracket";if(a=="=")return L="equals",null;if(a=="<"){v.tokenize=m,v.state=s,v.tagName=v.tagStart=null;var _=v.tokenize(u,v);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(a)?(v.tokenize=c(a),v.stringStartCol=u.column(),v.tokenize(u,v)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function c(u){var v=function(a,_){for(;!a.eol();)if(a.next()==u){_.tokenize=g;break}return"string"};return v.isInAttribute=!0,v}function d(u,v){return function(a,_){for(;!a.eol();){if(a.match(v)){_.tokenize=m;break}a.next()}return u}}function p(u){return function(v,a){for(var _;(_=v.next())!=null;){if(_=="<")return a.tokenize=p(u+1),a.tokenize(v,a);if(_==">")if(u==1){a.tokenize=m;break}else return a.tokenize=p(u-1),a.tokenize(v,a)}return"meta"}}function l(u,v,a){this.prev=u.context,this.tagName=v,this.indent=u.indented,this.startOfLine=a,(G.doNotIndent.hasOwnProperty(v)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function h(u){u.context&&(u.context=u.context.prev)}function o(u,v){for(var a;;){if(!u.context)return;if(a=u.context.tagName,!G.contextGrabbers.hasOwnProperty(a)||!G.contextGrabbers[a].hasOwnProperty(v))return;h(u)}}function s(u,v,a){return u=="openTag"?(a.tagStart=v.column(),A):u=="closeTag"?x:s}function A(u,v,a){return u=="word"?(a.tagName=v.current(),b="tag",R):G.allowMissingTagName&&u=="endTag"?(b="tag bracket",R(u,v,a)):(b="error",A)}function x(u,v,a){if(u=="word"){var _=v.current();return a.context&&a.context.tagName!=_&&G.implicitlyClosed.hasOwnProperty(a.context.tagName)&&h(a),a.context&&a.context.tagName==_||G.matchClosing===!1?(b="tag",S):(b="tag error",O)}else return G.allowMissingTagName&&u=="endTag"?(b="tag bracket",S(u,v,a)):(b="error",O)}function S(u,v,a){return u!="endTag"?(b="error",S):(h(a),s)}function O(u,v,a){return b="error",S(u,v,a)}function R(u,v,a){if(u=="word")return b="attribute",C;if(u=="endTag"||u=="selfcloseTag"){var _=a.tagName,N=a.tagStart;return a.tagName=a.tagStart=null,u=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(_)?o(a,_):(o(a,_),a.context=new l(a,_,N==a.indented)),s}return b="error",R}function C(u,v,a){return u=="equals"?w:(G.allowMissing||(b="error"),R(u,v,a))}function w(u,v,a){return u=="string"?y:u=="word"&&G.allowUnquoted?(b="string",R):(b="error",R(u,v,a))}function y(u,v,a){return u=="string"?y:R(u,v,a)}return{startState:function(u){var v={tokenize:m,state:s,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(v.baseIndent=u),v},token:function(u,v){if(!v.tagName&&u.sol()&&(v.indented=u.indentation()),u.eatSpace())return null;L=null;var a=v.tokenize(u,v);return(a||L)&&a!="comment"&&(b=null,v.state=v.state(L||a,u,v),b&&(a=b=="error"?a+" error":b)),a},indent:function(u,v,a){var _=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+P;if(_&&_.noIndent)return le.Pass;if(u.tokenize!=g&&u.tokenize!=m)return a?a.match(/^(\s*)/)[0].length:0;if(u.tagName)return G.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+P*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var N=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(N&&N[1])for(;_;)if(_.tagName==N[2]){_=_.prev;break}else if(G.implicitlyClosed.hasOwnProperty(_.tagName))_=_.prev;else break;else if(N)for(;_;){var B=G.contextGrabbers[_.tagName];if(B&&B.hasOwnProperty(N[2]))_=_.prev;else break}for(;_&&_.prev&&!_.startOfLine;)_=_.prev;return _?_.indent+P:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(u){u.state==w&&(u.state=R)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var v=[],a=u.context;a;a=a.prev)a.tagName&&v.push(a.tagName);return v.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(rt,we,$){"use strict";$.d(we,"a",function(){return X});class le{constructor(D){this.element=D,this.next=le.Undefined,this.prev=le.Undefined}}le.Undefined=new le(void 0);class X{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let D=this._first;for(;D!==le.Undefined;){const Y=D.next;D.prev=le.Undefined,D.next=le.Undefined,D=Y}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(D){return this._insert(D,!1)}push(D){return this._insert(D,!0)}_insert(D,Y){const j=new le(D);if(this._first===le.Undefined)this._first=j,this._last=j;else if(Y){const G=this._last;this._last=j,j.prev=G,G.next=j}else{const G=this._first;this._first=j,j.next=G,G.prev=j}this._size+=1;let P=!1;return()=>{P||(P=!0,this._remove(j))}}shift(){if(this._first===le.Undefined)return;{const D=this._first.element;return this._remove(this._first),D}}pop(){if(this._last===le.Undefined)return;{const D=this._last.element;return this._remove(this._last),D}}_remove(D){if(D.prev!==le.Undefined&&D.next!==le.Undefined){const Y=D.prev;Y.next=D.next,D.next.prev=Y}else D.prev===le.Undefined&&D.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):D.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):D.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let D=this._first;for(;D!==le.Undefined;)yield D.element,D=D.next}}},"3/fG":function(rt,we,$){"use strict";$.d(we,"a",function(){return X});function le(D,Y){let j;return Y.length===0?j=D:j=D.replace(/\{(\d+)\}/g,function(P,G){const W=G[0];return typeof Y[W]!="undefined"?Y[W]:P}),j}function X(D,Y,...j){return le(Y,j)}},"55Ip":function(rt,we,$){"use strict";$.d(we,"a",function(){return o});var le=$("Ty5D"),X=$("dI71"),D=$("q1tI"),Y=$.n(D),j=$("YS25"),P=$("17x9"),G=$.n(P),W=$("wx14"),n=$("zLVn"),L=$("9R94"),b=function(w){Object(X.a)(y,w);function y(){for(var v,a=arguments.length,_=new Array(a),N=0;N<a;N++)_[N]=arguments[N];return v=w.call.apply(w,[this].concat(_))||this,v.history=Object(j.a)(v.props),v}var u=y.prototype;return u.render=function(){return Y.a.createElement(le.c,{history:this.history,children:this.props.children})},y}(Y.a.Component),m=function(w){Object(X.a)(y,w);function y(){for(var v,a=arguments.length,_=new Array(a),N=0;N<a;N++)_[N]=arguments[N];return v=w.call.apply(w,[this].concat(_))||this,v.history=Object(j.b)(v.props),v}var u=y.prototype;return u.render=function(){return Y.a.createElement(le.c,{history:this.history,children:this.props.children})},y}(Y.a.Component),g=function(y,u){return typeof y=="function"?y(u):y},c=function(y,u){return typeof y=="string"?Object(j.c)(y,null,null,u):y},d=function(y){return y},p=Y.a.forwardRef;typeof p=="undefined"&&(p=d);function l(w){return!!(w.metaKey||w.altKey||w.ctrlKey||w.shiftKey)}var h=p(function(w,y){var u=w.innerRef,v=w.navigate,a=w.onClick,_=Object(n.a)(w,["innerRef","navigate","onClick"]),N=_.target,B=Object(W.a)({},_,{onClick:function(U){try{a&&a(U)}catch(M){throw U.preventDefault(),M}!U.defaultPrevented&&U.button===0&&(!N||N==="_self")&&!l(U)&&(U.preventDefault(),v())}});return d!==p?B.ref=y||u:B.ref=u,Y.a.createElement("a",B)}),o=p(function(w,y){var u=w.component,v=u===void 0?h:u,a=w.replace,_=w.to,N=w.innerRef,B=Object(n.a)(w,["component","replace","to","innerRef"]);return Y.a.createElement(le.e.Consumer,null,function(T){T||Object(L.a)(!1);var U=T.history,M=c(g(_,T.location),T.location),E=M?U.createHref(M):"",H=Object(W.a)({},B,{href:E,navigate:function(){var oe=g(_,T.location),de=a?U.replace:U.push;de(oe)}});return d!==p?H.ref=y||N:H.innerRef=N,Y.a.createElement(v,H)})});if(!1)var s,A;var x=function(y){return y},S=Y.a.forwardRef;typeof S=="undefined"&&(S=x);function O(){for(var w=arguments.length,y=new Array(w),u=0;u<w;u++)y[u]=arguments[u];return y.filter(function(v){return v}).join(" ")}var R=S(function(w,y){var u=w["aria-current"],v=u===void 0?"page":u,a=w.activeClassName,_=a===void 0?"active":a,N=w.activeStyle,B=w.className,T=w.exact,U=w.isActive,M=w.location,E=w.sensitive,H=w.strict,Z=w.style,oe=w.to,de=w.innerRef,Te=Object(n.a)(w,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(le.e.Consumer,null,function(be){be||Object(L.a)(!1);var Ae=M||be.location,Ce=c(g(oe,Ae),Ae),_e=Ce.pathname,ge=_e&&_e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),V=ge?Object(le.f)(Ae.pathname,{path:ge,exact:T,sensitive:E,strict:H}):null,I=!!(U?U(V,Ae):V),F=I?O(B,_):B,J=I?Object(W.a)({},Z,{},N):Z,ne=Object(W.a)({"aria-current":I&&v||null,className:F,style:J,to:Ce},Te);return x!==S?ne.ref=y||de:ne.innerRef=de,Y.a.createElement(o,ne)})});if(!1)var C},"5VLF":function(rt,we,$){"use strict";var le,X;function D(Y,j,P){var G=function(W,n){return Y.js_beautify(W,n)};return G.js=Y.js_beautify,G.css=j.css_beautify,G.html=P.html_beautify,G.js_beautify=Y.js_beautify,G.css_beautify=j.css_beautify,G.html_beautify=P.html_beautify,G}!(le=[$("6UM0"),$("TXwP"),$("psGv")],X=function(Y,j,P){return D(Y,j,P)}.apply(we,le),X!==void 0&&(rt.exports=X))},"5Y4S":function(rt,we,$){"use strict";$.d(we,"a",function(){return D});var le=$("MNsG");const X=le.b.performance&&typeof le.b.performance.now=="function";class D{constructor(Y){this._highResolution=X&&Y,this._startTime=this._now(),this._stopTime=-1}static create(Y=!0){return new D(Y)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?le.b.performance.now():Date.now()}}},"6+eU":function(rt,we,$){"use strict";$.d(we,"a",function(){return S});var le=$("wx14"),X=$("rePB"),D=$("VTBJ"),Y=$("1OyB"),j=$("vuIU"),P=$("Ji7U"),G=$("LK+K"),W=$("q1tI"),n=$.n(W),L=$("TSYQ"),b=$.n(L),m=function(R){var C,w="".concat(R.rootPrefixCls,"-item"),y=b()(w,"".concat(w,"-").concat(R.page),(C={},Object(X.a)(C,"".concat(w,"-active"),R.active),Object(X.a)(C,R.className,!!R.className),Object(X.a)(C,"".concat(w,"-disabled"),!R.page),C)),u=function(){R.onClick(R.page)},v=function(_){R.onKeyPress(_,R.onClick,R.page)};return n.a.createElement("li",{title:R.showTitle?R.page:null,className:y,onClick:u,onKeyPress:v,tabIndex:"0"},R.itemRender(R.page,"page",n.a.createElement("a",{rel:"nofollow"},R.page)))},g=m,c={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},d=function(O){Object(P.a)(C,O);var R=Object(G.a)(C);function C(){var w;Object(Y.a)(this,C);for(var y=arguments.length,u=new Array(y),v=0;v<y;v++)u[v]=arguments[v];return w=R.call.apply(R,[this].concat(u)),w.state={goInputText:""},w.buildOptionText=function(a){return"".concat(a," ").concat(w.props.locale.items_per_page)},w.changeSize=function(a){w.props.changeSize(Number(a))},w.handleChange=function(a){w.setState({goInputText:a.target.value})},w.handleBlur=function(a){var _=w.props,N=_.goButton,B=_.quickGo,T=_.rootPrefixCls,U=w.state.goInputText;if(N||U==="")return;if(a.relatedTarget&&(a.relatedTarget.className.indexOf("".concat(T,"-prev"))>=0||a.relatedTarget.className.indexOf("".concat(T,"-next"))>=0))return;w.setState({goInputText:""}),B(w.getValidValue())},w.go=function(a){var _=w.state.goInputText;if(_==="")return;(a.keyCode===c.ENTER||a.type==="click")&&(w.setState({goInputText:""}),w.props.quickGo(w.getValidValue()))},w}return Object(j.a)(C,[{key:"getValidValue",value:function(){var y=this.state,u=y.goInputText,v=y.current;return!u||isNaN(u)?v:Number(u)}},{key:"getPageSizeOptions",value:function(){var y=this.props,u=y.pageSize,v=y.pageSizeOptions;return v.some(function(a){return a.toString()===u.toString()})?v:v.concat([u.toString()]).sort(function(a,_){var N=isNaN(Number(a))?0:Number(a),B=isNaN(Number(_))?0:Number(_);return N-B})}},{key:"render",value:function(){var y=this,u=this.props,v=u.pageSize,a=u.locale,_=u.rootPrefixCls,N=u.changeSize,B=u.quickGo,T=u.goButton,U=u.selectComponentClass,M=u.buildOptionText,E=u.selectPrefixCls,H=u.disabled,Z=this.state.goInputText,oe="".concat(_,"-options"),de=U,Te=null,be=null,Ae=null;if(!N&&!B)return null;var Ce=this.getPageSizeOptions();if(N&&de){var _e=Ce.map(function(ge,V){return n.a.createElement(de.Option,{key:V,value:ge.toString()},(M||y.buildOptionText)(ge))});Te=n.a.createElement(de,{disabled:H,prefixCls:E,showSearch:!1,className:"".concat(oe,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(v||Ce[0]).toString(),onChange:this.changeSize,getPopupContainer:function(V){return V.parentNode}},_e)}return B&&(T&&(Ae=typeof T=="boolean"?n.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:H,className:"".concat(oe,"-quick-jumper-button")},a.jump_to_confirm):n.a.createElement("span",{onClick:this.go,onKeyUp:this.go},T)),be=n.a.createElement("div",{className:"".concat(oe,"-quick-jumper")},a.jump_to,n.a.createElement("input",{disabled:H,type:"text",value:Z,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),a.page,Ae)),n.a.createElement("li",{className:"".concat(oe)},Te,be)}}]),C}(n.a.Component);d.defaultProps={pageSizeOptions:["10","20","50","100"]};var p=d,l=$("N2Kk");function h(){}function o(O){return typeof O=="number"&&isFinite(O)&&Math.floor(O)===O}function s(O,R,C){return C}function A(O,R,C){var w=typeof O=="undefined"?R.pageSize:O;return Math.floor((C.total-1)/w)+1}var x=function(O){Object(P.a)(C,O);var R=Object(G.a)(C);function C(w){var y;Object(Y.a)(this,C),y=R.call(this,w),y.getJumpPrevPage=function(){return Math.max(1,y.state.current-(y.props.showLessItems?3:5))},y.getJumpNextPage=function(){return Math.min(A(void 0,y.state,y.props),y.state.current+(y.props.showLessItems?3:5))},y.getItemIcon=function(N,B){var T=y.props.prefixCls,U=N||n.a.createElement("button",{type:"button","aria-label":B,className:"".concat(T,"-item-link")});return typeof N=="function"&&(U=n.a.createElement(N,Object(D.a)({},y.props))),U},y.savePaginationNode=function(N){y.paginationNode=N},y.isValid=function(N){return o(N)&&N!==y.state.current},y.shouldDisplayQuickJumper=function(){var N=y.props,B=N.showQuickJumper,T=N.pageSize,U=N.total;return U<=T?!1:B},y.handleKeyDown=function(N){(N.keyCode===c.ARROW_UP||N.keyCode===c.ARROW_DOWN)&&N.preventDefault()},y.handleKeyUp=function(N){var B=y.getValidValue(N),T=y.state.currentInputValue;B!==T&&y.setState({currentInputValue:B}),N.keyCode===c.ENTER?y.handleChange(B):N.keyCode===c.ARROW_UP?y.handleChange(B-1):N.keyCode===c.ARROW_DOWN&&y.handleChange(B+1)},y.changePageSize=function(N){var B=y.state.current,T=A(N,y.state,y.props);B=B>T?T:B,T===0&&(B=y.state.current),typeof N=="number"&&("pageSize"in y.props||y.setState({pageSize:N}),"current"in y.props||y.setState({current:B,currentInputValue:B})),y.props.onShowSizeChange(B,N),"onChange"in y.props&&y.props.onChange&&y.props.onChange(B,N)},y.handleChange=function(N){var B=y.props.disabled,T=N;if(y.isValid(T)&&!B){var U=A(void 0,y.state,y.props);T>U?T=U:T<1&&(T=1),"current"in y.props||y.setState({current:T,currentInputValue:T});var M=y.state.pageSize;return y.props.onChange(T,M),T}return y.state.current},y.prev=function(){y.hasPrev()&&y.handleChange(y.state.current-1)},y.next=function(){y.hasNext()&&y.handleChange(y.state.current+1)},y.jumpPrev=function(){y.handleChange(y.getJumpPrevPage())},y.jumpNext=function(){y.handleChange(y.getJumpNextPage())},y.hasPrev=function(){return y.state.current>1},y.hasNext=function(){return y.state.current<A(void 0,y.state,y.props)},y.runIfEnter=function(N,B){if(N.key==="Enter"||N.charCode===13){for(var T=arguments.length,U=new Array(T>2?T-2:0),M=2;M<T;M++)U[M-2]=arguments[M];B.apply(void 0,U)}},y.runIfEnterPrev=function(N){y.runIfEnter(N,y.prev)},y.runIfEnterNext=function(N){y.runIfEnter(N,y.next)},y.runIfEnterJumpPrev=function(N){y.runIfEnter(N,y.jumpPrev)},y.runIfEnterJumpNext=function(N){y.runIfEnter(N,y.jumpNext)},y.handleGoTO=function(N){(N.keyCode===c.ENTER||N.type==="click")&&y.handleChange(y.state.currentInputValue)};var u=w.onChange!==h,v="current"in w;v&&!u&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var a=w.defaultCurrent;"current"in w&&(a=w.current);var _=w.defaultPageSize;return"pageSize"in w&&(_=w.pageSize),a=Math.min(a,A(_,void 0,w)),y.state={current:a,currentInputValue:a,pageSize:_},y}return Object(j.a)(C,[{key:"componentDidUpdate",value:function(y,u){var v=this.props.prefixCls;if(u.current!==this.state.current&&this.paginationNode){var a=this.paginationNode.querySelector(".".concat(v,"-item-").concat(u.current));a&&document.activeElement===a&&a.blur()}}},{key:"getValidValue",value:function(y){var u=y.target.value,v=A(void 0,this.state,this.props),a=this.state.currentInputValue,_;return u===""?_=u:isNaN(Number(u))?_=a:u>=v?_=v:_=Number(u),_}},{key:"getShowSizeChanger",value:function(){var y=this.props,u=y.showSizeChanger,v=y.total,a=y.totalBoundaryShowSizeChanger;return typeof u!="undefined"?u:v>a}},{key:"renderPrev",value:function(y){var u=this.props,v=u.prevIcon,a=u.itemRender,_=a(y,"prev",this.getItemIcon(v,"prev page")),N=!this.hasPrev();return Object(W.isValidElement)(_)?Object(W.cloneElement)(_,{disabled:N}):_}},{key:"renderNext",value:function(y){var u=this.props,v=u.nextIcon,a=u.itemRender,_=a(y,"next",this.getItemIcon(v,"next page")),N=!this.hasNext();return Object(W.isValidElement)(_)?Object(W.cloneElement)(_,{disabled:N}):_}},{key:"render",value:function(){var y=this,u=this.props,v=u.prefixCls,a=u.className,_=u.style,N=u.disabled,B=u.hideOnSinglePage,T=u.total,U=u.locale,M=u.showQuickJumper,E=u.showLessItems,H=u.showTitle,Z=u.showTotal,oe=u.simple,de=u.itemRender,Te=u.showPrevNextJumpers,be=u.jumpPrevIcon,Ae=u.jumpNextIcon,Ce=u.selectComponentClass,_e=u.selectPrefixCls,ge=u.pageSizeOptions,V=this.state,I=V.current,F=V.pageSize,J=V.currentInputValue;if(B===!0&&T<=F)return null;var ne=A(void 0,this.state,this.props),z=[],me=null,Oe=null,ke=null,ce=null,ye=null,Se=M&&M.goButton,Le=E?1:2,Be=I-1>0?I-1:0,We=I+1<ne?I+1:ne,Ke=Object.keys(this.props).reduce(function(ie,ae){return(ae.substr(0,5)==="data-"||ae.substr(0,5)==="aria-"||ae==="role")&&(ie[ae]=y.props[ae]),ie},{});if(oe)return Se&&(typeof Se=="boolean"?ye=n.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},U.jump_to_confirm):ye=n.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Se),ye=n.a.createElement("li",{title:H?"".concat(U.jump_to).concat(I,"/").concat(ne):null,className:"".concat(v,"-simple-pager")},ye)),n.a.createElement("ul",Object(le.a)({className:b()(v,"".concat(v,"-simple"),Object(X.a)({},"".concat(v,"-disabled"),N),a),style:_,ref:this.savePaginationNode},Ke),n.a.createElement("li",{title:H?U.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:b()("".concat(v,"-prev"),Object(X.a)({},"".concat(v,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Be)),n.a.createElement("li",{title:H?"".concat(I,"/").concat(ne):null,className:"".concat(v,"-simple-pager")},n.a.createElement("input",{type:"text",value:J,disabled:N,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),n.a.createElement("span",{className:"".concat(v,"-slash")},"/"),ne),n.a.createElement("li",{title:H?U.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:b()("".concat(v,"-next"),Object(X.a)({},"".concat(v,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(We)),ye);if(ne<=3+Le*2){var Xe={locale:U,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:H,itemRender:de};ne||z.push(n.a.createElement(g,Object(le.a)({},Xe,{key:"noPager",page:ne,className:"".concat(v,"-disabled")})));for(var lt=1;lt<=ne;lt+=1){var Je=I===lt;z.push(n.a.createElement(g,Object(le.a)({},Xe,{key:lt,page:lt,active:Je})))}}else{var qe=E?U.prev_3:U.prev_5,Pe=E?U.next_3:U.next_5;Te&&(me=n.a.createElement("li",{title:H?qe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:b()("".concat(v,"-jump-prev"),Object(X.a)({},"".concat(v,"-jump-prev-custom-icon"),!!be))},de(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(be,"prev page"))),Oe=n.a.createElement("li",{title:H?Pe:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:b()("".concat(v,"-jump-next"),Object(X.a)({},"".concat(v,"-jump-next-custom-icon"),!!Ae))},de(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ae,"next page")))),ce=n.a.createElement(g,{locale:U,last:!0,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ne,page:ne,active:!1,showTitle:H,itemRender:de}),ke=n.a.createElement(g,{locale:U,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:H,itemRender:de});var pt=Math.max(1,I-Le),ut=Math.min(I+Le,ne);I-1<=Le&&(ut=1+Le*2),ne-I<=Le&&(pt=ne-Le*2);for(var ue=pt;ue<=ut;ue+=1){var q=I===ue;z.push(n.a.createElement(g,{locale:U,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ue,page:ue,active:q,showTitle:H,itemRender:de}))}I-1>=Le*2&&I!==1+2&&(z[0]=Object(W.cloneElement)(z[0],{className:"".concat(v,"-item-after-jump-prev")}),z.unshift(me)),ne-I>=Le*2&&I!==ne-2&&(z[z.length-1]=Object(W.cloneElement)(z[z.length-1],{className:"".concat(v,"-item-before-jump-next")}),z.push(Oe)),pt!==1&&z.unshift(ke),ut!==ne&&z.push(ce)}var te=null;Z&&(te=n.a.createElement("li",{className:"".concat(v,"-total-text")},Z(T,[T===0?0:(I-1)*F+1,I*F>T?T:I*F])));var se=!this.hasPrev()||!ne,he=!this.hasNext()||!ne;return n.a.createElement("ul",Object(le.a)({className:b()(v,a,Object(X.a)({},"".concat(v,"-disabled"),N)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},Ke),te,n.a.createElement("li",{title:H?U.prev_page:null,onClick:this.prev,tabIndex:se?null:0,onKeyPress:this.runIfEnterPrev,className:b()("".concat(v,"-prev"),Object(X.a)({},"".concat(v,"-disabled"),se)),"aria-disabled":se},this.renderPrev(Be)),z,n.a.createElement("li",{title:H?U.next_page:null,onClick:this.next,tabIndex:he?null:0,onKeyPress:this.runIfEnterNext,className:b()("".concat(v,"-next"),Object(X.a)({},"".concat(v,"-disabled"),he)),"aria-disabled":he},this.renderNext(We)),n.a.createElement(p,{disabled:N,locale:U,rootPrefixCls:v,selectComponentClass:Ce,selectPrefixCls:_e,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:I,pageSize:F,pageSizeOptions:ge,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Se}))}}],[{key:"getDerivedStateFromProps",value:function(y,u){var v={};if("current"in y&&(v.current=y.current,y.current!==u.current&&(v.currentInputValue=v.current)),"pageSize"in y&&y.pageSize!==u.pageSize){var a=u.current,_=A(y.pageSize,u,y);a=a>_?_:a,"current"in y||(v.current=a,v.currentInputValue=a),v.pageSize=y.pageSize}return v}}]),C}(n.a.Component);x.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:h,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:h,locale:l.a,style:{},itemRender:s,totalBoundaryShowSizeChanger:50};var S=x},"6UM0":function(rt,we,$){var le,X;(function(){var D;(function(){"use strict";var j=[function(n,L,b){var m=b(1).Beautifier,g=b(5).Options;function c(d,p){var l=new m(d,p);return l.beautify()}n.exports=c,n.exports.defaultOptions=function(){return new g}},function(n,L,b){var m=b(2).Output,g=b(3).Token,c=b(4),d=b(5).Options,p=b(7).Tokenizer,l=b(7).line_starters,h=b(7).positionable_operators,o=b(7).TOKEN;function s(E,H){return H.indexOf(E)!==-1}function A(E){return E.replace(/^\s+/g,"")}function x(E){for(var H={},Z=0;Z<E.length;Z++)H[E[Z].replace(/-/g,"_")]=E[Z];return H}function S(E,H){return E&&E.type===o.RESERVED&&E.text===H}function O(E,H){return E&&E.type===o.RESERVED&&s(E.text,H)}var R=["case","return","do","if","throw","else","await","break","continue","async"],C=["before-newline","after-newline","preserve-newline"],w=x(C),y=[w.before_newline,w.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function v(E,H){if(H.multiline_frame||H.mode===u.ForInitializer||H.mode===u.Conditional)return;E.remove_indent(H.start_line_index)}function a(E){E=E.replace(c.allLineBreaks,`
`);for(var H=[],Z=E.indexOf(`
`);Z!==-1;)H.push(E.substring(0,Z)),E=E.substring(Z+1),Z=E.indexOf(`
`);return E.length&&H.push(E),H}function _(E){return E===u.ArrayLiteral}function N(E){return s(E,[u.Expression,u.ForInitializer,u.Conditional])}function B(E,H){for(var Z=0;Z<E.length;Z++){var oe=E[Z].trim();if(oe.charAt(0)!==H)return!1}return!0}function T(E,H){for(var Z=0,oe=E.length,de;Z<oe;Z++)if(de=E[Z],de&&de.indexOf(H)!==0)return!1;return!0}function U(E,H){H=H||{},this._source_text=E||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new d(H)}U.prototype.create_flags=function(E,H){var Z=0;E&&(Z=E.indentation_level,!this._output.just_added_newline()&&E.line_indent_level>Z&&(Z=E.line_indent_level));var oe={mode:H,parent:E,last_token:E?E.last_token:new g(o.START_BLOCK,""),last_word:E?E.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Z,alignment:0,line_indent_level:E?E.line_indent_level:Z,start_line_index:this._output.get_line_number(),ternary_depth:0};return oe},U.prototype._reset=function(E){var H=E.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new m(this._options,H),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var Z=new p(E,this._options);return this._tokens=Z.tokenize(),E},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E,H=this._reset(this._source_text),Z=this._options.eol;this._options.eol==="auto"&&(Z=`
`,H&&c.lineBreak.test(H||"")&&(Z=H.match(c.lineBreak)[0]));for(var oe=this._tokens.next();oe;)this.handle_token(oe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=oe,oe=this._tokens.next();return E=this._output.get_code(Z),E},U.prototype.handle_token=function(E,H){E.type===o.START_EXPR?this.handle_start_expr(E):E.type===o.END_EXPR?this.handle_end_expr(E):E.type===o.START_BLOCK?this.handle_start_block(E):E.type===o.END_BLOCK?this.handle_end_block(E):E.type===o.WORD?this.handle_word(E):E.type===o.RESERVED?this.handle_word(E):E.type===o.SEMICOLON?this.handle_semicolon(E):E.type===o.STRING?this.handle_string(E):E.type===o.EQUALS?this.handle_equals(E):E.type===o.OPERATOR?this.handle_operator(E):E.type===o.COMMA?this.handle_comma(E):E.type===o.BLOCK_COMMENT?this.handle_block_comment(E,H):E.type===o.COMMENT?this.handle_comment(E,H):E.type===o.DOT?this.handle_dot(E):E.type===o.EOF?this.handle_eof(E):E.type===o.UNKNOWN?this.handle_unknown(E,H):this.handle_unknown(E,H)},U.prototype.handle_whitespace_and_comments=function(E,H){var Z=E.newlines,oe=this._options.keep_array_indentation&&_(this._flags.mode);if(E.comments_before)for(var de=E.comments_before.next();de;)this.handle_whitespace_and_comments(de,H),this.handle_token(de,H),de=E.comments_before.next();if(oe)for(var Te=0;Te<Z;Te+=1)this.print_newline(Te>0,H);else if(this._options.max_preserve_newlines&&Z>this._options.max_preserve_newlines&&(Z=this._options.max_preserve_newlines),this._options.preserve_newlines&&Z>1){this.print_newline(!1,H);for(var be=1;be<Z;be+=1)this.print_newline(!0,H)}};var M=["async","break","continue","return","throw","yield"];U.prototype.allow_wrap_or_preserved_newline=function(E,H){if(H=H===void 0?!1:H,this._output.just_added_newline())return;var Z=this._options.preserve_newlines&&E.newlines||H,oe=s(this._flags.last_token.text,h)||s(E.text,h);if(oe){var de=s(this._flags.last_token.text,h)&&s(this._options.operator_position,y)||s(E.text,h);Z=Z&&de}if(Z)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,M))return;this._output.set_wrap_point()}},U.prototype.print_newline=function(E,H){if(!H&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Z=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&S(Z,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(E)&&(this._flags.multiline_frame=!0)},U.prototype.print_token_line_indentation=function(E){this._output.just_added_newline()&&(this._options.keep_array_indentation&&E.newlines&&(E.text==="["||_(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(E.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},U.prototype.print_token=function(E){if(this._output.raw){this._output.add_raw_token(E);return}if(this._options.comma_first&&E.previous&&E.previous.type===o.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var H=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(H),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(E),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(E),this._output.non_breaking_space=!0,this._output.add_token(E.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},U.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.set_mode=function(E){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,E),this._flags=this.create_flags(this._previous_flags,E),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&v(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},U.prototype.start_of_statement=function(E){var H=!1;return H=H||O(this._flags.last_token,["var","let","const"])&&E.type===o.WORD,H=H||S(this._flags.last_token,"do"),H=H||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&O(this._flags.last_token,M)&&!E.newlines,H=H||S(this._flags.last_token,"else")&&!(S(E,"if")&&!E.comments_before),H=H||this._flags.last_token.type===o.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),H=H||this._flags.last_token.type===o.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(E.text==="--"||E.text==="++")&&this._last_last_text!=="function"&&E.type!==o.WORD&&E.type!==o.RESERVED,H=H||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),H?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(E,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(E,O(E,["do","for","if","while"])),!0):!1},U.prototype.handle_start_expr=function(E){this.start_of_statement(E)||this.handle_whitespace_and_comments(E);var H=u.Expression;if(E.text==="["){if(this._flags.last_token.type===o.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(E),this.set_mode(H),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}H=u.ArrayLiteral,_(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),s(this._flags.last_token.type,[o.START_EXPR,o.END_EXPR,o.WORD,o.OPERATOR,o.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===o.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,H=u.ForInitializer):s(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,H=u.Conditional):s(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&E.whitespace_before===""?this._output.space_before_token=!1:(s(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(E);else if(this._flags.last_token.type===o.WORD){this._output.space_before_token=!1;var Z=this._tokens.peek(-3);if(this._options.space_after_named_function&&Z){var oe=this._tokens.peek(-4);O(Z,["async","function"])||Z.text==="*"&&O(oe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(Z.text==="{"||Z.text===","||Z.text==="*"&&(oe.text==="{"||oe.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(E);(this._flags.last_token.type===o.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(s(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&s(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===o.START_BLOCK?this.print_newline():(this._flags.last_token.type===o.END_EXPR||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===o.COMMA)&&this.allow_wrap_or_preserved_newline(E,E.newlines),this.print_token(E),this.set_mode(H),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},U.prototype.handle_end_expr=function(E){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(E),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(E,E.text==="]"&&_(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===o.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(E),this.restore_mode(),v(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},U.prototype.handle_start_block=function(E){this.handle_whitespace_and_comments(E);var H=this._tokens.peek(),Z=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===o.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):Z&&(s(Z.text,[":",","])&&s(H.type,[o.STRING,o.WORD,o.RESERVED])||s(H.text,["get","set","..."])&&s(Z.type,[o.WORD,o.RESERVED]))?s(this._last_last_text,["class","interface"])&&!s(Z.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===o.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):s(this._flags.last_token.type,[o.EQUALS,o.START_EXPR,o.COMMA,o.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var oe=!H.comments_before&&H.text==="}",de=oe&&this._flags.last_word==="function"&&this._flags.last_token.type===o.END_EXPR;if(this._options.brace_preserve_inline){var Te=0,be=null;this._flags.inline_frame=!0;do if(Te+=1,be=this._tokens.peek(Te-1),be.newlines){this._flags.inline_frame=!1;break}while(be.type!==o.EOF&&!(be.type===o.END_BLOCK&&be.opened===E))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&E.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==o.OPERATOR&&(de||this._flags.last_token.type===o.EQUALS||O(this._flags.last_token,R)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(_(this._previous_flags.mode)&&(this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.COMMA)&&((this._flags.last_token.type===o.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(E),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==o.OPERATOR&&this._flags.last_token.type!==o.START_EXPR&&(this._flags.last_token.type===o.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(E),this.indent(),!oe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},U.prototype.handle_end_block=function(E){for(this.handle_whitespace_and_comments(E);this._flags.mode===u.Statement;)this.restore_mode();var H=this._flags.last_token.type===o.START_BLOCK;this._flags.inline_frame&&!H?this._output.space_before_token=!0:this._options.brace_style==="expand"?H||this.print_newline():H||(_(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(E)},U.prototype.handle_word=function(E){if(E.type===o.RESERVED){if(s(E.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)E.type=o.WORD;else if(E.text==="import"&&s(this._tokens.peek().text,["(","."]))E.type=o.WORD;else if(s(E.text,["as","from"])&&!this._flags.import_block)E.type=o.WORD;else if(this._flags.mode===u.ObjectLiteral){var H=this._tokens.peek();H.text===":"&&(E.type=o.WORD)}}if(this.start_of_statement(E)?O(this._flags.last_token,["var","let","const"])&&E.type===o.WORD&&(this._flags.declaration_statement=!0):E.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==o.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(E),this.print_newline()):this.handle_whitespace_and_comments(E),this._flags.do_block&&!this._flags.do_while)if(S(E,"while")){this._output.space_before_token=!0,this.print_token(E),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&S(E,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(E,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(E),this._flags.in_case=!0;return}if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(E)),S(E,"function")){(s(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(s(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===o.OPERATOR))&&(!this._output.just_added_blankline()&&!E.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,M)?this._output.space_before_token=!0:S(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===o.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||_(this._flags.mode))||this.print_newline(),this.print_token(E),this._flags.last_word=E.text;return}var Z="NONE";if(this._flags.last_token.type===o.END_BLOCK?this._previous_flags.inline_frame?Z="SPACE":O(E,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&E.newlines?Z="NEWLINE":(Z="SPACE",this._output.space_before_token=!0):Z="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&this._flags.mode===u.BlockStatement?Z="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&N(this._flags.mode)?Z="SPACE":this._flags.last_token.type===o.STRING?Z="NEWLINE":this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.last_token.text==="*"&&(s(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&s(this._last_last_text,["{",","]))?Z="SPACE":this._flags.last_token.type===o.START_BLOCK?this._flags.inline_frame?Z="SPACE":Z="NEWLINE":this._flags.last_token.type===o.END_EXPR&&(this._output.space_before_token=!0,Z="NEWLINE"),O(E,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Z="SPACE":Z="NEWLINE"),O(E,["else","catch","finally"]))if((!(this._flags.last_token.type===o.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&E.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var oe=this._output.current_line;oe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Z==="NEWLINE"?O(this._flags.last_token,R)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(E,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==o.END_EXPR?(this._flags.last_token.type!==o.START_EXPR||!O(E,["var","let","const"]))&&this._flags.last_token.text!==":"&&(S(E,"if")&&S(E.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(E,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&_(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Z==="SPACE"&&(this._output.space_before_token=!0);E.previous&&(E.previous.type===o.WORD||E.previous.type===o.RESERVED)&&(this._output.space_before_token=!0),this.print_token(E),this._flags.last_word=E.text,E.type===o.RESERVED&&(E.text==="do"?this._flags.do_block=!0:E.text==="if"?this._flags.if_block=!0:E.text==="import"?this._flags.import_block=!0:this._flags.import_block&&S(E,"from")&&(this._flags.import_block=!1))},U.prototype.handle_semicolon=function(E){this.start_of_statement(E)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(E);for(var H=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&S(H,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(E)},U.prototype.handle_string=function(E){E.text.startsWith("`")&&E.newlines===0&&E.whitespace_before===""&&(E.previous.text===")"||this._flags.last_token.type===o.WORD)||(this.start_of_statement(E)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(E),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(E):E.text.startsWith("`")&&this._flags.last_token.type===o.END_EXPR&&(E.previous.text==="]"||E.previous.text===")")&&E.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(E)},U.prototype.handle_equals=function(E){this.start_of_statement(E)||this.handle_whitespace_and_comments(E),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(E),this._output.space_before_token=!0},U.prototype.handle_comma=function(E){this.handle_whitespace_and_comments(E,!0),this.print_token(E),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(E)):this._flags.mode===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(E)},U.prototype.handle_operator=function(E){var H=E.text==="*"&&(O(this._flags.last_token,["function","yield"])||s(this._flags.last_token.type,[o.START_BLOCK,o.COMMA,o.END_BLOCK,o.SEMICOLON])),Z=s(E.text,["-","+"])&&(s(this._flags.last_token.type,[o.START_BLOCK,o.START_EXPR,o.EQUALS,o.OPERATOR])||s(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(E)){var oe=!H;this.handle_whitespace_and_comments(E,oe)}if(E.text==="*"&&this._flags.last_token.type===o.DOT){this.print_token(E);return}if(E.text==="::"){this.print_token(E);return}if(this._flags.last_token.type===o.OPERATOR&&s(this._options.operator_position,y)&&this.allow_wrap_or_preserved_newline(E),E.text===":"&&this._flags.in_case){this.print_token(E),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==o.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var de=!0,Te=!0,be=!1;if(E.text===":"?this._flags.ternary_depth===0?de=!1:(this._flags.ternary_depth-=1,be=!0):E.text==="?"&&(this._flags.ternary_depth+=1),!Z&&!H&&this._options.preserve_newlines&&s(E.text,h)){var Ae=E.text===":",Ce=Ae&&be,_e=Ae&&!be;switch(this._options.operator_position){case w.before_newline:this._output.space_before_token=!_e,this.print_token(E),(!Ae||Ce)&&this.allow_wrap_or_preserved_newline(E),this._output.space_before_token=!0;return;case w.after_newline:this._output.space_before_token=!0,!Ae||Ce?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(E):this._output.space_before_token=!1,this.print_token(E),this._output.space_before_token=!0;return;case w.preserve_newline:_e||this.allow_wrap_or_preserved_newline(E),de=!(this._output.just_added_newline()||_e),this._output.space_before_token=de,this.print_token(E),this._output.space_before_token=!0;return}}if(H){this.allow_wrap_or_preserved_newline(E),de=!1;var ge=this._tokens.peek();Te=ge&&s(ge.type,[o.WORD,o.RESERVED])}else if(E.text==="...")this.allow_wrap_or_preserved_newline(E),de=this._flags.last_token.type===o.START_BLOCK,Te=!1;else if(s(E.text,["--","++","!","~"])||Z){if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR)&&this.allow_wrap_or_preserved_newline(E),de=!1,Te=!1,E.newlines&&(E.text==="--"||E.text==="++"||E.text==="~")){var V=O(this._flags.last_token,R)&&E.newlines;V&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(V,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(de=!0),this._flags.last_token.type===o.RESERVED?de=!0:this._flags.last_token.type===o.END_EXPR?de=!(this._flags.last_token.text==="]"&&(E.text==="--"||E.text==="++")):this._flags.last_token.type===o.OPERATOR&&(de=s(E.text,["--","-","++","+"])&&s(this._flags.last_token.text,["--","-","++","+"]),s(E.text,["+","-"])&&s(this._flags.last_token.text,["--","++"])&&(Te=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||de,this.print_token(E),this._output.space_before_token=Te},U.prototype.handle_block_comment=function(E,H){if(this._output.raw){this._output.add_raw_token(E),E.directives&&E.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(E.directives){this.print_newline(!1,H),this.print_token(E),E.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!c.newline.test(E.text)&&!E.newlines){this._output.space_before_token=!0,this.print_token(E),this._output.space_before_token=!0;return}else this.print_block_commment(E,H)},U.prototype.print_block_commment=function(E,H){var Z=a(E.text),oe,de=!1,Te=!1,be=E.whitespace_before,Ae=be.length;if(this.print_newline(!1,H),this.print_token_line_indentation(E),this._output.add_token(Z[0]),this.print_newline(!1,H),Z.length>1){for(Z=Z.slice(1),de=B(Z,"*"),Te=T(Z,be),de&&(this._flags.alignment=1),oe=0;oe<Z.length;oe++)de?(this.print_token_line_indentation(E),this._output.add_token(A(Z[oe]))):Te&&Z[oe]?(this.print_token_line_indentation(E),this._output.add_token(Z[oe].substring(Ae))):(this._output.current_line.set_indent(-1),this._output.add_token(Z[oe])),this.print_newline(!1,H);this._flags.alignment=0}},U.prototype.handle_comment=function(E,H){E.newlines?this.print_newline(!1,H):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(E),this.print_newline(!1,H)},U.prototype.handle_dot=function(E){this.start_of_statement(E)||this.handle_whitespace_and_comments(E,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,R)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(E,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(E)},U.prototype.handle_unknown=function(E,H){this.print_token(E),E.text[E.text.length-1]===`
`&&this.print_newline(!1,H)},U.prototype.handle_eof=function(E){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(E)},n.exports.Beautifier=U},function(n){function L(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var g=new L(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},L.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},L.prototype.has_match=function(g){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(g))return!0;return!1},L.prototype.set_indent=function(g,c){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(g){this.__items.push(g);var c=g.lastIndexOf(`
`);c!==-1?this.__character_count=g.length-c:this.__character_count+=g.length},L.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function b(g,c){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),c=c||"",g.indent_level>0&&(c=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}b.prototype.get_indent_size=function(g,c){var d=this.__base_string_length;return c=c||0,g<0&&(d=0),d+=g*this.__indent_size,d+=c,d},b.prototype.get_indent_string=function(g,c){var d=this.__base_string;return c=c||0,g<0&&(g=0,d=""),c+=g*this.__indent_size,this.__ensure_cache(c),d+=this.__cache[c],d},b.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},b.prototype.__add_column=function(){var g=this.__cache.length,c=0,d="";this.__indent_size&&g>=this.__indent_size&&(c=Math.floor(g/this.__indent_size),g-=c*this.__indent_size,d=new Array(c+1).join(this.__indent_string)),g&&(d+=new Array(g+1).join(" ")),this.__cache.push(d)};function m(g,c){this.__indent_cache=new b(g,c),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(g,c){return this.__indent_cache.get_indent_string(g,c)},m.prototype.get_indent_size=function(g,c){return this.__indent_cache.get_indent_size(g,c)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(g){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var d=this.__lines.join(`
`);return g!==`
`&&(d=d.replace(/[\n]/g,g)),d},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(g,c){return g=g||0,c=c||0,this.next_line.set_indent(g,c),this.__lines.length>1?(this.current_line.set_indent(g,c),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(g){for(var c=0;c<g.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(g){for(var c=this.__lines.length;g<c;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(g,c){for(var d=this.__lines.length-2;d>=0;){var p=this.__lines[d];if(p.is_empty())break;if(p.item(0).indexOf(g)!==0&&p.item(-1)!==c){this.__lines.splice(d+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}d--}},n.exports.Output=m},function(n){function L(b,m,g,c){this.type=b,this.text=m,this.comments_before=null,this.newlines=g||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}n.exports.Token=L},function(n,L){var b="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",c="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",d="(?:\\\\u[0-9a-fA-F]{4}|["+b+g+"])",p="(?:\\\\u[0-9a-fA-F]{4}|["+m+g+c+"])*";L.identifier=new RegExp(d+p,"g"),L.identifierStart=new RegExp(d),L.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+m+g+c+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;L.newline=/[\n\r\u2028\u2029]/,L.lineBreak=new RegExp(`\r
|`+L.newline.source),L.allLineBreaks=new RegExp(L.lineBreak.source,"g")},function(n,L,b){var m=b(6).Options,g=["before-newline","after-newline","preserve-newline"];function c(d){m.call(this,d,"js");var p=this.raw_options.brace_style||null;p==="expand-strict"?this.raw_options.brace_style="expand":p==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var h=0;h<l.length;h++)l[h]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[h];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}c.prototype=new m,n.exports.Options=c},function(n){function L(g,c){this.raw_options=b(g,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(g,c){var d=this.raw_options[g],p=c||[];return typeof d=="object"?d!==null&&typeof d.concat=="function"&&(p=d.concat()):typeof d=="string"&&(p=d.split(/[^a-zA-Z0-9_\/\-]+/)),p},L.prototype._get_boolean=function(g,c){var d=this.raw_options[g],p=d===void 0?!!c:!!d;return p},L.prototype._get_characters=function(g,c){var d=this.raw_options[g],p=c||"";return typeof d=="string"&&(p=d.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),p},L.prototype._get_number=function(g,c){var d=this.raw_options[g];c=parseInt(c,10),isNaN(c)&&(c=0);var p=parseInt(d,10);return isNaN(p)&&(p=c),p},L.prototype._get_selection=function(g,c,d){var p=this._get_selection_list(g,c,d);if(p.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+c+`
You passed in: '`+this.raw_options[g]+"'");return p[0]},L.prototype._get_selection_list=function(g,c,d){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(d=d||[c[0]],!this._is_valid_selection(d,c))throw new Error("Invalid Default Value!");var p=this._get_array(g,d);if(!this._is_valid_selection(p,c))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+c+`
You passed in: '`+this.raw_options[g]+"'");return p},L.prototype._is_valid_selection=function(g,c){return g.length&&c.length&&!g.some(function(d){return c.indexOf(d)===-1})};function b(g,c){var d={};g=m(g);var p;for(p in g)p!==c&&(d[p]=g[p]);if(c&&g[c])for(p in g[c])d[p]=g[c][p];return d}function m(g){var c={},d;for(d in g){var p=d.replace(/-/g,"_");c[p]=g[d]}return c}n.exports.Options=L,n.exports.normalizeOpts=m,n.exports.mergeOpts=b},function(n,L,b){var m=b(8).InputScanner,g=b(9).Tokenizer,c=b(9).TOKEN,d=b(13).Directives,p=b(4),l=b(12).Pattern,h=b(14).TemplatablePattern;function o(B,T){return T.indexOf(B)!==-1}var s={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:c.START,RAW:c.RAW,EOF:c.EOF},A=new d(/\/\*/,/\*\//),x=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,S=/[0-9]/,O=/[^\d\.]/,R=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),C=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";C=C.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),C="\\?\\.(?!\\d) "+C,C=C.replace(/ /g,"|");var w=new RegExp(C),y="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=y.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),v=new RegExp("^(?:"+u.join("|")+")$"),a,_=function(B,T){g.call(this,B,T),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var U=new l(this._input),M=new h(this._input).read_options(this._options);this.__patterns={template:M,identifier:M.starting_with(p.identifier).matching(p.identifierMatch),number:U.matching(x),punct:U.matching(w),comment:U.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:U.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:U.matching(/<!--/),html_comment_end:U.matching(/-->/),include:U.starting_with(/#include/).until_after(p.lineBreak),shebang:U.starting_with(/#!/).until_after(p.lineBreak),xml:U.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:M.until(/['\\\n\r\u2028\u2029]/),double_quote:M.until(/["\\\n\r\u2028\u2029]/),template_text:M.until(/[`\\$]/),template_expression:M.until(/[`}\\]/)}};_.prototype=new g,_.prototype._is_comment=function(B){return B.type===s.COMMENT||B.type===s.BLOCK_COMMENT||B.type===s.UNKNOWN},_.prototype._is_opening=function(B){return B.type===s.START_BLOCK||B.type===s.START_EXPR},_.prototype._is_closing=function(B,T){return(B.type===s.END_BLOCK||B.type===s.END_EXPR)&&T&&(B.text==="]"&&T.text==="["||B.text===")"&&T.text==="("||B.text==="}"&&T.text==="{")},_.prototype._reset=function(){a=!1},_.prototype._get_next_token=function(B,T){var U=null;this._readWhitespace();var M=this._input.peek();return M===null?this._create_token(s.EOF,""):(U=U||this._read_non_javascript(M),U=U||this._read_string(M),U=U||this._read_word(B),U=U||this._read_singles(M),U=U||this._read_comment(M),U=U||this._read_regexp(M,B),U=U||this._read_xml(M,B),U=U||this._read_punctuation(),U=U||this._create_token(s.UNKNOWN,this._input.next()),U)},_.prototype._read_word=function(B){var T;if(T=this.__patterns.identifier.read(),T!=="")return T=T.replace(p.allLineBreaks,`
`),!(B.type===s.DOT||B.type===s.RESERVED&&(B.text==="set"||B.text==="get"))&&v.test(T)?(T==="in"||T==="of")&&(B.type===s.WORD||B.type===s.STRING)?this._create_token(s.OPERATOR,T):this._create_token(s.RESERVED,T):this._create_token(s.WORD,T);if(T=this.__patterns.number.read(),T!=="")return this._create_token(s.WORD,T)},_.prototype._read_singles=function(B){var T=null;return B==="("||B==="["?T=this._create_token(s.START_EXPR,B):B===")"||B==="]"?T=this._create_token(s.END_EXPR,B):B==="{"?T=this._create_token(s.START_BLOCK,B):B==="}"?T=this._create_token(s.END_BLOCK,B):B===";"?T=this._create_token(s.SEMICOLON,B):B==="."&&O.test(this._input.peek(1))?T=this._create_token(s.DOT,B):B===","&&(T=this._create_token(s.COMMA,B)),T&&this._input.next(),T},_.prototype._read_punctuation=function(){var B=this.__patterns.punct.read();if(B!=="")return B==="="?this._create_token(s.EQUALS,B):B==="?."?this._create_token(s.DOT,B):this._create_token(s.OPERATOR,B)},_.prototype._read_non_javascript=function(B){var T="";if(B==="#"){if(this._is_first_token()&&(T=this.__patterns.shebang.read(),T))return this._create_token(s.UNKNOWN,T.trim()+`
`);if(T=this.__patterns.include.read(),T)return this._create_token(s.UNKNOWN,T.trim()+`
`);B=this._input.next();var U="#";if(this._input.hasNext()&&this._input.testChar(S)){do B=this._input.next(),U+=B;while(this._input.hasNext()&&B!=="#"&&B!=="=");return B==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(U+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(U+="{}",this._input.next(),this._input.next())),this._create_token(s.WORD,U)}this._input.back()}else if(B==="<"&&this._is_first_token()){if(T=this.__patterns.html_comment_start.read(),T){for(;this._input.hasNext()&&!this._input.testChar(p.newline);)T+=this._input.next();return a=!0,this._create_token(s.COMMENT,T)}}else if(a&&B==="-"&&(T=this.__patterns.html_comment_end.read(),T))return a=!1,this._create_token(s.COMMENT,T);return null},_.prototype._read_comment=function(B){var T=null;if(B==="/"){var U="";if(this._input.peek(1)==="*"){U=this.__patterns.block_comment.read();var M=A.get_directives(U);M&&M.ignore==="start"&&(U+=A.readIgnored(this._input)),U=U.replace(p.allLineBreaks,`
`),T=this._create_token(s.BLOCK_COMMENT,U),T.directives=M}else this._input.peek(1)==="/"&&(U=this.__patterns.comment.read(),T=this._create_token(s.COMMENT,U))}return T},_.prototype._read_string=function(B){if(B==="`"||B==="'"||B==='"'){var T=this._input.next();return this.has_char_escapes=!1,B==="`"?T+=this._read_string_recursive("`",!0,"${"):T+=this._read_string_recursive(B),this.has_char_escapes&&this._options.unescape_strings&&(T=N(T)),this._input.peek()===B&&(T+=this._input.next()),T=T.replace(p.allLineBreaks,`
`),this._create_token(s.STRING,T)}return null},_.prototype._allow_regexp_or_xml=function(B){return B.type===s.RESERVED&&o(B.text,["return","case","throw","else","do","typeof","yield"])||B.type===s.END_EXPR&&B.text===")"&&B.opened.previous.type===s.RESERVED&&o(B.opened.previous.text,["if","while","for"])||o(B.type,[s.COMMENT,s.START_EXPR,s.START_BLOCK,s.START,s.END_BLOCK,s.OPERATOR,s.EQUALS,s.EOF,s.SEMICOLON,s.COMMA])},_.prototype._read_regexp=function(B,T){if(B==="/"&&this._allow_regexp_or_xml(T)){for(var U=this._input.next(),M=!1,E=!1;this._input.hasNext()&&(M||E||this._input.peek()!==B)&&!this._input.testChar(p.newline);)U+=this._input.peek(),M?M=!1:(M=this._input.peek()==="\\",this._input.peek()==="["?E=!0:this._input.peek()==="]"&&(E=!1)),this._input.next();return this._input.peek()===B&&(U+=this._input.next(),U+=this._input.read(p.identifier)),this._create_token(s.STRING,U)}return null},_.prototype._read_xml=function(B,T){if(this._options.e4x&&B==="<"&&this._allow_regexp_or_xml(T)){var U="",M=this.__patterns.xml.read_match();if(M){for(var E=M[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),H=E.indexOf("{")===0,Z=0;M;){var oe=!!M[1],de=M[2],Te=!!M[M.length-1]||de.slice(0,8)==="![CDATA[";if(!Te&&(de===E||H&&de.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(oe?--Z:++Z),U+=M[0],Z<=0)break;M=this.__patterns.xml.read_match()}return M||(U+=this._input.match(/[\s\S]*/g)[0]),U=U.replace(p.allLineBreaks,`
`),this._create_token(s.STRING,U)}}return null};function N(B){for(var T="",U=0,M=new m(B),E=null;M.hasNext();)if(E=M.match(/([\s]|[^\\]|\\\\)+/g),E&&(T+=E[0]),M.peek()==="\\"){if(M.next(),M.peek()==="x")E=M.match(/x([0-9A-Fa-f]{2})/g);else if(M.peek()==="u")E=M.match(/u([0-9A-Fa-f]{4})/g);else{T+="\\",M.hasNext()&&(T+=M.next());continue}if(!E)return B;if(U=parseInt(E[1],16),U>126&&U<=255&&E[0].indexOf("x")===0)return B;if(U>=0&&U<32){T+="\\"+E[0];continue}else U===34||U===39||U===92?T+="\\"+String.fromCharCode(U):T+=String.fromCharCode(U)}return T}_.prototype._read_string_recursive=function(B,T,U){var M,E;B==="'"?E=this.__patterns.single_quote:B==='"'?E=this.__patterns.double_quote:B==="`"?E=this.__patterns.template_text:B==="}"&&(E=this.__patterns.template_expression);for(var H=E.read(),Z="";this._input.hasNext();){if(Z=this._input.next(),Z===B||!T&&p.newline.test(Z)){this._input.back();break}else Z==="\\"&&this._input.hasNext()?(M=this._input.peek(),M==="x"||M==="u"?this.has_char_escapes=!0:M==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Z+=this._input.next()):U&&(U==="${"&&Z==="$"&&this._input.peek()==="{"&&(Z+=this._input.next()),U===Z&&(B==="`"?Z+=this._read_string_recursive("}",T,"`"):Z+=this._read_string_recursive("`",T,"${"),this._input.hasNext()&&(Z+=this._input.next())));Z+=E.read(),H+=Z}return H},n.exports.Tokenizer=_,n.exports.TOKEN=s,n.exports.positionable_operators=R.slice(),n.exports.line_starters=y.slice()},function(n){var L=RegExp.prototype.hasOwnProperty("sticky");function b(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}b.prototype.restart=function(){this.__position=0},b.prototype.back=function(){this.__position>0&&(this.__position-=1)},b.prototype.hasNext=function(){return this.__position<this.__input_length},b.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},b.prototype.peek=function(m){var g=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(g=this.__input.charAt(m)),g},b.prototype.__match=function(m,g){m.lastIndex=g;var c=m.exec(this.__input);return c&&!(L&&m.sticky)&&(c.index!==g&&(c=null)),c},b.prototype.test=function(m,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(m,g):!1},b.prototype.testChar=function(m,g){var c=this.peek(g);return m.lastIndex=0,c!==null&&m.test(c)},b.prototype.match=function(m){var g=this.__match(m,this.__position);return g?this.__position+=g[0].length:g=null,g},b.prototype.read=function(m,g,c){var d="",p;return m&&(p=this.match(m),p&&(d+=p[0])),g&&(p||!m)&&(d+=this.readUntil(g,c)),d},b.prototype.readUntil=function(m,g){var c="",d=this.__position;m.lastIndex=this.__position;var p=m.exec(this.__input);return p?(d=p.index,g&&(d+=p[0].length)):d=this.__input_length,c=this.__input.substring(this.__position,d),this.__position=d,c},b.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},b.prototype.get_regexp=function(m,g){var c=null,d="g";return g&&L&&(d="y"),typeof m=="string"&&m!==""?c=new RegExp(m,d):m&&(c=new RegExp(m.source,d)),c},b.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},b.prototype.peekUntilAfter=function(m){var g=this.__position,c=this.readUntilAfter(m);return this.__position=g,c},b.prototype.lookBack=function(m){var g=this.__position-1;return g>=m.length&&this.__input.substring(g-m.length,g).toLowerCase()===m},n.exports.InputScanner=b},function(n,L,b){var m=b(8).InputScanner,g=b(3).Token,c=b(10).TokenStream,d=b(11).WhitespacePattern,p={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(h,o){this._input=new m(h),this._options=o||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new d(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,o=new g(p.START,""),s=null,A=[],x=new c;o.type!==p.EOF;){for(h=this._get_next_token(o,s);this._is_comment(h);)x.add(h),h=this._get_next_token(o,s);x.isEmpty()||(h.comments_before=x,x=new c),h.parent=s,this._is_opening(h)?(A.push(s),s=h):s&&this._is_closing(h,s)&&(h.opened=s,s.closed=h,s=A.pop(),h.parent=s),h.previous=o,o.next=h,this.__tokens.add(h),o=h}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(h,o){this._readWhitespace();var s=this._input.read(/.+/g);return s?this._create_token(p.RAW,s):this._create_token(p.EOF,"")},l.prototype._is_comment=function(h){return!1},l.prototype._is_opening=function(h){return!1},l.prototype._is_closing=function(h,o){return!1},l.prototype._create_token=function(h,o){var s=new g(h,o,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return s},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},n.exports.Tokenizer=l,n.exports.TOKEN=p},function(n){function L(b){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=b}L.prototype.restart=function(){this.__position=0},L.prototype.isEmpty=function(){return this.__tokens_length===0},L.prototype.hasNext=function(){return this.__position<this.__tokens_length},L.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__tokens[this.__position],this.__position+=1),b},L.prototype.peek=function(b){var m=null;return b=b||0,b+=this.__position,b>=0&&b<this.__tokens_length&&(m=this.__tokens[b]),m},L.prototype.add=function(b){this.__parent_token&&(b.parent=this.__parent_token),this.__tokens.push(b),this.__tokens_length+=1},n.exports.TokenStream=L},function(n,L,b){var m=b(12).Pattern;function g(c,d){m.call(this,c,d),d?this._line_regexp=this._input.get_regexp(d._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new m,g.prototype.__set_whitespace_patterns=function(c,d){c+="\\t ",d+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+d+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+d+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var d=this.__split(this._newline_regexp,c);this.newline_count=d.length-1,this.whitespace_before_token=d[this.newline_count]}return c},g.prototype.matching=function(c,d){var p=this._create();return p.__set_whitespace_patterns(c,d),p._update(),p},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(c,d){c.lastIndex=0;for(var p=0,l=[],h=c.exec(d);h;)l.push(d.substring(p,h.index)),p=h.index+h[0].length,h=c.exec(d);return p<d.length?l.push(d.substring(p,d.length)):l.push(""),l},n.exports.WhitespacePattern=g},function(n){function L(b,m){this._input=b,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,m&&(this._starting_pattern=this._input.get_regexp(m._starting_pattern,!0),this._match_pattern=this._input.get_regexp(m._match_pattern,!0),this._until_pattern=this._input.get_regexp(m._until_pattern),this._until_after=m._until_after)}L.prototype.read=function(){var b=this._input.read(this._starting_pattern);return(!this._starting_pattern||b)&&(b+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),b},L.prototype.read_match=function(){return this._input.match(this._match_pattern)},L.prototype.until_after=function(b){var m=this._create();return m._until_after=!0,m._until_pattern=this._input.get_regexp(b),m._update(),m},L.prototype.until=function(b){var m=this._create();return m._until_after=!1,m._until_pattern=this._input.get_regexp(b),m._update(),m},L.prototype.starting_with=function(b){var m=this._create();return m._starting_pattern=this._input.get_regexp(b,!0),m._update(),m},L.prototype.matching=function(b){var m=this._create();return m._match_pattern=this._input.get_regexp(b,!0),m._update(),m},L.prototype._create=function(){return new L(this._input,this)},L.prototype._update=function(){},n.exports.Pattern=L},function(n){function L(b,m){b=typeof b=="string"?b:b.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(b+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(b+/\sbeautify\signore:end\s/.source+m,"g")}L.prototype.get_directives=function(b){if(!b.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(b);g;)m[g[1]]=g[2],g=this.__directive_pattern.exec(b);return m},L.prototype.readIgnored=function(b){return b.readUntilAfter(this.__directives_end_ignore_pattern)},n.exports.Directives=L},function(n,L,b){var m=b(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(d,p){m.call(this,d,p),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),p&&(this.__template_pattern=this._input.get_regexp(p.__template_pattern),this._excluded=Object.assign(this._excluded,p._excluded),this._disabled=Object.assign(this._disabled,p._disabled));var l=new m(d);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}c.prototype=new m,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(d){var p=this._create();return p._disabled[d]=!0,p._update(),p},c.prototype.read_options=function(d){var p=this._create();for(var l in g)p._disabled[l]=d.templating.indexOf(l)===-1;return p._update(),p},c.prototype.exclude=function(d){var p=this._create();return p._excluded[d]=!0,p._update(),p},c.prototype.read=function(){var d="";this._match_pattern?d=this._input.read(this._starting_pattern):d=this._input.read(this._starting_pattern,this.__template_pattern);for(var p=this._read_template();p;)this._match_pattern?p+=this._input.read(this._match_pattern):p+=this._input.readUntil(this.__template_pattern),d+=p,p=this._read_template();return this._until_after&&(d+=this._input.readUntilAfter(this._until_pattern)),d},c.prototype.__set_templated_pattern=function(){var d=[];this._disabled.php||d.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||d.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||d.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(d.push(this.__patterns.django._starting_pattern.source),d.push(this.__patterns.django_value._starting_pattern.source),d.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||d.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&d.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+d.join("|")+")")},c.prototype._read_template=function(){var d="",p=this._input.peek();if(p==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(d=d||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(d=d||this.__patterns.erb.read())}else p==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(d=d||this.__patterns.handlebars_comment.read(),d=d||this.__patterns.handlebars_unescaped.read(),d=d||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(d=d||this.__patterns.django_value.read()),this._excluded.django||(d=d||this.__patterns.django_comment.read(),d=d||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(d=d||this.__patterns.smarty_comment.read(),d=d||this.__patterns.smarty_literal.read(),d=d||this.__patterns.smarty.read()));return d},n.exports.TemplatablePattern=c}],P={};function G(n){var L=P[n];if(L!==void 0)return L.exports;var b=P[n]={exports:{}};return j[n](b,b.exports,G),b.exports}var W=G(0);D=W})();var Y=D;!(le=[],X=function(){return{js_beautify:Y}}.apply(we,le),X!==void 0&&(rt.exports=X))})()},"746U":function(rt,we,$){"use strict";$.d(we,"f",function(){return le}),$.d(we,"l",function(){return X}),$.d(we,"k",function(){return D}),$.d(we,"j",function(){return Y}),$.d(we,"g",function(){return j}),$.d(we,"m",function(){return P}),$.d(we,"h",function(){return G}),$.d(we,"n",function(){return W}),$.d(we,"c",function(){return n}),$.d(we,"a",function(){return L}),$.d(we,"i",function(){return b}),$.d(we,"o",function(){return m}),$.d(we,"e",function(){return d}),$.d(we,"d",function(){return p}),$.d(we,"p",function(){return l}),$.d(we,"b",function(){return h});function le(o){return Array.isArray(o)}function X(o){return typeof o=="string"}function D(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&!(o instanceof RegExp)&&!(o instanceof Date)}function Y(o){return typeof o=="number"&&!isNaN(o)}function j(o){return o===!0||o===!1}function P(o){return typeof o=="undefined"}function G(o){return!W(o)}function W(o){return P(o)||o===null}function n(o,s){if(!o)throw new Error(s?`Unexpected type, expected '${s}'`:"Unexpected type")}function L(o){if(W(o))throw new Error("Assertion Failed: argument is undefined or null");return o}function b(o){return typeof o=="function"}function m(o,s){const A=Math.min(o.length,s.length);for(let x=0;x<A;x++)g(o[x],s[x])}function g(o,s){if(X(s)){if(typeof o!==s)throw new Error(`argument does not match constraint: typeof ${s}`)}else if(b(s)){try{if(o instanceof s)return}catch(A){}if(!W(o)&&o.constructor===s)return;if(s.length===1&&s.call(void 0,o)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function c(o){let s=[],A=Object.getPrototypeOf(o);for(;Object.prototype!==A;)s=s.concat(Object.getOwnPropertyNames(A)),A=Object.getPrototypeOf(A);return s}function d(o){const s=[];for(const A of c(o))typeof o[A]=="function"&&s.push(A);return s}function p(o,s){const A=S=>function(){const O=Array.prototype.slice.call(arguments,0);return s(S,O)};let x={};for(const S of o)x[S]=A(S);return x}function l(o){return o===null?void 0:o}function h(o,s="Unreachable"){throw new Error(s)}},"7Cbv":function(rt,we,$){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),X=new Uint8Array(16);function D(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(X)}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 j(g){return typeof g=="string"&&Y.test(g)}for(var P=j,G=[],W=0;W<256;++W)G.push((W+256).toString(16).substr(1));function n(g){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,d=(G[g[c+0]]+G[g[c+1]]+G[g[c+2]]+G[g[c+3]]+"-"+G[g[c+4]]+G[g[c+5]]+"-"+G[g[c+6]]+G[g[c+7]]+"-"+G[g[c+8]]+G[g[c+9]]+"-"+G[g[c+10]]+G[g[c+11]]+G[g[c+12]]+G[g[c+13]]+G[g[c+14]]+G[g[c+15]]).toLowerCase();if(!P(d))throw TypeError("Stringified UUID is invalid");return d}var L=n;function b(g,c,d){g=g||{};var p=g.random||(g.rng||D)();if(p[6]=p[6]&15|64,p[8]=p[8]&63|128,c){d=d||0;for(var l=0;l<16;++l)c[d+l]=p[l];return c}return L(p)}var m=we.a=b},"7ahc":function(rt,we,$){"use strict";$.d(we,"a",function(){return A});var le=$("k1fw"),X=$("0Owb"),D=$("+L6B"),Y=$("2/Rp"),j=$("y8nQ"),P=$("Vl3Y"),G=$("tJVT"),W=$("OaEy"),n=$("2fM7"),L=$("q1tI"),b=$.n(L),m=$("VrN/"),g=$.n(m),c=$("p77/"),d=$.n(c),p=$("c5Ni"),l=$.n(p),h=n.a.Option,o={labelCol:{span:4},wrapperCol:{span:20}},s={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"]};we.b=function(x){var S=x.callback,O=x.onCancel,R=Object(L.useState)("python"),C=Object(G.a)(R,2),w=C[0],y=C[1];function u(a){y(s[a][1])}function v(a){S(a)}return b.a.createElement(P.a,Object(X.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(n.a,{onChange:u},Object.keys(s).map(function(a){return b.a.createElement(h,{key:a,value:a},s[a][0])}))),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(A,{mode:w})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Y.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function A(x){var S=x.value,O=x.onChange,R=x.mode,C=x.options,w=C===void 0?{}:C,y=Object(L.useRef)(),u=Object(L.useState)(),v=Object(G.a)(u,2),a=v[0],_=v[1];return Object(L.useEffect)(function(){if(a){function N(B){var T=B.getValue();O&&O(T)}return a.on("change",N),function(){a.off("change",N)}}},[a,O]),Object(L.useEffect)(function(){a&&a.setOption("mode",R)},[a,R]),Object(L.useEffect)(function(){a&&((S!==a.getValue()||S==="")&&setTimeout(function(){a.setValue(S||" ")},300))},[a,S]),Object(L.useEffect)(function(){if(y.current&&!a){var N=g.a.fromTextArea(y.current,Object(le.a)({mode:R,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},w));_(N)}},[y.current,a]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:y}))}},"7qnI":function(rt,we,$){"use strict";var le=$("5Dmo"),X=$("3S7+"),D=$("fWQN"),Y=$("mtLc"),j=$("yKVA"),P=$("879j"),G=$("5NDa"),W=$("5rEg"),n=$("q1tI"),L=$.n(n),b=$("O2Wb"),m=$.n(b),g=W.a.TextArea,c=function(d){Object(j.a)(l,d);var p=Object(P.a)(l);function l(){return Object(D.a)(this,l),p.apply(this,arguments)}return Object(Y.a)(l,[{key:"render",value:function(){var o=this,s=this.props,A=s.index,x=s.onAnswerChange,S=s.addChildAnswer,O=s.exerciseIsPublish,R=s.answers,C=s.activeOptionErrorIndex,w=s.flex,y=w===void 0?"0 0 1000px":w;return L.a.createElement("div",{className:m.a.flex},L.a.createElement("div",{className:"".concat(m.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",A+1,"):"),L.a.createElement("div",{className:"".concat(m.a.flex," ").concat(m.a.flex1),style:{flexDirection:"column"}},R.map(function(u,v){var a="".concat(A,"-").concat(v);return L.a.createElement("div",{className:"".concat(m.a.flex," ").concat(m.a.flex1),key:v},L.a.createElement("div",{className:m.a.flex1,style:{flex:y}},L.a.createElement("div",null,L.a.createElement(g,{className:a===C?m.a.error:"",spellCheck:!1,rows:4,value:u||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(v==0?"":"(\u53EF\u9009)"),onChange:function(N){return x(A,v,N.target.value)},style:{minHeight:95}}))),!O&&L.a.createElement(L.a.Fragment,null,v!=0&&L.a.createElement(X.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(m.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswer(A,v)},style:{float:"right"}})),v===0&&L.a.createElement(X.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(m.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswermain(A,v)},style:{float:"right"}})),L.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},L.a.createElement("i",{className:"".concat(m.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return S(A)},style:{float:"right",visibility:v==R.length-1?"":"hidden"}}))))})))}}]),l}(n.Component);we.a=c},"8EBN":function(rt,we,$){(function(le){le($("VrN/"))})(function(le){"use strict";le.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 X=0;X<le.modeInfo.length;X++){var D=le.modeInfo[X];D.mimes&&(D.mime=D.mimes[0])}le.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var j=0;j<le.modeInfo.length;j++){var P=le.modeInfo[j];if(P.mime==Y)return P;if(P.mimes){for(var G=0;G<P.mimes.length;G++)if(P.mimes[G]==Y)return P}}if(/\+xml$/.test(Y))return le.findModeByMIME("application/xml");if(/\+json$/.test(Y))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var j=0;j<le.modeInfo.length;j++){var P=le.modeInfo[j];if(P.ext){for(var G=0;G<P.ext.length;G++)if(P.ext[G]==Y)return P}}},le.findModeByFileName=function(Y){for(var j=0;j<le.modeInfo.length;j++){var P=le.modeInfo[j];if(P.file&&P.file.test(Y))return P}var G=Y.lastIndexOf("."),W=G>-1&&Y.substring(G+1,Y.length);if(W)return le.findModeByExtension(W)},le.findModeByName=function(Y){Y=Y.toLowerCase();for(var j=0;j<le.modeInfo.length;j++){var P=le.modeInfo[j];if(P.name.toLowerCase()==Y)return P;if(P.alias){for(var G=0;G<P.alias.length;G++)if(P.alias[G].toLowerCase()==Y)return P}}}})},"8HAY":function(rt,we,$){"use strict";$.d(we,"a",function(){return j}),$.d(we,"b",function(){return P}),$.d(we,"d",function(){return G}),$.d(we,"e",function(){return W}),$.d(we,"c",function(){return n});var le=$("MI8n"),X=$("pmY6"),D=$("3/fG"),Y=function(L,b,m,g){function c(d){return d instanceof m?d:new m(function(p){p(d)})}return new(m||(m=Promise))(function(d,p){function l(s){try{o(g.next(s))}catch(A){p(A)}}function h(s){try{o(g.throw(s))}catch(A){p(A)}}function o(s){s.done?d(s.value):c(s.value).then(l,h)}o((g=g.apply(L,b||[])).next())})};class j extends X.a{constructor(L,b="",m="",g=!0,c){super();this._onDidChange=this._register(new le.b),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=L,this._label=b,this._cssClass=m,this._enabled=g,this._actionCallback=c}get id(){return this._id}get label(){return this._label}set label(L){this._setLabel(L)}_setLabel(L){this._label!==L&&(this._label=L,this._onDidChange.fire({label:L}))}get tooltip(){return this._tooltip||""}set tooltip(L){this._setTooltip(L)}_setTooltip(L){this._tooltip!==L&&(this._tooltip=L,this._onDidChange.fire({tooltip:L}))}get class(){return this._cssClass}set class(L){this._setClass(L)}_setClass(L){this._cssClass!==L&&(this._cssClass=L,this._onDidChange.fire({class:L}))}get enabled(){return this._enabled}set enabled(L){this._setEnabled(L)}_setEnabled(L){this._enabled!==L&&(this._enabled=L,this._onDidChange.fire({enabled:L}))}get checked(){return this._checked}set checked(L){this._setChecked(L)}_setChecked(L){this._checked!==L&&(this._checked=L,this._onDidChange.fire({checked:L}))}run(L,b){return Y(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(L))})}}class P extends X.a{constructor(){super(...arguments);this._onBeforeRun=this._register(new le.b),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new le.b),this.onDidRun=this._onDidRun.event}run(L,b){return Y(this,void 0,void 0,function*(){if(!L.enabled)return;this._onBeforeRun.fire({action:L});let m;try{yield this.runAction(L,b)}catch(g){m=g}this._onDidRun.fire({action:L,error:m})})}runAction(L,b){return Y(this,void 0,void 0,function*(){yield L.run(b)})}}class G extends j{constructor(L){super(G.ID,L,L?"separator text":"separator");this.checked=!1,this.enabled=!1}}G.ID="vs.actions.separator";class W{constructor(L,b,m,g){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=L,this.label=b,this.class=g,this._actions=m}get actions(){return this._actions}dispose(){}run(){return Y(this,void 0,void 0,function*(){})}}class n extends j{constructor(){super(n.ID,D.a("submenu.empty","(empty)"),void 0,!1)}}n.ID="vs.actions.empty"},"8hTe":function(rt,we,$){rt.exports={button:"button___1wy9m"}},"9Bee":function(rt,we,$){"use strict";var le=$("DYRE"),X=$("zeV3"),D=$("+L6B"),Y=$("2/Rp"),j=$("k1fw"),P=$("9og8"),G=$("tJVT"),W=$("WmNS"),n=$.n(W),L=$("q1tI"),b=$.n(L),m=$("vg9a"),g=$("DlQD"),c=$.n(g),d=$("rUJ1");function p(ue,q){var te=ue.match(/^(\s+)(?:```)/);if(te===null)return q;var se=te[1];return q.split(`
`).map(function(he){var ie=he.match(/^\s+/);if(ie===null)return he;var ae=Object(G.a)(ie,1),fe=ae[0];return fe.length>=se.length?he.slice(se.length):he}).join(`
`)}var l=[],h=["<ul>"],o=new c.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){l.length=0,h=["<ul>"]}var x={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function S(ue,q,te,se){if(q>=ue.length||ue[q].level<=te)return q;var he=ue[q];se.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),q++;var ie=[];return q=S(ue,q,he.level,ie),ie.length>0&&(se.push("<ul>"),ie.forEach(function(ae){se.push(ae)}),se.push("</ul>")),se.push("</li>"),q=S(ue,q,te,se),q}function O(){return S(l,0,0,h),h.push("</ul>"),h.join("")}var R={heading:function(q){var te=s.exec(q);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},fences:function(q){var te=this.rules.block.fences.exec(q);if(te){var se=te[0],he=p(se,te[3]||""),ie=te[2]?te[2].trim():te[2];if(["latex","katex","math"].indexOf(ie)>=0){var ae=y(),fe=he;he=ae,u[ae]={type:"block",expression:fe}}return{type:"code",raw:se,lang:ie,text:he}}}},C=/(?:\${2})([^\n`]+?)(?:\${2})/gi,w=0,y=function(){return"__special_katext_id_".concat(w++,"__")},u={};function v(){return u}function a(){w=0,u={}}function _(ue){return ue=ue.replace(C,function(q,te){var se=y();return u[se]={type:"inline",expression:te},se}),ue}var N=o.listitem;o.listitem=function(ue){return N(_(ue))};var B=o.paragraph;o.paragraph=function(ue){return B(_(ue))};var T=o.tablecell;o.tablecell=function(ue,q){return T(_(ue),q)},o.code=function(ue,q,te){var se=(q||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(ue,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(te?ue:Object(d.escape)(ue,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(te?ue:Object(d.escape)(ue,!0))+"</code></pre>"},o.heading=function(ue,q,te){var se=this.options.headerPrefix+te.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:se,level:q,text:ue}),"<h"+q+' id="'+se+'">'+ue+"</h"+q+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:R,renderer:o});var U=c.a,M=$("SJMd"),E=$("ulZh"),H=$.n(E),Z=$("m3rI"),oe=$("Oy/b"),de=$("p5ED"),Te=$("ErOA"),be=$("STEk");/* **********************************
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 Ae=function(ue,q){return(Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(te,se){te.__proto__=se}||function(te,se){for(var he in se)Object.prototype.hasOwnProperty.call(se,he)&&(te[he]=se[he])})(ue,q)};function Ce(ue,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function te(){this.constructor=ue}Ae(ue,q),ue.prototype=q===null?Object.create(q):(te.prototype=q.prototype,new te)}function _e(ue,q,te,se){return new(te||(te=Promise))(function(he,ie){function ae(xe){try{pe(se.next(xe))}catch(Re){ie(Re)}}function fe(xe){try{pe(se.throw(xe))}catch(Re){ie(Re)}}function pe(xe){var Re;xe.done?he(xe.value):(Re=xe.value,Re instanceof te?Re:new te(function(Ne){Ne(Re)})).then(ae,fe)}pe((se=se.apply(ue,q||[])).next())})}function ge(ue,q){var te,se,he,ie,ae={label:0,sent:function(){if(1&he[0])throw he[1];return he[1]},trys:[],ops:[]};return ie={next:fe(0),throw:fe(1),return:fe(2)},typeof Symbol=="function"&&(ie[Symbol.iterator]=function(){return this}),ie;function fe(pe){return function(xe){return function(Re){if(te)throw new TypeError("Generator is already executing.");for(;ae;)try{if(te=1,se&&(he=2&Re[0]?se.return:Re[0]?se.throw||((he=se.return)&&he.call(se),0):se.next)&&!(he=he.call(se,Re[1])).done)return he;switch(se=0,he&&(Re=[2&Re[0],he.value]),Re[0]){case 0:case 1:he=Re;break;case 4:return ae.label++,{value:Re[1],done:!1};case 5:ae.label++,se=Re[1],Re=[0];continue;case 7:Re=ae.ops.pop(),ae.trys.pop();continue;default:if(!(he=ae.trys,(he=he.length>0&&he[he.length-1])||Re[0]!==6&&Re[0]!==2)){ae=0;continue}if(Re[0]===3&&(!he||Re[1]>he[0]&&Re[1]<he[3])){ae.label=Re[1];break}if(Re[0]===6&&ae.label<he[1]){ae.label=he[1],he=Re;break}if(he&&ae.label<he[2]){ae.label=he[2],ae.ops.push(Re);break}he[2]&&ae.ops.pop(),ae.trys.pop();continue}Re=q.call(ue,ae)}catch(Ne){Re=[6,Ne],se=0}finally{te=he=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([pe,xe])}}}var V=function(){function ue(){}return ue.addKey=function(q){ue.key=q},Object.defineProperty(ue,"isLicensed",{get:function(){return!!ue.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(ue.key)},enumerable:!1,configurable:!0}),ue}(),I=function(){function ue(){}return ue.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},ue.setAttributes=function(q,te){for(var se=0,he=te;se<he.length;se++){var ie=he[se],ae=ie[0],fe=ie[1];q.setAttribute(ae,fe)}},ue.createRect=function(q,te,se){var he=document.createElementNS("http://www.w3.org/2000/svg","rect");return he.setAttribute("width",q.toString()),he.setAttribute("height",te.toString()),se&&ue.setAttributes(he,se),he},ue.createLine=function(q,te,se,he,ie){var ae=document.createElementNS("http://www.w3.org/2000/svg","line");return ae.setAttribute("x1",q.toString()),ae.setAttribute("y1",te.toString()),ae.setAttribute("x2",se.toString()),ae.setAttribute("y2",he.toString()),ie&&ue.setAttributes(ae,ie),ae},ue.createPolygon=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg","polygon");return se.setAttribute("points",q),te&&ue.setAttributes(se,te),se},ue.createCircle=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg","circle");return se.setAttribute("cx",(q/2).toString()),se.setAttribute("cy",(q/2).toString()),se.setAttribute("r",q.toString()),te&&ue.setAttributes(se,te),se},ue.createEllipse=function(q,te,se){var he=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return he.setAttribute("cx",(q/2).toString()),he.setAttribute("cy",(te/2).toString()),he.setAttribute("rx",(q/2).toString()),he.setAttribute("ry",(te/2).toString()),se&&ue.setAttributes(he,se),he},ue.createGroup=function(q){var te=document.createElementNS("http://www.w3.org/2000/svg","g");return q&&ue.setAttributes(te,q),te},ue.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},ue.createMarker=function(q,te,se,he,ie,ae,fe){var pe=document.createElementNS("http://www.w3.org/2000/svg","marker");return ue.setAttributes(pe,[["id",q],["orient",te],["markerWidth",se.toString()],["markerHeight",he.toString()],["refX",ie.toString()],["refY",ae.toString()]]),pe.appendChild(fe),pe},ue.createText=function(q){var te=document.createElementNS("http://www.w3.org/2000/svg","text");return te.setAttribute("x","0"),te.setAttribute("y","0"),q&&ue.setAttributes(te,q),te},ue.createTSpan=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg","tspan");return se.textContent=q,te&&ue.setAttributes(se,te),se},ue.createImage=function(q){var te=document.createElementNS("http://www.w3.org/2000/svg","image");return q&&ue.setAttributes(te,q),te},ue.createPoint=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return se.x=q,se.y=te,se},ue.createPath=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg","path");return se.setAttribute("d",q),te&&ue.setAttributes(se,te),se},ue.createElement=function(q,te){var se=document.createElementNS("http://www.w3.org/2000/svg",q);return te&&ue.setAttributes(se,te),se},ue.getHollowRectanglePath=function(q,te,se,he,ie,ae,fe,pe){return"M"+q+","+te+"V"+(te+he)+"H"+(q+se)+"V"+te+"H"+ie+"V"+ae+"H"+(ie+fe)+"V"+(ae+pe)+"H"+ie+"V"+te+"Z"},ue}(),F=function(){function ue(q){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+q+"_"}return Object.defineProperty(ue.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(ue.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(ue.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),ue.prototype.addClass=function(q){return this.styleSheet===void 0&&this.addStyleSheet(),q.name=""+this.classNamePrefix+q.localName,this.classes.push(q),this.styleSheet.sheet.insertRule("."+q.name+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length),q},ue.prototype.addRule=function(q){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(q),this.styleSheet.sheet.insertRule(q.selector+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length)},ue.prototype.addStyleSheet=function(){var q;this.styleSheet=document.createElement("style"),((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).appendChild(this.styleSheet),this.addRule(new J("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new J("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new J("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ne("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ne("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},ue.prototype.removeStyleSheet=function(){var q;this.styleSheet&&(((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},ue}(),J=function(ue,q){this.selector=ue,this.style=q},ne=function(ue,q){this.localName=ue,this.style=q},z=function(){function ue(){this.blocks=[],this.display=""}return ue.prototype.addButtonBlock=function(q){q.className=this.blockClassName,q.buttonClassName=this.buttonClassName,q.buttonColorsClassName=this.buttonColorsClassName,q.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(q)},ue.prototype.addElementBlock=function(q){q.className===void 0&&(q.className=this.blockClassName),this.blocks.push(q)},ue.prototype.getUI=function(){var q=document.createElement("div");return q.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,q.style.display=this.display,this.blocks.forEach(function(te){return q.appendChild(te.getUI())}),q},ue}(),me=function(){function ue(){}return ue.prototype.getUI=function(){var q=document.createElement("div");if(q.className=this.className,this.minWidth!==void 0&&(q.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":q.style.justifyContent="flex-start";break;case"center":q.style.justifyContent="center";break;case"end":q.style.justifyContent="flex-end"}return q.style.whiteSpace="nowrap",q},ue}(),Oe=function(ue){function q(){var te=ue!==null&&ue.apply(this,arguments)||this;return te.buttons=[],te}return Ce(q,ue),q.prototype.addButton=function(te){te.className=this.buttonClassName,te.colorsClassName=this.buttonColorsClassName,te.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(te)},q.prototype.getUI=function(){var te=ue.prototype.getUI.call(this);return this.buttons.forEach(function(se){return te.appendChild(se.getUI())}),te},q}(me),ke=function(){function ue(q,te){this._isActive=!1,this._isHidden=!1,this._icon=q,this.title=te,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(ue.prototype,"icon",{get:function(){return this._icon},set:function(q){this._icon=q,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"isActive",{get:function(){return this._isActive},set:function(q){this._isActive=q,this.adjustClassName()},enumerable:!1,configurable:!0}),ue.prototype.getUI=function(){var q=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 q.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},ue.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,"")))},ue.prototype.hide=function(){this._isHidden=!0},ue}(),ce=function(ue){function q(){var te=ue!==null&&ue.apply(this,arguments)||this;return te.elements=[],te}return Ce(q,ue),q.prototype.addElement=function(te){this.elements.push(te)},q.prototype.getUI=function(){var te=ue.prototype.getUI.call(this);return this.elements.forEach(function(se){return te.appendChild(se)}),te},q}(me),ye=function(){function ue(q,te){this.horizontal=q,this.vertical=te}return Object.defineProperty(ue.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),ue.prototype.getVerticalLength=function(q){return q/this.ratio},ue.prototype.getHorizontalLength=function(q){return q*this.ratio},ue}(),Se=function(){function ue(){}return ue.getIcon=function(q,te){if(q>0&&te>0){var se=new ye(q,te),he=se.ratio>=1?20:se.getHorizontalLength(20),ie=se.ratio<1?20:se.getVerticalLength(20),ae=document.createElementNS("http://www.w3.org/2000/svg","svg");ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),ae.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ae);var fe=I.createDefs();ae.appendChild(fe);var pe=I.createElement("clipPath",[["id","text-bg-clip"]]);fe.appendChild(pe);var xe=I.createPath(I.getHollowRectanglePath((24-he)/2,(24-ie)/2,he,ie,(24-he)/2+2,(24-ie)/2+2,he-4,ie-4));ae.appendChild(xe);var Re=I.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Re.appendChild(I.createTSpan(q+":"+te)),ae.appendChild(Re);var Ne=Re.getBBox();I.setAttributes(Re,[["x",((24-Ne.width)/2).toString()],["y",((24-Ne.height)/2-Ne.y).toString()]]);var Ye=I.createPath(I.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ne.width))/2,(24-Math.ceil(Ne.height))/2,Math.ceil(Ne.width),Math.ceil(Ne.height)));return pe.appendChild(Ye),I.setAttributes(xe,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ae),ae.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>'},ue}(),Le=function(ue){function q(te,se,he){var ie=ue.call(this,te,se)||this;return ie.isDropdownOpen=!1,ie.onClick=ie.dropdownButtonClicked,ie.dropdownButtons=he,ie}return Ce(q,ue),q.prototype.setupDropdown=function(){var te=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(se){se.className=te.className,se.colorsClassName=te.colorsClassName,te.dropdownBlock.appendChild(se.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(ke),Be=function(){function ue(q,te){this.GRIP_SIZE=10,this.color=q,this.fillColor=te,this.visual=I.createGroup(),this.visual.appendChild(I.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(I.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return ue.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},ue.prototype.setCenter=function(q,te){this.visual.childNodes.forEach(function(se){return I.setAttributes(se,[["cx",q.toString()],["cy",te.toString()]])})},ue}(),We=function(){function ue(q,te,se,he){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=te,this.margin=se,this.container=he,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(ue.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&I.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),ue.prototype.open=function(){var q=this;this.cropShadeElement=I.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=I.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var te=0;te<this.numberOfGridLines;te++)this.horizontalGridLines.push(I.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(I.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(se){return q.gridContainer.appendChild(se)}),this.verticalGridLines.forEach(function(se){return q.gridContainer.appendChild(se)}),this.cropRectElement=I.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},ue.prototype.setCropRectangle=function(q){this.cropRect=q;var te=Object.assign({},this.cropRect);this.zoomFactor!==1&&(te.width=this.cropRect.width*this.zoomFactor,te.height=this.cropRect.height*this.zoomFactor,te.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-te.width/2,te.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-te.height/2),I.setAttributes(this.cropRectElement,[["x",te.x.toString()],["y",te.y.toString()],["width",te.width.toString()],["height",te.height.toString()]]);var se=te.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(ie,ae){var fe=te.y+se*(ae+1);I.setAttributes(ie,[["x1",""+te.x],["y1",""+fe],["x2",""+(te.x+te.width)],["y2",""+fe]])});var he=te.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(ie,ae){var fe=te.x+he*(ae+1);I.setAttributes(ie,[["x1",""+fe],["y1",""+te.y],["x2",""+fe],["y2",""+(te.y+te.height)]])}),I.setAttributes(this.cropShadeElement,[["d",I.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,te.x,te.y,te.width,te.height)]]),this.topLeftGrip.setCenter(te.x,te.y),this.topRightGrip.setCenter(te.x+te.width,te.y),this.bottomLeftGrip.setCenter(te.x,te.y+te.height),this.bottomRightGrip.setCenter(te.x+te.width,te.y+te.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},ue.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)},ue.prototype.clientToLocalCoordinates=function(q,te){var se=this.container.getBoundingClientRect();return{x:q-se.left+this.margin,y:te-se.top+this.margin}},ue.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},ue.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var te=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(te)}q.preventDefault()},ue.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},ue.prototype.move=function(q){var te=q.x-this.previousPoint.x,se=q.y-this.previousPoint.y;this.zoomFactor!==1&&(te=-te/this.zoomFactor,se=-se/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+te),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+se),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},ue.prototype.resize=function(q){var te=Object.assign({},this.cropRect),se=q.x-this.previousPoint.x,he=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:te.x+se<this.margin&&(se=this.margin-te.x),te.x+=se,te.width=this.cropRect.x+this.cropRect.width-te.x;break;case this.bottomRightGrip:case this.topRightGrip:te.width+se>this.canvasWidth*this.zoomFactor&&(se=this.canvasWidth*this.zoomFactor-te.width),te.width+=se}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(te.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(se),te.height=this.aspectRatio.getVerticalLength(te.width)):(te.y+=he,te.height=this.cropRect.y+this.cropRect.height-te.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?te.height=this.aspectRatio.getVerticalLength(te.width):te.height+=he}te.width<10&&(te.x=this.cropRect.x,te.width=10),te.height<10&&(te.y=this.cropRect.y,te.height=10),this.previousPoint=q,te.x>=this.margin&&te.y>=this.margin&&te.x-this.margin+te.width<=this.canvasWidth&&te.y-this.margin+te.height<=this.canvasHeight&&(this.cropRect=te,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},ue.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,te=this.cropRect.y+this.cropRect.height/2,se=this.aspectRatio.getHorizontalLength(this.cropRect.height),he=this.aspectRatio.getVerticalLength(this.cropRect.width);se/this.canvasWidth<he/this.canvasHeight?this.cropRect.width=se:this.cropRect.height=he,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=q-this.cropRect.width/2,this.cropRect.y=te-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)}},ue.prototype.getRescaledRect=function(q,te,se,he,ie,ae){var fe=se/q,pe=he/te;return{x:(ie.x-ae)*fe+ae,y:(ie.y-ae)*pe+ae,width:ie.width*fe,height:ie.height*pe}},ue.prototype.scaleCanvas=function(q,te){var se=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,te,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=te,this.onCropChange&&this.onCropChange(se),this.setCropRectangle(se)},ue}(),Ke=function(){function ue(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,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(ue.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),ue.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},ue.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},ue.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},ue.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},ue.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();I.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},ue.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},ue.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var te="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,se=1;se<=this.width/5+10;se++){var he=se%5==0?this.height/3:this.height/6;te+="h4v"+-he+"h1v"+he}te+="v1H0Z",this.scaleShape=I.createPath(te);var ie=I.createTransform();this.scaleShape.transform.baseVal.appendItem(ie),q.appendChild(this.scaleShape),this.angleLabelElement=I.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=I.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ae=I.createTSpan("");return ae.innerHTML="&deg;",this.angleLabelElement.appendChild(ae),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},ue}(),Xe=function(){function ue(){this.naturalSize=!1,this.imageType="image/png"}return ue.prototype.rasterize=function(q,te,se,he,ie,ae,fe){var pe=this;return new Promise(function(xe){var Re=document.createElement("canvas");Re.width=q.width.baseVal.value-2*he,Re.height=q.height.baseVal.value-2*he;var Ne=1,Ye=1;pe.naturalSize===!0?(Ne=te.naturalWidth/(q.width.baseVal.value-2*he)/ae,Ye=te.naturalHeight/(q.height.baseVal.value-2*he)/fe,Re.width=te.naturalWidth/ae,Re.height=te.naturalHeight/fe):pe.width!==void 0&&pe.height!==void 0&&(Ne=pe.width/se.width,Ye=pe.height/se.height,Re.width*=Ne,Re.height*=Ye);var dt=Re.getContext("2d");dt.translate(Re.width/2,Re.height/2),dt.rotate(ie*Math.PI/180),dt.scale(ae,fe),dt.translate(-Re.width/2,-Re.height/2),dt.drawImage(te,0,0,Re.width,Re.height);var gt=document.createElement("canvas");gt.width=se.width*Ne,gt.height=se.height*Ye,gt.getContext("2d").putImageData(dt.getImageData((se.x-he)*Ne,(se.y-he)*Ye,se.width*Ne,se.height*Ye),0,0),xe(gt.toDataURL(pe.imageType,pe.imageQuality))})},ue}(),lt=function(){function ue(q){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=ue.instanceCounter++,this.styles=new F(this.instanceNo),this.target=q,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(ue.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),ue.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},ue.prototype.show=function(){this.showUI(),this.open()},ue.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(te){return te()}),this._isOpen=!1)},ue.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},ue.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},ue.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},ue.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},ue.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.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))},ue.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,te=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,se=te+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/q;this.resize(te,se)}},ue.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},ue.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",I.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},ue.prototype.resize=function(q,te){this.imageWidth=Math.round(q),this.imageHeight=Math.round(te),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()},ue.prototype.setEditingTarget=function(){var q=document.createElement("canvas");q.width=this.target.naturalWidth,q.height=this.target.naturalHeight,q.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var te=q.toDataURL();I.setAttributes(this.editingTarget,[["href",te]]),this.setEditingTargetSize()},ue.prototype.setTopLeft=function(){var q=this.target.getBoundingClientRect(),te=this.editorCanvas.getBoundingClientRect();this.left=q.left-te.left-this.CANVAS_MARGIN,this.top=q.top-te.top-this.CANVAS_MARGIN},ue.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=I.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=I.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=I.createGroup(),this.editingTargetRotationScaleContainer=I.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var q=I.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(q);var te=I.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(te),this.editingTargetContainer=I.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)},ue.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},ue.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=I.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new We(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()},ue.prototype.zoomToCrop=function(){if(this.cropRect){var q=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,te=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=q+"px "+te+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-q+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-te+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},ue.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)},ue.prototype.cropRectChanged=function(q){this.cropRect=q,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},ue.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},ue.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"},ue.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},ue.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 q=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,te=this.target.offsetTop>q+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=te+"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},ue.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},ue.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new z,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 te=new Oe;te.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(te);var se=[];this.aspectRatios.forEach(function(Ye){var dt=new ke(Se.getIcon(Ye.horizontal,Ye.vertical),Ye.horizontal===0&&Ye.vertical===0?"FREE":Ye.horizontal+":"+Ye.vertical);dt.onClick=function(){return q.ratioButtonClicked(Ye)},se.push(dt)}),this.aspectRatioButton=new Le(Se.getIcon(0,0),"Aspect ratio",se),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,te.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var he=new ke('<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");he.isActive=this.isGridVisible,he.onClick=function(){q.isGridVisible=!q.isGridVisible,he.isActive=q.isGridVisible},te.addButton(he);var ie=new ke('<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(ie.isActive=this.zoomToCropEnabled,ie.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,ie.isActive=q.zoomToCropEnabled},te.addButton(ie),!V.isLicensed){var ae=new ce;this.topToolbar.addElementBlock(ae);var fe=document.createElement("div");fe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var pe=document.createElement("a");pe.style.color="currentColor",pe.href="https://markerjs.com/products/cropro",pe.target="_blank",pe.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>',fe.appendChild(pe),ae.addElement(fe)}var xe=new Oe;xe.minWidth=3*this.toolbarHeight+"px",xe.contentAlign="end",this.topToolbar.addButtonBlock(xe);var Re=new ke('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Re.onClick=this.startRenderAndClose,xe.addButton(Re),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Re.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ne=new ke('<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");Ne.onClick=this.close,xe.addButton(Ne),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ne.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},ue.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new z,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 te=new Oe;te.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(te);var se=new ke('<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");se.onClick=this.rotateLeftButtonClicked,te.addButton(se);var he=new ke('<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");he.onClick=this.rotateRightButtonClicked,te.addButton(he);var ie=new ce;ie.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(ie),this.straightener=new Ke("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(xe){q.rotateBy(xe),q.straightener.angle=q.rotationAngle},ie.addElement(this.straightener.getUI());var ae=new Oe;ae.minWidth=2*this.toolbarHeight+"px",ae.contentAlign="end",this.bottomToolbar.addButtonBlock(ae);var fe=new ke('<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");fe.onClick=this.flipHorizontallyButtonClicked,ae.addButton(fe);var pe=new ke('<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");pe.onClick=this.flipVerticallyButtonClicked,ae.addButton(pe)},ue.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},ue.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Se.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},ue.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ye(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},ue.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},ue.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},ue.prototype.restoreState=function(q){if(q){var te=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(te),this.cropRectChanged(te),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},ue.prototype.clientToLocalCoordinates=function(q,te){var se=this.cropImage.getBoundingClientRect();return{x:q-se.left,y:te-se.top}},ue.prototype.onWindowResize=function(){this.positionUI()},ue.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"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()},ue.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},ue.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},ue.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},ue.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},ue.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var te=this.editingTargetRotationContainer.transform.baseVal.getItem(0);te.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(te,0);var se=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/se.width,this.imageHeight/se.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},ue.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},ue.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},ue.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},ue.prototype.startRenderAndClose=function(){return _e(this,void 0,void 0,function(){var q,te;return ge(this,function(se){switch(se.label){case 0:return[4,this.render()];case 1:return q=se.sent(),te=this.getState(),this.renderEventListeners.forEach(function(he){return he(q,te)}),this.close(!0),[2]}})})},ue.prototype.render=function(){return _e(this,void 0,void 0,function(){var q;return ge(this,function(te){switch(te.label){case 0:return(q=new Xe).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),I.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.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 te.sent(),[4,q.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,te.sent()]}})})},ue.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ne("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 ne("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ne("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ne("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*q)+`px;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ne("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ne("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new J("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new J("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new ne("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 ne("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new ne("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 ne("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new ne("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},ue.instanceCounter=0,ue}(),Je=$("8hTe"),qe=$.n(Je),Pe=/<pre[^>]*>/g;function pt(ue){var q=document.createElement("div");return q.innerHTML=ue,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var ut=we.a=function(ue){var q=ue.value,te=q===void 0?"":q,se=ue.edit,he=se===void 0?!1:se,ie=ue.className,ae=ue.showTextOnly,fe=ue.showLines,pe=ue.replaces,xe=ue.zoomImg,Re=ue.hasMask,Ne=ue.style,Ye=Ne===void 0?{}:Ne,dt=ue.stylesPrev,gt=dt===void 0?{}:dt,Kt=String(te),Ve=Object(L.useRef)(),Ue=Object(L.useRef)(),Et=Object(L.useState)(""),vt=Object(G.a)(Et,2),qt=vt[0],Yt=vt[1],yt=Object(L.useState)("office"),Qe=Object(G.a)(yt,2),xn=Qe[0],Me=Qe[1],un=function(){var kt=new lt(Ue.current);kt.displayMode="popup",kt.addRenderEventListener(function(){var Ot=Object(P.a)(n.a.mark(function nt(at){var et;return n.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:return Ve.current.style.display="none",Bt.next=3,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:at}});case 3:et=Bt.sent,et!=null&&et.id&&pe(Ue.current.getAttribute("src").replace(Z.a.API_SERVER,""),"/api/attachments/".concat(et==null?void 0:et.id,"?type=").concat(et.content_type));case 5:case"end":return Bt.stop()}},nt)}));return function(nt){return Ot.apply(this,arguments)}}()),kt.show()},ft=function(){var kt=new be.a(Ue.current);kt.settings.displayMode="popup",kt.addEventListener("render",function(){var Ot=Object(P.a)(n.a.mark(function nt(at){var et;return n.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:if(Ve.current.style.display="none",!Ue.current){Bt.next=6;break}return Bt.next=4,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:at.dataUrl}});case 4:et=Bt.sent,et!=null&&et.id&&pe(Ue.current.getAttribute("src").replace(Z.a.API_SERVER,""),"/api/attachments/".concat(et==null?void 0:et.id,"?type=").concat(et.content_type));case 6:case"end":return Bt.stop()}},nt)}));return function(nt){return Ot.apply(this,arguments)}}()),kt.show(),window.markerArea=kt},wt=Object(L.useMemo)(function(){Ve.current&&(Ve.current.style.zIndex=-1);try{var ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,kt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ot=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Kt=Kt.replace(ze,"("+Z.a.API_SERVER+"/api/attachments/").replace(kt,'"'+Z.a.API_SERVER+"/api/attachments/").replace(Ot,'"'+Z.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(Vt){}var nt=U(Kt),at=v();if(Kt.match(/\[TOC\]/)&&(nt=nt.replace("<p>[TOC]</p>",O()),A()),nt=nt.replace(/(__special_katext_id_\d+__)/g,function(Vt,Bt){var Fe=at[Bt],ht=Fe.type,hn=Fe.expression;return Object(oe.renderToString)(pt(hn)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),nt=nt.replace(/▁/g,"\u2581\u2581\u2581"),a(),ae){var et=document.createElement("div");return et.innerHTML=nt,et.innerText}return setTimeout(function(){return tn()},500),nt},[Kt]),it=Object(L.useRef)();x.WebkitLineClamp=fe,fe&&(Ye=Object(j.a)(Object(j.a)({},Ye),x));function Ft(ze){var kt=ze.target;if(kt.tagName.toUpperCase()==="IMG"){if(xe){var Ot=kt.getAttribute("src");Yt(Ot),Me("image")}}else if(kt.tagName.toUpperCase()==="A"){var nt=kt.getAttribute("href");if(nt.indexOf("office")>-1)ze.preventDefault(),Yt(nt),Me("office");else if(nt.indexOf("application/pdf")>-1)ze.preventDefault(),Yt(nt),Me("pdf");else if(nt.indexOf("text/html")>-1)ze.preventDefault(),Yt(nt),Me("html");else if(nt.startsWith("#")){ze.preventDefault();var at=document.getElementById(nt.replace("#",""));at&&at.scrollIntoView(!0)}}}var tn=function(){var kt,Ot=(kt=it.current)===null||kt===void 0?void 0:kt.querySelectorAll("video");Ot==null||Ot.forEach(function(nt){if(nt.oncontextmenu=function(){return!1},nt.src.indexOf(".m3u8")>-1&&!nt.canPlayType("application/vnd.apple.mpegurl")){if(H.a.isSupported()){var at=new H.a;at.loadSource(nt.src),at.attachMedia(nt)}}})};Object(L.useEffect)(function(){if(it.current&&wt&&(wt.match(Pe)&&window.PR.prettyPrint()),it.current)return it.current.addEventListener("click",Ft),function(){it.current.removeEventListener("click",Ft),a(),A()}},[wt,it.current,Ft]);var Dt=function(kt){if(!he)return;kt.target.nodeName==="IMG"?(Ve.current.style.zIndex=1,Ve.current.style.display="flex",Ve.current.style.width=kt.target.clientWidth+"px",Ve.current.style.height=kt.target.clientHeight+"px",Ve.current.style.top=kt.target.offsetTop+"px",Ve.current.style.left=kt.target.offsetLeft+"px",Ue.current.src=kt.target.getAttribute("src")):Ve.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:it,style:Object(j.a)({},Ye),className:"".concat(ie||""," markdown-body ").concat(qe.a.mdBody),onMouseOver:Dt,dangerouslySetInnerHTML:{__html:wt}}),b.a.createElement("div",{ref:Ve,className:qe.a.button},b.a.createElement(X.a,null,b.a.createElement(Y.a,{onClick:function(){return un()}},"\u88C1\u526A"),b.a.createElement(Y.a,{onClick:function(){return ft()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:Ue,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(de.a,{close:!0,data:qt,type:qt!=null&&qt.length?xn:"",style:Object(j.a)({},gt),onClose:function(){return Yt("")}}))}},"9VGf":function(rt,we,$){"use strict";$.d(we,"a",function(){return D});var le=$("q1tI"),X=$.n(le);function D(Y,j){var P=Object(le.useRef)();Object(le.useEffect)(function(){P.current=Y}),Object(le.useEffect)(function(){function G(){P.current()}if(j!==null){var W=setInterval(G,j);return function(){return clearInterval(W)}}},[j])}},BU3w:function(rt,we,$){"use strict";$.d(we,"a",function(){return P});var le=$("MNnm"),X="rc-util-key";function D(G){if(G.attachTo)return G.attachTo;var W=document.querySelector("head");return W||document.body}function Y(G){var W,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var L=document.createElement("style");if((W=n.csp)===null||W===void 0?void 0:W.nonce){var b;L.nonce=(b=n.csp)===null||b===void 0?void 0:b.nonce}L.innerHTML=G;var m=D(n),g=m.firstChild;return n.prepend&&m.prepend?m.prepend(L):n.prepend&&g?m.insertBefore(L,g):m.appendChild(L),L}var j=new Map;function P(G,W){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=D(n);if(!j.has(L)){var b=Y("",n),m=b.parentNode;j.set(L,m),m.removeChild(b)}var g=Array.from(j.get(L).children).find(function(h){return h.tagName==="STYLE"&&h[X]===W});if(g){var c,d;if(((c=n.csp)===null||c===void 0?void 0:c.nonce)&&g.nonce!==((d=n.csp)===null||d===void 0?void 0:d.nonce)){var p;g.nonce=(p=n.csp)===null||p===void 0?void 0:p.nonce}return g.innerHTML!==G&&(g.innerHTML=G),g}var l=Y(G,n);return l[X]=W,l}},Bd2K:function(rt,we,$){(function(le){le($("VrN/"),$("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(n,L,b){if(b!=le.Init&&b&&n.removeKeyMap("autoCloseTags"),!L)return;var m={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(m["'/'"]=function(g){return P(g)}),(typeof L!="object"||L.whenOpening!==!1)&&(m["'>'"]=function(g){return Y(g)}),n.addKeyMap(m)});var X=["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(n){if(n.getOption("disableInput"))return le.Pass;for(var L=n.listSelections(),b=[],m=n.getOption("autoCloseTags"),g=0;g<L.length;g++){if(!L[g].empty())return le.Pass;var c=L[g].head,d=n.getTokenAt(c),p=le.innerMode(n.getMode(),d.state),l=p.state,h=p.mode.xmlCurrentTag&&p.mode.xmlCurrentTag(l),o=h&&h.name;if(!o)return le.Pass;var s=p.mode.configuration=="html",A=typeof m=="object"&&m.dontCloseTags||s&&X,x=typeof m=="object"&&m.indentTags||s&&D;d.end>c.ch&&(o=o.slice(0,o.length-d.end+c.ch));var S=o.toLowerCase();if(!o||d.type=="string"&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||d.string.length==1)||d.type=="tag"&&h.close||d.string.indexOf("/")==c.ch-d.start-1||A&&G(A,S)>-1||W(n,p.mode.xmlCurrentContext&&p.mode.xmlCurrentContext(l)||[],o,c,!0))return le.Pass;var O=typeof m=="object"&&m.emptyTags;if(O&&G(O,o)>-1){b[g]={text:"/>",newPos:le.Pos(c.line,c.ch+2)};continue}var R=x&&G(x,S)>-1;b[g]={indent:R,text:">"+(R?`
`:"")+"</"+o+">",newPos:R?le.Pos(c.line+1,0):le.Pos(c.line,c.ch+1)}}for(var C=typeof m=="object"&&m.dontIndentOnAutoClose,g=L.length-1;g>=0;g--){var w=b[g];n.replaceRange(w.text,L[g].head,L[g].anchor,"+insert");var y=n.listSelections().slice(0);y[g]={head:w.newPos,anchor:w.newPos},n.setSelections(y),!C&&w.indent&&(n.indentLine(w.newPos.line,null,!0),n.indentLine(w.newPos.line+1,null,!0))}}function j(n,L){for(var b=n.listSelections(),m=[],g=L?"/":"</",c=n.getOption("autoCloseTags"),d=typeof c=="object"&&c.dontIndentOnSlash,p=0;p<b.length;p++){if(!b[p].empty())return le.Pass;var l=b[p].head,h=n.getTokenAt(l),o=le.innerMode(n.getMode(),h.state),s=o.state;if(L&&(h.type=="string"||h.string.charAt(0)!="<"||h.start!=l.ch-1))return le.Pass;var A,x=o.mode.name!="xml"&&n.getMode().name=="htmlmixed";if(x&&o.mode.name=="javascript")A=g+"script";else if(x&&o.mode.name=="css")A=g+"style";else{var S=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(s);if(!S||S.length&&W(n,S,S[S.length-1],l))return le.Pass;A=g+S[S.length-1]}n.getLine(l.line).charAt(h.end)!=">"&&(A+=">"),m[p]=A}if(n.replaceSelections(m),b=n.listSelections(),!d)for(var p=0;p<b.length;p++)(p==b.length-1||b[p].head.line<b[p+1].head.line)&&n.indentLine(b[p].head.line)}function P(n){return n.getOption("disableInput")?le.Pass:j(n,!0)}le.commands.closeTag=function(n){return j(n)};function G(n,L){if(n.indexOf)return n.indexOf(L);for(var b=0,m=n.length;b<m;++b)if(n[b]==L)return b;return-1}function W(n,L,b,m,g){if(!le.scanForClosingTag)return!1;var c=Math.min(n.lastLine()+1,m.line+500),d=le.scanForClosingTag(n,m,null,c);if(!d||d.tag!=b)return!1;for(var p=g?1:0,l=L.length-1;l>=0&&L[l]==b;l--)++p;m=d.to;for(var l=1;l<p;l++){var h=le.scanForClosingTag(n,m,null,c);if(!h||h.tag!=b)return!1;m=h.to}return!0}})},BjJ7:function(rt,we,$){"use strict";$.d(we,"d",function(){return X}),$.d(we,"c",function(){return D}),$.d(we,"e",function(){return Y}),$.d(we,"b",function(){return j}),$.d(we,"a",function(){return G});var le=$("m3rI");function X(W){var n=!0;if(W.length>0){for(var L=0;L<W.length;L++)if(W[L].compile_success==0||!W[L].compile_success){n=!1;break}}else n=!1;return n}function D(W){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],b=0;b<W.length;b++){var m=W[b],g=n?"".concat(n,"/").concat(m.name):"".concat(m.name);L.push({title:m.name,isLeaf:!(m.type==="tree"),key:g})}return L}function Y(W,n,L){for(var b=0;b<W.length;b++){var m=W[b];if(m.key===n){m.children=L;break}m.children&&Y(m.children,n,L)}return W}function j(W,n,L){var b;return function(){var m=this,g=arguments,c=function(){b=null,L||W.apply(m,g)},d=L&&!b;clearTimeout(b),b=setTimeout(c,n),d&&W.apply(m,g)}}var P=!0,G=le.a.API_SERVER},"C+DQ":function(rt,we,$){},"C/vA":function(rt,we,$){"use strict";$.d(we,"a",function(){return le});function le(X){const D=this;let Y=!1,j;return function(){return Y||(Y=!0,j=X.apply(D,arguments)),j}}},"Cg/j":function(rt,we,$){"use strict";$.d(we,"b",function(){return le}),$.d(we,"a",function(){return X}),$.d(we,"c",function(){return Y}),$.d(we,"d",function(){return j});var le;(function(P){P.serviceIds=new Map,P.DI_TARGET="$di$target",P.DI_DEPENDENCIES="$di$dependencies";function G(W){return W[P.DI_DEPENDENCIES]||[]}P.getServiceDependencies=G})(le||(le={}));const X=Y("instantiationService");function D(P,G,W,n){G[le.DI_TARGET]===G?G[le.DI_DEPENDENCIES].push({id:P,index:W,optional:n}):(G[le.DI_DEPENDENCIES]=[{id:P,index:W,optional:n}],G[le.DI_TARGET]=G)}function Y(P){if(le.serviceIds.has(P))return le.serviceIds.get(P);const G=function(W,n,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");D(G,W,L,!1)};return G.toString=()=>P,le.serviceIds.set(P,G),G}function j(P){return function(G,W,n){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");D(P,G,n,!0)}}},DlQD:function(rt,we,$){(function(le,X){rt.exports=X()})(this,function(){"use strict";function le(te,se){for(var he=0;he<se.length;he++){var ie=se[he];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(te,ie.key,ie)}}function X(te,se,he){return se&&le(te.prototype,se),he&&le(te,he),te}function D(te,se){if(!te)return;if(typeof te=="string")return Y(te,se);var he=Object.prototype.toString.call(te).slice(8,-1);if(he==="Object"&&te.constructor&&(he=te.constructor.name),he==="Map"||he==="Set")return Array.from(te);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return Y(te,se)}function Y(te,se){(se==null||se>te.length)&&(se=te.length);for(var he=0,ie=new Array(se);he<se;he++)ie[he]=te[he];return ie}function j(te,se){var he;if(typeof Symbol=="undefined"||te[Symbol.iterator]==null){if(Array.isArray(te)||(he=D(te))||se&&te&&typeof te.length=="number"){he&&(te=he);var ie=0;return function(){return ie>=te.length?{done:!0}:{done:!1,value:te[ie++]}}}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 he=te[Symbol.iterator](),he.next.bind(he)}function P(te,se){return se={exports:{}},te(se,se.exports),se.exports}var G=P(function(te){function se(){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 he(ie){te.exports.defaults=ie}te.exports={defaults:se(),getDefaults:se,changeDefaults:he}}),W=G.defaults,n=G.getDefaults,L=G.changeDefaults,b=/[&<>"']/,m=/[&<>"']/g,g=/[<>"']|&(?!#?\w+;)/,c=/[<>"']|&(?!#?\w+;)/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},p=function(se){return d[se]};function l(te,se){if(se){if(b.test(te))return te.replace(m,p)}else if(g.test(te))return te.replace(c,p);return te}var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(te){return te.replace(h,function(se,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var s=/(^|[^\[])\^/g;function A(te,se){te=te.source||te,se=se||"";var he={replace:function(ae,fe){return fe=fe.source||fe,fe=fe.replace(s,"$1"),te=te.replace(ae,fe),he},getRegex:function(){return new RegExp(te,se)}};return he}var x=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(te,se,he){if(te){var ie;try{ie=decodeURIComponent(o(he)).replace(x,"").toLowerCase()}catch(ae){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}se&&!S.test(he)&&(he=u(se,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch(ae){return null}return he}var R={},C=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(te,se){R[" "+te]||(C.test(te)?R[" "+te]=te+"/":R[" "+te]=N(te,"/",!0)),te=R[" "+te];var he=te.indexOf(":")===-1;return se.substring(0,2)==="//"?he?se:te.replace(w,"$1")+se:se.charAt(0)==="/"?he?se:te.replace(y,"$1")+se:te+se}var v={exec:function(){}};function a(te){for(var se=1,he,ie;se<arguments.length;se++){he=arguments[se];for(ie in he)Object.prototype.hasOwnProperty.call(he,ie)&&(te[ie]=he[ie])}return te}function _(te,se){var he=te.replace(/\|/g,function(fe,pe,xe){for(var Re=!1,Ne=pe;--Ne>=0&&xe[Ne]==="\\";)Re=!Re;return Re?"|":" |"}),ie=he.split(/ \|/),ae=0;if(ie.length>se)ie.splice(se);else for(;ie.length<se;)ie.push("");for(;ae<ie.length;ae++)ie[ae]=ie[ae].trim().replace(/\\\|/g,"|");return ie}function N(te,se,he){var ie=te.length;if(ie===0)return"";for(var ae=0;ae<ie;){var fe=te.charAt(ie-ae-1);if(fe===se&&!he)ae++;else if(fe!==se&&he)ae++;else break}return te.substr(0,ie-ae)}function B(te,se){if(te.indexOf(se[1])===-1)return-1;for(var he=te.length,ie=0,ae=0;ae<he;ae++)if(te[ae]==="\\")ae++;else if(te[ae]===se[0])ie++;else if(te[ae]===se[1]&&(ie--,ie<0))return ae;return-1}function T(te){te&&te.sanitize&&!te.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 U={escape:l,unescape:o,edit:A,cleanUrl:O,resolveUrl:u,noopTest:v,merge:a,splitCells:_,rtrim:N,findClosingBracket:B,checkSanitizeDeprecation:T},M=G.defaults,E=U.rtrim,H=U.splitCells,Z=U.escape,oe=U.findClosingBracket;function de(te,se,he){var ie=se.href,ae=se.title?Z(se.title):null,fe=te[1].replace(/\\([\[\]])/g,"$1");return te[0].charAt(0)!=="!"?{type:"link",raw:he,href:ie,title:ae,text:fe}:{type:"image",raw:he,href:ie,title:ae,text:Z(fe)}}function Te(te,se){var he=te.match(/^(\s+)(?:```)/);if(he===null)return se;var ie=he[1];return se.split(`
`).map(function(ae){var fe=ae.match(/^\s+/);if(fe===null)return ae;var pe=fe[0];return pe.length>=ie.length?ae.slice(ie.length):ae}).join(`
`)}var be=function(){function te(he){this.options=he||M}var se=te.prototype;return se.space=function(ie){var ae=this.rules.block.newline.exec(ie);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
`}},se.code=function(ie,ae){var fe=this.rules.block.code.exec(ie);if(fe){var pe=ae[ae.length-1];if(pe&&pe.type==="paragraph")return{raw:fe[0],text:fe[0].trimRight()};var xe=fe[0].replace(/^ {4}/gm,"");return{type:"code",raw:fe[0],codeBlockStyle:"indented",text:this.options.pedantic?xe:E(xe,`
`)}}},se.fences=function(ie){var ae=this.rules.block.fences.exec(ie);if(ae){var fe=ae[0],pe=Te(fe,ae[3]||"");return{type:"code",raw:fe,lang:ae[2]?ae[2].trim():ae[2],text:pe}}},se.heading=function(ie){var ae=this.rules.block.heading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},se.nptable=function(ie){var ae=this.rules.block.nptable.exec(ie);if(ae){var fe={type:"table",header:H(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[],raw:ae[0]};if(fe.header.length===fe.align.length){var pe=fe.align.length,xe;for(xe=0;xe<pe;xe++)/^ *-+: *$/.test(fe.align[xe])?fe.align[xe]="right":/^ *:-+: *$/.test(fe.align[xe])?fe.align[xe]="center":/^ *:-+ *$/.test(fe.align[xe])?fe.align[xe]="left":fe.align[xe]=null;for(pe=fe.cells.length,xe=0;xe<pe;xe++)fe.cells[xe]=H(fe.cells[xe],fe.header.length);return fe}}},se.hr=function(ie){var ae=this.rules.block.hr.exec(ie);if(ae)return{type:"hr",raw:ae[0]}},se.blockquote=function(ie){var ae=this.rules.block.blockquote.exec(ie);if(ae){var fe=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:fe}}},se.list=function(ie){var ae=this.rules.block.list.exec(ie);if(ae){for(var fe=ae[0],pe=ae[2],xe=pe.length>1,Re=pe[pe.length-1]===")",Ne={type:"list",raw:fe,ordered:xe,start:xe?+pe.slice(0,-1):"",loose:!1,items:[]},Ye=ae[0].match(this.rules.block.item),dt=!1,gt,Kt,Ve,Ue,Et,vt,qt,Yt=Ye.length,yt=0;yt<Yt;yt++)gt=Ye[yt],fe=gt,Kt=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) */,""),~gt.indexOf(`
`)&&(Kt-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+Kt+"}","gm"),"")),yt!==Yt-1&&(Ve=this.rules.block.bullet.exec(Ye[yt+1])[0],(xe?Ve.length===1||!Re&&Ve[Ve.length-1]===")":Ve.length>1||this.options.smartLists&&Ve!==pe)&&(Ue=Ye.slice(yt+1).join(`
`),Ne.raw=Ne.raw.substring(0,Ne.raw.length-Ue.length),yt=Yt-1)),Et=dt||/\n\n(?!\s*$)/.test(gt),yt!==Yt-1&&(dt=gt.charAt(gt.length-1)===`
`,Et||(Et=dt)),Et&&(Ne.loose=!0),vt=/^\[[ xX]\] /.test(gt),qt=void 0,vt&&(qt=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,"")),Ne.items.push({type:"list_item",raw:fe,task:vt,checked:qt,loose:Et,text:gt});return Ne}},se.html=function(ie){var ae=this.rules.block.html.exec(ie);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):Z(ae[0]):ae[0]}},se.def=function(ie){var ae=this.rules.block.def.exec(ie);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var fe=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:fe,raw:ae[0],href:ae[2],title:ae[3]}}},se.table=function(ie){var ae=this.rules.block.table.exec(ie);if(ae){var fe={type:"table",header:H(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[]};if(fe.header.length===fe.align.length){fe.raw=ae[0];var pe=fe.align.length,xe;for(xe=0;xe<pe;xe++)/^ *-+: *$/.test(fe.align[xe])?fe.align[xe]="right":/^ *:-+: *$/.test(fe.align[xe])?fe.align[xe]="center":/^ *:-+ *$/.test(fe.align[xe])?fe.align[xe]="left":fe.align[xe]=null;for(pe=fe.cells.length,xe=0;xe<pe;xe++)fe.cells[xe]=H(fe.cells[xe].replace(/^ *\| *| *\| *$/g,""),fe.header.length);return fe}}},se.lheading=function(ie){var ae=this.rules.block.lheading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},se.paragraph=function(ie){var ae=this.rules.block.paragraph.exec(ie);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
`?ae[1].slice(0,-1):ae[1]}},se.text=function(ie,ae){var fe=this.rules.block.text.exec(ie);if(fe){var pe=ae[ae.length-1];return pe&&pe.type==="text"?{raw:fe[0],text:fe[0]}:{type:"text",raw:fe[0],text:fe[0]}}},se.escape=function(ie){var ae=this.rules.inline.escape.exec(ie);if(ae)return{type:"escape",raw:ae[0],text:Z(ae[1])}},se.tag=function(ie,ae,fe){var pe=this.rules.inline.tag.exec(ie);if(pe)return!ae&&/^<a /i.test(pe[0])?ae=!0:ae&&/^<\/a>/i.test(pe[0])&&(ae=!1),!fe&&/^<(pre|code|kbd|script)(\s|>)/i.test(pe[0])?fe=!0:fe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(pe[0])&&(fe=!1),{type:this.options.sanitize?"text":"html",raw:pe[0],inLink:ae,inRawBlock:fe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):Z(pe[0]):pe[0]}},se.link=function(ie){var ae=this.rules.inline.link.exec(ie);if(ae){var fe=oe(ae[2],"()");if(fe>-1){var pe=ae[0].indexOf("!")===0?5:4,xe=pe+ae[1].length+fe;ae[2]=ae[2].substring(0,fe),ae[0]=ae[0].substring(0,xe).trim(),ae[3]=""}var Re=ae[2],Ne="";if(this.options.pedantic){var Ye=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);Ye?(Re=Ye[1],Ne=Ye[3]):Ne=""}else Ne=ae[3]?ae[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=de(ae,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:Ne&&Ne.replace(this.rules.inline._escapes,"$1")},ae[0]);return dt}},se.reflink=function(ie,ae){var fe;if((fe=this.rules.inline.reflink.exec(ie))||(fe=this.rules.inline.nolink.exec(ie))){var pe=(fe[2]||fe[1]).replace(/\s+/g," ");if(pe=ae[pe.toLowerCase()],!pe||!pe.href){var xe=fe[0].charAt(0);return{type:"text",raw:xe,text:xe}}var Re=de(fe,pe,fe[0]);return Re}},se.strong=function(ie,ae,fe){fe===void 0&&(fe="");var pe=this.rules.inline.strong.start.exec(ie);if(pe&&(!pe[1]||pe[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ae=ae.slice(-1*ie.length);var xe=pe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;xe.lastIndex=0;for(var Re;(pe=xe.exec(ae))!=null;)if(Re=this.rules.inline.strong.middle.exec(ae.slice(0,pe.index+3)),Re)return{type:"strong",raw:ie.slice(0,Re[0].length),text:ie.slice(2,Re[0].length-2)}}},se.em=function(ie,ae,fe){fe===void 0&&(fe="");var pe=this.rules.inline.em.start.exec(ie);if(pe&&(!pe[1]||pe[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ae=ae.slice(-1*ie.length);var xe=pe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;xe.lastIndex=0;for(var Re;(pe=xe.exec(ae))!=null;)if(Re=this.rules.inline.em.middle.exec(ae.slice(0,pe.index+2)),Re)return{type:"em",raw:ie.slice(0,Re[0].length),text:ie.slice(1,Re[0].length-1)}}},se.codespan=function(ie){var ae=this.rules.inline.code.exec(ie);if(ae){var fe=ae[2].replace(/\n/g," "),pe=/[^ ]/.test(fe),xe=fe.startsWith(" ")&&fe.endsWith(" ");return pe&&xe&&(fe=fe.substring(1,fe.length-1)),fe=Z(fe,!0),{type:"codespan",raw:ae[0],text:fe}}},se.br=function(ie){var ae=this.rules.inline.br.exec(ie);if(ae)return{type:"br",raw:ae[0]}},se.del=function(ie){var ae=this.rules.inline.del.exec(ie);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},se.autolink=function(ie,ae){var fe=this.rules.inline.autolink.exec(ie);if(fe){var pe,xe;return fe[2]==="@"?(pe=Z(this.options.mangle?ae(fe[1]):fe[1]),xe="mailto:"+pe):(pe=Z(fe[1]),xe=pe),{type:"link",raw:fe[0],text:pe,href:xe,tokens:[{type:"text",raw:pe,text:pe}]}}},se.url=function(ie,ae){var fe;if(fe=this.rules.inline.url.exec(ie)){var pe,xe;if(fe[2]==="@")pe=Z(this.options.mangle?ae(fe[0]):fe[0]),xe="mailto:"+pe;else{var Re;do Re=fe[0],fe[0]=this.rules.inline._backpedal.exec(fe[0])[0];while(Re!==fe[0]);pe=Z(fe[0]),fe[1]==="www."?xe="http://"+pe:xe=pe}return{type:"link",raw:fe[0],text:pe,href:xe,tokens:[{type:"text",raw:pe,text:pe}]}}},se.inlineText=function(ie,ae,fe){var pe=this.rules.inline.text.exec(ie);if(pe){var xe;return ae?xe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):Z(pe[0]):pe[0]:xe=Z(this.options.smartypants?fe(pe[0]):pe[0]),{type:"text",raw:pe[0],text:xe}}},te}(),Ae=U.noopTest,Ce=U.edit,_e=U.merge,ge={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:Ae,table:Ae,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=Ce(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=Ce(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=Ce(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._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",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=Ce(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=Ce(ge._paragraph).replace("hr",ge.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",ge._tag).getRegex(),ge.blockquote=Ce(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=_e({},ge),ge.gfm=_e({},ge.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*|$)"}),ge.gfm.nptable=Ce(ge.gfm.nptable).replace("hr",ge.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",ge._tag).getRegex(),ge.gfm.table=Ce(ge.gfm.table).replace("hr",ge.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",ge._tag).getRegex(),ge.pedantic=_e({},ge.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._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:Ae,paragraph:Ce(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var V={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ae,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:Ae,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};V._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",V.punctuation=Ce(V.punctuation).replace(/punctuation/g,V._punctuation).getRegex(),V._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",V._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",V.em.start=Ce(V.em.start).replace(/punctuation/g,V._punctuation).getRegex(),V.em.middle=Ce(V.em.middle).replace(/punctuation/g,V._punctuation).replace(/overlapSkip/g,V._overlapSkip).getRegex(),V.em.endAst=Ce(V.em.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.em.endUnd=Ce(V.em.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.start=Ce(V.strong.start).replace(/punctuation/g,V._punctuation).getRegex(),V.strong.middle=Ce(V.strong.middle).replace(/punctuation/g,V._punctuation).replace(/blockSkip/g,V._blockSkip).getRegex(),V.strong.endAst=Ce(V.strong.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.endUnd=Ce(V.strong.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.blockSkip=Ce(V._blockSkip,"g").getRegex(),V.overlapSkip=Ce(V._overlapSkip,"g").getRegex(),V._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,V._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,V._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])?)+(?![-_])/,V.autolink=Ce(V.autolink).replace("scheme",V._scheme).replace("email",V._email).getRegex(),V._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,V.tag=Ce(V.tag).replace("comment",ge._comment).replace("attribute",V._attribute).getRegex(),V._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,V._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,V._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,V.link=Ce(V.link).replace("label",V._label).replace("href",V._href).replace("title",V._title).getRegex(),V.reflink=Ce(V.reflink).replace("label",V._label).getRegex(),V.reflinkSearch=Ce(V.reflinkSearch,"g").replace("reflink",V.reflink).replace("nolink",V.nolink).getRegex(),V.normal=_e({},V),V.pedantic=_e({},V.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:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",V._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V._label).getRegex()}),V.gfm=_e({},V.normal,{escape:Ce(V.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),V.gfm.url=Ce(V.gfm.url,"i").replace("email",V.gfm._extended_email).getRegex(),V.breaks=_e({},V.gfm,{br:Ce(V.br).replace("{2,}","*").getRegex(),text:Ce(V.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var I={block:ge,inline:V},F=G.defaults,J=I.block,ne=I.inline;function z(te){return te.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 me(te){var se="",he,ie,ae=te.length;for(he=0;he<ae;he++)ie=te.charCodeAt(he),Math.random()>.5&&(ie="x"+ie.toString(16)),se+="&#"+ie+";";return se}var Oe=function(){function te(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||F,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:J.normal,inline:ne.normal};this.options.pedantic?(ie.block=J.pedantic,ie.inline=ne.pedantic):this.options.gfm&&(ie.block=J.gfm,this.options.breaks?ie.inline=ne.breaks:ie.inline=ne.gfm),this.tokenizer.rules=ie}te.lex=function(ie,ae){var fe=new te(ae);return fe.lex(ie)};var se=te.prototype;return se.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function(ie,ae,fe){ae===void 0&&(ae=[]),fe===void 0&&(fe=!0),ie=ie.replace(/^ +$/gm,"");for(var pe,xe,Re,Ne;ie;){if(pe=this.tokenizer.space(ie)){ie=ie.substring(pe.raw.length),pe.type&&ae.push(pe);continue}if(pe=this.tokenizer.code(ie,ae)){ie=ie.substring(pe.raw.length),pe.type?ae.push(pe):(Ne=ae[ae.length-1],Ne.raw+=`
`+pe.raw,Ne.text+=`
`+pe.text);continue}if(pe=this.tokenizer.fences(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.heading(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.nptable(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.hr(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.blockquote(ie)){ie=ie.substring(pe.raw.length),pe.tokens=this.blockTokens(pe.text,[],fe),ae.push(pe);continue}if(pe=this.tokenizer.list(ie)){for(ie=ie.substring(pe.raw.length),Re=pe.items.length,xe=0;xe<Re;xe++)pe.items[xe].tokens=this.blockTokens(pe.items[xe].text,[],!1);ae.push(pe);continue}if(pe=this.tokenizer.html(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(fe&&(pe=this.tokenizer.def(ie))){ie=ie.substring(pe.raw.length),this.tokens.links[pe.tag]||(this.tokens.links[pe.tag]={href:pe.href,title:pe.title});continue}if(pe=this.tokenizer.table(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.lheading(ie)){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(fe&&(pe=this.tokenizer.paragraph(ie))){ie=ie.substring(pe.raw.length),ae.push(pe);continue}if(pe=this.tokenizer.text(ie,ae)){ie=ie.substring(pe.raw.length),pe.type?ae.push(pe):(Ne=ae[ae.length-1],Ne.raw+=`
`+pe.raw,Ne.text+=`
`+pe.text);continue}if(ie){var Ye="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(Ye);break}else throw new Error(Ye)}}return ae},se.inline=function(ie){var ae,fe,pe,xe,Re,Ne,Ye=ie.length;for(ae=0;ae<Ye;ae++){Ne=ie[ae];switch(Ne.type){case"paragraph":case"text":case"heading":{Ne.tokens=[],this.inlineTokens(Ne.text,Ne.tokens);break}case"table":{for(Ne.tokens={header:[],cells:[]},xe=Ne.header.length,fe=0;fe<xe;fe++)Ne.tokens.header[fe]=[],this.inlineTokens(Ne.header[fe],Ne.tokens.header[fe]);for(xe=Ne.cells.length,fe=0;fe<xe;fe++)for(Re=Ne.cells[fe],Ne.tokens.cells[fe]=[],pe=0;pe<Re.length;pe++)Ne.tokens.cells[fe][pe]=[],this.inlineTokens(Re[pe],Ne.tokens.cells[fe][pe]);break}case"blockquote":{this.inline(Ne.tokens);break}case"list":{for(xe=Ne.items.length,fe=0;fe<xe;fe++)this.inline(Ne.items[fe].tokens);break}}}return ie},se.inlineTokens=function(ie,ae,fe,pe,xe){ae===void 0&&(ae=[]),fe===void 0&&(fe=!1),pe===void 0&&(pe=!1),xe===void 0&&(xe="");var Re,Ne=ie,Ye;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(Ye=this.tokenizer.rules.inline.reflinkSearch.exec(Ne))!=null;)dt.includes(Ye[0].slice(Ye[0].lastIndexOf("[")+1,-1))&&(Ne=Ne.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ye=this.tokenizer.rules.inline.blockSkip.exec(Ne))!=null;)Ne=Ne.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Re=this.tokenizer.escape(ie)){ie=ie.substring(Re.raw.length),ae.push(Re);continue}if(Re=this.tokenizer.tag(ie,fe,pe)){ie=ie.substring(Re.raw.length),fe=Re.inLink,pe=Re.inRawBlock,ae.push(Re);continue}if(Re=this.tokenizer.link(ie)){ie=ie.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,pe)),ae.push(Re);continue}if(Re=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,pe)),ae.push(Re);continue}if(Re=this.tokenizer.strong(ie,Ne,xe)){ie=ie.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],fe,pe),ae.push(Re);continue}if(Re=this.tokenizer.em(ie,Ne,xe)){ie=ie.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],fe,pe),ae.push(Re);continue}if(Re=this.tokenizer.codespan(ie)){ie=ie.substring(Re.raw.length),ae.push(Re);continue}if(Re=this.tokenizer.br(ie)){ie=ie.substring(Re.raw.length),ae.push(Re);continue}if(Re=this.tokenizer.del(ie)){ie=ie.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],fe,pe),ae.push(Re);continue}if(Re=this.tokenizer.autolink(ie,me)){ie=ie.substring(Re.raw.length),ae.push(Re);continue}if(!fe&&(Re=this.tokenizer.url(ie,me))){ie=ie.substring(Re.raw.length),ae.push(Re);continue}if(Re=this.tokenizer.inlineText(ie,pe,z)){ie=ie.substring(Re.raw.length),xe=Re.raw.slice(-1),ae.push(Re);continue}if(ie){var gt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(gt);break}else throw new Error(gt)}}return ae},X(te,null,[{key:"rules",get:function(){return{block:J,inline:ne}}}]),te}(),ke=G.defaults,ce=U.cleanUrl,ye=U.escape,Se=function(){function te(he){this.options=he||ke}var se=te.prototype;return se.code=function(ie,ae,fe){var pe=(ae||"").match(/\S*/)[0];if(this.options.highlight){var xe=this.options.highlight(ie,pe);xe!=null&&xe!==ie&&(fe=!0,ie=xe)}return pe?'<pre><code class="'+this.options.langPrefix+ye(pe,!0)+'">'+(fe?ie:ye(ie,!0))+`</code></pre>
`:"<pre><code>"+(fe?ie:ye(ie,!0))+`</code></pre>
`},se.blockquote=function(ie){return`<blockquote>
`+ie+`</blockquote>
`},se.html=function(ie){return ie},se.heading=function(ie,ae,fe,pe){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+pe.slug(fe)+'">'+ie+"</h"+ae+`>
`:"<h"+ae+">"+ie+"</h"+ae+`>
`},se.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},se.list=function(ie,ae,fe){var pe=ae?"ol":"ul",xe=ae&&fe!==1?' start="'+fe+'"':"";return"<"+pe+xe+`>
`+ie+"</"+pe+`>
`},se.listitem=function(ie){return"<li>"+ie+`</li>
`},se.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},se.paragraph=function(ie){return"<p>"+ie+`</p>
`},se.table=function(ie,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
<thead>
`+ie+`</thead>
`+ae+`</table>
`},se.tablerow=function(ie){return`<tr>
`+ie+`</tr>
`},se.tablecell=function(ie,ae){var fe=ae.header?"th":"td",pe=ae.align?"<"+fe+' align="'+ae.align+'">':"<"+fe+">";return pe+ie+"</"+fe+`>
`},se.strong=function(ie){return"<strong>"+ie+"</strong>"},se.em=function(ie){return"<em>"+ie+"</em>"},se.codespan=function(ie){return"<code>"+ie+"</code>"},se.br=function(){return this.options.xhtml?"<br/>":"<br>"},se.del=function(ie){return"<del>"+ie+"</del>"},se.link=function(ie,ae,fe){if(ie=ce(this.options.sanitize,this.options.baseUrl,ie),ie===null)return fe;var pe='<a href="'+ye(ie)+'"';return ae&&(pe+=' title="'+ae+'"'),pe+=">"+fe+"</a>",pe},se.image=function(ie,ae,fe){if(ie=ce(this.options.sanitize,this.options.baseUrl,ie),ie===null)return fe;var pe='<img src="'+ie+'" alt="'+fe+'"';return ae&&(pe+=' title="'+ae+'"'),pe+=this.options.xhtml?"/>":">",pe},se.text=function(ie){return ie},te}(),Le=function(){function te(){}var se=te.prototype;return se.strong=function(ie){return ie},se.em=function(ie){return ie},se.codespan=function(ie){return ie},se.del=function(ie){return ie},se.html=function(ie){return ie},se.text=function(ie){return ie},se.link=function(ie,ae,fe){return""+fe},se.image=function(ie,ae,fe){return""+fe},se.br=function(){return""},te}(),Be=function(){function te(){this.seen={}}var se=te.prototype;return se.slug=function(ie){var ae=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var fe=ae;do this.seen[fe]++,ae=fe+"-"+this.seen[fe];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},te}(),We=G.defaults,Ke=U.unescape,Xe=function(){function te(he){this.options=he||We,this.options.renderer=this.options.renderer||new Se,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Be}te.parse=function(ie,ae){var fe=new te(ae);return fe.parse(ie)};var se=te.prototype;return se.parse=function(ie,ae){ae===void 0&&(ae=!0);var fe="",pe,xe,Re,Ne,Ye,dt,gt,Kt,Ve,Ue,Et,vt,qt,Yt,yt,Qe,xn,Me,un=ie.length;for(pe=0;pe<un;pe++){Ue=ie[pe];switch(Ue.type){case"space":continue;case"hr":{fe+=this.renderer.hr();continue}case"heading":{fe+=this.renderer.heading(this.parseInline(Ue.tokens),Ue.depth,Ke(this.parseInline(Ue.tokens,this.textRenderer)),this.slugger);continue}case"code":{fe+=this.renderer.code(Ue.text,Ue.lang,Ue.escaped);continue}case"table":{for(Kt="",gt="",Ne=Ue.header.length,xe=0;xe<Ne;xe++)gt+=this.renderer.tablecell(this.parseInline(Ue.tokens.header[xe]),{header:!0,align:Ue.align[xe]});for(Kt+=this.renderer.tablerow(gt),Ve="",Ne=Ue.cells.length,xe=0;xe<Ne;xe++){for(dt=Ue.tokens.cells[xe],gt="",Ye=dt.length,Re=0;Re<Ye;Re++)gt+=this.renderer.tablecell(this.parseInline(dt[Re]),{header:!1,align:Ue.align[Re]});Ve+=this.renderer.tablerow(gt)}fe+=this.renderer.table(Kt,Ve);continue}case"blockquote":{Ve=this.parse(Ue.tokens),fe+=this.renderer.blockquote(Ve);continue}case"list":{for(Et=Ue.ordered,vt=Ue.start,qt=Ue.loose,Ne=Ue.items.length,Ve="",xe=0;xe<Ne;xe++)yt=Ue.items[xe],Qe=yt.checked,xn=yt.task,Yt="",yt.task&&(Me=this.renderer.checkbox(Qe),qt?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=Me+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=Me+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:Me}):Yt+=Me),Yt+=this.parse(yt.tokens,qt),Ve+=this.renderer.listitem(Yt,xn,Qe);fe+=this.renderer.list(Ve,Et,vt);continue}case"html":{fe+=this.renderer.html(Ue.text);continue}case"paragraph":{fe+=this.renderer.paragraph(this.parseInline(Ue.tokens));continue}case"text":{for(Ve=Ue.tokens?this.parseInline(Ue.tokens):Ue.text;pe+1<un&&ie[pe+1].type==="text";)Ue=ie[++pe],Ve+=`
`+(Ue.tokens?this.parseInline(Ue.tokens):Ue.text);fe+=ae?this.renderer.paragraph(Ve):Ve;continue}default:{var ft='Token with "'+Ue.type+'" type was not found.';if(this.options.silent){console.error(ft);return}else throw new Error(ft)}}}return fe},se.parseInline=function(ie,ae){ae=ae||this.renderer;var fe="",pe,xe,Re=ie.length;for(pe=0;pe<Re;pe++){xe=ie[pe];switch(xe.type){case"escape":{fe+=ae.text(xe.text);break}case"html":{fe+=ae.html(xe.text);break}case"link":{fe+=ae.link(xe.href,xe.title,this.parseInline(xe.tokens,ae));break}case"image":{fe+=ae.image(xe.href,xe.title,xe.text);break}case"strong":{fe+=ae.strong(this.parseInline(xe.tokens,ae));break}case"em":{fe+=ae.em(this.parseInline(xe.tokens,ae));break}case"codespan":{fe+=ae.codespan(xe.text);break}case"br":{fe+=ae.br();break}case"del":{fe+=ae.del(this.parseInline(xe.tokens,ae));break}case"text":{fe+=ae.text(xe.text);break}default:{var Ne='Token with "'+xe.type+'" type was not found.';if(this.options.silent){console.error(Ne);return}else throw new Error(Ne)}}}return fe},te}(),lt=U.merge,Je=U.checkSanitizeDeprecation,qe=U.escape,Pe=G.getDefaults,pt=G.changeDefaults,ut=G.defaults;function ue(te,se,he){if(typeof te=="undefined"||te===null)throw new Error("marked(): input parameter is undefined or null");if(typeof te!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(te)+", string expected");if(typeof se=="function"&&(he=se,se=null),se=lt({},ue.defaults,se||{}),Je(se),he){var ie=se.highlight,ae;try{ae=Oe.lex(te,se)}catch(Re){return he(Re)}var fe=function(Ne){var Ye;if(!Ne)try{Ye=Xe.parse(ae,se)}catch(dt){Ne=dt}return se.highlight=ie,Ne?he(Ne):he(null,Ye)};if(!ie||ie.length<3)return fe();if(delete se.highlight,!ae.length)return fe();var pe=0;ue.walkTokens(ae,function(Re){Re.type==="code"&&(pe++,setTimeout(function(){ie(Re.text,Re.lang,function(Ne,Ye){if(Ne)return fe(Ne);Ye!=null&&Ye!==Re.text&&(Re.text=Ye,Re.escaped=!0),pe--,pe===0&&fe()})},0))}),pe===0&&fe();return}try{var xe=Oe.lex(te,se);return se.walkTokens&&ue.walkTokens(xe,se.walkTokens),Xe.parse(xe,se)}catch(Re){if(Re.message+=`
Please report this to https://github.com/markedjs/marked.`,se.silent)return"<p>An error occurred:</p><pre>"+qe(Re.message+"",!0)+"</pre>";throw Re}}ue.options=ue.setOptions=function(te){return lt(ue.defaults,te),pt(ue.defaults),ue},ue.getDefaults=Pe,ue.defaults=ut,ue.use=function(te){var se=lt({},te);if(te.renderer&&function(){var ie=ue.defaults.renderer||new Se,ae=function(xe){var Re=ie[xe];ie[xe]=function(){for(var Ne=arguments.length,Ye=new Array(Ne),dt=0;dt<Ne;dt++)Ye[dt]=arguments[dt];var gt=te.renderer[xe].apply(ie,Ye);return gt===!1&&(gt=Re.apply(ie,Ye)),gt}};for(var fe in te.renderer)ae(fe);se.renderer=ie}(),te.tokenizer&&function(){var ie=ue.defaults.tokenizer||new be,ae=function(xe){var Re=ie[xe];ie[xe]=function(){for(var Ne=arguments.length,Ye=new Array(Ne),dt=0;dt<Ne;dt++)Ye[dt]=arguments[dt];var gt=te.tokenizer[xe].apply(ie,Ye);return gt===!1&&(gt=Re.apply(ie,Ye)),gt}};for(var fe in te.tokenizer)ae(fe);se.tokenizer=ie}(),te.walkTokens){var he=ue.defaults.walkTokens;se.walkTokens=function(ie){te.walkTokens(ie),he&&he(ie)}}ue.setOptions(se)},ue.walkTokens=function(te,se){for(var he=j(te),ie;!(ie=he()).done;){var ae=ie.value;se(ae);switch(ae.type){case"table":{for(var fe=j(ae.tokens.header),pe;!(pe=fe()).done;){var xe=pe.value;ue.walkTokens(xe,se)}for(var Re=j(ae.tokens.cells),Ne;!(Ne=Re()).done;)for(var Ye=Ne.value,dt=j(Ye),gt;!(gt=dt()).done;){var Kt=gt.value;ue.walkTokens(Kt,se)}break}case"list":{ue.walkTokens(ae.items,se);break}default:ae.tokens&&ue.walkTokens(ae.tokens,se)}}},ue.Parser=Xe,ue.parser=Xe.parse,ue.Renderer=Se,ue.TextRenderer=Le,ue.Lexer=Oe,ue.lexer=Oe.lex,ue.Tokenizer=be,ue.Slugger=Be,ue.parse=ue;var q=ue;return q})},ELLl:function(rt,we,$){(function(le){le($("VrN/"))})(function(le){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=le.Pos;le.defineOption("autoCloseBrackets",!1,function(d,p,l){l&&l!=le.Init&&(d.removeKeyMap(j),d.state.closeBrackets=null),p&&(P(Y(p,"pairs")),d.state.closeBrackets=p,d.addKeyMap(j))});function Y(d,p){return p=="pairs"&&typeof d=="string"?d:typeof d=="object"&&d[p]!=null?d[p]:X[p]}var j={Backspace:n,Enter:L};function P(d){for(var p=0;p<d.length;p++){var l=d.charAt(p),h="'"+l+"'";j[h]||(j[h]=G(l))}}P(X.pairs+"`");function G(d){return function(p){return m(p,d)}}function W(d){var p=d.state.closeBrackets;if(!p||p.override)return p;var l=d.getModeAt(d.getCursor());return l.closeBrackets||p}function n(d){var p=W(d);if(!p||d.getOption("disableInput"))return le.Pass;for(var l=Y(p,"pairs"),h=d.listSelections(),o=0;o<h.length;o++){if(!h[o].empty())return le.Pass;var s=g(d,h[o].head);if(!s||l.indexOf(s)%2!=0)return le.Pass}for(var o=h.length-1;o>=0;o--){var A=h[o].head;d.replaceRange("",D(A.line,A.ch-1),D(A.line,A.ch+1),"+delete")}}function L(d){var p=W(d),l=p&&Y(p,"explode");if(!l||d.getOption("disableInput"))return le.Pass;for(var h=d.listSelections(),o=0;o<h.length;o++){if(!h[o].empty())return le.Pass;var s=g(d,h[o].head);if(!s||l.indexOf(s)%2!=0)return le.Pass}d.operation(function(){var A=d.lineSeparator()||`
`;d.replaceSelection(A+A,null),d.execCommand("goCharLeft"),h=d.listSelections();for(var x=0;x<h.length;x++){var S=h[x].head.line;d.indentLine(S,null,!0),d.indentLine(S+1,null,!0)}})}function b(d){var p=le.cmpPos(d.anchor,d.head)>0;return{anchor:new D(d.anchor.line,d.anchor.ch+(p?-1:1)),head:new D(d.head.line,d.head.ch+(p?1:-1))}}function m(d,p){var l=W(d);if(!l||d.getOption("disableInput"))return le.Pass;var h=Y(l,"pairs"),o=h.indexOf(p);if(o==-1)return le.Pass;for(var s=Y(l,"closeBefore"),A=Y(l,"triples"),x=h.charAt(o+1)==p,S=d.listSelections(),O=o%2==0,R,C=0;C<S.length;C++){var w=S[C],y=w.head,u,v=d.getRange(y,D(y.line,y.ch+1));if(O&&!w.empty())u="surround";else if((x||!O)&&v==p)x&&c(d,y)?u="both":A.indexOf(p)>=0&&d.getRange(y,D(y.line,y.ch+3))==p+p+p?u="skipThree":u="skip";else if(x&&y.ch>1&&A.indexOf(p)>=0&&d.getRange(D(y.line,y.ch-2),y)==p+p){if(y.ch>2&&/\bstring/.test(d.getTokenTypeAt(D(y.line,y.ch-2))))return le.Pass;u="addFour"}else if(x){var a=y.ch==0?" ":d.getRange(D(y.line,y.ch-1),y);if(!le.isWordChar(v)&&a!=p&&!le.isWordChar(a))u="both";else return le.Pass}else if(O&&(v.length===0||/\s/.test(v)||s.indexOf(v)>-1))u="both";else return le.Pass;if(!R)R=u;else if(R!=u)return le.Pass}var _=o%2?h.charAt(o-1):p,N=o%2?p:h.charAt(o+1);d.operation(function(){if(R=="skip")d.execCommand("goCharRight");else if(R=="skipThree")for(var B=0;B<3;B++)d.execCommand("goCharRight");else if(R=="surround"){for(var T=d.getSelections(),B=0;B<T.length;B++)T[B]=_+T[B]+N;d.replaceSelections(T,"around"),T=d.listSelections().slice();for(var B=0;B<T.length;B++)T[B]=b(T[B]);d.setSelections(T)}else R=="both"?(d.replaceSelection(_+N,null),d.triggerElectric(_+N),d.execCommand("goCharLeft")):R=="addFour"&&(d.replaceSelection(_+_+_+_,"before"),d.execCommand("goCharRight"))})}function g(d,p){var l=d.getRange(D(p.line,p.ch-1),D(p.line,p.ch+1));return l.length==2?l:null}function c(d,p){var l=d.getTokenAt(D(p.line,p.ch+1));return/\bstring/.test(l.type)&&l.start==p.ch&&(p.ch==0||!/\bstring/.test(d.getTokenTypeAt(p)))}})},FWmy:function(rt,we,$){"use strict";$.d(we,"a",function(){return le});function le(X,D){if(!X)throw new Error(D?`Assertion failed (${D})`:"Assertion Failed")}},HmJG:function(rt,we,$){},JYp7:function(rt,we,$){"use strict";$.d(we,"a",function(){return le});var le;(function(X){function D(s){return s&&typeof s=="object"&&typeof s[Symbol.iterator]=="function"}X.is=D;const Y=Object.freeze([]);function j(){return Y}X.empty=j;function*P(s){yield s}X.single=P;function G(s){return s||Y}X.from=G;function W(s){return!s||s[Symbol.iterator]().next().done===!0}X.isEmpty=W;function n(s){return s[Symbol.iterator]().next().value}X.first=n;function L(s,A){for(const x of s)if(A(x))return!0;return!1}X.some=L;function b(s,A){for(const x of s)if(A(x))return x;return}X.find=b;function*m(s,A){for(const x of s)A(x)&&(yield x)}X.filter=m;function*g(s,A){let x=0;for(const S of s)yield A(S,x++)}X.map=g;function*c(...s){for(const A of s)for(const x of A)yield x}X.concat=c;function*d(s){for(const A of s)for(const x of A)yield x}X.concatNested=d;function p(s,A,x){let S=x;for(const O of s)S=A(S,O);return S}X.reduce=p;function*l(s,A,x=s.length){for(A<0&&(A+=s.length),x<0?x+=s.length:x>s.length&&(x=s.length);A<x;A++)yield s[A]}X.slice=l;function h(s,A=Number.POSITIVE_INFINITY){const x=[];if(A===0)return[x,s];const S=s[Symbol.iterator]();for(let O=0;O<A;O++){const R=S.next();if(R.done)return[x,X.empty()];x.push(R.value)}return[x,{[Symbol.iterator](){return S}}]}X.consume=h;function o(s,A,x=(S,O)=>S===O){const S=s[Symbol.iterator](),O=A[Symbol.iterator]();for(;;){const R=S.next(),C=O.next();if(R.done!==C.done)return!1;if(R.done)return!0;if(!x(R.value,C.value))return!1}}X.equals=o})(le||(le={}))},LdHM:function(rt,we,$){"use strict";$.d(we,"b",function(){return s}),$.d(we,"a",function(){return x});var le=$("1OyB"),X=$("vuIU"),D=$("Ji7U"),Y=$("LK+K"),j=$("q1tI"),P=$("rePB"),G=$("Ff2n"),W=$("ODXe"),n=$("4IlW"),L=$("bX4T"),b=$("YrtM"),m=$("TSYQ"),g=$.n(m),c=$("+nKL"),d=$("8OUc"),p=function(H,Z){var oe=H.prefixCls,de=H.id,Te=H.flattenOptions,be=H.childrenAsData,Ae=H.values,Ce=H.searchValue,_e=H.multiple,ge=H.defaultActiveFirstOption,V=H.height,I=H.itemHeight,F=H.notFoundContent,J=H.open,ne=H.menuItemSelectedIcon,z=H.virtual,me=H.onSelect,Oe=H.onToggleOpen,ke=H.onActiveValue,ce=H.onScroll,ye=H.onMouseEnter,Se="".concat(oe,"-item"),Le=Object(b.a)(function(){return Te},[J,Te],function(q,te){return te[0]&&q[1]!==te[1]}),Be=j.useRef(null),We=function(te){te.preventDefault()},Ke=function(te){Be.current&&Be.current.scrollTo({index:te})},Xe=function(te){for(var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=Le.length,ie=0;ie<he;ie+=1){var ae=(te+ie*se+he)%he,fe=Le[ae],pe=fe.group,xe=fe.data;if(!pe&&!xe.disabled)return ae}return-1},lt=j.useState(function(){return Xe(0)}),Je=Object(W.a)(lt,2),qe=Je[0],Pe=Je[1],pt=function(te){Pe(te);var se=Le[te];if(!se){ke(null,-1);return}ke(se.data.value,te)};j.useEffect(function(){pt(ge!==!1?Xe(0):-1)},[Le.length,Ce]),j.useEffect(function(){var q=setTimeout(function(){if(!_e&&J&&Ae.size===1){var te=Array.from(Ae)[0],se=Le.findIndex(function(he){var ie=he.data;return ie.value===te});pt(se),Ke(se)}});return function(){return clearTimeout(q)}},[J]);var ut=function(te){te!==void 0&&me(te,{selected:!Ae.has(te)}),_e||Oe(!1)};if(j.useImperativeHandle(Z,function(){return{onKeyDown:function(te){var se=te.which;switch(se){case n.a.UP:case n.a.DOWN:{var he=0;if(se===n.a.UP?he=-1:se===n.a.DOWN&&(he=1),he!==0){var ie=Xe(qe+he,he);Ke(ie),pt(ie)}break}case n.a.ENTER:{var ae=Le[qe];ae&&!ae.data.disabled?ut(ae.data.value):ut(void 0),J&&te.preventDefault();break}case n.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(te){Ke(te)}}}),Le.length===0)return j.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(Se,"-empty"),onMouseDown:We},F);function ue(q){var te=Le[q];if(!te)return null;var se=te.data||{},he=se.value,ie=se.label,ae=se.children,fe=Object(L.a)(se,!0),pe=be?ae:ie;return te?j.createElement("div",Object.assign({"aria-label":typeof pe=="string"?pe:null},fe,{key:q,role:"option",id:"".concat(de,"_list_").concat(q),"aria-selected":Ae.has(he)}),he):null}return j.createElement(j.Fragment,null,j.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},ue(qe-1),ue(qe),ue(qe+1)),j.createElement(c.a,{itemKey:"key",ref:Be,data:Le,height:V,itemHeight:I,fullHeight:!1,onMouseDown:We,onScroll:ce,virtual:z,onMouseEnter:ye},function(q,te){var se,he=q.group,ie=q.groupOption,ae=q.data,fe=ae.label,pe=ae.key;if(he)return j.createElement("div",{className:g()(Se,"".concat(Se,"-group"))},fe!==void 0?fe:pe);var xe=ae.disabled,Re=ae.value,Ne=ae.title,Ye=ae.children,dt=ae.style,gt=ae.className,Kt=Object(G.a)(ae,["disabled","value","title","children","style","className"]),Ve=Ae.has(Re),Ue="".concat(Se,"-option"),Et=g()(Se,Ue,gt,(se={},Object(P.a)(se,"".concat(Ue,"-grouped"),ie),Object(P.a)(se,"".concat(Ue,"-active"),qe===te&&!xe),Object(P.a)(se,"".concat(Ue,"-disabled"),xe),Object(P.a)(se,"".concat(Ue,"-selected"),Ve),se)),vt=be?Ye:fe,qt=!ne||typeof ne=="function"||Ve;return j.createElement("div",Object.assign({},Kt,{"aria-selected":Ve,className:Et,title:Ne,onMouseMove:function(){if(qe===te||xe)return;pt(te)},onClick:function(){xe||ut(Re)},style:dt}),j.createElement("div",{className:"".concat(Ue,"-content")},vt||Re),j.isValidElement(ne)||Ve,qt&&j.createElement(d.a,{className:"".concat(Se,"-option-state"),customizeIcon:ne,customizeIconProps:{isSelected:Ve}},Ve?"\u2713":null))}))},l=j.forwardRef(p);l.displayName="OptionList";var h=l,o=function(){return null};o.isSelectOption=!0;var s=o,A=function(){return null};A.isSelectOptGroup=!0;var x=A,S=$("VTBJ"),O=$("Zm9Q");function R(E){var H=E.key,Z=E.props,oe=Z.children,de=Z.value,Te=Object(G.a)(Z,["children","value"]);return Object(S.a)({key:H,value:de!==void 0?de:H,children:oe},Te)}function C(E){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(E).map(function(Z,oe){if(!j.isValidElement(Z)||!Z.type)return null;var de=Z.type.isSelectOptGroup,Te=Z.key,be=Z.props,Ae=be.children,Ce=Object(G.a)(be,["children"]);return H||!de?R(Z):Object(S.a)(Object(S.a)({key:"__RC_SELECT_GRP__".concat(Te===null?oe:Te,"__"),label:Te},Ce),{},{options:C(Ae)})}).filter(function(Z){return Z})}var w=$("2Qr1"),y=$("qNPg"),u=$("U8pU"),v=$("Kwbf"),a=$("WKfj");function _(E){var H=E.mode,Z=E.options,oe=E.children,de=E.backfill,Te=E.allowClear,be=E.placeholder,Ae=E.getInputElement,Ce=E.showSearch,_e=E.onSearch,ge=E.defaultOpen,V=E.autoFocus,I=E.labelInValue,F=E.value,J=E.inputValue,ne=E.optionLabelProp,z=H==="multiple"||H==="tags",me=Ce!==void 0?Ce:z||H==="combobox",Oe=Z||C(oe);if(Object(v.a)(H!=="tags"||Oe.every(function(Se){return!Se.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var ke=Oe.some(function(Se){return Se.options?Se.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Se?Se.value:Se.key)=="number"});Object(v.a)(!ke,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!ne,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!Ae,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!Ae||!Te||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),_e&&!me&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ge||V,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),F!=null){var ce=Object(a.d)(F);Object(v.a)(!I||ce.every(function(Se){return Object(u.a)(Se)==="object"&&("key"in Se||"value"in Se)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!z||Array.isArray(F),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var ye=null;Object(O.a)(oe).some(function(Se){if(!j.isValidElement(Se)||!Se.type)return!1;var Le=Se.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Be=Object(O.a)(Se.props.children).every(function(We){return!j.isValidElement(We)||!Se.type||We.type.isSelectOption?!0:(ye=We.type,!1)});return!Be}return ye=Le,!0}),ye&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ye.displayName||ye.name||ye,"`.")),Object(v.a)(J===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=_,B=Object(y.a)({prefixCls:"rc-select",components:{optionList:h},convertChildrenToData:C,flattenOptions:w.d,getLabeledValue:w.e,filterOptions:w.b,isValueDisabled:w.g,findValueOption:w.c,warningProps:N,fillOptionsWithMissingValue:w.a}),T=function(E){Object(D.a)(Z,E);var H=Object(Y.a)(Z);function Z(){var oe;return Object(le.a)(this,Z),oe=H.apply(this,arguments),oe.selectRef=j.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(X.a)(Z,[{key:"render",value:function(){return j.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),Z}(j.Component);T.Option=s,T.OptGroup=x;var U=T,M=we.c=U},LuLp:function(rt,we,$){rt.exports={flex_box_center:"flex_box_center___4bUZY",flex_space_between:"flex_space_between___1xTjN",flex_box_vertical_center:"flex_box_vertical_center___1vgGz",flex_box_center_end:"flex_box_center_end___P7hNa",flex_box_column:"flex_box_column___2sxpi",wrap:"wrap___lYrXF",modal:"modal___jAVte",titleWrap:"titleWrap___3ZYOv",required:"required___TyqrE",title:"title___YHdJB",colorGray:"colorGray___QPU3J",choiceWrap:"choiceWrap___3fip5",answer:"answer___1b5_q",activeAnswer:"activeAnswer___3IKUq",deleteIcon:"deleteIcon___dg_3n",addIcon:"addIcon___3bFJA",editorWrap:"editorWrap___xeZgL",htmlWrap:"htmlWrap___1-J33",radio:"radio___14ZC8",color333:"color333___2Hi7e",color999:"color999___wFMNh",questionType:"questionType___2DcP-",questionChoices:"questionChoices___1QDDn"}},M8RZ:function(rt,we,$){"use strict";$.d(we,"a",function(){return n});var le=$("fWQN"),X=$("mtLc"),D=$("yKVA"),Y=$("879j"),j=$("q1tI"),P=$.n(j),G=$("i8i4"),W=$.n(G),n=function(L){Object(D.a)(m,L);var b=Object(Y.a)(m);function m(g){var c;Object(le.a)(this,m),c=b.call(this,g);var d=window.document;return c.node=d.createElement("div"),d.body.appendChild(c.node),c}return Object(X.a)(m,[{key:"render",value:function(){var c=this.props.children;return Object(G.createPortal)(c,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),m}(P.a.Component)},MI8n:function(rt,we,$){"use strict";$.d(we,"c",function(){return j}),$.d(we,"b",function(){return n}),$.d(we,"e",function(){return L}),$.d(we,"a",function(){return b}),$.d(we,"d",function(){return m}),$.d(we,"f",function(){return g});var le=$("/cxE"),X=$("pmY6"),D=$("24hK"),Y=$("5Y4S"),j;(function(c){c.None=()=>X.a.None;function d(_){return(N,B=null,T)=>{let U=!1,M;return M=_(E=>U?void 0:(M?M.dispose():U=!0,N.call(B,E)),null,T),U&&M.dispose(),M}}c.once=d;function p(_,N){return x((B,T=null,U)=>_(M=>B.call(T,N(M)),null,U))}c.map=p;function l(_,N){return x((B,T=null,U)=>_(M=>{N(M),B.call(T,M)},null,U))}c.forEach=l;function h(_,N){return x((B,T=null,U)=>_(M=>N(M)&&B.call(T,M),null,U))}c.filter=h;function o(_){return _}c.signal=o;function s(..._){return(N,B=null,T)=>Object(X.e)(..._.map(U=>U(M=>N.call(B,M),null,T)))}c.any=s;function A(_,N,B){let T=B;return p(_,U=>(T=N(T,U),T))}c.reduce=A;function x(_){let N;const B=new n({onFirstListenerAdd(){N=_(B.fire,B)},onLastListenerRemove(){N.dispose()}});return B.event}function S(_,N,B=100,T=!1,U){let M,E,H,Z=0;const oe=new n({leakWarningThreshold:U,onFirstListenerAdd(){M=_(de=>{Z++,E=N(E,de),T&&!H&&(oe.fire(E),E=void 0),clearTimeout(H),H=setTimeout(()=>{const Te=E;E=void 0,H=void 0,(!T||Z>1)&&oe.fire(Te),Z=0},B)})},onLastListenerRemove(){M.dispose()}});return oe.event}c.debounce=S;function O(_,N=(B,T)=>B===T){let B=!0,T;return h(_,U=>{const M=B||!N(U,T);return B=!1,T=U,M})}c.latch=O;function R(_,N){return[c.filter(_,N),c.filter(_,B=>!N(B))]}c.split=R;function C(_,N=!1,B=[]){let T=B.slice(),U=_(H=>{T?T.push(H):E.fire(H)});const M=()=>{T&&T.forEach(H=>E.fire(H)),T=null},E=new n({onFirstListenerAdd(){U||(U=_(H=>E.fire(H)))},onFirstListenerDidAdd(){T&&(N?setTimeout(M):M())},onLastListenerRemove(){U&&U.dispose(),U=null}});return E.event}c.buffer=C;class w{constructor(_){this.event=_}map(_){return new w(p(this.event,_))}forEach(_){return new w(l(this.event,_))}filter(_){return new w(h(this.event,_))}reduce(_,N){return new w(A(this.event,_,N))}latch(){return new w(O(this.event))}debounce(_,N=100,B=!1,T){return new w(S(this.event,_,N,B,T))}on(_,N,B){return this.event(_,N,B)}once(_,N,B){return d(this.event)(_,N,B)}}function y(_){return new w(_)}c.chain=y;function u(_,N,B=T=>T){const T=(...H)=>E.fire(B(...H)),U=()=>_.on(N,T),M=()=>_.removeListener(N,T),E=new n({onFirstListenerAdd:U,onLastListenerRemove:M});return E.event}c.fromNodeEventEmitter=u;function v(_,N,B=T=>T){const T=(...H)=>E.fire(B(...H)),U=()=>_.addEventListener(N,T),M=()=>_.removeEventListener(N,T),E=new n({onFirstListenerAdd:U,onLastListenerRemove:M});return E.event}c.fromDOMEventEmitter=v;function a(_){return new Promise(N=>d(_)(N))}c.toPromise=a})(j||(j={}));class P{constructor(c){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${c}_${P._idPool++}`}start(c){this._stopWatch=new Y.a(!0),this._listenerCount=c}stop(){if(this._stopWatch){const c=this._stopWatch.elapsed();this._elapsedOverall+=c,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${c.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}P._idPool=0;let G=-1;class W{constructor(c,d=Math.random().toString(18).slice(2,5)){this.customThreshold=c,this.name=d,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(c){let d=G;if(typeof this.customThreshold=="number"&&(d=this.customThreshold),d<=0||c<d)return;this._stacks||(this._stacks=new Map);const p=new Error().stack.split(`
`).slice(3).join(`
`),l=this._stacks.get(p)||0;if(this._stacks.set(p,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=d*.5;let h,o=0;for(const[s,A]of this._stacks)(!h||o<A)&&(h=s,o=A);console.warn(`[${this.name}] potential listener LEAK detected, having ${c} listeners already. MOST frequent listener (${o}):`),console.warn(h)}return()=>{const h=this._stacks.get(p)||0;this._stacks.set(p,h-1)}}}class n{constructor(c){var d;this._disposed=!1,this._options=c,this._leakageMon=G>0?new W(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((d=this._options)===null||d===void 0?void 0:d._profName)?new P(this._options._profName):void 0}get event(){return this._event||(this._event=(c,d,p)=>{var l;this._listeners||(this._listeners=new D.a);const h=this._listeners.isEmpty();h&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const o=this._listeners.push(d?[c,d]:c);h&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,c,d);const s=(l=this._leakageMon)===null||l===void 0?void 0:l.check(this._listeners.size),A=Object(X.i)(()=>{if(s&&s(),!this._disposed&&(o(),this._options&&this._options.onLastListenerRemove)){const x=this._listeners&&!this._listeners.isEmpty();x||this._options.onLastListenerRemove(this)}});return p instanceof X.b?p.add(A):Array.isArray(p)&&p.push(A),A}),this._event}fire(c){var d,p;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new D.a);for(let l of this._listeners)this._deliveryQueue.push([l,c]);for((d=this._perfMon)===null||d===void 0||d.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[l,h]=this._deliveryQueue.shift();try{typeof l=="function"?l.call(void 0,h):l[0].call(l[1],h)}catch(o){Object(le.f)(o)}}(p=this._perfMon)===null||p===void 0||p.stop()}}dispose(){var c,d,p,l,h;this._disposed||(this._disposed=!0,(c=this._listeners)===null||c===void 0||c.clear(),(d=this._deliveryQueue)===null||d===void 0||d.clear(),(l=(p=this._options)===null||p===void 0?void 0:p.onLastListenerRemove)===null||l===void 0||l.call(p),(h=this._leakageMon)===null||h===void 0||h.dispose())}}class L extends n{constructor(c){super(c);this._isPaused=0,this._eventQueue=new D.a,this._mergeFn=c==null?void 0:c.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const c=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(c))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(c){this._listeners&&(this._isPaused!==0?this._eventQueue.push(c):super.fire(c))}}class b extends L{constructor(c){var d;super(c);this._delay=(d=c.delay)!==null&&d!==void 0?d:100}fire(c){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(c)}}class m{constructor(){this.buffers=[]}wrapEvent(c){return(d,p,l)=>c(h=>{const o=this.buffers[this.buffers.length-1];o?o.push(()=>d.call(p,h)):d.call(p,h)},void 0,l)}bufferEvents(c){const d=[];this.buffers.push(d);const p=c();return this.buffers.pop(),d.forEach(l=>l()),p}}class g{constructor(){this.listening=!1,this.inputEvent=j.None,this.inputEventListener=X.a.None,this.emitter=new n({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(c){this.inputEvent=c,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=c(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},MNsG:function(rt,we,$){"use strict";(function(le,X){$.d(we,"b",function(){return p}),$.d(we,"i",function(){return s}),$.d(we,"f",function(){return A}),$.d(we,"d",function(){return x}),$.d(we,"g",function(){return S}),$.d(we,"h",function(){return O}),$.d(we,"c",function(){return R}),$.d(we,"k",function(){return C}),$.d(we,"j",function(){return w}),$.d(we,"a",function(){return y}),$.d(we,"e",function(){return a});var D;const Y="en";let j=!1,P=!1,G=!1,W=!1,n=!1,L=!1,b=!1,m,g=Y,c,d;const p=typeof self=="object"?self:typeof le=="object"?le:{};let l;typeof p.vscode!="undefined"&&typeof p.vscode.process!="undefined"?l=p.vscode.process:typeof X!="undefined"&&(l=X);const h=typeof((D=l==null?void 0:l.versions)===null||D===void 0?void 0:D.electron)=="string"&&l.type==="renderer";if(typeof navigator=="object"&&!h)d=navigator.userAgent,j=d.indexOf("Windows")>=0,P=d.indexOf("Macintosh")>=0,b=(d.indexOf("Macintosh")>=0||d.indexOf("iPad")>=0||d.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,G=d.indexOf("Linux")>=0,L=!0,m=navigator.language,g=m;else if(typeof l=="object"){j=l.platform==="win32",P=l.platform==="darwin",G=l.platform==="linux",W=G&&!!l.env.SNAP&&!!l.env.SNAP_REVISION,m=Y,g=Y;const _=l.env.VSCODE_NLS_CONFIG;if(_)try{const N=JSON.parse(_),B=N.availableLanguages["*"];m=N.locale,g=B||Y,c=N._translationsConfigFile}catch(N){}n=!0}else console.error("Unable to resolve platform.");let o=0;P?o=1:j?o=3:G&&(o=2);const s=j,A=P,x=G,S=n,O=L,R=b,C=d,w=function(){if(p.setImmediate)return p.setImmediate.bind(p);if(typeof p.postMessage=="function"&&!p.importScripts){let B=[];p.addEventListener("message",U=>{if(U.data&&U.data.vscodeSetImmediateId)for(let M=0,E=B.length;M<E;M++){const H=B[M];if(H.id===U.data.vscodeSetImmediateId){B.splice(M,1),H.callback();return}}});let T=0;return U=>{const M=++T;B.push({id:M,callback:U}),p.postMessage({vscodeSetImmediateId:M},"*")}}if(typeof(l==null?void 0:l.nextTick)=="function")return l.nextTick.bind(l);const N=Promise.resolve();return B=>N.then(B)}(),y=P||b?2:j?1:3;let u=!0,v=!1;function a(){if(!v){v=!0;const _=new Uint8Array(2);_[0]=1,_[1]=2;const N=new Uint16Array(_.buffer);u=N[0]===(2<<8)+1}return u}}).call(this,$("IyRk"),$("Q2Ig"))},N0LK:function(rt,we,$){"use strict";$.d(we,"C",function(){return le}),$.d(we,"v",function(){return D}),$.d(we,"s",function(){return Y}),$.d(we,"t",function(){return j}),$.d(we,"U",function(){return P}),$.d(we,"J",function(){return G}),$.d(we,"O",function(){return W}),$.d(we,"p",function(){return n}),$.d(we,"T",function(){return L}),$.d(we,"q",function(){return b}),$.d(we,"N",function(){return m}),$.d(we,"M",function(){return g}),$.d(we,"Q",function(){return c}),$.d(we,"u",function(){return d}),$.d(we,"x",function(){return p}),$.d(we,"I",function(){return l}),$.d(we,"f",function(){return h}),$.d(we,"h",function(){return o}),$.d(we,"g",function(){return s}),$.d(we,"i",function(){return A}),$.d(we,"G",function(){return x}),$.d(we,"H",function(){return S}),$.d(we,"r",function(){return O}),$.d(we,"R",function(){return R}),$.d(we,"d",function(){return C}),$.d(we,"e",function(){return w}),$.d(we,"E",function(){return y}),$.d(we,"F",function(){return u}),$.d(we,"j",function(){return v}),$.d(we,"z",function(){return a}),$.d(we,"K",function(){return N}),$.d(we,"L",function(){return B}),$.d(we,"m",function(){return U}),$.d(we,"k",function(){return E}),$.d(we,"A",function(){return Z}),$.d(we,"a",function(){return oe}),$.d(we,"n",function(){return de}),$.d(we,"l",function(){return Te}),$.d(we,"D",function(){return be}),$.d(we,"B",function(){return Ae}),$.d(we,"b",function(){return Ce}),$.d(we,"S",function(){return _e}),$.d(we,"o",function(){return ge}),$.d(we,"P",function(){return V}),$.d(we,"w",function(){return I}),$.d(we,"c",function(){return F}),$.d(we,"y",function(){return z});function le(ce){return!ce||typeof ce!="string"?!0:ce.trim().length===0}const X=/{(\d+)}/g;function D(ce,...ye){return ye.length===0?ce:ce.replace(X,function(Se,Le){const Be=parseInt(Le,10);return isNaN(Be)||Be<0||Be>=ye.length?Se:ye[Be]})}function Y(ce){return ce.replace(/[<>&]/g,function(ye){switch(ye){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ye}})}function j(ce){return ce.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function P(ce,ye=" "){const Se=G(ce,ye);return W(Se,ye)}function G(ce,ye){if(!ce||!ye)return ce;const Se=ye.length;if(Se===0||ce.length===0)return ce;let Le=0;for(;ce.indexOf(ye,Le)===Le;)Le=Le+Se;return ce.substring(Le)}function W(ce,ye){if(!ce||!ye)return ce;const Se=ye.length,Le=ce.length;if(Se===0||Le===0)return ce;let Be=Le,We=-1;for(;!(We=ce.lastIndexOf(ye,Be-1),We===-1||We+Se!==Be);){if(We===0)return"";Be=We}return ce.substring(0,Be)}function n(ce){return ce.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function L(ce){return ce.replace(/\*/g,"")}function b(ce,ye,Se={}){if(!ce)throw new Error("Cannot create regex from empty string");ye||(ce=j(ce)),Se.wholeWord&&(/\B/.test(ce.charAt(0))||(ce="\\b"+ce),/\B/.test(ce.charAt(ce.length-1))||(ce=ce+"\\b"));let Le="";return Se.global&&(Le+="g"),Se.matchCase||(Le+="i"),Se.multiline&&(Le+="m"),Se.unicode&&(Le+="u"),new RegExp(ce,Le)}function m(ce){if(ce.source==="^"||ce.source==="^$"||ce.source==="$"||ce.source==="^\\s*$")return!1;const ye=ce.exec("");return!!(ye&&ce.lastIndex===0)}function g(ce){return(ce.global?"g":"")+(ce.ignoreCase?"i":"")+(ce.multiline?"m":"")+(ce.unicode?"u":"")}function c(ce){return ce.split(/\r\n|\r|\n/)}function d(ce){for(let ye=0,Se=ce.length;ye<Se;ye++){const Le=ce.charCodeAt(ye);if(Le!==32&&Le!==9)return ye}return-1}function p(ce,ye=0,Se=ce.length){for(let Le=ye;Le<Se;Le++){const Be=ce.charCodeAt(Le);if(Be!==32&&Be!==9)return ce.substring(ye,Le)}return ce.substring(ye,Se)}function l(ce,ye=ce.length-1){for(let Se=ye;Se>=0;Se--){const Le=ce.charCodeAt(Se);if(Le!==32&&Le!==9)return Se}return-1}function h(ce,ye){return ce<ye?-1:ce>ye?1:0}function o(ce,ye,Se=0,Le=ce.length,Be=0,We=ye.length){for(;Se<Le&&Be<We;Se++,Be++){let lt=ce.charCodeAt(Se),Je=ye.charCodeAt(Be);if(lt<Je)return-1;if(lt>Je)return 1}const Ke=Le-Se,Xe=We-Be;return Ke<Xe?-1:Ke>Xe?1:0}function s(ce,ye){return A(ce,ye,0,ce.length,0,ye.length)}function A(ce,ye,Se=0,Le=ce.length,Be=0,We=ye.length){for(;Se<Le&&Be<We;Se++,Be++){let lt=ce.charCodeAt(Se),Je=ye.charCodeAt(Be);if(lt===Je)continue;if(lt>=128||Je>=128)return o(ce.toLowerCase(),ye.toLowerCase(),Se,Le,Be,We);x(lt)&&(lt-=32),x(Je)&&(Je-=32);const qe=lt-Je;if(qe===0)continue;return qe}const Ke=Le-Se,Xe=We-Be;return Ke<Xe?-1:Ke>Xe?1:0}function x(ce){return ce>=97&&ce<=122}function S(ce){return ce>=65&&ce<=90}function O(ce,ye){return ce.length===ye.length&&A(ce,ye)===0}function R(ce,ye){const Se=ye.length;return ye.length>ce.length?!1:A(ce,ye,0,Se)===0}function C(ce,ye){let Se,Le=Math.min(ce.length,ye.length);for(Se=0;Se<Le;Se++)if(ce.charCodeAt(Se)!==ye.charCodeAt(Se))return Se;return Le}function w(ce,ye){let Se,Le=Math.min(ce.length,ye.length);const Be=ce.length-1,We=ye.length-1;for(Se=0;Se<Le;Se++)if(ce.charCodeAt(Be-Se)!==ye.charCodeAt(We-Se))return Se;return Le}function y(ce){return 55296<=ce&&ce<=56319}function u(ce){return 56320<=ce&&ce<=57343}function v(ce,ye){return(ce-55296<<10)+(ye-56320)+65536}function a(ce,ye,Se){const Le=ce.charCodeAt(Se);if(y(Le)&&Se+1<ye){const Be=ce.charCodeAt(Se+1);if(u(Be))return v(Le,Be)}return Le}function _(ce,ye){const Se=ce.charCodeAt(ye-1);if(u(Se)&&ye>1){const Le=ce.charCodeAt(ye-2);if(y(Le))return v(Le,Se)}return Se}function N(ce,ye){const Se=J.getInstance(),Le=ye,Be=ce.length,We=a(ce,Be,ye);ye+=We>=65536?2:1;let Ke=Se.getGraphemeBreakType(We);for(;ye<Be;){const Xe=a(ce,Be,ye),lt=Se.getGraphemeBreakType(Xe);if(F(Ke,lt))break;ye+=Xe>=65536?2:1,Ke=lt}return ye-Le}function B(ce,ye){const Se=J.getInstance(),Le=ye,Be=_(ce,ye);ye-=Be>=65536?2:1;let We=Se.getGraphemeBreakType(Be);for(;ye>0;){const Ke=_(ce,ye),Xe=Se.getGraphemeBreakType(Ke);if(F(Xe,We))break;ye-=Ke>=65536?2:1,We=Xe}return Le-ye}const T=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function U(ce){return T.test(ce)}const M=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function E(ce){return M.test(ce)}const H=/^[\t\n\r\x20-\x7E]*$/;function Z(ce){return H.test(ce)}const oe=/[\u2028\u2029]/;function de(ce){return oe.test(ce)}function Te(ce){for(let ye=0,Se=ce.length;ye<Se;ye++)if(be(ce.charCodeAt(ye)))return!0;return!1}function be(ce){return ce=+ce,ce>=11904&&ce<=55215||ce>=63744&&ce<=64255||ce>=65281&&ce<=65374}function Ae(ce){return ce>=127462&&ce<=127487||ce===8986||ce===8987||ce===9200||ce===9203||ce>=9728&&ce<=10175||ce===11088||ce===11093||ce>=127744&&ce<=128591||ce>=128640&&ce<=128764||ce>=128992&&ce<=129003||ce>=129280&&ce<=129535||ce>=129648&&ce<=129750}const Ce=String.fromCharCode(65279);function _e(ce){return!!(ce&&ce.length>0&&ce.charCodeAt(0)===65279)}function ge(ce,ye=!1){return ce?(ye&&(ce=ce.replace(/\\./g,"")),ce.toLowerCase()!==ce):!1}function V(ce){const ye=90-65+1;return ce=ce%(2*ye),ce<ye?String.fromCharCode(97+ce):String.fromCharCode(65+ce-ye)}function I(ce){const ye=J.getInstance();return ye.getGraphemeBreakType(ce)}function F(ce,ye){return ce===0?ye!==5&&ye!==7:ce===2&&ye===3?!1:ce===4||ce===2||ce===3||(ye===4||ye===2||ye===3)?!0:ce===8&&(ye===8||ye===9||ye===11||ye===12)||((ce===11||ce===9)&&(ye===9||ye===10)||((ce===12||ce===10)&&ye===10||(ye===5||ye===13||(ye===7||(ce===1||ce===13&&ye===14)))))?!1:!(ce===6&&ye===6)}class J{constructor(){this._data=ne()}static getInstance(){return J._INSTANCE||(J._INSTANCE=new J),J._INSTANCE}getGraphemeBreakType(ce){if(ce<32)return ce===10?3:ce===13?2:4;if(ce<127)return 0;const ye=this._data,Se=ye.length/3;let Le=1;for(;Le<=Se;)if(ce<ye[3*Le])Le=2*Le;else if(ce>ye[3*Le+1])Le=2*Le+1;else return ye[3*Le+2];return 0}}J._INSTANCE=null;function ne(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function z(ce,ye){if(ce===0)return 0;const Se=me(ce,ye);if(Se!==void 0)return Se;const Le=_(ye,ce);return ce-=Oe(Le),ce}function me(ce,ye){let Se=_(ye,ce);for(ce-=Oe(Se);ke(Se)||Se===65039||Se===8419;){if(ce===0)return;Se=_(ye,ce),ce-=Oe(Se)}if(!Ae(Se))return;if(ce>=0){const Le=_(ye,ce);Le===8205&&(ce-=Oe(Le))}return ce}function Oe(ce){return ce>=65536?2:1}function ke(ce){return 127995<=ce&&ce<=127999}},O2Wb:function(rt,we,$){rt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},Ot1p:function(rt,we,$){"use strict";var le=$("2qtc"),X=$("kLXV"),D=$("rAM+"),Y=$("miYZ"),j=$("tsqr"),P=$("9og8"),G=$("tJVT"),W=$("jrin"),n=$("WmNS"),L=$.n(n),b=$("q1tI"),m=$.n(b),g=$("VrN/"),c=$.n(g),d=$("bdgK"),p=$("p77/"),l=$("Bd2K"),h=$("ELLl"),o=$("19Vz"),s=$("lZu9"),A=$("+NIl"),x=$("kSUc"),S=$("9Bee"),O=function(xe){var Re=xe.value,Ne=Re===void 0?"":Re,Ye=xe.className,dt=xe.showTextOnly,gt=xe.showLines,Kt=xe.style,Ve=Kt===void 0?{}:Kt,Ue=Object(b.useMemo)(function(){return""},[Ne]);return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ue}}))},R=$("0Owb"),C=$("dejd"),w=$("C+DQ"),y=$("1vsH"),u=$("m3rI"),v=[{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 a(xe){var Re=xe.onActionCallback,Ne=xe.title,Ye=xe.icon,dt=xe.actionName,gt=xe.className,Kt=gt===void 0?"":gt,Ve=xe.children;function Ue(){Re(dt)}return m.a.createElement("a",{title:Ne,className:Kt,onClick:Ue},m.a.createElement("i",{className:"md-iconfont ".concat(Ye)}),Ve)}var _=function(xe){var Re=xe.watch,Ne=xe.showNullButton,Ye=xe.onActionCallback,dt=xe.fullScreen,gt=xe.insertTemp,Kt=xe.hidetoolBar,Ve=xe.uuid,Ue=xe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(y.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.F)("_educoder_session"),"&key=").concat(Ve,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Et=[].concat(v,[{title:"".concat(Re?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Re?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return m.a.createElement("ul",{className:"markdown-toolbar-container"},!Kt&&Et.map(function(vt,qt){return m.a.createElement("li",{key:qt},vt.actionName?m.a.createElement(a,Object(R.a)({},vt,{onActionCallback:Ye})):m.a.createElement("span",{className:"v-line"}))}),Ne?m.a.createElement("li",null,m.a.createElement(a,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ye},m.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,gt&&m.a.createElement("li",null,m.a.createElement(a,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(gt),onActionCallback:Ye},m.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),m.a.createElement("li",{className:"btn-full-screen"},m.a.createElement(a,{icon:"".concat(dt?"icon-shrink":"icon-enlarge"),title:dt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ye})))},N=$("M8RZ"),B=$("+L6B"),T=$("2/Rp"),U=$("y8nQ"),M=$("Vl3Y"),E=$("5NDa"),H=$("5rEg"),Z={labelCol:{span:4},wrapperCol:{span:20}},oe=function(xe){var Re=xe.callback,Ne=xe.onCancel;function Ye(dt){Re(dt)}return m.a.createElement(M.a,Object(R.a)({},Z,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ye}),m.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},m.a.createElement(H.a,null)),m.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},m.a.createElement(H.a,null)),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(T.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(T.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))},de=$("7ahc"),Te=$("HmJG"),be=$("BjJ7"),Ae=M.a.useForm,Ce={width:280,marginRight:10},_e={labelCol:{span:5},wrapperCol:{span:19}},ge=function(xe){var Re=xe.callback,Ne=xe.onCancel,Ye=Ae(),dt=Object(G.a)(Ye,1),gt=dt[0];function Kt(Et){Re(Et)}function Ve(Et,vt){if(Et.status===-1){j.b.error(Et.message);return}gt.setFieldsValue({src:"/api/attachments/".concat(Et.id),type:vt.type})}function Ue(Et){var vt=Et.target.files[0];I(vt,Ve)}return m.a.createElement(M.a,Object(R.a)({form:gt},_e,{className:"upload-image-panel",onFinish:Kt}),m.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},m.a.createElement("div",{className:"flex-container"},m.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},m.a.createElement(H.a,{style:Ce})),m.a.createElement(V,{onFileChange:Ue}))),m.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},m.a.createElement(H.a,{style:{width:264}})),m.a.createElement(M.a.Item,{style:{textAlign:"right"}},m.a.createElement(T.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(T.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))};function V(xe){var Re=xe.onFileChange;return m.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",m.a.createElement("input",{type:"file",onChange:Re}))}function I(xe,Re){if(!xe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ne=new FormData;Ne.append("editormd-image-file",xe),Ne.append("file_param_name","editormd-image-file"),Ne.append("byxhr","true");var Ye=new window.XMLHttpRequest;Ye.withCredentials=!0,Ye.addEventListener("load",function(dt){Re(JSON.parse(dt.target.responseText),xe)},!1),Ye.addEventListener("error",function(dt){console.error(dt)},!1),Ye.open("POST","".concat(be.a,"/api/attachments.json")),Ye.send(Ne)}var F=$("giR+"),J=$("fyUT"),ne=$("7Kak"),z=$("9yH6"),me=z.a.Group,Oe={margin:"0 8px"},ke=function(xe){var Re=xe.callback,Ne=xe.onCancel;function Ye(dt){Re(dt)}return m.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ye},m.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},m.a.createElement("span",{style:Oe},"\u5355\u5143\u683C\u6570\uFF1A"),m.a.createElement("span",{style:Oe},"\u884C\u6570"),m.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},m.a.createElement(J.a,null)),m.a.createElement("span",{style:Oe},"\u5217\u6570"),m.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},m.a.createElement(J.a,null))),m.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},m.a.createElement("span",{style:Oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),m.a.createElement(M.a.Item,{name:"align"},m.a.createElement(me,null,m.a.createElement(z.a,{value:"default"},m.a.createElement("i",{className:"fa fa-align-justify"})),m.a.createElement(z.a,{value:"left"},m.a.createElement("i",{className:"fa fa-align-left"})),m.a.createElement(z.a,{value:"center"},m.a.createElement("i",{className:"fa fa-align-center"})),m.a.createElement(z.a,{value:"right"},m.a.createElement("i",{className:"fa fa-align-right"}))))),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(T.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(T.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))},ce=$("ErOA"),ye=$("7Cbv"),Se="link",Le="upload-image",Be="code-block",We="add-table",Ke="------------",Xe={default:Ke,left:":".concat(Ke),center:":".concat(Ke,":"),right:"".concat(Ke,":")},lt=$("9VGf"),Je,qe;function Pe(){}var pt=0,ut=1e4,ue="\u2581",q=`
**\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 te(xe){return/^\d+$/.test(xe)?"".concat(xe,"px"):xe}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,he=se?"Cmd":"Ctrl",ie=["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"],ae=(Je={},Object(W.a)(Je,he+"-B","bold"),Object(W.a)(Je,he+"-I","italic"),Je),fe=(qe={},Object(W.a)(qe,Se,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(qe,Be,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(qe,Le,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(qe,We,"\u6DFB\u52A0\u8868\u683C"),qe),pe=we.a=function(xe){var Re=xe.defaultValue,Ne=Re===void 0?"":Re,Ye=xe.onChange,dt=xe.width,gt=dt===void 0?"100%":dt,Kt=xe.height,Ve=Kt===void 0?400:Kt,Ue=xe.miniToolbar,Et=Ue===void 0?!1:Ue,vt=xe.isFocus,qt=vt===void 0?!1:vt,Yt=xe.watch,yt=xe.insertTemp,Qe=xe.mode,xn=Qe===void 0?"markdown":Qe,Me=xe.id,un=Me===void 0?"markdown-editor-id":Me,ft=xe.showResizeBar,wt=ft===void 0?!1:ft,it=xe.noStorage,Ft=it===void 0?!1:it,tn=xe.showNullButton,Dt=tn===void 0?!1:tn,ze=xe.hidetoolBar,kt=ze===void 0?!1:ze,Ot=xe.fullScreen,nt=Ot===void 0?!1:Ot,at=xe.onBlur,et=xe.onCMBeforeChange,Vt=xe.onFullScreen,Bt=xe.className,Fe=Bt===void 0?"":Bt,ht=xe.disablePaste,hn=ht===void 0?!1:ht,vn=xe.placeholder,bn=vn===void 0?"":vn,cn=xe.values,yn=cn===void 0?"":cn,Tt=Object(b.useState)(null),pn=Object(G.a)(Tt,2),He=pn[0],Ht=pn[1],Qt=Object(b.useState)(Ne),$t=Object(G.a)(Qt,2),Ut=$t[0],Lt=$t[1],_n=Object(b.useState)(Yt),At=Object(G.a)(_n,2),Rt=At[0],tt=At[1],Wt=Object(b.useState)(nt),St=Object(G.a)(Wt,2),mn=St[0],jt=St[1],Xt=Object(b.useState)(""),fn=Object(G.a)(Xt,2),wn=fn[0],Tn=fn[1],nn=Object(b.useState)(0),bt=Object(G.a)(nn,2),ct=bt[0],Mt=bt[1],Zt=Object(b.useState)(Ve),an=Object(G.a)(Zt,2),Pt=an[0],Vn=an[1],ei=Object(b.useState)(!1),hi=Object(G.a)(ei,2),_i=hi[0],Bi=hi[1],ri=Object(b.useRef)(Object(ye.a)()),Ci=Object(b.useRef)(!1),ai=Object(b.useRef)(),ci=Object(b.useRef)(),di=Object(b.useRef)(),ti=Object(b.useRef)(),Ai=Object(b.useRef)(),ji=function(){var Ze=Object(P.a)(L.a.mark(function Ct(){var xt,Gt;return L.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:return sn.next=2,Object(ce.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ri.current}});case 2:Gt=sn.sent,Gt!=null&&(xt=Gt.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",He,ci),Gt.attachments.map(function(rn){rn.content_type.indexOf("image")>-1?He.replaceSelection("![,](/api/attachments/".concat(rn.id,"?type=").concat(rn.content_type,")")):rn.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):rn.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat(rn.content_type,'&disposition=inline" target="_blank">').concat(rn.name,"</a>")):He.replaceSelection("[".concat(rn.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat(rn.content_type,")"))}));case 4:case"end":return sn.stop()}},Ct)}));return function(){return Ze.apply(this,arguments)}}();Object(b.useEffect)(function(){Lt(yn),He==null||He.setValue(yn)},[yn]),Object(b.useEffect)(function(){Vt==null||Vt(mn)},[mn]),Object(b.useEffect)(function(){if(ci.current){var Ze=c.a.fromTextArea(ci.current,{mode:xn,lineNumbers:!Et,lineWrapping:!0,value:Ne,autoCloseTags:!0,autoCloseBrackets:!0});qt&&Ze.focus();function Ct(xt,Gt){if(hn){Gt.preventDefault();return}var zt=Gt.clipboardData;if(zt){var sn=zt.types.toString(),rn=zt.items;if(sn==="Files"||zt.types.indexOf("Files")>-1){if(Gt.preventDefault(),xn=="stex")return;try{var In,Xn=rn[1];((In=rn[0])===null||In===void 0?void 0:In.kind)==="file"&&(Xn=rn[0]);var en=Xn.getAsFile(),xi=en.name.split(".").pop();I(en,function(on){if(on.id){var Yn,Hn,ui;(en==null||((Yn=en.type)===null||Yn===void 0)?void 0:Yn.indexOf("image"))>-1?Ze.replaceSelection("![,](/api/attachments/".concat(on.id,"?type=").concat(on.content_type,")")):(en==null||((Hn=en.type)===null||Hn===void 0)?void 0:Hn.indexOf("video"))>-1?Ze.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,'"></video>')):(en==null||((ui=en.type)===null||ui===void 0)?void 0:ui.indexOf("pdf"))>-1?Ze.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(en.type,'&disposition=inline" target="_blank">').concat(en.name,"</a>")):ie.includes(xi)?Ze.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,'?type=office&disposition=inline" target="_blank">').concat(en.name,"</a>")):Ze.replaceSelection("[".concat(en.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(on.content_type,")"))}else(on==null?void 0:on.status)===401&&(document.location.href="/user/login")})}catch(on){j.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Ze.on("paste",Ct),Ze.on("dragleave",function(xt,Gt){di.current.classList.remove("mouse-hover-md")}),Ze.on("dragover",function(xt,Gt){di.current.classList.add("mouse-hover-md")}),Ze.on("drop",function(xt,Gt){di.current.classList.add("mouse-hover-md");var zt;if(zt=Gt.dataTransfer.files,zt.length>0){Gt.preventDefault(),Gt.stopPropagation();for(var sn=function(Xn){var en=zt[Xn],xi=en.name.split(".").pop();I(en,function(on){if(on.id){var Yn,Hn,ui;(en==null||((Yn=en.type)===null||Yn===void 0)?void 0:Yn.indexOf("image"))>-1?Ze.replaceSelection("![,](/api/attachments/".concat(on.id,"?type=").concat(on.content_type,")")):(en==null||((Hn=en.type)===null||Hn===void 0)?void 0:Hn.indexOf("video"))>-1?Ze.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,'"></video>')):(en==null||((ui=en.type)===null||ui===void 0)?void 0:ui.indexOf("pdf"))>-1?Ze.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(en.type,'&disposition=inline" target="_blank">').concat(en.name,"</a>")):ie.includes(xi)?Ze.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,'?type=office&disposition=inline" target="_blank">').concat(en.name,"</a>")):Ze.replaceSelection("[".concat(en.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(on.content_type,")"))}else(on==null?void 0:on.status)===401&&(document.location.href="/user/login")})},rn=0;rn<zt.length;rn++)sn(rn)}}),Ht(Ze),function(){Ze.off("paste",Ct)}}},[]);var An=Object(b.useCallback)(function(){if(di.current)try{}catch(Ze){console.log(Ze,"---- to set md editor body height")}},[Pt,di,mn]);Object(b.useEffect)(function(){function Ze(){var xt=new d.default(function(Gt){var zt=Object(D.a)(Gt),sn;try{for(zt.s();!(sn=zt.n()).done;){var rn=sn.value;(rn.target.offsetHeight>0||rn.target.offsetWidth>0)&&(An(),He.setSize("100%","100%"),He.refresh())}}catch(In){zt.e(In)}finally{zt.f()}});return xt.observe(ci.current.parentElement),xt}if(He){var Ct=Ze();return function(){Ct.unobserve(ci.current.parentElement)}}},[He,An]),Object(b.useEffect)(function(){if(He){for(var Ze=[],Ct=function(){var rn=Gt[xt];zt=Object(G.a)(rn,2);var In=zt[0],Xn=zt[1],en=Object(W.a)({},In,function(){Ri(Xn)});Ze.push(en),He.addKeyMap(en)},xt=0,Gt=Object.entries(ae);xt<Gt.length;xt++){var zt;Ct()}return ai.current=setInterval(function(){Ci.current&&ji()},4e3),function(){clearInterval(ai.current);var sn=Object(D.a)(Ze),rn;try{for(sn.s();!(rn=sn.n()).done;){var In=rn.value;He.removeKeyMap(In)}}catch(Xn){sn.e(Xn)}finally{sn.f()}}}},[He]),Object(b.useEffect)(function(){nt!==mn&&jt(nt)},[nt]),Object(lt.a)(function(){if(!Ft&&ct>0){var Ze=new Date().getTime(),Ct=window.sessionStorage.getItem(un);Ze>=ct+ut&&(!Ct||Ct!==Ut)&&(window.sessionStorage.setItem(un,Ut),Bi(!0))}},ut),Object(b.useEffect)(function(){tt(Yt)},[He,Yt]),Object(b.useEffect)(function(){He&&(qt&&He.focus())},[He,qt]),Object(b.useEffect)(function(){if(Rt&&He){var Ze=He.getScrollerElement();function Ct(xt){var Gt=xt.target;if(Ai.current){var zt=Gt.scrollTop/Gt.scrollHeight;Ai.current.scrollTop=Ai.current.scrollHeight*zt}}return Ze.addEventListener("scroll",Ct),function(){Ze.removeEventListener("scroll",Ct)}}},[He,Rt]),Object(b.useEffect)(function(){if(He&&et){function Ze(Ct,xt){et(Ct,xt)}return He.on("beforeChange",Ze),function(){He.off("beforeChange",Ze)}}},[He,et]),Object(b.useEffect)(function(){if(He&&at){function Ze(){at(He.getValue())}return He.on("blur",Ze),function(){He.off("blur",Ze)}}},[He,at]),Object(b.useEffect)(function(){if(He){function Ze(Ct){var xt=Ct.getValue();Lt(xt),Mt(new Date().getTime()),Ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ye&&Ye(xt)}return He.on("change",Ze),function(){He.off("change",Ze)}}},[He,Ye]),Object(b.useEffect)(function(){He&&(Ne==null?(He.setValue(""),Lt("")):Ne!==He.getValue()&&(He.setValue(Ne),Lt(Ne),He.setCursor(He.lineCount(),0)))},[He,Ne]);var Ri=Object(b.useCallback)(function(Ze){var Ct=He.getCursor(),xt=He.getSelection(),Gt=xt.split(`
`);switch(Ze){case"bold":return He.replaceSelection("**"+xt+"**"),xt===""&&He.setCursor(Ct.line,Ct.ch+2),He.focus();case"italic":return He.replaceSelection("*"+xt+"*"),xt===""&&He.setCursor(Ct.line,Ct.ch+1),He.focus();case"code":return He.replaceSelection("`"+xt+"`"),xt===""&&He.setCursor(Ct.line,Ct.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+xt+"$$`"),xt===""&&He.setCursor(Ct.line,Ct.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+xt+"\n```"),He.setCursor(Ct.line+1,xt.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
`),He.focus();case"list-ul":return xt===""?He.replaceSelection("- "+xt):He.replaceSelection(Gt.map(function(zt){return zt===""?"":"- ".concat(zt)}).join(`
`)),He.focus();case"list-ol":return xt===""?He.replaceSelection("1. "+xt):He.replaceSelection(Gt.map(function(zt,sn){return zt===""?"":"".concat(sn+1,". ").concat(zt)}).join(`
`)),He.focus();case"add-null-ch":return xt===""&&He.setCursor(Ct.line,Ct.ch+1),He.replaceSelection(ue),He.focus();case"inster-template-1":return xt===""&&He.setCursor(Ct.line,Ct.ch),He.replaceSelection(q),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return tt(!Rt),He.focus();case"trigger-full-screen":return jt(!mn),He.focus();case Se:Tn(Se);return;case Be:Tn(Be);return;case Le:Tn(Le);return;case We:Tn(We);return;default:throw new Error}},[He,Rt,mn]),Oi=Object(b.useCallback)(function(Ze){Tn("");switch(wn){case Se:var Ct=Ze.title,xt=Ze.link;return He.replaceSelection("[".concat(Ct,"](").concat(xt,")")),He.focus();case Be:var Gt=Ze.language,zt=Ze.content;return He.replaceSelection(["```"+Gt,zt,"```"].join(`
`)),He.focus();case Le:var sn=Ze.src,rn=Ze.alt;return rn?He.replaceSelection("![ ".concat(rn," ]( ").concat(sn,' "').concat(rn,'" )')):He.replaceSelection("![,](".concat(sn,")")),He.focus();case We:for(var In=Ze.row,Xn=Ze.col,en=Ze.align,xi=`
`,on=0;on<In;on++){for(var Yn=[],Hn=[],ui=0;ui<Xn;ui++)on===1&&Hn.push(Xe[en]),Yn.push(" ");on===1&&(xi+="| ".concat(Hn.join(" | "),` |
`)),xi+="| ".concat(Yn.join(Xn===1?"":" | "),` |
`)}return He.replaceSelection(xi+`
`),He.focus();default:throw new Error}},[He,wn]),Li=Object(b.useMemo)(function(){switch(wn){case Se:return m.a.createElement(oe,{callback:Oi,onCancel:fi});case Be:return m.a.createElement(de.b,{callback:Oi,onCancel:fi});case Le:return m.a.createElement(ge,{callback:Oi,onCancel:fi});case We:return m.a.createElement(ke,{callback:Oi,onCancel:fi});default:return null}},[wn]);function fi(){Tn("")}Object(b.useEffect)(function(){if(ti.current){var Ze=ti.current,Ct=!1,xt=0;function Gt(rn){Ct=!0,xt=rn.pageY}function zt(){Ct=!1}function sn(rn){if(Ct){var In=rn.pageY-xt;In<0&&(In=0),In>300&&(In=300);var Xn=Ve+In+"px";Vn(Xn)}}return Ze.addEventListener("mousedown",Gt),document.addEventListener("mousemove",sn),document.addEventListener("mouseup",zt),function(){Ze.removeEventListener("mousedown",Gt),document.removeEventListener("mousemove",sn),document.removeEventListener("mouseup",zt)}}},[He,ti]),Object(b.useEffect)(function(){Vn(Ve)},[Ve]);var si=te(gt),Hi=te(Pt),Fn={width:si,height:Hi},Wi=Object(b.useMemo)(function(){if(ct){var Ze=new Date(ct),Ct=Ze.getHours(),xt=Ze.getMinutes(),Gt=Ze.getSeconds();return Ct=Ct<10?"0"+Ct:Ct,xt=xt<10?"0"+xt:xt,Gt=Gt<10?"0"+Gt:Gt,"".concat(Ct,":").concat(xt,":").concat(Gt)}return 0},[ct]);function qi(){window.sessionStorage.removeItem(un),Bi(!1),Mt(0)}function Ei(){Bi(!1),Mt(0),He.setValue(window.sessionStorage.getItem(un))}function Un(Ze,Ct){var xt=He.getValue();xt=xt.replace(Ze,Ct),Lt(xt),He==null||He.setValue(xt)}return m.a.createElement(b.Fragment,null,m.a.createElement("div",{className:"markdown-editor-wrapper",ref:di},m.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(Rt?"on-preview":""," ").concat(Et?"mini":""," ").concat(mn?"full-screen":""),style:Fn},m.a.createElement(_,{insertTemp:yt,watch:Rt,fullScreen:mn,showNullButton:Dt,onActionCallback:Ri,hidetoolBar:kt,uuid:ri.current,setOpenPhones:function(){Ci.current=!0}}),m.a.createElement("div",{className:"markdown-editor-body"},m.a.createElement("div",{className:"codemirror-container"},m.a.createElement("textarea",{ref:ci,placeholder:bn})),Rt?m.a.createElement("div",{ref:Ai,className:"preview-container"},xn==="stex"&&m.a.createElement(O,{value:Ut}),xn!=="stex"&&m.a.createElement(S.a,{edit:!0,value:Ut,replaces:Un})):null))),wt?m.a.createElement("a",{ref:ti,className:"editor-resize"}):null,m.a.createElement(N.a,null,fe[wn]?m.a.createElement(X.a,{centered:!0,title:fe[wn],visible:!0,onCancel:fi,footer:null,className:"markdown-popup-form"},Li):null))}},SJMd:function(rt,we){/**
* @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 $,le,X,D=!1,Y,j;window.PR_SHOULD_USE_CONTINUATION=!0;var P,G;(function(){var W=window,n=["break,continue,do,else,for,if,return,while"],L=[n,"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"],b=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],m=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],g=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[b,"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"],d="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",p=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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",h=[n,"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"],o=[n,"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"],s=[n,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[m,c,g,p,l,h,o,s],x=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,S="str",O="kwd",R="com",C="typ",w="lit",y="pun",u="pln",v="tag",a="dec",_="src",N="atn",B="atv",T="nocode",U="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(me){for(var Oe=0,ke=!1,ce=!1,ye=0,Se=me.length;ye<Se;++ye){var Le=me[ye];if(Le.ignoreCase)ce=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ke=!0,ce=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function We(qe){var Pe=qe.charCodeAt(0);if(Pe!==92)return Pe;var pt=qe.charAt(1);return Pe=Be[pt],Pe||("0"<=pt&&pt<="7"?parseInt(qe.substring(1),8):pt==="u"||pt==="x"?parseInt(qe.substring(2),16):qe.charCodeAt(1))}function Ke(qe){if(qe<32)return(qe<16?"\\x0":"\\x")+qe.toString(16);var Pe=String.fromCharCode(qe);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function Xe(qe){var Pe=qe.substring(1,qe.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=[],ut=Pe[0]==="^",ue=["["];ut&&ue.push("^");for(var q=ut?1:0,te=Pe.length;q<te;++q){var se=Pe[q];if(/\\[bdsw]/i.test(se))ue.push(se);else{var he=We(se),ie;q+2<te&&Pe[q+1]==="-"?(ie=We(Pe[q+2]),q+=2):ie=he,pt.push([he,ie]),ie<65||he>122||(ie<65||he>90||pt.push([Math.max(65,he)|32,Math.min(ie,90)|32]),ie<97||he>122||pt.push([Math.max(97,he)&~32,Math.min(ie,122)&~32]))}}pt.sort(function(xe,Re){return xe[0]-Re[0]||Re[1]-xe[1]});for(var ae=[],fe=[],q=0;q<pt.length;++q){var pe=pt[q];pe[0]<=fe[1]+1?fe[1]=Math.max(fe[1],pe[1]):ae.push(fe=pe)}for(var q=0;q<ae.length;++q){var pe=ae[q];ue.push(Ke(pe[0])),pe[1]>pe[0]&&(pe[1]+1>pe[0]&&ue.push("-"),ue.push(Ke(pe[1])))}return ue.push("]"),ue.join("")}function lt(qe){for(var Pe=qe.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=Pe.length,ut=[],ue=0,q=0;ue<pt;++ue){var te=Pe[ue];if(te==="(")++q;else if(te.charAt(0)==="\\"){var se=+te.substring(1);se&&(se<=q?ut[se]=-1:Pe[ue]=Ke(se))}}for(var ue=1;ue<ut.length;++ue)ut[ue]===-1&&(ut[ue]=++Oe);for(var ue=0,q=0;ue<pt;++ue){var te=Pe[ue];if(te==="(")++q,ut[q]||(Pe[ue]="(?:");else if(te.charAt(0)==="\\"){var se=+te.substring(1);se&&se<=q&&(Pe[ue]="\\"+ut[se])}}for(var ue=0;ue<pt;++ue)Pe[ue]==="^"&&Pe[ue+1]!=="^"&&(Pe[ue]="");if(qe.ignoreCase&&ke)for(var ue=0;ue<pt;++ue){var te=Pe[ue],he=te.charAt(0);te.length>=2&&he==="["?Pe[ue]=Xe(te):he!=="\\"&&(Pe[ue]=te.replace(/[a-zA-Z]/g,function(fe){var pe=fe.charCodeAt(0);return"["+String.fromCharCode(pe&~32,pe|32)+"]"}))}return Pe.join("")}for(var Je=[],ye=0,Se=me.length;ye<Se;++ye){var Le=me[ye];if(Le.global||Le.multiline)throw new Error(""+Le);Je.push("(?:"+lt(Le)+")")}return new RegExp(Je.join("|"),ce?"gi":"g")}function E(me,Oe){var ke=/(?:^|\s)nocode(?:\s|$)/,ce=[],ye=0,Se=[],Le=0;function Be(We){var Ke=We.nodeType;if(Ke==1){if(ke.test(We.className))return;for(var Xe=We.firstChild;Xe;Xe=Xe.nextSibling)Be(Xe);var lt=We.nodeName.toLowerCase();(lt==="br"||lt==="li")&&(ce[Le]=`
`,Se[Le<<1]=ye++,Se[Le++<<1|1]=We)}else if(Ke==3||Ke==4){var Je=We.nodeValue;Je.length&&(Oe?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),ce[Le]=Je,Se[Le<<1]=ye,ye+=Je.length,Se[Le++<<1|1]=We)}}return Be(me),{sourceCode:ce.join("").replace(/\n$/,""),spans:Se}}function H(me,Oe,ke,ce,ye){if(!ke)return;var Se={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:Oe,decorations:null};ce(Se),ye.push.apply(ye,Se.decorations)}var Z=/\S/;function oe(me){for(var Oe=void 0,ke=me.firstChild;ke;ke=ke.nextSibling){var ce=ke.nodeType;Oe=ce===1?Oe?me:ke:ce===3&&Z.test(ke.nodeValue)?me:Oe}return Oe===me?void 0:Oe}function de(me,Oe){var ke={},ce;(function(){for(var Le=me.concat(Oe),Be=[],We={},Ke=0,Xe=Le.length;Ke<Xe;++Ke){var lt=Le[Ke],Je=lt[3];if(Je)for(var qe=Je.length;--qe>=0;)ke[Je.charAt(qe)]=lt;var Pe=lt[1],pt=""+Pe;We.hasOwnProperty(pt)||(Be.push(Pe),We[pt]=null)}Be.push(/[\0-\uffff]/),ce=M(Be)})();var ye=Oe.length,Se=function(Le){for(var Be=Le.sourceCode,We=Le.basePos,Ke=Le.sourceNode,Xe=[We,u],lt=0,Je=Be.match(ce)||[],qe={},Pe=0,pt=Je.length;Pe<pt;++Pe){var ut=Je[Pe],ue=qe[ut],q=void 0,te;if(typeof ue=="string")te=!1;else{var se=ke[ut.charAt(0)];if(se)q=ut.match(se[1]),ue=se[0];else{for(var he=0;he<ye;++he)if(se=Oe[he],q=ut.match(se[1]),q){ue=se[0];break}q||(ue=u)}te=ue.length>=5&&ue.substring(0,5)==="lang-",te&&!(q&&typeof q[1]=="string")&&(te=!1,ue=_),te||(qe[ut]=ue)}var ie=lt;if(lt+=ut.length,!te)Xe.push(We+ie,ue);else{var ae=q[1],fe=ut.indexOf(ae),pe=fe+ae.length;q[2]&&(pe=ut.length-q[2].length,fe=pe-ae.length);var xe=ue.substring(5);H(Ke,We+ie,ut.substring(0,fe),Se,Xe),H(Ke,We+ie+fe,ae,V(xe,ae),Xe),H(Ke,We+ie+pe,ut.substring(pe),Se,Xe)}}Le.decorations=Xe};return Se}function Te(me){var Oe=[],ke=[];me.tripleQuotedStrings?Oe.push([S,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?Oe.push([S,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([S,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&ke.push([S,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ce=me.hashComments;ce&&(me.cStyleComments?(ce>1?Oe.push([R,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([R,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([S,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([R,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(ke.push([R,/^\/\/[^\r\n]*/,null]),ke.push([R,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ye=me.regexLiterals;if(ye){var Se=ye>1?"":`
\r`,Le=Se?".":"[\\S\\s]",Be="/(?=[^/*"+Se+"])(?:[^/\\x5B\\x5C"+Se+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Se+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+U+"("+Be+")")])}var We=me.types;We&&ke.push([C,We]);var Ke=(""+me.keywords).replace(/^ | $/g,"");Ke.length&&ke.push([O,new RegExp("^(?:"+Ke.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([u,/^\s+/,null,` \r
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(Xe+="(?!s*/)"),ke.push([w,/^@[a-z_$][a-z_$@0-9]*/i,null],[C,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[w,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[y,new RegExp(Xe),null]),de(Oe,ke)}var be=Te({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ae(me,Oe,ke){for(var ce=/(?:^|\s)nocode(?:\s|$)/,ye=/\r\n?|\n/,Se=me.ownerDocument,Le=Se.createElement("li");me.firstChild;)Le.appendChild(me.firstChild);var Be=[Le];function We(Pe){var pt=Pe.nodeType;if(pt==1&&!ce.test(Pe.className))if(Pe.nodeName==="br")Ke(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var ut=Pe.firstChild;ut;ut=ut.nextSibling)We(ut);else if((pt==3||pt==4)&&ke){var ue=Pe.nodeValue,q=ue.match(ye);if(q){var te=ue.substring(0,q.index);Pe.nodeValue=te;var se=ue.substring(q.index+q[0].length);if(se){var he=Pe.parentNode;he.insertBefore(Se.createTextNode(se),Pe.nextSibling)}Ke(Pe),te||Pe.parentNode.removeChild(Pe)}}}function Ke(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function pt(q,te){var se=te?q.cloneNode(!1):q,he=q.parentNode;if(he){var ie=pt(he,1),ae=q.nextSibling;ie.appendChild(se);for(var fe=ae;fe;fe=ae)ae=fe.nextSibling,ie.appendChild(fe)}return se}for(var ut=pt(Pe.nextSibling,0),ue;(ue=ut.parentNode)&&ue.nodeType===1;)ut=ue;Be.push(ut)}for(var Xe=0;Xe<Be.length;++Xe)We(Be[Xe]);Oe===(Oe|0)&&Be[0].setAttribute("value",Oe);var lt=Se.createElement("ol");lt.className="linenums";for(var Je=Math.max(0,Oe-1|0)||0,Xe=0,qe=Be.length;Xe<qe;++Xe)Le=Be[Xe],Le.className="L"+(Xe+Je)%10,Le.firstChild||Le.appendChild(Se.createTextNode("\xA0")),lt.appendChild(Le);me.appendChild(lt)}function Ce(me){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var ke=/\n/g,ce=me.sourceCode,ye=ce.length,Se=0,Le=me.spans,Be=Le.length,We=0,Ke=me.decorations,Xe=Ke.length,lt=0;Ke[Xe]=ye;var Je,qe;for(qe=Je=0;qe<Xe;)Ke[qe]!==Ke[qe+2]?(Ke[Je++]=Ke[qe++],Ke[Je++]=Ke[qe++]):qe+=2;for(Xe=Je,qe=Je=0;qe<Xe;){for(var Pe=Ke[qe],pt=Ke[qe+1],ut=qe+2;ut+2<=Xe&&Ke[ut+1]===pt;)ut+=2;Ke[Je++]=Pe,Ke[Je++]=pt,qe=ut}Xe=Ke.length=Je;var ue=me.sourceNode,q="";ue&&(q=ue.style.display,ue.style.display="none");try{for(var te=null;We<Be;){var se=Le[We],he=Le[We+2]||ye,ie=Ke[lt+2]||ye,ut=Math.min(he,ie),ae=Le[We+1],fe;if(ae.nodeType!==1&&(fe=ce.substring(Se,ut))){Oe&&(fe=fe.replace(ke,"\r")),ae.nodeValue=fe;var pe=ae.ownerDocument,xe=pe.createElement("span");xe.className=Ke[lt+1];var Re=ae.parentNode;Re.replaceChild(xe,ae),xe.appendChild(ae),Se<he&&(Le[We+1]=ae=pe.createTextNode(ce.substring(ut,he)),Re.insertBefore(ae,xe.nextSibling))}Se=ut,Se>=he&&(We+=2),Se>=ie&&(lt+=2)}}finally{ue&&(ue.style.display=q)}}var _e={};function ge(me,Oe){for(var ke=Oe.length;--ke>=0;){var ce=Oe[ke];_e.hasOwnProperty(ce)?W.console&&console.warn("cannot override language handler %s",ce):_e[ce]=me}}function V(me,Oe){return me&&_e.hasOwnProperty(me)||(me=/^\s*</.test(Oe)?"default-markup":"default-code"),_e[me]}ge(be,["default-code"]),ge(de([],[[u,/^[^<?]+/],[a,/^<!\w[^>]*(?:>|$)/],[R,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[y,/^(?:<[%?]|[%?]>)/],["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"]),ge(de([[u,/^[\s]+/,null,` \r
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[y,/^[=<>\/]+/],["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"]),ge(de([],[[B,/^[\s\S]+/]]),["uq.val"]),ge(Te({keywords:m,hashComments:!0,cStyleComments:!0,types:x}),["c","cc","cpp","cxx","cyc","m"]),ge(Te({keywords:"null,true,false"}),["json"]),ge(Te({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:x}),["cs"]),ge(Te({keywords:g,cStyleComments:!0}),["java"]),ge(Te({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(Te({keywords:h,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(Te({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(Te({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(Te({keywords:d,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(de([],[[S,/^[\s\S]+/]]),["regex"]);function I(me){var Oe=me.langExtension;try{var ke=E(me.sourceNode,me.pre),ce=ke.sourceCode;me.sourceCode=ce,me.spans=ke.spans,me.basePos=0,V(Oe,ce)(me),Ce(me)}catch(ye){W.console&&console.log(ye&&ye.stack||ye)}}function F(me,Oe,ke){var ce=ke||!1,ye=Oe||null,Se=document.createElement("div");Se.innerHTML="<pre>"+me+"</pre>",Se=Se.firstChild,ce&&Ae(Se,ce,!0);var Le={langExtension:ye,numberLines:ce,sourceNode:Se,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return I(Le),Se.innerHTML}function J(me,Oe){var ke=Oe||document.body,ce=ke.ownerDocument||document;function ye(se){return ke.getElementsByTagName(se)}for(var Se=[ye("pre"),ye("code"),ye("xmp")],Le=[],Be=0;Be<Se.length;++Be)for(var We=0,Ke=Se[Be].length;We<Ke;++We)Le.push(Se[Be][We]);Se=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var lt=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,qe=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,pt=/pre|xmp/i,ut=/^code$/i,ue=/^(?:pre|code|xmp)$/i,q={};function te(){for(var se=W.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;lt<Le.length&&Xe.now()<se;lt++){for(var he=Le[lt],ie=q,ae=he;ae=ae.previousSibling;){var fe=ae.nodeType,pe=(fe===7||fe===8)&&ae.nodeValue;if(pe?!/^\??prettify\b/.test(pe):fe!==3||/\S/.test(ae.nodeValue))break;if(pe){ie={},pe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Yt,yt,Qe){ie[yt]=Qe});break}}var xe=he.className;if((ie!==q||qe.test(xe))&&!Pe.test(xe)){for(var Re=!1,Ne=he.parentNode;Ne;Ne=Ne.parentNode){var Ye=Ne.tagName;if(ue.test(Ye)&&Ne.className&&qe.test(Ne.className)){Re=!0;break}}if(!Re){he.className+=" prettyprinted";var dt=ie.lang;if(!dt){dt=xe.match(Je);var gt;!dt&&(gt=oe(he))&&ut.test(gt.tagName)&&(dt=gt.className.match(Je)),dt&&(dt=dt[1])}var Kt;if(pt.test(he.tagName))Kt=1;else{var Ve=he.currentStyle,Ue=ce.defaultView,Et=Ve?Ve.whiteSpace:Ue&&Ue.getComputedStyle?Ue.getComputedStyle(he,null).getPropertyValue("white-space"):0;Kt=Et&&Et.substring(0,3)==="pre"}var vt=ie.linenums;(vt=vt==="true"||+vt)||(vt=xe.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&Ae(he,vt,Kt);var qt={langExtension:dt,sourceNode:he,numberLines:vt,pre:Kt,sourceCode:null,basePos:null,spans:null,decorations:null};I(qt)}}}lt<Le.length?W.setTimeout(te,250):typeof me=="function"&&me()}te()}var ne=W.PR={createSimpleLexer:de,registerLangHandler:ge,sourceDecorator:Te,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:B,PR_COMMENT:R,PR_DECLARATION:a,PR_KEYWORD:O,PR_LITERAL:w,PR_NOCODE:T,PR_PLAIN:u,PR_PUNCTUATION:y,PR_SOURCE:_,PR_STRING:S,PR_TAG:v,PR_TYPE:C,prettyPrintOne:D?W.prettyPrintOne=F:P=F,prettyPrint:G=D?W.prettyPrint=J:G=J},z=W.define;typeof z=="function"&&z.amd&&z("google-code-prettify",[],function(){return ne})})()},STEk:function(rt,we,$){"use strict";$.d(we,"a",function(){return ge});/*! *****************************************************************************
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 le=function(V,I){return(le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,J){F.__proto__=J}||function(F,J){for(var ne in J)Object.prototype.hasOwnProperty.call(J,ne)&&(F[ne]=J[ne])})(V,I)};function X(V,I){function F(){this.constructor=V}le(V,I),V.prototype=I===null?Object.create(I):(F.prototype=I.prototype,new F)}function D(V,I,F,J){return new(F||(F=Promise))(function(ne,z){function me(ce){try{ke(J.next(ce))}catch(ye){z(ye)}}function Oe(ce){try{ke(J.throw(ce))}catch(ye){z(ye)}}function ke(ce){var ye;ce.done?ne(ce.value):(ye=ce.value,ye instanceof F?ye:new F(function(Se){Se(ye)})).then(me,Oe)}ke((J=J.apply(V,I||[])).next())})}function Y(V,I){var F,J,ne,z,me={label:0,sent:function(){if(1&ne[0])throw ne[1];return ne[1]},trys:[],ops:[]};return z={next:Oe(0),throw:Oe(1),return:Oe(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function Oe(ke){return function(ce){return function(ye){if(F)throw new TypeError("Generator is already executing.");for(;me;)try{if(F=1,J&&(ne=2&ye[0]?J.return:ye[0]?J.throw||((ne=J.return)&&ne.call(J),0):J.next)&&!(ne=ne.call(J,ye[1])).done)return ne;switch(J=0,ne&&(ye=[2&ye[0],ne.value]),ye[0]){case 0:case 1:ne=ye;break;case 4:return me.label++,{value:ye[1],done:!1};case 5:me.label++,J=ye[1],ye=[0];continue;case 7:ye=me.ops.pop(),me.trys.pop();continue;default:if(!(ne=me.trys,(ne=ne.length>0&&ne[ne.length-1])||ye[0]!==6&&ye[0]!==2)){me=0;continue}if(ye[0]===3&&(!ne||ye[1]>ne[0]&&ye[1]<ne[3])){me.label=ye[1];break}if(ye[0]===6&&me.label<ne[1]){me.label=ne[1],ne=ye;break}if(ne&&me.label<ne[2]){me.label=ne[2],me.ops.push(ye);break}ne[2]&&me.ops.pop(),me.trys.pop();continue}ye=I.call(V,me)}catch(Se){ye=[6,Se],J=0}finally{F=ne=0}if(5&ye[0])throw ye[1];return{value:ye[0]?ye[1]:void 0,done:!0}}([ke,ce])}}}function j(){for(var V=0,I=0,F=arguments.length;I<F;I++)V+=arguments[I].length;var J=Array(V),ne=0;for(I=0;I<F;I++)for(var z=arguments[I],me=0,Oe=z.length;me<Oe;me++,ne++)J[ne]=z[me];return J}var P=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(I,F){for(var J=0,ne=F;J<ne.length;J++){var z=ne[J],me=z[0],Oe=z[1];I.setAttribute(me,Oe)}},V.createRect=function(I,F,J){var ne=document.createElementNS("http://www.w3.org/2000/svg","rect");return ne.setAttribute("width",I.toString()),ne.setAttribute("height",F.toString()),J&&V.setAttributes(ne,J),ne},V.createLine=function(I,F,J,ne,z){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",I.toString()),me.setAttribute("y1",F.toString()),me.setAttribute("x2",J.toString()),me.setAttribute("y2",ne.toString()),z&&V.setAttributes(me,z),me},V.createPolygon=function(I,F){var J=document.createElementNS("http://www.w3.org/2000/svg","polygon");return J.setAttribute("points",I),F&&V.setAttributes(J,F),J},V.createCircle=function(I,F){var J=document.createElementNS("http://www.w3.org/2000/svg","circle");return J.setAttribute("cx",(I/2).toString()),J.setAttribute("cy",(I/2).toString()),J.setAttribute("r",I.toString()),F&&V.setAttributes(J,F),J},V.createEllipse=function(I,F,J){var ne=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ne.setAttribute("cx",(I/2).toString()),ne.setAttribute("cy",(F/2).toString()),ne.setAttribute("rx",(I/2).toString()),ne.setAttribute("ry",(F/2).toString()),J&&V.setAttributes(ne,J),ne},V.createGroup=function(I){var F=document.createElementNS("http://www.w3.org/2000/svg","g");return I&&V.setAttributes(F,I),F},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(I,F,J,ne,z,me,Oe){var ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(ke,[["id",I],["orient",F],["markerWidth",J.toString()],["markerHeight",ne.toString()],["refX",z.toString()],["refY",me.toString()]]),ke.appendChild(Oe),ke},V.createText=function(I){var F=document.createElementNS("http://www.w3.org/2000/svg","text");return F.setAttribute("x","0"),F.setAttribute("y","0"),I&&V.setAttributes(F,I),F},V.createTSpan=function(I,F){var J=document.createElementNS("http://www.w3.org/2000/svg","tspan");return J.textContent=I,F&&V.setAttributes(J,F),J},V.createImage=function(I){var F=document.createElementNS("http://www.w3.org/2000/svg","image");return I&&V.setAttributes(F,I),F},V.createPoint=function(I,F){var J=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return J.x=I,J.y=F,J},V.createPath=function(I,F){var J=document.createElementNS("http://www.w3.org/2000/svg","path");return J.setAttribute("d",I),F&&V.setAttributes(J,F),J},V}(),G=function(){function V(){}return V.addKey=function(I){V.key=I},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),W=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(I,F,J){var ne=this;return new Promise(function(z){var me=J!==void 0?J:document.createElement("canvas");I===null&&(ne.markersOnly=!0,ne.naturalSize=!1);var Oe=document.createElementNS("http://www.w3.org/2000/svg","svg");Oe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Oe.setAttribute("width",F.width.baseVal.valueAsString),Oe.setAttribute("height",F.height.baseVal.valueAsString),Oe.setAttribute("viewBox","0 0 "+F.viewBox.baseVal.width.toString()+" "+F.viewBox.baseVal.height.toString()),Oe.innerHTML=F.innerHTML,ne.naturalSize===!0?(Oe.width.baseVal.value=I.naturalWidth,Oe.height.baseVal.value=I.naturalHeight):ne.width!==void 0&&ne.height!==void 0&&(Oe.width.baseVal.value=ne.width,Oe.height.baseVal.value=ne.height),me.width=Oe.width.baseVal.value,me.height=Oe.height.baseVal.value;var ke=Oe.outerHTML,ce=me.getContext("2d");ne.markersOnly!==!0&&ce.drawImage(I,0,0,me.width,me.height);var ye=window.URL,Se=new Image(me.width,me.height);Se.setAttribute("crossOrigin","anonymous");var Le=new Blob([ke],{type:"image/svg+xml"}),Be=ye.createObjectURL(Le);Se.onload=function(){ce.drawImage(Se,0,0),ye.revokeObjectURL(Be);var We=me.toDataURL(ne.imageType,ne.imageQuality);z(We)},Se.src=Be})},V}(),n=function(){},L=function(){function V(I){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+I+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(I){return this.styleSheet===void 0&&this.addStyleSheet(),I.name=""+this.classNamePrefix+I.localName,this.classes.push(I),this.styleSheet.sheet.insertRule("."+I.name+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length),I},V.prototype.addRule=function(I){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(I),this.styleSheet.sheet.insertRule(I.selector+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var I;this.styleSheet=document.createElement("style"),((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).appendChild(this.styleSheet),this.addRule(new b("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new m("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new m("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var I;this.styleSheet&&(((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),b=function(V,I){this.selector=V,this.style=I},m=function(V,I){this.localName=V,this.style=I},g=function(){function V(I,F,J,ne,z){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=I,this.displayMode=F,this.markerItems=J,this.uiStyleSettings=ne,this.styles=z,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(I){var F=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=I,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",this.uiContainer.appendChild(J),this.addActionButton(J,'<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(J,'<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(J,'<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(J,'<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(J,'<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(J,'<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(J,'<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(J,'<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(z){var me=document.createElement("div");me.className=""+F.toolbarButtonStyleClass.name,me.setAttribute("data-type-name",z.typeName),me.innerHTML=z.icon,me.addEventListener("click",function(){F.markerToolbarButtonClicked(me,z)}),F.buttons.push(me),F.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 ne=document.createElement("div");ne.className=this.toolbarBlockStyleClass.name,ne.style.whiteSpace="nowrap",ne.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(ne),this.addActionButton(ne,'<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(ne,'<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()},V.prototype.addButtonClickListener=function(I){this.buttonClickListeners.push(I)},V.prototype.removeButtonClickListener=function(I){this.buttonClickListeners.indexOf(I)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(I),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var I=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var F=0;F<this.markerButtons.length;F++)F<I||F===I&&this.markerButtons.length-1===I?this.markerButtonBlock.appendChild(this.markerButtons[F]):(F===I&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[F]))}},V.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")},V.prototype.resetButtonStyles=function(){var I=this;this.buttons.forEach(function(F){F.className=F.className.replace(I.uiStyleSettings.toolbarButtonStyleColorsClassName?I.uiStyleSettings.toolbarButtonStyleColorsClassName:I.toolbarButtonStyleColorsClass.name,"").trim(),F.className=F.className.replace(I.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?I.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:I.toolbarActiveButtonStyleColorsClass.name,"").trim(),F.className+=" "+(I.uiStyleSettings.toolbarButtonStyleColorsClassName?I.uiStyleSettings.toolbarButtonStyleColorsClassName:I.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(I,F,J){var ne=this,z=document.createElement("div");switch(z.className=""+this.toolbarButtonStyleClass.name,z.innerHTML=F,z.setAttribute("data-action",J),z.addEventListener("click",function(){ne.actionToolbarButtonClicked(z,J)}),J){case"select":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":z.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":z.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":z.style.fill=this.uiStyleSettings.closeButtonColor}I.appendChild(z),this.buttons.push(z)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new m("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 m("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new m("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new m("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 m("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var I=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new m("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px;
padding: `+I+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new m("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new m("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},V.prototype.markerToolbarButtonClicked=function(I,F){this.setActiveButton(I),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(J){return J("marker",F)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(I,F){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(J){return J("action",F)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(I){this.resetButtonStyles(),I.className=I.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),I.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(I){var F=this.markerButtons.find(function(J){return J.getAttribute("data-type-name")===I});F&&this.setActiveButton(F)},V.prototype.setCurrentMarker=function(I){var F=this;this.currentMarker=I,this.buttons.filter(function(J){return/delete|notes/.test(J.getAttribute("data-action"))}).forEach(function(J){F.currentMarker===void 0?(J.style.fillOpacity="0.4",J.style.pointerEvents="none"):(J.style.fillOpacity="1",J.style.pointerEvents="all")})},V}(),c=function(){function V(I,F,J,ne){this.panels=[],this.panelButtons=[],this.markerjsContainer=I,this.displayMode=F,this.uiStyleSettings=J,this.styles=ne,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var I;this.toolboxStyleClass=this.styles.addClass(new m("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 m("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var F=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new m("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new m("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new m("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 m("toolbox-panel-row_colors",`
background-color: `+((I=this.uiStyleSettings.toolboxBackgroundColor)!==null&&I!==void 0?I:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new m("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*F)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*F)+`px;
padding: `+F+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new m("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new m("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},V.prototype.show=function(I){var F;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=I,this.uiContainer.className=this.toolboxStyleClass.name+" "+((F=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(I){var F,J,ne=this;this.panels=I,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((J=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&J!==void 0?J:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(z){var me;z.uiStyleSettings=ne.uiStyleSettings;var Oe=document.createElement("div");Oe.className=ne.toolboxButtonStyleClass.name+" "+((me=ne.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:ne.toolboxButtonStyleColorsClass.name),Oe.innerHTML=z.icon,Oe.title=z.title,Oe.addEventListener("click",function(){ne.panelButtonClick(z)}),ne.panelButtons.push(Oe),ne.buttonRow.appendChild(Oe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(I){var F=this,J=-1;if(I!==this.activePanel){J=this.panels.indexOf(I),this.panelRow.innerHTML="";var ne=I.getUi();ne.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(ne),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=I}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){F.displayMode==="inline"?F.panelRow.style.display="none":F.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,me){var Oe,ke;z.className=F.toolboxButtonStyleClass.name+" "+(me===J?""+((Oe=F.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:F.toolboxActiveButtonStyleColorsClass.name):""+((ke=F.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ke!==void 0?ke:F.toolboxButtonStyleColorsClass.name))})},V}(),d=function(V,I){this.title=V,this.icon=I},p=function(V){function I(F,J,ne,z){var me=V.call(this,F,z||'<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=J,me.currentColor=ne,me.setCurrentColor=me.setCurrentColor.bind(me),me.getColorBox=me.getColorBox.bind(me),me}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");return J.style.overflow="hidden",J.style.whiteSpace="nowrap",this.colors.forEach(function(ne){var z=F.getColorBox(ne);J.appendChild(z),F.colorBoxes.push(z)}),J},I.prototype.getColorBox=function(F){var J=this,ne=this.uiStyleSettings.toolbarHeight/4,z=this.uiStyleSettings.toolbarHeight-ne,me=document.createElement("div");me.style.display="inline-block",me.style.boxSizing="content-box",me.style.width=z-2+"px",me.style.height=z-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=(z+2)/2+"px",me.style.borderColor=F===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",me.addEventListener("click",function(){J.setCurrentColor(F,me)});var Oe=document.createElement("div");return Oe.style.display="inline-block",Oe.style.width=z-2+"px",Oe.style.height=z-2+"px",Oe.style.backgroundColor=F,Oe.style.borderRadius=z/2+"px",F==="transparent"&&(Oe.style.fill=this.uiStyleSettings.toolboxAccentColor,Oe.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(Oe),me},I.prototype.setCurrentColor=function(F,J){var ne=this;this.currentColor=F,this.colorBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(F)},I}(d),l=function(){function V(I,F,J){this._state="new",this._isSelected=!1,this._container=I,this._overlayContainer=F,this.globalSettings=J,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(I){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(I,F){},V.prototype.dblClick=function(I,F){},V.prototype.manipulate=function(I){},V.prototype.pointerUp=function(I){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(I){this.container.childNodes.length>0?this.container.insertBefore(I,this.container.childNodes[0]):this.container.appendChild(I)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(I){this._state=I.state,this.notes=I.notes},V.prototype.scale=function(I,F){},V.prototype.colorChanged=function(I){this.onColorChanged&&this.onColorChanged(I),this.stateChanged()},V.prototype.fillColorChanged=function(I){this.onFillColorChanged&&this.onFillColorChanged(I),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var I=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),I.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(I)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),h=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(I){return this.topLeft.ownsTarget(I)?this.topLeft:this.topCenter.ownsTarget(I)?this.topCenter:this.topRight.ownsTarget(I)?this.topRight:this.centerLeft.ownsTarget(I)?this.centerLeft:this.centerRight.ownsTarget(I)?this.centerRight:this.bottomLeft.ownsTarget(I)?this.bottomLeft:this.bottomCenter.ownsTarget(I)?this.bottomCenter:this.bottomRight.ownsTarget(I)?this.bottomRight:void 0},V}(),o=function(){function V(){this.GRIP_SIZE=10,this.visual=P.createGroup(),this.visual.appendChild(P.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(P.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(I){return I===this.visual||I===this.visual.childNodes[0]||I===this.visual.childNodes[1]},V}(),s=function(){function V(){}return V.toITransformMatrix=function(I){return{a:I.a,b:I.b,c:I.c,d:I.d,e:I.e,f:I.f}},V.toSVGMatrix=function(I,F){return I.a=F.a,I.b=F.b,I.c=F.c,I.d=F.d,I.e=F.e,I.f=F.f,I},V}(),A=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.left=0,z.top=0,z.width=0,z.height=0,z.defaultSize={x:50,y:20},z.offsetX=0,z.offsetY=0,z.rotationAngle=0,z.CB_DISTANCE=10,z._suppressMarkerCreateEvent=!1,z.container.transform.baseVal.appendItem(P.createTransform()),z.setupControlBox(),z}return X(I,V),Object.defineProperty(I.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"visual",{get:function(){return this._visual},set:function(F){this._visual=F;var J=P.createTransform();this._visual.transform.baseVal.appendItem(J)},enumerable:!1,configurable:!0}),I.prototype.ownsTarget=function(F){return!!V.prototype.ownsTarget.call(this,F)||!!(this.controlGrips.findGripByVisual(F)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F))},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="new"&&(this.left=F.x,this.top=F.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var ne=this.unrotatePoint(F);if(this.manipulationStartX=ne.x,this.manipulationStartY=ne.y,this.offsetX=ne.x-this.left,this.offsetY=ne.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(J),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(J)){this.activeGrip=this.rotatorGrip;var z=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=z.x-this.width/2,this.top=z.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"},I.prototype.pointerUp=function(F){var J=this.state;V.prototype.pointerUp.call(this,F),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(F),this._state="select",J==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},I.prototype.moveVisual=function(F){this.visual.style.transform="translate("+F.x+"px, "+F.y+"px)"},I.prototype.manipulate=function(F){var J=this.unrotatePoint(F);this.state==="creating"?this.resize(F):this.state==="move"?(this.left=this.manipulationStartLeft+(J.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(J.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(J):this.state==="rotate"&&this.rotate(F)},I.prototype.resize=function(F){var J=this.manipulationStartLeft,ne=this.manipulationStartWidth,z=this.manipulationStartTop,me=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:J=this.manipulationStartLeft+F.x-this.manipulationStartX,ne=this.manipulationStartWidth+this.manipulationStartLeft-J;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:ne=this.manipulationStartWidth+F.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+F.y-this.manipulationStartY,me=this.manipulationStartHeight+this.manipulationStartTop-z;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:me=this.manipulationStartHeight+F.y-this.manipulationStartY}ne>=0?(this.left=J,this.width=ne):(this.left=J+ne,this.width=-ne),me>=0?(this.top=z,this.height=me):(this.top=z+me,this.height=-me),this.setSize()},I.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},I.prototype.rotate=function(F){if(Math.abs(F.x-this.centerX)>.1){var J=Math.sign(F.x-this.centerX);this.rotationAngle=180*Math.atan((F.y-this.centerY)/(F.x-this.centerX))/Math.PI+90*J,this.applyRotation()}},I.prototype.applyRotation=function(){var F=this.container.transform.baseVal.getItem(0);F.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(F,0)},I.prototype.rotatePoint=function(F){if(this.rotationAngle===0)return F;var J=this.container.getCTM(),ne=P.createPoint(F.x,F.y);return{x:(ne=ne.matrixTransform(J)).x,y:ne.y}},I.prototype.unrotatePoint=function(F){if(this.rotationAngle===0)return F;var J=this.container.getCTM();J=J.inverse();var ne=P.createPoint(F.x,F.y);return{x:(ne=ne.matrixTransform(J)).x,y:ne.y}},I.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},I.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},I.prototype.setupControlBox=function(){this.controlBox=P.createGroup();var F=P.createTransform();F.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(F),this.container.appendChild(this.controlBox),this.controlRect=P.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=P.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 h,this.addControlGrips(),this.controlBox.style.display="none"},I.prototype.adjustControlBox=function(){var F=this.controlBox.transform.baseVal.getItem(0);F.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(F,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()},I.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()},I.prototype.createGrip=function(){var F=new o;return F.visual.transform.baseVal.appendItem(P.createTransform()),this.controlBox.appendChild(F.visual),F},I.prototype.positionGrips=function(){var F=this.controlGrips.topLeft.GRIP_SIZE,J=-F/2,ne=J,z=(this.width+this.CB_DISTANCE)/2-F/2,me=(this.height+this.CB_DISTANCE)/2-F/2,Oe=this.height+this.CB_DISTANCE-F/2,ke=this.width+this.CB_DISTANCE-F/2;this.positionGrip(this.controlGrips.topLeft.visual,J,ne),this.positionGrip(this.controlGrips.topCenter.visual,z,ne),this.positionGrip(this.controlGrips.topRight.visual,ke,ne),this.positionGrip(this.controlGrips.centerLeft.visual,J,me),this.positionGrip(this.controlGrips.centerRight.visual,ke,me),this.positionGrip(this.controlGrips.bottomLeft.visual,J,Oe),this.positionGrip(this.controlGrips.bottomCenter.visual,z,Oe),this.positionGrip(this.controlGrips.bottomRight.visual,ke,Oe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,z,ne-3*this.CB_DISTANCE)},I.prototype.positionGrip=function(F,J,ne){var z=F.transform.baseVal.getItem(0);z.setTranslate(J,ne),F.transform.baseVal.replaceItem(z,0)},I.prototype.hideControlBox=function(){this.controlBox.style.display="none"},I.prototype.showControlBox=function(){this.controlBox.style.display=""},I.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:s.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:s.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F);var J=F;this.left=J.left,this.top=J.top,this.width=J.width,this.height=J.height,this.rotationAngle=J.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(s.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,J.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(s.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,J.containerTransformMatrix))},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J);var ne=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:ne.x*F,y:ne.y*J});this.left=z.x,this.top=z.y,this.width=this.width*F,this.height=this.height*J,this.adjustControlBox()},I}(l),x=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.visual)},I.prototype.createVisual=function(){this.visual=P.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)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},I.prototype.manipulate=function(F){V.prototype.manipulate.call(this,F)},I.prototype.resize=function(F){V.prototype.resize.call(this,F),this.setSize()},I.prototype.setSize=function(){V.prototype.setSize.call(this),P.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},I.prototype.pointerUp=function(F){V.prototype.pointerUp.call(this,F),this.setSize()},I.prototype.setStrokeColor=function(F){this.strokeColor=F,this.visual&&P.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(F),this.stateChanged()},I.prototype.setFillColor=function(F){this.fillColor=F,this.visual&&P.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},I.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.visual&&P.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},I.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.visual&&P.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},I.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},I.prototype.restoreState=function(F){var J=F;this.fillColor=J.fillColor,this.strokeColor=J.strokeColor,this.strokeWidth=J.strokeWidth,this.strokeDasharray=J.strokeDasharray,this.opacity=J.opacity,this.createVisual(),V.prototype.restoreState.call(this,F),this.setSize()},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.setSize()},I.title="Rectangle marker",I}(A),S=function(V){function I(F,J,ne,z){var me=V.call(this,F,z||'<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=J,me.currentWidth=ne,me.setCurrentWidth=me.setCurrentWidth.bind(me),me}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");return J.style.display="flex",J.style.overflow="hidden",J.style.flexGrow="2",this.widths.forEach(function(ne){var z=document.createElement("div");z.style.display="flex",z.style.flexGrow="2",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=ne===F.currentWidth?F.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){F.setCurrentWidth(ne,z)}),J.appendChild(z);var me=document.createElement("div");me.innerText=ne.toString(),me.style.marginRight="5px",z.appendChild(me);var Oe=document.createElement("div");Oe.style.minHeight="20px",Oe.style.flexGrow="2",Oe.style.display="flex",Oe.style.alignItems="center";var ke=document.createElement("hr");ke.style.minWidth="20px",ke.style.border="0px",ke.style.borderTop=ne+"px solid "+F.uiStyleSettings.toolboxColor,ke.style.flexGrow="2",Oe.appendChild(ke),z.appendChild(Oe),F.widthBoxes.push(z)}),J},I.prototype.setCurrentWidth=function(F,J){var ne=this;this.currentWidth=F,this.widthBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},I}(d),O=function(V){function I(F,J,ne,z){var me=V.call(this,F,z||'<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=J,me.currentStyle=ne,me.setCurrentStyle=me.setCurrentStyle.bind(me),me}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");return J.style.display="flex",J.style.overflow="hidden",J.style.flexGrow="2",this.styles.forEach(function(ne){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/F.styles.length-5+"%",z.style.borderColor=ne===F.currentStyle?F.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){F.setCurrentStyle(ne,z)}),J.appendChild(z);var me=document.createElement("div");me.style.minHeight="20px",me.style.flexGrow="2",me.style.overflow="hidden";var Oe=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+F.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(ne!==""?'stroke-dasharray="'+ne+'"':"")+` />
</svg>`;me.innerHTML=Oe,z.appendChild(me),F.styleBoxes.push(z)}),J},I.prototype.setCurrentStyle=function(F,J){var ne=this;this.currentStyle=F,this.styleBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},I}(d),R=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.strokeColor=ne.defaultColor,z.strokeWidth=ne.defaultStrokeWidth,z.strokeDasharray=ne.defaultStrokeDasharray,z.strokePanel=new p("Line color",ne.defaultColorSet,ne.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new S("Line width",ne.defaultStrokeWidths,ne.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new O("Line style",ne.defaultStrokeDasharrays,ne.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return X(I,V),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=V.prototype.getState.call(this);return F.typeName=I.typeName,F},I.typeName="FrameMarker",I.title="Frame marker",I.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',I}(x),C=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},w=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.x1=0,z.y1=0,z.x2=0,z.y2=0,z.defaultLength=50,z.manipulationStartX=0,z.manipulationStartY=0,z.manipulationStartX1=0,z.manipulationStartY1=0,z.manipulationStartX2=0,z.manipulationStartY2=0,z.setupControlBox(),z}return X(I,V),I.prototype.ownsTarget=function(F){return!!V.prototype.ownsTarget.call(this,F)||!(!this.grip1.ownsTarget(F)&&!this.grip2.ownsTarget(F))},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.manipulationStartX=F.x,this.manipulationStartY=F.y,this.state==="new"&&(this.x1=F.x,this.y1=F.y,this.x2=F.x,this.y2=F.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(J)?this.activeGrip=this.grip1:this.grip2.ownsTarget(J)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},I.prototype.pointerUp=function(F){var J=this.state;V.prototype.pointerUp.call(this,F),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(F),this._state="select",J==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},I.prototype.adjustVisual=function(){},I.prototype.manipulate=function(F){this.state==="creating"?this.resize(F):this.state==="move"?(this.x1=this.manipulationStartX1+F.x-this.manipulationStartX,this.y1=this.manipulationStartY1+F.y-this.manipulationStartY,this.x2=this.manipulationStartX2+F.x-this.manipulationStartX,this.y2=this.manipulationStartY2+F.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(F)},I.prototype.resize=function(F){switch(this.activeGrip){case this.grip1:this.x1=F.x,this.y1=F.y;break;case this.grip2:case void 0:this.x2=F.x,this.y2=F.y}this.adjustVisual(),this.adjustControlBox()},I.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},I.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},I.prototype.setupControlBox=function(){this.controlBox=P.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},I.prototype.adjustControlBox=function(){this.positionGrips()},I.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},I.prototype.createGrip=function(){var F=new o;return F.visual.transform.baseVal.appendItem(P.createTransform()),this.controlBox.appendChild(F.visual),F},I.prototype.positionGrips=function(){var F=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-F/2,this.y1-F/2),this.positionGrip(this.grip2.visual,this.x2-F/2,this.y2-F/2)},I.prototype.positionGrip=function(F,J,ne){var z=F.transform.baseVal.getItem(0);z.setTranslate(J,ne),F.transform.baseVal.replaceItem(z,0)},I.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F);var J=F;this.x1=J.x1,this.y1=J.y1,this.x2=J.x2,this.y2=J.y2},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.x1=this.x1*F,this.y1=this.y1*J,this.x2=this.x2*F,this.y2=this.y2*J,this.adjustVisual(),this.adjustControlBox()},I}(l),y=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.strokeColor=ne.defaultColor,z.strokeWidth=ne.defaultStrokeWidth,z.strokeDasharray=ne.defaultStrokeDasharray,z.strokePanel=new p("Line color",ne.defaultColorSet,ne.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new S("Line width",ne.defaultStrokeWidths,ne.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new O("Line style",ne.defaultStrokeDasharrays,ne.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.selectorLine&&F!==this.visibleLine)},I.prototype.createVisual=function(){this.visual=P.createGroup(),this.selectorLine=P.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=P.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)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},I.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()),P.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),P.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),P.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},I.prototype.setStrokeColor=function(F){this.strokeColor=F,this.adjustVisual(),this.colorChanged(F)},I.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.adjustVisual()},I.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.adjustVisual(),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F);var J=F;this.strokeColor=J.strokeColor,this.strokeWidth=J.strokeWidth,this.strokeDasharray=J.strokeDasharray,this.createVisual(),this.adjustVisual()},I.typeName="LineMarker",I.title="Line marker",I.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',I}(w),u=function(V){function I(F,J,ne,z){var me=V.call(this,F,z||'<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=J,me.currentFont=ne,me.setCurrentFont=me.setCurrentFont.bind(me),me}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");return J.style.overflow="hidden",J.style.flexGrow="2",this.fonts.forEach(function(ne){var z=document.createElement("div");z.style.display="inline-block",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/F.fonts.length-5+"%",z.style.borderColor=ne===F.currentFont?F.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){F.setCurrentFont(ne,z)}),J.appendChild(z);var me=document.createElement("div");me.style.display="flex",me.style.minHeight="20px",me.style.flexGrow="2",me.style.fontFamily=ne,me.style.overflow="hidden";var Oe=document.createElement("div");Oe.style.whiteSpace="nowrap",Oe.style.overflow="hidden",Oe.style.textOverflow="ellipsis",Oe.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(Oe),z.appendChild(me),F.fontBoxes.push(z)}),J},I.prototype.setCurrentFont=function(F,J){var ne=this;this.currentFont=F,this.fontBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},I}(d),v=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.color="transparent",z.padding=5,z.DEFAULT_TEXT="your text here",z.text=z.DEFAULT_TEXT,z.isMoved=!1,z.color=ne.defaultColor,z.fontFamily=ne.defaultFontFamily,z.defaultSize={x:100,y:30},z.setColor=z.setColor.bind(z),z.setFont=z.setFont.bind(z),z.renderText=z.renderText.bind(z),z.sizeText=z.sizeText.bind(z),z.textEditDivClicked=z.textEditDivClicked.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.setSize=z.setSize.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.colorPanel=new p("Color",ne.defaultColorSet,ne.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new u("Font",ne.defaultFontFamilies,ne.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return X(I,V),I.prototype.ownsTarget=function(F){if(V.prototype.ownsTarget.call(this,F)||F===this.visual||F===this.textElement||F===this.bgRectangle)return!0;var J=!1;return this.textElement.childNodes.forEach(function(ne){ne===F&&(J=!0)}),J},I.prototype.createVisual=function(){this.visual=P.createGroup(),this.bgRectangle=P.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=P.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(P.createTransform()),this.textElement.transform.baseVal.appendItem(P.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.isMoved=!1,this.pointerDownPoint=F,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},I.prototype.renderText=function(){var F=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(J){F.textElement.appendChild(P.createTSpan(J.trim()===""?" ":J.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},I.prototype.getTextScale=function(){var F=this.textElement.getBBox(),J=1;if(F.width>0&&F.height>0){var ne=(1*this.width-this.width*this.padding*2/100)/F.width,z=(1*this.height-this.height*this.padding*2/100)/F.height;J=Math.min(ne,z)}return J},I.prototype.getTextPosition=function(F){var J=this.textElement.getBBox(),ne=0,z=0;return J.width>0&&J.height>0&&(ne=(this.width-J.width*F)/2,z=this.height/2-J.height*F/2),{x:ne,y:z}},I.prototype.sizeText=function(){var F=this.textElement.getBBox(),J=this.getTextScale(),ne=this.getTextPosition(J);ne.y-=F.y*J,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+ne.x+"px, "+ne.y+"px) scale("+J+", "+J+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(ne.x,ne.y),this.textElement.transform.baseVal.getItem(1).setScale(J,J))},I.prototype.manipulate=function(F){V.prototype.manipulate.call(this,F),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(F.x-this.pointerDownPoint.x)>5||Math.abs(F.y-this.pointerDownPoint.y)>5)},I.prototype.resize=function(F){V.prototype.resize.call(this,F),this.isMoved=!0,this.setSize(),this.sizeText()},I.prototype.setSize=function(){V.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(P.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),P.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},I.prototype.pointerUp=function(F){var J=this.state;J==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,F),this.setSize(),(J==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},I.prototype.showTextEditor=function(){var F=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(J){J.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var J=Number.parseFloat(F.textEditor.style.fontSize);F.textEditor.clientWidth>=Number.parseInt(F.textEditor.style.maxWidth)&&J>.9;)J-=.1,F.textEditor.style.fontSize=Math.max(J,.9)+"em"}),this.textEditor.addEventListener("keyup",function(J){J.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(J){if(J.clipboardData){var ne=J.clipboardData.getData("text"),z=window.getSelection();if(!z.rangeCount)return!1;z.deleteFromDocument(),z.getRangeAt(0).insertNode(document.createTextNode(ne)),J.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){F.textEditDivClicked(F.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},I.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var F=this.getTextScale(),J=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),ne=this.textElement.getBBox(),z={x:ne.width*F,y:ne.height*F};J.x-=z.x/2,J.y-=z.y/2,this.textEditor.style.top=J.y+"px",this.textEditor.style.left=J.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-J.x+"px",this.textEditor.style.fontSize=Math.max(16*F,12)+"px",this.textElement.style.display="none"}},I.prototype.textEditDivClicked=function(F){this.text=F.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},I.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},I.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},I.prototype.dblClick=function(F,J){V.prototype.dblClick.call(this,F,J),this.showTextEditor()},I.prototype.setColor=function(F){this.textElement&&P.setAttributes(this.textElement,[["fill",F]]),this.color=F,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(F)},I.prototype.setFont=function(F){this.textElement&&P.setAttributes(this.textElement,[["font-family",F]]),this.fontFamily=F,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},I.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},I.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){var J=F;this.color=J.color,this.fontFamily=J.fontFamily,this.padding=J.padding,this.text=J.text,this.createVisual(),V.prototype.restoreState.call(this,F),this.setSize()},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.setSize(),this.sizeText(),this.positionTextEditor()},I.typeName="TextMarker",I.title="Text marker",I.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>',I}(A),a=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.color="transparent",z.lineWidth=3,z.drawing=!1,z.pixelRatio=1,z.color=ne.defaultColor,z.lineWidth=ne.defaultStrokeWidth,z.pixelRatio=ne.freehandPixelRatio,z.setColor=z.setColor.bind(z),z.addCanvas=z.addCanvas.bind(z),z.finishCreation=z.finishCreation.bind(z),z.setLineWidth=z.setLineWidth.bind(z),z.colorPanel=new p("Color",ne.defaultColorSet,ne.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.lineWidthPanel=new S("Line width",ne.defaultStrokeWidths,ne.defaultStrokeWidth),z.lineWidthPanel.onWidthChanged=z.setLineWidth,z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.drawingImage)},I.prototype.createVisual=function(){this.visual=P.createGroup(),this.drawingImage=P.createImage(),this.visual.appendChild(this.drawingImage);var F=P.createTransform();this.visual.transform.baseVal.appendItem(F),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(F,J){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(F.x,F.y),this.drawing=!0):V.prototype.pointerDown.call(this,F,J)},I.prototype.manipulate=function(F){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(F.x,F.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,F)},I.prototype.resize=function(F){V.prototype.resize.call(this,F),P.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),P.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},I.prototype.pointerUp=function(F){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,F)},I.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)},I.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},I.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},I.prototype.finishCreation=function(){for(var F=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),J=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],ne=J[0],z=J[1],me=J[2],Oe=J[3],ke=!1,ce=0;ce<this.canvasElement.height;ce++)for(var ye=0;ye<this.canvasElement.width;ye++)F.data[ce*this.canvasElement.width*4+4*ye+3]>0&&(ke=!0,ce<z&&(z=ce),ye<ne&&(ne=ye),ce>Oe&&(Oe=ce),ye>me&&(me=ye));if(ke){this.left=ne/this.pixelRatio,this.top=z/this.pixelRatio,this.width=(me-ne)/this.pixelRatio,this.height=(Oe-z)/this.pixelRatio;var Se=document.createElement("canvas");Se.width=me-ne,Se.height=Oe-z,Se.getContext("2d").putImageData(this.canvasContext.getImageData(ne,z,me-ne,Oe-z),0,0),this.drawingImgUrl=Se.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},I.prototype.setDrawingImage=function(){P.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),P.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},I.prototype.setColor=function(F){this.color=F,this.colorChanged(F)},I.prototype.setLineWidth=function(F){this.lineWidth=F},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){this.createVisual(),V.prototype.restoreState.call(this,F),this.drawingImgUrl=F.drawingImgUrl,this.setDrawingImage()},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.setDrawingImage()},I.typeName="FreehandMarker",I.title="Freehand marker",I.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>',I}(A),_=function(V){function I(F,J,ne){var z=V.call(this,F,ne||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return z.typeBoxes=[],z.currentType=J,z.setCurrentType=z.setCurrentType.bind(z),z}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");J.style.display="flex",J.style.overflow="hidden",J.style.flexGrow="2";for(var ne=function(Oe){var ke="both";switch(Oe){case 0:ke="both";break;case 1:ke="start";break;case 2:ke="end";break;case 3:ke="none"}var ce=document.createElement("div");if(ce.style.display="flex",ce.style.flexGrow="2",ce.style.alignItems="center",ce.style.justifyContent="space-between",ce.style.padding="5px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderColor=ke===z.currentType?z.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){F.setCurrentType(ke,ce)}),J.appendChild(ce),ke==="both"||ke==="start"){var ye=document.createElement("div");ye.style.display="flex",ye.style.alignItems="center",ye.style.minHeight="20px",ye.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="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ye.style.marginLeft="5px",ce.appendChild(ye)}var Se=document.createElement("div");Se.style.display="flex",Se.style.alignItems="center",Se.style.minHeight="20px",Se.style.flexGrow="2";var Le=document.createElement("hr");if(Le.style.minWidth="20px",Le.style.border="0px",Le.style.borderTop="3px solid "+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee"),Le.style.flexGrow="2",Se.appendChild(Le),ce.appendChild(Se),ke==="both"||ke==="end"){var Be=document.createElement("div");Be.style.display="flex",Be.style.alignItems="center",Be.style.minHeight="20px",Be.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="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Be.style.marginRight="5px",ce.appendChild(Be)}z.typeBoxes.push(ce)},z=this,me=0;me<4;me++)ne(me);return J},I.prototype.setCurrentType=function(F,J){var ne=this;this.currentType=F,this.typeBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings!==void 0?ne.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},I}(d),N=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.arrowType="end",z.arrowBaseHeight=10,z.arrowBaseWidth=10,z.getArrowPoints=z.getArrowPoints.bind(z),z.setArrowType=z.setArrowType.bind(z),z.arrowTypePanel=new _("Arrow type","end"),z.arrowTypePanel.onArrowTypeChanged=z.setArrowType,z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.arrow1&&F!==this.arrow2)},I.prototype.getArrowPoints=function(F,J){var ne=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return F-ne/2+","+(J+z/2)+" "+F+","+(J-z/2)+" "+(F+ne/2)+","+(J+z/2)},I.prototype.createTips=function(){this.arrow1=P.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(P.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=P.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(P.createTransform()),this.visual.appendChild(this.arrow2)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="creating"&&this.createTips()},I.prototype.adjustVisual=function(){if(V.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",P.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),P.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var F=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),J=this.arrow1.transform.baseVal.getItem(0);J.setRotate(F,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(J,0);var ne=this.arrow2.transform.baseVal.getItem(0);ne.setRotate(F+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(ne,0)}},I.prototype.setArrowType=function(F){this.arrowType=F,this.adjustVisual(),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F);var J=F;this.arrowType=J.arrowType,this.createTips(),this.adjustVisual()},I.typeName="ArrowMarker",I.title="Arrow marker",I.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',I}(y),B=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.fillColor=ne.defaultFillColor,z.strokeWidth=0,z.fillPanel=new p("Color",ne.defaultColorSet,ne.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return X(I,V),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=V.prototype.getState.call(this);return F.typeName=I.typeName,F},I.typeName="CoverMarker",I.title="Cover marker",I.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',I}(x),T=function(V){function I(F,J,ne,z){var me=V.call(this,F,z||'<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=J,me.currentOpacity=ne,me.setCurrentOpacity=me.setCurrentOpacity.bind(me),me}return X(I,V),I.prototype.getUi=function(){var F=this,J=document.createElement("div");return J.style.display="flex",J.style.overflow="hidden",J.style.flexGrow="2",J.style.justifyContent="space-between",this.opacities.forEach(function(ne){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="center",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=ne===F.currentOpacity?F.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){F.setCurrentOpacity(ne,z)}),J.appendChild(z);var me=document.createElement("div");me.innerText=100*ne+"%",z.appendChild(me),F.opacityBoxes.push(z)}),J},I.prototype.setCurrentOpacity=function(F,J){var ne=this;this.currentOpacity=F,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===J?ne.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},I}(d),U=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=ne.defaultHighlightColor,z.strokeWidth=0,z.opacity=ne.defaultHighlightOpacity,z.fillPanel=new p("Color",ne.defaultColorSet,z.fillColor),z.fillPanel.onColorChanged=z.setFillColor,z.opacityPanel=new T("Opacity",ne.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return X(I,V),I.prototype.setOpacity=function(F){this.opacity=F,this.visual&&P.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=V.prototype.getState.call(this);return F.typeName=I.typeName,F},I.typeName="HighlightMarker",I.title="Highlight marker",I.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>',I}(B),M='<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>',E=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.bgColor="transparent",z.tipPosition={x:0,y:0},z.tipBase1Position={x:0,y:0},z.tipBase2Position={x:0,y:0},z.tipMoving=!1,z.color=ne.defaultStrokeColor,z.bgColor=ne.defaultFillColor,z.fontFamily=ne.defaultFontFamily,z.defaultSize={x:100,y:30},z.setBgColor=z.setBgColor.bind(z),z.getTipPoints=z.getTipPoints.bind(z),z.positionTip=z.positionTip.bind(z),z.setTipPoints=z.setTipPoints.bind(z),z.colorPanel=new p("Text color",ne.defaultColorSet,z.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>'),z.colorPanel.onColorChanged=z.setColor,z.bgColorPanel=new p("Fill color",ne.defaultColorSet,z.bgColor,M),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new u("Font",ne.defaultFontFamilies,ne.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.tipGrip=new o,z.tipGrip.visual.transform.baseVal.appendItem(P.createTransform()),z.controlBox.appendChild(z.tipGrip.visual),z}return X(I,V),I.prototype.ownsTarget=function(F){return V.prototype.ownsTarget.call(this,F)||this.tipGrip.ownsTarget(F)||this.tip===F},I.prototype.createTip=function(){P.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=P.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},I.prototype.pointerDown=function(F,J){this.state==="new"&&V.prototype.pointerDown.call(this,F,J),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(J)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,F,J)},I.prototype.pointerUp=function(F){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,F);else{var J=this.state==="creating";V.prototype.pointerUp.call(this,F),this.setTipPoints(J),this.positionTip()}},I.prototype.manipulate=function(F){if(this.tipMoving){var J=this.unrotatePoint(F);this.tipPosition={x:J.x-this.manipulationStartLeft,y:J.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,F)},I.prototype.setBgColor=function(F){this.bgRectangle&&this.tip&&(P.setAttributes(this.bgRectangle,[["fill",F]]),P.setAttributes(this.tip,[["fill",F]])),this.bgColor=F,this.fillColorChanged(F)},I.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},I.prototype.setTipPoints=function(F){F===void 0&&(F=!1);var J=Math.min(this.height/2,15),ne=this.height/5;F&&(this.tipPosition={x:J+ne/2,y:this.height+20});var z=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(ne=this.width/5,J=Math.min(this.width/2,15),this.tipBase1Position={x:J,y:0},this.tipBase2Position={x:J+ne,y:0}):(this.tipBase1Position={x:0,y:J},this.tipBase2Position={x:0,y:J+ne}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(ne=this.width/5,J=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-J-ne,y:0},this.tipBase2Position={x:this.width-J,y:0}):(this.tipBase1Position={x:this.width,y:J},this.tipBase2Position={x:this.width,y:J+ne}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?z<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(ne=this.width/5,J=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-J-ne,y:this.height},this.tipBase2Position={x:this.width-J,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-J-ne},this.tipBase2Position={x:this.width,y:this.height-J}):z<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(ne=this.width/5,J=Math.min(this.width/2,15),this.tipBase1Position={x:J,y:this.height},this.tipBase2Position={x:J+ne,y:this.height}):(this.tipBase1Position={x:0,y:this.height-J},this.tipBase2Position={x:0,y:this.height-J-ne})},I.prototype.resize=function(F){V.prototype.resize.call(this,F),this.positionTip()},I.prototype.positionTip=function(){P.setAttributes(this.tip,[["points",this.getTipPoints()]]);var F=this.tipGrip.visual.transform.baseVal.getItem(0);F.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(F,0)},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),I.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},I.prototype.getState=function(){var F=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){var J=F;this.bgColor=J.bgColor,this.tipPosition=J.tipPosition,V.prototype.restoreState.call(this,F),this.createTip(),this.setTipPoints()},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.tipPosition={x:this.tipPosition.x*F,y:this.tipPosition.y*J},this.positionTip()},I.typeName="CalloutMarker",I.title="Callout marker",I.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>',I}(v),H=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.strokeColor=ne.defaultColor,z.strokeWidth=ne.defaultStrokeWidth,z.strokeDasharray=ne.defaultStrokeDasharray,z.fillColor=ne.defaultFillColor,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.setOpacity=z.setOpacity.bind(z),z.createVisual=z.createVisual.bind(z),z.strokePanel=new p("Line color",j(ne.defaultColorSet,["transparent"]),ne.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new p("Fill color",j(ne.defaultColorSet,["transparent"]),z.fillColor,M),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new S("Line width",ne.defaultStrokeWidths,ne.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new O("Line style",ne.defaultStrokeDasharrays,ne.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.opacityPanel=new T("Opacity",ne.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.visual)},I.prototype.createVisual=function(){this.visual=P.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)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="new"&&(this.createVisual(),this.moveVisual(F),this._state="creating")},I.prototype.manipulate=function(F){V.prototype.manipulate.call(this,F)},I.prototype.resize=function(F){V.prototype.resize.call(this,F),this.setSize()},I.prototype.setSize=function(){V.prototype.setSize.call(this),P.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},I.prototype.pointerUp=function(F){V.prototype.pointerUp.call(this,F),this.setSize()},I.prototype.setStrokeColor=function(F){this.strokeColor=F,this.visual&&P.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(F),this.stateChanged()},I.prototype.setFillColor=function(F){this.fillColor=F,this.visual&&P.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(F),this.stateChanged()},I.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.visual&&P.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},I.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.visual&&P.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},I.prototype.setOpacity=function(F){this.opacity=F,this.visual&&P.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){var J=F;this.fillColor=J.fillColor,this.strokeColor=J.strokeColor,this.strokeWidth=J.strokeWidth,this.strokeDasharray=J.strokeDasharray,this.opacity=J.opacity,this.createVisual(),V.prototype.restoreState.call(this,F),this.setSize()},I.prototype.scale=function(F,J){V.prototype.scale.call(this,F,J),this.setSize()},I.typeName="EllipseMarker",I.title="Ellipse marker",I.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>',I}(A),Z=function(V){function I(F,J,ne){return V.call(this,F,J,ne)||this}return X(I,V),Object.defineProperty(I.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.tip1&&F!==this.tip2)},I.prototype.createTips=function(){this.tip1=P.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(P.createTransform()),this.visual.appendChild(this.tip1),this.tip2=P.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(P.createTransform()),this.visual.appendChild(this.tip2)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.state==="creating"&&this.createTips()},I.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(P.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()]]),P.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 F=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),J=this.tip1.transform.baseVal.getItem(0);J.setRotate(F,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(J,0);var ne=this.tip2.transform.baseVal.getItem(0);ne.setRotate(F+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(ne,0)}},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=V.prototype.getState.call(this);return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F),this.createTips(),this.adjustVisual()},I.typeName="MeasurementMarker",I.title="Measurement marker",I.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>',I}(y),oe=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.strokePanel.colors=ne.defaultColorSet,z.fillColor="transparent",z}return X(I,V),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=V.prototype.getState.call(this);return F.typeName=I.typeName,F},I.typeName="EllipseFrameMarker",I.title="Ellipse frame marker",I.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>',I}(H),de=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(I){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(I)||(this.undoStack.push(I),JSON.stringify(this.lastRedoStep)!==JSON.stringify(I)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(I){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=I)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var I=this.undoStack.pop();return I!==void 0&&this.redoStack.push(I),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),Te=function(V){function I(F,J,ne){var z=V.call(this,F,J,ne)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.curveX=0,z.curveY=0,z.manipulationStartCurveX=0,z.manipulationStartCurveY=0,z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.positionGrips=z.positionGrips.bind(z),z.addControlGrips=z.addControlGrips.bind(z),z.adjustVisual=z.adjustVisual.bind(z),z.setupControlBox=z.setupControlBox.bind(z),z.resize=z.resize.bind(z),z.strokeColor=ne.defaultColor,z.strokeWidth=ne.defaultStrokeWidth,z.strokeDasharray=ne.defaultStrokeDasharray,z.strokePanel=new p("Line color",ne.defaultColorSet,ne.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new S("Line width",ne.defaultStrokeWidths,ne.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new O("Line style",ne.defaultStrokeDasharrays,ne.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return X(I,V),I.prototype.ownsTarget=function(F){return!(!V.prototype.ownsTarget.call(this,F)&&F!==this.visual&&F!==this.selectorCurve&&F!==this.visibleCurve&&!this.curveGrip.ownsTarget(F))},I.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},I.prototype.createVisual=function(){this.visual=P.createGroup(),this.selectorCurve=P.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=P.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)},I.prototype.pointerDown=function(F,J){V.prototype.pointerDown.call(this,F,J),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=F.x,this.curveY=F.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(J)&&(this.activeGrip=this.curveGrip,this._state="resize")},I.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),P.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),P.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),P.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},I.prototype.setupControlBox=function(){V.prototype.setupControlBox.call(this),this.curveControlLine1=P.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=P.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)},I.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},I.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var F=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-F/2,this.curveY-F/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()))},I.prototype.manipulate=function(F){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+F.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+F.y-this.manipulationStartY),V.prototype.manipulate.call(this,F)},I.prototype.resize=function(F){this.activeGrip===this.curveGrip&&(this.curveX=F.x,this.curveY=F.y),V.prototype.resize.call(this,F),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},I.prototype.setStrokeColor=function(F){this.strokeColor=F,this.adjustVisual(),this.colorChanged(F)},I.prototype.setStrokeWidth=function(F){this.strokeWidth=F,this.adjustVisual()},I.prototype.setStrokeDasharray=function(F){this.strokeDasharray=F,this.adjustVisual()},I.prototype.scale=function(F,J){this.curveX=this.curveX*F,this.curveY=this.curveY*J,V.prototype.scale.call(this,F,J)},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var F=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return F.typeName=I.typeName,F},I.prototype.restoreState=function(F){V.prototype.restoreState.call(this,F);var J=F;this.strokeColor=J.strokeColor,this.strokeWidth=J.strokeWidth,this.strokeDasharray=J.strokeDasharray,this.curveX=J.curveX,this.curveY=J.curveY,this.createVisual(),this.adjustVisual()},I.typeName="CurveMarker",I.title="Curve marker",I.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>',I}(w),be=function(){function V(I,F){F===void 0&&(F=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=I,this.cancelable=F}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),Ae=function(V){function I(F,J,ne){var z=V.call(this,F,!1)||this;return z.dataUrl=J,z.state=ne,z}return X(I,V),I}(be),Ce=function(V){function I(F,J,ne){ne===void 0&&(ne=!1);var z=V.call(this,F,ne)||this;return z.marker=J,z}return X(I,V),I}(be),_e=function(){function V(){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 V.prototype.addEventListener=function(I,F){this[I].push(F)},V.prototype.removeEventListener=function(I,F){var J=this[I].indexOf(F);J>-1&&this[I].splice(J,1)},V}(),ge=function(){function V(I){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new C,this._isOpen=!1,this.undoRedoManager=new de,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 _e,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new L(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=I,this.targetRoot=document.body,this.width=I.clientWidth,this.height=I.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(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[R,a,N,v,oe,H,U,E,Z,B,y,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[R,a,N,v,H,U,E]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[R,a,N,v,U]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(I){var F=this;this._availableMarkerTypes.splice(0),I.forEach(function(J){if(typeof J=="string"){var ne=F.ALL_MARKER_TYPES.find(function(z){return z.typeName===J});ne!==void 0&&F._availableMarkerTypes.push(ne)}else F._availableMarkerTypes.push(J)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(I){this._zoomLevel=I,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),G.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},V.prototype.show=function(){var I=this;this.styles.styleSheetRoot===void 0&&n.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=n.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(F){return F(new be(I))})},V.prototype.render=function(){return D(this,void 0,void 0,function(){var I;return Y(this,function(F){switch(F.label){case 0:return this.setCurrentMarker(),(I=new W).naturalSize=this.renderAtNaturalSize,I.imageType=this.renderImageType,I.imageQuality=this.renderImageQuality,I.markersOnly=this.renderMarkersOnly,I.width=this.renderWidth,I.height=this.renderHeight,[4,I.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return F.sent(),[4,I.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,F.sent()]}})})},V.prototype.close=function(I){var F=this;if(I===void 0&&(I=!1),this.isOpen){var J=!1;I||this.eventListeners.beforeclose.forEach(function(ne){var z=new be(F,!0);ne(z),z.defaultPrevented&&(J=!0)}),J||(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(ne){return ne(new be(F))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var I,F=[],J=0;J<arguments.length;J++)F[J]=arguments[J];(I=this._availableMarkerTypes).push.apply(I,F)},V.prototype.addRenderEventListener=function(I){this.addEventListener("render",function(F){I(F.dataUrl,F.state)})},V.prototype.removeRenderEventListener=function(I){},V.prototype.addCloseEventListener=function(I){this.addEventListener("close",function(){I()})},V.prototype.removeCloseEventListener=function(I){},V.prototype.setupResizeObserver=function(){var I=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){I.resize(I.target.clientWidth,I.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return I.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var I=1*this.target.clientWidth/this.target.clientHeight,F=this.editorCanvas.clientWidth/I>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*I:this.editorCanvas.clientWidth,J=F<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/I;this.resize(F,J)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(I,F){this._isResizing=!0;var J=I/this.imageWidth,ne=F/this.imageHeight;this.imageWidth=Math.round(I),this.imageHeight=Math.round(F),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(J,ne),this._isResizing=!1},V.prototype.scaleMarkers=function(I,F){var J,ne=this;this._currentMarker&&this._currentMarker instanceof v?this._currentMarker.scale(I,F):(J=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(z){z!==ne._currentMarker&&z.scale(I,F)}),J!==void 0&&this.setCurrentMarker(J)},V.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"},V.prototype.setTopLeft=function(){var I=this.editingTarget.getBoundingClientRect(),F=this.editorCanvas.getBoundingClientRect();this.left=I.left-F.left,this.top=I.top-F.top},V.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)},V.prototype.addDefs=function(){for(var I,F=[],J=0;J<arguments.length;J++)F[J]=arguments[J];this.defs=P.createDefs(),this.addDefsToImage(),(I=this.defs).append.apply(I,F)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.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)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.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)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.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)},V.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 I=document.createElement("a");I.href="https://markerjs.com/",I.target="_blank",I.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>',I.title="Powered by marker.js",I.style.display="grid",I.style.alignItems="center",I.style.justifyItems="center",I.style.padding="3px",I.style.width="20px",I.style.height="20px",this.logoUI.appendChild(I),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.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")},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.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 I=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=I+"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 g(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 c(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.removeMarker=function(I){this.markerImage.removeChild(I.container),this.markers.indexOf(I)>-1&&this.markers.splice(this.markers.indexOf(I),1),I.dispose()},V.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())},V.prototype.toolbarButtonClicked=function(I,F){if(I==="marker"&&F!==void 0)this.createNewMarker(F);else if(I==="action")switch(F){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()}},V.prototype.deleteSelectedMarker=function(){var I=this;if(this._currentMarker!==void 0){var F=!1;if(this.eventListeners.markerbeforedelete.forEach(function(ne){var z=new Ce(I,I._currentMarker,!0);ne(z),z.defaultPrevented&&(F=!0)}),!F){var J=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(ne){return ne(new Ce(I,J))})}}},V.prototype.clear=function(){var I=this,F=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var Oe=new Ce(I,void 0,!0);me(Oe),Oe.defaultPrevented&&(F=!0)}),!F)){this.setCurrentMarker();for(var J=function(me){var Oe=ne.markers[me];ne.setCurrentMarker(ne.markers[me]),ne._currentMarker.dispose(),ne.markerImage.removeChild(ne._currentMarker.container),ne.markers.splice(ne.markers.indexOf(ne._currentMarker),1),ne.eventListeners.markerdelete.forEach(function(ke){return ke(new Ce(I,Oe))})},ne=this,z=this.markers.length-1;z>=0;z--)J(z);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var I;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=(I=this._currentMarker.notes)!==null&&I!==void 0?I:"",this.overlayContainer.appendChild(this.notesArea))},V.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)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var I=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var F=this.getState(),J=this.undoRedoManager.getLastUndoStep();if(!J||J.width===F.width&&J.height===F.height){var ne=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(F),ne<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(z){return z(new be(I))})}else this.undoRedoManager.replaceLastUndoStep(F),this.eventListeners.statechange.forEach(function(z){return z(new be(I))})}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var I=this,F=this.undoRedoManager.undo();F!==void 0&&(this.restoreState(F),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(J){return J(new be(I))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var I=this,F=this.undoRedoManager.redo();F!==void 0&&(this.restoreState(F),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(J){return J(new be(I))}))},V.prototype.stepZoom=function(){var I=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=I<this.zoomSteps.length-1?this.zoomSteps[I+1]:this.zoomSteps[0]},V.prototype.panTo=function(I){this.contentDiv.scrollBy({left:this.prevPanPoint.x-I.x,top:this.prevPanPoint.y-I.y}),this.prevPanPoint=I},V.prototype.startRenderAndClose=function(){return D(this,void 0,void 0,function(){var I,F,J=this;return Y(this,function(ne){switch(ne.label){case 0:return[4,this.render()];case 1:return I=ne.sent(),F=this.getState(),this.eventListeners.render.forEach(function(z){return z(new Ae(J,I,F))}),this.close(!0),[2]}})})},V.prototype.getState=function(I){I===!0&&this.setCurrentMarker();var F={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(J){return F.markers.push(J.getState())}),F},V.prototype.restoreState=function(I){var F=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);I.markers.forEach(function(J){var ne=F._availableMarkerTypes.find(function(me){return me.typeName===J.typeName});if(ne!==void 0){var z=F.addNewMarker(ne);z.restoreState(J),F.markers.push(z)}}),I.width&&I.height&&(I.width!==this.imageWidth||I.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/I.width,this.imageHeight/I.height),this.eventListeners.restorestate.forEach(function(J){return J(new be(F))})},V.prototype.addNewMarker=function(I){var F=P.createGroup();return this.markerImage.appendChild(F),new I(F,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(I){var F,J=this;(F=typeof I=="string"?this._availableMarkerTypes.find(function(ne){return ne.typeName===I}):I)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(F),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(F.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(ne){return ne(new Ce(J,J._currentMarker))}))},V.prototype.markerCreated=function(I){var F=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(I),this.setCurrentMarker(I),I instanceof a&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(a):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(J){return J(new Ce(F,F._currentMarker))})},V.prototype.colorChanged=function(I){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=I,this.settings.defaultStrokeColor=I)},V.prototype.fillColorChanged=function(I){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=I)},V.prototype.markerStateChanged=function(I){var F=this;this.eventListeners.markerchange.forEach(function(J){return J(new Ce(F,I))})},V.prototype.setCurrentMarker=function(I){var F=this;this._currentMarker!==I&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(J){return J(new Ce(F,F._currentMarker))})),this._currentMarker=I,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(J){return J(new Ce(F,F._currentMarker))}))},V.prototype.onPointerDown=function(I){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||I.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var F=this.markers.find(function(J){return J.ownsTarget(I.target)});F!==void 0?(this.setCurrentMarker(F),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(I.clientX,I.clientY),I.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:I.clientX,y:I.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(I.clientX,I.clientY))},V.prototype.onDblClick=function(I){if(this._isFocused||this.focus(),this.mode==="select"){var F=this.markers.find(function(J){return J.ownsTarget(I.target)});F!==void 0&&F!==this._currentMarker&&this.setCurrentMarker(F),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(I.clientX,I.clientY),I.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(I){this.touchPoints!==1&&I.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||I.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(I.clientX,I.clientY)):this.zoomLevel>1&&this.panTo({x:I.clientX,y:I.clientY}))},V.prototype.onPointerUp=function(I){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(I.clientX,I.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(I){this._currentMarker===void 0||this.notesArea!==void 0||I.key!=="Delete"&&I.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(I,F){var J=this.markerImage.getBoundingClientRect();return{x:(I-J.left)/this.zoomLevel,y:(F-J.top)/this.zoomLevel}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var I=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=I+"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()},V.prototype.addLicenseKey=function(I){G.addKey(I)},V.prototype.addEventListener=function(I,F){this.eventListeners.addEventListener(I,F)},V.prototype.removeEventListener=function(I,F){this.eventListeners.removeEventListener(I,F)},V.prototype.renderState=function(I){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(I),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var I=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(F){return F(new be(I))}))},V.prototype.blur=function(){var I=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(F){return F(new be(I))}))},V.instanceCounter=0,V}()},T8No:function(rt,we,$){"use strict";$.d(we,"a",function(){return G}),$.d(we,"e",function(){return W}),$.d(we,"c",function(){return y}),$.d(we,"b",function(){return u}),$.d(we,"d",function(){return v}),$.d(we,"f",function(){return N});var le=$("MNsG"),X=$("N0LK"),D=$("Cg/j");let Y=le.k||"";const j=new Map;j.set("false",!1),j.set("true",!0),j.set("isMac",le.f),j.set("isLinux",le.d),j.set("isWindows",le.i),j.set("isWeb",le.h),j.set("isMacNative",le.f&&!le.h),j.set("isEdge",Y.indexOf("Edg/")>=0),j.set("isFirefox",Y.indexOf("Firefox")>=0),j.set("isChrome",Y.indexOf("Chrome")>=0),j.set("isSafari",Y.indexOf("Safari")>=0);const P=Object.prototype.hasOwnProperty;class G{static has(T){return m.create(T)}static equals(T,U){return g.create(T,U)}static regex(T,U){return S.create(T,U)}static not(T){return l.create(T)}static and(...T){return C.create(T,null)}static or(...T){return w.create(T,null,!0)}static deserialize(T,U=!1){return T?this._deserializeOrExpression(T,U):void 0}static _deserializeOrExpression(T,U){let M=T.split("||");return w.create(M.map(E=>this._deserializeAndExpression(E,U)),null,!0)}static _deserializeAndExpression(T,U){let M=T.split("&&");return C.create(M.map(E=>this._deserializeOne(E,U)),null)}static _deserializeOne(T,U){if(T=T.trim(),T.indexOf("!=")>=0){let M=T.split("!=");return p.create(M[0].trim(),this._deserializeValue(M[1],U))}if(T.indexOf("==")>=0){let M=T.split("==");return g.create(M[0].trim(),this._deserializeValue(M[1],U))}if(T.indexOf("=~")>=0){let M=T.split("=~");return S.create(M[0].trim(),this._deserializeRegexValue(M[1],U))}if(T.indexOf(" in ")>=0){let M=T.split(" in ");return c.create(M[0].trim(),M[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(T)){const M=T.split(">=");return s.create(M[0].trim(),M[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(T)){const M=T.split(">");return o.create(M[0].trim(),M[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(T)){const M=T.split("<=");return x.create(M[0].trim(),M[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(T)){const M=T.split("<");return A.create(M[0].trim(),M[1].trim())}return/^\!\s*/.test(T)?l.create(T.substr(1).trim()):m.create(T)}static _deserializeValue(T,U){if(T=T.trim(),T==="true")return!0;if(T==="false")return!1;let M=/^'([^']*)'$/.exec(T);return M?M[1].trim():T}static _deserializeRegexValue(T,U){if(Object(X.C)(T)){if(U)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let M=T.indexOf("/"),E=T.lastIndexOf("/");if(M===E||M<0){if(U)throw new Error(`bad regexp-value '${T}', missing /-enclosure`);return console.warn(`bad regexp-value '${T}', missing /-enclosure`),null}let H=T.slice(M+1,E),Z=T[E+1]==="i"?"i":"";try{return new RegExp(H,Z)}catch(oe){if(U)throw new Error(`bad regexp-value '${T}', parse error: ${oe}`);return console.warn(`bad regexp-value '${T}', parse error: ${oe}`),null}}}function W(T,U){const M=T?T.substituteConstants():void 0,E=U?U.substituteConstants():void 0;return!M&&!E?!0:!M||!E?!1:M.equals(E)}function n(T,U){return T.cmp(U)}class L{constructor(){this.type=0}cmp(T){return this.type-T.type}equals(T){return T.type===this.type}substituteConstants(){return this}evaluate(T){return!1}serialize(){return"false"}keys(){return[]}negate(){return b.INSTANCE}}L.INSTANCE=new L;class b{constructor(){this.type=1}cmp(T){return this.type-T.type}equals(T){return T.type===this.type}substituteConstants(){return this}evaluate(T){return!0}serialize(){return"true"}keys(){return[]}negate(){return L.INSTANCE}}b.INSTANCE=new b;class m{constructor(T,U){this.key=T,this.negated=U,this.type=2}static create(T,U=null){const M=j.get(T);return typeof M=="boolean"?M?b.INSTANCE:L.INSTANCE:new m(T,U)}cmp(T){return T.type!==this.type?this.type-T.type:a(this.key,T.key)}equals(T){return T.type===this.type?this.key===T.key:!1}substituteConstants(){const T=j.get(this.key);return typeof T=="boolean"?T?b.INSTANCE:L.INSTANCE:this}evaluate(T){return!!T.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=l.create(this.key,this)),this.negated}}class g{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=4}static create(T,U,M=null){if(typeof U=="boolean")return U?m.create(T,M):l.create(T,M);const E=j.get(T);if(typeof E=="boolean"){const H=E?"true":"false";return U===H?b.INSTANCE:L.INSTANCE}return new g(T,U,M)}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){const T=j.get(this.key);if(typeof T=="boolean"){const U=T?"true":"false";return this.value===U?b.INSTANCE:L.INSTANCE}return this}evaluate(T){return T.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=p.create(this.key,this.value,this)),this.negated}}class c{constructor(T,U){this.key=T,this.valueKey=U,this.type=10,this.negated=null}static create(T,U){return new c(T,U)}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.valueKey,T.key,T.valueKey)}equals(T){return T.type===this.type?this.key===T.key&&this.valueKey===T.valueKey:!1}substituteConstants(){return this}evaluate(T){const U=T.getValue(this.valueKey),M=T.getValue(this.key);return Array.isArray(U)?U.indexOf(M)>=0:typeof M=="string"&&typeof U=="object"&&U!==null?P.call(U,M):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=d.create(this)),this.negated}}class d{constructor(T){this._actual=T,this.type=11}static create(T){return new d(T)}cmp(T){return T.type!==this.type?this.type-T.type:this._actual.cmp(T._actual)}equals(T){return T.type===this.type?this._actual.equals(T._actual):!1}substituteConstants(){return this}evaluate(T){return!this._actual.evaluate(T)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class p{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=5}static create(T,U,M=null){if(typeof U=="boolean")return U?l.create(T,M):m.create(T,M);const E=j.get(T);if(typeof E=="boolean"){const H=E?"true":"false";return U===H?L.INSTANCE:b.INSTANCE}return new p(T,U,M)}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){const T=j.get(this.key);if(typeof T=="boolean"){const U=T?"true":"false";return this.value===U?L.INSTANCE:b.INSTANCE}return this}evaluate(T){return T.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this.value,this)),this.negated}}class l{constructor(T,U){this.key=T,this.negated=U,this.type=3}static create(T,U=null){const M=j.get(T);return typeof M=="boolean"?M?L.INSTANCE:b.INSTANCE:new l(T,U)}cmp(T){return T.type!==this.type?this.type-T.type:a(this.key,T.key)}equals(T){return T.type===this.type?this.key===T.key:!1}substituteConstants(){const T=j.get(this.key);return typeof T=="boolean"?T?L.INSTANCE:b.INSTANCE:this}evaluate(T){return!T.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this)),this.negated}}function h(T,U){if(typeof T=="string"){const M=parseFloat(T);isNaN(M)||(T=M)}return typeof T=="string"||typeof T=="number"?U(T):L.INSTANCE}class o{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=12}static create(T,U,M=null){return h(U,E=>new o(T,E,M))}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){return this}evaluate(T){return typeof this.value=="string"?!1:parseFloat(T.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this.key,this.value,this)),this.negated}}class s{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=13}static create(T,U,M=null){return h(U,E=>new s(T,E,M))}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){return this}evaluate(T){return typeof this.value=="string"?!1:parseFloat(T.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=A.create(this.key,this.value,this)),this.negated}}class A{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=14}static create(T,U,M=null){return h(U,E=>new A(T,E,M))}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){return this}evaluate(T){return typeof this.value=="string"?!1:parseFloat(T.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=s.create(this.key,this.value,this)),this.negated}}class x{constructor(T,U,M){this.key=T,this.value=U,this.negated=M,this.type=15}static create(T,U,M=null){return h(U,E=>new x(T,E,M))}cmp(T){return T.type!==this.type?this.type-T.type:_(this.key,this.value,T.key,T.value)}equals(T){return T.type===this.type?this.key===T.key&&this.value===T.value:!1}substituteConstants(){return this}evaluate(T){return typeof this.value=="string"?!1:parseFloat(T.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=o.create(this.key,this.value,this)),this.negated}}class S{constructor(T,U){this.key=T,this.regexp=U,this.type=7,this.negated=null}static create(T,U){return new S(T,U)}cmp(T){if(T.type!==this.type)return this.type-T.type;if(this.key<T.key)return-1;if(this.key>T.key)return 1;const U=this.regexp?this.regexp.source:"",M=T.regexp?T.regexp.source:"";return U<M?-1:U>M?1:0}equals(T){if(T.type===this.type){const U=this.regexp?this.regexp.source:"",M=T.regexp?T.regexp.source:"";return this.key===T.key&&U===M}return!1}substituteConstants(){return this}evaluate(T){let U=T.getValue(this.key);return this.regexp?this.regexp.test(U):!1}serialize(){const T=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${T}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=O.create(this)),this.negated}}class O{constructor(T){this._actual=T,this.type=8}static create(T){return new O(T)}cmp(T){return T.type!==this.type?this.type-T.type:this._actual.cmp(T._actual)}equals(T){return T.type===this.type?this._actual.equals(T._actual):!1}substituteConstants(){return this}evaluate(T){return!this._actual.evaluate(T)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function R(T){let U=null;for(let M=0,E=T.length;M<E;M++){const H=T[M].substituteConstants();if(T[M]!==H&&U===null){U=[];for(let Z=0;Z<M;Z++)U[Z]=T[Z]}U!==null&&(U[M]=H)}return U===null?T:U}class C{constructor(T,U){this.expr=T,this.negated=U,this.type=6}static create(T,U){return C._normalizeArr(T,U)}cmp(T){if(T.type!==this.type)return this.type-T.type;if(this.expr.length<T.expr.length)return-1;if(this.expr.length>T.expr.length)return 1;for(let U=0,M=this.expr.length;U<M;U++){const E=n(this.expr[U],T.expr[U]);if(E!==0)return E}return 0}equals(T){if(T.type===this.type){if(this.expr.length!==T.expr.length)return!1;for(let U=0,M=this.expr.length;U<M;U++)if(!this.expr[U].equals(T.expr[U]))return!1;return!0}return!1}substituteConstants(){const T=R(this.expr);return T===this.expr?this:C.create(T,this.negated)}evaluate(T){for(let U=0,M=this.expr.length;U<M;U++)if(!this.expr[U].evaluate(T))return!1;return!0}static _normalizeArr(T,U){const M=[];let E=!1;for(const H of T){if(!H)continue;if(H.type===1){E=!0;continue}if(H.type===0)return L.INSTANCE;if(H.type===6){M.push(...H.expr);continue}M.push(H)}if(M.length===0&&E)return b.INSTANCE;if(M.length===0)return;if(M.length===1)return M[0];M.sort(n);for(let H=1;H<M.length;H++)M[H-1].equals(M[H])&&(M.splice(H,1),H--);if(M.length===1)return M[0];for(;M.length>1;){const H=M[M.length-1];if(H.type!==9)break;M.pop();const Z=M.pop(),oe=M.length===0,de=w.create(H.expr.map(Te=>C.create([Te,Z],null)),null,oe);de&&(M.push(de),M.sort(n))}return M.length===1?M[0]:new C(M,U)}serialize(){return this.expr.map(T=>T.serialize()).join(" && ")}keys(){const T=[];for(let U of this.expr)T.push(...U.keys());return T}negate(){if(!this.negated){const T=[];for(let U of this.expr)T.push(U.negate());this.negated=w.create(T,this,!0)}return this.negated}}class w{constructor(T,U){this.expr=T,this.negated=U,this.type=9}static create(T,U,M){return w._normalizeArr(T,U,M)}cmp(T){if(T.type!==this.type)return this.type-T.type;if(this.expr.length<T.expr.length)return-1;if(this.expr.length>T.expr.length)return 1;for(let U=0,M=this.expr.length;U<M;U++){const E=n(this.expr[U],T.expr[U]);if(E!==0)return E}return 0}equals(T){if(T.type===this.type){if(this.expr.length!==T.expr.length)return!1;for(let U=0,M=this.expr.length;U<M;U++)if(!this.expr[U].equals(T.expr[U]))return!1;return!0}return!1}substituteConstants(){const T=R(this.expr);return T===this.expr?this:w.create(T,this.negated,!1)}evaluate(T){for(let U=0,M=this.expr.length;U<M;U++)if(this.expr[U].evaluate(T))return!0;return!1}static _normalizeArr(T,U,M){let E=[],H=!1;if(T){for(let Z=0,oe=T.length;Z<oe;Z++){const de=T[Z];if(!de)continue;if(de.type===0){H=!0;continue}if(de.type===1)return b.INSTANCE;if(de.type===9){E=E.concat(de.expr);continue}E.push(de)}if(E.length===0&&H)return L.INSTANCE;E.sort(n)}if(E.length===0)return;if(E.length===1)return E[0];for(let Z=1;Z<E.length;Z++)E[Z-1].equals(E[Z])&&(E.splice(Z,1),Z--);if(E.length===1)return E[0];if(M){for(let Z=0;Z<E.length;Z++)for(let oe=Z+1;oe<E.length;oe++)N(E[Z],E[oe])&&(E.splice(oe,1),oe--);if(E.length===1)return E[0]}return new w(E,U)}serialize(){return this.expr.map(T=>T.serialize()).join(" || ")}keys(){const T=[];for(let U of this.expr)T.push(...U.keys());return T}negate(){if(!this.negated){let T=[];for(let U of this.expr)T.push(U.negate());for(;T.length>1;){const U=T.shift(),M=T.shift(),E=[];for(const Z of B(U))for(const oe of B(M))E.push(C.create([Z,oe],null));const H=T.length===0;T.unshift(w.create(E,null,H))}this.negated=T[0]}return this.negated}}class y extends m{constructor(T,U,M){super(T,null);this._defaultValue=U,typeof M=="object"?y._info.push(Object.assign(Object.assign({},M),{key:T})):M!==!0&&y._info.push({key:T,description:M,type:U!=null?typeof U:void 0})}static all(){return y._info.values()}bindTo(T){return T.createKey(this.key,this._defaultValue)}getValue(T){return T.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(T){return g.create(this.key,T)}}y._info=[];const u=Object(D.c)("contextKeyService"),v="setContext";function a(T,U){return T<U?-1:T>U?1:0}function _(T,U,M,E){return T<M?-1:T>M?1:U<E?-1:U>E?1:0}function N(T,U){if(U.type===6&&T.type!==9&&T.type!==6){for(const H of U.expr)if(T.equals(H))return!0}const M=T.negate(),E=B(M).concat(B(U));E.sort(n);for(let H=0;H<E.length;H++){const Z=E[H],oe=Z.negate();for(let de=H+1;de<E.length;de++){const Te=E[de];if(oe.equals(Te))return!0}}return!1}function B(T){return T.type===9?T.expr:[T]}},TXwP:function(rt,we,$){var le,X;(function(){var D;(function(){"use strict";var j=[,,function(n){function L(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var g=new L(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},L.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},L.prototype.has_match=function(g){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(g))return!0;return!1},L.prototype.set_indent=function(g,c){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(g){this.__items.push(g);var c=g.lastIndexOf(`
`);c!==-1?this.__character_count=g.length-c:this.__character_count+=g.length},L.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function b(g,c){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),c=c||"",g.indent_level>0&&(c=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}b.prototype.get_indent_size=function(g,c){var d=this.__base_string_length;return c=c||0,g<0&&(d=0),d+=g*this.__indent_size,d+=c,d},b.prototype.get_indent_string=function(g,c){var d=this.__base_string;return c=c||0,g<0&&(g=0,d=""),c+=g*this.__indent_size,this.__ensure_cache(c),d+=this.__cache[c],d},b.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},b.prototype.__add_column=function(){var g=this.__cache.length,c=0,d="";this.__indent_size&&g>=this.__indent_size&&(c=Math.floor(g/this.__indent_size),g-=c*this.__indent_size,d=new Array(c+1).join(this.__indent_string)),g&&(d+=new Array(g+1).join(" ")),this.__cache.push(d)};function m(g,c){this.__indent_cache=new b(g,c),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(g,c){return this.__indent_cache.get_indent_string(g,c)},m.prototype.get_indent_size=function(g,c){return this.__indent_cache.get_indent_size(g,c)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(g){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var d=this.__lines.join(`
`);return g!==`
`&&(d=d.replace(/[\n]/g,g)),d},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(g,c){return g=g||0,c=c||0,this.next_line.set_indent(g,c),this.__lines.length>1?(this.current_line.set_indent(g,c),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(g){for(var c=0;c<g.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(g){for(var c=this.__lines.length;g<c;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(g,c){for(var d=this.__lines.length-2;d>=0;){var p=this.__lines[d];if(p.is_empty())break;if(p.item(0).indexOf(g)!==0&&p.item(-1)!==c){this.__lines.splice(d+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}d--}},n.exports.Output=m},,,,function(n){function L(g,c){this.raw_options=b(g,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(g,c){var d=this.raw_options[g],p=c||[];return typeof d=="object"?d!==null&&typeof d.concat=="function"&&(p=d.concat()):typeof d=="string"&&(p=d.split(/[^a-zA-Z0-9_\/\-]+/)),p},L.prototype._get_boolean=function(g,c){var d=this.raw_options[g],p=d===void 0?!!c:!!d;return p},L.prototype._get_characters=function(g,c){var d=this.raw_options[g],p=c||"";return typeof d=="string"&&(p=d.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),p},L.prototype._get_number=function(g,c){var d=this.raw_options[g];c=parseInt(c,10),isNaN(c)&&(c=0);var p=parseInt(d,10);return isNaN(p)&&(p=c),p},L.prototype._get_selection=function(g,c,d){var p=this._get_selection_list(g,c,d);if(p.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+c+`
You passed in: '`+this.raw_options[g]+"'");return p[0]},L.prototype._get_selection_list=function(g,c,d){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(d=d||[c[0]],!this._is_valid_selection(d,c))throw new Error("Invalid Default Value!");var p=this._get_array(g,d);if(!this._is_valid_selection(p,c))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+c+`
You passed in: '`+this.raw_options[g]+"'");return p},L.prototype._is_valid_selection=function(g,c){return g.length&&c.length&&!g.some(function(d){return c.indexOf(d)===-1})};function b(g,c){var d={};g=m(g);var p;for(p in g)p!==c&&(d[p]=g[p]);if(c&&g[c])for(p in g[c])d[p]=g[c][p];return d}function m(g){var c={},d;for(d in g){var p=d.replace(/-/g,"_");c[p]=g[d]}return c}n.exports.Options=L,n.exports.normalizeOpts=m,n.exports.mergeOpts=b},,function(n){var L=RegExp.prototype.hasOwnProperty("sticky");function b(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}b.prototype.restart=function(){this.__position=0},b.prototype.back=function(){this.__position>0&&(this.__position-=1)},b.prototype.hasNext=function(){return this.__position<this.__input_length},b.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},b.prototype.peek=function(m){var g=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(g=this.__input.charAt(m)),g},b.prototype.__match=function(m,g){m.lastIndex=g;var c=m.exec(this.__input);return c&&!(L&&m.sticky)&&(c.index!==g&&(c=null)),c},b.prototype.test=function(m,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(m,g):!1},b.prototype.testChar=function(m,g){var c=this.peek(g);return m.lastIndex=0,c!==null&&m.test(c)},b.prototype.match=function(m){var g=this.__match(m,this.__position);return g?this.__position+=g[0].length:g=null,g},b.prototype.read=function(m,g,c){var d="",p;return m&&(p=this.match(m),p&&(d+=p[0])),g&&(p||!m)&&(d+=this.readUntil(g,c)),d},b.prototype.readUntil=function(m,g){var c="",d=this.__position;m.lastIndex=this.__position;var p=m.exec(this.__input);return p?(d=p.index,g&&(d+=p[0].length)):d=this.__input_length,c=this.__input.substring(this.__position,d),this.__position=d,c},b.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},b.prototype.get_regexp=function(m,g){var c=null,d="g";return g&&L&&(d="y"),typeof m=="string"&&m!==""?c=new RegExp(m,d):m&&(c=new RegExp(m.source,d)),c},b.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},b.prototype.peekUntilAfter=function(m){var g=this.__position,c=this.readUntilAfter(m);return this.__position=g,c},b.prototype.lookBack=function(m){var g=this.__position-1;return g>=m.length&&this.__input.substring(g-m.length,g).toLowerCase()===m},n.exports.InputScanner=b},,,,,function(n){function L(b,m){b=typeof b=="string"?b:b.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(b+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(b+/\sbeautify\signore:end\s/.source+m,"g")}L.prototype.get_directives=function(b){if(!b.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(b);g;)m[g[1]]=g[2],g=this.__directive_pattern.exec(b);return m},L.prototype.readIgnored=function(b){return b.readUntilAfter(this.__directives_end_ignore_pattern)},n.exports.Directives=L},,function(n,L,b){var m=b(16).Beautifier,g=b(17).Options;function c(d,p){var l=new m(d,p);return l.beautify()}n.exports=c,n.exports.defaultOptions=function(){return new g}},function(n,L,b){var m=b(17).Options,g=b(2).Output,c=b(8).InputScanner,d=b(13).Directives,p=new d(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,h=/\r\n|[\r\n]/g,o=/\s/,s=/(?:\s|\n)+/g,A=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,x=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function S(O,R){this._source_text=O||"",this._options=new m(R),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}S.prototype.eatString=function(O){var R="";for(this._ch=this._input.next();this._ch;){if(R+=this._ch,this._ch==="\\")R+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return R},S.prototype.eatWhitespace=function(O){for(var R=o.test(this._input.peek()),C=0;o.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
`&&((C===0||C<this._options.max_preserve_newlines)&&(C++,this._output.add_new_line(!0)));return R},S.prototype.foundNestedPseudoClass=function(){for(var O=0,R=1,C=this._input.peek(R);C;){if(C==="{")return!0;if(C==="(")O+=1;else if(C===")"){if(O===0)return!1;O-=1}else if(C===";"||C==="}")return!1;R++,C=this._input.peek(R)}return!1},S.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},S.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},S.prototype.indent=function(){this._indentLevel++},S.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},S.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,R=this._options.eol;R==="auto"&&(R=`
`,O&&l.test(O||"")&&(R=O.match(l)[0])),O=O.replace(h,`
`);var C=O.match(/^[\t ]*/)[0];this._output=new g(this._options,C),this._input=new c(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var w=0,y=!1,u=!1,v=!1,a=!1,_=!1,N=!1,B=this._ch,T=!1,U,M,E;U=this._input.read(s),M=U!=="",E=B,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),B=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var H=this._input.read(A),Z=p.get_directives(H);Z&&Z.ignore==="start"&&(H+=p.readIgnored(this._input)),this.print_string(H),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(x)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(M),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var oe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);oe.match(/[ :]$/)&&(oe=this.eatString(": ").replace(/\s$/,""),this.print_string(oe),this._output.space_before_token=!0),oe=oe.replace(/\s$/,""),oe==="extend"?a=!0:oe==="import"&&(_=!0),oe in this.NESTED_AT_RULE?(this._nestedLevel+=1,oe in this.CONDITIONAL_GROUP_RULE&&(v=!0)):!y&&w===0&&oe.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(M),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),v?(v=!1,y=this._indentLevel>=this._nestedLevel):y=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&y&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(E==="("?this._output.space_before_token=!1:E!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),E==="{"&&this._output.trim(!0),_=!1,a=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),y=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var de=0;de<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;de++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[de])){T=!0;break}(y||v)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!a&&w===0?(this.print_string(":"),u||(u=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Te=E==='"'||E==="'";this.preserveSingleSpace(Te||M),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")T=!1,w===0?(u&&(this.outdent(),u=!1),a=!1,_=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),w++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),w&&(w--,this.outdent()));else{var be=!1;this._input.lookBack("with")&&(be=!0),this.preserveSingleSpace(M||be),this.print_string(this._ch),u&&E==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),N=!0):(this.eatWhitespace(),w++,this.indent())}else if(this._ch===")")w&&(w--,this.outdent()),N&&this._input.peek()===";"&&this._options.selector_separator_newline&&(N=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!u||N)&&w===0&&!_&&!a?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&w===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&o.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(M),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),o.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Ae=E==='"'||E==="'";this.preserveSingleSpace(Ae||M),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&T&&this._output.add_new_line()}var Ce=this._output.get_code(R);return Ce},n.exports.Beautifier=S},function(n,L,b){var m=b(6).Options;function g(c){m.call(this,c,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var d=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||d;var p=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<p.length;l++)p[l]!=="expand"?this.brace_style="collapse":this.brace_style=p[l]}g.prototype=new m,n.exports.Options=g}],P={};function G(n){var L=P[n];if(L!==void 0)return L.exports;var b=P[n]={exports:{}};return j[n](b,b.exports,G),b.exports}var W=G(15);D=W})();var Y=D;!(le=[],X=function(){return{css_beautify:Y}}.apply(we,le),X!==void 0&&(rt.exports=X))})()},Vhoy:function(rt,we,$){"use strict";$.d(we,"d",function(){return Y}),$.d(we,"e",function(){return j}),$.d(we,"c",function(){return P}),$.d(we,"b",function(){return G}),$.d(we,"a",function(){return W});var le=$("MI8n");class X{constructor(){this._icons=new Map,this._onDidRegister=new le.b}add(n){const L=this._icons.get(n.id);L?n.description?L.description=n.description:console.error(`Duplicate registration of codicon ${n.id}`):(this._icons.set(n.id,n),this._onDidRegister.fire(n))}get(n){return this._icons.get(n)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const D=new X,Y=D;function j(n,L){return new G(n,L)}function P(n){return n?n.replace(/\$\((.*?)\)/g,(L,b)=>` ${b} `).trim():""}class G{constructor(n,L,b){this.id=n,this.definition=L,this.description=b,D.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var W;(function(n){n.iconNameSegment="[A-Za-z0-9]+",n.iconNameExpression="[A-Za-z0-9\\-]+",n.iconModifierExpression="~[A-Za-z]+";const L=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function b(c){if(c instanceof G)return["codicon","codicon-"+c.id];const d=L.exec(c.id);if(!d)return b(G.error);let[,p,l]=d;const h=["codicon","codicon-"+p];return l&&h.push("codicon-modifier-"+l.substr(1)),h}n.asClassNameArray=b;function m(c){return b(c).join(" ")}n.asClassName=m;function g(c){return"."+b(c).join(".")}n.asCSSSelector=g})(W||(W={})),function(n){n.add=new n("add",{fontCharacter:"\\ea60"}),n.plus=new n("plus",n.add.definition),n.gistNew=new n("gist-new",n.add.definition),n.repoCreate=new n("repo-create",n.add.definition),n.lightbulb=new n("lightbulb",{fontCharacter:"\\ea61"}),n.lightBulb=new n("light-bulb",{fontCharacter:"\\ea61"}),n.repo=new n("repo",{fontCharacter:"\\ea62"}),n.repoDelete=new n("repo-delete",{fontCharacter:"\\ea62"}),n.gistFork=new n("gist-fork",{fontCharacter:"\\ea63"}),n.repoForked=new n("repo-forked",{fontCharacter:"\\ea63"}),n.gitPullRequest=new n("git-pull-request",{fontCharacter:"\\ea64"}),n.gitPullRequestAbandoned=new n("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),n.recordKeys=new n("record-keys",{fontCharacter:"\\ea65"}),n.keyboard=new n("keyboard",{fontCharacter:"\\ea65"}),n.tag=new n("tag",{fontCharacter:"\\ea66"}),n.tagAdd=new n("tag-add",{fontCharacter:"\\ea66"}),n.tagRemove=new n("tag-remove",{fontCharacter:"\\ea66"}),n.person=new n("person",{fontCharacter:"\\ea67"}),n.personFollow=new n("person-follow",{fontCharacter:"\\ea67"}),n.personOutline=new n("person-outline",{fontCharacter:"\\ea67"}),n.personFilled=new n("person-filled",{fontCharacter:"\\ea67"}),n.gitBranch=new n("git-branch",{fontCharacter:"\\ea68"}),n.gitBranchCreate=new n("git-branch-create",{fontCharacter:"\\ea68"}),n.gitBranchDelete=new n("git-branch-delete",{fontCharacter:"\\ea68"}),n.sourceControl=new n("source-control",{fontCharacter:"\\ea68"}),n.mirror=new n("mirror",{fontCharacter:"\\ea69"}),n.mirrorPublic=new n("mirror-public",{fontCharacter:"\\ea69"}),n.star=new n("star",{fontCharacter:"\\ea6a"}),n.starAdd=new n("star-add",{fontCharacter:"\\ea6a"}),n.starDelete=new n("star-delete",{fontCharacter:"\\ea6a"}),n.starEmpty=new n("star-empty",{fontCharacter:"\\ea6a"}),n.comment=new n("comment",{fontCharacter:"\\ea6b"}),n.commentAdd=new n("comment-add",{fontCharacter:"\\ea6b"}),n.alert=new n("alert",{fontCharacter:"\\ea6c"}),n.warning=new n("warning",{fontCharacter:"\\ea6c"}),n.search=new n("search",{fontCharacter:"\\ea6d"}),n.searchSave=new n("search-save",{fontCharacter:"\\ea6d"}),n.logOut=new n("log-out",{fontCharacter:"\\ea6e"}),n.signOut=new n("sign-out",{fontCharacter:"\\ea6e"}),n.logIn=new n("log-in",{fontCharacter:"\\ea6f"}),n.signIn=new n("sign-in",{fontCharacter:"\\ea6f"}),n.eye=new n("eye",{fontCharacter:"\\ea70"}),n.eyeUnwatch=new n("eye-unwatch",{fontCharacter:"\\ea70"}),n.eyeWatch=new n("eye-watch",{fontCharacter:"\\ea70"}),n.circleFilled=new n("circle-filled",{fontCharacter:"\\ea71"}),n.primitiveDot=new n("primitive-dot",{fontCharacter:"\\ea71"}),n.closeDirty=new n("close-dirty",{fontCharacter:"\\ea71"}),n.debugBreakpoint=new n("debug-breakpoint",{fontCharacter:"\\ea71"}),n.debugBreakpointDisabled=new n("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),n.debugHint=new n("debug-hint",{fontCharacter:"\\ea71"}),n.primitiveSquare=new n("primitive-square",{fontCharacter:"\\ea72"}),n.edit=new n("edit",{fontCharacter:"\\ea73"}),n.pencil=new n("pencil",{fontCharacter:"\\ea73"}),n.info=new n("info",{fontCharacter:"\\ea74"}),n.issueOpened=new n("issue-opened",{fontCharacter:"\\ea74"}),n.gistPrivate=new n("gist-private",{fontCharacter:"\\ea75"}),n.gitForkPrivate=new n("git-fork-private",{fontCharacter:"\\ea75"}),n.lock=new n("lock",{fontCharacter:"\\ea75"}),n.mirrorPrivate=new n("mirror-private",{fontCharacter:"\\ea75"}),n.close=new n("close",{fontCharacter:"\\ea76"}),n.removeClose=new n("remove-close",{fontCharacter:"\\ea76"}),n.x=new n("x",{fontCharacter:"\\ea76"}),n.repoSync=new n("repo-sync",{fontCharacter:"\\ea77"}),n.sync=new n("sync",{fontCharacter:"\\ea77"}),n.clone=new n("clone",{fontCharacter:"\\ea78"}),n.desktopDownload=new n("desktop-download",{fontCharacter:"\\ea78"}),n.beaker=new n("beaker",{fontCharacter:"\\ea79"}),n.microscope=new n("microscope",{fontCharacter:"\\ea79"}),n.vm=new n("vm",{fontCharacter:"\\ea7a"}),n.deviceDesktop=new n("device-desktop",{fontCharacter:"\\ea7a"}),n.file=new n("file",{fontCharacter:"\\ea7b"}),n.fileText=new n("file-text",{fontCharacter:"\\ea7b"}),n.more=new n("more",{fontCharacter:"\\ea7c"}),n.ellipsis=new n("ellipsis",{fontCharacter:"\\ea7c"}),n.kebabHorizontal=new n("kebab-horizontal",{fontCharacter:"\\ea7c"}),n.mailReply=new n("mail-reply",{fontCharacter:"\\ea7d"}),n.reply=new n("reply",{fontCharacter:"\\ea7d"}),n.organization=new n("organization",{fontCharacter:"\\ea7e"}),n.organizationFilled=new n("organization-filled",{fontCharacter:"\\ea7e"}),n.organizationOutline=new n("organization-outline",{fontCharacter:"\\ea7e"}),n.newFile=new n("new-file",{fontCharacter:"\\ea7f"}),n.fileAdd=new n("file-add",{fontCharacter:"\\ea7f"}),n.newFolder=new n("new-folder",{fontCharacter:"\\ea80"}),n.fileDirectoryCreate=new n("file-directory-create",{fontCharacter:"\\ea80"}),n.trash=new n("trash",{fontCharacter:"\\ea81"}),n.trashcan=new n("trashcan",{fontCharacter:"\\ea81"}),n.history=new n("history",{fontCharacter:"\\ea82"}),n.clock=new n("clock",{fontCharacter:"\\ea82"}),n.folder=new n("folder",{fontCharacter:"\\ea83"}),n.fileDirectory=new n("file-directory",{fontCharacter:"\\ea83"}),n.symbolFolder=new n("symbol-folder",{fontCharacter:"\\ea83"}),n.logoGithub=new n("logo-github",{fontCharacter:"\\ea84"}),n.markGithub=new n("mark-github",{fontCharacter:"\\ea84"}),n.github=new n("github",{fontCharacter:"\\ea84"}),n.terminal=new n("terminal",{fontCharacter:"\\ea85"}),n.console=new n("console",{fontCharacter:"\\ea85"}),n.repl=new n("repl",{fontCharacter:"\\ea85"}),n.zap=new n("zap",{fontCharacter:"\\ea86"}),n.symbolEvent=new n("symbol-event",{fontCharacter:"\\ea86"}),n.error=new n("error",{fontCharacter:"\\ea87"}),n.stop=new n("stop",{fontCharacter:"\\ea87"}),n.variable=new n("variable",{fontCharacter:"\\ea88"}),n.symbolVariable=new n("symbol-variable",{fontCharacter:"\\ea88"}),n.array=new n("array",{fontCharacter:"\\ea8a"}),n.symbolArray=new n("symbol-array",{fontCharacter:"\\ea8a"}),n.symbolModule=new n("symbol-module",{fontCharacter:"\\ea8b"}),n.symbolPackage=new n("symbol-package",{fontCharacter:"\\ea8b"}),n.symbolNamespace=new n("symbol-namespace",{fontCharacter:"\\ea8b"}),n.symbolObject=new n("symbol-object",{fontCharacter:"\\ea8b"}),n.symbolMethod=new n("symbol-method",{fontCharacter:"\\ea8c"}),n.symbolFunction=new n("symbol-function",{fontCharacter:"\\ea8c"}),n.symbolConstructor=new n("symbol-constructor",{fontCharacter:"\\ea8c"}),n.symbolBoolean=new n("symbol-boolean",{fontCharacter:"\\ea8f"}),n.symbolNull=new n("symbol-null",{fontCharacter:"\\ea8f"}),n.symbolNumeric=new n("symbol-numeric",{fontCharacter:"\\ea90"}),n.symbolNumber=new n("symbol-number",{fontCharacter:"\\ea90"}),n.symbolStructure=new n("symbol-structure",{fontCharacter:"\\ea91"}),n.symbolStruct=new n("symbol-struct",{fontCharacter:"\\ea91"}),n.symbolParameter=new n("symbol-parameter",{fontCharacter:"\\ea92"}),n.symbolTypeParameter=new n("symbol-type-parameter",{fontCharacter:"\\ea92"}),n.symbolKey=new n("symbol-key",{fontCharacter:"\\ea93"}),n.symbolText=new n("symbol-text",{fontCharacter:"\\ea93"}),n.symbolReference=new n("symbol-reference",{fontCharacter:"\\ea94"}),n.goToFile=new n("go-to-file",{fontCharacter:"\\ea94"}),n.symbolEnum=new n("symbol-enum",{fontCharacter:"\\ea95"}),n.symbolValue=new n("symbol-value",{fontCharacter:"\\ea95"}),n.symbolRuler=new n("symbol-ruler",{fontCharacter:"\\ea96"}),n.symbolUnit=new n("symbol-unit",{fontCharacter:"\\ea96"}),n.activateBreakpoints=new n("activate-breakpoints",{fontCharacter:"\\ea97"}),n.archive=new n("archive",{fontCharacter:"\\ea98"}),n.arrowBoth=new n("arrow-both",{fontCharacter:"\\ea99"}),n.arrowDown=new n("arrow-down",{fontCharacter:"\\ea9a"}),n.arrowLeft=new n("arrow-left",{fontCharacter:"\\ea9b"}),n.arrowRight=new n("arrow-right",{fontCharacter:"\\ea9c"}),n.arrowSmallDown=new n("arrow-small-down",{fontCharacter:"\\ea9d"}),n.arrowSmallLeft=new n("arrow-small-left",{fontCharacter:"\\ea9e"}),n.arrowSmallRight=new n("arrow-small-right",{fontCharacter:"\\ea9f"}),n.arrowSmallUp=new n("arrow-small-up",{fontCharacter:"\\eaa0"}),n.arrowUp=new n("arrow-up",{fontCharacter:"\\eaa1"}),n.bell=new n("bell",{fontCharacter:"\\eaa2"}),n.bold=new n("bold",{fontCharacter:"\\eaa3"}),n.book=new n("book",{fontCharacter:"\\eaa4"}),n.bookmark=new n("bookmark",{fontCharacter:"\\eaa5"}),n.debugBreakpointConditionalUnverified=new n("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),n.debugBreakpointConditional=new n("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),n.debugBreakpointConditionalDisabled=new n("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),n.debugBreakpointDataUnverified=new n("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),n.debugBreakpointData=new n("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),n.debugBreakpointDataDisabled=new n("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),n.debugBreakpointLogUnverified=new n("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),n.debugBreakpointLog=new n("debug-breakpoint-log",{fontCharacter:"\\eaab"}),n.debugBreakpointLogDisabled=new n("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),n.briefcase=new n("briefcase",{fontCharacter:"\\eaac"}),n.broadcast=new n("broadcast",{fontCharacter:"\\eaad"}),n.browser=new n("browser",{fontCharacter:"\\eaae"}),n.bug=new n("bug",{fontCharacter:"\\eaaf"}),n.calendar=new n("calendar",{fontCharacter:"\\eab0"}),n.caseSensitive=new n("case-sensitive",{fontCharacter:"\\eab1"}),n.check=new n("check",{fontCharacter:"\\eab2"}),n.checklist=new n("checklist",{fontCharacter:"\\eab3"}),n.chevronDown=new n("chevron-down",{fontCharacter:"\\eab4"}),n.dropDownButton=new n("drop-down-button",n.chevronDown.definition),n.chevronLeft=new n("chevron-left",{fontCharacter:"\\eab5"}),n.chevronRight=new n("chevron-right",{fontCharacter:"\\eab6"}),n.chevronUp=new n("chevron-up",{fontCharacter:"\\eab7"}),n.chromeClose=new n("chrome-close",{fontCharacter:"\\eab8"}),n.chromeMaximize=new n("chrome-maximize",{fontCharacter:"\\eab9"}),n.chromeMinimize=new n("chrome-minimize",{fontCharacter:"\\eaba"}),n.chromeRestore=new n("chrome-restore",{fontCharacter:"\\eabb"}),n.circleOutline=new n("circle-outline",{fontCharacter:"\\eabc"}),n.debugBreakpointUnverified=new n("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),n.circleSlash=new n("circle-slash",{fontCharacter:"\\eabd"}),n.circuitBoard=new n("circuit-board",{fontCharacter:"\\eabe"}),n.clearAll=new n("clear-all",{fontCharacter:"\\eabf"}),n.clippy=new n("clippy",{fontCharacter:"\\eac0"}),n.closeAll=new n("close-all",{fontCharacter:"\\eac1"}),n.cloudDownload=new n("cloud-download",{fontCharacter:"\\eac2"}),n.cloudUpload=new n("cloud-upload",{fontCharacter:"\\eac3"}),n.code=new n("code",{fontCharacter:"\\eac4"}),n.collapseAll=new n("collapse-all",{fontCharacter:"\\eac5"}),n.colorMode=new n("color-mode",{fontCharacter:"\\eac6"}),n.commentDiscussion=new n("comment-discussion",{fontCharacter:"\\eac7"}),n.compareChanges=new n("compare-changes",{fontCharacter:"\\eafd"}),n.creditCard=new n("credit-card",{fontCharacter:"\\eac9"}),n.dash=new n("dash",{fontCharacter:"\\eacc"}),n.dashboard=new n("dashboard",{fontCharacter:"\\eacd"}),n.database=new n("database",{fontCharacter:"\\eace"}),n.debugContinue=new n("debug-continue",{fontCharacter:"\\eacf"}),n.debugDisconnect=new n("debug-disconnect",{fontCharacter:"\\ead0"}),n.debugPause=new n("debug-pause",{fontCharacter:"\\ead1"}),n.debugRestart=new n("debug-restart",{fontCharacter:"\\ead2"}),n.debugStart=new n("debug-start",{fontCharacter:"\\ead3"}),n.debugStepInto=new n("debug-step-into",{fontCharacter:"\\ead4"}),n.debugStepOut=new n("debug-step-out",{fontCharacter:"\\ead5"}),n.debugStepOver=new n("debug-step-over",{fontCharacter:"\\ead6"}),n.debugStop=new n("debug-stop",{fontCharacter:"\\ead7"}),n.debug=new n("debug",{fontCharacter:"\\ead8"}),n.deviceCameraVideo=new n("device-camera-video",{fontCharacter:"\\ead9"}),n.deviceCamera=new n("device-camera",{fontCharacter:"\\eada"}),n.deviceMobile=new n("device-mobile",{fontCharacter:"\\eadb"}),n.diffAdded=new n("diff-added",{fontCharacter:"\\eadc"}),n.diffIgnored=new n("diff-ignored",{fontCharacter:"\\eadd"}),n.diffModified=new n("diff-modified",{fontCharacter:"\\eade"}),n.diffRemoved=new n("diff-removed",{fontCharacter:"\\eadf"}),n.diffRenamed=new n("diff-renamed",{fontCharacter:"\\eae0"}),n.diff=new n("diff",{fontCharacter:"\\eae1"}),n.discard=new n("discard",{fontCharacter:"\\eae2"}),n.editorLayout=new n("editor-layout",{fontCharacter:"\\eae3"}),n.emptyWindow=new n("empty-window",{fontCharacter:"\\eae4"}),n.exclude=new n("exclude",{fontCharacter:"\\eae5"}),n.extensions=new n("extensions",{fontCharacter:"\\eae6"}),n.eyeClosed=new n("eye-closed",{fontCharacter:"\\eae7"}),n.fileBinary=new n("file-binary",{fontCharacter:"\\eae8"}),n.fileCode=new n("file-code",{fontCharacter:"\\eae9"}),n.fileMedia=new n("file-media",{fontCharacter:"\\eaea"}),n.filePdf=new n("file-pdf",{fontCharacter:"\\eaeb"}),n.fileSubmodule=new n("file-submodule",{fontCharacter:"\\eaec"}),n.fileSymlinkDirectory=new n("file-symlink-directory",{fontCharacter:"\\eaed"}),n.fileSymlinkFile=new n("file-symlink-file",{fontCharacter:"\\eaee"}),n.fileZip=new n("file-zip",{fontCharacter:"\\eaef"}),n.files=new n("files",{fontCharacter:"\\eaf0"}),n.filter=new n("filter",{fontCharacter:"\\eaf1"}),n.flame=new n("flame",{fontCharacter:"\\eaf2"}),n.foldDown=new n("fold-down",{fontCharacter:"\\eaf3"}),n.foldUp=new n("fold-up",{fontCharacter:"\\eaf4"}),n.fold=new n("fold",{fontCharacter:"\\eaf5"}),n.folderActive=new n("folder-active",{fontCharacter:"\\eaf6"}),n.folderOpened=new n("folder-opened",{fontCharacter:"\\eaf7"}),n.gear=new n("gear",{fontCharacter:"\\eaf8"}),n.gift=new n("gift",{fontCharacter:"\\eaf9"}),n.gistSecret=new n("gist-secret",{fontCharacter:"\\eafa"}),n.gist=new n("gist",{fontCharacter:"\\eafb"}),n.gitCommit=new n("git-commit",{fontCharacter:"\\eafc"}),n.gitCompare=new n("git-compare",{fontCharacter:"\\eafd"}),n.gitMerge=new n("git-merge",{fontCharacter:"\\eafe"}),n.githubAction=new n("github-action",{fontCharacter:"\\eaff"}),n.githubAlt=new n("github-alt",{fontCharacter:"\\eb00"}),n.globe=new n("globe",{fontCharacter:"\\eb01"}),n.grabber=new n("grabber",{fontCharacter:"\\eb02"}),n.graph=new n("graph",{fontCharacter:"\\eb03"}),n.gripper=new n("gripper",{fontCharacter:"\\eb04"}),n.heart=new n("heart",{fontCharacter:"\\eb05"}),n.home=new n("home",{fontCharacter:"\\eb06"}),n.horizontalRule=new n("horizontal-rule",{fontCharacter:"\\eb07"}),n.hubot=new n("hubot",{fontCharacter:"\\eb08"}),n.inbox=new n("inbox",{fontCharacter:"\\eb09"}),n.issueClosed=new n("issue-closed",{fontCharacter:"\\eba4"}),n.issueReopened=new n("issue-reopened",{fontCharacter:"\\eb0b"}),n.issues=new n("issues",{fontCharacter:"\\eb0c"}),n.italic=new n("italic",{fontCharacter:"\\eb0d"}),n.jersey=new n("jersey",{fontCharacter:"\\eb0e"}),n.json=new n("json",{fontCharacter:"\\eb0f"}),n.kebabVertical=new n("kebab-vertical",{fontCharacter:"\\eb10"}),n.key=new n("key",{fontCharacter:"\\eb11"}),n.law=new n("law",{fontCharacter:"\\eb12"}),n.lightbulbAutofix=new n("lightbulb-autofix",{fontCharacter:"\\eb13"}),n.linkExternal=new n("link-external",{fontCharacter:"\\eb14"}),n.link=new n("link",{fontCharacter:"\\eb15"}),n.listOrdered=new n("list-ordered",{fontCharacter:"\\eb16"}),n.listUnordered=new n("list-unordered",{fontCharacter:"\\eb17"}),n.liveShare=new n("live-share",{fontCharacter:"\\eb18"}),n.loading=new n("loading",{fontCharacter:"\\eb19"}),n.location=new n("location",{fontCharacter:"\\eb1a"}),n.mailRead=new n("mail-read",{fontCharacter:"\\eb1b"}),n.mail=new n("mail",{fontCharacter:"\\eb1c"}),n.markdown=new n("markdown",{fontCharacter:"\\eb1d"}),n.megaphone=new n("megaphone",{fontCharacter:"\\eb1e"}),n.mention=new n("mention",{fontCharacter:"\\eb1f"}),n.milestone=new n("milestone",{fontCharacter:"\\eb20"}),n.mortarBoard=new n("mortar-board",{fontCharacter:"\\eb21"}),n.move=new n("move",{fontCharacter:"\\eb22"}),n.multipleWindows=new n("multiple-windows",{fontCharacter:"\\eb23"}),n.mute=new n("mute",{fontCharacter:"\\eb24"}),n.noNewline=new n("no-newline",{fontCharacter:"\\eb25"}),n.note=new n("note",{fontCharacter:"\\eb26"}),n.octoface=new n("octoface",{fontCharacter:"\\eb27"}),n.openPreview=new n("open-preview",{fontCharacter:"\\eb28"}),n.package_=new n("package",{fontCharacter:"\\eb29"}),n.paintcan=new n("paintcan",{fontCharacter:"\\eb2a"}),n.pin=new n("pin",{fontCharacter:"\\eb2b"}),n.play=new n("play",{fontCharacter:"\\eb2c"}),n.run=new n("run",{fontCharacter:"\\eb2c"}),n.plug=new n("plug",{fontCharacter:"\\eb2d"}),n.preserveCase=new n("preserve-case",{fontCharacter:"\\eb2e"}),n.preview=new n("preview",{fontCharacter:"\\eb2f"}),n.project=new n("project",{fontCharacter:"\\eb30"}),n.pulse=new n("pulse",{fontCharacter:"\\eb31"}),n.question=new n("question",{fontCharacter:"\\eb32"}),n.quote=new n("quote",{fontCharacter:"\\eb33"}),n.radioTower=new n("radio-tower",{fontCharacter:"\\eb34"}),n.reactions=new n("reactions",{fontCharacter:"\\eb35"}),n.references=new n("references",{fontCharacter:"\\eb36"}),n.refresh=new n("refresh",{fontCharacter:"\\eb37"}),n.regex=new n("regex",{fontCharacter:"\\eb38"}),n.remoteExplorer=new n("remote-explorer",{fontCharacter:"\\eb39"}),n.remote=new n("remote",{fontCharacter:"\\eb3a"}),n.remove=new n("remove",{fontCharacter:"\\eb3b"}),n.replaceAll=new n("replace-all",{fontCharacter:"\\eb3c"}),n.replace=new n("replace",{fontCharacter:"\\eb3d"}),n.repoClone=new n("repo-clone",{fontCharacter:"\\eb3e"}),n.repoForcePush=new n("repo-force-push",{fontCharacter:"\\eb3f"}),n.repoPull=new n("repo-pull",{fontCharacter:"\\eb40"}),n.repoPush=new n("repo-push",{fontCharacter:"\\eb41"}),n.report=new n("report",{fontCharacter:"\\eb42"}),n.requestChanges=new n("request-changes",{fontCharacter:"\\eb43"}),n.rocket=new n("rocket",{fontCharacter:"\\eb44"}),n.rootFolderOpened=new n("root-folder-opened",{fontCharacter:"\\eb45"}),n.rootFolder=new n("root-folder",{fontCharacter:"\\eb46"}),n.rss=new n("rss",{fontCharacter:"\\eb47"}),n.ruby=new n("ruby",{fontCharacter:"\\eb48"}),n.saveAll=new n("save-all",{fontCharacter:"\\eb49"}),n.saveAs=new n("save-as",{fontCharacter:"\\eb4a"}),n.save=new n("save",{fontCharacter:"\\eb4b"}),n.screenFull=new n("screen-full",{fontCharacter:"\\eb4c"}),n.screenNormal=new n("screen-normal",{fontCharacter:"\\eb4d"}),n.searchStop=new n("search-stop",{fontCharacter:"\\eb4e"}),n.server=new n("server",{fontCharacter:"\\eb50"}),n.settingsGear=new n("settings-gear",{fontCharacter:"\\eb51"}),n.settings=new n("settings",{fontCharacter:"\\eb52"}),n.shield=new n("shield",{fontCharacter:"\\eb53"}),n.smiley=new n("smiley",{fontCharacter:"\\eb54"}),n.sortPrecedence=new n("sort-precedence",{fontCharacter:"\\eb55"}),n.splitHorizontal=new n("split-horizontal",{fontCharacter:"\\eb56"}),n.splitVertical=new n("split-vertical",{fontCharacter:"\\eb57"}),n.squirrel=new n("squirrel",{fontCharacter:"\\eb58"}),n.starFull=new n("star-full",{fontCharacter:"\\eb59"}),n.starHalf=new n("star-half",{fontCharacter:"\\eb5a"}),n.symbolClass=new n("symbol-class",{fontCharacter:"\\eb5b"}),n.symbolColor=new n("symbol-color",{fontCharacter:"\\eb5c"}),n.symbolConstant=new n("symbol-constant",{fontCharacter:"\\eb5d"}),n.symbolEnumMember=new n("symbol-enum-member",{fontCharacter:"\\eb5e"}),n.symbolField=new n("symbol-field",{fontCharacter:"\\eb5f"}),n.symbolFile=new n("symbol-file",{fontCharacter:"\\eb60"}),n.symbolInterface=new n("symbol-interface",{fontCharacter:"\\eb61"}),n.symbolKeyword=new n("symbol-keyword",{fontCharacter:"\\eb62"}),n.symbolMisc=new n("symbol-misc",{fontCharacter:"\\eb63"}),n.symbolOperator=new n("symbol-operator",{fontCharacter:"\\eb64"}),n.symbolProperty=new n("symbol-property",{fontCharacter:"\\eb65"}),n.wrench=new n("wrench",{fontCharacter:"\\eb65"}),n.wrenchSubaction=new n("wrench-subaction",{fontCharacter:"\\eb65"}),n.symbolSnippet=new n("symbol-snippet",{fontCharacter:"\\eb66"}),n.tasklist=new n("tasklist",{fontCharacter:"\\eb67"}),n.telescope=new n("telescope",{fontCharacter:"\\eb68"}),n.textSize=new n("text-size",{fontCharacter:"\\eb69"}),n.threeBars=new n("three-bars",{fontCharacter:"\\eb6a"}),n.thumbsdown=new n("thumbsdown",{fontCharacter:"\\eb6b"}),n.thumbsup=new n("thumbsup",{fontCharacter:"\\eb6c"}),n.tools=new n("tools",{fontCharacter:"\\eb6d"}),n.triangleDown=new n("triangle-down",{fontCharacter:"\\eb6e"}),n.triangleLeft=new n("triangle-left",{fontCharacter:"\\eb6f"}),n.triangleRight=new n("triangle-right",{fontCharacter:"\\eb70"}),n.triangleUp=new n("triangle-up",{fontCharacter:"\\eb71"}),n.twitter=new n("twitter",{fontCharacter:"\\eb72"}),n.unfold=new n("unfold",{fontCharacter:"\\eb73"}),n.unlock=new n("unlock",{fontCharacter:"\\eb74"}),n.unmute=new n("unmute",{fontCharacter:"\\eb75"}),n.unverified=new n("unverified",{fontCharacter:"\\eb76"}),n.verified=new n("verified",{fontCharacter:"\\eb77"}),n.versions=new n("versions",{fontCharacter:"\\eb78"}),n.vmActive=new n("vm-active",{fontCharacter:"\\eb79"}),n.vmOutline=new n("vm-outline",{fontCharacter:"\\eb7a"}),n.vmRunning=new n("vm-running",{fontCharacter:"\\eb7b"}),n.watch=new n("watch",{fontCharacter:"\\eb7c"}),n.whitespace=new n("whitespace",{fontCharacter:"\\eb7d"}),n.wholeWord=new n("whole-word",{fontCharacter:"\\eb7e"}),n.window=new n("window",{fontCharacter:"\\eb7f"}),n.wordWrap=new n("word-wrap",{fontCharacter:"\\eb80"}),n.zoomIn=new n("zoom-in",{fontCharacter:"\\eb81"}),n.zoomOut=new n("zoom-out",{fontCharacter:"\\eb82"}),n.listFilter=new n("list-filter",{fontCharacter:"\\eb83"}),n.listFlat=new n("list-flat",{fontCharacter:"\\eb84"}),n.listSelection=new n("list-selection",{fontCharacter:"\\eb85"}),n.selection=new n("selection",{fontCharacter:"\\eb85"}),n.listTree=new n("list-tree",{fontCharacter:"\\eb86"}),n.debugBreakpointFunctionUnverified=new n("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),n.debugBreakpointFunction=new n("debug-breakpoint-function",{fontCharacter:"\\eb88"}),n.debugBreakpointFunctionDisabled=new n("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),n.debugStackframeActive=new n("debug-stackframe-active",{fontCharacter:"\\eb89"}),n.debugStackframeDot=new n("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),n.debugStackframe=new n("debug-stackframe",{fontCharacter:"\\eb8b"}),n.debugStackframeFocused=new n("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),n.debugBreakpointUnsupported=new n("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),n.symbolString=new n("symbol-string",{fontCharacter:"\\eb8d"}),n.debugReverseContinue=new n("debug-reverse-continue",{fontCharacter:"\\eb8e"}),n.debugStepBack=new n("debug-step-back",{fontCharacter:"\\eb8f"}),n.debugRestartFrame=new n("debug-restart-frame",{fontCharacter:"\\eb90"}),n.callIncoming=new n("call-incoming",{fontCharacter:"\\eb92"}),n.callOutgoing=new n("call-outgoing",{fontCharacter:"\\eb93"}),n.menu=new n("menu",{fontCharacter:"\\eb94"}),n.expandAll=new n("expand-all",{fontCharacter:"\\eb95"}),n.feedback=new n("feedback",{fontCharacter:"\\eb96"}),n.groupByRefType=new n("group-by-ref-type",{fontCharacter:"\\eb97"}),n.ungroupByRefType=new n("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),n.account=new n("account",{fontCharacter:"\\eb99"}),n.bellDot=new n("bell-dot",{fontCharacter:"\\eb9a"}),n.debugConsole=new n("debug-console",{fontCharacter:"\\eb9b"}),n.library=new n("library",{fontCharacter:"\\eb9c"}),n.output=new n("output",{fontCharacter:"\\eb9d"}),n.runAll=new n("run-all",{fontCharacter:"\\eb9e"}),n.syncIgnored=new n("sync-ignored",{fontCharacter:"\\eb9f"}),n.pinned=new n("pinned",{fontCharacter:"\\eba0"}),n.githubInverted=new n("github-inverted",{fontCharacter:"\\eba1"}),n.debugAlt=new n("debug-alt",{fontCharacter:"\\eb91"}),n.serverProcess=new n("server-process",{fontCharacter:"\\eba2"}),n.serverEnvironment=new n("server-environment",{fontCharacter:"\\eba3"}),n.pass=new n("pass",{fontCharacter:"\\eba4"}),n.stopCircle=new n("stop-circle",{fontCharacter:"\\eba5"}),n.playCircle=new n("play-circle",{fontCharacter:"\\eba6"}),n.record=new n("record",{fontCharacter:"\\eba7"}),n.debugAltSmall=new n("debug-alt-small",{fontCharacter:"\\eba8"}),n.vmConnect=new n("vm-connect",{fontCharacter:"\\eba9"}),n.cloud=new n("cloud",{fontCharacter:"\\ebaa"}),n.merge=new n("merge",{fontCharacter:"\\ebab"}),n.exportIcon=new n("export",{fontCharacter:"\\ebac"}),n.graphLeft=new n("graph-left",{fontCharacter:"\\ebad"}),n.magnet=new n("magnet",{fontCharacter:"\\ebae"}),n.notebook=new n("notebook",{fontCharacter:"\\ebaf"}),n.redo=new n("redo",{fontCharacter:"\\ebb0"}),n.checkAll=new n("check-all",{fontCharacter:"\\ebb1"}),n.pinnedDirty=new n("pinned-dirty",{fontCharacter:"\\ebb2"}),n.passFilled=new n("pass-filled",{fontCharacter:"\\ebb3"}),n.circleLargeFilled=new n("circle-large-filled",{fontCharacter:"\\ebb4"}),n.circleLargeOutline=new n("circle-large-outline",{fontCharacter:"\\ebb5"}),n.combine=new n("combine",{fontCharacter:"\\ebb6"}),n.gather=new n("gather",{fontCharacter:"\\ebb6"}),n.table=new n("table",{fontCharacter:"\\ebb7"}),n.variableGroup=new n("variable-group",{fontCharacter:"\\ebb8"}),n.typeHierarchy=new n("type-hierarchy",{fontCharacter:"\\ebb9"}),n.typeHierarchySub=new n("type-hierarchy-sub",{fontCharacter:"\\ebba"}),n.typeHierarchySuper=new n("type-hierarchy-super",{fontCharacter:"\\ebbb"}),n.gitPullRequestCreate=new n("git-pull-request-create",{fontCharacter:"\\ebbc"}),n.runAbove=new n("run-above",{fontCharacter:"\\ebbd"}),n.runBelow=new n("run-below",{fontCharacter:"\\ebbe"}),n.notebookTemplate=new n("notebook-template",{fontCharacter:"\\ebbf"}),n.debugRerun=new n("debug-rerun",{fontCharacter:"\\ebc0"}),n.workspaceTrusted=new n("workspace-trusted",{fontCharacter:"\\ebc1"}),n.workspaceUntrusted=new n("workspace-untrusted",{fontCharacter:"\\ebc2"}),n.workspaceUnspecified=new n("workspace-unspecified",{fontCharacter:"\\ebc3"}),n.terminalCmd=new n("terminal-cmd",{fontCharacter:"\\ebc4"}),n.terminalDebian=new n("terminal-debian",{fontCharacter:"\\ebc5"}),n.terminalLinux=new n("terminal-linux",{fontCharacter:"\\ebc6"}),n.terminalPowershell=new n("terminal-powershell",{fontCharacter:"\\ebc7"}),n.terminalTmux=new n("terminal-tmux",{fontCharacter:"\\ebc8"}),n.terminalUbuntu=new n("terminal-ubuntu",{fontCharacter:"\\ebc9"}),n.terminalBash=new n("terminal-bash",{fontCharacter:"\\ebca"}),n.arrowSwap=new n("arrow-swap",{fontCharacter:"\\ebcb"}),n.copy=new n("copy",{fontCharacter:"\\ebcc"}),n.personAdd=new n("person-add",{fontCharacter:"\\ebcd"}),n.filterFilled=new n("filter-filled",{fontCharacter:"\\ebce"}),n.wand=new n("wand",{fontCharacter:"\\ebcf"}),n.debugLineByLine=new n("debug-line-by-line",{fontCharacter:"\\ebd0"}),n.inspect=new n("inspect",{fontCharacter:"\\ebd1"}),n.layers=new n("layers",{fontCharacter:"\\ebd2"}),n.layersDot=new n("layers-dot",{fontCharacter:"\\ebd3"}),n.layersActive=new n("layers-active",{fontCharacter:"\\ebd4"}),n.compass=new n("compass",{fontCharacter:"\\ebd5"}),n.compassDot=new n("compass-dot",{fontCharacter:"\\ebd6"}),n.compassActive=new n("compass-active",{fontCharacter:"\\ebd7"}),n.azure=new n("azure",{fontCharacter:"\\ebd8"}),n.issueDraft=new n("issue-draft",{fontCharacter:"\\ebd9"}),n.gitPullRequestClosed=new n("git-pull-request-closed",{fontCharacter:"\\ebda"}),n.gitPullRequestDraft=new n("git-pull-request-draft",{fontCharacter:"\\ebdb"}),n.debugAll=new n("debug-all",{fontCharacter:"\\ebdc"}),n.debugCoverage=new n("debug-coverage",{fontCharacter:"\\ebdd"}),n.runErrors=new n("run-errors",{fontCharacter:"\\ebde"}),n.folderLibrary=new n("folder-library",{fontCharacter:"\\ebdf"}),n.debugContinueSmall=new n("debug-continue-small",{fontCharacter:"\\ebe0"}),n.beakerStop=new n("beaker-stop",{fontCharacter:"\\ebe1"}),n.graphLine=new n("graph-line",{fontCharacter:"\\ebe2"}),n.graphScatter=new n("graph-scatter",{fontCharacter:"\\ebe3"}),n.pieChart=new n("pie-chart",{fontCharacter:"\\ebe4"}),n.bracket=new n("bracket",n.json.definition),n.bracketDot=new n("bracket-dot",{fontCharacter:"\\ebe5"}),n.bracketError=new n("bracket-error",{fontCharacter:"\\ebe6"}),n.lockSmall=new n("lock-small",{fontCharacter:"\\ebe7"}),n.azureDevops=new n("azure-devops",{fontCharacter:"\\ebe8"}),n.verifiedFilled=new n("verified-filled",{fontCharacter:"\\ebe9"})}(G||(G={}))},"VrN/":function(rt,we,$){(function(le,X){rt.exports=X()})(this,function(){"use strict";var le=navigator.userAgent,X=navigator.platform,D=/gecko\/\d/i.test(le),Y=/MSIE \d/.test(le),j=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),P=/Edge\/(\d+)/.exec(le),G=Y||j||P,W=G&&(Y?document.documentMode||6:+(P||j)[1]),n=!P&&/WebKit\//.test(le),L=n&&/Qt\/\d+\.\d+/.test(le),b=!P&&/Chrome\//.test(le),m=/Opera\//.test(le),g=/Apple Computer/.test(navigator.vendor),c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),d=/PhantomJS/.test(le),p=!P&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),l=/Android/.test(le),h=p||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),o=p||/Mac/.test(X),s=/\bCrOS\b/.test(le),A=/win/i.test(X),x=m&&le.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(m=!1,n=!0);var S=o&&(L||m&&(x==null||x<12.11)),O=D||G&&W>=9;function R(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=function(e,t){var r=e.className,i=R(t).exec(r);if(i){var f=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(f?i[1]+f:"")}};function w(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function y(e,t){return w(e).appendChild(t)}function u(e,t,r,i){var f=document.createElement(e);if(r&&(f.className=r),i&&(f.style.cssText=i),typeof t=="string")f.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)f.appendChild(t[k]);return f}function v(e,t,r,i){var f=u(e,t,r,i);return f.setAttribute("role","presentation"),f}var a;document.createRange?a=function(e,t,r,i){var f=document.createRange();return f.setEnd(i||e,r),f.setStart(e,t),f}:a=function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(f){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i};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 N(){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 B(e,t){var r=e.className;R(t).test(r)||(e.className+=(r?" ":"")+t)}function T(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!R(r[i]).test(t)&&(t+=" "+r[i]);return t}var U=function(e){e.select()};p?U=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(U=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function E(e,t,r){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(r!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function H(e,t,r,i,f){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=i||0,K=f||0;;){var Q=e.indexOf(" ",k);if(Q<0||Q>=t)return K+(t-k);K+=Q-k,K+=r-K%r,k=Q+1}}var Z=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};Z.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Z.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 oe(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var de=50,Te={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Ae={origin:"*mouse"},Ce={origin:"+move"};function _e(e,t,r){for(var i=0,f=0;;){var k=e.indexOf(" ",i);k==-1&&(k=e.length);var K=k-i;if(k==e.length||f+K>=t)return i+Math.min(K,t-f);if(f+=k-i,f+=r-f%r,i=k+1,f>=t)return i}}var ge=[""];function V(e){for(;ge.length<=e;)ge.push(I(ge)+" ");return ge[e]}function I(e){return e[e.length-1]}function F(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function J(e,t,r){for(var i=0,f=r(t);i<e.length&&r(e[i])<=f;)i++;e.splice(i,0,t)}function ne(){}function z(e,t){var r;return Object.create?r=Object.create(e):(ne.prototype=e,r=new ne),t&&E(t,r),r}var me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function ke(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function ce(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ye=/[\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 Se(e){return e.charCodeAt(0)>=768&&ye.test(e)}function Le(e,t,r){for(;(r<0?t>0:t<e.length)&&Se(e.charAt(t));)t+=r;return t}function Be(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var f=(t+r)/2,k=i<0?Math.ceil(f):Math.floor(f);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+i}}function We(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var f=!1,k=0;k<e.length;++k){var K=e[k];(K.from<r&&K.to>t||t==r&&K.to==t)&&(i(Math.max(K.from,t),Math.min(K.to,r),K.level==1?"rtl":"ltr",k),f=!0)}f||i(t,r,"ltr")}var Ke=null;function Xe(e,t,r){var i;Ke=null;for(var f=0;f<e.length;++f){var k=e[f];if(k.from<t&&k.to>t)return f;k.to==t&&(k.from!=k.to&&r=="before"?i=f:Ke=f),k.from==t&&(k.from!=k.to&&r!="before"?i=f:Ke=f)}return i!=null?i:Ke}var lt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,k=/[LRr]/,K=/[Lb1n]/,Q=/[1n]/;function ee(re,ve,Ee){this.level=re,this.from=ve,this.to=Ee}return function(re,ve){var Ee=ve=="ltr"?"L":"R";if(re.length==0||ve=="ltr"&&!i.test(re))return!1;for(var De=re.length,Ie=[],je=0;je<De;++je)Ie.push(r(re.charCodeAt(je)));for(var Ge=0,$e=Ee;Ge<De;++Ge){var st=Ie[Ge];st=="m"?Ie[Ge]=$e:$e=st}for(var mt=0,ot=Ee;mt<De;++mt){var _t=Ie[mt];_t=="1"&&ot=="r"?Ie[mt]="n":k.test(_t)&&(ot=_t,_t=="r"&&(Ie[mt]="R"))}for(var Nt=1,It=Ie[0];Nt<De-1;++Nt){var Jt=Ie[Nt];Jt=="+"&&It=="1"&&Ie[Nt+1]=="1"?Ie[Nt]="1":Jt==","&&It==Ie[Nt+1]&&(It=="1"||It=="n")&&(Ie[Nt]=It),It=Jt}for(var gn=0;gn<De;++gn){var Mn=Ie[gn];if(Mn==",")Ie[gn]="N";else if(Mn=="%"){var Sn=void 0;for(Sn=gn+1;Sn<De&&Ie[Sn]=="%";++Sn);for(var ii=gn&&Ie[gn-1]=="!"||Sn<De&&Ie[Sn]=="1"?"1":"N",Qn=gn;Qn<Sn;++Qn)Ie[Qn]=ii;gn=Sn-1}}for(var On=0,Zn=Ee;On<De;++On){var jn=Ie[On];Zn=="L"&&jn=="1"?Ie[On]="L":k.test(jn)&&(Zn=jn)}for(var Dn=0;Dn<De;++Dn)if(f.test(Ie[Dn])){var Ln=void 0;for(Ln=Dn+1;Ln<De&&f.test(Ie[Ln]);++Ln);for(var Cn=(Dn?Ie[Dn-1]:Ee)=="L",qn=(Ln<De?Ie[Ln]:Ee)=="L",mr=Cn==qn?Cn?"L":"R":Ee,Ui=Dn;Ui<Ln;++Ui)Ie[Ui]=mr;Dn=Ln-1}for(var Gn=[],bi,Nn=0;Nn<De;)if(K.test(Ie[Nn])){var Va=Nn;for(++Nn;Nn<De&&K.test(Ie[Nn]);++Nn);Gn.push(new ee(0,Va,Nn))}else{var Si=Nn,Qi=Gn.length,Zi=ve=="rtl"?1:0;for(++Nn;Nn<De&&Ie[Nn]!="L";++Nn);for(var Kn=Si;Kn<Nn;)if(Q.test(Ie[Kn])){Si<Kn&&(Gn.splice(Qi,0,new ee(1,Si,Kn)),Qi+=Zi);var gr=Kn;for(++Kn;Kn<Nn&&Q.test(Ie[Kn]);++Kn);Gn.splice(Qi,0,new ee(2,gr,Kn)),Qi+=Zi,Si=Kn}else++Kn;Si<Nn&&Gn.splice(Qi,0,new ee(1,Si,Nn))}return ve=="ltr"&&(Gn[0].level==1&&(bi=re.match(/^\s+/))&&(Gn[0].from=bi[0].length,Gn.unshift(new ee(0,0,bi[0].length))),I(Gn).level==1&&(bi=re.match(/\s+$/))&&(I(Gn).to-=bi[0].length,Gn.push(new ee(0,De-bi[0].length,De)))),ve=="rtl"?Gn.reverse():Gn}}();function Je(e,t){var r=e.order;return r==null&&(r=e.order=lt(e.text,t)),r}var qe=[],Pe=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||qe).concat(r)}};function pt(e,t){return e._handlers&&e._handlers[t]||qe}function ut(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,f=i&&i[t];if(f){var k=oe(f,r);k>-1&&(i[t]=f.slice(0,k).concat(f.slice(k+1)))}}}function ue(e,t){var r=pt(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),f=0;f<r.length;++f)r[f].apply(null,i)}function q(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ue(e,r||t.type,e,t),fe(t)||t.codemirrorIgnore}function te(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)oe(r,t[i])==-1&&r.push(t[i])}function se(e,t){return pt(e,t).length>0}function he(e){e.prototype.on=function(t,r){Pe(this,t,r)},e.prototype.off=function(t,r){ut(this,t,r)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function fe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function pe(e){ie(e),ae(e)}function xe(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),o&&e.ctrlKey&&t==1&&(t=3),t}var Ne=function(){if(G&&W<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),Ye;function dt(e){if(Ye==null){var t=u("span","\u200B");y(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ye=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&W<8))}var r=Ye?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var gt;function Kt(e){if(gt!=null)return gt;var t=y(e,document.createTextNode("A\u062EA")),r=a(t,0,1).getBoundingClientRect(),i=a(t,1,2).getBoundingClientRect();return w(e),!r||r.left==r.right?!1:gt=i.right-r.right<3}var Ve=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var f=e.indexOf(`
`,t);f==-1&&(f=e.length);var k=e.slice(t,e.charAt(f-1)=="\r"?f-1:f),K=k.indexOf("\r");K!=-1?(r.push(k.slice(0,K)),t+=K+1):(r.push(k),t=f+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Ue=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},Et=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function qt(e){if(vt!=null)return vt;var t=y(e,u("span","x")),r=t.getBoundingClientRect(),i=a(t,0,1).getBoundingClientRect();return vt=Math.abs(r.left-i.left)>1}var Yt={},yt={};function Qe(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function xn(e,t){yt[e]=t}function Me(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=z(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Me("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Me("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function un(e,t){t=Me(t);var r=Yt[t.name];if(!r)return un(e,"text/plain");var i=r(e,t);if(ft.hasOwnProperty(t.name)){var f=ft[t.name];for(var k in f){if(!f.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=f[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var K in t.modeProps)i[K]=t.modeProps[K];return i}var ft={};function wt(e,t){var r=ft.hasOwnProperty(e)?ft[e]:ft[e]={};E(t,r)}function it(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var f=t[i];f instanceof Array&&(f=f.concat([])),r[i]=f}return r}function Ft(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 tn(e,t,r){return e.startState?e.startState(t,r):!0}var Dt=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};Dt.prototype.eol=function(){return this.pos>=this.string.length},Dt.prototype.sol=function(){return this.pos==this.lineStart},Dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Dt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Dt.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},Dt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Dt.prototype.skipToEnd=function(){this.pos=this.string.length},Dt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Dt.prototype.backUp=function(e){this.pos-=e},Dt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.match=function(e,t,r){if(typeof e=="string"){var i=function(K){return r?K.toLowerCase():K},f=this.string.substr(this.pos,e.length);if(i(f)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Dt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Dt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ze(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 i=0;;++i){var f=r.children[i],k=f.chunkSize();if(t<k){r=f;break}t-=k}return r.lines[t]}function kt(e,t,r){var i=[],f=t.line;return e.iter(t.line,r.line+1,function(k){var K=k.text;f==r.line&&(K=K.slice(0,r.ch)),f==t.line&&(K=K.slice(t.ch)),i.push(K),++f}),i}function Ot(e,t,r){var i=[];return e.iter(t,r,function(f){i.push(f.text)}),i}function nt(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function at(e){if(e.parent==null)return null;for(var t=e.parent,r=oe(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var f=0;!(i.children[f]==t);++f)r+=i.children[f].chunkSize();return r+t.first}function et(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var f=e.children[i],k=f.height;if(t<k){e=f;continue e}t-=k,r+=f.chunkSize()}return r}while(!e.lines);for(var K=0;K<e.lines.length;++K){var Q=e.lines[K],ee=Q.height;if(t<ee)break;t-=ee}return r+K}function Vt(e,t){return t>=e.first&&t<e.first+e.size}function Bt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,r){if(r===void 0&&(r=null),!(this instanceof Fe))return new Fe(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ht(e,t){return e.line-t.line||e.ch-t.ch}function hn(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function vn(e){return Fe(e.line,e.ch)}function bn(e,t){return ht(e,t)<0?t:e}function cn(e,t){return ht(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Tt(e,t){if(t.line<e.first)return Fe(e.first,0);var r=e.first+e.size-1;return t.line>r?Fe(r,ze(e,r).text.length):pn(t,ze(e,t.line).text.length)}function pn(e,t){var r=e.ch;return r==null||r>t?Fe(e.line,t):r<0?Fe(e.line,0):e}function He(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=Tt(e,t[i]);return r}var Ht=function(e,t){this.state=e,this.lookAhead=t},Qt=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};Qt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Qt.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}},Qt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Qt.fromSaved=function(e,t,r){return t instanceof Ht?new Qt(e,it(e.mode,t.state),r,t.lookAhead):new Qt(e,it(e.mode,t),r)},Qt.prototype.save=function(e){var t=e!==!1?it(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ht(t,this.maxLookAhead):t};function $t(e,t,r,i){var f=[e.state.modeGen],k={};mn(e,t.text,e.doc.mode,r,function(re,ve){return f.push(re,ve)},k,i);for(var K=r.state,Q=function(re){r.baseTokens=f;var ve=e.state.overlays[re],Ee=1,De=0;r.state=!0,mn(e,t.text,ve.mode,r,function(Ie,je){for(var Ge=Ee;De<Ie;){var $e=f[Ee];$e>Ie&&f.splice(Ee,1,Ie,f[Ee+1],$e),Ee+=2,De=Math.min(Ie,$e)}if(!je)return;if(ve.opaque)f.splice(Ge,Ee-Ge,Ie,"overlay "+je),Ee=Ge+2;else for(;Ge<Ee;Ge+=2){var st=f[Ge+1];f[Ge+1]=(st?st+" ":"")+"overlay "+je}},k),r.state=K,r.baseTokens=null,r.baseTokenPos=1},ee=0;ee<e.state.overlays.length;++ee)Q(ee);return{styles:f,classes:k.bgClass||k.textClass?k:null}}function Ut(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Lt(e,at(t)),f=t.text.length>e.options.maxHighlightLength&&it(e.doc.mode,i.state),k=$t(e,t,i);f&&(i.state=f),t.stateAfter=i.save(!f),t.styles=k.styles,k.classes?t.styleClasses=k.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 Lt(e,t,r){var i=e.doc,f=e.display;if(!i.mode.startState)return new Qt(i,!0,t);var k=jt(e,t,r),K=k>i.first&&ze(i,k-1).stateAfter,Q=K?Qt.fromSaved(i,K,k):new Qt(i,tn(i.mode),k);return i.iter(k,t,function(ee){_n(e,ee.text,Q);var re=Q.line;ee.stateAfter=re==t-1||re%5==0||re>=f.viewFrom&&re<f.viewTo?Q.save():null,Q.nextLine()}),r&&(i.modeFrontier=Q.line),Q}function _n(e,t,r,i){var f=e.doc.mode,k=new Dt(t,e.options.tabSize,r);for(k.start=k.pos=i||0,t==""&&At(f,r.state);!k.eol();)Rt(f,k,r.state),k.start=k.pos}function At(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=Ft(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function Rt(e,t,r,i){for(var f=0;f<10;f++){i&&(i[0]=Ft(e,r).mode);var k=e.token(t,r);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var tt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Wt(e,t,r,i){var f=e.doc,k=f.mode,K;t=Tt(f,t);var Q=ze(f,t.line),ee=Lt(e,t.line,r),re=new Dt(Q.text,e.options.tabSize,ee),ve;for(i&&(ve=[]);(i||re.pos<t.ch)&&!re.eol();)re.start=re.pos,K=Rt(k,re,ee.state),i&&ve.push(new tt(re,K,it(f.mode,ee.state)));return i?ve:new tt(re,K,ee.state)}function St(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 i=r[1]?"bgClass":"textClass";t[i]==null?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function mn(e,t,r,i,f,k,K){var Q=r.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var ee=0,re=null,ve=new Dt(t,e.options.tabSize,i),Ee,De=e.options.addModeClass&&[null];for(t==""&&St(At(r,i.state),k);!ve.eol();){if(ve.pos>e.options.maxHighlightLength?(Q=!1,K&&_n(e,t,i,ve.pos),ve.pos=t.length,Ee=null):Ee=St(Rt(r,ve,i.state,De),k),De){var Ie=De[0].name;Ie&&(Ee="m-"+(Ee?Ie+" "+Ee:Ie))}if(!Q||re!=Ee){for(;ee<ve.start;)ee=Math.min(ve.start,ee+5e3),f(ee,re);re=Ee}ve.start=ve.pos}for(;ee<ve.pos;){var je=Math.min(ve.pos,ee+5e3);f(je,re),ee=je}}function jt(e,t,r){for(var i,f,k=e.doc,K=r?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>K;--Q){if(Q<=k.first)return k.first;var ee=ze(k,Q-1),re=ee.stateAfter;if(re&&(!r||Q+(re instanceof Ht?re.lookAhead:0)<=k.modeFrontier))return Q;var ve=H(ee.text,null,e.options.tabSize);(f==null||i>ve)&&(f=Q-1,i=ve)}return f}function Xt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,i=t-1;i>r;i--){var f=ze(e,i).stateAfter;if(f&&(!(f instanceof Ht)||i+f.lookAhead<t)){r=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var fn=!1,wn=!1;function Tn(){fn=!0}function nn(){wn=!0}function bt(e,t,r){this.marker=e,this.from=t,this.to=r}function ct(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function Mt(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function Zt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function an(e,t,r){var i;if(e)for(var f=0;f<e.length;++f){var k=e[f],K=k.marker,Q=k.from==null||(K.inclusiveLeft?k.from<=t:k.from<t);if(Q||k.from==t&&K.type=="bookmark"&&(!r||!k.marker.insertLeft)){var ee=k.to==null||(K.inclusiveRight?k.to>=t:k.to>t);(i||(i=[])).push(new bt(K,k.from,ee?null:k.to))}}return i}function Pt(e,t,r){var i;if(e)for(var f=0;f<e.length;++f){var k=e[f],K=k.marker,Q=k.to==null||(K.inclusiveRight?k.to>=t:k.to>t);if(Q||k.from==t&&K.type=="bookmark"&&(!r||k.marker.insertLeft)){var ee=k.from==null||(K.inclusiveLeft?k.from<=t:k.from<t);(i||(i=[])).push(new bt(K,ee?null:k.from-t,k.to==null?null:k.to-t))}}return i}function Vn(e,t){if(t.full)return null;var r=Vt(e,t.from.line)&&ze(e,t.from.line).markedSpans,i=Vt(e,t.to.line)&&ze(e,t.to.line).markedSpans;if(!r&&!i)return null;var f=t.from.ch,k=t.to.ch,K=ht(t.from,t.to)==0,Q=an(r,f,K),ee=Pt(i,k,K),re=t.text.length==1,ve=I(t.text).length+(re?f:0);if(Q)for(var Ee=0;Ee<Q.length;++Ee){var De=Q[Ee];if(De.to==null){var Ie=ct(ee,De.marker);Ie?re&&(De.to=Ie.to==null?null:Ie.to+ve):De.to=f}}if(ee)for(var je=0;je<ee.length;++je){var Ge=ee[je];if(Ge.to!=null&&(Ge.to+=ve),Ge.from==null){var $e=ct(Q,Ge.marker);$e||(Ge.from=ve,re&&(Q||(Q=[])).push(Ge))}else Ge.from+=ve,re&&(Q||(Q=[])).push(Ge)}Q&&(Q=ei(Q)),ee&&ee!=Q&&(ee=ei(ee));var st=[Q];if(!re){var mt=t.text.length-2,ot;if(mt>0&&Q)for(var _t=0;_t<Q.length;++_t)Q[_t].to==null&&(ot||(ot=[])).push(new bt(Q[_t].marker,null,null));for(var Nt=0;Nt<mt;++Nt)st.push(ot);st.push(ee)}return st}function ei(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 hi(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(Ie){if(Ie.markedSpans)for(var je=0;je<Ie.markedSpans.length;++je){var Ge=Ie.markedSpans[je].marker;Ge.readOnly&&(!i||oe(i,Ge)==-1)&&(i||(i=[])).push(Ge)}}),!i)return null;for(var f=[{from:t,to:r}],k=0;k<i.length;++k)for(var K=i[k],Q=K.find(0),ee=0;ee<f.length;++ee){var re=f[ee];if(ht(re.to,Q.from)<0||ht(re.from,Q.to)>0)continue;var ve=[ee,1],Ee=ht(re.from,Q.from),De=ht(re.to,Q.to);(Ee<0||!K.inclusiveLeft&&!Ee)&&ve.push({from:re.from,to:Q.from}),(De>0||!K.inclusiveRight&&!De)&&ve.push({from:Q.to,to:re.to}),f.splice.apply(f,ve),ee+=ve.length-3}return f}function _i(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 Bi(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function ri(e){return e.inclusiveLeft?-1:0}function Ci(e){return e.inclusiveRight?1:0}function ai(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var i=e.find(),f=t.find(),k=ht(i.from,f.from)||ri(e)-ri(t);if(k)return-k;var K=ht(i.to,f.to)||Ci(e)-Ci(t);return K||t.id-e.id}function ci(e,t){var r=wn&&e.markedSpans,i;if(r)for(var f=void 0,k=0;k<r.length;++k)f=r[k],f.marker.collapsed&&(t?f.from:f.to)==null&&(!i||ai(i,f.marker)<0)&&(i=f.marker);return i}function di(e){return ci(e,!0)}function ti(e){return ci(e,!1)}function Ai(e,t){var r=wn&&e.markedSpans,i;if(r)for(var f=0;f<r.length;++f){var k=r[f];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!i||ai(i,k.marker)<0)&&(i=k.marker)}return i}function ji(e,t,r,i,f){var k=ze(e,t),K=wn&&k.markedSpans;if(K)for(var Q=0;Q<K.length;++Q){var ee=K[Q];if(!ee.marker.collapsed)continue;var re=ee.marker.find(0),ve=ht(re.from,r)||ri(ee.marker)-ri(f),Ee=ht(re.to,i)||Ci(ee.marker)-Ci(f);if(ve>=0&&Ee<=0||ve<=0&&Ee>=0)continue;if(ve<=0&&(ee.marker.inclusiveRight&&f.inclusiveLeft?ht(re.to,r)>=0:ht(re.to,r)>0)||ve>=0&&(ee.marker.inclusiveRight&&f.inclusiveLeft?ht(re.from,i)<=0:ht(re.from,i)<0))return!0}}function An(e){for(var t;t=di(e);)e=t.find(-1,!0).line;return e}function Ri(e){for(var t;t=ti(e);)e=t.find(1,!0).line;return e}function Oi(e){for(var t,r;t=ti(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Li(e,t){var r=ze(e,t),i=An(r);return r==i?t:at(i)}function fi(e,t){if(t>e.lastLine())return t;var r=ze(e,t),i;if(!si(e,r))return t;for(;i=ti(r);)r=i.find(1,!0).line;return at(r)+1}function si(e,t){var r=wn&&t.markedSpans;if(r)for(var i=void 0,f=0;f<r.length;++f){if(i=r[f],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&Hi(e,t,i))return!0}}function Hi(e,t,r){if(r.to==null){var i=r.marker.find(1,!0);return Hi(e,i.line,ct(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var f=void 0,k=0;k<t.markedSpans.length;++k)if(f=t.markedSpans[k],f.marker.collapsed&&!f.marker.widgetNode&&f.from==r.to&&(f.to==null||f.to!=r.from)&&(f.marker.inclusiveLeft||r.marker.inclusiveRight)&&Hi(e,t,f))return!0}function Fn(e){e=An(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var f=r.lines[i];if(f==e)break;t+=f.height}for(var k=r.parent;k;r=k,k=r.parent)for(var K=0;K<k.children.length;++K){var Q=k.children[K];if(Q==r)break;t+=Q.height}return t}function Wi(e){if(e.height==0)return 0;for(var t=e.text.length,r,i=e;r=di(i);){var f=r.find(0,!0);i=f.from.line,t+=f.from.ch-f.to.ch}for(i=e;r=ti(i);){var k=r.find(0,!0);t-=i.text.length-k.from.ch,i=k.to.line,t+=i.text.length-k.to.ch}return t}function qi(e){var t=e.display,r=e.doc;t.maxLine=ze(r,r.first),t.maxLineLength=Wi(t.maxLine),t.maxLineChanged=!0,r.iter(function(i){var f=Wi(i);f>t.maxLineLength&&(t.maxLineLength=f,t.maxLine=i)})}var Ei=function(e,t,r){this.text=e,Bi(this,t),this.height=r?r(this):1};Ei.prototype.lineNo=function(){return at(this)},he(Ei);function Un(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),_i(e),Bi(e,r);var f=i?i(e):1;f!=e.height&&nt(e,f)}function Ze(e){e.parent=null,_i(e)}var Ct={},xt={};function Gt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?xt:Ct;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function zt(e,t){var r=v("span",null,null,n?"padding-right: .1px":null),i={pre:v("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var f=0;f<=(t.rest?t.rest.length:0);f++){var k=f?t.rest[f-1]:t.line,K=void 0;i.pos=0,i.addToken=rn,Kt(e.display.measure)&&(K=Je(k,e.doc.direction))&&(i.addToken=Xn(i.addToken,K)),i.map=[];var Q=t!=e.display.externalMeasured&&at(k);xi(k,i,Ut(e,k,Q)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=T(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=T(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(dt(e.display.measure))),f==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(n){var ee=i.content.lastChild;(/\bcm-tab\b/.test(ee.className)||ee.querySelector&&ee.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return ue(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=T(i.pre.className,i.textClass||"")),i}function sn(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function rn(e,t,r,i,f,k,K){if(!t)return;var Q=e.splitSpaces?In(t,e.trailingSpace):t,ee=e.cm.state.specialChars,re=!1,ve;if(!ee.test(t))e.col+=t.length,ve=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,ve),G&&W<9&&(re=!0),e.pos+=t.length;else{ve=document.createDocumentFragment();for(var Ee=0;;){ee.lastIndex=Ee;var De=ee.exec(t),Ie=De?De.index-Ee:t.length-Ee;if(Ie){var je=document.createTextNode(Q.slice(Ee,Ee+Ie));G&&W<9?ve.appendChild(u("span",[je])):ve.appendChild(je),e.map.push(e.pos,e.pos+Ie,je),e.col+=Ie,e.pos+=Ie}if(!De)break;Ee+=Ie+1;var Ge=void 0;if(De[0]==" "){var $e=e.cm.options.tabSize,st=$e-e.col%$e;Ge=ve.appendChild(u("span",V(st),"cm-tab")),Ge.setAttribute("role","presentation"),Ge.setAttribute("cm-text"," "),e.col+=st}else De[0]=="\r"||De[0]==`
`?(Ge=ve.appendChild(u("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ge.setAttribute("cm-text",De[0]),e.col+=1):(Ge=e.cm.options.specialCharPlaceholder(De[0]),Ge.setAttribute("cm-text",De[0]),G&&W<9?ve.appendChild(u("span",[Ge])):ve.appendChild(Ge),e.col+=1);e.map.push(e.pos,e.pos+1,Ge),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,r||i||f||re||k||K){var mt=r||"";i&&(mt+=i),f&&(mt+=f);var ot=u("span",[ve],mt,k);if(K)for(var _t in K)K.hasOwnProperty(_t)&&_t!="style"&&_t!="class"&&ot.setAttribute(_t,K[_t]);return e.content.appendChild(ot)}e.content.appendChild(ve)}function In(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",f=0;f<e.length;f++){var k=e.charAt(f);k==" "&&r&&(f==e.length-1||e.charCodeAt(f+1)==32)&&(k="\xA0"),i+=k,r=k==" "}return i}function Xn(e,t){return function(r,i,f,k,K,Q,ee){f=f?f+" cm-force-border":"cm-force-border";for(var re=r.pos,ve=re+i.length;;){for(var Ee=void 0,De=0;De<t.length&&!(Ee=t[De],Ee.to>re&&Ee.from<=re);De++);if(Ee.to>=ve)return e(r,i,f,k,K,Q,ee);e(r,i.slice(0,Ee.to-re),f,k,null,Q,ee),k=null,i=i.slice(Ee.to-re),re=Ee.to}}}function en(e,t,r,i){var f=!i&&r.widgetNode;f&&e.map.push(e.pos,e.pos+t,f),!i&&e.cm.display.input.needsContentAttribute&&(f||(f=e.content.appendChild(document.createElement("span"))),f.setAttribute("cm-marker",r.id)),f&&(e.cm.display.input.setUneditable(f),e.content.appendChild(f)),e.pos+=t,e.trailingSpace=!1}function xi(e,t,r){var i=e.markedSpans,f=e.text,k=0;if(!i){for(var K=1;K<r.length;K+=2)t.addToken(t,f.slice(k,k=r[K]),Gt(r[K+1],t.cm.options));return}for(var Q=f.length,ee=0,re=1,ve="",Ee,De,Ie=0,je,Ge,$e,st,mt;;){if(Ie==ee){je=Ge=$e=De="",mt=null,st=null,Ie=Infinity;for(var ot=[],_t=void 0,Nt=0;Nt<i.length;++Nt){var It=i[Nt],Jt=It.marker;if(Jt.type=="bookmark"&&It.from==ee&&Jt.widgetNode)ot.push(Jt);else if(It.from<=ee&&(It.to==null||It.to>ee||Jt.collapsed&&It.to==ee&&It.from==ee)){if(It.to!=null&&It.to!=ee&&Ie>It.to&&(Ie=It.to,Ge=""),Jt.className&&(je+=" "+Jt.className),Jt.css&&(De=(De?De+";":"")+Jt.css),Jt.startStyle&&It.from==ee&&($e+=" "+Jt.startStyle),Jt.endStyle&&It.to==Ie&&(_t||(_t=[])).push(Jt.endStyle,It.to),Jt.title&&((mt||(mt={})).title=Jt.title),Jt.attributes)for(var gn in Jt.attributes)(mt||(mt={}))[gn]=Jt.attributes[gn];Jt.collapsed&&(!st||ai(st.marker,Jt)<0)&&(st=It)}else It.from>ee&&Ie>It.from&&(Ie=It.from)}if(_t)for(var Mn=0;Mn<_t.length;Mn+=2)_t[Mn+1]==Ie&&(Ge+=" "+_t[Mn]);if(!st||st.from==ee)for(var Sn=0;Sn<ot.length;++Sn)en(t,0,ot[Sn]);if(st&&(st.from||0)==ee){if(en(t,(st.to==null?Q+1:st.to)-ee,st.marker,st.from==null),st.to==null)return;st.to==ee&&(st=!1)}}if(ee>=Q)break;for(var ii=Math.min(Q,Ie);;){if(ve){var Qn=ee+ve.length;if(!st){var On=Qn>ii?ve.slice(0,ii-ee):ve;t.addToken(t,On,Ee?Ee+je:je,$e,ee+On.length==Ie?Ge:"",De,mt)}if(Qn>=ii){ve=ve.slice(ii-ee),ee=ii;break}ee=Qn,$e=""}ve=f.slice(k,k=r[re++]),Ee=Gt(r[re++],t.cm.options)}}}function on(e,t,r){this.line=t,this.rest=Oi(t),this.size=this.rest?at(I(this.rest))-r+1:1,this.node=this.text=null,this.hidden=si(e,t)}function Yn(e,t,r){for(var i=[],f,k=t;k<r;k=f){var K=new on(e.doc,ze(e.doc,k),k);f=k+K.size,i.push(K)}return i}var Hn=null;function ui(e){Hn?Hn.ops.push(e):e.ownsGroup=Hn={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var i=0;i<e.ops.length;i++){var f=e.ops[i];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,f.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Lo(r)}finally{Hn=null,t(r)}}var vr=null;function Bn(e,t){var r=pt(e,t);if(!r.length)return;var i=Array.prototype.slice.call(arguments,2),f;Hn?f=Hn.delayedCallbacks:vr?f=vr:(f=vr=[],setTimeout(Do,0));for(var k=function(Q){f.push(function(){return r[Q].apply(null,i)})},K=0;K<r.length;++K)k(K)}function Do(){var e=vr;vr=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,i){for(var f=0;f<t.changes.length;f++){var k=t.changes[f];k=="text"?Po(e,t):k=="gutter"?Ja(e,t,r,i):k=="class"?ha(e,t):k=="widget"&&Mo(e,t,i)}t.changes=null}function yr(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&W<8&&(e.node.style.zIndex=2)),e.node}function ko(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 i=yr(t);t.background=i.insertBefore(u("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):zt(e,t)}function Po(e,t){var r=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):r&&(t.text.className=r)}function ha(e,t){ko(e,t),t.line.wrapClass?yr(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 Ja(e,t,r,i){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 f=yr(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),f.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var K=yr(t),Q=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),K.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(u("div",Bt(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var re=e.display.gutterSpecs[ee].className,ve=k.hasOwnProperty(re)&&k[re];ve&&Q.appendChild(u("div",[ve],"CodeMirror-gutter-elt","left: "+i.gutterLeft[re]+"px; width: "+i.gutterWidth[re]+"px"))}}}function Mo(e,t,r){t.alignable&&(t.alignable=null);for(var i=R("CodeMirror-linewidget"),f=t.node.firstChild,k=void 0;f;f=k)k=f.nextSibling,i.test(f.className)&&t.node.removeChild(f);Qa(e,t,r)}function No(e,t,r,i){var f=$a(e,t);return t.text=t.node=f.pre,f.bgClass&&(t.bgClass=f.bgClass),f.textClass&&(t.textClass=f.textClass),ha(e,t),Ja(e,t,r,i),Qa(e,t,i),t.node}function Qa(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,r,!1)}function Za(e,t,r,i,f){if(!t.widgets)return;for(var k=yr(r),K=0,Q=t.widgets;K<Q.length;++K){var ee=Q[K],re=u("div",[ee.node],"CodeMirror-linewidget"+(ee.className?" "+ee.className:""));ee.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Fo(ee,re,r,i),e.display.input.setUneditable(re),f&&ee.above?k.insertBefore(re,r.gutter||r.text):k.appendChild(re),Bn(ee,"redraw")}}function Fo(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var f=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(f-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=f+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function br(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;"),y(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function wi(e,t){for(var r=xe(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 Wr(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=y(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function vi(e){return de-e.display.nativeBarWidth}function Gi(e){return e.display.scroller.clientWidth-vi(e)-e.display.barWidth}function da(e){return e.display.scroller.clientHeight-vi(e)-e.display.barHeight}function Uo(e,t,r){var i=e.options.lineWrapping,f=i&&Gi(e);if(!t.measure.heights||i&&t.measure.width!=f){var k=t.measure.heights=[];if(i){t.measure.width=f;for(var K=t.text.firstChild.getClientRects(),Q=0;Q<K.length-1;Q++){var ee=K[Q],re=K[Q+1];Math.abs(ee.bottom-re.bottom)>2&&k.push((ee.bottom+re.top)/2-r.top)}}k.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var f=0;f<e.rest.length;f++)if(at(e.rest[f])>r)return{map:e.measure.maps[f],cache:e.measure.caches[f],before:!0}}function Bo(e,t){t=An(t);var r=at(t),i=e.display.externalMeasured=new on(e.doc,t,r);i.lineN=r;var f=i.built=zt(e,i);return i.text=f.pre,y(e.display.lineMeasure,f.pre),i}function ts(e,t,r,i){return yi(e,er(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Vi(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function er(e,t){var r=at(t),i=fa(e,r);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,r,ba(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var f=es(i,t,r);return{line:t,view:i,rect:null,map:f.map,cache:f.cache,before:f.before,hasHeights:!1}}function yi(e,t,r,i,f){t.before&&(r=-1);var k=r+(i||""),K;return t.cache.hasOwnProperty(k)?K=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),K=Ho(e,t,r,i),K.bogus||(t.cache[k]=K)),{left:K.left,right:K.right,top:f?K.rtop:K.top,bottom:f?K.rbottom:K.bottom}}var ns={left:0,right:0,top:0,bottom:0};function is(e,t,r){for(var i,f,k,K,Q,ee,re=0;re<e.length;re+=3)if(Q=e[re],ee=e[re+1],t<Q?(f=0,k=1,K="left"):t<ee?(f=t-Q,k=f+1):(re==e.length-3||t==ee&&e[re+3]>t)&&(k=ee-Q,f=k-1,t>=ee&&(K="right")),f!=null){if(i=e[re+2],Q==ee&&r==(i.insertLeft?"left":"right")&&(K=r),r=="left"&&f==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)i=e[(re-=3)+2],K="left";if(r=="right"&&f==ee-Q)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)i=e[(re+=3)+2],K="right";break}return{node:i,start:f,end:k,collapse:K,coverStart:Q,coverEnd:ee}}function jo(e,t){var r=ns;if(t=="left")for(var i=0;i<e.length&&!((r=e[i]).left!=r.right);i++);else for(var f=e.length-1;f>=0&&!((r=e[f]).left!=r.right);f--);return r}function Ho(e,t,r,i){var f=is(t.map,r,i),k=f.node,K=f.start,Q=f.end,ee=f.collapse,re;if(k.nodeType==3){for(var ve=0;ve<4;ve++){for(;K&&Se(t.line.text.charAt(f.coverStart+K));)--K;for(;f.coverStart+Q<f.coverEnd&&Se(t.line.text.charAt(f.coverStart+Q));)++Q;if(G&&W<9&&K==0&&Q==f.coverEnd-f.coverStart?re=k.parentNode.getBoundingClientRect():re=jo(a(k,K,Q).getClientRects(),i),re.left||re.right||K==0)break;Q=K,K=K-1,ee="right"}G&&W<11&&(re=Wo(e.display.measure,re))}else{K>0&&(ee=i="right");var Ee;e.options.lineWrapping&&(Ee=k.getClientRects()).length>1?re=Ee[i=="right"?Ee.length-1:0]:re=k.getBoundingClientRect()}if(G&&W<9&&!K&&(!re||!re.left&&!re.right)){var De=k.parentNode.getClientRects()[0];De?re={left:De.left,right:De.left+nr(e.display),top:De.top,bottom:De.bottom}:re=ns}for(var Ie=re.top-t.rect.top,je=re.bottom-t.rect.top,Ge=(Ie+je)/2,$e=t.view.measure.heights,st=0;st<$e.length-1&&!(Ge<$e[st]);st++);var mt=st?$e[st-1]:0,ot=$e[st],_t={left:(ee=="right"?re.right:re.left)-t.rect.left,right:(ee=="left"?re.left:re.right)-t.rect.left,top:mt,bottom:ot};return!re.left&&!re.right&&(_t.bogus=!0),e.options.singleCursorHeightPerLine||(_t.rtop=Ie,_t.rbottom=je),_t}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!qt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function rs(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 as(e){e.display.externalMeasure=null,w(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function _r(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return b&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return b&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=br(e.widgets[r]));return t}function Gr(e,t,r,i,f){if(!f){var k=pa(t);r.top+=k,r.bottom+=k}if(i=="line")return r;i||(i="local");var K=Fn(t);if(i=="local"?K+=Wr(e.display):K-=e.display.viewOffset,i=="page"||i=="window"){var Q=e.display.lineSpace.getBoundingClientRect();K+=Q.top+(i=="window"?0:os());var ee=Q.left+(i=="window"?0:ss());r.left+=ee,r.right+=ee}return r.top+=K,r.bottom+=K,r}function ls(e,t,r){if(r=="div")return t;var i=t.left,f=t.top;if(r=="page")i-=ss(),f-=os();else if(r=="local"||!r){var k=e.display.sizer.getBoundingClientRect();i+=k.left,f+=k.top}var K=e.display.lineSpace.getBoundingClientRect();return{left:i-K.left,top:f-K.top}}function ma(e,t,r,i,f){return i||(i=ze(e.doc,t.line)),Gr(e,i,ts(e,i,t.ch,f),r)}function pi(e,t,r,i,f,k){i=i||ze(e.doc,t.line),f||(f=er(e,i));function K(je,Ge){var $e=yi(e,f,je,Ge?"right":"left",k);return Ge?$e.left=$e.right:$e.right=$e.left,Gr(e,i,$e,r)}var Q=Je(i,e.doc.direction),ee=t.ch,re=t.sticky;if(ee>=i.text.length?(ee=i.text.length,re="before"):ee<=0&&(ee=0,re="after"),!Q)return K(re=="before"?ee-1:ee,re=="before");function ve(je,Ge,$e){var st=Q[Ge],mt=st.level==1;return K($e?je-1:je,mt!=$e)}var Ee=Xe(Q,ee,re),De=Ke,Ie=ve(ee,Ee,re=="before");return De!=null&&(Ie.other=ve(ee,De,re!="before")),Ie}function us(e,t){var r=0;t=Tt(e.doc,t),e.options.lineWrapping||(r=nr(e.display)*t.ch);var i=ze(e.doc,t.line),f=Fn(i)+Wr(e.display);return{left:r,right:r,top:f,bottom:f+i.height}}function ga(e,t,r,i,f){var k=Fe(e,t,r);return k.xRel=f,i&&(k.outside=i),k}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var f=et(i,r),k=i.first+i.size-1;if(f>k)return ga(i.first+i.size-1,ze(i,k).text.length,null,1,1);t<0&&(t=0);for(var K=ze(i,f);;){var Q=Go(e,K,f,t,r),ee=Ai(K,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!ee)return Q;var re=ee.find(1);if(re.line==f)return re;K=ze(i,f=re.line)}}function hs(e,t,r,i){i-=pa(t);var f=t.text.length,k=Be(function(K){return yi(e,r,K-1).bottom<=i},f,0);return f=Be(function(K){return yi(e,r,K).top>i},k,f),{begin:k,end:f}}function cs(e,t,r,i){r||(r=er(e,t));var f=Gr(e,t,yi(e,r,i),"line").top;return hs(e,t,r,f)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,f){f-=Fn(t);var k=er(e,t),K=pa(t),Q=0,ee=t.text.length,re=!0,ve=Je(t,e.doc.direction);if(ve){var Ee=(e.options.lineWrapping?Ko:zo)(e,t,r,k,ve,i,f);re=Ee.level!=1,Q=re?Ee.from:Ee.to-1,ee=re?Ee.to:Ee.from-1}var De=null,Ie=null,je=Be(function(Nt){var It=yi(e,k,Nt);return It.top+=K,It.bottom+=K,ya(It,i,f,!1)?(It.top<=f&&It.left<=i&&(De=Nt,Ie=It),!0):!1},Q,ee),Ge,$e,st=!1;if(Ie){var mt=i-Ie.left<Ie.right-i,ot=mt==re;je=De+(ot?0:1),$e=ot?"after":"before",Ge=mt?Ie.left:Ie.right}else{!re&&(je==ee||je==Q)&&je++,$e=je==0?"after":je==t.text.length?"before":yi(e,k,je-(re?1:0)).bottom+K<=f==re?"after":"before";var _t=pi(e,Fe(r,je,$e),"line",t,k);Ge=_t.left,st=f<_t.top?-1:f>=_t.bottom?1:0}return je=Le(t.text,je,1),ga(r,je,$e,st,i-Ge)}function zo(e,t,r,i,f,k,K){var Q=Be(function(Ee){var De=f[Ee],Ie=De.level!=1;return ya(pi(e,Fe(r,Ie?De.to:De.from,Ie?"before":"after"),"line",t,i),k,K,!0)},0,f.length-1),ee=f[Q];if(Q>0){var re=ee.level!=1,ve=pi(e,Fe(r,re?ee.from:ee.to,re?"after":"before"),"line",t,i);ya(ve,k,K,!0)&&ve.top>K&&(ee=f[Q-1])}return ee}function Ko(e,t,r,i,f,k,K){var Q=hs(e,t,i,K),ee=Q.begin,re=Q.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var ve=null,Ee=null,De=0;De<f.length;De++){var Ie=f[De];if(Ie.from>=re||Ie.to<=ee)continue;var je=Ie.level!=1,Ge=yi(e,i,je?Math.min(re,Ie.to)-1:Math.max(ee,Ie.from)).right,$e=Ge<k?k-Ge+1e9:Ge-k;(!ve||Ee>$e)&&(ve=Ie,Ee=$e)}return ve||(ve=f[f.length-1]),ve.from<ee&&(ve={from:ee,to:ve.to,level:ve.level}),ve.to>re&&(ve={from:ve.from,to:re,level:ve.level}),ve}var zi;function tr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zi==null){zi=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zi.appendChild(document.createTextNode("x")),zi.appendChild(u("br"));zi.appendChild(document.createTextNode("x"))}y(e.measure,zi);var r=zi.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),w(e.measure),r||1}function nr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");y(e.measure,r);var i=t.getBoundingClientRect(),f=(i.right-i.left)/10;return f>2&&(e.cachedCharWidth=f),f||10}function ba(e){for(var t=e.display,r={},i={},f=t.gutters.clientLeft,k=t.gutters.firstChild,K=0;k;k=k.nextSibling,++K){var Q=e.display.gutterSpecs[K].className;r[Q]=k.offsetLeft+k.clientLeft+f,i[Q]=k.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ds(e){var t=tr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/nr(e.display)-3);return function(f){if(si(e.doc,f))return 0;var k=0;if(f.widgets)for(var K=0;K<f.widgets.length;K++)f.widgets[K].height&&(k+=f.widgets[K].height);return r?k+(Math.ceil(f.text.length/i)||1)*t:k+t}}function Ea(e){var t=e.doc,r=ds(e);t.iter(function(i){var f=r(i);f!=i.height&&nt(i,f)})}function Ki(e,t,r,i){var f=e.display;if(!r&&xe(t).getAttribute("cm-not-content")=="true")return null;var k,K,Q=f.lineSpace.getBoundingClientRect();try{k=t.clientX-Q.left,K=t.clientY-Q.top}catch(Ee){return null}var ee=va(e,k,K),re;if(i&&ee.xRel>0&&(re=ze(e.doc,ee.line).text).length==ee.ch){var ve=H(re,re.length,e.options.tabSize)-re.length;ee=Fe(ee.line,Math.max(0,Math.round((k-qa(e.display).left)/nr(e.display))-ve))}return ee}function Vi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function $n(e,t,r,i){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),i||(i=0);var f=e.display;if(i&&r<f.viewTo&&(f.updateLineNumbers==null||f.updateLineNumbers>t)&&(f.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=f.viewTo)wn&&Li(e.doc,t)<f.viewTo&&Di(e);else if(r<=f.viewFrom)wn&&fi(e.doc,r+i)>f.viewFrom?Di(e):(f.viewFrom+=i,f.viewTo+=i);else if(t<=f.viewFrom&&r>=f.viewTo)Di(e);else if(t<=f.viewFrom){var k=zr(e,r,r+i,1);k?(f.view=f.view.slice(k.index),f.viewFrom=k.lineN,f.viewTo+=i):Di(e)}else if(r>=f.viewTo){var K=zr(e,t,t,-1);K?(f.view=f.view.slice(0,K.index),f.viewTo=K.lineN):Di(e)}else{var Q=zr(e,t,t,-1),ee=zr(e,r,r+i,1);Q&&ee?(f.view=f.view.slice(0,Q.index).concat(Yn(e,Q.lineN,ee.lineN)).concat(f.view.slice(ee.index)),f.viewTo+=i):Di(e)}var re=f.externalMeasured;re&&(r<re.lineN?re.lineN+=i:t<re.lineN+re.size&&(f.externalMeasured=null))}function Ii(e,t,r){e.curOp.viewChanged=!0;var i=e.display,f=e.display.externalMeasured;if(f&&t>=f.lineN&&t<f.lineN+f.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var k=i.view[Vi(e,t)];if(k.node==null)return;var K=k.changes||(k.changes=[]);oe(K,r)==-1&&K.push(r)}function Di(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zr(e,t,r,i){var f=Vi(e,t),k,K=e.display.view;if(!wn||r==e.doc.first+e.doc.size)return{index:f,lineN:r};for(var Q=e.display.viewFrom,ee=0;ee<f;ee++)Q+=K[ee].size;if(Q!=t){if(i>0){if(f==K.length-1)return null;k=Q+K[f].size-t,f++}else k=Q-t;t+=k,r+=k}for(;Li(e.doc,r)!=r;){if(f==(i<0?0:K.length-1))return null;r+=i*K[f-(i<0?1:0)].size,f+=i}return{index:f,lineN:r}}function Vo(e,t,r){var i=e.display,f=i.view;f.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Yn(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Yn(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Vi(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(Yn(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,Vi(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var f=t[i];!f.hidden&&(!f.node||f.changes)&&++r}return r}function Er(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,i={},f=i.cursors=document.createDocumentFragment(),k=i.selection=document.createDocumentFragment(),K=0;K<r.sel.ranges.length;K++){if(!t&&K==r.sel.primIndex)continue;var Q=r.sel.ranges[K];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var ee=Q.empty();(ee||e.options.showCursorWhenSelecting)&&ms(e,Q.head,f),ee||Xo(e,Q,k)}return i}function ms(e,t,r){var i=pi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),f=r.appendChild(u("div","\xA0","CodeMirror-cursor"));if(f.style.left=i.left+"px",f.style.top=i.top+"px",f.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var k=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=i.other.left+"px",k.style.top=i.other.top+"px",k.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function Kr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var i=e.display,f=e.doc,k=document.createDocumentFragment(),K=qa(e.display),Q=K.left,ee=Math.max(i.sizerWidth,Gi(e)-i.sizer.offsetLeft)-K.right,re=f.direction=="ltr";function ve(ot,_t,Nt,It){_t<0&&(_t=0),_t=Math.round(_t),It=Math.round(It),k.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+ot+`px;
top: `+_t+"px; width: "+(Nt==null?ee-ot:Nt)+`px;
height: `+(It-_t)+"px"))}function Ee(ot,_t,Nt){var It=ze(f,ot),Jt=It.text.length,gn,Mn;function Sn(On,Zn){return ma(e,Fe(ot,On),"div",It,Zn)}function ii(On,Zn,jn){var Dn=cs(e,It,null,On),Ln=Zn=="ltr"==(jn=="after")?"left":"right",Cn=jn=="after"?Dn.begin:Dn.end-(/\s/.test(It.text.charAt(Dn.end-1))?2:1);return Sn(Cn,Ln)[Ln]}var Qn=Je(It,f.direction);return We(Qn,_t||0,Nt==null?Jt:Nt,function(On,Zn,jn,Dn){var Ln=jn=="ltr",Cn=Sn(On,Ln?"left":"right"),qn=Sn(Zn-1,Ln?"right":"left"),mr=_t==null&&On==0,Ui=Nt==null&&Zn==Jt,Gn=Dn==0,bi=!Qn||Dn==Qn.length-1;if(qn.top-Cn.top<=3){var Nn=(re?mr:Ui)&&Gn,Va=(re?Ui:mr)&&bi,Si=Nn?Q:(Ln?Cn:qn).left,Qi=Va?ee:(Ln?qn:Cn).right;ve(Si,Cn.top,Qi-Si,Cn.bottom)}else{var Zi,Kn,gr,Xa;Ln?(Zi=re&&mr&&Gn?Q:Cn.left,Kn=re?ee:ii(On,jn,"before"),gr=re?Q:ii(Zn,jn,"after"),Xa=re&&Ui&&bi?ee:qn.right):(Zi=re?ii(On,jn,"before"):Q,Kn=!re&&mr&&Gn?ee:Cn.right,gr=!re&&Ui&&bi?Q:qn.left,Xa=re?ii(Zn,jn,"after"):ee),ve(Zi,Cn.top,Kn-Zi,Cn.bottom),Cn.bottom<qn.top&&ve(Q,Cn.bottom,null,qn.top),ve(gr,qn.top,Xa-gr,qn.bottom)}(!gn||Kr(Cn,gn)<0)&&(gn=Cn),Kr(qn,gn)<0&&(gn=qn),(!Mn||Kr(Cn,Mn)<0)&&(Mn=Cn),Kr(qn,Mn)<0&&(Mn=qn)}),{start:gn,end:Mn}}var De=t.from(),Ie=t.to();if(De.line==Ie.line)Ee(De.line,De.ch,Ie.ch);else{var je=ze(f,De.line),Ge=ze(f,Ie.line),$e=An(je)==An(Ge),st=Ee(De.line,De.ch,$e?je.text.length+1:null).end,mt=Ee(Ie.line,$e?0:null,Ie.ch).start;$e&&(st.top<mt.top-2?(ve(st.right,st.top,null,st.bottom),ve(Q,mt.top,mt.left,mt.bottom)):ve(st.right,st.top,mt.left-st.right,st.bottom)),st.bottom<mt.top&&ve(Q,st.bottom,null,mt.top)}r.appendChild(k)}function xa(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()||ir(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),wa(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ir(e))},100)}function wa(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,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),n&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function ir(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ue(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vr(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var f=t.view[i],k=e.options.lineWrapping,K=void 0,Q=0;if(f.hidden)continue;if(G&&W<8){var ee=f.node.offsetTop+f.node.offsetHeight;K=ee-r,r=ee}else{var re=f.node.getBoundingClientRect();K=re.bottom-re.top,!k&&f.text.firstChild&&(Q=f.text.firstChild.getBoundingClientRect().right-re.left-1)}var ve=f.line.height-K;if((ve>.005||ve<-.005)&&(nt(f.line,K),ys(f.line),f.rest))for(var Ee=0;Ee<f.rest.length;Ee++)ys(f.rest[Ee]);if(Q>e.display.sizerWidth){var De=Math.ceil(Q/nr(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=f.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Xr(e,t,r){var i=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-Wr(e));var f=r&&r.bottom!=null?r.bottom:i+e.wrapper.clientHeight,k=et(t,i),K=et(t,f);if(r&&r.ensure){var Q=r.ensure.from.line,ee=r.ensure.to.line;Q<k?(k=Q,K=et(t,Fn(ze(t,Q))+e.wrapper.clientHeight)):Math.min(ee,t.lastLine())>=K&&(k=et(t,Fn(ze(t,ee))-e.wrapper.clientHeight),K=ee)}return{from:k,to:Math.max(K,k+1)}}function Yo(e,t){if(q(e,"scrollCursorIntoView"))return;var r=e.display,i=r.sizer.getBoundingClientRect(),f=null;if(t.top+i.top<0?f=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),f!=null&&!d){var k=u("div","\u200B",null,`position: absolute;
top: `+(t.top-r.viewOffset-Wr(e.display))+`px;
height: `+(t.bottom-t.top+vi(e)+r.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(f),e.display.lineSpace.removeChild(k)}}function $o(e,t,r,i){i==null&&(i=0);var f;!e.options.lineWrapping&&t==r&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var K=!1,Q=pi(e,t),ee=!r||r==t?Q:pi(e,r);f={left:Math.min(Q.left,ee.left),top:Math.min(Q.top,ee.top)-i,right:Math.max(Q.left,ee.left),bottom:Math.max(Q.bottom,ee.bottom)+i};var re=Ta(e,f),ve=e.doc.scrollTop,Ee=e.doc.scrollLeft;if(re.scrollTop!=null&&(wr(e,re.scrollTop),Math.abs(e.doc.scrollTop-ve)>1&&(K=!0)),re.scrollLeft!=null&&(Xi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-Ee)>1&&(K=!0)),!K)break}return f}function Jo(e,t){var r=Ta(e,t);r.scrollTop!=null&&wr(e,r.scrollTop),r.scrollLeft!=null&&Xi(e,r.scrollLeft)}function Ta(e,t){var r=e.display,i=tr(e.display);t.top<0&&(t.top=0);var f=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=da(e),K={};t.bottom-t.top>k&&(t.bottom=t.top+k);var Q=e.doc.height+ca(r),ee=t.top<i,re=t.bottom>Q-i;if(t.top<f)K.scrollTop=ee?0:t.top;else if(t.bottom>f+k){var ve=Math.min(t.top,(re?Q:t.bottom)-k);ve!=f&&(K.scrollTop=ve)}var Ee=e.options.fixedGutter?0:r.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-Ee,Ie=Gi(e)-r.gutters.offsetWidth,je=t.right-t.left>Ie;return je&&(t.right=t.left+Ie),t.left<10?K.scrollLeft=0:t.left<De?K.scrollLeft=Math.max(0,t.left+Ee-(je?0:10)):t.right>Ie+De-3&&(K.scrollLeft=t.right+(je?0:10)-Ie),K}function Sa(e,t){if(t==null)return;Yr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function rr(e){Yr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xr(e,t,r){(t!=null||r!=null)&&Yr(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qo(e,t){Yr(e),e.curOp.scrollToPos=t}function Yr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);bs(e,r,i,t.margin)}}function bs(e,t,r,i){var f=Ta(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});xr(e,f.scrollLeft,f.scrollTop)}function wr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),_s(e,t,!0),D&&Aa(e),Cr(e,100)}function _s(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 Xi(e,t,r,i){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)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Tr(e){var t=e.display,r=t.gutters.offsetWidth,i=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:i,scrollHeight:i+vi(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Yi=function(e,t,r){this.cm=r;var i=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=f.tabIndex=-1,e(i),e(f),Pe(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Pe(f,"scroll",function(){f.clientWidth&&t(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Yi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var f=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+f)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:t?i:0}},Yi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Yi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Yi.prototype.zeroWidthHack=function(){var e=o&&!c?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Z,this.disableVert=new Z},Yi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var f=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(f.right-1,(f.top+f.bottom)/2):document.elementFromPoint((f.right+f.left)/2,f.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Yi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sr=function(){};Sr.prototype.update=function(){return{bottom:0,right:0}},Sr.prototype.setScrollLeft=function(){},Sr.prototype.setScrollTop=function(){},Sr.prototype.clear=function(){};function ar(e,t){t||(t=Tr(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var f=0;f<4&&r!=e.display.barWidth||i!=e.display.barHeight;f++)r!=e.display.barWidth&&e.options.lineWrapping&&Vr(e),Es(e,Tr(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Yi,null:Sr};function ws(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&C(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(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"?Xi(e,t):wr(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function $i(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:++Zo},ui(e.curOp)}function Ji(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var i=0;i<t.length;i++)tl(t[i]);for(var f=0;f<t.length;f++)nl(t[f]);for(var k=0;k<t.length;k++)il(t[k]);for(var K=0;K<t.length;K++)rl(t[K])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&qi(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 $r(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Vr(t),e.barMeasure=Tr(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(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+vi(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Gi(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Xi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ar(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function rl(e){var t=e.cm,r=t.display,i=t.doc;if(e.updatedDisplay&&Ts(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Xi(t,e.scrollLeft,!0,!0),e.scrollToPos){var f=$o(t,Tt(i,e.scrollToPos.from),Tt(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,f)}var k=e.maybeHiddenMarkers,K=e.maybeUnhiddenMarkers;if(k)for(var Q=0;Q<k.length;++Q)k[Q].lines.length||ue(k[Q],"hide");if(K)for(var ee=0;ee<K.length;++ee)K[ee].lines.length&&ue(K[ee],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ni(e,t){if(e.curOp)return t();$i(e);try{return t()}finally{Ji(e)}}function kn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);$i(e);try{return t.apply(e,arguments)}finally{Ji(e)}}}function zn(e){return function(){if(this.curOp)return e.apply(this,arguments);$i(this);try{return e.apply(this,arguments)}finally{Ji(this)}}}function Pn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);$i(t);try{return e.apply(this,arguments)}finally{Ji(t)}}}function Cr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=Lt(e,t.highlightFrontier),f=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var K=k.styles,Q=k.text.length>e.options.maxHighlightLength?it(t.mode,i.state):null,ee=$t(e,k,i,!0);Q&&(i.state=Q),k.styles=ee.styles;var re=k.styleClasses,ve=ee.classes;ve?k.styleClasses=ve:re&&(k.styleClasses=null);for(var Ee=!K||K.length!=k.styles.length||re!=ve&&(!re||!ve||re.bgClass!=ve.bgClass||re.textClass!=ve.textClass),De=0;!Ee&&De<K.length;++De)Ee=K[De]!=k.styles[De];Ee&&f.push(i.line),k.stateAfter=i.save(),i.nextLine()}else k.text.length<=e.options.maxHighlightLength&&_n(e,k.text,i),k.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return Cr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),f.length&&ni(e,function(){for(var k=0;k<f.length;k++)Ii(e,f[k],"text")})}var $r=function(e,t,r){var i=e.display;this.viewport=t,this.visible=Xr(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Gi(e),this.force=r,this.dims=ba(e),this.events=[]};$r.prototype.signal=function(e,t){se(e,t)&&this.events.push(arguments)},$r.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ue.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=vi(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=vi(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=N();if(!t||!_(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&_(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==N())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 Ca(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return Di(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&&fs(e)==0)return!1;Cs(e)&&(Di(e),t.dims=ba(e));var f=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),K=Math.min(f,t.visible.to+e.options.viewportMargin);r.viewFrom<k&&k-r.viewFrom<20&&(k=Math.max(i.first,r.viewFrom)),r.viewTo>K&&r.viewTo-K<20&&(K=Math.min(f,r.viewTo)),wn&&(k=Li(e.doc,k),K=fi(e.doc,K));var Q=k!=r.viewFrom||K!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,k,K),r.viewOffset=Fn(ze(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var ee=fs(e);if(!Q&&ee==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var re=ol(e);return ee>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),ee>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(re),w(r.cursorDiv),w(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Q&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Cr(e,400)),r.updateLineNumbers=null,!0}function Ts(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Gi(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ca(e.display)-da(e),r.top)}),t.visible=Xr(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Xr(e.display,e.doc,r));if(!Ca(e,t))break;Vr(e);var f=Tr(e);Er(e),ar(e,f),Oa(e,f),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var r=new $r(e,t);if(Ca(e,r)){Vr(e),Ts(e,r);var i=Tr(e);Er(e),ar(e,i),Oa(e,i),r.finish()}}function ul(e,t,r){var i=e.display,f=e.options.lineNumbers,k=i.lineDiv,K=k.firstChild;function Q(je){var Ge=je.nextSibling;return n&&o&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ge}for(var ee=i.view,re=i.viewFrom,ve=0;ve<ee.length;ve++){var Ee=ee[ve];if(!Ee.hidden)if(!Ee.node||Ee.node.parentNode!=k){var De=No(e,Ee,re,r);k.insertBefore(De,K)}else{for(;K!=Ee.node;)K=Q(K);var Ie=f&&t!=null&&t<=re&&Ee.lineNumber;Ee.changes&&(oe(Ee.changes,"gutter")>-1&&(Ie=!1),Ya(e,Ee,re,r)),Ie&&(w(Ee.lineNumber),Ee.lineNumber.appendChild(document.createTextNode(Bt(e.options,re)))),K=Ee.node.nextSibling}re+=Ee.size}for(;K;)K=Q(K)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+vi(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,f=t.gutters.offsetWidth,k=i+"px",K=0;K<r.length;K++)if(!r[K].hidden){e.options.fixedGutter&&(r[K].gutter&&(r[K].gutter.style.left=k),r[K].gutterBackground&&(r[K].gutterBackground.style.left=k));var Q=r[K].alignable;if(Q)for(var ee=0;ee<Q.length;ee++)Q[ee].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=i+f+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Bt(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var f=i.measure.appendChild(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=f.firstChild.offsetWidth,K=f.offsetWidth-k;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(k,i.lineGutter.offsetWidth-K)+1,i.lineNumWidth=i.lineNumInnerWidth+K,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var r=[],i=!1,f=0;f<e.length;f++){var k=e[f],K=null;if(typeof k!="string"&&(K=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)i=!0;else continue;r.push({className:k,style:K})}return t&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;w(t),e.lineGutter=null;for(var i=0;i<r.length;++i){var f=r[i],k=f.className,K=f.style,Q=t.appendChild(u("div",null,"CodeMirror-gutter "+k));K&&(Q.style.cssText=K),k=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ra(e)}function Ar(e){As(e.display),$n(e),Ss(e)}function hl(e,t,r,i){var f=this;this.input=r,f.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),f.scrollbarFiller.setAttribute("cm-not-content","true"),f.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),f.gutterFiller.setAttribute("cm-not-content","true"),f.lineDiv=v("div",null,"CodeMirror-code"),f.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),f.cursorDiv=u("div",null,"CodeMirror-cursors"),f.measure=u("div",null,"CodeMirror-measure"),f.lineMeasure=u("div",null,"CodeMirror-measure"),f.lineSpace=v("div",[f.measure,f.lineMeasure,f.selectionDiv,f.cursorDiv,f.lineDiv],null,"position: relative; outline: none");var k=v("div",[f.lineSpace],"CodeMirror-lines");f.mover=u("div",[k],null,"position: relative"),f.sizer=u("div",[f.mover],"CodeMirror-sizer"),f.sizerWidth=null,f.heightForcer=u("div",null,null,"position: absolute; height: "+de+"px; width: 1px;"),f.gutters=u("div",null,"CodeMirror-gutters"),f.lineGutter=null,f.scroller=u("div",[f.sizer,f.heightForcer,f.gutters],"CodeMirror-scroll"),f.scroller.setAttribute("tabIndex","-1"),f.wrapper=u("div",[f.scrollbarFiller,f.gutterFiller,f.scroller],"CodeMirror"),G&&W<8&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),!n&&!(D&&h)&&(f.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(f.wrapper):e(f.wrapper)),f.viewFrom=f.viewTo=t.first,f.reportedViewFrom=f.reportedViewTo=t.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,f.gutterSpecs=La(i.gutters,i.lineNumbers),As(f),r.init(f)}var Jr=0,oi=null;G?oi=-.53:D?oi=15:b?oi=-.7:g&&(oi=-1/3);function Rs(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=Rs(e);return t.x*=oi,t.y*=oi,t}function Os(e,t){var r=Rs(t),i=r.x,f=r.y,k=e.display,K=k.scroller,Q=K.scrollWidth>K.clientWidth,ee=K.scrollHeight>K.clientHeight;if(!(i&&Q||f&&ee))return;if(f&&o&&n){e:for(var re=t.target,ve=k.view;re!=K;re=re.parentNode)for(var Ee=0;Ee<ve.length;Ee++)if(ve[Ee].node==re){e.display.currentWheelTarget=re;break e}}if(i&&!D&&!m&&oi!=null){f&&ee&&wr(e,Math.max(0,K.scrollTop+f*oi)),Xi(e,Math.max(0,K.scrollLeft+i*oi)),(!f||f&&ee)&&ie(t),k.wheelStartX=null;return}if(f&&oi!=null){var De=f*oi,Ie=e.doc.scrollTop,je=Ie+k.wrapper.clientHeight;De<0?Ie=Math.max(0,Ie+De-50):je=Math.min(e.doc.height,je+De+50),Aa(e,{top:Ie,bottom:je})}Jr<20&&(k.wheelStartX==null?(k.wheelStartX=K.scrollLeft,k.wheelStartY=K.scrollTop,k.wheelDX=i,k.wheelDY=f,setTimeout(function(){if(k.wheelStartX==null)return;var Ge=K.scrollLeft-k.wheelStartX,$e=K.scrollTop-k.wheelStartY,st=$e&&k.wheelDY&&$e/k.wheelDY||Ge&&k.wheelDX&&Ge/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!st)return;oi=(oi*Jr+st)/(Jr+1),++Jr},200)):(k.wheelDX+=i,k.wheelDY+=f))}var li=function(e,t){this.ranges=e,this.primIndex=t};li.prototype.primary=function(){return this.ranges[this.primIndex]},li.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],i=e.ranges[t];if(!hn(r.anchor,i.anchor)||!hn(r.head,i.head))return!1}return!0},li.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ln(vn(this.ranges[t].anchor),vn(this.ranges[t].head));return new li(e,this.primIndex)},li.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},li.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(ht(t,i.from())>=0&&ht(e,i.to())<=0)return r}return-1};var ln=function(e,t){this.anchor=e,this.head=t};ln.prototype.from=function(){return cn(this.anchor,this.head)},ln.prototype.to=function(){return bn(this.anchor,this.head)},ln.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function mi(e,t,r){var i=e&&e.options.selectionsMayTouch,f=t[r];t.sort(function(De,Ie){return ht(De.from(),Ie.from())}),r=oe(t,f);for(var k=1;k<t.length;k++){var K=t[k],Q=t[k-1],ee=ht(Q.to(),K.from());if(i&&!K.empty()?ee>0:ee>=0){var re=cn(Q.from(),K.from()),ve=bn(Q.to(),K.to()),Ee=Q.empty()?K.from()==K.head:Q.from()==Q.head;k<=r&&--r,t.splice(--k,2,new ln(Ee?ve:re,Ee?re:ve))}}return new li(t,r)}function ki(e,t){return new li([new ln(e,t||e)],0)}function Pi(e){return e.text?Fe(e.from.line+e.text.length-1,I(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Pi(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Pi(t).ch-t.to.ch),Fe(r,i)}function Ia(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var f=e.sel.ranges[i];r.push(new ln(Ls(f.anchor,t),Ls(f.head,t)))}return mi(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Fe(r.line,e.ch-t.ch+r.ch):Fe(r.line+(e.line-t.line),e.ch)}function dl(e,t,r){for(var i=[],f=Fe(e.first,0),k=f,K=0;K<t.length;K++){var Q=t[K],ee=Is(Q.from,f,k),re=Is(Pi(Q),f,k);if(f=Q.to,k=re,r=="around"){var ve=e.sel.ranges[K],Ee=ht(ve.head,ve.anchor)<0;i[K]=new ln(Ee?re:ee,Ee?ee:re)}else i[K]=new ln(ee,ee)}return new li(i,e.sel.primIndex)}function Da(e){e.doc.mode=un(e.options,e.doc.modeOption),Rr(e)}function Rr(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,Cr(e,100),e.state.modeGen++,e.curOp&&$n(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&I(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,r,i){function f(mt){return r?r[mt]:null}function k(mt,ot,_t){Un(mt,ot,_t,i),Bn(mt,"change",mt,t)}function K(mt,ot){for(var _t=[],Nt=mt;Nt<ot;++Nt)_t.push(new Ei(re[Nt],f(Nt),i));return _t}var Q=t.from,ee=t.to,re=t.text,ve=ze(e,Q.line),Ee=ze(e,ee.line),De=I(re),Ie=f(re.length-1),je=ee.line-Q.line;if(t.full)e.insert(0,K(0,re.length)),e.remove(re.length,e.size-re.length);else if(Ds(e,t)){var Ge=K(0,re.length-1);k(Ee,Ee.text,Ie),je&&e.remove(Q.line,je),Ge.length&&e.insert(Q.line,Ge)}else if(ve==Ee)if(re.length==1)k(ve,ve.text.slice(0,Q.ch)+De+ve.text.slice(ee.ch),Ie);else{var $e=K(1,re.length-1);$e.push(new Ei(De+ve.text.slice(ee.ch),Ie,i)),k(ve,ve.text.slice(0,Q.ch)+re[0],f(0)),e.insert(Q.line+1,$e)}else if(re.length==1)k(ve,ve.text.slice(0,Q.ch)+re[0]+Ee.text.slice(ee.ch),f(0)),e.remove(Q.line+1,je);else{k(ve,ve.text.slice(0,Q.ch)+re[0],f(0)),k(Ee,De+Ee.text.slice(ee.ch),Ie);var st=K(1,re.length-1);je>1&&e.remove(Q.line+1,je-1),e.insert(Q.line+1,st)}Bn(e,"change",e,t)}function Mi(e,t,r){function i(f,k,K){if(f.linked)for(var Q=0;Q<f.linked.length;++Q){var ee=f.linked[Q];if(ee.doc==k)continue;var re=K&&ee.sharedHist;if(r&&!re)continue;t(ee.doc,re),i(ee.doc,f,re)}}i(e,null,!0)}function ks(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),Ps(e),e.options.lineWrapping||qi(e),e.options.mode=t.modeOption,$n(e)}function Ps(e){(e.doc.direction=="rtl"?B:C)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){ni(e,function(){Ps(e),$n(e)})}function Qr(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 Pa(e,t){var r={from:vn(t.from),to:Pi(t),text:kt(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Mi(e,function(i){return Fs(i,r,t.from.line,t.to.line+1)},!0),r}function Ms(e){for(;e.length;){var t=I(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),I(e.done);if(e.done.length&&!I(e.done).ranges)return I(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),I(e.done)}function Ns(e,t,r,i){var f=e.history;f.undone.length=0;var k=+new Date,K,Q;if((f.lastOp==i||f.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&f.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(K=pl(f,f.lastOp==i)))Q=I(K.changes),ht(t.from,t.to)==0&&ht(t.from,Q.to)==0?Q.to=Pi(t):K.changes.push(Pa(e,t));else{var ee=I(f.done);for((!ee||!ee.ranges)&&Zr(e.sel,f.done),K={changes:[Pa(e,t)],generation:f.generation},f.done.push(K);f.done.length>f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift()}f.done.push(r),f.generation=++f.maxGeneration,f.lastModTime=f.lastSelTime=k,f.lastOp=f.lastSelOp=i,f.lastOrigin=f.lastSelOrigin=t.origin,Q||ue(e,"historyAdded")}function ml(e,t,r,i){var f=t.charAt(0);return f=="*"||f=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var f=e.history,k=i&&i.origin;r==f.lastSelOp||k&&f.lastSelOrigin==k&&(f.lastModTime==f.lastSelTime&&f.lastOrigin==k||ml(e,k,I(f.done),t))?f.done[f.done.length-1]=t:Zr(t,f.done),f.lastSelTime=+new Date,f.lastSelOrigin=k,f.lastSelOp=r,i&&i.clearRedo!==!1&&Ms(f.undone)}function Zr(e,t){var r=I(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var f=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(K){K.markedSpans&&((f||(f=t["spans_"+e.id]={}))[k]=K.markedSpans),++k})}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 i=[],f=0;f<t.text.length;++f)i.push(vl(r[f]));return i}function Us(e,t){var r=yl(e,t),i=Vn(e,t);if(!r)return i;if(!i)return r;for(var f=0;f<r.length;++f){var k=r[f],K=i[f];if(k&&K){e:for(var Q=0;Q<K.length;++Q){for(var ee=K[Q],re=0;re<k.length;++re)if(k[re].marker==ee.marker)continue e;k.push(ee)}}else K&&(r[f]=K)}return r}function sr(e,t,r){for(var i=[],f=0;f<e.length;++f){var k=e[f];if(k.ranges){i.push(r?li.prototype.deepCopy.call(k):k);continue}var K=k.changes,Q=[];i.push({changes:Q});for(var ee=0;ee<K.length;++ee){var re=K[ee],ve=void 0;if(Q.push({from:re.from,to:re.to,text:re.text}),t)for(var Ee in re)(ve=Ee.match(/^spans_(\d+)$/))&&(oe(t,Number(ve[1]))>-1&&(I(Q)[Ee]=re[Ee],delete re[Ee]))}}return i}function Ma(e,t,r,i){if(i){var f=e.anchor;if(r){var k=ht(t,f)<0;k!=ht(r,f)<0?(f=t,t=r):k!=ht(t,r)<0&&(t=r)}return new ln(f,t)}else return new ln(r||t,t)}function qr(e,t,r,i,f){f==null&&(f=e.cm&&(e.cm.display.shift||e.extend)),Wn(e,new li([Ma(e.sel.primary(),t,r,f)],0),i)}function Bs(e,t,r){for(var i=[],f=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)i[k]=Ma(e.sel.ranges[k],t[k],null,f);var K=mi(e.cm,i,e.sel.primIndex);Wn(e,K,r)}function Na(e,t,r,i){var f=e.sel.ranges.slice(0);f[t]=r,Wn(e,mi(e.cm,f,e.sel.primIndex),i)}function js(e,t,r,i){Wn(e,ki(t,r),i)}function bl(e,t,r){var i={ranges:t.ranges,update:function(f){this.ranges=[];for(var k=0;k<f.length;k++)this.ranges[k]=new ln(Tt(e,f[k].anchor),Tt(e,f[k].head))},origin:r&&r.origin};return ue(e,"beforeSelectionChange",e,i),e.cm&&ue(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?mi(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,r){var i=e.history.done,f=I(i);f&&f.ranges?(i[i.length-1]=t,ea(e,t,r)):Wn(e,t,r)}function Wn(e,t,r){ea(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ea(e,t,r){(se(e,"beforeSelectionChange")||e.cm&&se(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var i=r&&r.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(r&&r.scroll===!1)&&e.cm&&rr(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,te(e.cm)),Bn(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,r,i){for(var f,k=0;k<t.ranges.length;k++){var K=t.ranges[k],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],ee=ta(e,K.anchor,Q&&Q.anchor,r,i),re=ta(e,K.head,Q&&Q.head,r,i);(f||ee!=K.anchor||re!=K.head)&&(f||(f=t.ranges.slice(0,k)),f[k]=new ln(ee,re))}return f?mi(e.cm,f,t.primIndex):t}function or(e,t,r,i,f){var k=ze(e,t.line);if(k.markedSpans)for(var K=0;K<k.markedSpans.length;++K){var Q=k.markedSpans[K],ee=Q.marker,re="selectLeft"in ee?!ee.selectLeft:ee.inclusiveLeft,ve="selectRight"in ee?!ee.selectRight:ee.inclusiveRight;if((Q.from==null||(re?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(ve?Q.to>=t.ch:Q.to>t.ch))){if(f&&(ue(ee,"beforeCursorEnter"),ee.explicitlyCleared))if(k.markedSpans){--K;continue}else break;if(!ee.atomic)continue;if(r){var Ee=ee.find(i<0?1:-1),De=void 0;if((i<0?ve:re)&&(Ee=Ks(e,Ee,-i,Ee&&Ee.line==t.line?k:null)),Ee&&Ee.line==t.line&&(De=ht(Ee,r))&&(i<0?De<0:De>0))return or(e,Ee,t,i,f)}var Ie=ee.find(i<0?-1:1);return(i<0?re:ve)&&(Ie=Ks(e,Ie,i,Ie.line==t.line?k:null)),Ie?or(e,Ie,t,i,f):null}}return t}function ta(e,t,r,i,f){var k=i||1,K=or(e,t,r,k,f)||!f&&or(e,t,r,k,!0)||or(e,t,r,-k,f)||!f&&or(e,t,r,-k,!0);return K||(e.cantEdit=!0,Fe(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?Tt(e,Fe(t.line-1)):null:r>0&&t.ch==(i||ze(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+r)}function Vs(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),be)}function Xs(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(f,k,K,Q){f&&(i.from=Tt(e,f)),k&&(i.to=Tt(e,k)),K&&(i.text=K),Q!==void 0&&(i.origin=Q)}),ue(e,"beforeChange",e,i),e.cm&&ue(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function lr(e,t,r){if(e.cm){if(!e.cm.curOp)return kn(e.cm,lr)(e,t,r);if(e.cm.state.suppressEdits)return}if((se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=fn&&!r&&hi(e,t.from,t.to);if(i)for(var f=i.length-1;f>=0;--f)Ys(e,{from:i[f].from,to:i[f].to,text:f?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),Or(e,t,r,Vn(e,t));var i=[];Mi(e,function(f,k){!k&&oe(i,f.history)==-1&&(Zs(f.history,t),i.push(f.history)),Or(f,t,null,Vn(f,t))})}function na(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var f=e.history,k,K=e.sel,Q=t=="undo"?f.done:f.undone,ee=t=="undo"?f.undone:f.done,re=0;re<Q.length&&!(k=Q[re],r?k.ranges&&!k.equals(e.sel):!k.ranges);re++);if(re==Q.length)return;for(f.lastOrigin=f.lastSelOrigin=null;;)if(k=Q.pop(),k.ranges){if(Zr(k,ee),r&&!k.equals(e.sel)){Wn(e,k,{clearRedo:!1});return}K=k}else if(i){Q.push(k);return}else break;var ve=[];Zr(K,ee),ee.push({changes:ve,generation:f.generation}),f.generation=k.generation||++f.maxGeneration;for(var Ee=se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"),De=function(Ge){var $e=k.changes[Ge];if($e.origin=t,Ee&&!Xs(e,$e,!1))return Q.length=0,{};ve.push(Pa(e,$e));var st=Ge?Ia(e,$e):I(Q);Or(e,$e,st,Us(e,$e)),!Ge&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:Pi($e)});var mt=[];Mi(e,function(ot,_t){!_t&&oe(mt,ot.history)==-1&&(Zs(ot.history,$e),mt.push(ot.history)),Or(ot,$e,null,Us(ot,$e))})},Ie=k.changes.length-1;Ie>=0;--Ie){var je=De(Ie);if(je)return je.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new li(F(e.sel.ranges,function(f){return new ln(Fe(f.anchor.line+t,f.anchor.ch),Fe(f.head.line+t,f.head.ch))}),e.sel.primIndex),e.cm){$n(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)Ii(e.cm,i,"gutter")}}function Or(e,t,r,i){if(e.cm&&!e.cm.curOp)return kn(e.cm,Or)(e,t,r,i);if(t.to.line<e.first){$s(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 f=t.text.length-1-(e.first-t.from.line);$s(e,f),t={from:Fe(e.first,0),to:Fe(t.to.line+f,t.to.ch),text:[I(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Fe(k,ze(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=kt(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?_l(e.cm,t,i):ka(e,t,i),ea(e,r,be),e.cantEdit&&ta(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,r){var i=e.doc,f=e.display,k=t.from,K=t.to,Q=!1,ee=k.line;e.options.lineWrapping||(ee=at(An(ze(i,k.line))),i.iter(ee,K.line+1,function(Ie){if(Ie==f.maxLine)return Q=!0,!0})),i.sel.contains(t.from,t.to)>-1&&te(e),ka(i,t,r,ds(e)),e.options.lineWrapping||(i.iter(ee,k.line+t.text.length,function(Ie){var je=Wi(Ie);je>f.maxLineLength&&(f.maxLine=Ie,f.maxLineLength=je,f.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Xt(i,k.line),Cr(e,400);var re=t.text.length-(K.line-k.line)-1;t.full?$n(e):k.line==K.line&&t.text.length==1&&!Ds(e.doc,t)?Ii(e,k.line,"text"):$n(e,k.line,K.line+1,re);var ve=se(e,"changes"),Ee=se(e,"change");if(Ee||ve){var De={from:k,to:K,text:t.text,removed:t.removed,origin:t.origin};Ee&&Bn(e,"change",e,De),ve&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function ur(e,t,r,i,f){var k;i||(i=r),ht(i,r)<0&&(k=[i,r],r=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),lr(e,{from:r,to:i,text:t,origin:f})}function Js(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Qs(e,t,r,i){for(var f=0;f<e.length;++f){var k=e[f],K=!0;if(k.ranges){k.copied||(k=e[f]=k.deepCopy(),k.copied=!0);for(var Q=0;Q<k.ranges.length;Q++)Js(k.ranges[Q].anchor,t,r,i),Js(k.ranges[Q].head,t,r,i);continue}for(var ee=0;ee<k.changes.length;++ee){var re=k.changes[ee];if(r<re.from.line)re.from=Fe(re.from.line+i,re.from.ch),re.to=Fe(re.to.line+i,re.to.ch);else if(t<=re.to.line){K=!1;break}}K||(e.splice(0,f+1),f=0)}}function Zs(e,t){var r=t.from.line,i=t.to.line,f=t.text.length-(i-r)-1;Qs(e.done,r,i,f),Qs(e.undone,r,i,f)}function Lr(e,t,r,i){var f=t,k=t;return typeof t=="number"?k=ze(e,yn(e,t)):f=at(t),f==null?null:(i(k,f)&&e.cm&&Ii(e.cm,f,r),k)}function Ir(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}Ir.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;r<i;++r){var f=this.lines[r];this.height-=f.height,Ze(f),Bn(f,"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 i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,r){for(var i=e+t;e<i;++e)if(r(this.lines[e]))return!0}};function Dr(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var f=e[i];t+=f.chunkSize(),r+=f.height,f.parent=this}this.size=t,this.height=r,this.parent=null}Dr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],f=i.chunkSize();if(e<f){var k=Math.min(t,f-e),K=i.height;if(i.removeInner(e,k),this.height-=K-i.height,f==k&&(this.children.splice(r--,1),i.parent=null),(t-=k)==0)break;e=0}else e-=f}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ir))){var Q=[];this.collapse(Q),this.children=[new Ir(Q)],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 i=0;i<this.children.length;++i){var f=this.children[i],k=f.chunkSize();if(e<=k){if(f.insertInner(e,t,r),f.lines&&f.lines.length>50){for(var K=f.lines.length%25+25,Q=K;Q<f.lines.length;){var ee=new Ir(f.lines.slice(Q,Q+=25));f.height-=ee.height,this.children.splice(++i,0,ee),ee.parent=this}f.lines=f.lines.slice(0,K),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Dr(t);if(e.parent){e.size-=r.size,e.height-=r.height;var f=oe(e.parent.children,e);e.parent.children.splice(f+1,0,r)}else{var i=new Dr(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var f=this.children[i],k=f.chunkSize();if(e<k){var K=Math.min(t,k-e);if(f.iterN(e,K,r))return!0;if((t-=K)==0)break;e=0}else e-=k}}};var kr=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=e,this.node=t};kr.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,i=at(r);if(i==null||!t)return;for(var f=0;f<t.length;++f)t[f]==this&&t.splice(f--,1);t.length||(r.widgets=null);var k=br(this);nt(r,Math.max(0,r.height-k)),e&&(ni(e,function(){qs(e,r,-k),Ii(e,i,"widget")}),Bn(e,"lineWidgetCleared",e,this,i))},kr.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,i=this.line;this.height=null;var f=br(this)-t;if(!f)return;si(this.doc,i)||nt(i,i.height+f),r&&ni(r,function(){r.curOp.forceUpdate=!0,qs(r,i,f),Bn(r,"lineWidgetChanged",r,e,at(i))})},he(kr);function qs(e,t,r){Fn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,i){var f=new kr(e,r,i),k=e.cm;return k&&f.noHScroll&&(k.display.alignWidgets=!0),Lr(e,t,"widget",function(K){var Q=K.widgets||(K.widgets=[]);if(f.insertAt==null?Q.push(f):Q.splice(Math.min(Q.length-1,Math.max(0,f.insertAt)),0,f),f.line=K,k&&!si(e,K)){var ee=Fn(K)<e.scrollTop;nt(K,K.height+br(f)),ee&&Sa(k,f.height),k.curOp.forceUpdate=!0}return!0}),k&&Bn(k,"lineWidgetAdded",k,f,typeof t=="number"?t:at(t)),f}var eo=0,Ni=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Ni.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&$i(e),se(this,"clear")){var r=this.find();r&&Bn(this,"clear",r.from,r.to)}for(var i=null,f=null,k=0;k<this.lines.length;++k){var K=this.lines[k],Q=ct(K.markedSpans,this);e&&!this.collapsed?Ii(e,at(K),"text"):e&&(Q.to!=null&&(f=at(K)),Q.from!=null&&(i=at(K))),K.markedSpans=Mt(K.markedSpans,Q),Q.from==null&&this.collapsed&&!si(this.doc,K)&&e&&nt(K,tr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ee=0;ee<this.lines.length;++ee){var re=An(this.lines[ee]),ve=Wi(re);ve>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=ve,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&$n(e,i,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&Bn(e,"markerCleared",e,this,i,f),t&&Ji(e),this.parent&&this.parent.clear()},Ni.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,f=0;f<this.lines.length;++f){var k=this.lines[f],K=ct(k.markedSpans,this);if(K.from!=null&&(r=Fe(t?k:at(k),K.from),e==-1))return r;if(K.to!=null&&(i=Fe(t?k:at(k),K.to),e==1))return i}return r&&{from:r,to:i}},Ni.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,i=this.doc.cm;if(!t||!i)return;ni(i,function(){var f=t.line,k=at(t.line),K=fa(i,k);if(K&&(rs(K),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!si(r.doc,f)&&r.height!=null){var Q=r.height;r.height=null;var ee=br(r)-Q;ee&&nt(f,f.height+ee)}Bn(i,"markerChanged",i,e)})},Ni.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ni.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},he(Ni);function hr(e,t,r,i,f){if(i&&i.shared)return xl(e,t,r,i,f);if(e.cm&&!e.cm.curOp)return kn(e.cm,hr)(e,t,r,i,f);var k=new Ni(e,f),K=ht(t,r);if(i&&E(i,k,!1),K>0||K==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=v("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ji(e,t.line,t,r,k)||t.line!=r.line&&ji(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");nn()}k.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Q=t.line,ee=e.cm,re;if(e.iter(Q,r.line+1,function(Ee){ee&&k.collapsed&&!ee.options.lineWrapping&&An(Ee)==ee.display.maxLine&&(re=!0),k.collapsed&&Q!=t.line&&nt(Ee,0),Zt(Ee,new bt(k,Q==t.line?t.ch:null,Q==r.line?r.ch:null)),++Q}),k.collapsed&&e.iter(t.line,r.line+1,function(Ee){si(e,Ee)&&nt(Ee,0)}),k.clearOnEnter&&Pe(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Tn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),ee){if(re&&(ee.curOp.updateMaxLine=!0),k.collapsed)$n(ee,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ve=t.line;ve<=r.line;ve++)Ii(ee,ve,"text");k.atomic&&Gs(ee.doc),Bn(ee,"markerAdded",ee,k)}return k}var Pr=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Pr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Bn(this,"clear")},Pr.prototype.find=function(e,t){return this.primary.find(e,t)},he(Pr);function xl(e,t,r,i,f){i=E(i),i.shared=!1;var k=[hr(e,t,r,i,f)],K=k[0],Q=i.widgetNode;return Mi(e,function(ee){Q&&(i.widgetNode=Q.cloneNode(!0)),k.push(hr(ee,Tt(ee,t),Tt(ee,r),i,f));for(var re=0;re<ee.linked.length;++re)if(ee.linked[re].isParent)return;K=I(k)}),new Pr(k,K)}function to(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function wl(e,t){for(var r=0;r<t.length;r++){var i=t[r],f=i.find(),k=e.clipPos(f.from),K=e.clipPos(f.to);if(ht(k,K)){var Q=hr(e,k,K,i.primary,i.primary.type);i.markers.push(Q),Q.parent=i}}}function Tl(e){for(var t=function(i){var f=e[i],k=[f.primary.doc];Mi(f.primary.doc,function(ee){return k.push(ee)});for(var K=0;K<f.markers.length;K++){var Q=f.markers[K];oe(k,Q.doc)==-1&&(Q.parent=null,f.markers.splice(K--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,Jn=function(e,t,r,i,f){if(!(this instanceof Jn))return new Jn(e,t,r,i,f);r==null&&(r=0),Dr.call(this,[new Ir([new Ei("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var k=Fe(r,0);this.sel=ki(k),this.history=new Qr(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=f=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:k,to:k,text:e}),Wn(this,ki(k),be)};Jn.prototype=z(Dr.prototype,{constructor:Jn,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,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ot(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Pn(function(e){var t=Fe(this.first,0),r=this.first+this.size-1;lr(this,{from:t,to:Fe(r,ze(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xr(this.cm,0,0),Wn(this,ki(t),be)}),replaceRange:function(e,t,r,i){t=Tt(this,t),r=r?Tt(this,r):t,ur(this,e,t,r,i)},getRange:function(e,t,r){var i=kt(this,Tt(this,e),Tt(this,t));return r===!1?i:i.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Vt(this,e))return ze(this,e)},getLineNumber:function(e){return at(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ze(this,e)),An(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Tt(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:Pn(function(e,t,r){js(this,Tt(this,typeof e=="number"?Fe(e,t||0):e),null,r)}),setSelection:Pn(function(e,t,r){js(this,Tt(this,e),Tt(this,t||e),r)}),extendSelection:Pn(function(e,t,r){qr(this,Tt(this,e),t&&Tt(this,t),r)}),extendSelections:Pn(function(e,t){Bs(this,He(this,e),t)}),extendSelectionsBy:Pn(function(e,t){var r=F(this.sel.ranges,e);Bs(this,He(this,r),t)}),setSelections:Pn(function(e,t,r){if(!e.length)return;for(var i=[],f=0;f<e.length;f++)i[f]=new ln(Tt(this,e[f].anchor),Tt(this,e[f].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Wn(this,mi(this.cm,i,t),r)}),addSelection:Pn(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new ln(Tt(this,e),Tt(this,t||e))),Wn(this,mi(this.cm,i,i.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,i=0;i<t.length;i++){var f=kt(this,t[i].from(),t[i].to());r=r?r.concat(f):f}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var f=kt(this,r[i].from(),r[i].to());e!==!1&&(f=f.join(e||this.lineSeparator())),t[i]=f}return t},replaceSelection:function(e,t,r){for(var i=[],f=0;f<this.sel.ranges.length;f++)i[f]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:Pn(function(e,t,r){for(var i=[],f=this.sel,k=0;k<f.ranges.length;k++){var K=f.ranges[k];i[k]={from:K.from(),to:K.to(),text:this.splitLines(e[k]),origin:r}}for(var Q=t&&t!="end"&&dl(this,i,t),ee=i.length-1;ee>=0;ee--)lr(this,i[ee]);Q?Hs(this,Q):this.cm&&rr(this.cm)}),undo:Pn(function(){na(this,"undo")}),redo:Pn(function(){na(this,"redo")}),undoSelection:Pn(function(){na(this,"undo",!0)}),redoSelection:Pn(function(){na(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,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var f=0;f<e.undone.length;f++)e.undone[f].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Qr(this.history.maxGeneration),Mi(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:sr(this.history.done),undone:sr(this.history.undone)}},setHistory:function(e){var t=this.history=new Qr(this.history.maxGeneration);t.done=sr(e.done.slice(0),null,!0),t.undone=sr(e.undone.slice(0),null,!0)},setGutterMarker:Pn(function(e,t,r){return Lr(this,e,"gutter",function(i){var f=i.gutterMarkers||(i.gutterMarkers={});return f[t]=r,!r&&ce(f)&&(i.gutterMarkers=null),!0})}),clearGutter:Pn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Lr(t,r,"gutter",function(){return r.gutterMarkers[e]=null,ce(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Vt(this,e))return null;if(t=e,e=ze(this,e),!e)return null}else if(t=at(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:Pn(function(e,t,r){return Lr(this,e,t=="gutter"?"gutter":"class",function(i){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[f])i[f]=r;else{if(R(r).test(i[f]))return!1;i[f]+=" "+r}return!0})}),removeLineClass:Pn(function(e,t,r){return Lr(this,e,t=="gutter"?"gutter":"class",function(i){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=i[f];if(k)if(r==null)i[f]=null;else{var K=k.match(R(r));if(!K)return!1;var Q=K.index+K[0].length;i[f]=k.slice(0,K.index)+(!K.index||Q==k.length?"":" ")+k.slice(Q)||null}else return!1;return!0})}),addLineWidget:Pn(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return hr(this,Tt(this,e),Tt(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=Tt(this,e),hr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Tt(this,e);var t=[],r=ze(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var f=r[i];(f.from==null||f.from<=e.ch)&&(f.to==null||f.to>=e.ch)&&t.push(f.marker.parent||f.marker)}return t},findMarks:function(e,t,r){e=Tt(this,e),t=Tt(this,t);var i=[],f=e.line;return this.iter(e.line,t.line+1,function(k){var K=k.markedSpans;if(K)for(var Q=0;Q<K.length;Q++){var ee=K[Q];!(ee.to!=null&&f==e.line&&e.ch>=ee.to||ee.from==null&&f!=e.line||ee.from!=null&&f==t.line&&ee.from>=t.ch)&&(!r||r(ee.marker))&&i.push(ee.marker.parent||ee.marker)}++f}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)r[i].from!=null&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first,i=this.lineSeparator().length;return this.iter(function(f){var k=f.text.length+i;if(k>e)return t=e,!0;e-=k,++r}),Tt(this,Fe(r,t))},indexFromPos:function(e){e=Tt(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(i){t+=i.text.length+r}),t},copy:function(e){var t=new Jn(Ot(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 i=new Jn(Ot(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],wl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof En&&(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),Tl(to(this));break}if(e.history==this.history){var i=[e.id];Mi(e,function(f){return i.push(f.id)},!0),e.history=new Qr(null),e.history.done=sr(this.history.done,i),e.history.undone=sr(this.history.undone,i)}},iterLinkedDocs:function(e){Mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ve(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Pn(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)})}),Jn.prototype.eachLine=Jn.prototype.iter;var no=0;function Cl(e){var t=this;if(io(t),q(t,e)||wi(t.display,e))return;ie(e),G&&(no=+new Date);var r=Ki(t,e,!0),i=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var f=i.length,k=Array(f),K=0,Q=function(){++K==f&&kn(t,function(){r=Tt(t.doc,r);var Ie={from:r,to:r,text:t.doc.splitLines(k.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};lr(t.doc,Ie),Hs(t.doc,ki(Tt(t.doc,r),Tt(t.doc,Pi(Ie))))})()},ee=function(Ie,je){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ie.type)==-1){Q();return}var Ge=new FileReader;Ge.onerror=function(){return Q()},Ge.onload=function(){var $e=Ge.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){Q();return}k[je]=$e,Q()},Ge.readAsText(Ie)},re=0;re<i.length;re++)ee(i[re],re);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 ve=e.dataTransfer.getData("Text");if(ve){var Ee;if(t.state.draggingText&&!t.state.draggingText.copy&&(Ee=t.listSelections()),ea(t.doc,ki(r,r)),Ee)for(var De=0;De<Ee.length;++De)ur(t.doc,"",Ee[De].anchor,Ee[De].head,"drag");t.replaceSelection(ve,"around","paste"),t.display.input.focus()}}catch(Ie){}}}function Al(e,t){if(G&&(!e.state.draggingText||+new Date-no<100)){pe(t);return}if(q(e,t)||wi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!g){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),m&&r.parentNode.removeChild(r)}}function Rl(e,t){var r=Ki(e,t);if(!r)return;var i=document.createDocumentFragment();ms(e,r,i),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),y(e.display.dragCursor,i)}function io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<t.length;i++){var f=t[i].CodeMirror;f&&r.push(f)}r.length&&r[0].operation(function(){for(var k=0;k<r.length;k++)e(r[k])})}var ao=!1;function Ol(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Pe(window,"blur",function(){return ro(ir)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Fi={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"},Mr=0;Mr<10;Mr++)Fi[Mr+48]=Fi[Mr+96]=String(Mr);for(var ia=65;ia<=90;ia++)Fi[ia]=String.fromCharCode(ia);for(var Nr=1;Nr<=12;Nr++)Fi[Nr+111]=Fi[Nr+63235]="F"+Nr;var Ti={};Ti.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"},Ti.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"},Ti.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"},Ti.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"]},Ti.default=o?Ti.macDefault:Ti.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,i,f,k,K=0;K<t.length-1;K++){var Q=t[K];if(/^(cmd|meta|m)$/i.test(Q))k=!0;else if(/^a(lt)?$/i.test(Q))r=!0;else if(/^(c|ctrl|control)$/i.test(Q))i=!0;else if(/^s(hift)?$/i.test(Q))f=!0;else throw new Error("Unrecognized modifier name: "+Q)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),f&&(e="Shift-"+e),e}function kl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(i=="..."){delete e[r];continue}for(var f=F(r.split(" "),Dl),k=0;k<f.length;k++){var K=void 0,Q=void 0;k==f.length-1?(Q=f.join(" "),K=i):(Q=f.slice(0,k+1).join(" "),K="...");var ee=t[Q];if(!ee)t[Q]=K;else if(ee!=K)throw new Error("Inconsistent bindings for "+Q)}delete e[r]}for(var re in t)e[re]=t[re];return e}function cr(e,t,r,i){t=ra(t);var f=t.call?t.call(e,i):t[e];if(f===!1)return"nothing";if(f==="...")return"multi";if(f!=null&&r(f))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return cr(e,t.fallthrough,r,i);for(var k=0;k<t.fallthrough.length;k++){var K=cr(e,t.fallthrough[k],r,i);if(K)return K}}}function so(e){var t=typeof e=="string"?e:Fi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(S?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(S?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(m&&e.keyCode==34&&e.char)return!1;var r=Fi[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function ra(e){return typeof e=="string"?Ti[e]:e}function dr(e,t){for(var r=e.doc.sel.ranges,i=[],f=0;f<r.length;f++){for(var k=t(r[f]);i.length&&ht(k.from,I(i).to)<=0;){var K=i.pop();if(ht(K.from,k.from)<0){k.from=K.from;break}}i.push(k)}ni(e,function(){for(var Q=i.length-1;Q>=0;Q--)ur(e.doc,"",i[Q].from,i[Q].to,"+delete");rr(e)})}function Fa(e,t,r){var i=Le(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ua(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Fe(t.line,i,r<0?"after":"before")}function Ba(e,t,r,i,f){if(e){t.doc.direction=="rtl"&&(f=-f);var k=Je(r,t.doc.direction);if(k){var K=f<0?I(k):k[0],Q=f<0==(K.level==1),ee=Q?"after":"before",re;if(K.level>0||t.doc.direction=="rtl"){var ve=er(t,r);re=f<0?r.text.length-1:0;var Ee=yi(t,ve,re).top;re=Be(function(De){return yi(t,ve,De).top==Ee},f<0==(K.level==1)?K.from:K.to-1,re),ee=="before"&&(re=Fa(r,re,1))}else re=f<0?K.to:K.from;return new Fe(i,re,ee)}}return new Fe(i,f<0?r.text.length:0,f<0?"before":"after")}function Pl(e,t,r,i){var f=Je(t,e.doc.direction);if(!f)return Ua(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=Xe(f,r.ch,r.sticky),K=f[k];if(e.doc.direction=="ltr"&&K.level%2==0&&(i>0?K.to>r.ch:K.from<r.ch))return Ua(t,r,i);var Q=function(st,mt){return Fa(t,st instanceof Fe?st.ch:st,mt)},ee,re=function(st){return e.options.lineWrapping?(ee=ee||er(e,t),cs(e,t,ee,st)):{begin:0,end:t.text.length}},ve=re(r.sticky=="before"?Q(r,-1):r.ch);if(e.doc.direction=="rtl"||K.level==1){var Ee=K.level==1==i<0,De=Q(r,Ee?1:-1);if(De!=null&&(Ee?De<=K.to&&De<=ve.end:De>=K.from&&De>=ve.begin)){var Ie=Ee?"before":"after";return new Fe(r.line,De,Ie)}}var je=function(st,mt,ot){for(var _t=function(gn,Mn){return Mn?new Fe(r.line,Q(gn,1),"before"):new Fe(r.line,gn,"after")};st>=0&&st<f.length;st+=mt){var Nt=f[st],It=mt>0==(Nt.level!=1),Jt=It?ot.begin:Q(ot.end,-1);if(Nt.from<=Jt&&Jt<Nt.to)return _t(Jt,It);if(Jt=It?Nt.from:Q(Nt.to,-1),ot.begin<=Jt&&Jt<ot.end)return _t(Jt,It)}},Ge=je(k+i,i,ve);if(Ge)return Ge;var $e=i>0?ve.end:Q(ve.begin,-1);return $e!=null&&!(i>0&&$e==t.text.length)&&(Ge=je(i>0?0:f.length-1,i,re($e)),Ge)?Ge:null}var Fr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return dr(e,function(t){if(t.empty()){var r=ze(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return dr(e,function(t){return{from:Fe(t.from().line,0),to:Tt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return dr(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return dr(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return dr(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:i}})},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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ml(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")},Ce)},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")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},Ce)},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(),i=e.options.tabSize,f=0;f<r.length;f++){var k=r[f].from(),K=H(e.getLine(k.line),k.ch,i);t.push(V(i-K%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ni(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var f=t[i].head,k=ze(e.doc,f.line).text;if(k){if(f.ch==k.length&&(f=new Fe(f.line,f.ch-1)),f.ch>0)f=new Fe(f.line,f.ch+1),e.replaceRange(k.charAt(f.ch-1)+k.charAt(f.ch-2),Fe(f.line,f.ch-2),f,"+transpose");else if(f.line>e.doc.first){var K=ze(e.doc,f.line-1).text;K&&(f=new Fe(f.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+K.charAt(K.length-1),Fe(f.line-1,K.length-1),f,"+transpose"))}}r.push(new ln(f,f))}e.setSelections(r)})},newlineAndIndent:function(e){return ni(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 i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);rr(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=ze(e.doc,t),i=An(r);return i!=r&&(t=at(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var r=ze(e.doc,t),i=Ri(r);return i!=r&&(t=at(i)),Ba(!0,e,r,t,-1)}function ho(e,t){var r=uo(e,t.line),i=ze(e.doc,r.line),f=Je(i,e.doc.direction);if(!f||f[0].level==0){var k=Math.max(r.ch,i.text.search(/\S/)),K=t.line==r.line&&t.ch<=k&&t.ch;return Fe(r.line,K?0:k,r.sticky)}return r}function aa(e,t,r){if(typeof t=="string"&&(t=Fr[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,f=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),f=t(e)!=Te}finally{e.display.shift=i,e.state.suppressEdits=!1}return f}function Nl(e,t,r){for(var i=0;i<e.state.keyMaps.length;i++){var f=cr(t,e.state.keyMaps[i],r,e);if(f)return f}return e.options.extraKeys&&cr(t,e.options.extraKeys,r,e)||cr(t,e.options.keyMap,r,e)}var Fl=new Z;function Ur(e,t,r,i){var f=e.state.keySeq;if(f){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==f&&(e.state.keySeq=null,e.display.input.reset())}),co(e,f+" "+t,r,i))return!0}return co(e,t,r,i)}function co(e,t,r,i){var f=Nl(e,t,i);return f=="multi"&&(e.state.keySeq=t),f=="handled"&&Bn(e,"keyHandled",e,t,r),(f=="handled"||f=="multi")&&(ie(r),xa(e)),!!f}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?Ur(e,"Shift-"+r,t,function(i){return aa(e,i,!0)})||Ur(e,r,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return aa(e,i)}):Ur(e,r,t,function(i){return aa(e,i)}):!1}function Ul(e,t,r){return Ur(e,"'"+r+"'",t,function(i){return aa(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),q(t,e))return;G&&W<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var i=fo(t,e);m&&(ja=i?r:null,!i&&r==88&&!Et&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!o&&!i&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function r(i){(i.keyCode==18||!i.altKey)&&(C(t,"CodeMirror-crosshair"),ut(document,"keyup",r),ut(document,"mouseover",r))}Pe(document,"keyup",r),Pe(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),q(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(wi(t.display,e)||q(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var r=e.keyCode,i=e.charCode;if(m&&r==ja){ja=null,ie(e);return}if(m&&(!e.which||e.which<10)&&fo(t,e))return;var f=String.fromCharCode(i==null?r:i);if(f=="\b")return;if(Ul(t,e,f))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ha.prototype.compare=function(e,t,r){return this.time+jl>e&&ht(t,this.pos)==0&&r==this.button};var Br,jr;function Hl(e,t){var r=+new Date;return jr&&jr.compare(r,e,t)?(Br=jr=null,"triple"):Br&&Br.compare(r,e,t)?(jr=new Ha(r,e,t),Br=null,"double"):(Br=new Ha(r,e,t),jr=null,"single")}function vo(e){var t=this,r=t.display;if(q(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,wi(r,e)){n||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Ki(t,e),f=Re(e),k=i?Hl(i,f):"single";if(window.focus(),f==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,f,i,k,e))return;f==1?i?zl(t,i,k,e):xe(e)==r.scroller&&ie(e):f==2?(i&&qr(t.doc,i),setTimeout(function(){return r.input.focus()},20)):f==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,f){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Ur(e,oo(k,f),f,function(K){if(typeof K=="string"&&(K=Fr[K]),!K)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=K(e,r)!=Te}finally{e.state.suppressEdits=!1}return Q})}function Gl(e,t,r){var i=e.getOption("configureMouse"),f=i?i(e,t,r):{};if(f.unit==null){var k=s?r.shiftKey&&r.metaKey:r.altKey;f.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(f.extend==null||e.doc.extend)&&(f.extend=e.doc.extend||r.shiftKey),f.addNew==null&&(f.addNew=o?r.metaKey:r.ctrlKey),f.moveOnDrag==null&&(f.moveOnDrag=!(o?r.altKey:r.ctrlKey)),f}function zl(e,t,r,i){G?setTimeout(M(gs,e),0):e.curOp.focus=N();var f=Gl(e,r,i),k=e.doc.sel,K;e.options.dragDrop&&Ne&&!e.isReadOnly()&&r=="single"&&(K=k.contains(t))>-1&&(ht((K=k.ranges[K]).from(),t)<0||t.xRel>0)&&(ht(K.to(),t)>0||t.xRel<0)?Kl(e,i,t,f):Vl(e,i,t,f)}function Kl(e,t,r,i){var f=e.display,k=!1,K=kn(e,function(re){n&&(f.scroller.draggable=!1),e.state.draggingText=!1,ut(f.wrapper.ownerDocument,"mouseup",K),ut(f.wrapper.ownerDocument,"mousemove",Q),ut(f.scroller,"dragstart",ee),ut(f.scroller,"drop",K),k||(ie(re),i.addNew||qr(e.doc,r,null,null,i.extend),n&&!g||G&&W==9?setTimeout(function(){f.wrapper.ownerDocument.body.focus({preventScroll:!0}),f.input.focus()},20):f.input.focus())}),Q=function(re){k=k||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},ee=function(){return k=!0};n&&(f.scroller.draggable=!0),e.state.draggingText=K,K.copy=!i.moveOnDrag,f.scroller.dragDrop&&f.scroller.dragDrop(),Pe(f.wrapper.ownerDocument,"mouseup",K),Pe(f.wrapper.ownerDocument,"mousemove",Q),Pe(f.scroller,"dragstart",ee),Pe(f.scroller,"drop",K),vs(e),setTimeout(function(){return f.input.focus()},20)}function yo(e,t,r){if(r=="char")return new ln(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new ln(Fe(t.line,0),Tt(e.doc,Fe(t.line+1,0)));var i=r(e,t);return new ln(i.from,i.to)}function Vl(e,t,r,i){var f=e.display,k=e.doc;ie(t);var K,Q,ee=k.sel,re=ee.ranges;if(i.addNew&&!i.extend?(Q=k.sel.contains(r),Q>-1?K=re[Q]:K=new ln(r,r)):(K=k.sel.primary(),Q=k.sel.primIndex),i.unit=="rectangle")i.addNew||(K=new ln(r,r)),r=Ki(e,t,!0,!0),Q=-1;else{var ve=yo(e,r,i.unit);i.extend?K=Ma(K,ve.anchor,ve.head,i.extend):K=ve}i.addNew?Q==-1?(Q=re.length,Wn(k,mi(e,re.concat([K]),Q),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Q].empty()&&i.unit=="char"&&!i.extend?(Wn(k,mi(e,re.slice(0,Q).concat(re.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),ee=k.sel):Na(k,Q,K,Ae):(Q=0,Wn(k,new li([K],0),Ae),ee=k.sel);var Ee=r;function De(ot){if(ht(Ee,ot)==0)return;if(Ee=ot,i.unit=="rectangle"){for(var _t=[],Nt=e.options.tabSize,It=H(ze(k,r.line).text,r.ch,Nt),Jt=H(ze(k,ot.line).text,ot.ch,Nt),gn=Math.min(It,Jt),Mn=Math.max(It,Jt),Sn=Math.min(r.line,ot.line),ii=Math.min(e.lastLine(),Math.max(r.line,ot.line));Sn<=ii;Sn++){var Qn=ze(k,Sn).text,On=_e(Qn,gn,Nt);gn==Mn?_t.push(new ln(Fe(Sn,On),Fe(Sn,On))):Qn.length>On&&_t.push(new ln(Fe(Sn,On),Fe(Sn,_e(Qn,Mn,Nt))))}_t.length||_t.push(new ln(r,r)),Wn(k,mi(e,ee.ranges.slice(0,Q).concat(_t),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ot)}else{var Zn=K,jn=yo(e,ot,i.unit),Dn=Zn.anchor,Ln;ht(jn.anchor,Dn)>0?(Ln=jn.head,Dn=cn(Zn.from(),jn.anchor)):(Ln=jn.anchor,Dn=bn(Zn.to(),jn.head));var Cn=ee.ranges.slice(0);Cn[Q]=Xl(e,new ln(Tt(k,Dn),Ln)),Wn(k,mi(e,Cn,Q),Ae)}}var Ie=f.wrapper.getBoundingClientRect(),je=0;function Ge(ot){var _t=++je,Nt=Ki(e,ot,!0,i.unit=="rectangle");if(!Nt)return;if(ht(Nt,Ee)!=0){e.curOp.focus=N(),De(Nt);var It=Xr(f,k);(Nt.line>=It.to||Nt.line<It.from)&&setTimeout(kn(e,function(){je==_t&&Ge(ot)}),150)}else{var Jt=ot.clientY<Ie.top?-20:ot.clientY>Ie.bottom?20:0;Jt&&setTimeout(kn(e,function(){if(je!=_t)return;f.scroller.scrollTop+=Jt,Ge(ot)}),50)}}function $e(ot){e.state.selectingText=!1,je=Infinity,ot&&(ie(ot),f.input.focus()),ut(f.wrapper.ownerDocument,"mousemove",st),ut(f.wrapper.ownerDocument,"mouseup",mt),k.history.lastSelOrigin=null}var st=kn(e,function(ot){ot.buttons===0||!Re(ot)?$e(ot):Ge(ot)}),mt=kn(e,$e);e.state.selectingText=mt,Pe(f.wrapper.ownerDocument,"mousemove",st),Pe(f.wrapper.ownerDocument,"mouseup",mt)}function Xl(e,t){var r=t.anchor,i=t.head,f=ze(e.doc,r.line);if(ht(r,i)==0&&r.sticky==i.sticky)return t;var k=Je(f);if(!k)return t;var K=Xe(k,r.ch,r.sticky),Q=k[K];if(Q.from!=r.ch&&Q.to!=r.ch)return t;var ee=K+(Q.from==r.ch==(Q.level!=1)?0:1);if(ee==0||ee==k.length)return t;var re;if(i.line!=r.line)re=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ve=Xe(k,i.ch,i.sticky),Ee=ve-K||(i.ch-r.ch)*(Q.level==1?-1:1);ve==ee-1||ve==ee?re=Ee<0:re=Ee>0}var De=k[ee+(re?-1:0)],Ie=re==(De.level==1),je=Ie?De.from:De.to,Ge=Ie?"after":"before";return r.ch==je&&r.sticky==Ge?t:new ln(new Fe(r.line,je,Ge),i)}function bo(e,t,r,i){var f,k;if(t.touches)f=t.touches[0].clientX,k=t.touches[0].clientY;else try{f=t.clientX,k=t.clientY}catch(De){return!1}if(f>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ie(t);var K=e.display,Q=K.lineDiv.getBoundingClientRect();if(k>Q.bottom||!se(e,r))return fe(t);k-=Q.top-K.viewOffset;for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var re=K.gutters.childNodes[ee];if(re&&re.getBoundingClientRect().right>=f){var ve=et(e.doc,k),Ee=e.display.gutterSpecs[ee];return ue(e,r,e,ve,Ee.className,t),fe(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(wi(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?bo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),_r(e)}var fr={toString:function(){return"CodeMirror.Init"}},xo={},sa={};function $l(e){var t=e.optionHandlers;function r(i,f,k,K){e.defaults[i]=f,k&&(t[i]=K?function(Q,ee,re){re!=fr&&k(Q,ee,re)}:k)}e.defineOption=r,e.Init=fr,r("value","",function(i,f){return i.setValue(f)},!0),r("mode",null,function(i,f){i.doc.modeOption=f,Da(i)},!0),r("indentUnit",2,Da,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Rr(i),_r(i),$n(i)},!0),r("lineSeparator",null,function(i,f){if(i.doc.lineSep=f,!f)return;var k=[],K=i.doc.first;i.doc.iter(function(ee){for(var re=0;;){var ve=ee.text.indexOf(f,re);if(ve==-1)break;re=ve+f.length,k.push(Fe(K,ve))}K++});for(var Q=k.length-1;Q>=0;Q--)ur(i.doc,f,k[Q],Fe(k[Q].line,k[Q].ch+f.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,f,k){i.state.specialChars=new RegExp(f.source+(f.test(" ")?"":"| "),"g"),k!=fr&&i.refresh()}),r("specialCharPlaceholder",sn,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",h?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,f){return i.getInputField().spellcheck=f},!0),r("autocorrect",!1,function(i,f){return i.getInputField().autocorrect=f},!0),r("autocapitalize",!1,function(i,f){return i.getInputField().autocapitalize=f},!0),r("rtlMoveVisually",!A),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Ar(i)},!0),r("keyMap","default",function(i,f,k){var K=ra(f),Q=k!=fr&&ra(k);Q&&Q.detach&&Q.detach(i,K),K.attach&&K.attach(i,Q||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(i,f){i.display.gutterSpecs=La(f,i.options.lineNumbers),Ar(i)},!0),r("fixedGutter",!0,function(i,f){i.display.gutters.style.left=f?_a(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return ar(i)},!0),r("scrollbarStyle","native",function(i){ws(i),ar(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,f){i.display.gutterSpecs=La(i.options.gutters,f),Ar(i)},!0),r("firstLineNumber",1,Ar,!0),r("lineNumberFormatter",function(i){return i},Ar,!0),r("showCursorWhenSelecting",!1,Er,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,f){f=="nocursor"&&(ir(i),i.display.input.blur()),i.display.input.readOnlyChanged(f)}),r("screenReaderLabel",null,function(i,f){f=f===""?null:f,i.display.input.screenReaderLabelChanged(f)}),r("disableInput",!1,function(i,f){f||i.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Er,!0),r("singleCursorHeightPerLine",!0,Er,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Rr,!0),r("addModeClass",!1,Rr,!0),r("pollInterval",100),r("undoDepth",200,function(i,f){return i.doc.history.undoDepth=f}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Rr,!0),r("moveInputWithCursor",!0,function(i,f){f||i.display.input.resetPosition()}),r("tabindex",null,function(i,f){return i.display.input.getField().tabIndex=f||""}),r("autofocus",null),r("direction","ltr",function(i,f){return i.doc.setDirection(f)},!0),r("phrases",null)}function Jl(e,t,r){var i=r&&r!=fr;if(!t!=!i){var f=e.display.dragFunctions,k=t?Pe:ut;k(e.display.scroller,"dragstart",f.start),k(e.display.scroller,"dragenter",f.enter),k(e.display.scroller,"dragover",f.over),k(e.display.scroller,"dragleave",f.leave),k(e.display.scroller,"drop",f.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),qi(e)),Ea(e),$n(e),_r(e),setTimeout(function(){return ar(e)},100)}function En(e,t){var r=this;if(!(this instanceof En))return new En(e,t);this.options=t=t?E(t):{},E(xo,t,!1);var i=t.value;typeof i=="string"?i=new Jn(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var f=new En.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,f,t);k.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ws(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 Z,keySeq:null,specialChars:null},t.autofocus&&!h&&k.input.focus(),G&&W<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ol(),$i(this),this.curOp.forceUpdate=!0,ks(this,i),t.autofocus&&!h||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&wa(r)},20):ir(this);for(var K in sa)sa.hasOwnProperty(K)&&sa[K](this,t[K],fr);Cs(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ga.length;++Q)Ga[Q](this);Ji(this),n&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}En.defaults=xo,En.optionHandlers=sa;function Zl(e){var t=e.display;Pe(t.scroller,"mousedown",kn(e,vo)),G&&W<11?Pe(t.scroller,"dblclick",kn(e,function(ee){if(q(e,ee))return;var re=Ki(e,ee);if(!re||Wa(e,ee)||wi(e.display,ee))return;ie(ee);var ve=e.findWordAt(re);qr(e.doc,ve.anchor,ve.head)})):Pe(t.scroller,"dblclick",function(ee){return q(e,ee)||ie(ee)}),Pe(t.scroller,"contextmenu",function(ee){return _o(e,ee)}),Pe(t.input.getField(),"contextmenu",function(ee){t.scroller.contains(ee.target)||_o(e,ee)});var r,i={end:0};function f(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function k(ee){if(ee.touches.length!=1)return!1;var re=ee.touches[0];return re.radiusX<=1&&re.radiusY<=1}function K(ee,re){if(re.left==null)return!0;var ve=re.left-ee.left,Ee=re.top-ee.top;return ve*ve+Ee*Ee>20*20}Pe(t.scroller,"touchstart",function(ee){if(!q(e,ee)&&!k(ee)&&!Wa(e,ee)){t.input.ensurePolled(),clearTimeout(r);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-i.end<=300?i:null},ee.touches.length==1&&(t.activeTouch.left=ee.touches[0].pageX,t.activeTouch.top=ee.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(ee){var re=t.activeTouch;if(re&&!wi(t,ee)&&re.left!=null&&!re.moved&&new Date-re.start<300){var ve=e.coordsChar(t.activeTouch,"page"),Ee;!re.prev||K(re,re.prev)?Ee=new ln(ve,ve):!re.prev.prev||K(re,re.prev.prev)?Ee=e.findWordAt(ve):Ee=new ln(Fe(ve.line,0),Tt(e.doc,Fe(ve.line+1,0))),e.setSelection(Ee.anchor,Ee.head),e.focus(),ie(ee)}f()}),Pe(t.scroller,"touchcancel",f),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(wr(e,t.scroller.scrollTop),Xi(e,t.scroller.scrollLeft,!0),ue(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(ee){return Os(e,ee)}),Pe(t.scroller,"DOMMouseScroll",function(ee){return Os(e,ee)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(ee){q(e,ee)||pe(ee)},over:function(ee){q(e,ee)||(Rl(e,ee),pe(ee))},start:function(ee){return Al(e,ee)},drop:kn(e,Cl),leave:function(ee){q(e,ee)||io(e)}};var Q=t.input.getField();Pe(Q,"keyup",function(ee){return mo.call(e,ee)}),Pe(Q,"keydown",kn(e,po)),Pe(Q,"keypress",kn(e,go)),Pe(Q,"focus",function(ee){return wa(e,ee)}),Pe(Q,"blur",function(ee){return ir(e,ee)})}var Ga=[];En.defineInitHook=function(e){return Ga.push(e)};function Hr(e,t,r,i){var f=e.doc,k;r==null&&(r="add"),r=="smart"&&(f.mode.indent?k=Lt(e,t).state:r="prev");var K=e.options.tabSize,Q=ze(f,t),ee=H(Q.text,null,K);Q.stateAfter&&(Q.stateAfter=null);var re=Q.text.match(/^\s*/)[0],ve;if(!i&&!/\S/.test(Q.text))ve=0,r="not";else if(r=="smart"&&(ve=f.mode.indent(k,Q.text.slice(re.length),Q.text),ve==Te||ve>150)){if(!i)return;r="prev"}r=="prev"?t>f.first?ve=H(ze(f,t-1).text,null,K):ve=0:r=="add"?ve=ee+e.options.indentUnit:r=="subtract"?ve=ee-e.options.indentUnit:typeof r=="number"&&(ve=ee+r),ve=Math.max(0,ve);var Ee="",De=0;if(e.options.indentWithTabs)for(var Ie=Math.floor(ve/K);Ie;--Ie)De+=K,Ee+=" ";if(De<ve&&(Ee+=V(ve-De)),Ee!=re)return ur(f,Ee,Fe(t,0),Fe(t,re.length),"+input"),Q.stateAfter=null,!0;for(var je=0;je<f.sel.ranges.length;je++){var Ge=f.sel.ranges[je];if(Ge.head.line==t&&Ge.head.ch<re.length){var $e=Fe(t,re.length);Na(f,je,new ln($e,$e));break}}}var gi=null;function oa(e){gi=e}function za(e,t,r,i,f){var k=e.doc;e.display.shift=!1,i||(i=k.sel);var K=+new Date-200,Q=f=="paste"||e.state.pasteIncoming>K,ee=Ve(t),re=null;if(Q&&i.ranges.length>1)if(gi&&gi.text.join(`
`)==t){if(i.ranges.length%gi.text.length==0){re=[];for(var ve=0;ve<gi.text.length;ve++)re.push(k.splitLines(gi.text[ve]))}}else ee.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(re=F(ee,function(st){return[st]}));for(var Ee=e.curOp.updateInput,De=i.ranges.length-1;De>=0;De--){var Ie=i.ranges[De],je=Ie.from(),Ge=Ie.to();Ie.empty()&&(r&&r>0?je=Fe(je.line,je.ch-r):e.state.overwrite&&!Q?Ge=Fe(Ge.line,Math.min(ze(k,Ge.line).text.length,Ge.ch+I(ee).length)):Q&&gi&&gi.lineWise&&gi.text.join(`
`)==ee.join(`
`)&&(je=Ge=Fe(je.line,0)));var $e={from:je,to:Ge,text:re?re[De%re.length]:ee,origin:f||(Q?"paste":e.state.cutIncoming>K?"cut":"+input")};lr(e.doc,$e),Bn(e,"inputRead",e,$e)}t&&!Q&&To(e,t),rr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ee),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function wo(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ni(t,function(){return za(t,r,0,null,"paste")}),!0}function To(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var f=r.ranges[i];if(f.head.ch>100||i&&r.ranges[i-1].head.line==f.head.line)continue;var k=e.getModeAt(f.head),K=!1;if(k.electricChars){for(var Q=0;Q<k.electricChars.length;Q++)if(t.indexOf(k.electricChars.charAt(Q))>-1){K=Hr(e,f.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(ze(e.doc,f.head.line).text.slice(0,f.head.ch))&&(K=Hr(e,f.head.line,"smart")));K&&Bn(e,"electricInput",e,f.head.line)}}function So(e){for(var t=[],r=[],i=0;i<e.doc.sel.ranges.length;i++){var f=e.doc.sel.ranges[i].head.line,k={anchor:Fe(f,0),head:Fe(f+1,0)};r.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:r}}function Co(e,t,r,i){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return n?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),Co(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(i,f){var k=this.options,K=k[i];if(k[i]==f&&i!="mode")return;k[i]=f,t.hasOwnProperty(i)&&kn(this,t[i])(this,f,K),ue(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,f){this.state.keyMaps[f?"push":"unshift"](ra(i))},removeKeyMap:function(i){for(var f=this.state.keyMaps,k=0;k<f.length;++k)if(f[k]==i||f[k].name==i)return f.splice(k,1),!0},addOverlay:zn(function(i,f){var k=i.token?i:e.getMode(this.options,i);if(k.startState)throw new Error("Overlays may not be stateful.");J(this.state.overlays,{mode:k,modeSpec:i,opaque:f&&f.opaque,priority:f&&f.priority||0},function(K){return K.priority}),this.state.modeGen++,$n(this)}),removeOverlay:zn(function(i){for(var f=this.state.overlays,k=0;k<f.length;++k){var K=f[k].modeSpec;if(K==i||typeof i=="string"&&K.name==i){f.splice(k,1),this.state.modeGen++,$n(this);return}}}),indentLine:zn(function(i,f,k){typeof f!="string"&&typeof f!="number"&&(f==null?f=this.options.smartIndent?"smart":"prev":f=f?"add":"subtract"),Vt(this.doc,i)&&Hr(this,i,f,k)}),indentSelection:zn(function(i){for(var f=this.doc.sel.ranges,k=-1,K=0;K<f.length;K++){var Q=f[K];if(Q.empty())Q.head.line>k&&(Hr(this,Q.head.line,i,!0),k=Q.head.line,K==this.doc.sel.primIndex&&rr(this));else{var ee=Q.from(),re=Q.to(),ve=Math.max(k,ee.line);k=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var Ee=ve;Ee<k;++Ee)Hr(this,Ee,i);var De=this.doc.sel.ranges;ee.ch==0&&f.length==De.length&&De[K].from().ch>0&&Na(this.doc,K,new ln(ee,De[K].to()),be)}}}),getTokenAt:function(i,f){return Wt(this,i,f)},getLineTokens:function(i,f){return Wt(this,Fe(i),f,!0)},getTokenTypeAt:function(i){i=Tt(this.doc,i);var f=Ut(this,ze(this.doc,i.line)),k=0,K=(f.length-1)/2,Q=i.ch,ee;if(Q==0)ee=f[2];else for(;;){var re=k+K>>1;if((re?f[re*2-1]:0)>=Q)K=re;else if(f[re*2+1]<Q)k=re+1;else{ee=f[re*2+2];break}}var ve=ee?ee.indexOf("overlay "):-1;return ve<0?ee:ve==0?null:ee.slice(0,ve-1)},getModeAt:function(i){var f=this.doc.mode;return f.innerMode?e.innerMode(f,this.getTokenAt(i).state).mode:f},getHelper:function(i,f){return this.getHelpers(i,f)[0]},getHelpers:function(i,f){var k=[];if(!r.hasOwnProperty(f))return k;var K=r[f],Q=this.getModeAt(i);if(typeof Q[f]=="string")K[Q[f]]&&k.push(K[Q[f]]);else if(Q[f])for(var ee=0;ee<Q[f].length;ee++){var re=K[Q[f][ee]];re&&k.push(re)}else Q.helperType&&K[Q.helperType]?k.push(K[Q.helperType]):K[Q.name]&&k.push(K[Q.name]);for(var ve=0;ve<K._global.length;ve++){var Ee=K._global[ve];Ee.pred(Q,this)&&oe(k,Ee.val)==-1&&k.push(Ee.val)}return k},getStateAfter:function(i,f){var k=this.doc;return i=yn(k,i==null?k.first+k.size-1:i),Lt(this,i+1,f).state},cursorCoords:function(i,f){var k,K=this.doc.sel.primary();return i==null?k=K.head:typeof i=="object"?k=Tt(this.doc,i):k=i?K.from():K.to(),pi(this,k,f||"page")},charCoords:function(i,f){return ma(this,Tt(this.doc,i),f||"page")},coordsChar:function(i,f){return i=ls(this,i,f||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,f){return i=ls(this,{top:i,left:0},f||"page").top,et(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,f,k){var K=!1,Q;if(typeof i=="number"){var ee=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>ee&&(i=ee,K=!0),Q=ze(this.doc,i)}else Q=i;return Gr(this,Q,{top:0,left:0},f||"page",k||K).top+(K?this.doc.height-Fn(Q):0)},defaultTextHeight:function(){return tr(this.display)},defaultCharWidth:function(){return nr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,f,k,K,Q){var ee=this.display;i=pi(this,Tt(this.doc,i));var re=i.bottom,ve=i.left;if(f.style.position="absolute",f.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(f),ee.sizer.appendChild(f),K=="over")re=i.top;else if(K=="above"||K=="near"){var Ee=Math.max(ee.wrapper.clientHeight,this.doc.height),De=Math.max(ee.sizer.clientWidth,ee.lineSpace.clientWidth);(K=="above"||i.bottom+f.offsetHeight>Ee)&&i.top>f.offsetHeight?re=i.top-f.offsetHeight:i.bottom+f.offsetHeight<=Ee&&(re=i.bottom),ve+f.offsetWidth>De&&(ve=De-f.offsetWidth)}f.style.top=re+"px",f.style.left=f.style.right="",Q=="right"?(ve=ee.sizer.clientWidth-f.offsetWidth,f.style.right="0px"):(Q=="left"?ve=0:Q=="middle"&&(ve=(ee.sizer.clientWidth-f.offsetWidth)/2),f.style.left=ve+"px"),k&&Jo(this,{left:ve,top:re,right:ve+f.offsetWidth,bottom:re+f.offsetHeight})},triggerOnKeyDown:zn(po),triggerOnKeyPress:zn(go),triggerOnKeyUp:mo,triggerOnMouseDown:zn(vo),execCommand:function(i){if(Fr.hasOwnProperty(i))return Fr[i].call(null,this)},triggerElectric:zn(function(i){To(this,i)}),findPosH:function(i,f,k,K){var Q=1;f<0&&(Q=-1,f=-f);for(var ee=Tt(this.doc,i),re=0;re<f&&!(ee=Ka(this.doc,ee,Q,k,K),ee.hitSide);++re);return ee},moveH:zn(function(i,f){var k=this;this.extendSelectionsBy(function(K){return k.display.shift||k.doc.extend||K.empty()?Ka(k.doc,K.head,i,f,k.options.rtlMoveVisually):i<0?K.from():K.to()},Ce)}),deleteH:zn(function(i,f){var k=this.doc.sel,K=this.doc;k.somethingSelected()?K.replaceSelection("",null,"+delete"):dr(this,function(Q){var ee=Ka(K,Q.head,i,f,!1);return i<0?{from:ee,to:Q.head}:{from:Q.head,to:ee}})}),findPosV:function(i,f,k,K){var Q=1,ee=K;f<0&&(Q=-1,f=-f);for(var re=Tt(this.doc,i),ve=0;ve<f;++ve){var Ee=pi(this,re,"div");if(ee==null?ee=Ee.left:Ee.left=ee,re=Ro(this,Ee,Q,k),re.hitSide)break}return re},moveV:zn(function(i,f){var k=this,K=this.doc,Q=[],ee=!this.display.shift&&!K.extend&&K.sel.somethingSelected();if(K.extendSelectionsBy(function(ve){if(ee)return i<0?ve.from():ve.to();var Ee=pi(k,ve.head,"div");ve.goalColumn!=null&&(Ee.left=ve.goalColumn),Q.push(Ee.left);var De=Ro(k,Ee,i,f);return f=="page"&&ve==K.sel.primary()&&Sa(k,ma(k,De,"div").top-Ee.top),De},Ce),Q.length)for(var re=0;re<K.sel.ranges.length;re++)K.sel.ranges[re].goalColumn=Q[re]}),findWordAt:function(i){var f=this.doc,k=ze(f,i.line).text,K=i.ch,Q=i.ch;if(k){var ee=this.getHelper(i,"wordChars");(i.sticky=="before"||Q==k.length)&&K?--K:++Q;for(var re=k.charAt(K),ve=ke(re,ee)?function(Ee){return ke(Ee,ee)}:/\s/.test(re)?function(Ee){return/\s/.test(Ee)}:function(Ee){return!/\s/.test(Ee)&&!ke(Ee)};K>0&&ve(k.charAt(K-1));)--K;for(;Q<k.length&&ve(k.charAt(Q));)++Q}return new ln(Fe(i.line,K),Fe(i.line,Q))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:zn(function(i,f){xr(this,i,f)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-vi(this)-this.display.barHeight,width:i.scrollWidth-vi(this)-this.display.barWidth,clientHeight:da(this),clientWidth:Gi(this)}},scrollIntoView:zn(function(i,f){i==null?(i={from:this.doc.sel.primary().head,to:null},f==null&&(f=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Fe(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=f||0,i.from.line!=null?Qo(this,i):bs(this,i.from,i.to,i.margin)}),setSize:zn(function(i,f){var k=this,K=function(ee){return typeof ee=="number"||/^\d+$/.test(String(ee))?ee+"px":ee};i!=null&&(this.display.wrapper.style.width=K(i)),f!=null&&(this.display.wrapper.style.height=K(f)),this.options.lineWrapping&&as(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(ee){if(ee.widgets){for(var re=0;re<ee.widgets.length;re++)if(ee.widgets[re].noHScroll){Ii(k,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,ue(this,"refresh",this)}),operation:function(i){return ni(this,i)},startOperation:function(){return $i(this)},endOperation:function(){return Ji(this)},refresh:zn(function(){var i=this.display.cachedTextHeight;$n(this),this.curOp.forceUpdate=!0,_r(this),xr(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(i==null||Math.abs(i-tr(this.display))>.5||this.options.lineWrapping)&&Ea(this),ue(this,"refresh",this)}),swapDoc:zn(function(i){var f=this.doc;return f.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,i),_r(this),this.display.input.reset(),xr(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,Bn(this,"swapDoc",this,f),f}),phrase:function(i){var f=this.options.phrases;return f&&Object.prototype.hasOwnProperty.call(f,i)?f[i]:i},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}},he(e),e.registerHelper=function(i,f,k){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][f]=k},e.registerGlobalHelper=function(i,f,k,K){e.registerHelper(i,f,K),r[i]._global.push({pred:k,val:K})}}function Ka(e,t,r,i,f){var k=t,K=r,Q=ze(e,t.line),ee=f&&e.direction=="rtl"?-r:r;function re(){var mt=t.line+ee;return mt<e.first||mt>=e.first+e.size?!1:(t=new Fe(mt,t.ch,t.sticky),Q=ze(e,mt))}function ve(mt){var ot;if(i=="codepoint"){var _t=Q.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(_t)?ot=null:ot=new Fe(t.line,Math.max(0,Math.min(Q.text.length,t.ch+r*(_t>=55296&&_t<56320?2:1))),-r)}else f?ot=Pl(e.cm,Q,t,r):ot=Ua(Q,t,r);if(ot==null)if(!mt&&re())t=Ba(f,e.cm,Q,t.line,ee);else return!1;else t=ot;return!0}if(i=="char"||i=="codepoint")ve();else if(i=="column")ve(!0);else if(i=="word"||i=="group")for(var Ee=null,De=i=="group",Ie=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(r<0&&!ve(!je));je=!1){var Ge=Q.text.charAt(t.ch)||`
`,$e=ke(Ge,Ie)?"w":De&&Ge==`
`?"n":!De||/\s/.test(Ge)?null:"p";if(De&&!je&&!$e&&($e="s"),Ee&&Ee!=$e){r<0&&(r=1,ve(),t.sticky="after");break}if($e&&(Ee=$e),r>0&&!ve(!je))break}var st=ta(e,t,k,K,!0);return hn(k,st)&&(st.hitSide=!0),st}function Ro(e,t,r,i){var f=e.doc,k=t.left,K;if(i=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ee=Math.max(Q-.5*tr(e.display),3);K=(r>0?t.bottom:t.top)+r*ee}else i=="line"&&(K=r>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,k,K),!re.outside);){if(r<0?K<=0:K>=f.height){re.hitSide=!0;break}K+=r*5}return re}var dn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};dn.prototype.init=function(e){var t=this,r=this,i=r.cm,f=r.div=e.lineDiv;Co(f,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k(Q){for(var ee=Q.target;ee;ee=ee.parentNode){if(ee==f)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ee.className))break}return!1}Pe(f,"paste",function(Q){if(!k(Q)||q(i,Q)||wo(Q,i))return;W<=11&&setTimeout(kn(i,function(){return t.updateFromDOM()}),20)}),Pe(f,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Pe(f,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Pe(f,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(f,"touchstart",function(){return r.forceCompositionEnd()}),Pe(f,"input",function(){t.composing||t.readFromDOMSoon()});function K(Q){if(!k(Q)||q(i,Q))return;if(i.somethingSelected())oa({lineWise:!1,text:i.getSelections()}),Q.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var ee=So(i);oa({lineWise:!0,text:ee.text}),Q.type=="cut"&&i.operation(function(){i.setSelections(ee.ranges,0,be),i.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var re=gi.text.join(`
`);if(Q.clipboardData.setData("Text",re),Q.clipboardData.getData("Text")==re){Q.preventDefault();return}}var ve=Ao(),Ee=ve.firstChild;i.display.lineSpace.insertBefore(ve,i.display.lineSpace.firstChild),Ee.value=gi.text.join(`
`);var De=document.activeElement;U(Ee),setTimeout(function(){i.display.lineSpace.removeChild(ve),De.focus(),De==f&&r.showPrimarySelection()},50)}Pe(f,"copy",K),Pe(f,"cut",K)},dn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},dn.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},dn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},dn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},dn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),f=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||f.line<t.display.viewFrom){e.removeAllRanges();return}var k=la(t,e.anchorNode,e.anchorOffset),K=la(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&K&&!K.bad&&ht(cn(k,K),i)==0&&ht(bn(k,K),f)==0)return;var Q=t.display.view,ee=i.line>=t.display.viewFrom&&Oo(t,i)||{node:Q[0].measure.map[2],offset:0},re=f.line<t.display.viewTo&&Oo(t,f);if(!re){var ve=Q[Q.length-1].measure,Ee=ve.maps?ve.maps[ve.maps.length-1]:ve.map;re={node:Ee[Ee.length-1],offset:Ee[Ee.length-2]-Ee[Ee.length-3]}}if(!ee||!re){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),Ie;try{Ie=a(ee.node,ee.offset,re.offset,re.node)}catch(je){}Ie&&(!D&&t.state.focused?(e.collapse(ee.node,ee.offset),Ie.collapsed||(e.removeAllRanges(),e.addRange(Ie))):(e.removeAllRanges(),e.addRange(Ie)),De&&e.anchorNode==null?e.addRange(De):D&&this.startGracePeriod()),this.rememberSelection()},dn.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)},dn.prototype.showMultipleSelections=function(e){y(this.cm.display.cursorDiv,e.cursors),y(this.cm.display.selectionDiv,e.selection)},dn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},dn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},dn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},dn.prototype.blur=function(){this.div.blur()},dn.prototype.getField=function(){return this.div},dn.prototype.supportsTouch=function(){return!0},dn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ni(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)},dn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},dn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&b&&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=la(t,e.anchorNode,e.anchorOffset),i=la(t,e.focusNode,e.focusOffset);r&&i&&ni(t,function(){Wn(t.doc,ki(r,i),be),(r.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},dn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),i=r.from(),f=r.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Fe(i.line-1,ze(e.doc,i.line-1).length)),f.ch==ze(e.doc,f.line).text.length&&f.line<e.lastLine()&&(f=Fe(f.line+1,0)),i.line<t.viewFrom||f.line>t.viewTo-1)return!1;var k,K,Q;i.line==t.viewFrom||(k=Vi(e,i.line))==0?(K=at(t.view[0].line),Q=t.view[0].node):(K=at(t.view[k].line),Q=t.view[k-1].node.nextSibling);var ee=Vi(e,f.line),re,ve;if(ee==t.view.length-1?(re=t.viewTo-1,ve=t.lineDiv.lastChild):(re=at(t.view[ee+1].line)-1,ve=t.view[ee+1].node.previousSibling),!Q)return!1;for(var Ee=e.doc.splitLines(tu(e,Q,ve,K,re)),De=kt(e.doc,Fe(K,0),Fe(re,ze(e.doc,re).text.length));Ee.length>1&&De.length>1;)if(I(Ee)==I(De))Ee.pop(),De.pop(),re--;else if(Ee[0]==De[0])Ee.shift(),De.shift(),K++;else break;for(var Ie=0,je=0,Ge=Ee[0],$e=De[0],st=Math.min(Ge.length,$e.length);Ie<st&&Ge.charCodeAt(Ie)==$e.charCodeAt(Ie);)++Ie;for(var mt=I(Ee),ot=I(De),_t=Math.min(mt.length-(Ee.length==1?Ie:0),ot.length-(De.length==1?Ie:0));je<_t&&mt.charCodeAt(mt.length-je-1)==ot.charCodeAt(ot.length-je-1);)++je;if(Ee.length==1&&De.length==1&&K==i.line)for(;Ie&&Ie>i.ch&&mt.charCodeAt(mt.length-je-1)==ot.charCodeAt(ot.length-je-1);)Ie--,je++;Ee[Ee.length-1]=mt.slice(0,mt.length-je).replace(/^\u200b+/,""),Ee[0]=Ee[0].slice(Ie).replace(/\u200b+$/,"");var Nt=Fe(K,Ie),It=Fe(re,De.length?I(De).length-je:0);if(Ee.length>1||Ee[0]||ht(Nt,It))return ur(e.doc,Ee,Nt,It,"+input"),!0},dn.prototype.ensurePolled=function(){this.forceCompositionEnd()},dn.prototype.reset=function(){this.forceCompositionEnd()},dn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},dn.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)},dn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ni(this.cm,function(){return $n(e.cm)})},dn.prototype.setUneditable=function(e){e.contentEditable="false"},dn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||kn(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},dn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},dn.prototype.onContextMenu=function(){},dn.prototype.resetPosition=function(){},dn.prototype.needsContentAttribute=!0;function Oo(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=ze(e.doc,t.line),f=es(r,i,t.line),k=Je(i,e.doc.direction),K="left";if(k){var Q=Xe(k,t.ch);K=Q%2?"right":"left"}var ee=is(f.map,t.ch,K);return ee.offset=ee.collapse=="right"?ee.end:ee.start,ee}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function pr(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,f){var k="",K=!1,Q=e.doc.lineSeparator(),ee=!1;function re(Ie){return function(je){return je.id==Ie}}function ve(){K&&(k+=Q,ee&&(k+=Q),K=ee=!1)}function Ee(Ie){Ie&&(ve(),k+=Ie)}function De(Ie){if(Ie.nodeType==1){var je=Ie.getAttribute("cm-text");if(je){Ee(je);return}var Ge=Ie.getAttribute("cm-marker"),$e;if(Ge){var st=e.findMarks(Fe(i,0),Fe(f+1,0),re(+Ge));st.length&&($e=st[0].find(0))&&Ee(kt(e.doc,$e.from,$e.to).join(Q));return}if(Ie.getAttribute("contenteditable")=="false")return;var mt=/^(pre|div|p|li|table|br)$/i.test(Ie.nodeName);if(!/^br$/i.test(Ie.nodeName)&&Ie.textContent.length==0)return;mt&&ve();for(var ot=0;ot<Ie.childNodes.length;ot++)De(Ie.childNodes[ot]);/^(pre|p)$/i.test(Ie.nodeName)&&(ee=!0),mt&&(K=!0)}else Ie.nodeType==3&&Ee(Ie.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==r);)t=t.nextSibling,ee=!1;return k}function la(e,t,r){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[r],!i)return pr(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,r=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var f=0;f<e.display.view.length;f++){var k=e.display.view[f];if(k.node==i)return nu(k,t,r)}}function nu(e,t,r){var i=e.text.firstChild,f=!1;if(!t||!_(i,t))return pr(Fe(at(e.line),0),!0);if(t==i&&(f=!0,t=i.childNodes[r],r=0,!t)){var k=e.rest?I(e.rest):e.line;return pr(Fe(at(k),k.text.length),f)}var K=t.nodeType==3?t:null,Q=t;for(!K&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(K=t.firstChild,r&&(r=K.nodeValue.length));Q.parentNode!=i;)Q=Q.parentNode;var ee=e.measure,re=ee.maps;function ve($e,st,mt){for(var ot=-1;ot<(re?re.length:0);ot++)for(var _t=ot<0?ee.map:re[ot],Nt=0;Nt<_t.length;Nt+=3){var It=_t[Nt+2];if(It==$e||It==st){var Jt=at(ot<0?e.line:e.rest[ot]),gn=_t[Nt]+mt;return(mt<0||It!=$e)&&(gn=_t[Nt+(mt?1:0)]),Fe(Jt,gn)}}}var Ee=ve(K,Q,r);if(Ee)return pr(Ee,f);for(var De=Q.nextSibling,Ie=K?K.nodeValue.length-r:0;De;De=De.nextSibling){if(Ee=ve(De,De.firstChild,0),Ee)return pr(Fe(Ee.line,Ee.ch-Ie),f);Ie+=De.textContent.length}for(var je=Q.previousSibling,Ge=r;je;je=je.previousSibling){if(Ee=ve(je,je.firstChild,-1),Ee)return pr(Fe(Ee.line,Ee.ch+Ge),f);Ge+=je.textContent.length}}var Rn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Z,this.hasSelection=!1,this.composing=null};Rn.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var f=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),p&&(f.style.width="0px"),Pe(f,"input",function(){G&&W>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Pe(f,"paste",function(K){if(q(i,K)||wo(K,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function k(K){if(q(i,K))return;if(i.somethingSelected())oa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Q=So(i);oa({lineWise:!0,text:Q.text}),K.type=="cut"?i.setSelections(Q.ranges,null,be):(r.prevInput="",f.value=Q.text.join(`
`),U(f))}else return;K.type=="cut"&&(i.state.cutIncoming=+new Date)}Pe(f,"cut",k),Pe(f,"copy",k),Pe(e.scroller,"paste",function(K){if(wi(e,K)||q(i,K))return;if(!f.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var Q=new Event("paste");Q.clipboardData=K.clipboardData,f.dispatchEvent(Q)}),Pe(e.lineSpace,"selectstart",function(K){wi(e,K)||ie(K)}),Pe(f,"compositionstart",function(){var K=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:K,range:i.markText(K,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Pe(f,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Rn.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Rn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Rn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var f=pi(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),K=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,f.top+K.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,f.left+K.left-k.left))}return i},Rn.prototype.showSelection=function(e){var t=this.cm,r=t.display;y(r.cursorDiv,e.cursors),y(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Rn.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&&U(this.textarea),G&&W>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",G&&W>=9&&(this.hasSelection=null))},Rn.prototype.getField=function(){return this.textarea},Rn.prototype.supportsTouch=function(){return!1},Rn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!h||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},Rn.prototype.blur=function(){this.textarea.blur()},Rn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Rn.prototype.receivedFocus=function(){this.slowPoll()},Rn.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()})},Rn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Rn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ue(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var f=r.value;if(f==i&&!t.somethingSelected())return!1;if(G&&W>=9&&this.hasSelection===f||o&&/[\uf700-\uf7ff]/.test(f))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=f.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var K=0,Q=Math.min(i.length,f.length);K<Q&&i.charCodeAt(K)==f.charCodeAt(K);)++K;return ni(t,function(){za(t,f.slice(K),i.length-K,null,e.composing?"*compose":null),f.length>1e3||f.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=f,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Rn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Rn.prototype.onKeyPress=function(){G&&W>=9&&(this.hasSelection=null),this.fastPoll()},Rn.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,f=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Ki(r,e),K=i.scroller.scrollTop;if(!k||m)return;var Q=r.options.resetSelectionOnContextMenu;Q&&r.doc.sel.contains(k)==-1&&kn(r,Wn)(r.doc,ki(k),be);var ee=f.style.cssText,re=t.wrapper.style.cssText,ve=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",f.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ve.top-5)+"px; left: "+(e.clientX-ve.left-5)+`px;
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Ee;n&&(Ee=window.scrollY),i.input.focus(),n&&window.scrollTo(null,Ee),i.input.reset(),r.somethingSelected()||(f.value=t.prevInput=" "),t.contextMenuPending=Ie,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function De(){if(f.selectionStart!=null){var Ge=r.somethingSelected(),$e="\u200B"+(Ge?f.value:"");f.value="\u21DA",f.value=$e,t.prevInput=Ge?"":"\u200B",f.selectionStart=1,f.selectionEnd=$e.length,i.selForContextMenu=r.doc.sel}}function Ie(){if(t.contextMenuPending!=Ie)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,f.style.cssText=ee,G&&W<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=K),f.selectionStart!=null){(!G||G&&W<9)&&De();var Ge=0,$e=function(){i.selForContextMenu==r.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&t.prevInput=="\u200B"?kn(r,Vs)(r):Ge++<10?i.detectingSelectAll=setTimeout($e,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout($e,200)}}if(G&&W>=9&&De(),O){pe(e);var je=function(){ut(window,"mouseup",je),setTimeout(Ie,20)};Pe(window,"mouseup",je)}else setTimeout(Ie,50)},Rn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Rn.prototype.setUneditable=function(){},Rn.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?E(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=N();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=Q.getValue()}var f;if(e.form&&(Pe(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;f=k.submit;try{var K=k.submit=function(){i(),k.submit=f,k.submit(),k.submit=K}}catch(ee){}}t.finishInit=function(ee){ee.save=i,ee.getTextArea=function(){return e},ee.toTextArea=function(){ee.toTextArea=isNaN,i(),e.parentNode.removeChild(ee.getWrapperElement()),e.style.display="",e.form&&(ut(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var Q=En(function(ee){return e.parentNode.insertBefore(ee,e.nextSibling)},t);return Q}function ru(e){e.off=ut,e.on=Pe,e.wheelEventPixels=cl,e.Doc=Jn,e.splitLines=Ve,e.countColumn=H,e.findColumn=_e,e.isWordChar=Oe,e.Pass=Te,e.signal=ue,e.Line=Ei,e.changeEnd=Pi,e.scrollbarModel=xs,e.Pos=Fe,e.cmpPos=ht,e.modes=Yt,e.mimeModes=yt,e.resolveMode=Me,e.getMode=un,e.modeExtensions=ft,e.extendMode=wt,e.copyState=it,e.startState=tn,e.innerMode=Ft,e.commands=Fr,e.keyMap=Ti,e.keyName=lo,e.isModifierKey=so,e.lookupKey=cr,e.normalizeKeyMap=kl,e.StringStream=Dt,e.SharedTextMarker=Pr,e.TextMarker=Ni,e.LineWidget=kr,e.e_preventDefault=ie,e.e_stopPropagation=ae,e.e_stop=pe,e.addClass=B,e.contains=_,e.rmClass=C,e.keyNames=Fi}$l(En),ql(En);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Jn.prototype)Jn.prototype.hasOwnProperty(ua)&&oe(au,ua)<0&&(En.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Jn.prototype[ua]));return he(Jn),En.inputStyles={textarea:Rn,contenteditable:dn},En.defineMode=function(e){!En.defaults.mode&&e!="null"&&(En.defaults.mode=e),Qe.apply(this,arguments)},En.defineMIME=xn,En.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),En.defineMIME("text/plain","null"),En.defineExtension=function(e,t){En.prototype[e]=t},En.defineDocExtension=function(e,t){Jn.prototype[e]=t},En.fromTextArea=iu,ru(En),En.version="5.58.2",En})},Y1PL:function(rt,we,$){"use strict";$.r(we),$.d(we,"ResizableTextArea",function(){return oe});var le=$("wx14"),X=$("1OyB"),D=$("vuIU"),Y=$("Ji7U"),j=$("LK+K"),P=$("q1tI"),G=$("VTBJ"),W=$("rePB"),n=$("Zm9Q"),L=$("Kwbf"),b=$("c+Xe"),m=$("m+aA"),g=$("bdgK"),c=new Map;function d(be){be.forEach(function(Ae){var Ce,_e=Ae.target;(Ce=c.get(_e))===null||Ce===void 0||Ce.forEach(function(ge){return ge(_e)})})}var p=new g.default(d),l=null,h=null;function o(be,Ae){c.has(be)||(c.set(be,new Set),p.observe(be)),c.get(be).add(Ae)}function s(be,Ae){c.has(be)&&(c.get(be).delete(Ae),c.get(be).size||(p.unobserve(be),c.delete(be)))}var A=function(be){Object(Y.a)(Ce,be);var Ae=Object(j.a)(Ce);function Ce(){return Object(X.a)(this,Ce),Ae.apply(this,arguments)}return Object(D.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(P.Component),x=P.createContext(null);function S(be){var Ae=be.children,Ce=be.onBatchResize,_e=P.useRef(0),ge=P.useRef([]),V=P.useContext(x),I=P.useCallback(function(F,J,ne){_e.current+=1;var z=_e.current;ge.current.push({size:F,element:J,data:ne}),Promise.resolve().then(function(){z===_e.current&&(Ce==null||Ce(ge.current),ge.current=[])}),V==null||V(F,J,ne)},[Ce,V]);return P.createElement(x.Provider,{value:I},Ae)}function O(be){var Ae=be.children,Ce=be.disabled,_e=P.useRef(null),ge=P.useRef(null),V=P.useContext(x),I=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),F=P.isValidElement(Ae)&&Object(b.c)(Ae),J=F?Ae.ref:null,ne=P.useMemo(function(){return Object(b.a)(J,_e)},[J,_e]),z=P.useRef(be);z.current=be;var me=P.useCallback(function(Oe){var ke=z.current,ce=ke.onResize,ye=ke.data,Se=Oe.getBoundingClientRect(),Le=Se.width,Be=Se.height,We=Oe.offsetWidth,Ke=Oe.offsetHeight,Xe=Math.floor(Le),lt=Math.floor(Be);if(I.current.width!==Xe||I.current.height!==lt||I.current.offsetWidth!==We||I.current.offsetHeight!==Ke){var Je={width:Xe,height:lt,offsetWidth:We,offsetHeight:Ke};I.current=Je;var qe=We===Math.round(Le)?Le:We,Pe=Ke===Math.round(Be)?Be:Ke,pt=Object(G.a)(Object(G.a)({},Je),{},{offsetWidth:qe,offsetHeight:Pe});V==null||V(pt,Oe,ye),ce&&Promise.resolve().then(function(){ce(pt,Oe)})}},[]);return P.useEffect(function(){var Oe=Object(m.a)(_e.current)||Object(m.a)(ge.current);return Oe&&!Ce&&o(Oe,me),function(){return s(Oe,me)}},[_e.current,Ce]),P.createElement(A,{ref:ge},F?P.cloneElement(Ae,{ref:ne}):Ae)}var R="rc-observer-key";function C(be){var Ae=be.children,Ce=Object(n.a)(Ae);return Ce.map(function(_e,ge){var V=(_e==null?void 0:_e.key)||"".concat(R,"-").concat(ge);return P.createElement(O,Object(le.a)({},be,{key:V}),_e)})}C.Collection=S;var w=C,y=$("bT9E"),u=$("TSYQ"),v=$.n(u),a=`
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"],N={},B;function T(be){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Ae&&N[Ce])return N[Ce];var _e=window.getComputedStyle(be),ge=_e.getPropertyValue("box-sizing")||_e.getPropertyValue("-moz-box-sizing")||_e.getPropertyValue("-webkit-box-sizing"),V=parseFloat(_e.getPropertyValue("padding-bottom"))+parseFloat(_e.getPropertyValue("padding-top")),I=parseFloat(_e.getPropertyValue("border-bottom-width"))+parseFloat(_e.getPropertyValue("border-top-width")),F=_.map(function(ne){return"".concat(ne,":").concat(_e.getPropertyValue(ne))}).join(";"),J={sizingStyle:F,paddingSize:V,borderSize:I,boxSizing:ge};return Ae&&Ce&&(N[Ce]=J),J}function U(be){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),be.getAttribute("wrap")?B.setAttribute("wrap",be.getAttribute("wrap")):B.removeAttribute("wrap");var ge=T(be,Ae),V=ge.paddingSize,I=ge.borderSize,F=ge.boxSizing,J=ge.sizingStyle;B.setAttribute("style","".concat(J,";").concat(a)),B.value=be.value||be.placeholder||"";var ne=Number.MIN_SAFE_INTEGER,z=Number.MAX_SAFE_INTEGER,me=B.scrollHeight,Oe;if(F==="border-box"?me+=I:F==="content-box"&&(me-=V),Ce!==null||_e!==null){B.value=" ";var ke=B.scrollHeight-V;Ce!==null&&(ne=ke*Ce,F==="border-box"&&(ne=ne+V+I),me=Math.max(ne,me)),_e!==null&&(z=ke*_e,F==="border-box"&&(z=z+V+I),Oe=me>z?"":"hidden",me=Math.min(z,me))}return{height:me,minHeight:ne,maxHeight:z,overflowY:Oe,resize:"none"}}var M=$("Gytx"),E=$.n(M),H;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(H||(H={}));var Z=function(be){Object(Y.a)(Ce,be);var Ae=Object(j.a)(Ce);function Ce(_e){var ge;return Object(X.a)(this,Ce),ge=Ae.call(this,_e),ge.nextFrameActionId=void 0,ge.resizeFrameId=void 0,ge.textArea=void 0,ge.saveTextArea=function(V){ge.textArea=V},ge.handleResize=function(V){var I=ge.state.resizeStatus,F=ge.props,J=F.autoSize,ne=F.onResize;if(I!==H.NONE)return;typeof ne=="function"&&ne(V),J&&ge.resizeOnNextFrame()},ge.resizeOnNextFrame=function(){cancelAnimationFrame(ge.nextFrameActionId),ge.nextFrameActionId=requestAnimationFrame(ge.resizeTextarea)},ge.resizeTextarea=function(){var V=ge.props.autoSize;if(!V||!ge.textArea)return;var I=V.minRows,F=V.maxRows,J=U(ge.textArea,!1,I,F);ge.setState({textareaStyles:J,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ge.resizeFrameId),ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:H.RESIZED},function(){ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:H.NONE}),ge.fixFirefoxAutoScroll()})})})})},ge.renderTextArea=function(){var V=ge.props,I=V.prefixCls,F=I===void 0?"rc-textarea":I,J=V.autoSize,ne=V.onResize,z=V.className,me=V.disabled,Oe=ge.state,ke=Oe.textareaStyles,ce=Oe.resizeStatus,ye=Object(y.a)(ge.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Se=v()(F,z,Object(W.a)({},"".concat(F,"-disabled"),me));"value"in ye&&(ye.value=ye.value||"");var Le=Object(G.a)(Object(G.a)(Object(G.a)({},ge.props.style),ke),ce===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(w,{onResize:ge.handleResize,disabled:!(J||ne)},P.createElement("textarea",Object(le.a)({},ye,{className:Se,style:Le,ref:ge.saveTextArea})))},ge.state={textareaStyles:{},resizeStatus:H.NONE},ge}return Object(D.a)(Ce,[{key:"componentDidUpdate",value:function(ge){(ge.value!==this.props.value||!E()(ge.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 ge=this.textArea.selectionStart,V=this.textArea.selectionEnd;this.textArea.setSelectionRange(ge,V)}}catch(I){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(P.Component),oe=Z,de=function(be){Object(Y.a)(Ce,be);var Ae=Object(j.a)(Ce);function Ce(_e){var ge;Object(X.a)(this,Ce),ge=Ae.call(this,_e),ge.resizableTextArea=void 0,ge.focus=function(){ge.resizableTextArea.textArea.focus()},ge.saveTextArea=function(I){ge.resizableTextArea=I},ge.handleChange=function(I){var F=ge.props.onChange;ge.setValue(I.target.value,function(){ge.resizableTextArea.resizeTextarea()}),F&&F(I)},ge.handleKeyDown=function(I){var F=ge.props,J=F.onPressEnter,ne=F.onKeyDown;I.keyCode===13&&J&&J(I),ne&&ne(I)};var V=typeof _e.value=="undefined"||_e.value===null?_e.defaultValue:_e.value;return ge.state={value:V},ge}return Object(D.a)(Ce,[{key:"setValue",value:function(ge,V){"value"in this.props||this.setState({value:ge},V)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ge){return"value"in ge?{value:ge.value}:null}}]),Ce}(P.Component),Te=we.default=de},ZW9T:function(rt,we,$){"use strict";$.d(we,"a",function(){return M});var le=$("k1fw"),X=$("oBTY"),D=$("miYZ"),Y=$("tsqr"),j=$("rAM+"),P=$("tJVT"),G=$("PpiC"),W=$("q1tI"),n=$.n(W),L=$("bdgK"),b=$("9og8"),m=$("WmNS"),g=$.n(m),c={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},d={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},p={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},h=$("5VLF"),o=$.n(h),s={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},A=function(H,Z){return Z.map(function(oe){return{label:oe,kind:H.languages.CompletionItemKind.Keyword,insertText:oe}})},x=function(H){return Object.keys(s.tables).map(function(Z){return{label:Z,kind:H.languages.CompletionItemKind.Variable,insertText:Z}})},S=function(H,Z){var oe=s.tables[H];return oe?oe.map(function(de){return{label:de,kind:Z.languages.CompletionItemKind.Field,insertText:de}}):[]};function O(E,H,Z,oe,de){var Te=H.getWordUntilPosition(Z),be={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:Te.startColumn,endColumn:Te.endColumn},Ae=oe.map(function(Ce){return{label:Ce,kind:E.languages.CompletionItemKind.Keyword,insertText:Ce,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:be}});return de.map(function(Ce){Ae.push(Object(le.a)(Object(le.a)({},Ce),{},{range:be}))}),Ae}var R=function(E){s.languages.map(function(de){return E.languages.registerDocumentFormattingEditProvider(de,{provideDocumentFormattingEdits:function(be,Ae,Ce){return Object(b.a)(g.a.mark(function _e(){var ge;return g.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return ge=o()(be.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),I.abrupt("return",[{range:be.getFullModelRange(),text:ge}]);case 2:case"end":return I.stop()}},_e)}))()}}),de});var H=p.quickKey.map(function(de){return{label:de.label,kind:E.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Z=l.quickKey.map(function(de){return{label:de.label,kind:E.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),oe=d.quickKey.map(function(de){return{label:de.label,kind:E.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet}});E.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(Te,be){var Ae=Te.getWordUntilPosition(be),Ce={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},_e=Te.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(X.a)(p.keywords.map(function(ge){return{label:ge,kind:E.languages.CompletionItemKind.Function,documentation:ge,insertText:ge,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})),Object(X.a)(p.quickKey.map(function(ge){return{label:ge.label,kind:E.languages.CompletionItemKind.Function,documentation:ge.content,insertText:_e.startsWith("#")?ge.content.replace(/#/,""):ge.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})))}}}),E.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(Te,be){var Ae=Te.getWordUntilPosition(be),Ce={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn};return{suggestions:Object(X.a)(c.keywords.map(function(_e){return{label:_e,kind:E.languages.CompletionItemKind.Function,documentation:_e,insertText:_e,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}}))}}}),E.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(Te,be){var Ae=Te.getWordUntilPosition(be),Ce={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},_e=Te.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(X.a)(d.keywords.map(function(ge){return{label:ge,kind:E.languages.CompletionItemKind.Function,documentation:ge,insertText:ge,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})),Object(X.a)(d.quickKey.map(function(ge){return{label:ge.label,kind:E.languages.CompletionItemKind.Function,documentation:ge.content,insertText:_e.startsWith("#")?ge.content.replace(/#/,""):ge.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})))}}}),E.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(Te,be){var Ae=Te.getWordUntilPosition(be),Ce={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:Ae.startColumn,endColumn:Ae.endColumn},_e=Te.getLineContent(be.lineNumber).substring(Ae.startColumn-2,Ae.endColumn);return{suggestions:[].concat(Object(X.a)(l.keywords.map(function(ge){return{label:ge,kind:E.languages.CompletionItemKind.Function,documentation:ge,insertText:ge,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})),Object(X.a)(l.quickKey.map(function(ge){return{label:ge.label,kind:E.languages.CompletionItemKind.Function,documentation:ge.content,insertText:_e.startsWith("#")?ge.content.replace(/#/,""):ge.content,insertTextRules:E.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ce}})))}}})},C="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",w=$("fjLI"),y=$("LvDl"),u=$("+ua5");function v(E){return/^\d+$/.test(E)?"".concat(E,"px"):E}function a(){}var _=!1,N={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function B(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],H=E;if(Array.isArray(E)){for(var Z=0;Z<E.length;Z++){var oe=N[E[Z]];if(oe)return oe}return H[0]}return N[H]||H}var T=null,U=we.b=function(E){var H=E.width,Z=H===void 0?"100%":H,oe=E.height,de=oe===void 0?"100%":oe,Te=E.value,be=E.language,Ae=be===void 0?"javascript":be,Ce=E.style,_e=Ce===void 0?{}:Ce,ge=E.options,V=ge===void 0?{}:ge,I=E.overrideServices,F=I===void 0?{}:I,J=E.theme,ne=J===void 0?"vs-dark":J,z=E.onEditBlur,me=E.onSave,Oe=E.autoHeight,ke=Oe===void 0?!1:Oe,ce=E.forbidCopy,ye=ce===void 0?!1:ce,Se=E.onChange,Le=Se===void 0?a:Se,Be=E.editorDidMount,We=Be===void 0?a:Be,Ke=E.onFocus,Xe=Ke===void 0?a:Ke,lt=E.filename,Je=lt===void 0?"educoder.txt":lt,qe=E.errorLine,Pe=E.errorContent,pt=Pe===void 0?"":Pe,ut=Object(G.a)(E,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),ue=Object(W.useRef)(),q=Object(W.useRef)({}),te=Object(W.useRef)(),se=Object(W.useRef)(),he=Object(W.useRef)(!1),ie=Object(W.useRef)(),ae=Object(W.useState)(!1),fe=Object(P.a)(ae,2),pe=fe[0],xe=fe[1];function Re(){var ft;return ue.current&&(ft=new L.default(function(wt){var it=Object(j.a)(wt),Ft;try{for(it.s();!(Ft=it.n()).done;){var tn=Ft.value;(tn.target.offsetHeight>0||tn.target.offsetWidth>0)&&q.current.instance.layout()}}catch(Dt){it.e(Dt)}finally{it.f()}}),ft.observe(ue.current)),ft}function Ne(){Y.b.warn(decodeURIComponent(C))}var Ye=function(){var wt=q.current.instance;if(Te!=null&&wt&&pe){var it=wt.getModel();it&&Te!==it.getValue()&&(_=!0,it.setValue(Te),wt.layout(),_=!1)}};Object(W.useEffect)(function(){se.current&&clearTimeout(se.current),se.current=setTimeout(function(){Ye()},500)},[Te,pe,q.current]),Object(W.useEffect)(function(){if(qe&&q.current&&q.current.instance){var ft=q.current.instance;ft.changeViewZones(function(it){var Ft=document.createElement("div");Ft.style.padding="10px 20px",Ft.style.width="calc(100% - 20px)",Ft.className="my-error-line-wrp",Ft.innerHTML=pt,it.addZone({afterLineNumber:qe||11,heightInLines:3,domNode:Ft})});var wt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};ft.addOverlayWidget(wt),ft.revealPositionInCenter({lineNumber:20,column:1})}},[qe,q.current,pe]);function dt(){var ft=q.current.instance;if(ft){var wt=ft.getSelection(),it=q.current.pastePos||{},Ft=new T.Range(it.startLineNumber||wt.endLineNumber,it.startColumn||wt.endColumn,it.endLineNumber||wt.endLineNumber,it.endColumn||wt.endColumn);setTimeout(function(){ft.executeEdits("",[{range:Ft,text:""}])},300)}}function gt(ft){(window.navigator.platform.match("Mac")?ft.metaKey:ft.ctrlKey)&&ft.keyCode==83&&(ft.preventDefault(),me())}var Kt=function(){if(ke&&q.current.instance){var wt=q.current.instance.getContentHeight();Me(wt<de?de:wt)}else Me(de)};function Ve(ft){var wt=document.createEvent("MouseEvents");wt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ft.dispatchEvent(wt)}function Ue(ft,wt){var it=window.URL||window.webkitURL||window,Ft=new Blob([wt]),tn=document.createElementNS("http://www.w3.org/1999/xhtml","a");tn.href=it.createObjectURL(Ft),tn.download=ft,Ve(tn)}Object(W.useEffect)(function(){Kt()},[Kt]),Object(W.useEffect)(function(){ue.current&&!pe&&Promise.all([$.e(18),$.e(29)]).then($.t.bind(null,"M/lh",7)).then(function(ft){try{T=ft,q.current.instance=T.editor.create(ue.current,{value:Te,language:B(Ae),theme:ne,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},F);var wt=q.current.instance,it=w.d._menuItems,Ft=Object(X.a)(it).find(function(Ot){return Ot[0]._debugName=="EditorContext"}),tn=Ft[1],Dt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],ze=function(nt,at){var et=nt._first;do{var Vt,Bt,Fe=at.includes((Vt=et.element)===null||Vt===void 0||((Bt=Vt.command)===null||Bt===void 0)?void 0:Bt.id);Fe&&nt._remove(et)}while(et=et.next)};if(We(wt,T),setTimeout(function(){Kt(),q.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ue(Je||"educoder.txt",wt.getValue())}}),wt.getDomNode().addEventListener("input",function(){te.current.autoFormat&&wt.getAction("editor.action.formatDocument").run()})},500),q.current.subscription=wt.onDidChangeModelContent(function(Ot){he.current?clearTimeout(ie.current):(Kt(),Le(wt.getValue(),Ot)),ie.current=setTimeout(function(){he.current=!1},500)}),window.Monaco||R(T,B(Ae)),ye&&(ze(tn,Dt),ue.current.classList.add("noCopyPaste"),wt.onKeyDown(function(Ot){var nt=Ot.keyCode,at=Ot.ctrlKey,et=Ot.metaKey;(nt===33||nt===52)&&(et||at)&&(Ne(),Ot.preventDefault())})),window.Monaco=T,z&&wt.onDidBlurEditorWidget(function(){z(wt.getValue())}),Xe&&wt.onDidFocusEditorText(function(){Xe(wt.getValue())}),ye){wt.addCommand(T.KeyMod.CtrlCmd|T.KeyCode.KEY_V,function(){return Ne(),null}),wt.onDidPaste(function(Ot){q.current.pastePos=Ot});try{window.addEventListener("paste",dt)}catch(Ot){}}var kt=Re();return xe(!0),function(){var Ot=q.current.instance;Ot.dispose();var nt=Ot.getModel();nt&&nt.dispose(),q.current.subscription&&q.current.subscription.dispose(),ye&&window.removeEventListener("paste",dt),kt.unobserve(ue.current)}}catch(Ot){}})},[]),Object(W.useEffect)(function(){var ft=q.current.instance;if(ft&&pe)return document.addEventListener("keydown",gt,!1),function(){document.removeEventListener("keydown",gt)}},[me,pe]),Object(W.useEffect)(function(){var ft=q.current.instance;if(ft&&pe){var wt=B(Ae);T.editor.setModelLanguage(ft.getModel(),wt),console.log("language:",Ae,ft.getModel(),wt)}},[Ae,pe]),Object(W.useEffect)(function(){var ft=q.current.instance;ft&&pe&&T.editor.setTheme(ne)},[ne,pe]),Object(W.useEffect)(function(){var ft=q.current.instance;te.current=V,ft&&pe&&(ft.updateOptions(Object(le.a)({},V)),setTimeout(function(){ft.getModel().updateOptions(Object(le.a)({},V))},200))},[JSON.stringify(V),pe]),Object(W.useEffect)(function(){var ft=q.current.instance;ft&&pe&&ft.layout()},[Z,de,pe]);var Et=Object(W.useState)(v(Z)),vt=Object(P.a)(Et,2),qt=vt[0],Yt=vt[1],yt=Object(W.useState)(v(de)),Qe=Object(P.a)(yt,2),xn=Qe[0],Me=Qe[1],un=Object(le.a)(Object(le.a)({},_e),{},{width:qt,height:xn});return n.a.createElement("div",{className:"my-monaco-editor",ref:ue,style:un})};function M(E){var H=E.width,Z=H===void 0?"100%":H,oe=E.height,de=oe===void 0?"100%":oe,Te=E.original,be=E.modified,Ae=E.language,Ce=E.options,_e=Ce===void 0?{}:Ce,ge=Object(W.useRef)(),V=Object(W.useState)(null),I=Object(P.a)(V,2),F=I[0],J=I[1];function ne(ke){var ce;return ge.current&&(ce=new L.default(function(ye){var Se=Object(j.a)(ye),Le;try{for(Se.s();!(Le=Se.n()).done;){var Be=Le.value;(Be.target.offsetHeight>0||Be.target.offsetWidth>0)&&ke.layout()}}catch(We){Se.e(We)}finally{Se.f()}}),ce.observe(ge.current)),ce}Object(W.useEffect)(function(){ge.current&&Promise.all([$.e(18),$.e(29)]).then($.t.bind(null,"M/lh",7)).then(function(ke){T=ke;var ce=T.editor.createDiffEditor(ge.current,Object(le.a)(Object(le.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},_e),{},{wordWrap:!0}));J(ce);var ye=ne(ce);return function(){ce.dispose();var Se=ce.getModel();Se&&Se.dispose(),ye.unobserve(ge.current)}})},[]),Object(W.useEffect)(function(){F&&F.setModel({original:T.editor.createModel(Te,Ae),modified:T.editor.createModel(be,Ae)})},[Te,be,Ae,F]);var z=v(Z),me=v(de),Oe={width:z,height:me};return n.a.createElement("div",{className:"my-diff-editor",ref:ge,style:Oe})}},bT9E:function(rt,we,$){"use strict";$.d(we,"a",function(){return X});var le=$("VTBJ");function X(D,Y){var j=Object(le.a)({},D);return Array.isArray(Y)&&Y.forEach(function(P){delete j[P]}),j}},c5Ni:function(rt,we,$){},dejd:function(rt,we,$){},dmUQ:function(rt,we,$){"use strict";var le=$("Ff2n"),X=$("rePB"),D=$("1OyB"),Y=$("vuIU"),j=$("Ji7U"),P=$("md7G"),G=$("foSv"),W=$("q1tI"),n=$.n(W),L=$("TSYQ"),b=$.n(L),m=$("4IlW");function g(y,u){var v=Object.keys(y);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(y);u&&(a=a.filter(function(_){return Object.getOwnPropertyDescriptor(y,_).enumerable})),v.push.apply(v,a)}return v}function c(y){for(var u=1;u<arguments.length;u++){var v=arguments[u]!=null?arguments[u]:{};u%2?g(Object(v),!0).forEach(function(a){Object(X.a)(y,a,v[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(v)):g(Object(v)).forEach(function(a){Object.defineProperty(y,a,Object.getOwnPropertyDescriptor(v,a))})}return y}function d(y){var u=p();return function(){var a=Object(G.a)(y),_;if(u){var N=Object(G.a)(this).constructor;_=Reflect.construct(a,arguments,N)}else _=a.apply(this,arguments);return Object(P.a)(this,_)}}function p(){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(y){return!1}}function l(){}function h(y){y.preventDefault()}var o=function(u){return u.replace(/[^\w.-]+/g,"")},s=200,A=600,x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,S=function(u){return u!=null},O=function(u,v){return v===u||typeof v=="number"&&typeof u=="number"&&isNaN(v)&&isNaN(u)},R=function(y){Object(j.a)(v,y);var u=d(v);function v(a){var _;Object(D.a)(this,v),_=u.call(this,a),_.onKeyDown=function(T){var U=_.props,M=U.onKeyDown,E=U.onPressEnter;if(T.keyCode===m.a.UP){var H=_.getRatio(T);_.up(T,H,null),_.stop()}else if(T.keyCode===m.a.DOWN){var Z=_.getRatio(T);_.down(T,Z,null),_.stop()}else T.keyCode===m.a.ENTER&&E&&E(T);if(_.recordCursorPosition(),_.lastKeyCode=T.keyCode,M){for(var oe=arguments.length,de=new Array(oe>1?oe-1:0),Te=1;Te<oe;Te++)de[Te-1]=arguments[Te];M.apply(void 0,[T].concat(de))}},_.onKeyUp=function(T){var U=_.props.onKeyUp;if(_.stop(),_.recordCursorPosition(),U){for(var M=arguments.length,E=new Array(M>1?M-1:0),H=1;H<M;H++)E[H-1]=arguments[H];U.apply(void 0,[T].concat(E))}},_.onChange=function(T){var U=_.props.onChange;_.state.focused&&(_.inputting=!0),_.rawInput=_.props.parser(_.getValueFromEvent(T)),_.setState({inputValue:_.rawInput}),U(_.toNumber(_.rawInput))},_.onMouseUp=function(){var T=_.props.onMouseUp;_.recordCursorPosition(),T&&T.apply(void 0,arguments)},_.onFocus=function(){var T;_.setState({focused:!0}),(T=_.props).onFocus.apply(T,arguments)},_.onBlur=function(){var T=_.props.onBlur;_.inputting=!1,_.setState({focused:!1});var U=_.getCurrentValidValue(_.state.inputValue),M=_.setValue(U,l);if(T){var E=_.input.value,H=_.getInputDisplayValue({focus:!1,value:M});_.input.value=H&&Number(H),T.apply(void 0,arguments),_.input.value=E}},_.getRatio=function(T){var U=1;return T.metaKey||T.ctrlKey?U=.1:T.shiftKey&&(U=10),U},_.getFullNum=function(T){return isNaN(T)?T:/e/i.test(String(T))?Number(T).toFixed(18).replace(/\.?0+$/,""):T},_.getPrecision=function(T){if(S(_.props.precision))return _.props.precision;var U=String(T);if(U.indexOf("e-")>=0)return parseInt(U.slice(U.indexOf("e-")+2),10);var M=0;return U.indexOf(".")>=0&&(M=U.length-U.indexOf(".")-1),M},_.getInputDisplayValue=function(T){var U=T||_.state,M=U.focused,E=U.inputValue,H=U.value,Z;M?Z=E:Z=_.toPrecisionAsStep(H),Z==null&&(Z="");var oe=_.formatWrapper(Z);return S(_.props.decimalSeparator)&&(oe=oe.toString().replace(".",_.props.decimalSeparator)),oe},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(T){}},_.restoreByAfter=function(T){if(T===void 0)return!1;var U=_.input.value,M=U.lastIndexOf(T);if(M===-1)return!1;var E=_.cursorBefore.length;return _.lastKeyCode===m.a.DELETE&&_.cursorBefore.charAt(E-1)===T[0]?(_.fixCaret(E,E),!0):M+T.length===U.length?(_.fixCaret(M,M),!0):!1},_.partRestoreByAfter=function(T){return T===void 0?!1:Array.prototype.some.call(T,function(U,M){var E=T.substring(M);return _.restoreByAfter(E)})},_.isNotCompleteNumber=function(T){return isNaN(T)||T===""||T===null||T&&T.toString().indexOf(".")===T.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(T,U,M){_.pressingUpOrDown=!0,_.step("down",T,U,M)},_.up=function(T,U,M){_.pressingUpOrDown=!0,_.step("up",T,U,M)},_.saveInput=function(T){_.input=T};var N=a.value;N===void 0&&(N=a.defaultValue),_.state={focused:a.autoFocus};var B=_.getValidValue(_.toNumber(N));return _.state=c(c({},_.state),{},{inputValue:_.toPrecisionAsStep(B),value:B}),_}return Object(Y.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var N=this.props,B=N.value,T=N.onChange,U=N.max,M=N.min,E=this.state.focused;if(_){if(!O(_.value,B)||!O(_.max,U)||!O(_.min,M)){var H=E?B:this.getValidValue(B),Z;this.pressingUpOrDown?Z=H:this.inputting?Z=this.rawInput:Z=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Z})}var oe="value"in this.props?B:this.state.value;"max"in this.props&&_.max!==U&&typeof oe=="number"&&oe>U&&T&&T(U),"min"in this.props&&_.min!==M&&typeof oe=="number"&&oe<M&&T&&T(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===m.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===m.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case m.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case m.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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 N=_;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(_){var N=_.target.value.trim().replace(/。/g,".");return S(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(_){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,T=parseFloat(_);return isNaN(T)?_:(T<N&&(T=N),T>B&&(T=B),T)}},{key:"setValue",value:function(_,N){var B=this.props.precision,T=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),U=this.state.value,M=U===void 0?null:U,E=this.state.inputValue,H=E===void 0?null:E,Z=typeof T=="number"?T.toFixed(B):"".concat(T),oe=T!==M||Z!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},N)):this.setState({value:T,inputValue:this.toPrecisionAsStep(_)},N),oe&&this.props.onChange(T),T}},{key:"getMaxPrecision",value:function(_){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,T=B.precision,U=B.step;if(S(T))return T;var M=this.getPrecision(N),E=this.getPrecision(U),H=this.getPrecision(_);return _?Math.max(H,M+E):M+E}},{key:"getPrecisionFactor",value:function(_){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(_,N);return Math.pow(10,B)}},{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 N=Math.abs(this.getMaxPrecision(_));return isNaN(N)?_.toString():Number(_).toFixed(N)}},{key:"toNumber",value:function(_){var N=this.props.precision,B=this.state.focused,T=_&&_.length>16&&B;return this.isNotCompleteNumber(_)||T?_:S(N)?Math.round(_*Math.pow(10,N))/Math.pow(10,N):Number(_)}},{key:"upStep",value:function(_,N){var B=this.props.step,T=this.getPrecisionFactor(_,N),U=Math.abs(this.getMaxPrecision(_,N)),M=((T*_+T*B*N)/T).toFixed(U);return this.toNumber(M)}},{key:"downStep",value:function(_,N){var B=this.props.step,T=this.getPrecisionFactor(_,N),U=Math.abs(this.getMaxPrecision(_,N)),M=((T*_-T*B*N)/T).toFixed(U);return this.toNumber(M)}},{key:"step",value:function(_,N){var B=this,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var M=this.props;if(M.disabled)return;var E=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(E))return;var H=this["".concat(_,"Step")](E,T),Z=H>M.max||H<M.min;if(H>M.max?H=M.max:H<M.min&&(H=M.min),this.setValue(H,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),Z)return;this.autoStepTimer=setTimeout(function(){B[_](N,T,!0)},U?s:A)}},{key:"fixCaret",value:function(_,N){if(_===void 0||N===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,T=this.input.selectionEnd;(_!==B||N!==T)&&this.input.setSelectionRange(_,N)}catch(U){}}},{key:"render",value:function(){var _,N=this.props,B=N.prefixCls,T=N.disabled,U=N.readOnly,M=N.useTouch,E=N.autoComplete,H=N.upHandler,Z=N.downHandler,oe=N.className,de=N.max,Te=N.min,be=N.style,Ae=N.title,Ce=N.onMouseEnter,_e=N.onMouseLeave,ge=N.onMouseOver,V=N.onMouseOut,I=N.required,F=N.onClick,J=N.tabIndex,ne=N.type,z=N.placeholder,me=N.id,Oe=N.inputMode,ke=N.pattern,ce=N.step,ye=N.maxLength,Se=N.autoFocus,Le=N.name,Be=N.onPaste,We=N.onInput,Ke=Object(le.a)(N,["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"]),Xe=this.state,lt=Xe.value,Je=Xe.focused,qe=b()(B,(_={},Object(X.a)(_,oe,!!oe),Object(X.a)(_,"".concat(B,"-disabled"),T),Object(X.a)(_,"".concat(B,"-focused"),Je),_)),Pe={};Object.keys(Ke).forEach(function(pe){(pe.substr(0,5)==="data-"||pe.substr(0,5)==="aria-"||pe==="role")&&(Pe[pe]=Ke[pe])});var pt=!U&&!T,ut=this.getInputDisplayValue(null),ue=(lt||lt===0)&&(isNaN(lt)||Number(lt)>=de),q=(lt||lt===0)&&(isNaN(lt)||Number(lt)<=Te),te=ue||T||U,se=q||T||U,he=b()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(X.a)({},"".concat(B,"-handler-up-disabled"),te)),ie=b()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(X.a)({},"".concat(B,"-handler-down-disabled"),se)),ae=M?{onTouchStart:te?l:this.up,onTouchEnd:this.stop}:{onMouseDown:te?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},fe=M?{onTouchStart:se?l:this.down,onTouchEnd:this.stop}:{onMouseDown:se?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return n.a.createElement("div",{className:qe,style:be,title:Ae,onMouseEnter:Ce,onMouseLeave:_e,onMouseOver:ge,onMouseOut:V,onFocus:function(){return null},onBlur:function(){return null}},n.a.createElement("div",{className:"".concat(B,"-handler-wrap")},n.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":te,className:he}),H||n.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:h})),n.a.createElement("span",Object.assign({unselectable:"on"},fe,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:ie}),Z||n.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:h}))),n.a.createElement("div",{className:"".concat(B,"-input-wrap")},n.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":de,"aria-valuenow":lt,required:I,type:ne,placeholder:z,onPaste:Be,onClick:F,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:J,autoComplete:E,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:pt?this.onKeyDown:l,onKeyUp:pt?this.onKeyUp:l,autoFocus:Se,maxLength:ye,readOnly:U,disabled:T,max:de,min:Te,step:ce,name:Le,title:Ae,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ut),pattern:ke,inputMode:Oe,onInput:We},Pe))))}}]),v}(n.a.Component);R.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:x,min:-x,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:o,required:!1,autoComplete:"off"};var C=R,w=we.a=C},fcSX:function(rt,we,$){"use strict";var le=$("Ff2n"),X=$("1OyB"),D=$("vuIU"),Y=$("Ji7U"),j=$("md7G"),P=$("foSv"),G=$("1W/9"),W=$("q1tI"),n=$("rePB"),L=$("JX7q"),b=$("TSYQ"),m=$.n(b),g=$("qx4F"),c=$("4IlW");function d(T){return Array.isArray(T)?T:[T]}var p={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},l=Object.keys(p).filter(function(T){if(typeof document=="undefined")return!1;var U=document.getElementsByTagName("html")[0];return T in(U?U.style:{})})[0],h=p[l];function o(T,U,M,E){T.addEventListener?T.addEventListener(U,M,E):T.attachEvent&&T.attachEvent("on".concat(U),M)}function s(T,U,M,E){T.removeEventListener?T.removeEventListener(U,M,E):T.attachEvent&&T.detachEvent("on".concat(U),M)}function A(T,U){var M=typeof T=="function"?T(U):T;return Array.isArray(M)?M.length===2?M:[M[0],M[1]]:[M]}var x=function(U){return!isNaN(parseFloat(U))&&isFinite(U)},S=!(typeof window!="undefined"&&window.document&&window.document.createElement),O=function T(U,M,E,H){if(!M||M===document||M instanceof Document)return!1;if(M===U.parentNode)return!0;var Z=Math.max(Math.abs(E),Math.abs(H))===Math.abs(H),oe=Math.max(Math.abs(E),Math.abs(H))===Math.abs(E),de=M.scrollHeight-M.clientHeight,Te=M.scrollWidth-M.clientWidth,be=document.defaultView.getComputedStyle(M),Ae=be.overflowY==="auto"||be.overflowY==="scroll",Ce=be.overflowX==="auto"||be.overflowX==="scroll",_e=de&&Ae,ge=Te&&Ce;return Z&&(!_e||_e&&(M.scrollTop>=de&&H<0||M.scrollTop<=0&&H>0))||oe&&(!ge||ge&&(M.scrollLeft>=Te&&E<0||M.scrollLeft<=0&&E>0))?T(U,M.parentNode,E,H):!1};function R(T){var U=C();return function(){var E=Object(P.a)(T),H;if(U){var Z=Object(P.a)(this).constructor;H=Reflect.construct(E,arguments,Z)}else H=E.apply(this,arguments);return Object(j.a)(this,H)}}function C(){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(T){return!1}}var w={},y=function(T){Object(Y.a)(M,T);var U=R(M);function M(E){var H;return Object(X.a)(this,M),H=U.call(this,E),H.domFocus=function(){H.dom&&H.dom.focus()},H.removeStartHandler=function(Z){if(Z.touches.length>1)return;H.startPos={x:Z.touches[0].clientX,y:Z.touches[0].clientY}},H.removeMoveHandler=function(Z){if(Z.changedTouches.length>1)return;var oe=Z.currentTarget,de=Z.changedTouches[0].clientX-H.startPos.x,Te=Z.changedTouches[0].clientY-H.startPos.y;(oe===H.maskDom||oe===H.handlerDom||oe===H.contentDom&&O(oe,Z.target,de,Te))&&Z.cancelable&&Z.preventDefault()},H.transitionEnd=function(Z){var oe=Z.target;s(oe,h,H.transitionEnd),oe.style.transition=""},H.onKeyDown=function(Z){if(Z.keyCode===c.a.ESC){var oe=H.props.onClose;Z.stopPropagation(),oe&&oe(Z)}},H.onWrapperTransitionEnd=function(Z){var oe=H.props,de=oe.open,Te=oe.afterVisibleChange;Z.target===H.contentWrapper&&Z.propertyName.match(/transform$/)&&(H.dom.style.transition="",!de&&H.getCurrentDrawerSome()&&(document.body.style.overflowX="",H.maskDom&&(H.maskDom.style.left="",H.maskDom.style.width="")),Te&&Te(!!de))},H.openLevelTransition=function(){var Z=H.props,oe=Z.open,de=Z.width,Te=Z.height,be=H.getHorizontalBoolAndPlacementName(),Ae=be.isHorizontal,Ce=be.placementName,_e=H.contentDom?H.contentDom.getBoundingClientRect()[Ae?"width":"height"]:0,ge=(Ae?de:Te)||_e;H.setLevelAndScrolling(oe,Ce,ge)},H.setLevelTransform=function(Z,oe,de,Te){var be=H.props,Ae=be.placement,Ce=be.levelMove,_e=be.duration,ge=be.ease,V=be.showMask;H.levelDom.forEach(function(I){I.style.transition="transform ".concat(_e," ").concat(ge),o(I,h,H.transitionEnd);var F=Z?de:0;if(Ce){var J=A(Ce,{target:I,open:Z});F=Z?J[0]:J[1]||0}var ne=typeof F=="number"?"".concat(F,"px"):F,z=Ae==="left"||Ae==="top"?ne:"-".concat(ne);z=V&&Ae==="right"&&Te?"calc(".concat(z," + ").concat(Te,"px)"):z,I.style.transform=F?"".concat(oe,"(").concat(z,")"):""})},H.setLevelAndScrolling=function(Z,oe,de){var Te=H.props.onChange;if(!S){var be=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(g.a)(!0):0;H.setLevelTransform(Z,oe,de,be),H.toggleScrollingToDrawerAndBody(be)}Te&&Te(Z)},H.toggleScrollingToDrawerAndBody=function(Z){var oe=H.props,de=oe.getOpenCount,Te=oe.getContainer,be=oe.showMask,Ae=oe.open,Ce=Te&&Te(),_e=de&&de();if(Ce&&Ce.parentNode===document.body&&be){var ge=["touchstart"],V=[document.body,H.maskDom,H.handlerDom,H.contentDom];Ae&&document.body.style.overflow!=="hidden"?(Z&&H.addScrollingEffect(Z),_e===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",V.forEach(function(I,F){if(!I)return;o(I,ge[F]||"touchmove",F?H.removeMoveHandler:H.removeStartHandler,H.passive)})):H.getCurrentDrawerSome()&&(_e||(document.body.style.overflow=""),document.body.style.touchAction="",Z&&H.remScrollingEffect(Z),V.forEach(function(I,F){if(!I)return;s(I,ge[F]||"touchmove",F?H.removeMoveHandler:H.removeStartHandler,H.passive)}))}},H.addScrollingEffect=function(Z){var oe=H.props,de=oe.placement,Te=oe.duration,be=oe.ease,Ae=oe.getOpenCount,Ce=oe.switchScrollingEffect,_e=Ae&&Ae();_e===1&&Ce();var ge="width ".concat(Te," ").concat(be),V="transform ".concat(Te," ").concat(be);H.dom.style.transition="none";switch(de){case"right":H.dom.style.transform="translateX(-".concat(Z,"px)");break;case"top":case"bottom":H.dom.style.width="calc(100% - ".concat(Z,"px)"),H.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(H.timeout),H.timeout=setTimeout(function(){H.dom&&(H.dom.style.transition="".concat(V,",").concat(ge),H.dom.style.width="",H.dom.style.transform="")})},H.remScrollingEffect=function(Z){var oe=H.props,de=oe.placement,Te=oe.duration,be=oe.ease,Ae=oe.getOpenCount,Ce=oe.switchScrollingEffect,_e=Ae&&Ae();_e||Ce(!0),l&&(document.body.style.overflowX="hidden"),H.dom.style.transition="none";var ge,V="width ".concat(Te," ").concat(be),I="transform ".concat(Te," ").concat(be);switch(de){case"left":{H.dom.style.width="100%",V="width 0s ".concat(be," ").concat(Te);break}case"right":{H.dom.style.transform="translateX(".concat(Z,"px)"),H.dom.style.width="100%",V="width 0s ".concat(be," ").concat(Te),H.maskDom&&(H.maskDom.style.left="-".concat(Z,"px"),H.maskDom.style.width="calc(100% + ".concat(Z,"px)"));break}case"top":case"bottom":{H.dom.style.width="calc(100% + ".concat(Z,"px)"),H.dom.style.height="100%",H.dom.style.transform="translateZ(0)",ge="height 0s ".concat(be," ").concat(Te);break}default:break}clearTimeout(H.timeout),H.timeout=setTimeout(function(){H.dom&&(H.dom.style.transition="".concat(I,",").concat(ge?"".concat(ge,","):"").concat(V),H.dom.style.transform="",H.dom.style.width="",H.dom.style.height="")})},H.getCurrentDrawerSome=function(){return!Object.keys(w).some(function(Z){return w[Z]})},H.getLevelDom=function(Z){var oe=Z.level,de=Z.getContainer;if(S)return;var Te=de&&de(),be=Te?Te.parentNode:null;if(H.levelDom=[],oe==="all"){var Ae=be?Array.prototype.slice.call(be.children):[];Ae.forEach(function(Ce){Ce.nodeName!=="SCRIPT"&&Ce.nodeName!=="STYLE"&&Ce.nodeName!=="LINK"&&Ce!==Te&&H.levelDom.push(Ce)})}else oe&&d(oe).forEach(function(Ce){document.querySelectorAll(Ce).forEach(function(_e){H.levelDom.push(_e)})})},H.getHorizontalBoolAndPlacementName=function(){var Z=H.props.placement,oe=Z==="left"||Z==="right",de="translate".concat(oe?"X":"Y");return{isHorizontal:oe,placementName:de}},H.state={_self:Object(L.a)(H)},H}return Object(D.a)(M,[{key:"componentDidMount",value:function(){var H=this;if(!S){var Z=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return Z=!0,null}}))}catch(Ae){}this.passive=Z?{passive:!1}:!1}var oe=this.props,de=oe.open,Te=oe.getContainer,be=Te&&Te();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),de&&(be&&be.parentNode===document.body&&(w[this.drawerId]=de),this.openLevelTransition(),this.forceUpdate(function(){H.domFocus()}))}},{key:"componentDidUpdate",value:function(H){var Z=this.props,oe=Z.open,de=Z.getContainer,Te=de&&de();oe!==H.open&&(oe&&this.domFocus(),Te&&Te.parentNode===document.body&&(w[this.drawerId]=!!oe),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var H=this.props,Z=H.getOpenCount,oe=H.open,de=H.switchScrollingEffect,Te=typeof Z=="function"&&Z();delete w[this.drawerId],oe&&(this.setLevelTransform(!1),document.body.style.touchAction=""),Te||(document.body.style.overflow="",de(!0))}},{key:"render",value:function(){var H,Z=this,oe=this.props,de=oe.className,Te=oe.children,be=oe.style,Ae=oe.width,Ce=oe.height,_e=oe.defaultOpen,ge=oe.open,V=oe.prefixCls,I=oe.placement,F=oe.level,J=oe.levelMove,ne=oe.ease,z=oe.duration,me=oe.getContainer,Oe=oe.handler,ke=oe.onChange,ce=oe.afterVisibleChange,ye=oe.showMask,Se=oe.maskClosable,Le=oe.maskStyle,Be=oe.onClose,We=oe.onHandleClick,Ke=oe.keyboard,Xe=oe.getOpenCount,lt=oe.switchScrollingEffect,Je=Object(le.a)(oe,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),qe=this.dom?ge:!1,Pe=m()(V,(H={},Object(n.a)(H,"".concat(V,"-").concat(I),!0),Object(n.a)(H,"".concat(V,"-open"),qe),Object(n.a)(H,de||"",!!de),Object(n.a)(H,"no-mask",!ye),H)),pt=this.getHorizontalBoolAndPlacementName(),ut=pt.placementName,ue=I==="left"||I==="top"?"-100%":"100%",q=qe?"":"".concat(ut,"(").concat(ue,")"),te=Oe&&W.cloneElement(Oe,{onClick:function(he){Oe.props.onClick&&Oe.props.onClick(),We&&We(he)},ref:function(he){Z.handlerDom=he}});return W.createElement("div",Object.assign({},Je,{tabIndex:-1,className:Pe,style:be,ref:function(he){Z.dom=he},onKeyDown:qe&&Ke?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),ye&&W.createElement("div",{className:"".concat(V,"-mask"),onClick:Se?Be:void 0,style:Le,ref:function(he){Z.maskDom=he}}),W.createElement("div",{className:"".concat(V,"-content-wrapper"),style:{transform:q,msTransform:q,width:x(Ae)?"".concat(Ae,"px"):Ae,height:x(Ce)?"".concat(Ce,"px"):Ce},ref:function(he){Z.contentWrapper=he}},W.createElement("div",{className:"".concat(V,"-content"),ref:function(he){Z.contentDom=he},onTouchStart:qe&&ye?this.removeStartHandler:void 0,onTouchMove:qe&&ye?this.removeMoveHandler:void 0},Te),te))}}],[{key:"getDerivedStateFromProps",value:function(H,Z){var oe=Z.prevProps,de=Z._self,Te={prevProps:H};if(oe!==void 0){var be=H.placement,Ae=H.level;be!==oe.placement&&(de.contentDom=null),Ae!==oe.level&&de.getLevelDom(H)}return Te}}]),M}(W.Component);y.defaultProps={switchScrollingEffect:function(){}};var u=y;function v(T){var U=a();return function(){var E=Object(P.a)(T),H;if(U){var Z=Object(P.a)(this).constructor;H=Reflect.construct(E,arguments,Z)}else H=E.apply(this,arguments);return Object(j.a)(this,H)}}function a(){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(T){return!1}}var _=function(T){Object(Y.a)(M,T);var U=v(M);function M(E){var H;Object(X.a)(this,M),H=U.call(this,E),H.onHandleClick=function(oe){var de=H.props,Te=de.onHandleClick,be=de.open;if(Te&&Te(oe),typeof be=="undefined"){var Ae=H.state.open;H.setState({open:!Ae})}},H.onClose=function(oe){var de=H.props,Te=de.onClose,be=de.open;Te&&Te(oe),typeof be=="undefined"&&H.setState({open:!1})};var Z=typeof E.open!="undefined"?E.open:!!E.defaultOpen;return H.state={open:Z},"onMaskClick"in E&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),H}return Object(D.a)(M,[{key:"render",value:function(){var H=this,Z=this.props,oe=Z.defaultOpen,de=Z.getContainer,Te=Z.wrapperClassName,be=Z.forceRender,Ae=Z.handler,Ce=Object(le.a)(Z,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),_e=this.state.open;if(!de)return W.createElement("div",{className:Te,ref:function(I){H.dom=I}},W.createElement(u,Object.assign({},Ce,{open:_e,handler:Ae,getContainer:function(){return H.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var ge=!!Ae||be;return W.createElement(G.a,{visible:_e,forceRender:ge,getContainer:de,wrapperClassName:Te},function(V){var I=V.visible,F=V.afterClose,J=Object(le.a)(V,["visible","afterClose"]);return W.createElement(u,Object.assign({},Ce,J,{open:I!==void 0?I:_e,afterVisibleChange:F!==void 0?F:Ce.afterVisibleChange,handler:Ae,onClose:H.onClose,onHandleClick:H.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(H,Z){var oe=Z.prevProps,de={prevProps:H};return typeof oe!="undefined"&&H.open!==oe.open&&(de.open=H.open),de}}]),M}(W.Component);_.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:W.createElement("div",{className:"drawer-handle"},W.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var N=_,B=we.a=N},fjLI:function(rt,we,$){"use strict";$.d(we,"f",function(){return g}),$.d(we,"b",function(){return c}),$.d(we,"a",function(){return d}),$.d(we,"d",function(){return p}),$.d(we,"e",function(){return l}),$.d(we,"c",function(){return h});var le=$("8HAY"),X=$("Vhoy"),D=$("MI8n"),Y=$("JYp7"),j=$("pmY6"),P=$("24hK"),G=$("nnTU"),W=$("T8No"),n=$("Cg/j"),L=$("t9D7"),b=function(o,s,A,x){var S=arguments.length,O=S<3?s:x===null?x=Object.getOwnPropertyDescriptor(s,A):x,R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(o,s,A,x);else for(var C=o.length-1;C>=0;C--)(R=o[C])&&(O=(S<3?R(O):S>3?R(s,A,O):R(s,A))||O);return S>3&&O&&Object.defineProperty(s,A,O),O},m=function(o,s){return function(A,x){s(A,x,o)}};function g(o){return o.command!==void 0}class c{constructor(o){this.id=c._idPool++,this._debugName=o}}c._idPool=0,c.CommandPalette=new c("CommandPalette"),c.EditorContext=new c("EditorContext"),c.SimpleEditorContext=new c("SimpleEditorContext"),c.EditorContextCopy=new c("EditorContextCopy"),c.EditorContextPeek=new c("EditorContextPeek"),c.MenubarEditMenu=new c("MenubarEditMenu"),c.MenubarCopy=new c("MenubarCopy"),c.MenubarGoMenu=new c("MenubarGoMenu"),c.MenubarSelectionMenu=new c("MenubarSelectionMenu"),c.InlineCompletionsActions=new c("InlineCompletionsActions");const d=Object(n.c)("menuService"),p=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new D.b,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:o=>o===c.CommandPalette}}addCommand(o){return this.addCommands(Y.a.single(o))}addCommands(o){for(const s of o)this._commands.set(s.id,s);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),Object(j.i)(()=>{let s=!1;for(const A of o)s=this._commands.delete(A.id)||s;s&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(o){return this._commands.get(o)}getCommands(){const o=new Map;return this._commands.forEach((s,A)=>o.set(A,s)),o}appendMenuItem(o,s){return this.appendMenuItems(Y.a.single({id:o,item:s}))}appendMenuItems(o){const s=new Set,A=new P.a;for(const{id:x,item:S}of o){let O=this._menuItems.get(x);O||(O=new P.a,this._menuItems.set(x,O)),A.push(O.push(S)),s.add(x)}return this._onDidChangeMenu.fire(s),Object(j.i)(()=>{if(A.size>0){for(let x of A)x();this._onDidChangeMenu.fire(s),A.clear()}})}getMenuItems(o){let s;return this._menuItems.has(o)?s=[...this._menuItems.get(o)]:s=[],o===c.CommandPalette&&this._appendImplicitItems(s),s}_appendImplicitItems(o){const s=new Set;for(const A of o)g(A)&&(s.add(A.command.id),A.alt&&s.add(A.alt.id));this._commands.forEach((A,x)=>{s.has(x)||o.push({command:A})})}};class l extends le.e{constructor(o,s,A,x){super(`submenuitem.${o.submenu.id}`,typeof o.title=="string"?o.title:o.title.value,[],"submenu");this.item=o,this._menuService=s,this._contextKeyService=A,this._options=x}get actions(){const o=[],s=this._menuService.createMenu(this.item.submenu,this._contextKeyService),A=s.getActions(this._options);s.dispose();for(const[,x]of A)x.length>0&&(o.push(...x),o.push(new le.d));return o.length&&o.pop(),o}}let h=class o{constructor(s,A,x,S,O){var R,C;if(this._commandService=O,this.id=s.id,this.label=(x==null?void 0:x.renderShortTitle)&&s.shortTitle?typeof s.shortTitle=="string"?s.shortTitle:s.shortTitle.value:typeof s.title=="string"?s.title:s.title.value,this.tooltip=(C=typeof s.tooltip=="string"?s.tooltip:(R=s.tooltip)===null||R===void 0?void 0:R.value)!==null&&C!==void 0?C:"",this.enabled=!s.precondition||S.contextMatchesRules(s.precondition),this.checked=void 0,s.toggled){const w=s.toggled.condition?s.toggled:{condition:s.toggled};this.checked=S.contextMatchesRules(w.condition),this.checked&&w.tooltip&&(this.tooltip=typeof w.tooltip=="string"?w.tooltip:w.tooltip.value),w.title&&(this.label=typeof w.title=="string"?w.title:w.title.value)}this.item=s,this.alt=A?new o(A,void 0,x,S,O):void 0,this._options=x,L.d.isThemeIcon(s.icon)&&(this.class=X.a.asClassName(s.icon))}dispose(){}run(...s){var A,x;let S=[];return((A=this._options)===null||A===void 0?void 0:A.arg)&&(S=[...S,this._options.arg]),((x=this._options)===null||x===void 0?void 0:x.shouldForwardArgs)&&(S=[...S,...s]),this._commandService.executeCommand(this.id,...S)}};h=b([m(3,W.b),m(4,G.b)],h)},ic2d:function(rt,we,$){"use strict";$.d(we,"a",function(){return Y});var le=$("FWmy"),X=$("746U");class D{constructor(){this.data=new Map}add(j,P){le.a(X.l(j)),le.a(X.k(P)),le.a(!this.data.has(j),"There is already an extension with this id"),this.data.set(j,P)}as(j){return this.data.get(j)||null}}const Y=new D},kSUc:function(rt,we,$){},kqOp:function(rt,we,$){"use strict";$.d(we,"a",function(){return L});var le=$("0Owb"),X=$("fWQN"),D=$("mtLc"),Y=$("yKVA"),j=$("879j"),P=$("q1tI"),G=$.n(P),W=$("Ot1p"),n="\u2581",L=function(b){Object(Y.a)(g,b);var m=Object(j.a)(g);function g(){var c;Object(X.a)(this,g);for(var d=arguments.length,p=new Array(d),l=0;l<d;l++)p[l]=arguments[l];return c=m.call.apply(m,[this].concat(p)),c.getChCountBeforeCursor=function(h,o){for(var s=o.line,A=0,x=0;x<s;x++)A+=h.getLine(x).split(n).length-1;var S=h.getLine(s).substring(0,o.ch);return A+=S.split(n).length-1,A},c.onCMBeforeChange=function(h,o){var s=h.getRange(o.from,o.to),A=0;if(o.text.forEach(function(R){A+=R.split(n).length-1}),s&&s.indexOf(n)!=-1){var x=s.split(n).length-1,S=c.getChCountBeforeCursor(h,o.from);console.log("\u5220\u9664".concat(x,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(S,"\u4E2A\uFF0C\u65B0\u589E").concat(A,"\u4E2A")),c.props.deleteEmptyDisabled?o.cancel():c.props.onPlaceholderChange&&c.props.onPlaceholderChange(S,x,A)}else if(A){var O=c.getChCountBeforeCursor(h,o.from);console.log("\u65B0\u589E".concat(A,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(O,"\u4E2A")),c.props.onPlaceholderChange&&c.props.onPlaceholderChange(O,0,A)}},c}return Object(D.a)(g,[{key:"render",value:function(){return G.a.createElement(W.a,Object(le.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),g}(P.Component)},lZu9:function(rt,we,$){(function(le){le($("VrN/"),$("1eCo"),$("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(X,D){var Y=le.getMode(X,"text/html"),j=Y.name=="null";function P(M){if(le.findModeByName){var E=le.findModeByName(M);E&&(M=E.mime||E.mimes[0])}var H=le.getMode(X,M);return H.name=="null"?null:H}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 G={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 W in G)G.hasOwnProperty(W)&&D.tokenTypeOverrides[W]&&(G[W]=D.tokenTypeOverrides[W]);var n=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,m=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,g=/^ {0,3}(?:\={1,}|-{2,})\s*$/,c=/^[^#!\[\]*_\\<>` "'(~:]+/,d=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,h=" ";function o(M,E,H){return E.f=E.inline=H,H(M,E)}function s(M,E,H){return E.f=E.block=H,H(M,E)}function A(M){return!M||!/\S/.test(M.string)}function x(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==O){var E=j;if(!E){var H=le.innerMode(Y,M.htmlState);E=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}E&&(M.f=y,M.block=S,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function S(M,E){var H=M.column()===E.indentation,Z=A(E.prevLine.stream),oe=E.indentedCode,de=E.prevLine.hr,Te=E.list!==!1,be=(E.listStack[E.listStack.length-1]||0)+3;E.indentedCode=!1;var Ae=E.indentation;if(E.indentationDiff===null&&(E.indentationDiff=E.indentation,Te)){for(E.list=null;Ae<E.listStack[E.listStack.length-1];)E.listStack.pop(),E.listStack.length?E.indentation=E.listStack[E.listStack.length-1]:E.list=!1;E.list!==!1&&(E.indentationDiff=Ae-E.listStack[E.listStack.length-1])}var Ce=!Z&&!de&&!E.prevLine.header&&(!Te||!oe)&&!E.prevLine.fencedCodeEnd,_e=(E.list===!1||de||Z)&&E.indentation<=be&&M.match(n),ge=null;if(E.indentationDiff>=4&&(oe||E.prevLine.fencedCodeEnd||E.prevLine.header||Z))return M.skipToEnd(),E.indentedCode=!0,G.code;if(M.eatSpace())return null;if(H&&E.indentation<=be&&(ge=M.match(m))&&ge[1].length<=6)return E.quote=0,E.header=ge[1].length,E.thisLine.header=!0,D.highlightFormatting&&(E.formatting="header"),E.f=E.inline,C(E);if(E.indentation<=be&&M.eat(">"))return E.quote=H?1:E.quote+1,D.highlightFormatting&&(E.formatting="quote"),M.eatSpace(),C(E);if(!_e&&!E.setext&&H&&E.indentation<=be&&(ge=M.match(L))){var V=ge[1]?"ol":"ul";return E.indentation=Ae+M.current().length,E.list=!0,E.quote=0,E.listStack.push(E.indentation),E.em=!1,E.strong=!1,E.code=!1,E.strikethrough=!1,D.taskLists&&M.match(b,!1)&&(E.taskList=!0),E.f=E.inline,D.highlightFormatting&&(E.formatting=["list","list-"+V]),C(E)}else{if(H&&E.indentation<=be&&(ge=M.match(d,!0)))return E.quote=0,E.fencedEndRE=new RegExp(ge[1]+"+ *$"),E.localMode=D.fencedCodeBlockHighlighting&&P(ge[2]||D.fencedCodeBlockDefaultMode),E.localMode&&(E.localState=le.startState(E.localMode)),E.f=E.block=R,D.highlightFormatting&&(E.formatting="code-block"),E.code=-1,C(E);if(E.setext||(!Ce||!Te)&&!E.quote&&E.list===!1&&!E.code&&!_e&&!p.test(M.string)&&(ge=M.lookAhead(1))&&(ge=ge.match(g)))return E.setext?(E.header=E.setext,E.setext=0,M.skipToEnd(),D.highlightFormatting&&(E.formatting="header")):(E.header=ge[0].charAt(0)=="="?1:2,E.setext=E.header),E.thisLine.header=!0,E.f=E.inline,C(E);if(_e)return M.skipToEnd(),E.hr=!0,E.thisLine.hr=!0,G.hr;if(M.peek()==="[")return o(M,E,N)}return o(M,E,E.inline)}function O(M,E){var H=Y.token(M,E.htmlState);if(!j){var Z=le.innerMode(Y,E.htmlState);(Z.mode.name=="xml"&&Z.state.tagStart===null&&!Z.state.context&&Z.state.tokenize.isInText||E.md_inside&&M.current().indexOf(">")>-1)&&(E.f=y,E.block=S,E.htmlState=null)}return H}function R(M,E){var H=E.listStack[E.listStack.length-1]||0,Z=E.indentation<H,oe=H+3;if(E.fencedEndRE&&E.indentation<=oe&&(Z||M.match(E.fencedEndRE))){D.highlightFormatting&&(E.formatting="code-block");var de;return Z||(de=C(E)),E.localMode=E.localState=null,E.block=S,E.f=y,E.fencedEndRE=null,E.code=0,E.thisLine.fencedCodeEnd=!0,Z?s(M,E,E.block):de}else return E.localMode?E.localMode.token(M,E.localState):(M.skipToEnd(),G.code)}function C(M){var E=[];if(M.formatting){E.push(G.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var H=0;H<M.formatting.length;H++)E.push(G.formatting+"-"+M.formatting[H]),M.formatting[H]==="header"&&E.push(G.formatting+"-"+M.formatting[H]+"-"+M.header),M.formatting[H]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=M.quote?E.push(G.formatting+"-"+M.formatting[H]+"-"+M.quote):E.push("error"))}if(M.taskOpen)return E.push("meta"),E.length?E.join(" "):null;if(M.taskClosed)return E.push("property"),E.length?E.join(" "):null;if(M.linkHref?E.push(G.linkHref,"url"):(M.strong&&E.push(G.strong),M.em&&E.push(G.em),M.strikethrough&&E.push(G.strikethrough),M.emoji&&E.push(G.emoji),M.linkText&&E.push(G.linkText),M.code&&E.push(G.code),M.image&&E.push(G.image),M.imageAltText&&E.push(G.imageAltText,"link"),M.imageMarker&&E.push(G.imageMarker)),M.header&&E.push(G.header,G.header+"-"+M.header),M.quote&&(E.push(G.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=M.quote?E.push(G.quote+"-"+M.quote):E.push(G.quote+"-"+D.maxBlockquoteDepth)),M.list!==!1){var Z=(M.listStack.length-1)%3;Z?Z===1?E.push(G.list2):E.push(G.list3):E.push(G.list1)}return M.trailingSpaceNewLine?E.push("trailing-space-new-line"):M.trailingSpace&&E.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),E.length?E.join(" "):null}function w(M,E){return M.match(c,!0)?C(E):void 0}function y(M,E){var H=E.text(M,E);if(typeof H!="undefined")return H;if(E.list)return E.list=null,C(E);if(E.taskList){var Z=M.match(b,!0)[1]===" ";return Z?E.taskOpen=!0:E.taskClosed=!0,D.highlightFormatting&&(E.formatting="task"),E.taskList=!1,C(E)}if(E.taskOpen=!1,E.taskClosed=!1,E.header&&M.match(/^#+$/,!0))return D.highlightFormatting&&(E.formatting="header"),C(E);var oe=M.next();if(E.linkTitle){E.linkTitle=!1;var de=oe;oe==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(M.match(new RegExp(Te),!0))return G.linkHref}if(oe==="`"){var be=E.formatting;D.highlightFormatting&&(E.formatting="code"),M.eatWhile("`");var Ae=M.current().length;if(E.code==0&&(!E.quote||Ae==1))return E.code=Ae,C(E);if(Ae==E.code){var Ce=C(E);return E.code=0,Ce}else return E.formatting=be,C(E)}else if(E.code)return C(E);if(oe==="\\"&&(M.next(),D.highlightFormatting)){var _e=C(E),ge=G.formatting+"-escape";return _e?_e+" "+ge:ge}if(oe==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return E.imageMarker=!0,E.image=!0,D.highlightFormatting&&(E.formatting="image"),C(E);if(oe==="["&&E.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return E.imageMarker=!1,E.imageAltText=!0,D.highlightFormatting&&(E.formatting="image"),C(E);if(oe==="]"&&E.imageAltText){D.highlightFormatting&&(E.formatting="image");var _e=C(E);return E.imageAltText=!1,E.image=!1,E.inline=E.f=v,_e}if(oe==="["&&!E.image)return E.linkText&&M.match(/^.*?\]/)||(E.linkText=!0,D.highlightFormatting&&(E.formatting="link")),C(E);if(oe==="]"&&E.linkText){D.highlightFormatting&&(E.formatting="link");var _e=C(E);return E.linkText=!1,E.inline=E.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?v:y,_e}if(oe==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){E.f=E.inline=u,D.highlightFormatting&&(E.formatting="link");var _e=C(E);return _e?_e+=" ":_e="",_e+G.linkInline}if(oe==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){E.f=E.inline=u,D.highlightFormatting&&(E.formatting="link");var _e=C(E);return _e?_e+=" ":_e="",_e+G.linkEmail}if(D.xml&&oe==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var V=M.string.indexOf(">",M.pos);if(V!=-1){var I=M.string.substring(M.start,V);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(I)&&(E.md_inside=!0)}return M.backUp(1),E.htmlState=le.startState(Y),s(M,E,O)}if(D.xml&&oe==="<"&&M.match(/^\/\w*?>/))return E.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var F=1,J=M.pos==1?" ":M.string.charAt(M.pos-2);F<3&&M.eat(oe);)F++;var ne=M.peek()||" ",z=!/\s/.test(ne)&&(!l.test(ne)||/\s/.test(J)||l.test(J)),me=!/\s/.test(J)&&(!l.test(J)||/\s/.test(ne)||l.test(ne)),Oe=null,ke=null;if(F%2&&(!E.em&&z&&(oe==="*"||!me||l.test(J))?Oe=!0:E.em==oe&&me&&(oe==="*"||!z||l.test(ne))&&(Oe=!1)),F>1&&(!E.strong&&z&&(oe==="*"||!me||l.test(J))?ke=!0:E.strong==oe&&me&&(oe==="*"||!z||l.test(ne))&&(ke=!1)),ke!=null||Oe!=null){D.highlightFormatting&&(E.formatting=Oe==null?"strong":ke==null?"em":"strong em"),Oe===!0&&(E.em=oe),ke===!0&&(E.strong=oe);var Ce=C(E);return Oe===!1&&(E.em=!1),ke===!1&&(E.strong=!1),Ce}}else if(oe===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return C(E);M.backUp(1)}if(D.strikethrough){if(oe==="~"&&M.eatWhile(oe)){if(E.strikethrough){D.highlightFormatting&&(E.formatting="strikethrough");var Ce=C(E);return E.strikethrough=!1,Ce}else if(M.match(/^[^\s]/,!1))return E.strikethrough=!0,D.highlightFormatting&&(E.formatting="strikethrough"),C(E)}else if(oe===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return C(E);M.backUp(2)}}if(D.emoji&&oe===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){E.emoji=!0,D.highlightFormatting&&(E.formatting="emoji");var ce=C(E);return E.emoji=!1,ce}return oe===" "&&(M.match(/^ +$/,!1)?E.trailingSpace++:E.trailingSpace&&(E.trailingSpaceNewLine=!0)),C(E)}function u(M,E){var H=M.next();if(H===">"){E.f=E.inline=y,D.highlightFormatting&&(E.formatting="link");var Z=C(E);return Z?Z+=" ":Z="",Z+G.linkInline}return M.match(/^[^>]+/,!0),G.linkInline}function v(M,E){if(M.eatSpace())return null;var H=M.next();return H==="("||H==="["?(E.f=E.inline=_(H==="("?")":"]"),D.highlightFormatting&&(E.formatting="link-string"),E.linkHref=!0,C(E)):"error"}var a={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(M){return function(E,H){var Z=E.next();if(Z===M){H.f=H.inline=y,D.highlightFormatting&&(H.formatting="link-string");var oe=C(H);return H.linkHref=!1,oe}return E.match(a[M]),H.linkHref=!0,C(H)}}function N(M,E){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(E.f=B,M.next(),D.highlightFormatting&&(E.formatting="link"),E.linkText=!0,C(E)):o(M,E,y)}function B(M,E){if(M.match(/^\]:/,!0)){E.f=E.inline=T,D.highlightFormatting&&(E.formatting="link");var H=C(E);return E.linkText=!1,H}return M.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function T(M,E){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?E.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),E.f=E.inline=y,G.linkHref+" url")}var U={startState:function(){return{f:S,prevLine:{stream:null},thisLine:{stream:null},block:S,htmlState:null,indentation:0,inline:y,text:w,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(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&le.copyState(Y,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?le.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,E){if(E.formatting=!1,M!=E.thisLine.stream){if(E.header=0,E.hr=!1,M.match(/^\s*$/,!0))return x(E),null;if(E.prevLine=E.thisLine,E.thisLine={stream:M},E.taskList=!1,E.trailingSpace=0,E.trailingSpaceNewLine=!1,!E.localState&&(E.f=E.block,E.f!=O)){var H=M.match(/^\s*/,!0)[0].replace(/\t/g,h).length;if(E.indentation=H,E.indentationDiff=null,H>0)return null}}return E.f(M,E)},innerMode:function(M){return M.block==O?{state:M.htmlState,mode:Y}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:U}},indent:function(M,E,H){return M.block==O&&Y.indent?Y.indent(M.htmlState,E,H):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,E,H):le.Pass},blankLine:x,getType:C,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return U},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},nEHx:function(rt,we,$){"use strict";$.d(we,"a",function(){return le});var le;(function(X){X.DARK="dark",X.LIGHT="light",X.HIGH_CONTRAST="hc"})(le||(le={}))},nnTU:function(rt,we,$){"use strict";$.d(we,"b",function(){return G}),$.d(we,"a",function(){return W});var le=$("MI8n"),X=$("JYp7"),D=$("pmY6"),Y=$("24hK"),j=$("746U"),P=$("Cg/j");const G=Object(P.c)("commandService"),W=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new le.b,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,L){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!L)throw new Error("invalid command");return this.registerCommand({id:n,handler:L})}if(n.description){const d=[];for(let l of n.description.args)d.push(l.constraint);const p=n.handler;n.handler=function(l,...h){return Object(j.o)(h,d),p(l,...h)}}const{id:b}=n;let m=this._commands.get(b);m||(m=new Y.a,this._commands.set(b,m));let g=m.unshift(n),c=Object(D.i)(()=>{g();const d=this._commands.get(b);(d==null?void 0:d.isEmpty())&&this._commands.delete(b)});return this._onDidRegisterCommand.fire(b),c}registerCommandAlias(n,L){return W.registerCommand(n,(b,...m)=>b.get(G).executeCommand(L,...m))}getCommand(n){const L=this._commands.get(n);return!L||L.isEmpty()?void 0:X.a.first(L)}getCommands(){const n=new Map;for(const L of this._commands.keys()){const b=this.getCommand(L);b&&n.set(L,b)}return n}};W.registerCommand("noop",()=>{})},osHv:function(rt,we,$){(function(le){le($("VrN/"))})(function(le){"use strict";var X=le.Pos;function D(l,h){return l.line-h.line||l.ch-h.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",j=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Y+"]["+j+"]*)","g");function G(l,h,o,s){this.line=h,this.ch=o,this.cm=l,this.text=l.getLine(h),this.min=s?Math.max(s.from,l.firstLine()):l.firstLine(),this.max=s?Math.min(s.to-1,l.lastLine()):l.lastLine()}function W(l,h){var o=l.cm.getTokenTypeAt(X(l.line,h));return o&&/\btag\b/.test(o)}function n(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function L(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function b(l){for(;;){var h=l.text.indexOf(">",l.ch);if(h==-1){if(n(l))continue;return}if(!W(l,h+1)){l.ch=h+1;continue}var o=l.text.lastIndexOf("/",h),s=o>-1&&!/\S/.test(l.text.slice(o+1,h));return l.ch=h+1,s?"selfClose":"regular"}}function m(l){for(;;){var h=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(h==-1){if(L(l))continue;return}if(!W(l,h+1)){l.ch=h;continue}P.lastIndex=h,l.ch=h;var o=P.exec(l.text);if(o&&o.index==h)return o}}function g(l){for(;;){P.lastIndex=l.ch;var h=P.exec(l.text);if(!h){if(n(l))continue;return}if(!W(l,h.index+1)){l.ch=h.index+1;continue}return l.ch=h.index+h[0].length,h}}function c(l){for(;;){var h=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(h==-1){if(L(l))continue;return}if(!W(l,h+1)){l.ch=h;continue}var o=l.text.lastIndexOf("/",h),s=o>-1&&!/\S/.test(l.text.slice(o+1,h));return l.ch=h+1,s?"selfClose":"regular"}}function d(l,h){for(var o=[];;){var s=g(l),A,x=l.line,S=l.ch-(s?s[0].length:0);if(!s||!(A=b(l)))return;if(A=="selfClose")continue;if(s[1]){for(var O=o.length-1;O>=0;--O)if(o[O]==s[2]){o.length=O;break}if(O<0&&(!h||h==s[2]))return{tag:s[2],from:X(x,S),to:X(l.line,l.ch)}}else o.push(s[2])}}function p(l,h){for(var o=[];;){var s=c(l);if(!s)return;if(s=="selfClose"){m(l);continue}var A=l.line,x=l.ch,S=m(l);if(!S)return;if(S[1])o.push(S[2]);else{for(var O=o.length-1;O>=0;--O)if(o[O]==S[2]){o.length=O;break}if(O<0&&(!h||h==S[2]))return{tag:S[2],from:X(l.line,l.ch),to:X(A,x)}}}}le.registerHelper("fold","xml",function(l,h){for(var o=new G(l,h.line,0);;){var s=g(o);if(!s||o.line!=h.line)return;var A=b(o);if(!A)return;if(!s[1]&&A!="selfClose"){var x=X(o.line,o.ch),S=d(o,s[2]);return S&&D(S.from,x)>0?{from:x,to:S.from}:null}}}),le.findMatchingTag=function(l,h,o){var s=new G(l,h.line,h.ch,o);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var A=b(s),x=A&&X(s.line,s.ch),S=A&&m(s);if(!A||!S||D(s,h)>0)return;var O={from:X(s.line,s.ch),to:x,tag:S[2]};return A=="selfClose"?{open:O,close:null,at:"open"}:S[1]?{open:p(s,S[2]),close:O,at:"close"}:(s=new G(l,x.line,x.ch,o),{open:O,close:d(s,S[2]),at:"open"})},le.findEnclosingTag=function(l,h,o,s){for(var A=new G(l,h.line,h.ch,o);;){var x=p(A,s);if(!x)break;var S=new G(l,h.line,h.ch,o),O=d(S,x.tag);if(O)return{open:x,close:O}}},le.scanForClosingTag=function(l,h,o,s){var A=new G(l,h.line,h.ch,s?{from:0,to:s}:null);return d(A,o)}})},p5ED:function(rt,we,$){"use strict";var le=$("+L6B"),X=$("2/Rp"),D=$("5Dmo"),Y=$("3S7+"),j=$("k1fw"),P=$("9og8"),G=$("tJVT"),W=$("WmNS"),n=$.n(W),L=$("q1tI"),b=$.n(L),m=$("vHTk"),g=$.n(m),c=$("yEEn"),d=$("ZW9T"),p=$("1vsH"),l=$("V0Rq"),h=$("m3rI");we.a=function(o){var s,A,x,S,O,R,C,w=o.editOffice,y=w===void 0?"view":w,u=o.data,v=o.theme,a=o.type,_=o.filename,N=o.monacoEditor,B=o.className,T=o.style,U=o.close,M=o.onClose,E=o.hasMask,H=o.disabledDownload,Z=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),oe=Object(G.a)(Z,2),de=oe[0],Te=oe[1],be=Object(L.useState)(""),Ae=Object(G.a)(be,2),Ce=Ae[0],_e=Ae[1],ge=Object(L.useState)(),V=Object(G.a)(ge,2),I=V[0],F=V[1],J=window.ENV==="build"?"/react/build":"",ne=h.a.PROXY_SERVER||location.origin,z,me=1024*1024,Oe=10*me,ke=Object(L.useRef)();(s=u)!==null&&s!==void 0&&s.startsWith("/api")&&a!=="txt"&&(u=(h.a.API_SERVER||location.origin)+u),a==="office"&&(z=Object(p.T)(u).filesize,z>Oe&&(a="other")),_&&N&&(N.filename=_),Object(L.useEffect)(function(){var Le,Be,We=(Le=document.cookie)===null||Le===void 0||((Be=Le.replace(/\s/g,""))===null||Be===void 0)?void 0:Be.split(";");We==null||We.map(function(Ke){var Xe=Ke.split("=");Xe[0]==="_educoder_session"&&_e(Xe[1])})},[]),Object(L.useEffect)(function(){a==="office"&&ce()},[a,u]);var ce=function(){var Le=Object(P.a)(n.a.mark(function Be(){var We,Ke,Xe;return n.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return console.log("data:",u),We=u,u.startsWith("http")||(We=location.origin+We),Ke=new URL(We).pathname.split("/").pop(),Je.next=6,Object(l.V)({attachment_id:Ke});case 6:Xe=Je.sent,F(Xe);case 8:case"end":return Je.stop()}},Be)}));return function(){return Le.apply(this,arguments)}}(),ye=function(){if(u.startsWith("http")||u.startsWith("blob:")){Se();return}Object(p.z)(_||"educoder",u,_)},Se=function(){Object(p.x)(_||"educoder",decodeURIComponent(u))};return b.a.createElement("div",{style:Object(j.a)({},T||{}),className:"".concat(E&&g.a.bgBlack," ").concat(a?g.a.wrp:"hide")},U&&b.a.createElement("div",{className:g.a.close,ref:ke},!H&&b.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ke.current}},b.a.createElement("span",{onClick:Se},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ke.current}},b.a.createElement("span",{className:"",onClick:M},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(g.a[B]," ").concat(B," ").concat(g.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&b.a.createElement(d.b,N)),a==="audio"&&b.a.createElement("audio",{src:"".concat(((A=u)===null||A===void 0?void 0:A.indexOf("http://"))>-1||((x=u)===null||x===void 0?void 0:x.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),a==="video"&&b.a.createElement(b.a.Fragment,null,((S=u)===null||S===void 0?void 0:S.indexOf("http"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),a==="office"&&I&&b.a.createElement("iframe",{src:"".concat(J,"/office.html?key=").concat(I.key,"&url=").concat(ne+I.url,"&callbackUrl=").concat(ne+I.callbackUrl,"&fileType=").concat(I.fileType,"&title=").concat(I.title,"&model=").concat(y,"&officeServer=").concat(h.a.OFFICE_SERVER,"&disabledDownload=").concat(!!H)}),a==="html"&&b.a.createElement("iframe",{src:u+"&disposition=inline"}),a==="pdf"&&b.a.createElement("iframe",{src:"".concat(J,"/js/pdfview/index.html?url=").concat(u,"&disabledDownload=").concat(!!H)}),a==="image"&&b.a.createElement("img",{src:"".concat(((O=u)===null||O===void 0?void 0:O.indexOf("http://"))>-1||((R=u)===null||R===void 0?void 0:R.indexOf("https://"))>-1||(C=u)!==null&&C!==void 0&&C.startsWith("/api")?"":"data:image/png;base64,").concat(u)}),a==="other"&&b.a.createElement("div",null,b.a.createElement(X.a,{type:"primary",size:"large",onClick:ye},b.a.createElement(c.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),a==="download"&&b.a.createElement(X.a,{type:"primary",size:"large",onClick:ye},b.a.createElement(c.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(rt,we,$){},pmY6:function(rt,we,$){"use strict";$.d(we,"h",function(){return L}),$.d(we,"g",function(){return m}),$.d(we,"f",function(){return g}),$.d(we,"e",function(){return c}),$.d(we,"i",function(){return d}),$.d(we,"b",function(){return p}),$.d(we,"a",function(){return l}),$.d(we,"d",function(){return h}),$.d(we,"c",function(){return o});var le=$("C/vA"),X=$("JYp7");const D=!1;let Y=null;function j(s){Y=s}if(D){const s="__is_disposable_tracked__";j(new class{trackDisposable(A){const x=new Error("Potentially leaked disposable").stack;setTimeout(()=>{A[s]||console.log(x)},3e3)}setParent(A,x){if(A&&A!==l.None)try{A[s]=!0}catch(S){}}markAsDisposed(A){if(A&&A!==l.None)try{A[s]=!0}catch(x){}}markAsSingleton(A){}})}function P(s){return Y==null||Y.trackDisposable(s),s}function G(s){Y==null||Y.markAsDisposed(s)}function W(s,A){Y==null||Y.setParent(s,A)}function n(s,A){if(!Y)return;for(const x of s)Y.setParent(x,A)}function L(s){return Y==null||Y.markAsSingleton(s),s}class b extends Error{constructor(s){super(`Encountered errors while disposing of store. Errors: [${s.join(", ")}]`);this.errors=s}}function m(s){return typeof s.dispose=="function"&&s.dispose.length===0}function g(s){if(X.a.is(s)){let A=[];for(const x of s)if(x)try{x.dispose()}catch(S){A.push(S)}if(A.length===1)throw A[0];if(A.length>1)throw new b(A);return Array.isArray(s)?[]:s}else if(s)return s.dispose(),s}function c(...s){const A=d(()=>g(s));return n(s,A),A}function d(s){const A=P({dispose:Object(le.a)(()=>{G(A),s()})});return A}class p{constructor(){this._toDispose=new Set,this._isDisposed=!1,P(this)}dispose(){if(this._isDisposed)return;G(this),this._isDisposed=!0,this.clear()}clear(){try{g(this._toDispose.values())}finally{this._toDispose.clear()}}add(s){if(!s)return s;if(s===this)throw new Error("Cannot register a disposable on itself!");return W(s,this),this._isDisposed?p.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(s),s}}p.DISABLE_DISPOSED_WARNING=!1;class l{constructor(){this._store=new p,P(this),W(this._store,this)}dispose(){G(this),this._store.dispose()}_register(s){if(s===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(s)}}l.None=Object.freeze({dispose(){}});class h{constructor(){this._isDisposed=!1,P(this)}get value(){return this._isDisposed?void 0:this._value}set value(s){var A;if(this._isDisposed||s===this._value)return;(A=this._value)===null||A===void 0||A.dispose(),s&&W(s,this),this._value=s}clear(){this.value=void 0}dispose(){var s;this._isDisposed=!0,G(this),(s=this._value)===null||s===void 0||s.dispose(),this._value=void 0}clearAndLeak(){const s=this._value;return this._value=void 0,s&&W(s,null),s}}class o{constructor(s){this.object=s}dispose(){}}},pr0Y:function(rt,we,$){"use strict";$.r(we);var le=$("+L6B"),X=$("2/Rp"),D=$("5NDa"),Y=$("5rEg"),j=$("5Dmo"),P=$("3S7+"),G=$("14J3"),W=$("BMrR"),n=$("jCWc"),L=$("kPKH"),b=$("sPJy"),m=$("bE4q"),g=$("/zsF"),c=$("PArb"),d=$("miYZ"),p=$("tsqr"),l=$("9og8"),h=$("k1fw"),o=$("oBTY"),s=$("y8nQ"),A=$("Vl3Y"),x=$("tJVT"),S=$("PpiC"),O=$("B9cy"),R=$("Ol7k"),C=$("lUTK"),w=$("BvKs"),y=$("WmNS"),u=$.n(y),v=$("q1tI"),a=$.n(v),_=$("Ty5D"),N=$("55Ip"),B=$("9kvl"),T=$("w5pM"),U=$("tgas"),M=$("giR+"),E=$("fyUT"),H=$("sRBo"),Z=$("kaz8"),oe=$("2qtc"),de=$("kLXV"),Te=$("V0Rq"),be=$("Ot1p"),Ae=$("9Bee"),Ce=$("LuLp"),_e=$.n(Ce),ge=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],V=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.onRef,xn=Qe===void 0?function(){}:Qe,Me=Ue.editData,un=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ft=Object(v.useState)([]),wt=Object(x.a)(ft,2),it=wt[0],Ft=wt[1],tn=Object(v.useState)(),Dt=Object(x.a)(tn,2),ze=Dt[0],kt=Dt[1],Ot=Object(v.useState)([]),nt=Object(x.a)(Ot,2),at=nt[0],et=nt[1],Vt=Object(v.useState)(""),Bt=Object(x.a)(Vt,2),Fe=Bt[0],ht=Bt[1],hn=Object(v.useState)(5),vn=Object(x.a)(hn,2),bn=vn[0],cn=vn[1],yn=Object(v.useState)(!1),Tt=Object(x.a)(yn,2),pn=Tt[0],He=Tt[1],Ht=Object(_.i)();Object(v.useEffect)(function(){Ft(["","","",""])},[]),Object(v.useEffect)(function(){if(!(Me!=null&&Me.question_choices)){He(!0);return}ht(Me==null?void 0:Me.question_title),cn(parseInt(Me==null?void 0:Me.question_score)),Ft(Me==null?void 0:Me.question_choices.map(function(Rt){return Rt.choice_text}));var At=[];Me==null||Me.standard_answer.map(function(Rt,tt){At.push(Rt-1)}),et(At)},[Me]),Object(v.useImperativeHandle)(Et,function(){return{onSave:Qt,isEdit:pn}});var Qt=function(){var At=Object(l.a)(u.a.mark(function Rt(){var tt,Wt,St;return u.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(Fe){jt.next=3;break}return p.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),jt.abrupt("return",!1);case 3:if(tt=it.findIndex(function(Xt){return!Xt}),!(tt>-1)){jt.next=7;break}return p.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ge[tt]," \u9009\u9879\u7684\u5185\u5BB9")),jt.abrupt("return",!1);case 7:if(at.length){jt.next=10;break}return p.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),jt.abrupt("return",!1);case 10:if(!(at.length<1)){jt.next=13;break}return p.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),jt.abrupt("return",!1);case 13:if(Wt=it.map(function(Xt,fn){return{choice_text:Xt,is_answer:at.includes(fn)?fn+1:0}}),!Me.question_id){jt.next=20;break}return jt.next=17,yt({type:"exercise/editExerciseQuestion",payload:{id:Me.question_id,question_title:Fe,question_type:1,question_score:"5.0",question_choices:Wt.map(function(Xt){return Xt.choice_text}),standard_answers:Wt.filter(function(Xt){return Xt.is_answer}).map(function(Xt){return Xt.is_answer})}});case 17:St=jt.sent,jt.next=23;break;case 20:return jt.next=22,yt({type:"exercise/addExerciseQuestion",payload:{categoryId:Ht.categoryId,question_title:Fe,question_type:1,question_score:"5.0",question_choices:Wt.map(function(Xt){return Xt.choice_text}),standard_answers:Wt.filter(function(Xt){return Xt.is_answer}).map(function(Xt){return Xt.is_answer})}});case 22:St=jt.sent;case 23:St.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),He(!1),yt({type:"exercise/editExercise",payload:Object(h.a)({},Ht)}));case 24:case"end":return jt.stop()}},Rt)}));return function(){return At.apply(this,arguments)}}(),$t=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ut=function(){var At=Object(l.a)(u.a.mark(function Rt(tt){return u.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:St.t0=tt.id,St.next=St.t0==="del"?3:St.t0==="up"||St.t0==="down"?5:St.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function jt(){return u.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(Te.n)({id:Me.question_id});case 2:yt({type:"exercise/editExercise",payload:Object(h.a)({},Ht)});case 3:case"end":return fn.stop()}},jt)}))()}}),St.abrupt("break",11);case 5:return St.next=7,yt({type:"exercise/exeriseMoveUpDown",payload:{id:Me.question_id,opr:tt.id}});case 7:return yt({type:"exercise/editExercise",payload:Object(h.a)({},Ht)}),St.abrupt("break",11);case 9:return He(!0),St.abrupt("break",11);case 11:case"end":return St.stop()}},Rt)}));return function(tt){return At.apply(this,arguments)}}(),Lt=function(){var Rt;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Me.key,"\u3001\u591A\u9009\u9898"),"\uFF08",Me.question_score,"\u5206\uFF09"),!Me.hideAction&&$t.map(function(tt,Wt){return tt.id==="up"&&Me.key===1||tt.id==="down"&&Me.key===Me.len?null:a.a.createElement(P.a,{key:Wt,placement:"bottom",title:tt.name},a.a.createElement("span",{onClick:function(){return Ut(tt)},className:tt.icon}))})),a.a.createElement("div",{className:"mt5"},a.a.createElement(Ae.a,{value:Me.question_title})),a.a.createElement("div",{className:_e.a.questionChoices},Me==null||((Rt=Me.question_choices)===null||Rt===void 0)?void 0:Rt.map(function(tt,Wt){return a.a.createElement(W.a,null,a.a.createElement(L.a,null,a.a.createElement(Z.a,{key:Wt,checked:Me.standard_answer.includes(Wt+1),disabled:!0},ge[Wt],".")),a.a.createElement(L.a,{flex:"1"},a.a.createElement("span",{className:"c-black font14"},a.a.createElement(Ae.a,{value:tt.choice_text}))))})))},_n=function(){return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),a.a.createElement("p",{className:_e.a.titleWrap},a.a.createElement("span",{className:_e.a.required},"*"),a.a.createElement("span",{className:_e.a.title},"\u9898\u5E72\uFF1A")),a.a.createElement(be.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Fe,onChange:function(tt){return ht(tt)}}),it.map(function(Rt,tt){return a.a.createElement("div",{className:_e.a.choiceWrap,key:tt},a.a.createElement(P.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},a.a.createElement("div",{className:"".concat(_e.a.answer," ").concat(at.includes(tt)?_e.a.activeAnswer:""),onClick:function(){at.includes(tt)?et(at.filter(function(St){return St!==tt})):et([].concat(Object(o.a)(at),[tt]))}},ge[tt])),a.a.createElement("div",{className:_e.a.editorWrap},ze===tt?a.a.createElement(be.a,{id:"single-question-option-".concat(tt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Rt,onChange:function(St){it[tt]=St,Ft(it)}}):a.a.createElement("div",{className:_e.a.htmlWrap,onClick:function(){return kt(tt)}},a.a.createElement(Ae.a,{value:Rt}))),tt>1&&a.a.createElement(P.a,{title:"\u5220\u9664"},a.a.createElement("i",{className:"".concat(_e.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Ft(it.filter(function(St,mn){return mn!==tt}))}})),tt<7&&tt===it.length-1&&a.a.createElement(P.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},a.a.createElement("i",{className:"".concat(_e.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Ft([].concat(Object(o.a)(it),[""]))}})))}),a.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),a.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",a.a.createElement(E.a,{value:bn,max:1e4,min:-1,onChange:function(tt){cn(tt)}})," ","\u5206"),a.a.createElement("aside",{className:"tr"},Me.question_id&&a.a.createElement(X.a,{type:"default",onClick:function(){return He(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return Qt()}},"\u4FDD\u5B58")))};return a.a.createElement("section",{className:_e.a.wrap},!pn&&Lt(),pn&&_n())},I=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(V)),F=$("7Kak"),J=$("9yH6"),ne=["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"],z=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.onRef,xn=Qe===void 0?function(){}:Qe,Me=Ue.editData,un=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ft=Object(v.useState)([]),wt=Object(x.a)(ft,2),it=wt[0],Ft=wt[1],tn=Object(v.useState)(),Dt=Object(x.a)(tn,2),ze=Dt[0],kt=Dt[1],Ot=Object(v.useState)([]),nt=Object(x.a)(Ot,2),at=nt[0],et=nt[1],Vt=Object(v.useState)(""),Bt=Object(x.a)(Vt,2),Fe=Bt[0],ht=Bt[1],hn=Object(v.useState)(0),vn=Object(x.a)(hn,2),bn=vn[0],cn=vn[1],yn=Object(v.useState)(!1),Tt=Object(x.a)(yn,2),pn=Tt[0],He=Tt[1],Ht=Object(_.i)();Object(v.useEffect)(function(){Ft(["","","",""])},[]),Object(v.useEffect)(function(){if(!(Me!=null&&Me.question_choices)){He(!0);return}ht(Me==null?void 0:Me.question_title),cn(parseInt(Me==null?void 0:Me.question_score)),Ft(Me==null?void 0:Me.question_choices.map(function(Rt){return Rt.choice_text}));var At=[];Me==null||Me.standard_answer.map(function(Rt,tt){At.push(Rt-1)}),et(At)},[Me]),Object(v.useImperativeHandle)(Et,function(){return{onSave:Qt,isEdit:pn}});var Qt=function(){var At=Object(l.a)(u.a.mark(function Rt(){var tt,Wt,St;return u.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(Fe){jt.next=3;break}return p.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),jt.abrupt("return",!1);case 3:if(tt=it.findIndex(function(Xt){return!Xt}),!(tt>-1)){jt.next=7;break}return p.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ne[tt]," \u9009\u9879\u7684\u5185\u5BB9")),jt.abrupt("return",!1);case 7:if(at.length){jt.next=10;break}return p.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),jt.abrupt("return",!1);case 10:if(!(at.length<1)){jt.next=13;break}return p.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),jt.abrupt("return",!1);case 13:if(Wt=it.map(function(Xt,fn){return{choice_text:Xt,is_answer:at.includes(fn)?fn+1:0}}),!Me.question_id){jt.next=20;break}return jt.next=17,Object(U.u)({id:Me.question_id,question_title:Fe,question_type:1,question_score:bn,question_choices:Wt.map(function(Xt){return Xt.choice_text}),standard_answers:Wt.filter(function(Xt){return Xt.is_answer}).map(function(Xt){return Xt.is_answer})});case 17:St=jt.sent,jt.next=23;break;case 20:return jt.next=22,Object(U.a)({exercise_bank_id:Ht.topicId,question_title:Fe,question_type:1,question_score:"5.0",question_choices:Wt.map(function(Xt){return Xt.choice_text}),standard_answers:Wt.filter(function(Xt){return Xt.is_answer}).map(function(Xt){return Xt.is_answer})});case 22:St=jt.sent;case 23:return St.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),He(!1)),jt.next=26,yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},Ht)});case 26:case"end":return jt.stop()}},Rt)}));return function(){return At.apply(this,arguments)}}(),$t=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ut=function(){var At=Object(l.a)(u.a.mark(function Rt(tt){return u.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:St.t0=tt.id,St.next=St.t0==="del"?3:St.t0==="up"||St.t0==="down"?5:St.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function jt(){return u.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(U.e)({pollsId:Me.question_id});case 2:yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},Ht)});case 3:case"end":return fn.stop()}},jt)}))()}}),St.abrupt("break",11);case 5:return St.next=7,Object(U.j)({exerciseId:Me==null?void 0:Me.question_id,opr:tt.id});case 7:return yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},Ht)}),St.abrupt("break",11);case 9:return He(!0),St.abrupt("break",11);case 11:case"end":return St.stop()}},Rt)}));return function(tt){return At.apply(this,arguments)}}(),Lt=function(){var Rt;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Me.key,"\u3001\u5355\u9009\u9898"),"\uFF08",Me.question_score,"\u5206\uFF09"),!Me.hideAction&&$t.map(function(tt,Wt){return tt.id==="up"&&Me.key===1||tt.id==="down"&&Me.key===Me.len?null:a.a.createElement(P.a,{key:Wt,placement:"bottom",title:tt.name},a.a.createElement("span",{onClick:function(){return Ut(tt)},className:tt.icon}))})),a.a.createElement("div",{className:"mt5"},a.a.createElement(Ae.a,{value:Me.question_title})),a.a.createElement("div",{className:_e.a.questionChoices},Me==null||((Rt=Me.question_choices)===null||Rt===void 0)?void 0:Rt.map(function(tt,Wt){return a.a.createElement(W.a,null,a.a.createElement(L.a,null,a.a.createElement(J.a,{key:Wt,checked:Me.standard_answer.includes(Wt+1),disabled:!0},ne[Wt],".")),a.a.createElement(L.a,{flex:"1"},a.a.createElement("span",{className:"c-black font14"},a.a.createElement(Ae.a,{value:tt.choice_text}))))})))},_n=function(){return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),a.a.createElement("p",{className:_e.a.titleWrap},a.a.createElement("span",{className:_e.a.required},"*"),a.a.createElement("span",{className:_e.a.title},"\u9898\u5E72\uFF1A")),a.a.createElement(be.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Fe,onChange:function(tt){return ht(tt)}}),it.map(function(Rt,tt){return a.a.createElement("div",{className:_e.a.choiceWrap,key:tt},a.a.createElement(P.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},a.a.createElement("div",{className:"".concat(_e.a.answer," ").concat(at.includes(tt)?_e.a.activeAnswer:""),onClick:function(){at.includes(tt)?et(at.filter(function(St){return St!==tt})):et([].concat(Object(o.a)(at),[tt]))}},ne[tt])),a.a.createElement("div",{className:_e.a.editorWrap},ze===tt?a.a.createElement(be.a,{id:"single-question-option-".concat(tt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Rt,onChange:function(St){it[tt]=St,Ft(it)}}):a.a.createElement("div",{className:_e.a.htmlWrap,onClick:function(){return kt(tt)}},a.a.createElement(Ae.a,{value:Rt}))),tt>1&&a.a.createElement(P.a,{title:"\u5220\u9664"},a.a.createElement("i",{className:"".concat(_e.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Ft(it.filter(function(St,mn){return mn!==tt}))}})),tt<7&&tt===it.length-1&&a.a.createElement(P.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},a.a.createElement("i",{className:"".concat(_e.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Ft([].concat(Object(o.a)(it),[""]))}})))}),a.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),a.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",a.a.createElement(E.a,{value:bn,max:1e4,min:-1,onChange:function(tt){cn(tt)}})," ","\u5206"),a.a.createElement("aside",{className:"tr"},Me.question_id&&a.a.createElement(X.a,{type:"default",onClick:function(){return He(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return Qt()}},"\u4FDD\u5B58")))};return a.a.createElement("section",{className:_e.a.wrap},!pn&&Lt(),pn&&_n())},me=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(z)),Oe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ke=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.onRef,xn=Qe===void 0?function(){}:Qe,Me=Ue.editData,un=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ft=Object(v.useState)(),wt=Object(x.a)(ft,2),it=wt[0],Ft=wt[1],tn=Object(v.useState)(""),Dt=Object(x.a)(tn,2),ze=Dt[0],kt=Dt[1],Ot=Object(v.useState)(!1),nt=Object(x.a)(Ot,2),at=nt[0],et=nt[1],Vt=Object(v.useState)(5),Bt=Object(x.a)(Vt,2),Fe=Bt[0],ht=Bt[1],hn=Object(_.i)();Object(v.useEffect)(function(){if(!(Me!=null&&Me.question_choices)){et(!0);return}kt(Me==null?void 0:Me.question_title),ht(Me==null?void 0:Me.question_score),Ft(Me.standard_answer[0]+"")},[Me]),Object(v.useImperativeHandle)(Et,function(){return{onSave:vn,isEdit:at}});var vn=function(){var pn=Object(l.a)(u.a.mark(function He(){var Ht,Qt;return u.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(ze){Ut.next=3;break}return p.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Ut.abrupt("return",!1);case 3:if(it){Ut.next=6;break}return p.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),Ut.abrupt("return",!1);case 6:if(Ht=[{choice_text:"\u6B63\u786E",is_answer:it==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:it==="2"?2:0}],!Me.question_id){Ut.next=13;break}return Ut.next=10,Object(U.u)({id:Me.question_id,question_title:ze,question_type:2,question_score:Fe,question_choices:Ht.map(function(Lt){return Lt.choice_text}),standard_answers:Ht.filter(function(Lt){return Lt.is_answer}).map(function(Lt){return Lt.is_answer})});case 10:Qt=Ut.sent,Ut.next=16;break;case 13:return Ut.next=15,Object(U.a)({exercise_bank_id:hn.topicId,question_title:ze,question_type:2,question_score:Fe,question_choices:Ht.map(function(Lt){return Lt.choice_text}),standard_answers:Ht.filter(function(Lt){return Lt.is_answer}).map(function(Lt){return Lt.is_answer})});case 15:Qt=Ut.sent;case 16:return Qt.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),et(!1)),yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},hn)}),Ut.abrupt("return",{name:ze,choices:Ht});case 19:case"end":return Ut.stop()}},He)}));return function(){return pn.apply(this,arguments)}}(),bn=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],cn=function(){var pn=Object(l.a)(u.a.mark(function He(Ht){return u.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:$t.t0=Ht.id,$t.next=$t.t0==="del"?3:$t.t0==="up"||$t.t0==="down"?5:$t.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function Lt(){return u.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(U.e)({pollsId:Me.question_id});case 2:yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},hn)});case 3:case"end":return At.stop()}},Lt)}))()}}),$t.abrupt("break",11);case 5:return $t.next=7,Object(U.j)({exerciseId:Me==null?void 0:Me.question_id,opr:Ht.id});case 7:return yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},hn)}),$t.abrupt("break",11);case 9:return et(!0),$t.abrupt("break",11);case 11:case"end":return $t.stop()}},He)}));return function(Ht){return pn.apply(this,arguments)}}(),yn=function(){var He;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Me.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",Me.question_score,"\u5206\uFF09"),!Me.hideAction&&bn.map(function(Ht,Qt){return Ht.id==="up"&&Me.key===1||Ht.id==="down"&&Me.key===Me.len?null:a.a.createElement(P.a,{key:Qt,placement:"bottom",title:Ht.name},a.a.createElement("span",{onClick:function(){return cn(Ht)},className:Ht.icon}))})),a.a.createElement("div",{className:"mt5"},Me.question_title),a.a.createElement("div",{className:_e.a.questionChoices},Me==null||((He=Me.question_choices)===null||He===void 0)?void 0:He.map(function(Ht,Qt){return a.a.createElement(J.a,{key:Qt,checked:Me.standard_answer.includes(Qt+1),disabled:!0},Oe[Qt],"."," ",a.a.createElement("span",{className:"c-black font14"},Ht.choice_text))})))},Tt=function(){return a.a.createElement("aside",null,a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),a.a.createElement("p",{className:_e.a.titleWrap},a.a.createElement("span",{className:_e.a.required},"*"),a.a.createElement("span",{className:_e.a.title},"\u9898\u5E72\uFF1A")),a.a.createElement(be.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ze,onChange:function(Ht){return kt(Ht)}}),a.a.createElement("p",{className:_e.a.titleWrap},a.a.createElement("span",{className:_e.a.required},"*"),a.a.createElement("span",{className:_e.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",a.a.createElement("span",{className:_e.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),a.a.createElement(J.a.Group,{buttonStyle:"solid",value:it,onChange:function(Ht){return Ft(Ht.target.value)}},a.a.createElement(J.a.Button,{value:"1",className:"".concat(_e.a.radio," mr40")},"\u6B63\u786E"),a.a.createElement(J.a.Button,{value:"2",className:_e.a.radio},"\u9519\u8BEF")),a.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),a.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",a.a.createElement(E.a,{value:Fe,max:1e4,min:-1,onChange:function(Ht){ht(Ht)}})," ","\u5206"),a.a.createElement("aside",{className:"tr"},Me.question_id&&a.a.createElement(X.a,{type:"default",onClick:function(){return et(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return vn()}},"\u4FDD\u5B58")))};return a.a.createElement("section",{className:_e.a.wrap},!at&&yn(),at&&Tt())},ce=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(ke)),ye=$("kqOp"),Se=$("7qnI"),Le=$("1vsH"),Be=["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"],We=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.editData,xn=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","editData"]),Me=Object(v.useState)(""),un=Object(x.a)(Me,2),ft=un[0],wt=un[1],it=Object(v.useState)(""),Ft=Object(x.a)(it,2),tn=Ft[0],Dt=Ft[1],ze=Object(v.useState)([]),kt=Object(x.a)(ze,2),Ot=kt[0],nt=kt[1],at=Object(v.useState)(""),et=Object(x.a)(at,2),Vt=et[0],Bt=et[1],Fe=Object(v.useState)(),ht=Object(x.a)(Fe,2),hn=ht[0],vn=ht[1],bn=Object(v.useState)(!1),cn=Object(x.a)(bn,2),yn=cn[0],Tt=cn[1],pn=Object(v.useState)(5),He=Object(x.a)(pn,2),Ht=He[0],Qt=He[1],$t=Object(v.useState)(!1),Ut=Object(x.a)($t,2),Lt=Ut[0],_n=Ut[1],At=Object(_.i)();Object(v.useEffect)(function(){if(!(Qe!=null&&Qe.question_title)){_n(!0);return}wt(Qe==null?void 0:Qe.question_title),vn(Qe==null?void 0:Qe.is_ordered),Qt(Qe==null?void 0:Qe.question_score);var nn=Qe==null?void 0:Qe.standard_answer.map(function(bt){return bt.answer_text});nt(nn)},[vt.editData]),Object(v.useEffect)(function(){Tt(!1)},[Lt]),Object(v.useImperativeHandle)(Et,function(){return{onSave:Rt,isEdit:Lt}});var Rt=function(){var nn=Object(l.a)(u.a.mark(function bt(){var ct,Mt,Zt;return u.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:if(ct=[],Mt=!1,Ot.forEach(function(Vn,ei){ct.push({choice_id:ei+1,answer_text:[]}),Vn.forEach(function(hi,_i){ct[ei].answer_text.push(hi),(!hi||!Object(Le.eb)(hi,1e4))&&(Bt("".concat(ei,"-").concat(_i)),p.b.info(hi?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Mt=!0)})}),!Mt){Pt.next=5;break}return Pt.abrupt("return",!1);case 5:if(!Qe.question_id){Pt.next=11;break}return Pt.next=8,Object(U.u)({id:Qe.question_id,question_title:ft,question_type:3,question_score:Ht,is_ordered:hn,standard_answers:ct});case 8:Zt=Pt.sent,Pt.next=14;break;case 11:return Pt.next=13,Object(U.a)({exercise_bank_id:At.topicId,question_title:ft,question_type:3,question_score:Ht,is_ordered:hn,standard_answers:ct});case 13:Zt=Pt.sent;case 14:return Zt.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),_n(!1)),yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},At)}),Pt.abrupt("return",{name:ft,analysis:tn,standard_answers:ct,is_ordered:hn});case 17:case"end":return Pt.stop()}},bt)}));return function(){return nn.apply(this,arguments)}}(),tt=function(bt,ct,Mt){var Zt=Ot.slice();if(ct&&Zt.splice(bt,ct),Mt&&yn)for(var an=0;an<Mt;an++)Zt.splice(bt+an,0,[""]);Tt(!0),nt(Zt)},Wt=function(bt,ct,Mt){Bt("");var Zt=Ot.slice();Zt[bt][ct]=Mt,nt(Zt)},St=function(bt){var ct=Ot.slice();ct[bt]=[].concat(Object(o.a)(ct[bt]),[""]),nt(ct)},mn=function(bt,ct){var Mt=Ot.slice();if(!Mt[bt][ct]){Mt[bt]=Mt[bt].filter(function(Zt,an){return an!==ct}),nt(Mt);return}de.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:_e.a.modal,onOk:function(){Mt[bt]=Mt[bt].filter(function(an,Pt){return Pt!==ct}),nt(Mt)}})},jt=function(bt){de.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:_e.a.modal,onOk:function(){var Mt=Ot.slice();Mt=Ot.filter(function(Zt,an){return bt!==an}),nt(Mt)}})},Xt=function(){return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),a.a.createElement("div",null,a.a.createElement(ye.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:ft,onChange:function(ct){return wt(ct)},showNullButton:!0,onPlaceholderChange:tt})),a.a.createElement("div",{className:"mt20"},Ot.map(function(bt,ct){return a.a.createElement(Se.a,{key:ct,answers:bt,index:ct,is_md:!0,activeOptionErrorIndex:Vt,onAnswerChange:Wt,addChildAnswer:St,deleteChildAnswer:mn,deleteChildAnswermain:jt})})),a.a.createElement("div",{className:"mt20"},Ot.length>1&&a.a.createElement("span",null,a.a.createElement(Z.a,{checked:hn,onChange:function(ct){return vn(ct.target.checked)},className:"".concat(_e.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),a.a.createElement("span",{className:"".concat(_e.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"))),a.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",a.a.createElement(E.a,{value:Ht,max:1e4,min:-1,onChange:function(ct){Qt(ct)}})," ","\u5206"),a.a.createElement("aside",{className:"tr"},Qe.question_id&&a.a.createElement(X.a,{type:"default",onClick:function(){return _n(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return Rt()}},"\u4FDD\u5B58")))},fn=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],wn=function(){var nn=Object(l.a)(u.a.mark(function bt(ct){return u.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:Zt.t0=ct.id,Zt.next=Zt.t0==="del"?3:Zt.t0==="up"||Zt.t0==="down"?5:Zt.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function Pt(){return u.a.wrap(function(ei){for(;;)switch(ei.prev=ei.next){case 0:return ei.next=2,Object(U.e)({pollsId:Qe.question_id});case 2:yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},At)});case 3:case"end":return ei.stop()}},Pt)}))()}}),Zt.abrupt("break",11);case 5:return Zt.next=7,Object(U.j)({exerciseId:Qe==null?void 0:Qe.question_id,opr:ct.id});case 7:return yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},At)}),Zt.abrupt("break",11);case 9:return _n(!0),Zt.abrupt("break",11);case 11:case"end":return Zt.stop()}},bt)}));return function(ct){return nn.apply(this,arguments)}}(),Tn=function(){var bt;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Qe.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",Qe.question_score,"\u5206\uFF09"),!Qe.hideAction&&fn.map(function(ct,Mt){return ct.id==="up"&&Qe.key===1||ct.id==="down"&&Qe.key===Qe.len?null:a.a.createElement(P.a,{key:Mt,placement:"bottom",title:ct.name},a.a.createElement("span",{onClick:function(){return wn(ct)},className:ct.icon}))})),a.a.createElement("div",{className:"mt5"},Qe.question_title),a.a.createElement("div",{className:_e.a.questionChoices},Qe==null||((bt=Qe.standard_answer)===null||bt===void 0)?void 0:bt.map(function(ct,Mt){return a.a.createElement(W.a,null,a.a.createElement(L.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",ct.choice_id,"\uFF09\uFF1A"),a.a.createElement(L.a,{flex:"1"},a.a.createElement(Y.a,{key:Mt,checked:Qe.standard_answer.includes(Mt),disabled:!0,value:ct.answer_text})))})))};return a.a.createElement("section",{className:_e.a.wrap},!Lt&&Tn(),Lt&&Xt())},Ke=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(We)),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"],lt=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.onRef,xn=Qe===void 0?function(){}:Qe,Me=Ue.editData,un=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ft=Object(v.useState)(""),wt=Object(x.a)(ft,2),it=wt[0],Ft=wt[1],tn=Object(v.useState)(""),Dt=Object(x.a)(tn,2),ze=Dt[0],kt=Dt[1],Ot=Object(v.useState)(""),nt=Object(x.a)(Ot,2),at=nt[0],et=nt[1],Vt=Object(v.useState)(5),Bt=Object(x.a)(Vt,2),Fe=Bt[0],ht=Bt[1],hn=Object(v.useState)(!1),vn=Object(x.a)(hn,2),bn=vn[0],cn=vn[1],yn=Object(_.i)();Object(v.useEffect)(function(){var $t;if(!(Me!=null&&Me.question_title)){cn(!0);return}Ft(Me==null?void 0:Me.question_title),et(Me==null||(($t=Me.standard_answer)===null||$t===void 0)?void 0:$t[0]),ht(Me==null?void 0:Me.question_score)},[vt.editData]),Object(v.useImperativeHandle)(Et,function(){return{onSave:Tt,isEdit:bn}});var Tt=function(){var $t=Object(l.a)(u.a.mark(function Ut(){var Lt;return u.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:if(it){At.next=3;break}return p.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),At.abrupt("return",!1);case 3:if(!Me.question_id){At.next=9;break}return At.next=6,Object(U.u)({id:Me.question_id,question_title:it,question_type:4,question_score:Fe,standard_answers:[at]});case 6:Lt=At.sent,At.next=12;break;case 9:return At.next=11,Object(U.a)({exercise_bank_id:yn.topicId,question_title:it,question_type:4,question_score:Fe,standard_answers:[at]});case 11:Lt=At.sent;case 12:return Lt.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),cn(!1),yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},yn)})),At.abrupt("return",{name:it,answer_texts:[at],analysis:ze});case 14:case"end":return At.stop()}},Ut)}));return function(){return $t.apply(this,arguments)}}(),pn=function(){return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u7B80\u7B54\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),a.a.createElement(be.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:it,onChange:function(Lt){return Ft(Lt)}}),a.a.createElement("p",{className:_e.a.titleWrap},a.a.createElement("span",{className:_e.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),a.a.createElement(be.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:at,onChange:function(Lt){return et(Lt)}}),a.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",a.a.createElement(E.a,{value:Fe,max:1e4,min:-1,onChange:function(Lt){ht(Lt)}})," ","\u5206"),a.a.createElement("aside",{className:"tr"},Me.question_id&&a.a.createElement(X.a,{type:"default",onClick:function(){return cn(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return Tt()}},"\u4FDD\u5B58")))},He=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],Ht=function(){var $t=Object(l.a)(u.a.mark(function Ut(Lt){return u.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:At.t0=Lt.id,At.next=At.t0==="del"?3:At.t0==="up"||At.t0==="down"?5:At.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function tt(){return u.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return St.next=2,Object(U.e)({pollsId:Me.question_id});case 2:yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},yn)});case 3:case"end":return St.stop()}},tt)}))()}}),At.abrupt("break",11);case 5:return At.next=7,Object(U.j)({exerciseId:Me==null?void 0:Me.question_id,opr:Lt.id});case 7:return yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},yn)}),At.abrupt("break",11);case 9:return cn(!0),At.abrupt("break",11);case 11:case"end":return At.stop()}},Ut)}));return function(Lt){return $t.apply(this,arguments)}}(),Qt=function(){return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Me.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",Me.question_score,"\u5206\uFF09"),!Me.hideAction&&He.map(function(Ut,Lt){return Ut.id==="up"&&Me.key===1||Ut.id==="down"&&Me.key===Me.len?null:a.a.createElement(P.a,{key:Lt,placement:"bottom",title:Ut.name},a.a.createElement("span",{onClick:function(){return Ht(Ut)},className:Ut.icon}))})),a.a.createElement("div",{className:"mt5"},Me.question_title),a.a.createElement("div",{className:_e.a.questionChoices},a.a.createElement("p",null,a.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),a.a.createElement(Ae.a,{value:at})))};return a.a.createElement("section",{className:_e.a.wrap},!bn&&Qt(),bn&&pn())},Je=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(lt)),qe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Pe=function(Ue,Et){var vt=Ue.problemset,qt=Ue.globalSetting,Yt=Ue.loading,yt=Ue.dispatch,Qe=Ue.editData,xn=Object(S.a)(Ue,["problemset","globalSetting","loading","dispatch","editData"]),Me=Object(v.useState)(""),un=Object(x.a)(Me,2),ft=un[0],wt=un[1],it=Object(v.useState)(""),Ft=Object(x.a)(it,2),tn=Ft[0],Dt=Ft[1],ze=Object(v.useState)(""),kt=Object(x.a)(ze,2),Ot=kt[0],nt=kt[1],at=Object(v.useState)([]),et=Object(x.a)(at,2),Vt=et[0],Bt=et[1],Fe=Object(v.useState)(""),ht=Object(x.a)(Fe,2),hn=ht[0],vn=ht[1],bn=Object(v.useState)(),cn=Object(x.a)(bn,2),yn=cn[0],Tt=cn[1],pn=Object(v.useState)(!1),He=Object(x.a)(pn,2),Ht=He[0],Qt=He[1],$t=Object(v.useState)([]),Ut=Object(x.a)($t,2),Lt=Ut[0],_n=Ut[1],At=Object(v.useState)(!1),Rt=Object(x.a)(At,2),tt=Rt[0],Wt=Rt[1],St=Object(_.i)();Object(v.useEffect)(function(){var Tn;Qe.edit&&Wt(!0),wt(Qe.shixun_name),Dt(Qe.question_title);var nn=[];(Tn=Qe.shixun)===null||Tn===void 0||Tn.map(function(bt){nn.push(bt.challenge_score)}),_n(nn)},[Qe]),Object(v.useEffect)(function(){Qt(!1)},[tt]),Object(v.useImperativeHandle)(Et,function(){return{onSave:mn,isEdit:tt}});var mn=function(){var Tn=Object(l.a)(u.a.mark(function nn(){var bt,ct,Mt;return u.a.wrap(function(an){for(;;)switch(an.prev=an.next){case 0:if(bt=[],ct=!1,!ct){an.next=4;break}return an.abrupt("return",!1);case 4:if(!Qe.question_id){an.next=10;break}return an.next=7,Object(U.u)({id:Qe.question_id,question_title:tn,shixun_name:ft,shixun_id:Qe.shixun_id,question_type:5,question_scores:Lt});case 7:Mt=an.sent,an.next=13;break;case 10:return an.next=12,Object(U.a)({exercise_bank_id:St.topicId,question_title:tn,shixun_name:ft,shixun_id:Qe.shixun_id,question_type:5,question_scores:Lt});case 12:Mt=an.sent;case 13:return Mt.status===0&&(p.b.success("\u4FDD\u5B58\u6210\u529F"),Wt(!1)),an.next=16,yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},St)});case 16:return an.abrupt("return",{name:tn,analysis:Ot,standard_answers:bt,is_ordered:yn});case 17:case"end":return an.stop()}},nn)}));return function(){return Tn.apply(this,arguments)}}(),jt=function(){var nn;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),a.a.createElement("div",{className:"mt10"},a.a.createElement(Y.a,{defaultValue:ft,onChange:function(ct){wt(ct.target.value)}})),a.a.createElement("div",{className:"mt10"},a.a.createElement(be.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:tn,onChange:function(ct){Dt(ct)}})),a.a.createElement("div",{className:"mt20"},(nn=Qe.shixun)===null||nn===void 0?void 0:nn.map(function(bt,ct){return a.a.createElement(W.a,{gutter:[20,20]},a.a.createElement(L.a,{flex:"1"},ct+1,".",bt.challenge_name),a.a.createElement(L.a,null,a.a.createElement(E.a,{defaultValue:Lt[ct],onChange:function(Zt){Lt[ct]=Zt,_n(Lt),console.log("srore:L",Lt[ct])}})))})),a.a.createElement("div",{className:"mt20"},Vt.length>1&&a.a.createElement("span",null,a.a.createElement(Z.a,{checked:yn,onChange:function(ct){return Tt(ct.target.checked)},className:"".concat(_e.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),a.a.createElement("span",{className:"".concat(_e.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"))),a.a.createElement("aside",{className:"tr"},!(Qe!=null&&Qe.edit)&&a.a.createElement(X.a,{type:"default",onClick:function(){return Wt(!1)}},"\u53D6\u6D88"),a.a.createElement(X.a,{className:"ml20",type:"primary",onClick:function(){return mn()}},"\u4FDD\u5B58")))},Xt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-shangyi_Hover",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiayi_moren",id:"down"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjishijuan3x",id:"edit"}],fn=function(){var Tn=Object(l.a)(u.a.mark(function nn(bt){return u.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:Mt.t0=bt.id,Mt.next=Mt.t0==="del"?3:Mt.t0==="up"||Mt.t0==="down"?5:Mt.t0==="edit"?9:11;break;case 3:return de.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(l.a)(u.a.mark(function an(){return u.a.wrap(function(Vn){for(;;)switch(Vn.prev=Vn.next){case 0:return Vn.next=2,Object(U.e)({pollsId:Qe.question_id});case 2:yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},St)});case 3:case"end":return Vn.stop()}},an)}))()}}),Mt.abrupt("break",11);case 5:return Mt.next=7,Object(U.j)({exerciseId:Qe==null?void 0:Qe.question_id,opr:bt.id});case 7:return yt({type:"polls/getExerciseBanks",payload:Object(h.a)({},St)}),Mt.abrupt("break",11);case 9:return Wt(!0),Mt.abrupt("break",11);case 11:case"end":return Mt.stop()}},nn)}));return function(bt){return Tn.apply(this,arguments)}}(),wn=function(){var nn;return a.a.createElement("aside",null,a.a.createElement("div",{className:_e.a.questionType},a.a.createElement("div",null,a.a.createElement("span",{className:"font16 c-blue"},Qe.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",Qe.question_score,"\u5206\uFF09"),a.a.createElement("div",{className:"tr"},a.a.createElement(N.a,{target:"_blank",to:"/shixuns/".concat(Qe.shixun_identifier,"/challenges")},"\u5B9E\u8BAD\u8BE6\u60C5"),!Qe.hideAction&&Xt.map(function(bt,ct){return bt.id==="up"&&Qe.key===1||bt.id==="down"&&Qe.key===Qe.len?null:a.a.createElement(P.a,{key:ct,placement:"bottom",title:bt.name},a.a.createElement("span",{onClick:function(){return fn(bt)},className:bt.icon}))}))),a.a.createElement("div",{className:"font16"},Qe.shixun_name),a.a.createElement("div",{className:"mt30"}),(nn=Qe.shixun)===null||nn===void 0?void 0:nn.map(function(bt,ct){return a.a.createElement("div",{key:ct},"\u7B2C",ct+1,"\u5173"," ",a.a.createElement("span",{className:"ml10"},bt.challenge_name)," ",a.a.createElement("span",{className:"ml10"},bt.challenge_score))}))};return a.a.createElement("section",{className:_e.a.wrap},!tt&&wn(),tt&&jt())},pt=Object(B.a)(function(Ve){var Ue=Ve.problemset,Et=Ve.loading,vt=Ve.globalSetting;return{problemset:Ue,globalSetting:vt,loading:Et.effects}},null,null,{forwardRef:!0})(Object(v.forwardRef)(Pe)),ut=$("bbsP"),ue=$("/wGt"),q=$("DjyN"),te=$("NUBc"),se=$("uSYw"),he=$.n(se),ie=Y.a.Search,ae=[{id:"type",name:"\u7B5B\u9009",children:[{name:"\u5168\u90E8\u5B9E\u8BAD",id:"all",type:"type"},{name:"\u6211\u7684\u5B9E\u8BAD",id:"mine",type:"type"}]},{id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]}],fe=function(Ue){var Et,vt=Ue.classroomList,qt=Ue.loading,Yt=Ue.dispatch,yt=Ue.callback,Qe=Object(_.i)(),xn=Object(_.h)(),Me=vt.actionTabs,un=A.a.useForm(),ft=Object(x.a)(un,1),wt=ft[0],it=vt.shixunLists,Ft=Object(v.useState)([]),tn=Object(x.a)(Ft,2),Dt=tn[0],ze=tn[1],kt=Object(v.useState)({page:1,type:"all",diff:"",status:"published",order:"desc",limit:20,sort:"publish_time",no_jupyter:1}),Ot=Object(x.a)(kt,2),nt=Ot[0],at=Ot[1];return Object(v.useEffect)(function(){Yt({type:"classroomList/getShixunLists",payload:Object(h.a)({},nt)})},[Qe.categoryId]),Object(v.useEffect)(function(){ze([])},[vt.actionTabs.key]),vt.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:a.a.createElement(ue.a,{title:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",placement:"bottom",height:"100%",closable:!1,visible:vt.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",key:"bottom",className:he.a.drawer,footer:a.a.createElement("div",{className:"tc"},a.a.createElement(X.a,{size:"large",onClick:function(){Yt({type:"classroomList/setActionTabs",payload:{key:""}})},style:{marginRight:8}},"\u53D6\u6D88"),a.a.createElement(X.a,{size:"large",onClick:Object(l.a)(u.a.mark(function et(){var Vt;return u.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:Dt.length>1?p.b.error("\u53EA\u80FD\u9009\u62E9\u4E00\u4E2A\u5B9E\u8DF5\u9879\u76EE"):Dt.length===0?p.b.error("\u8BF7\u9009\u62E9\u5B9E\u8DF5\u9879\u76EE"):(yt&&yt(it==null||((Vt=it.shixun_list)===null||Vt===void 0)?void 0:Vt.filter(function(ht){return ht.id===Dt[0]})[0]),Yt({type:"classroomList/setActionTabs",payload:{key:""}}));case 1:case"end":return Fe.stop()}},et)})),type:"primary"},"\u786E\u5B9A"))},a.a.createElement("section",{className:"tc"},a.a.createElement(ie,{placeholder:"\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",enterButton:"\u641C\u7D22",size:"large",className:he.a.search,onSearch:function(Vt){nt.keyword=Vt,Yt({type:"classroomList/getShixunLists",payload:Object(h.a)({},nt)})}})),a.a.createElement("section",{className:"edu-container"},ae.map(function(et,Vt){var Bt;return a.a.createElement("ul",{className:he.a.menu,key:Vt},a.a.createElement("li",null,et.name),et==null||((Bt=et.children)===null||Bt===void 0)?void 0:Bt.map(function(Fe,ht){return a.a.createElement("li",{key:ht,className:nt[et.id]==Fe.id?he.a.actived:"",onClick:function(){nt[et.id]=Fe.id,at(Object(h.a)({},nt)),Yt({type:"classroomList/getShixunLists",payload:Object(h.a)({},nt)})}},a.a.createElement("strong",null,Fe.name))}))}),it==null||((Et=it.shixun_list)===null||Et===void 0)?void 0:Et.map(function(et,Vt){return a.a.createElement("div",{className:he.a.listItem,key:Vt},a.a.createElement(Z.a,{checked:Dt.includes(et.id),value:et.id,onChange:function(Fe){var ht=Dt.indexOf(et.id);Dt.indexOf(et.id)>-1?ze(Dt.filter(function(hn){return hn!==et.id})):ze(Dt.concat(et.id))}}),a.a.createElement("div",{className:he.a.info},a.a.createElement("div",{className:he.a.title},a.a.createElement("div",{className:he.a.titleLeft},a.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:et.title}}))),a.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},a.a.createElement("span",{className:he.a.description,dangerouslySetInnerHTML:{__html:et.description}})),a.a.createElement("div",{className:" mt15"},et.challenge_names.map(function(Bt,Fe){return a.a.createElement("span",{key:Fe,className:"mr30"},"\u7B2C",Fe+1,"\u5173 ",Bt," ")})),a.a.createElement(c.a,{dashed:!0}),a.a.createElement("div",{className:"c-light-black mt20"},a.a.createElement("span",null,et.author_name),a.a.createElement("span",{className:"ml15 mr15"},"|"),a.a.createElement("span",null,et.author_school_name),a.a.createElement("span",{className:"ml15 mr15"},"|"),a.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570:",et.level),a.a.createElement("span",{className:"ml15 mr15"},"|"),a.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570:"),a.a.createElement("span",null,et.study_count))))}),a.a.createElement("p",null)),a.a.createElement("div",{className:"tc"},a.a.createElement(te.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showQuickJumper:!0,total:it==null?void 0:it.shixuns_count,onChange:function(Vt){nt.page=Vt,ze([]),Yt({type:"classroomList/getShixunLists",payload:Object(h.a)({},nt)})}})))},pe=Object(B.a)(function(Ve){var Ue=Ve.classroomList,Et=Ve.loading;return{classroomList:Ue,loading:Et}})(fe),xe=$("uLbx"),Re=$.n(xe),Ne=w.a.SubMenu,Ye=R.a.Content,dt=R.a.Sider,gt=function(Ue){var Et,vt,qt,Yt,yt,Qe,xn,Me,un,ft,wt,it,Ft,tn,Dt,ze,kt,Ot,nt,at,et,Vt,Bt,Fe,ht,hn,vn,bn,cn,yn,Tt,pn,He,Ht,Qt,$t,Ut,Lt,_n,At,Rt,tt,Wt,St,mn,jt,Xt,fn,wn,Tn,nn,bt,ct,Mt,Zt,an,Pt=Ue.polls,Vn=Ue.globalSetting,ei=Ue.loading,hi=Ue.user,_i=Ue.dispatch,Bi=Object(S.a)(Ue,["polls","globalSetting","loading","user","dispatch"]),ri=Object(_.i)(),Ci=Object(_.h)(),ai=hi.userInfo,ci=A.a.useForm(),di=Object(x.a)(ci,1),ti=di[0],Ai=Object(v.useState)([]),ji=Object(x.a)(Ai,2),An=ji[0],Ri=ji[1],Oi=Object(v.useState)(!1),Li=Object(x.a)(Oi,2),fi=Li[0],si=Li[1],Hi=[{name:"\u9009\u62E9\u9898",id:0},{name:"\u5224\u65AD\u9898",id:2},{name:"\u586B\u7A7A\u9898",id:3},{name:"\u7B80\u7B54\u9898",id:4},{name:"\u5B9E\u8BAD\u9898",id:5}],Fn=Object(v.useRef)();Object(v.useEffect)(function(){var Un;if((Un=Pt.exerciseBanks)!==null&&Un!==void 0&&Un.exercise_questions){var Ze,Ct,xt,Gt,zt;Ri(Object(o.a)((Ze=Pt.exerciseBanks)===null||Ze===void 0?void 0:Ze.exercise_questions)),ti.setFieldsValue({exercise_name:(Ct=Pt.exerciseBanks)===null||Ct===void 0||((xt=Ct.exercise)===null||xt===void 0)?void 0:xt.exercise_name,exercise_description:(Gt=Pt.exerciseBanks)===null||Gt===void 0||((zt=Gt.exercise)===null||zt===void 0)?void 0:zt.exercise_description})}},[Pt.exerciseBanks]),Object(v.useEffect)(function(){_i({type:"polls/getExerciseBanks",payload:Object(h.a)({},ri)})},[ri.categoryId]);var Wi=function(){var Un=Object(l.a)(u.a.mark(function Ze(){var Ct,xt,Gt;return u.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:return sn.next=2,ti.validateFields();case 2:return Gt=ti.getFieldValue(),Gt.is_md=!0,Gt.topicId=(Ct=Pt.exerciseBanks)===null||Ct===void 0||((xt=Ct.exercise)===null||xt===void 0)?void 0:xt.id,si(!1),sn.next=8,Object(U.v)(Object(h.a)({},Gt));case 8:_i({type:"polls/getExerciseBanks",payload:Object(h.a)({},ri)});case 9:case"end":return sn.stop()}},Ze)}));return function(){return Un.apply(this,arguments)}}(),qi=function(){var Un=Object(l.a)(u.a.mark(function Ze(Ct){var xt;return u.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Fn==null?void 0:Fn.current;case 2:if(xt=zt.sent,!(xt!=null&&xt.isEdit)){zt.next=6;break}return p.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),zt.abrupt("return");case 6:Ct===5?_i({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}):Ri([].concat(Object(o.a)(An),[{question_type:Ct}]));case 7:case"end":return zt.stop()}},Ze)}));return function(Ct){return Un.apply(this,arguments)}}(),Ei=function(){return An==null?void 0:An.map(function(Ze,Ct){if(Ze.key=Ct+1,Ze.len=An.length,Ze.question_type===0)return a.a.createElement("aside",null,a.a.createElement(me,{ref:Fn,editData:Ze}),a.a.createElement(c.a,null));if(Ze.question_type===1)return a.a.createElement("aside",null,a.a.createElement(I,{ref:Fn,editData:Ze}),a.a.createElement(c.a,null));if(Ze.question_type===2)return a.a.createElement("aside",null,a.a.createElement(ce,{ref:Fn,editData:Ze}),a.a.createElement(c.a,null));if(Ze.question_type===3)return a.a.createElement("aside",null,a.a.createElement(Ke,{editData:Ze}),a.a.createElement(c.a,null));if(Ze.question_type===4)return a.a.createElement("aside",null,a.a.createElement(Je,{editData:Ze}),a.a.createElement(c.a,null));if(Ze.question_type===5)return a.a.createElement("aside",null,a.a.createElement(pt,{editData:Ze}),a.a.createElement(c.a,null))})};return a.a.createElement("section",{className:"edu-container"},a.a.createElement("section",{className:"animated fadeIn"},a.a.createElement("aside",{className:"mt10"},ai&&a.a.createElement(m.a,{separator:">"},a.a.createElement(m.a.Item,null,a.a.createElement(N.a,{to:"/users/".concat(ai.login,"/topics/personal")},"\u6211\u7684\u9898\u5E93")),a.a.createElement(m.a.Item,null,a.a.createElement(N.a,{to:"/users/".concat(ai==null?void 0:ai.login,"/topics/").concat(ri.topicId,"/").concat(ri.topictype,"/exercise/detail")},"\u8BE6\u60C5")),a.a.createElement(m.a.Item,null,"\u7F16\u8F91"))),a.a.createElement("aside",{className:[Re.a.title,"mt20"].join(" ")},a.a.createElement(W.a,{style:{width:"100%"},align:"middle"},a.a.createElement(L.a,{flex:"1"},a.a.createElement("strong",{className:"font20 ml5"},"\u7F16\u8F91\u8BD5\u5377"),a.a.createElement(Le.m,{status:[(Et=Pt.exerciseBanks)!==null&&Et!==void 0&&(vt=Et.exercise)!==null&&vt!==void 0&&vt.is_public?"\u516C\u5F00":"\u79C1\u6709"]})),a.a.createElement(L.a,null,a.a.createElement(N.a,{className:"font16 c-light-black",to:"/users/".concat(ai.login,"/topics/personal")},"\u8FD4\u56DE"))))),a.a.createElement("section",{className:[Re.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},!fi&&a.a.createElement("aside",null,a.a.createElement("div",{className:Re.a.containerDesc},a.a.createElement("div",null,(qt=Pt.exerciseBanks)===null||qt===void 0||((Yt=qt.exercise)===null||Yt===void 0)?void 0:Yt.exercise_name),a.a.createElement("div",null,a.a.createElement(P.a,{title:"\u7F16\u8F91"},a.a.createElement("span",{onClick:function(){return si(!0)},className:"iconfont c-green ml30 icon-bianjishijuan3x"})))),a.a.createElement("div",{className:"c-light-black"},(yt=Pt.exerciseBanks)===null||yt===void 0||((Qe=yt.exercise)===null||Qe===void 0)?void 0:Qe.exercise_description)),fi&&a.a.createElement(A.a,{layout:"vertical",form:ti},a.a.createElement(A.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},a.a.createElement(Y.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),a.a.createElement(A.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},a.a.createElement(Y.a.TextArea,{rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26"})),a.a.createElement(A.a.Item,{className:"tr"},a.a.createElement(X.a,{type:"primary",onClick:function(){Wi()}},"\u4FDD\u5B58")))),a.a.createElement("p",{className:"mt10",style:{display:"flex"}},a.a.createElement("span",{className:"fl",style:{flex:"1"}},!!((xn=Pt.exerciseBanks)!==null&&xn!==void 0&&(Me=xn.exercise_types)!==null&&Me!==void 0&&Me.q_singles)&&a.a.createElement("span",{className:"ml20"},"\u5355\u9009\u9898",(un=Pt.exerciseBanks)===null||un===void 0||((ft=un.exercise_types)===null||ft===void 0)?void 0:ft.q_singles,"\u9898\uFF0C\u5171",(wt=Pt.exerciseBanks)===null||wt===void 0||((it=wt.exercise_types)===null||it===void 0)?void 0:it.q_singles_scores,"\u5206"),!!((Ft=Pt.exerciseBanks)!==null&&Ft!==void 0&&(tn=Ft.exercise_types)!==null&&tn!==void 0&&tn.q_doubles)&&a.a.createElement("span",{className:"ml20"},"\u591A\u9009\u9898",(Dt=Pt.exerciseBanks)===null||Dt===void 0||((ze=Dt.exercise_types)===null||ze===void 0)?void 0:ze.q_doubles,"\u9898\uFF0C\u5171",(kt=Pt.exerciseBanks)===null||kt===void 0||((Ot=kt.exercise_types)===null||Ot===void 0)?void 0:Ot.q_doubles_scores,"\u5206"),!!((nt=Pt.exerciseBanks)!==null&&nt!==void 0&&(at=nt.exercise_types)!==null&&at!==void 0&&at.q_judges)&&a.a.createElement("span",{className:"ml20"},"\u5224\u65AD\u9898",(et=Pt.exerciseBanks)===null||et===void 0||((Vt=et.exercise_types)===null||Vt===void 0)?void 0:Vt.q_judges,"\u9898\uFF0C\u5171",(Bt=Pt.exerciseBanks)===null||Bt===void 0||((Fe=Bt.exercise_types)===null||Fe===void 0)?void 0:Fe.q_judges_scores,"\u5206"),!!((ht=Pt.exerciseBanks)!==null&&ht!==void 0&&(hn=ht.exercise_types)!==null&&hn!==void 0&&hn.q_nulls)&&a.a.createElement("span",{className:"ml20"},"\u586B\u7A7A\u9898",(vn=Pt.exerciseBanks)===null||vn===void 0||((bn=vn.exercise_types)===null||bn===void 0)?void 0:bn.q_nulls,"\u9898\uFF0C\u5171",(cn=Pt.exerciseBanks)===null||cn===void 0||((yn=cn.exercise_types)===null||yn===void 0)?void 0:yn.q_nulls_scores,"\u5206"),!!((Tt=Pt.exerciseBanks)!==null&&Tt!==void 0&&(pn=Tt.exercise_types)!==null&&pn!==void 0&&pn.q_mains)&&a.a.createElement("span",{className:"ml20"},"\u7B80\u7B54\u9898",(He=Pt.exerciseBanks)===null||He===void 0||((Ht=He.exercise_types)===null||Ht===void 0)?void 0:Ht.q_mains,"\u9898\uFF0C\u5171",(Qt=Pt.exerciseBanks)===null||Qt===void 0||(($t=Qt.exercise_types)===null||$t===void 0)?void 0:$t.q_mains_scores,"\u5206"),!!((Ut=Pt.exerciseBanks)!==null&&Ut!==void 0&&(Lt=Ut.exercise_types)!==null&&Lt!==void 0&&Lt.q_shixuns)&&a.a.createElement("span",{className:"ml20"},"\u5B9E\u8BAD\u9898",(_n=Pt.exerciseBanks)===null||_n===void 0||((At=_n.exercise_types)===null||At===void 0)?void 0:At.q_shixuns,"\u9898\uFF0C\u5171",(Rt=Pt.exerciseBanks)===null||Rt===void 0||((tt=Rt.exercise_types)===null||tt===void 0)?void 0:tt.q_shixuns_scores,"\u5206"),!!((Wt=Pt.exerciseBanks)!==null&&Wt!==void 0&&(St=Wt.exercise_types)!==null&&St!==void 0&&St.q_pros)&&a.a.createElement("span",{className:"ml20"},"\u7F16\u7A0B\u9898",(mn=Pt.exerciseBanks)===null||mn===void 0||((jt=mn.exercise_types)===null||jt===void 0)?void 0:jt.q_pros,"\u9898\uFF0C\u5171",(Xt=Pt.exerciseBanks)===null||Xt===void 0||((fn=Xt.exercise_types)===null||fn===void 0)?void 0:fn.q_pros_scores,"\u5206")),a.a.createElement("span",{className:"fr"},!!((wn=Pt.exerciseBanks)!==null&&wn!==void 0&&(Tn=wn.exercise_types)!==null&&Tn!==void 0&&Tn.q_counts)&&a.a.createElement("span",null,"\u5408\u8BA1"," ",a.a.createElement("span",{className:"color-blue"},(nn=Pt.exerciseBanks)===null||nn===void 0||((bt=nn.exercise_types)===null||bt===void 0)?void 0:bt.q_counts)," ","\u9898\uFF0C \u5171"," ",a.a.createElement("span",{className:"".concat(((ct=Pt.exerciseBanks)===null||ct===void 0||((Mt=ct.exercise_types)===null||Mt===void 0)?void 0:Mt.q_scores)>100?"color-red font-bd":"color-orange")},(Zt=Pt.exerciseBanks)===null||Zt===void 0||((an=Zt.exercise_types)===null||an===void 0)?void 0:an.q_scores)," ","\u5206"))),An!=""&&a.a.createElement("section",{className:[Re.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},Ei()),a.a.createElement("section",{style:{display:"flex"},className:[Re.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},a.a.createElement("div",{style:{flex:"1"}},Hi.map(function(Un,Ze){return a.a.createElement(X.a,{className:"mr20",type:"primary",onClick:function(){return qi(Un.id)}},a.a.createElement(T.a,{className:"mr5"}),Un.name)}))),a.a.createElement(pe,{callback:function(Ze){An.push({shixun:Ze.challenge_names.map(function(Ct){return{challenge_name:Ct,challenge_score:5}}),shixun_name:Ze.title,shixun_id:Ze.id,question_type:5,edit:!0}),Ri(Object(o.a)(An))}}))},Kt=we.default=Object(B.a)(function(Ve){var Ue=Ve.polls,Et=Ve.loading,vt=Ve.user,qt=Ve.globalSetting;return{polls:Ue,globalSetting:qt,user:vt,loading:Et.effects}})(gt)},psGv:function(rt,we,$){var le,X;(function(){var D;(function(){"use strict";var G=[,,function(b){function m(d){this.__parent=d,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}m.prototype.clone_empty=function(){var d=new m(this.__parent);return d.set_indent(this.__indent_count,this.__alignment_count),d},m.prototype.item=function(d){return d<0?this.__items[this.__items.length+d]:this.__items[d]},m.prototype.has_match=function(d){for(var p=this.__items.length-1;p>=0;p--)if(this.__items[p].match(d))return!0;return!1},m.prototype.set_indent=function(d,p){this.is_empty()&&(this.__indent_count=d||0,this.__alignment_count=p||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},m.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},m.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},m.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var d=this.__parent.current_line;return d.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),d.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),d.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,d.__items[0]===" "&&(d.__items.splice(0,1),d.__character_count-=1),!0}return!1},m.prototype.is_empty=function(){return this.__items.length===0},m.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},m.prototype.push=function(d){this.__items.push(d);var p=d.lastIndexOf(`
`);p!==-1?this.__character_count=d.length-p:this.__character_count+=d.length},m.prototype.pop=function(){var d=null;return this.is_empty()||(d=this.__items.pop(),this.__character_count-=d.length),d},m.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},m.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},m.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},m.prototype.toString=function(){var d="";return this.is_empty()?this.__parent.indent_empty_lines&&(d=this.__parent.get_indent_string(this.__indent_count)):(d=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),d+=this.__items.join("")),d};function g(d,p){this.__cache=[""],this.__indent_size=d.indent_size,this.__indent_string=d.indent_char,d.indent_with_tabs||(this.__indent_string=new Array(d.indent_size+1).join(d.indent_char)),p=p||"",d.indent_level>0&&(p=new Array(d.indent_level+1).join(this.__indent_string)),this.__base_string=p,this.__base_string_length=p.length}g.prototype.get_indent_size=function(d,p){var l=this.__base_string_length;return p=p||0,d<0&&(l=0),l+=d*this.__indent_size,l+=p,l},g.prototype.get_indent_string=function(d,p){var l=this.__base_string;return p=p||0,d<0&&(d=0,l=""),p+=d*this.__indent_size,this.__ensure_cache(p),l+=this.__cache[p],l},g.prototype.__ensure_cache=function(d){for(;d>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var d=this.__cache.length,p=0,l="";this.__indent_size&&d>=this.__indent_size&&(p=Math.floor(d/this.__indent_size),d-=p*this.__indent_size,l=new Array(p+1).join(this.__indent_string)),d&&(l+=new Array(d+1).join(" ")),this.__cache.push(l)};function c(d,p){this.__indent_cache=new g(d,p),this.raw=!1,this._end_with_newline=d.end_with_newline,this.indent_size=d.indent_size,this.wrap_line_length=d.wrap_line_length,this.indent_empty_lines=d.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new m(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(d,p){return this.__indent_cache.get_indent_string(d,p)},c.prototype.get_indent_size=function(d,p){return this.__indent_cache.get_indent_size(d,p)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(d){return this.is_empty()||!d&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(d){this.trim(!0);var p=this.current_line.pop();p&&(p[p.length-1]===`
`&&(p=p.replace(/\n+$/g,"")),this.current_line.push(p)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
`);return d!==`
`&&(l=l.replace(/[\n]/g,d)),l},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(d,p){return d=d||0,p=p||0,this.next_line.set_indent(d,p),this.__lines.length>1?(this.current_line.set_indent(d,p),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(d){for(var p=0;p<d.newlines;p++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(d.whitespace_before),this.current_line.push(d.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},c.prototype.add_token=function(d){this.__add_space_before_token(),this.current_line.push(d),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},c.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},c.prototype.remove_indent=function(d){for(var p=this.__lines.length;d<p;)this.__lines[d]._remove_indent(),d++;this.current_line._remove_wrap_indent()},c.prototype.trim=function(d){for(d=d===void 0?!1:d,this.current_line.trim();d&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(d,p){for(var l=this.__lines.length-2;l>=0;){var h=this.__lines[l];if(h.is_empty())break;if(h.item(0).indexOf(d)!==0&&h.item(-1)!==p){this.__lines.splice(l+1,0,new m(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},b.exports.Output=c},function(b){function m(g,c,d,p){this.type=g,this.text=c,this.comments_before=null,this.newlines=d||0,this.whitespace_before=p||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}b.exports.Token=m},,,function(b){function m(d,p){this.raw_options=g(d,p),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}m.prototype._get_array=function(d,p){var l=this.raw_options[d],h=p||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(h=l.concat()):typeof l=="string"&&(h=l.split(/[^a-zA-Z0-9_\/\-]+/)),h},m.prototype._get_boolean=function(d,p){var l=this.raw_options[d],h=l===void 0?!!p:!!l;return h},m.prototype._get_characters=function(d,p){var l=this.raw_options[d],h=p||"";return typeof l=="string"&&(h=l.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),h},m.prototype._get_number=function(d,p){var l=this.raw_options[d];p=parseInt(p,10),isNaN(p)&&(p=0);var h=parseInt(l,10);return isNaN(h)&&(h=p),h},m.prototype._get_selection=function(d,p,l){var h=this._get_selection_list(d,p,l);if(h.length!==1)throw new Error("Invalid Option Value: The option '"+d+`' can only be one of the following values:
`+p+`
You passed in: '`+this.raw_options[d]+"'");return h[0]},m.prototype._get_selection_list=function(d,p,l){if(!p||p.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[p[0]],!this._is_valid_selection(l,p))throw new Error("Invalid Default Value!");var h=this._get_array(d,l);if(!this._is_valid_selection(h,p))throw new Error("Invalid Option Value: The option '"+d+`' can contain only the following values:
`+p+`
You passed in: '`+this.raw_options[d]+"'");return h},m.prototype._is_valid_selection=function(d,p){return d.length&&p.length&&!d.some(function(l){return p.indexOf(l)===-1})};function g(d,p){var l={};d=c(d);var h;for(h in d)h!==p&&(l[h]=d[h]);if(p&&d[p])for(h in d[p])l[h]=d[p][h];return l}function c(d){var p={},l;for(l in d){var h=l.replace(/-/g,"_");p[h]=d[l]}return p}b.exports.Options=m,b.exports.normalizeOpts=c,b.exports.mergeOpts=g},,function(b){var m=RegExp.prototype.hasOwnProperty("sticky");function g(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var c=null;return this.hasNext()&&(c=this.__input.charAt(this.__position),this.__position+=1),c},g.prototype.peek=function(c){var d=null;return c=c||0,c+=this.__position,c>=0&&c<this.__input_length&&(d=this.__input.charAt(c)),d},g.prototype.__match=function(c,d){c.lastIndex=d;var p=c.exec(this.__input);return p&&!(m&&c.sticky)&&(p.index!==d&&(p=null)),p},g.prototype.test=function(c,d){return d=d||0,d+=this.__position,d>=0&&d<this.__input_length?!!this.__match(c,d):!1},g.prototype.testChar=function(c,d){var p=this.peek(d);return c.lastIndex=0,p!==null&&c.test(p)},g.prototype.match=function(c){var d=this.__match(c,this.__position);return d?this.__position+=d[0].length:d=null,d},g.prototype.read=function(c,d,p){var l="",h;return c&&(h=this.match(c),h&&(l+=h[0])),d&&(h||!c)&&(l+=this.readUntil(d,p)),l},g.prototype.readUntil=function(c,d){var p="",l=this.__position;c.lastIndex=this.__position;var h=c.exec(this.__input);return h?(l=h.index,d&&(l+=h[0].length)):l=this.__input_length,p=this.__input.substring(this.__position,l),this.__position=l,p},g.prototype.readUntilAfter=function(c){return this.readUntil(c,!0)},g.prototype.get_regexp=function(c,d){var p=null,l="g";return d&&m&&(l="y"),typeof c=="string"&&c!==""?p=new RegExp(c,l):c&&(p=new RegExp(c.source,l)),p},g.prototype.get_literal_regexp=function(c){return RegExp(c.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(c){var d=this.__position,p=this.readUntilAfter(c);return this.__position=d,p},g.prototype.lookBack=function(c){var d=this.__position-1;return d>=c.length&&this.__input.substring(d-c.length,d).toLowerCase()===c},b.exports.InputScanner=g},function(b,m,g){var c=g(8).InputScanner,d=g(3).Token,p=g(10).TokenStream,l=g(11).WhitespacePattern,h={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(s,A){this._input=new c(s),this._options=A||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new p,this._reset();for(var s,A=new d(h.START,""),x=null,S=[],O=new p;A.type!==h.EOF;){for(s=this._get_next_token(A,x);this._is_comment(s);)O.add(s),s=this._get_next_token(A,x);O.isEmpty()||(s.comments_before=O,O=new p),s.parent=x,this._is_opening(s)?(S.push(x),x=s):x&&this._is_closing(s,x)&&(s.opened=x,x.closed=s,x=S.pop(),s.parent=x),s.previous=A,A.next=s,this.__tokens.add(s),A=s}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(s,A){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(h.RAW,x):this._create_token(h.EOF,"")},o.prototype._is_comment=function(s){return!1},o.prototype._is_opening=function(s){return!1},o.prototype._is_closing=function(s,A){return!1},o.prototype._create_token=function(s,A){var x=new d(s,A,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},b.exports.Tokenizer=o,b.exports.TOKEN=h},function(b){function m(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}m.prototype.restart=function(){this.__position=0},m.prototype.isEmpty=function(){return this.__tokens_length===0},m.prototype.hasNext=function(){return this.__position<this.__tokens_length},m.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},m.prototype.peek=function(g){var c=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(c=this.__tokens[g]),c},m.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},b.exports.TokenStream=m},function(b,m,g){var c=g(12).Pattern;function d(p,l){c.call(this,p,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}d.prototype=new c,d.prototype.__set_whitespace_patterns=function(p,l){p+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+p+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},d.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var p=this._input.read(this._match_pattern);if(p===" ")this.whitespace_before_token=" ";else if(p){var l=this.__split(this._newline_regexp,p);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return p},d.prototype.matching=function(p,l){var h=this._create();return h.__set_whitespace_patterns(p,l),h._update(),h},d.prototype._create=function(){return new d(this._input,this)},d.prototype.__split=function(p,l){p.lastIndex=0;for(var h=0,o=[],s=p.exec(l);s;)o.push(l.substring(h,s.index)),h=s.index+s[0].length,s=p.exec(l);return h<l.length?o.push(l.substring(h,l.length)):o.push(""),o},b.exports.WhitespacePattern=d},function(b){function m(g,c){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,c&&(this._starting_pattern=this._input.get_regexp(c._starting_pattern,!0),this._match_pattern=this._input.get_regexp(c._match_pattern,!0),this._until_pattern=this._input.get_regexp(c._until_pattern),this._until_after=c._until_after)}m.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},m.prototype.read_match=function(){return this._input.match(this._match_pattern)},m.prototype.until_after=function(g){var c=this._create();return c._until_after=!0,c._until_pattern=this._input.get_regexp(g),c._update(),c},m.prototype.until=function(g){var c=this._create();return c._until_after=!1,c._until_pattern=this._input.get_regexp(g),c._update(),c},m.prototype.starting_with=function(g){var c=this._create();return c._starting_pattern=this._input.get_regexp(g,!0),c._update(),c},m.prototype.matching=function(g){var c=this._create();return c._match_pattern=this._input.get_regexp(g,!0),c._update(),c},m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){},b.exports.Pattern=m},function(b){function m(g,c){g=typeof g=="string"?g:g.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+c,"g")}m.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var d=this.__directive_pattern.exec(g);d;)c[d[1]]=d[2],d=this.__directive_pattern.exec(g);return c},m.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},b.exports.Directives=m},function(b,m,g){var c=g(12).Pattern,d={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function p(l,h){c.call(this,l,h),this.__template_pattern=null,this._disabled=Object.assign({},d),this._excluded=Object.assign({},d),h&&(this.__template_pattern=this._input.get_regexp(h.__template_pattern),this._excluded=Object.assign(this._excluded,h._excluded),this._disabled=Object.assign(this._disabled,h._disabled));var o=new c(l);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}p.prototype=new c,p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){this.__set_templated_pattern()},p.prototype.disable=function(l){var h=this._create();return h._disabled[l]=!0,h._update(),h},p.prototype.read_options=function(l){var h=this._create();for(var o in d)h._disabled[o]=l.templating.indexOf(o)===-1;return h._update(),h},p.prototype.exclude=function(l){var h=this._create();return h._excluded[l]=!0,h._update(),h},p.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var h=this._read_template();h;)this._match_pattern?h+=this._input.read(this._match_pattern):h+=this._input.readUntil(this.__template_pattern),l+=h,h=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},p.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},p.prototype._read_template=function(){var l="",h=this._input.peek();if(h==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(l=l||this.__patterns.erb.read())}else h==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},b.exports.TemplatablePattern=p},,,,function(b,m,g){var c=g(19).Beautifier,d=g(20).Options;function p(l,h,o,s){var A=new c(l,h,o,s);return A.beautify()}b.exports=p,b.exports.defaultOptions=function(){return new d}},function(b,m,g){var c=g(20).Options,d=g(2).Output,p=g(21).Tokenizer,l=g(21).TOKEN,h=/\r\n|[\r\n]/,o=/\r\n|[\r\n]/g,s=function(v,a){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=v.max_preserve_newlines,this.preserve_newlines=v.preserve_newlines,this._output=new d(v,a)};s.prototype.current_line_has_match=function(v){return this._output.current_line.has_match(v)},s.prototype.set_space_before_token=function(v,a){this._output.space_before_token=v,this._output.non_breaking_space=a},s.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},s.prototype.add_raw_token=function(v){this._output.add_raw_token(v)},s.prototype.print_preserved_newlines=function(v){var a=0;v.type!==l.TEXT&&v.previous.type!==l.TEXT&&(a=v.newlines?1:0),this.preserve_newlines&&(a=v.newlines<this.max_preserve_newlines+1?v.newlines:this.max_preserve_newlines+1);for(var _=0;_<a;_++)this.print_newline(_>0);return a!==0},s.prototype.traverse_whitespace=function(v){return v.whitespace_before||v.newlines?(this.print_preserved_newlines(v)||(this._output.space_before_token=!0),!0):!1},s.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},s.prototype.print_newline=function(v){this._output.add_new_line(v)},s.prototype.print_token=function(v){v.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(v.text))},s.prototype.indent=function(){this.indent_level++},s.prototype.get_full_indent=function(v){return v=this.indent_level+(v||0),v<1?"":this._output.get_indent_string(v)};var A=function(v){for(var a=null,_=v.next;_.type!==l.EOF&&v.closed!==_;){if(_.type===l.ATTRIBUTE&&_.text==="type"){_.next&&_.next.type===l.EQUALS&&_.next.next&&_.next.next.type===l.VALUE&&(a=_.next.next.text);break}_=_.next}return a},x=function(v,a){var _=null,N=null;return a.closed?(v==="script"?_="text/javascript":v==="style"&&(_="text/css"),_=A(a)||_,_.search("text/css")>-1?N="css":_.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":_.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":_.search(/test\/null/)>-1&&(N="null"),N):null};function S(v,a){return a.indexOf(v)!==-1}function O(v,a,_){this.parent=v||null,this.tag=a?a.tag_name:"",this.indent_level=_||0,this.parser_token=a||null}function R(v){this._printer=v,this._current_frame=null}R.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},R.prototype.record_tag=function(v){var a=new O(this._current_frame,v,this._printer.indent_level);this._current_frame=a},R.prototype._try_pop_frame=function(v){var a=null;return v&&(a=v.parser_token,this._printer.indent_level=v.indent_level,this._current_frame=v.parent),a},R.prototype._get_frame=function(v,a){for(var _=this._current_frame;_&&!(v.indexOf(_.tag)!==-1);){if(a&&a.indexOf(_.tag)!==-1){_=null;break}_=_.parent}return _},R.prototype.try_pop=function(v,a){var _=this._get_frame([v],a);return this._try_pop_frame(_)},R.prototype.indent_to_tag=function(v){var a=this._get_frame(v);a&&(this._printer.indent_level=a.indent_level)};function C(v,a,_,N){this._source_text=v||"",a=a||{},this._js_beautify=_,this._css_beautify=N,this._tag_stack=null;var B=new c(a,"html");this._options=B,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}C.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v=this._source_text,a=this._options.eol;this._options.eol==="auto"&&(a=`
`,v&&h.test(v)&&(a=v.match(h)[0])),v=v.replace(o,`
`);var _=v.match(/^[\t ]*/)[0],N={text:"",type:""},B=new w,T=new s(this._options,_),U=new p(v,this._options).tokenize();this._tag_stack=new R(T);for(var M=null,E=U.next();E.type!==l.EOF;)E.type===l.TAG_OPEN||E.type===l.COMMENT?(M=this._handle_tag_open(T,E,B,N),B=M):E.type===l.ATTRIBUTE||E.type===l.EQUALS||E.type===l.VALUE||E.type===l.TEXT&&!B.tag_complete?M=this._handle_inside_tag(T,E,B,U):E.type===l.TAG_CLOSE?M=this._handle_tag_close(T,E,B):E.type===l.TEXT?M=this._handle_text(T,E,B):T.add_raw_token(E),N=M,E=U.next();var H=T._output.get_code(a);return H},C.prototype._handle_tag_close=function(v,a,_){var N={text:a.text,type:a.type};return v.alignment_size=0,_.tag_complete=!0,v.set_space_before_token(a.newlines||a.whitespace_before!=="",!0),_.is_unformatted?v.add_raw_token(a):(_.tag_start_char==="<"&&(v.set_space_before_token(a.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&_.has_wrapped_attrs&&v.print_newline(!1)),v.print_token(a)),_.indent_content&&!(_.is_unformatted||_.is_content_unformatted)&&(v.indent(),_.indent_content=!1),!_.is_inline_element&&!(_.is_unformatted||_.is_content_unformatted)&&v.set_wrap_point(),N},C.prototype._handle_inside_tag=function(v,a,_,N){var B=_.has_wrapped_attrs,T={text:a.text,type:a.type};if(v.set_space_before_token(a.newlines||a.whitespace_before!=="",!0),_.is_unformatted)v.add_raw_token(a);else if(_.tag_start_char==="{"&&a.type===l.TEXT)v.print_preserved_newlines(a)?(a.newlines=0,v.add_raw_token(a)):v.print_token(a);else{if(a.type===l.ATTRIBUTE?(v.set_space_before_token(!0),_.attr_count+=1):(a.type===l.EQUALS||a.type===l.VALUE&&a.previous.type===l.EQUALS)&&v.set_space_before_token(!1),a.type===l.ATTRIBUTE&&_.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(v.traverse_whitespace(a),B=B||a.newlines!==0),this._is_wrap_attributes_force)){var U=_.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&_.attr_count===1){var M=!0,E=0,H;do{if(H=N.peek(E),H.type===l.ATTRIBUTE){M=!1;break}E+=1}while(E<4&&H.type!==l.EOF&&H.type!==l.TAG_CLOSE);U=!M}U&&(v.print_newline(!1),B=!0)}v.print_token(a),B=B||v.previous_token_wrapped(),_.has_wrapped_attrs=B}return T},C.prototype._handle_text=function(v,a,_){var N={text:a.text,type:"TK_CONTENT"};return _.custom_beautifier_name?this._print_custom_beatifier_text(v,a,_):_.is_unformatted||_.is_content_unformatted?v.add_raw_token(a):(v.traverse_whitespace(a),v.print_token(a)),N},C.prototype._print_custom_beatifier_text=function(v,a,_){var N=this;if(a.text!==""){var B=a.text,T,U=1,M="",E="";_.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?T=this._js_beautify:_.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?T=this._css_beautify:_.custom_beautifier_name==="html"&&(T=function(be,Ae){var Ce=new C(be,Ae,N._js_beautify,N._css_beautify);return Ce.beautify()}),this._options.indent_scripts==="keep"?U=0:this._options.indent_scripts==="separate"&&(U=-v.indent_level);var H=v.get_full_indent(U);if(B=B.replace(/\n[ \t]*$/,""),_.custom_beautifier_name!=="html"&&B[0]==="<"&&B.match(/^(<!--|<!\[CDATA\[)/)){var Z=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(B);if(!Z){v.add_raw_token(a);return}M=H+Z[1]+`
`,B=Z[4],Z[5]&&(E=H+Z[5]),B=B.replace(/\n[ \t]*$/,""),(Z[2]||Z[3].indexOf(`
`)!==-1)&&(Z=Z[3].match(/[ \t]+$/),Z&&(a.whitespace_before=Z[0]))}if(B)if(T){var oe=function(){this.eol=`
`};oe.prototype=this._options.raw_options;var de=new oe;B=T(H+B,de)}else{var Te=a.whitespace_before;Te&&(B=B.replace(new RegExp(`
(`+Te+")?","g"),`
`)),B=H+B.replace(/\n/g,`
`+H)}M&&(B?B=M+B+`
`+E:B=M+E),v.print_newline(!1),B&&(a.text=B,a.whitespace_before="",a.newlines=0,v.add_raw_token(a),v.print_newline(!0))}},C.prototype._handle_tag_open=function(v,a,_,N){var B=this._get_tag_open_token(a);return(_.is_unformatted||_.is_content_unformatted)&&!_.is_empty_element&&a.type===l.TAG_OPEN&&a.text.indexOf("</")===0?(v.add_raw_token(a),B.start_tag_token=this._tag_stack.try_pop(B.tag_name)):(v.traverse_whitespace(a),this._set_tag_position(v,a,B,_,N),B.is_inline_element||v.set_wrap_point(),v.print_token(a)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(B.alignment_size=a.text.length+1),!B.tag_complete&&!B.is_unformatted&&(v.alignment_size=B.alignment_size),B};var w=function(v,a){if(this.parent=v||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!a)this.tag_complete=!0;else{var _;this.tag_start_char=a.text[0],this.text=a.text,this.tag_start_char==="<"?(_=a.text.match(/^<([^\s>]*)/),this.tag_check=_?_[1]:""):(_=a.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=_?_[1]:"",(a.text.startsWith("{{#>")||a.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&a.next!==null?this.tag_check=a.next.text.split(" ")[0]:this.tag_check=a.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),a.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||a.closed&&a.closed.text==="/>";var N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};C.prototype._get_tag_open_token=function(v){var a=new w(this._tag_stack.get_parser_token(),v);return a.alignment_size=this._options.wrap_attributes_indent_size,a.is_end_tag=a.is_end_tag||S(a.tag_check,this._options.void_elements),a.is_empty_element=a.tag_complete||a.is_start_tag&&a.is_end_tag,a.is_unformatted=!a.tag_complete&&S(a.tag_check,this._options.unformatted),a.is_content_unformatted=!a.is_empty_element&&S(a.tag_check,this._options.content_unformatted),a.is_inline_element=S(a.tag_name,this._options.inline)||a.tag_name.includes("-")||a.tag_start_char==="{",a},C.prototype._set_tag_position=function(v,a,_,N,B){if(_.is_empty_element||(_.is_end_tag?_.start_tag_token=this._tag_stack.try_pop(_.tag_name):(this._do_optional_end_element(_)&&(_.is_inline_element||v.print_newline(!1)),this._tag_stack.record_tag(_),(_.tag_name==="script"||_.tag_name==="style")&&!(_.is_unformatted||_.is_content_unformatted)&&(_.custom_beautifier_name=x(_.tag_check,a)))),S(_.tag_check,this._options.extra_liners)&&(v.print_newline(!1),v._output.just_added_blankline()||v.print_newline(!0)),_.is_empty_element){if(_.tag_start_char==="{"&&_.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),_.indent_content=!0;var T=v.current_line_has_match(/{{#if/);T||v.print_newline(!1)}_.tag_name==="!--"&&B.type===l.TAG_CLOSE&&N.is_end_tag&&_.text.indexOf(`
`)===-1||(_.is_inline_element||_.is_unformatted||v.print_newline(!1),this._calcluate_parent_multiline(v,_))}else if(_.is_end_tag){var U=!1;U=_.start_tag_token&&_.start_tag_token.multiline_content,U=U||!_.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(B.type===l.TAG_CLOSE&&_.start_tag_token===N)&&B.type!=="TK_CONTENT",(_.is_content_unformatted||_.is_unformatted)&&(U=!1),U&&v.print_newline(!1)}else _.indent_content=!_.custom_beautifier_name,_.tag_start_char==="<"&&(_.tag_name==="html"?_.indent_content=this._options.indent_inner_html:_.tag_name==="head"?_.indent_content=this._options.indent_head_inner_html:_.tag_name==="body"&&(_.indent_content=this._options.indent_body_inner_html)),!(_.is_inline_element||_.is_unformatted)&&(B.type!=="TK_CONTENT"||_.is_content_unformatted)&&v.print_newline(!1),this._calcluate_parent_multiline(v,_)},C.prototype._calcluate_parent_multiline=function(v,a){a.parent&&v._output.just_added_newline()&&!((a.is_inline_element||a.is_unformatted)&&a.parent.is_inline_element)&&(a.parent.multiline_content=!0)};var y=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],u=["a","audio","del","ins","map","noscript","video"];C.prototype._do_optional_end_element=function(v){var a=null;if(v.is_empty_element||!v.is_start_tag||!v.parent)return;if(v.tag_name==="body")a=a||this._tag_stack.try_pop("head");else if(v.tag_name==="li")a=a||this._tag_stack.try_pop("li",["ol","ul"]);else if(v.tag_name==="dd"||v.tag_name==="dt")a=a||this._tag_stack.try_pop("dt",["dl"]),a=a||this._tag_stack.try_pop("dd",["dl"]);else if(v.parent.tag_name==="p"&&y.indexOf(v.tag_name)!==-1){var _=v.parent.parent;(!_||u.indexOf(_.tag_name)===-1)&&(a=a||this._tag_stack.try_pop("p"))}else v.tag_name==="rp"||v.tag_name==="rt"?(a=a||this._tag_stack.try_pop("rt",["ruby","rtc"]),a=a||this._tag_stack.try_pop("rp",["ruby","rtc"])):v.tag_name==="optgroup"?a=a||this._tag_stack.try_pop("optgroup",["select"]):v.tag_name==="option"?a=a||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):v.tag_name==="colgroup"?a=a||this._tag_stack.try_pop("caption",["table"]):v.tag_name==="thead"?(a=a||this._tag_stack.try_pop("caption",["table"]),a=a||this._tag_stack.try_pop("colgroup",["table"])):v.tag_name==="tbody"||v.tag_name==="tfoot"?(a=a||this._tag_stack.try_pop("caption",["table"]),a=a||this._tag_stack.try_pop("colgroup",["table"]),a=a||this._tag_stack.try_pop("thead",["table"]),a=a||this._tag_stack.try_pop("tbody",["table"])):v.tag_name==="tr"?(a=a||this._tag_stack.try_pop("caption",["table"]),a=a||this._tag_stack.try_pop("colgroup",["table"]),a=a||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(v.tag_name==="th"||v.tag_name==="td")&&(a=a||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),a=a||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return v.parent=this._tag_stack.get_parser_token(),a},b.exports.Beautifier=C},function(b,m,g){var c=g(6).Options;function d(p){c.call(this,p,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}d.prototype=new c,b.exports.Options=d},function(b,m,g){var c=g(9).Tokenizer,d=g(9).TOKEN,p=g(13).Directives,l=g(14).TemplatablePattern,h=g(12).Pattern,o={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:d.START,RAW:d.RAW,EOF:d.EOF},s=new p(/<\!--/,/-->/),A=function(x,S){c.call(this,x,S),this._current_tag_name="";var O=new l(this._input).read_options(this._options),R=new h(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:R.starting_with(/{{!--/).until_after(/--}}/),handlebars:R.starting_with(/{{/).until_after(/}}/),handlebars_open:R.until(/[\n\r\t }]/),handlebars_raw_close:R.until(/}}/),comment:R.starting_with(/<!--/).until_after(/-->/),cdata:R.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:R.starting_with(/<!\[/).until_after(/]>/),processing:R.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var C=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=R.matching(C).until_after(C)}};A.prototype=new c,A.prototype._is_comment=function(x){return!1},A.prototype._is_opening=function(x){return x.type===o.TAG_OPEN},A.prototype._is_closing=function(x,S){return x.type===o.TAG_CLOSE&&S&&((x.text===">"||x.text==="/>")&&S.text[0]==="<"||x.text==="}}"&&S.text[0]==="{"&&S.text[1]==="{")},A.prototype._reset=function(){this._current_tag_name=""},A.prototype._get_next_token=function(x,S){var O=null;this._readWhitespace();var R=this._input.peek();return R===null?this._create_token(o.EOF,""):(O=O||this._read_open_handlebars(R,S),O=O||this._read_attribute(R,x,S),O=O||this._read_close(R,S),O=O||this._read_raw_content(R,x,S),O=O||this._read_content_word(R),O=O||this._read_comment_or_cdata(R),O=O||this._read_processing(R),O=O||this._read_open(R,S),O=O||this._create_token(o.UNKNOWN,this._input.next()),O)},A.prototype._read_comment_or_cdata=function(x){var S=null,O=null,R=null;if(x==="<"){var C=this._input.peek(1);C==="!"&&(O=this.__patterns.comment.read(),O?(R=s.get_directives(O),R&&R.ignore==="start"&&(O+=s.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(S=this._create_token(o.COMMENT,O),S.directives=R)}return S},A.prototype._read_processing=function(x){var S=null,O=null,R=null;if(x==="<"){var C=this._input.peek(1);(C==="!"||C==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(S=this._create_token(o.COMMENT,O),S.directives=R)}return S},A.prototype._read_open=function(x,S){var O=null,R=null;return S||x==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),R=this._create_token(o.TAG_OPEN,O)),R},A.prototype._read_open_handlebars=function(x,S){var O=null,R=null;return S||this._options.indent_handlebars&&x==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),R=this._create_token(o.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),R=this._create_token(o.TAG_OPEN,O))),R},A.prototype._read_close=function(x,S){var O=null,R=null;return S&&(S.text[0]==="<"&&(x===">"||x==="/"&&this._input.peek(1)===">")?(O=this._input.next(),x==="/"&&(O+=this._input.next()),R=this._create_token(o.TAG_CLOSE,O)):S.text[0]==="{"&&x==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),R=this._create_token(o.TAG_CLOSE,"}}"))),R},A.prototype._read_attribute=function(x,S,O){var R=null,C="";if(O&&O.text[0]==="<")if(x==="=")R=this._create_token(o.EQUALS,this._input.next());else if(x==='"'||x==="'"){var w=this._input.next();x==='"'?w+=this.__patterns.double_quote.read():w+=this.__patterns.single_quote.read(),R=this._create_token(o.VALUE,w)}else C=this.__patterns.attribute.read(),C&&(S.type===o.EQUALS?R=this._create_token(o.VALUE,C):R=this._create_token(o.ATTRIBUTE,C));return R},A.prototype._is_content_unformatted=function(x){return this._options.void_elements.indexOf(x)===-1&&(this._options.content_unformatted.indexOf(x)!==-1||this._options.unformatted.indexOf(x)!==-1)},A.prototype._read_raw_content=function(x,S,O){var R="";if(O&&O.text[0]==="{")R=this.__patterns.handlebars_raw_close.read();else if(S.type===o.TAG_CLOSE&&S.opened.text[0]==="<"&&S.text[0]!=="/"){var C=S.opened.text.substr(1).toLowerCase();if(C==="script"||C==="style"){var w=this._read_comment_or_cdata(x);if(w)return w.type=o.TEXT,w;R=this._input.readUntil(new RegExp("</"+C+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(C)&&(R=this._input.readUntil(new RegExp("</"+C+"[\\n\\r\\t ]*?>","ig")))}return R?this._create_token(o.TEXT,R):null},A.prototype._read_content_word=function(x){var S="";if(this._options.unformatted_content_delimiter&&(x===this._options.unformatted_content_delimiter[0]&&(S=this.__patterns.unformatted_content_delimiter.read())),S||(S=this.__patterns.word.read()),S)return this._create_token(o.TEXT,S)},b.exports.Tokenizer=A,b.exports.TOKEN=o}],W={};function n(b){var m=W[b];if(m!==void 0)return m.exports;var g=W[b]={exports:{}};return G[b](g,g.exports,n),g.exports}var L=n(18);D=L})();var Y=D;if(!0)!(le=[$,$("6UM0"),$("TXwP")],X=function(G){var W=$("6UM0"),n=$("TXwP");return{html_beautify:function(L,b){return Y(L,b,W.js_beautify,n.css_beautify)}}}.apply(we,le),X!==void 0&&(rt.exports=X));else var j,P})()},"rAM+":function(rt,we,$){"use strict";$.d(we,"a",function(){return X});var le=$("Qw5x");function X(D,Y){var j;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(j=Object(le.a)(D))||Y&&D&&typeof D.length=="number"){j&&(D=j);var P=0,G=function(){};return{s:G,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(m){throw m},f:G}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var W=!0,n=!1,L;return{s:function(){j=D[Symbol.iterator]()},n:function(){var m=j.next();return W=m.done,m},e:function(m){n=!0,L=m},f:function(){try{!W&&j.return!=null&&j.return()}finally{if(n)throw L}}}}},rUJ1:function(rt,we){const $=/[&<>"']/,le=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},j=R=>Y[R];function P(R,C){if(C){if($.test(R))return R.replace(le,j)}else if(X.test(R))return R.replace(D,j);return R}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(R){return R.replace(G,(C,w)=>(w=w.toLowerCase(),w==="colon"?":":w.charAt(0)==="#"?w.charAt(1)==="x"?String.fromCharCode(parseInt(w.substring(2),16)):String.fromCharCode(+w.substring(1)):""))}const n=/(^|[^\[])\^/g;function L(R,C){R=R.source||R,C=C||"";const w={replace:(y,u)=>(u=u.source||u,u=u.replace(n,"$1"),R=R.replace(y,u),w),getRegex:()=>new RegExp(R,C)};return w}const b=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(R,C,w){if(R){let y;try{y=decodeURIComponent(W(w)).replace(b,"").toLowerCase()}catch(u){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}C&&!m.test(w)&&(w=h(C,w));try{w=encodeURI(w).replace(/%25/g,"%")}catch(y){return null}return w}const c={},d=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(R,C){c[" "+R]||(d.test(R)?c[" "+R]=R+"/":c[" "+R]=x(R,"/",!0)),R=c[" "+R];const w=R.indexOf(":")===-1;return C.substring(0,2)==="//"?w?C:R.replace(p,"$1")+C:C.charAt(0)==="/"?w?C:R.replace(l,"$1")+C:R+C}const o={exec:function(){}};function s(R){let C=1,w,y;for(;C<arguments.length;C++){w=arguments[C];for(y in w)Object.prototype.hasOwnProperty.call(w,y)&&(R[y]=w[y])}return R}function A(R,C){const w=R.replace(/\|/g,(v,a,_)=>{let N=!1,B=a;for(;--B>=0&&_[B]==="\\";)N=!N;return N?"|":" |"}),y=w.split(/ \|/);let u=0;if(y.length>C)y.splice(C);else for(;y.length<C;)y.push("");for(;u<y.length;u++)y[u]=y[u].trim().replace(/\\\|/g,"|");return y}function x(R,C,w){const y=R.length;if(y===0)return"";let u=0;for(;u<y;){const v=R.charAt(y-u-1);if(v===C&&!w)u++;else if(v!==C&&w)u++;else break}return R.substr(0,y-u)}function S(R,C){if(R.indexOf(C[1])===-1)return-1;const w=R.length;let y=0,u=0;for(;u<w;u++)if(R[u]==="\\")u++;else if(R[u]===C[0])y++;else if(R[u]===C[1]&&(y--,y<0))return u;return-1}function O(R){R&&R.sanitize&&!R.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:P,unescape:W,edit:L,cleanUrl:g,resolveUrl:h,noopTest:o,merge:s,splitCells:A,rtrim:x,findClosingBracket:S,checkSanitizeDeprecation:O}},t9D7:function(rt,we,$){"use strict";$.d(we,"b",function(){return G}),$.d(we,"g",function(){return n}),$.d(we,"d",function(){return L}),$.d(we,"e",function(){return b}),$.d(we,"a",function(){return m}),$.d(we,"f",function(){return d}),$.d(we,"c",function(){return p});var le=$("Vhoy"),X=$("MI8n"),D=$("pmY6"),Y=$("Cg/j"),j=$("ic2d"),P=$("nEHx");const G=Object(Y.c)("themeService");var W;(function(l){function h(o){return o&&typeof o=="object"&&typeof o.id=="string"}l.isThemeColor=h})(W||(W={}));function n(l){return{id:l}}var L;(function(l){function h(O){return O&&typeof O=="object"&&typeof O.id=="string"&&(typeof O.color=="undefined"||W.isThemeColor(O.color))}l.isThemeIcon=h;const o=new RegExp(`^\\$\\((${le.a.iconNameExpression}(?:${le.a.iconModifierExpression})?)\\)$`);function s(O){const R=o.exec(O);if(!R)return;let[,C]=R;return{id:C}}l.fromString=s;function A(O,R){let C=O.id;const w=C.lastIndexOf("~");return w!==-1&&(C=C.substring(0,w)),R&&(C=`${C}~${R}`),{id:C}}l.modify=A;function x(O,R){var C,w;return O.id===R.id&&((C=O.color)===null||C===void 0?void 0:C.id)===((w=R.color)===null||w===void 0?void 0:w.id)}l.isEqual=x;function S(O,R){return{id:O.id,color:R?n(R):void 0}}l.asThemeIcon=S,l.asClassNameArray=le.a.asClassNameArray,l.asClassName=le.a.asClassName,l.asCSSSelector=le.a.asCSSSelector})(L||(L={}));function b(l){switch(l){case P.a.DARK:return"vs-dark";case P.a.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const m={ThemingContribution:"base.contributions.theming"};class g{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new X.b}onColorThemeChange(l){return this.themingParticipants.push(l),this.onThemingParticipantAddedEmitter.fire(l),Object(D.i)(()=>{const h=this.themingParticipants.indexOf(l);this.themingParticipants.splice(h,1)})}getThemingParticipants(){return this.themingParticipants}}let c=new g;j.a.add(m.ThemingContribution,c);function d(l){return c.onColorThemeChange(l)}class p extends D.a{constructor(l){super();this.themeService=l,this.theme=l.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(h=>this.onThemeChange(h)))}onThemeChange(l){this.theme=l,this.updateStyles()}updateStyles(){}}},uLbx:function(rt,we,$){rt.exports={flex_box_center:"flex_box_center___1paSn",flex_space_between:"flex_space_between___36S3i",flex_box_vertical_center:"flex_box_vertical_center___3ccMy",flex_box_center_end:"flex_box_center_end___31AGp",flex_box_column:"flex_box_column___1cfjg",bg:"bg___1_34e",containerTitle:"containerTitle___3x8NS",containerDesc:"containerDesc___j5b4j",listItem:"listItem___3eFKb",info:"info___1lfiH",title:"title___1_ERY",titleLeft:"titleLeft___MRBRV",titleRight:"titleRight___XliYN",acitons:"acitons___3Fqbt"}},uSYw:function(rt,we,$){rt.exports={flex_box_center:"flex_box_center___1Yp6V",flex_space_between:"flex_space_between___15-lw",flex_box_vertical_center:"flex_box_vertical_center___3Z69M",flex_box_center_end:"flex_box_center_end___mA7IH",flex_box_column:"flex_box_column___3xASj",wrp:"wrp___2ltDQ",drawer:"drawer___3_MCx",menu:"menu___aAo09",actived:"actived___3DNqM",actived2:"actived2___3JLKu",listItem:"listItem___39GLP",info:"info___1GUGE",title:"title___1wRiz",titleLeft:"titleLeft___1BA1e",titleRight:"titleRight___2w3Ba",search:"search___vFEeF",description:"description___29YXF",menuCourse:"menuCourse___2vc01"}},ulZh:function(rt,we,$){typeof window!="undefined"&&function(X,D){rt.exports=D()}(this,function(){return function(le){var X={};function D(Y){if(X[Y])return X[Y].exports;var j=X[Y]={i:Y,l:!1,exports:{}};return le[Y].call(j.exports,j,j.exports,D),j.l=!0,j.exports}return D.m=le,D.c=X,D.d=function(Y,j,P){D.o(Y,j)||Object.defineProperty(Y,j,{enumerable:!0,get:P})},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,j){if(j&1&&(Y=D(Y)),j&8)return Y;if(j&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Y}),j&2&&typeof Y!="string")for(var G in Y)D.d(P,G,function(W){return Y[W]}.bind(null,G));return P},D.n=function(Y){var j=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(j,"a",j),j},D.o=function(Y,j){return Object.prototype.hasOwnProperty.call(Y,j)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,X,D){"use strict";var Y=Object.prototype.hasOwnProperty,j="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(j=!1));function G(b,m,g){this.fn=b,this.context=m,this.once=g||!1}function W(b,m,g,c,d){if(typeof g!="function")throw new TypeError("The listener must be a function");var p=new G(g,c||b,d),l=j?j+m:m;return b._events[l]?b._events[l].fn?b._events[l]=[b._events[l],p]:b._events[l].push(p):(b._events[l]=p,b._eventsCount++),b}function n(b,m){--b._eventsCount===0?b._events=new P:delete b._events[m]}function L(){this._events=new P,this._eventsCount=0}L.prototype.eventNames=function(){var m=[],g,c;if(this._eventsCount===0)return m;for(c in g=this._events)Y.call(g,c)&&m.push(j?c.slice(1):c);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(g)):m},L.prototype.listeners=function(m){var g=j?j+m:m,c=this._events[g];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,l=new Array(p);d<p;d++)l[d]=c[d].fn;return l},L.prototype.listenerCount=function(m){var g=j?j+m:m,c=this._events[g];return c?c.fn?1:c.length:0},L.prototype.emit=function(m,g,c,d,p,l){var h=j?j+m:m;if(!this._events[h])return!1;var o=this._events[h],s=arguments.length,A,x;if(o.fn){o.once&&this.removeListener(m,o.fn,void 0,!0);switch(s){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,g),!0;case 3:return o.fn.call(o.context,g,c),!0;case 4:return o.fn.call(o.context,g,c,d),!0;case 5:return o.fn.call(o.context,g,c,d,p),!0;case 6:return o.fn.call(o.context,g,c,d,p,l),!0}for(x=1,A=new Array(s-1);x<s;x++)A[x-1]=arguments[x];o.fn.apply(o.context,A)}else{var S=o.length,O;for(x=0;x<S;x++){o[x].once&&this.removeListener(m,o[x].fn,void 0,!0);switch(s){case 1:o[x].fn.call(o[x].context);break;case 2:o[x].fn.call(o[x].context,g);break;case 3:o[x].fn.call(o[x].context,g,c);break;case 4:o[x].fn.call(o[x].context,g,c,d);break;default:if(!A)for(O=1,A=new Array(s-1);O<s;O++)A[O-1]=arguments[O];o[x].fn.apply(o[x].context,A)}}}return!0},L.prototype.on=function(m,g,c){return W(this,m,g,c,!1)},L.prototype.once=function(m,g,c){return W(this,m,g,c,!0)},L.prototype.removeListener=function(m,g,c,d){var p=j?j+m:m;if(!this._events[p])return this;if(!g)return n(this,p),this;var l=this._events[p];if(l.fn)l.fn===g&&(!d||l.once)&&(!c||l.context===c)&&n(this,p);else{for(var h=0,o=[],s=l.length;h<s;h++)(l[h].fn!==g||d&&!l[h].once||c&&l[h].context!==c)&&o.push(l[h]);o.length?this._events[p]=o.length===1?o[0]:o:n(this,p)}return this},L.prototype.removeAllListeners=function(m){var g;return m?(g=j?j+m:m,this._events[g]&&n(this,g)):(this._events=new P,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=j,L.EventEmitter=L,le.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,X,D){(function(Y){var j=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,n={buildAbsoluteURL:function(L,b,m){if(m=m||{},L=L.trim(),b=b.trim(),!b){if(!m.alwaysNormalize)return L;var g=n.parseURL(L);if(!g)throw new Error("Error trying to parse base URL.");return g.path=n.normalizePath(g.path),n.buildURLFromParts(g)}var c=n.parseURL(b);if(!c)throw new Error("Error trying to parse relative URL.");if(c.scheme)return m.alwaysNormalize?(c.path=n.normalizePath(c.path),n.buildURLFromParts(c)):b;var d=n.parseURL(L);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var p=P.exec(d.path);d.netLoc=p[1],d.path=p[2]}d.netLoc&&!d.path&&(d.path="/");var l={scheme:d.scheme,netLoc:c.netLoc,path:null,params:c.params,query:c.query,fragment:c.fragment};if(!c.netLoc&&(l.netLoc=d.netLoc,c.path[0]!=="/"))if(!c.path)l.path=d.path,c.params||(l.params=d.params,c.query||(l.query=d.query));else{var h=d.path,o=h.substring(0,h.lastIndexOf("/")+1)+c.path;l.path=n.normalizePath(o)}return l.path===null&&(l.path=m.alwaysNormalize?n.normalizePath(c.path):c.path),n.buildURLFromParts(l)},parseURL:function(L){var b=j.exec(L);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(G,"");L.length!==(L=L.replace(W,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};le.exports=n})(this)},"./node_modules/webworkify-webpack/index.js":function(le,X,D){function Y(m){var g={};function c(p){if(g[p])return g[p].exports;var l=g[p]={i:p,l:!1,exports:{}};return m[p].call(l.exports,l,l.exports,c),l.l=!0,l.exports}c.m=m,c.c=g,c.i=function(p){return p},c.d=function(p,l,h){c.o(p,l)||Object.defineProperty(p,l,{configurable:!1,enumerable:!0,get:h})},c.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},c.n=function(p){var l=p&&p.__esModule?function(){return p.default}:function(){return p};return c.d(l,"a",l),l},c.o=function(p,l){return Object.prototype.hasOwnProperty.call(p,l)},c.p="/",c.oe=function(p){throw console.error(p),p};var d=c(c.s=ENTRY_MODULE);return d.default||d}var j="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+j+").*?\\)";function G(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(m){return!isNaN(1*m)}function n(m,g,c){var d={};d[c]=[];var p=g.toString(),l=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return d;for(var h=l[1],o=new RegExp("(\\\\n|\\W)"+G(h)+P,"g"),s;s=o.exec(p);){if(s[3]==="dll-reference")continue;d[c].push(s[3])}for(o=new RegExp("\\("+G(h)+'\\("(dll-reference\\s('+j+'))"\\)\\)'+P,"g");s=o.exec(p);)m[s[2]]||(d[c].push(s[1]),m[s[2]]=D(s[1]).m),d[s[2]]=d[s[2]]||[],d[s[2]].push(s[4]);for(var A=Object.keys(d),x=0;x<A.length;x++)for(var S=0;S<d[A[x]].length;S++)W(d[A[x]][S])&&(d[A[x]][S]=1*d[A[x]][S]);return d}function L(m){var g=Object.keys(m);return g.reduce(function(c,d){return c||m[d].length>0},!1)}function b(m,g){for(var c={main:[g]},d={main:[]},p={main:{}};L(c);)for(var l=Object.keys(c),h=0;h<l.length;h++){var o=l[h],s=c[o],A=s.pop();if(p[o]=p[o]||{},p[o][A]||!m[o][A])continue;p[o][A]=!0,d[o]=d[o]||[],d[o].push(A);for(var x=n(m,m[o][A],o),S=Object.keys(x),O=0;O<S.length;O++)c[S[O]]=c[S[O]]||[],c[S[O]]=c[S[O]].concat(x[S[O]])}return d}le.exports=function(m,g){g=g||{};var c={main:D.m},d=g.all?{main:Object.keys(c.main)}:b(c,m),p="";Object.keys(d).filter(function(A){return A!=="main"}).forEach(function(A){for(var x=0;d[A][x];)x++;d[A].push(x),c[A][x]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+A+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+d[A].map(function(S){return""+JSON.stringify(S)+": "+c[A][S].toString()}).join(",")+`});
`}),p=p+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+d.main.map(function(A){return""+JSON.stringify(A)+": "+c.main[A].toString()}).join(",")+"}))(self);";var l=new window.Blob([p],{type:"text/javascript"});if(g.bare)return l;var h=window.URL||window.webkitURL||window.mozURL||window.msURL,o=h.createObjectURL(l),s=new window.Worker(o);return s.objectURL=o,s}},"./src/config.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"hlsDefaultConfig",function(){return O}),D.d(X,"mergeConfig",function(){return C}),D.d(X,"enableStreamingMode",function(){return w});var Y=D("./src/controller/abr-controller.ts"),j=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),W=D("./src/controller/subtitle-track-controller.ts"),n=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),b=D("./src/controller/cap-level-controller.ts"),m=D("./src/controller/fps-controller.ts"),g=D("./src/controller/eme-controller.ts"),c=D("./src/controller/cmcd-controller.ts"),d=D("./src/utils/xhr-loader.ts"),p=D("./src/utils/fetch-loader.ts"),l=D("./src/utils/cues.ts"),h=D("./src/utils/mediakeys-helper.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(y){for(var u=1;u<arguments.length;u++){var v=arguments[u];for(var a in v)Object.prototype.hasOwnProperty.call(v,a)&&(y[a]=v[a])}return y},s.apply(this,arguments)}function A(y,u){var v=Object.keys(y);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(y);u&&(a=a.filter(function(_){return Object.getOwnPropertyDescriptor(y,_).enumerable})),v.push.apply(v,a)}return v}function x(y){for(var u=1;u<arguments.length;u++){var v=arguments[u]!=null?arguments[u]:{};u%2?A(Object(v),!0).forEach(function(a){S(y,a,v[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(v)):A(Object(v)).forEach(function(a){Object.defineProperty(y,a,Object.getOwnPropertyDescriptor(v,a))})}return y}function S(y,u,v){return u in y?Object.defineProperty(y,u,{value:v,enumerable:!0,configurable:!0,writable:!0}):y[u]=v,y}var O=x(x({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:d.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:n.default,capLevelController:b.default,fpsController:m.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:h.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},R()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:W.default,timelineController:L.TimelineController,audioStreamController:j.default,audioTrackController:P.default,emeController:g.default,cmcdController:c.default});function R(){return{cueHandler:l.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 C(y,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},y,u)}function w(y){var u=y.loader;if(u!==p.default&&u!==d.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),y.progressive=!1;else{var v=Object(p.fetchSupported)();v&&(y.loader=p.default,y.progressive=!0,y.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/errors.ts"),n=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function b(c,d){for(var p=0;p<d.length;p++){var l=d[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function m(c,d,p){return d&&b(c.prototype,d),p&&b(c,p),c}var g=function(){function c(p){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=p;var l=p.config;this.bwEstimator=new j.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var d=c.prototype;return d.registerListeners=function(){var l=this.hls;l.on(P.Events.FRAG_LOADING,this.onFragLoading,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var l=this.hls;l.off(P.Events.FRAG_LOADING,this.onFragLoading,this),l.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},d.onFragLoading=function(l,h){var o=h.frag;if(o.type===n.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=o,this.partCurrent=(s=h.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},d.onLevelLoaded=function(l,h){var o=this.hls.config;h.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},d._abandonRulesCheck=function(){var l=this.fragCurrent,h=this.partCurrent,o=this.hls,s=o.autoLevelEnabled,A=o.config,x=o.media;if(!l||!x)return;var S=h?h.stats:l.stats,O=h?h.duration:l.duration;if(S.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||x.paused||!x.playbackRate||!x.readyState)return;var R=performance.now()-S.loading.start,C=Math.abs(x.playbackRate);if(R<=500*O/C)return;var w=o.levels,y=o.minAutoLevel,u=w[l.level],v=S.total||Math.max(S.loaded,Math.round(O*u.maxBitrate/8)),a=Math.max(1,S.bwEstimate?S.bwEstimate/8:S.loaded*1e3/R),_=(v-S.loaded)/a,N=x.currentTime,B=(G.BufferHelper.bufferInfo(x,N,A.maxBufferHole).end-N)/C;if(B>=2*O/C||_<=B)return;var T=Number.POSITIVE_INFINITY,U;for(U=l.level-1;U>y;U--){var M=w[U].maxBitrate;if(T=O*M/(8*.8*a),T<B)break}if(T>=_)return;var E=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+l.sn+(h?" part "+h.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+U+`
Current BW estimate: `+(Object(Y.isFiniteNumber)(E)?(E/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+_.toFixed(3)+` s
Estimated load time for the next fragment: `+T.toFixed(3)+` s
Time to underbuffer: `+B.toFixed(3)+" s"),o.nextLoadLevel=U,this.bwEstimator.sample(R,S.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),o.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:h,stats:S})},d.onFragLoaded=function(l,h){var o=h.frag,s=h.part;if(o.type===n.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(o.sn)){var A=s?s.stats:o.stats,x=s?s.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var S=this.hls.levels[o.level],O=(S.loaded?S.loaded.bytes:0)+A.loaded,R=(S.loaded?S.loaded.duration:0)+x;S.loaded={bytes:O,duration:R},S.realBitrate=Math.round(8*O/R)}if(o.bitrateTest){var C={stats:A,frag:o,part:s,id:o.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,C),o.bitrateTest=!1}}},d.onFragBuffered=function(l,h){var o=h.frag,s=h.part,A=s?s.stats:o.stats;if(A.aborted)return;if(o.type!==n.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var x=A.parsing.end-A.loading.start;this.bwEstimator.sample(x,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=x/1e3:this.bitrateTestDelay=0},d.onError=function(l,h){switch(h.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var l=this.fragCurrent,h=this.partCurrent,o=this.hls,s=o.maxAutoLevel,A=o.config,x=o.minAutoLevel,S=o.media,O=h?h.duration:l?l.duration:0,R=S?S.currentTime:0,C=S&&S.playbackRate!==0?Math.abs(S.playbackRate):1,w=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,y=(G.BufferHelper.bufferInfo(S,R,A.maxBufferHole).end-R)/C,u=this.findBestLevel(w,x,s,y,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(u>=0)return u;L.logger.trace((y?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=O?Math.min(O,A.maxStarvationDelay):A.maxStarvationDelay,a=A.abrBandWidthFactor,_=A.abrBandWidthUpFactor;if(!y){var N=this.bitrateTestDelay;if(N){var B=O?Math.min(O,A.maxLoadingDelay):A.maxLoadingDelay;v=B-N,L.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),a=_=1}}return u=this.findBestLevel(w,x,s,y+v,a,_),Math.max(u,0)},d.findBestLevel=function(l,h,o,s,A,x){for(var S,O=this.fragCurrent,R=this.partCurrent,C=this.lastLoadedFragLevel,w=this.hls.levels,y=w[C],u=!!(y!=null&&(S=y.details)!==null&&S!==void 0&&S.live),v=y==null?void 0:y.codecSet,a=R?R.duration:O?O.duration:0,_=o;_>=h;_--){var N=w[_];if(!N||v&&N.codecSet!==v)continue;var B=N.details,T=(R?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||a,U=void 0;_<=C?U=A*l:U=x*l;var M=w[_].maxBitrate,E=M*T/U;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(U)+"/"+M+"/"+T+"/"+s+"/"+E),U>M&&(!E||u&&!this.bitrateTestDelay||E<s))return _}return-1},m(c,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,h=this.bwEstimator;if(l!==-1&&(!h||!h.canEstimate()))return l;var o=this.getNextABRAutoLevel();return l!==-1&&(o=Math.min(l,o)),o},set:function(l){this._nextAutoLevel=l}}]),c}();X.default=g},"./src/controller/audio-stream-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/polyfills/number.ts"),j=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-tracker.ts"),n=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),b=D("./src/loader/fragment.ts"),m=D("./src/demux/chunk-cache.ts"),g=D("./src/demux/transmuxer-interface.ts"),c=D("./src/types/transmuxer.ts"),d=D("./src/controller/fragment-finders.ts"),p=D("./src/utils/discontinuities.ts"),l=D("./src/errors.ts"),h=D("./src/utils/logger.ts");function o(){return o=Object.assign||function(O){for(var R=1;R<arguments.length;R++){var C=arguments[R];for(var w in C)Object.prototype.hasOwnProperty.call(C,w)&&(O[w]=C[w])}return O},o.apply(this,arguments)}function s(O,R){O.prototype=Object.create(R.prototype),O.prototype.constructor=O,A(O,R)}function A(O,R){return A=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},A(O,R)}var x=100,S=function(O){s(R,O);function R(w,y){var u;return u=O.call(this,w,y,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var C=R.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var y=this.hls;y.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.on(P.Events.ERROR,this.onError,this),y.on(P.Events.BUFFER_RESET,this.onBufferReset,this),y.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var y=this.hls;y.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.off(P.Events.ERROR,this.onError,this),y.off(P.Events.BUFFER_RESET,this.onBufferReset,this),y.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(y,u){var v=u.frag,a=u.id,_=u.initPTS;if(a==="main"){var N=v.cc;this.initPTS[v.cc]=_,this.log("InitPTS for cc: "+N+" found from main: "+_),this.videoTrackCC=N,this.state===j.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(y){if(!this.levels){this.startPosition=y,this.state=j.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(x),this.fragLoadError=0,u>0&&y===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=j.State.IDLE):(this.loadedmetadata=!1,this.state=j.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()},C.doTick=function(){switch(this.state){case j.State.IDLE:this.doTickIdle();break;case j.State.WAITING_TRACK:{var y,u=this.levels,v=this.trackId,a=u==null||((y=u[v])===null||y===void 0)?void 0:y.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=j.State.WAITING_INIT_PTS}break}case j.State.FRAG_LOADING_WAITING_RETRY:{var _,N=performance.now(),B=this.retryDate;(!B||N>=B||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=j.State.IDLE);break}case j.State.WAITING_INIT_PTS:{var T=this.waitingData;if(T){var U=T.frag,M=T.part,E=T.cache,H=T.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=j.State.FRAG_LOADING;var Z=E.flush(),oe={frag:U,part:M,payload:Z,networkDetails:null};this._handleFragmentLoadProgress(oe),H&&O.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)h.logger.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),Te=G.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),be=Object(d.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,U);be<0&&(h.logger.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=j.State.IDLE}}this.onTickEnd()},C.clearWaitingFragment=function(){var y=this.waitingData;y&&(this.fragmentTracker.removeFragment(y.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.State.IDLE)},C.onTickEnd=function(){var y=this.media;if(!y||!y.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:y,v=u.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=y.currentTime},C.doTickIdle=function(){var y,u,v=this.hls,a=this.levels,_=this.media,N=this.trackId,B=v.config;if(!a||!a[N])return;if(!_&&(this.startFragRequested||!B.startFragPrefetch))return;var T=a[N],U=T.details;if(!U||U.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(U)){this.state=j.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(M===null)return;var E=M.len,H=this.getMaxBufferLength(),Z=this.audioSwitch;if(E>=H&&!Z)return;if(!Z&&this._streamEnded(M,U)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=j.State.ENDED;return}var oe=U.fragments,de=oe[0].start,Te=M.end;if(Z){var be=this.getLoadPosition();Te=be,U.PTSKnown&&be<de&&((M.end>de||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=de+.05))}var Ae=this.getNextFragment(Te,U);if(!Ae){this.bufferFlushed=!0;return}((y=Ae.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((u=Ae.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Ae,U):this.loadFragment(Ae,U,Te)},C.getMaxBufferLength=function(){var y=O.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return u===null?y:Math.max(y,u.len)},C.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(y,u){var v=u.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(a){return new n.Level(a)})},C.onAudioTrackSwitching=function(y,u){var v=!!u.url;this.trackId=u.id;var a=this.fragCurrent;a!=null&&a.loader&&a.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(x):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=j.State.IDLE):this.state=j.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(y,u){this.mainDetails=u.details},C.onAudioTrackLoaded=function(y,u){var v,a=this.levels,_=u.details,N=u.id;if(!a){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var B=a[N],T=0;if(_.live||(v=B.details)!==null&&v!==void 0&&v.live){var U=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!U)return;!B.details&&_.hasProgramDateTime&&U.hasProgramDateTime?(Object(p.alignMediaPlaylistByPDT)(_,U),T=_.fragments[0].start):T=this.alignPlaylists(_,B.details)}B.details=_,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(B.details,T),this.state===j.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=j.State.IDLE),this.tick()},C._handleFragmentLoadProgress=function(y){var u,v=y.frag,a=y.part,_=y.payload,N=this.config,B=this.trackId,T=this.levels;if(!T){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var U=T[B];console.assert(U,"Audio track is defined on fragment load progress");var M=U.details;console.assert(M,"Audio track details are defined on fragment load progress");var E=N.defaultAudioCodec||U.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new g.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Z=this.initPTS[v.cc],oe=(u=v.initSegment)===null||u===void 0?void 0:u.data;if(Z!==void 0){var de=!1,Te=a?a.index:-1,be=Te!==-1,Ae=new c.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,_.byteLength,Te,be);H.push(_,oe,E,"",v,a,M.totalduration,de,Ae,Z)}else{h.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+B);var Ce=this.waitingData=this.waitingData||{frag:v,part:a,cache:new m.default,complete:!1},_e=Ce.cache;_e.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=j.State.WAITING_INIT_PTS}},C._handleFragmentLoadComplete=function(y){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,y)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(y,u){var v=u.tracks.audio;v&&(this.mediaBuffer=v.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},C.onFragBuffered=function(y,u){var v=u.frag,a=u.part;if(v.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(a?" p: "+a.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,a)},C.onError=function(y,u){switch(u.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,u);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==j.State.ERROR&&this.state!==j.State.STOPPED&&(this.state=u.fatal?j.State.ERROR:j.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===j.State.PARSING||this.state===j.State.PARSED)){var v=!0,a=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);a&&a.len>.5&&(v=!this.reduceMaxBufferLength(a.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},C.onBufferFlushed=function(y,u){var v=u.type;v===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},C._handleTransmuxComplete=function(y){var u,v="audio",a=this.hls,_=y.remuxResult,N=y.chunkMeta,B=this.getCurrentContext(N);if(!B){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var T=B.frag,U=B.part,M=_.audio,E=_.text,H=_.id3,Z=_.initSegment;if(this.fragContextChanged(T))return;if(this.state=j.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),Z!=null&&Z.tracks&&(this._bufferInitSegment(Z.tracks,T,N),a.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:v,tracks:Z.tracks})),M){var oe=M.startPTS,de=M.endPTS,Te=M.startDTS,be=M.endDTS;U&&(U.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:de,startDTS:Te,endDTS:be}),T.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,oe,de,Te,be),this.bufferFragmentData(M,T,U,N)}if(H!=null&&(u=H.samples)!==null&&u!==void 0&&u.length){var Ae=o({frag:T,id:v},H);a.trigger(P.Events.FRAG_PARSING_METADATA,Ae)}if(E){var Ce=o({frag:T,id:v},E);a.trigger(P.Events.FRAG_PARSING_USERDATA,Ce)}},C._bufferInitSegment=function(y,u,v){if(this.state!==j.State.PARSING)return;y.video&&delete y.video;var a=y.audio;if(!a)return;a.levelCodec=a.codec,a.id="audio",this.log("Init audio buffer, container:"+a.container+", codecs[parsed]=["+a.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,y);var _=a.initSegment;if(_!=null&&_.byteLength){var N={type:"audio",frag:u,part:null,chunkMeta:v,parent:u.type,data:_};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},C.loadFragment=function(y,u,v){var a=this.fragmentTracker.getState(y);this.fragCurrent=y,(this.audioSwitch||a===W.FragmentState.NOT_LOADED||a===W.FragmentState.PARTIAL)&&(y.sn==="initSegment"?this._loadInitSegment(y):u.live&&!Object(Y.isFiniteNumber)(this.initPTS[y.cc])?(this.log("Waiting for video PTS in continuity counter "+y.cc+" of live stream before loading audio fragment "+y.sn+" of level "+this.trackId),this.state=j.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,y,u,v)))},C.completeAudioSwitch=function(){var y=this.hls,u=this.media,v=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,y.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},R}(j.default);X.default=S},"./src/controller/audio-track-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts"),j=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function W(g,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function n(g,c,d){return c&&W(g.prototype,c),d&&W(g,d),g}function L(g,c){g.prototype=Object.create(c.prototype),g.prototype.constructor=g,b(g,c)}function b(g,c){return b=Object.setPrototypeOf||function(p,l){return p.__proto__=l,p},b(g,c)}var m=function(g){L(c,g);function c(p){var l;return l=g.call(this,p,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var d=c.prototype;return d.registerListeners=function(){var l=this.hls;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.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(Y.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var l=this.hls;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.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(Y.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,g.prototype.destroy.call(this)},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},d.onManifestParsed=function(l,h){this.tracks=h.audioTracks||[]},d.onAudioTrackLoaded=function(l,h){var o=h.id,s=h.details,A=this.tracksInGroup[o];if(!A){this.warn("Invalid audio track id "+o);return}var x=A.details;A.details=h.details,this.log("audioTrack "+o+" loaded ["+s.startSN+"-"+s.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,h,x))},d.onLevelLoading=function(l,h){this.switchLevel(h.level)},d.onLevelSwitching=function(l,h){this.switchLevel(h.level)},d.switchLevel=function(l){var h=this.hls.levels[l];if(!(h!=null&&h.audioGroupIds))return;var o=h.audioGroupIds[h.urlId];if(this.groupId!==o){this.groupId=o;var s=this.tracks.filter(function(x){return!o||x.groupId===o});this.selectDefaultTrack&&!s.some(function(x){return x.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var A={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},d.onError=function(l,h){if(g.prototype.onError.call(this,l,h),h.fatal||!h.context)return;h.context.type===G.PlaylistContextType.AUDIO_TRACK&&h.context.id===this.trackId&&h.context.groupId===this.groupId&&this.retryLoadingOrFail(h)},d.setAudioTrack=function(l){var h=this.tracksInGroup;if(l<0||l>=h.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=h[this.trackId];this.log("Now switching to audio-track index "+l);var s=h[l],A=s.id,x=s.groupId,S=x===void 0?"":x,O=s.name,R=s.type,C=s.url;if(this.trackId=l,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:S,name:O,type:R,url:C}),s.details&&!s.details.live)return;var w=this.switchParams(s.url,o==null?void 0:o.details);this.loadPlaylist(w)},d.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var h=this.trackName,o=this.findTrackId(h)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(l){for(var h=this.tracksInGroup,o=0;o<h.length;o++){var s=h[o];if((!this.selectDefaultTrack||s.default)&&(!l||l===s.name))return s.id}return-1},d.loadPlaylist=function(l){var h=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(h)){var o=h.id,s=h.groupId,A=h.url;if(l)try{A=l.addDirectives(A)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:A,id:o,groupId:s,deliveryDirectives:l||null})}},n(c,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),c}(P.default);X.default=m},"./src/controller/base-playlist-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return n});var Y=D("./src/polyfills/number.ts"),j=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),n=function(){function L(m,g){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,g+":"),this.warn=G.logger.warn.bind(G.logger,g+":"),this.hls=m}var b=L.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(g,c){c.fatal&&c.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(g,c){var d=c==null?void 0:c.renditionReports;if(d)for(var p=0;p<d.length;p++){var l=d[p],h=""+l.URI;if(h===g.substr(-h.length)){var o=parseInt(l["LAST-MSN"]),s=parseInt(l["LAST-PART"]);if(c&&this.hls.config.lowLatencyMode){var A=Math.min(c.age-c.partTarget,c.targetduration);s!==void 0&&A>c.partTarget&&(s+=1)}if(Object(Y.isFiniteNumber)(o))return new j.HlsUrlParameters(o,Object(Y.isFiniteNumber)(s)?s:void 0,j.HlsSkip.No)}}},b.loadPlaylist=function(g){},b.shouldLoadTrack=function(g){return this.canLoad&&g&&!!g.url&&(!g.details||g.details.live)},b.playlistLoaded=function(g,c,d){var p=this,l=c.details,h=c.stats,o=h.loading.end?Math.max(0,self.performance.now()-h.loading.end):0;if(l.advancedDateTime=Date.now()-o,l.live||d!=null&&d.live){if(l.reloaded(d),d&&this.log("live playlist "+g+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),d&&l.fragments.length>0&&Object(P.mergeDetails)(d,l),!this.canLoad||!l.live)return;var s,A=void 0,x=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var S=this.hls.config.lowLatencyMode,O=l.lastPartSn,R=l.endSN,C=l.lastPartIndex,w=C!==-1,y=O===R,u=S?0:C;w?(A=y?R+1:O,x=y?u:C+1):A=R+1;var v=l.age,a=v+l.ageHeader,_=Math.min(a-l.partTarget,l.targetduration*1.5);if(_>0){if(d&&_>d.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+d.tuneInGoal+" to: "+_+" with playlist age: "+l.age),_=0;else{var N=Math.floor(_/l.targetduration);if(A+=N,x!==void 0){var B=Math.round(_%l.targetduration/l.partTarget);x+=B}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+_+" skip sn "+N+" to part "+x)}l.tuneInGoal=_}if(s=this.getDeliveryDirectives(l,c.deliveryDirectives,A,x),S||!y){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(l,c.deliveryDirectives,A,x);var T=Object(P.computeReloadInterval)(l,h);A!==void 0&&l.canBlockReload&&(T-=l.partTarget||1),this.log("reload live playlist "+g+" in "+Math.round(T)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(s)},T)}else this.clearTimer()},b.getDeliveryDirectives=function(g,c,d,p){var l=Object(j.getSkipValue)(g,d);return c!=null&&c.skip&&g.deltaUpdateFailed&&(d=c.msn,p=c.part,l=j.HlsSkip.No),new j.HlsUrlParameters(d,p,l)},b.retryLoadingOrFail=function(g){var c=this,d=this.hls.config,p=this.retryCount<d.levelLoadingMaxRetry;if(p){var l;if(this.retryCount++,g.details.indexOf("LoadTimeOut")>-1&&(l=g.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+g.details+'"'),this.loadPlaylist();else{var h=Math.min(Math.pow(2,this.retryCount)*d.levelLoadingRetryDelay,d.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return c.loadPlaylist()},h),this.warn("retry playlist loading #"+this.retryCount+" in "+h+' ms after "'+g.details+'"')}}else this.warn('cannot recover from error "'+g.details+'"'),this.clearTimer(),g.fatal=!0;return p},L}()},"./src/controller/base-stream-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"State",function(){return R}),D.d(X,"default",function(){return C});var Y=D("./src/polyfills/number.ts"),j=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts"),n=D("./src/events.ts"),L=D("./src/errors.ts"),b=D("./src/types/transmuxer.ts"),m=D("./src/utils/mp4-tools.ts"),g=D("./src/utils/discontinuities.ts"),c=D("./src/controller/fragment-finders.ts"),d=D("./src/controller/level-helper.ts"),p=D("./src/loader/fragment-loader.ts"),l=D("./src/crypt/decrypter.ts"),h=D("./src/utils/time-ranges.ts"),o=D("./src/types/loader.ts");function s(w,y){for(var u=0;u<y.length;u++){var v=y[u];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,v.key,v)}}function A(w,y,u){return y&&s(w.prototype,y),u&&s(w,u),w}function x(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function S(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,O(w,y)}function O(w,y){return O=Object.setPrototypeOf||function(v,a){return v.__proto__=a,v},O(w,y)}var R={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"},C=function(w){S(y,w);function y(v,a,_){var N;return N=w.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=R.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=_,N.log=W.logger.log.bind(W.logger,_+":"),N.warn=W.logger.warn.bind(W.logger,_+":"),N.hls=v,N.fragmentLoader=new p.default(v.config),N.fragmentTracker=a,N.config=v.config,N.decrypter=new l.default(v,v.config),v.on(n.Events.KEY_LOADED,N.onKeyLoaded,x(N)),N}var u=y.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(a){},u.stopLoad=function(){this.fragmentLoader.abort();var a=this.fragCurrent;a&&this.fragmentTracker.removeFragment(a),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=R.STOPPED},u._streamEnded=function(a,_){var N=this.fragCurrent,B=this.fragmentTracker;if(!_.live&&N&&N.sn===_.endSN&&!a.nextStart){var T=B.getState(N);return T===P.FragmentState.PARTIAL||T===P.FragmentState.OK}return!1},u.onMediaAttached=function(a,_){var N=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===R.STOPPED&&this.startLoad(B.startPosition)},u.onMediaDetaching=function(){var a=this.media;a!=null&&a.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),a&&(a.removeEventListener("seeking",this.onvseeking),a.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var a=this.config,_=this.fragCurrent,N=this.media,B=this.mediaBuffer,T=this.state,U=N?N.currentTime:0,M=G.BufferHelper.bufferInfo(B||N,U,a.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(U)?U.toFixed(3):U)+", state: "+T),T===R.ENDED)this.resetLoadingState();else if(_&&!M.len){var E=a.maxFragLookUpTolerance,H=_.start-E,Z=_.start+_.duration+E,oe=U>Z;(U<H||oe)&&(oe&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=U),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=U),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(a,_){if(this.state!==R.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=R.IDLE;var N=this.levels[_.frag.level].details;N&&this.loadFragment(_.frag,N,_.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),w.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=R.STOPPED,this.hls.off(n.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,w.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(a,_){this.log("Loading key for "+a.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+a.level),this.state=R.KEY_LOADING,this.fragCurrent=a,this.hls.trigger(n.Events.KEY_LOADING,{frag:a})},u.loadFragment=function(a,_,N){this._loadFragForPlayback(a,_,N)},u._loadFragForPlayback=function(a,_,N){var B=this,T=function(M){if(B.fragContextChanged(a)){B.warn("Fragment "+a.sn+(M.part?" p: "+M.part.index:"")+" of level "+a.level+" was dropped during download."),B.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,B._handleFragmentLoadProgress(M)};this._doFragLoad(a,_,N,T).then(function(U){if(!U)return;B.fragLoadError=0;var M=B.state;if(B.fragContextChanged(a)){(M===R.FRAG_LOADING||M===R.BACKTRACKING||!B.fragCurrent&&M===R.PARSING)&&(B.fragmentTracker.removeFragment(a),B.state=R.IDLE);return}if("payload"in U&&(B.log("Loaded fragment "+a.sn+" of level "+a.level),B.hls.trigger(n.Events.FRAG_LOADED,U),B.state===R.BACKTRACKING)){B.fragmentTracker.backtrack(a,U),B.resetFragmentLoading(a);return}B._handleFragmentLoadComplete(U)}).catch(function(U){B.warn(U),B.resetFragmentLoading(a)})},u.flushMainBuffer=function(a,_,N){if(N===void 0&&(N=null),!(a-_))return;var B={startOffset:a,endOffset:_,type:N};this.fragLoadError=0,this.hls.trigger(n.Events.BUFFER_FLUSHING,B)},u._loadInitSegment=function(a){var _=this;this._doFragLoad(a).then(function(N){if(!N||_.fragContextChanged(a)||!_.levels)throw new Error("init load aborted");return N}).then(function(N){var B=_.hls,T=N.payload,U=a.decryptdata;if(T&&T.byteLength>0&&U&&U.key&&U.iv&&U.method==="AES-128"){var M=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(T),U.key.buffer,U.iv.buffer).then(function(E){var H=self.performance.now();return B.trigger(n.Events.FRAG_DECRYPTED,{frag:a,payload:E,stats:{tstart:M,tdecrypt:H}}),N.payload=E,N})}return N}).then(function(N){var B=_.fragCurrent,T=_.hls,U=_.levels;if(!U)throw new Error("init load aborted, missing levels");var M=U[a.level].details;console.assert(M,"Level details are defined when init segment is loaded");var E=a.stats;_.state=R.IDLE,_.fragLoadError=0,a.data=new Uint8Array(N.payload),E.parsing.start=E.buffering.start=self.performance.now(),E.parsing.end=E.buffering.end=self.performance.now(),N.frag===B&&T.trigger(n.Events.FRAG_BUFFERED,{stats:E,frag:B,part:null,id:a.type}),_.tick()}).catch(function(N){_.warn(N),_.resetFragmentLoading(a)})},u.fragContextChanged=function(a){var _=this.fragCurrent;return!a||!_||a.level!==_.level||a.sn!==_.sn||a.urlId!==_.urlId},u.fragBufferedComplete=function(a,_){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+a.type+" sn: "+a.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+a.level+" "+h.default.toString(G.BufferHelper.getBuffered(N))),this.state=R.IDLE,this.tick()},u._handleFragmentLoadComplete=function(a){var _=this.transmuxer;if(!_)return;var N=a.frag,B=a.part,T=a.partsLoaded,U=!T||T.length===0||T.some(function(E){return!E}),M=new b.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,B?B.index:-1,!U);_.flush(M)},u._handleFragmentLoadProgress=function(a){},u._doFragLoad=function(a,_,N,B){var T=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(a.start,N||0),this.config.lowLatencyMode&&_){var U=_.partList;if(U&&B){N>a.end&&_.fragmentHint&&(a=_.fragmentHint);var M=this.getNextPart(U,a,N);if(M>-1){var E=U[M];return this.log("Loading part sn: "+a.sn+" p: "+E.index+" cc: "+a.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+M+"-"+(U.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+a.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=E.start+E.duration,this.state=R.FRAG_LOADING,this.hls.trigger(n.Events.FRAG_LOADING,{frag:a,part:U[M],targetBufferTime:N}),this.doFragPartsLoad(a,U,M,B).catch(function(H){return T.handleFragLoadError(H)})}else if(!a.url||this.loadedEndOfParts(U,N))return Promise.resolve(null)}}return this.log("Loading fragment "+a.sn+" cc: "+a.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+a.level+", target: "+parseFloat(N.toFixed(3))),Object(Y.isFiniteNumber)(a.sn)&&!this.bitrateTest&&(this.nextLoadPosition=a.start+a.duration),this.state=R.FRAG_LOADING,this.hls.trigger(n.Events.FRAG_LOADING,{frag:a,targetBufferTime:N}),this.fragmentLoader.load(a,B).catch(function(H){return T.handleFragLoadError(H)})},u.doFragPartsLoad=function(a,_,N,B){var T=this;return new Promise(function(U,M){var E=[],H=function Z(oe){var de=_[oe];T.fragmentLoader.loadPart(a,de,B).then(function(Te){E[de.index]=Te;var be=Te.part;T.hls.trigger(n.Events.FRAG_LOADED,Te);var Ae=_[oe+1];if(Ae&&Ae.fragment===a)Z(oe+1);else return U({frag:a,part:be,partsLoaded:E})}).catch(M)};H(N)})},u.handleFragLoadError=function(a){var _=a.data;return _&&_.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(n.Events.ERROR,_),null},u._handleTransmuxerFlush=function(a){var _=this.getCurrentContext(a);if(!_||this.state!==R.PARSING){this.fragCurrent||(this.state=R.IDLE);return}var N=_.frag,B=_.part,T=_.level,U=self.performance.now();N.stats.parsing.end=U,B&&(B.stats.parsing.end=U),this.updateLevelTiming(N,B,T,a.partial)},u.getCurrentContext=function(a){var _=this.levels,N=a.level,B=a.sn,T=a.part;if(!_||!_[N])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+N+". The current chunk will not be buffered."),null;var U=_[N],M=T>-1?Object(d.getPartWith)(U,B,T):null,E=M?M.fragment:Object(d.getFragmentWithSN)(U,B,this.fragCurrent);return E?{frag:E,part:M,level:U}:null},u.bufferFragmentData=function(a,_,N,B){if(!a||this.state!==R.PARSING)return;var T=a.data1,U=a.data2,M=T;if(T&&U&&(M=Object(m.appendUint8Array)(T,U)),!M||!M.length)return;var E={type:a.type,frag:_,part:N,chunkMeta:B,parent:_.type,data:M};this.hls.trigger(n.Events.BUFFER_APPENDING,E),a.dropped&&a.independent&&!N&&this.flushBufferGap(_)},u.flushBufferGap=function(a){var _=this.media;if(!_)return;if(!G.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,a.start);return}var N=_.currentTime,B=G.BufferHelper.bufferInfo(_,N,0),T=a.duration,U=Math.min(this.config.maxFragLookUpTolerance*2,T*.25),M=Math.max(Math.min(a.start-U,B.end-U),N+U);a.start-M>U&&this.flushMainBuffer(M,a.start)},u.getFwdBufferInfo=function(a,_){var N=this.config,B=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(B))return null;var T=G.BufferHelper.bufferInfo(a,B,N.maxBufferHole);if(T.len===0&&T.nextStart!==void 0){var U=this.fragmentTracker.getBufferedFrag(B,_);if(U&&T.nextStart<U.end)return G.BufferHelper.bufferInfo(a,B,Math.max(T.nextStart,N.maxBufferHole))}return T},u.getMaxBufferLength=function(a){var _=this.config,N;return a?N=Math.max(8*_.maxBufferSize/a,_.maxBufferLength):N=_.maxBufferLength,Math.min(N,_.maxMaxBufferLength)},u.reduceMaxBufferLength=function(a){var _=this.config,N=a||_.maxBufferLength;return _.maxMaxBufferLength>=N?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(a,_){var N,B,T=_.fragments,U=T.length;if(!U)return null;var M=this.config,E=T[0].start,H;if(_.live){var Z=M.initialLiveManifestSize;if(U<Z)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+Z+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(_,T),this.startPosition=H?this.hls.liveSyncPosition||H.start:a)}else a<=E&&(H=T[0]);if(!H){var oe=M.lowLatencyMode?_.partEnd:_.fragmentEnd;H=this.getFragmentAtPosition(a,oe,_)}return(N=H)!==null&&N!==void 0&&N.initSegment&&!((B=H)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},u.getNextPart=function(a,_,N){for(var B=-1,T=!1,U=!0,M=0,E=a.length;M<E;M++){var H=a[M];if(U=U&&!H.independent,B>-1&&N<H.start)break;var Z=H.loaded;!Z&&(T||H.independent||U)&&H.fragment===_&&(B=M),T=Z}return B},u.loadedEndOfParts=function(a,_){var N=a[a.length-1];return N&&_>N.start&&N.loaded},u.getInitialLiveFragment=function(a,_){var N=this.fragPrevious,B=null;if(N){if(a.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),B=Object(c.findFragmentByPDT)(_,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var T=N.sn+1;if(T>=a.startSN&&T<=a.endSN){var U=_[T-a.startSN];N.cc===U.cc&&(B=U,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(c.findFragWithCC)(_,N.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(B=this.getFragmentAtPosition(M,this.bitrateTest?a.fragmentEnd:a.edge,a))}return B},u.getFragmentAtPosition=function(a,_,N){var B=this.config,T=this.fragPrevious,U=N.fragments,M=N.endSN,E=N.fragmentHint,H=B.maxFragLookUpTolerance,Z=!!(B.lowLatencyMode&&N.partList&&E);Z&&E&&!this.bitrateTest&&(U=U.concat(E),M=E.sn);var oe;if(a<_){var de=a>_-H?0:H;oe=Object(c.findFragmentByPTS)(T,U,a,de)}else oe=U[U.length-1];if(oe){var Te=oe.sn-N.startSN,be=T&&oe.level===T.level,Ae=U[Te+1],Ce=this.fragmentTracker.getState(oe);if(Ce===P.FragmentState.BACKTRACKED){oe=null;for(var _e=Te;U[_e]&&this.fragmentTracker.getState(U[_e])===P.FragmentState.BACKTRACKED;)T?oe=U[_e--]:oe=U[--_e];oe||(oe=Ae)}else T&&oe.sn===T.sn&&!Z&&(be&&(oe.sn<M&&this.fragmentTracker.getState(Ae)!==P.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Ae.sn),oe=Ae):oe=null))}return oe},u.synchronizeToLiveEdge=function(a){var _=this.config,N=this.media;if(!N)return;var B=this.hls.liveSyncPosition,T=N.currentTime,U=a.fragments[0].start,M=a.edge,E=T>=U-_.maxFragLookUpTolerance&&T<=M;if(B!==null&&N.duration>B&&(T<B||!E)){var H=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*a.targetduration;(!E&&N.readyState<4||T<M-H)&&(this.loadedmetadata||(this.nextLoadPosition=B),N.readyState&&(this.warn("Playback: "+T.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+B.toFixed(3)),N.currentTime=B))}},u.alignPlaylists=function(a,_){var N=this.levels,B=this.levelLastLoaded,T=this.fragPrevious,U=B!==null?N[B]:null,M=a.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var E=a.fragments[0].start,H=!_,Z=a.alignedSliding&&Object(Y.isFiniteNumber)(E);if(H||!Z&&!E){Object(g.alignStream)(T,U,a);var oe=a.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+a.startSN+" prev-sn: "+(T?T.sn:"na")+" fragments: "+M),oe}return E},u.waitForCdnTuneIn=function(a){var _=3;return a.live&&a.canBlockReload&&a.tuneInGoal>Math.max(a.partHoldBack,a.partTarget*_)},u.setStartPosition=function(a,_){var N=this.startPosition;if(N<_&&(N=-1),N===-1||this.lastCurrentTime===-1){var B=a.startTimeOffset;Object(Y.isFiniteNumber)(B)?(N=_+B,B<0&&(N+=a.totalduration),N=Math.min(Math.max(_,N),_+a.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+N),this.startPosition=N):a.live?N=this.hls.liveSyncPosition||_:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},u.getLoadPosition=function(){var a=this.media,_=0;return this.loadedmetadata&&a?_=a.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},u.handleFragLoadAborted=function(a,_){this.transmuxer&&a.sn!=="initSegment"&&a.stats.aborted&&(this.warn("Fragment "+a.sn+(_?" part"+_.index:"")+" of level "+a.level+" was aborted"),this.resetFragmentLoading(a))},u.resetFragmentLoading=function(a){(!this.fragCurrent||!this.fragContextChanged(a))&&(this.state=R.IDLE)},u.onFragmentOrKeyLoadError=function(a,_){if(_.fatal)return;var N=_.frag;if(!N||N.type!==a)return;var B=this.fragCurrent;console.assert(B&&N.sn===B.sn&&N.level===B.level&&N.urlId===B.urlId,"Frag load error must match current frag to retry");var T=this.config;if(this.fragLoadError+1<=T.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var U=Math.min(Math.pow(2,this.fragLoadError)*T.fragLoadingRetryDelay,T.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+a+" "+N.level+" failed to load, retrying in "+U+"ms"),this.retryDate=self.performance.now()+U,this.fragLoadError++,this.state=R.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(a===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=R.IDLE):(W.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=R.ERROR)},u.afterBufferFlushed=function(a,_,N){if(!a)return;var B=G.BufferHelper.getBuffered(a);this.fragmentTracker.detectEvictedFragments(_,B,N),this.state===R.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE},u.resetLiveStartWhenNotLoaded=function(a){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[a].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(a,_,N,B){var T=this,U=N.details;console.assert(!!U,"level.details must be defined");var M=Object.keys(a.elementaryStreams).reduce(function(E,H){var Z=a.elementaryStreams[H];if(Z){var oe=Z.endPTS-Z.startPTS;if(oe<=0)return T.warn("Could not parse fragment "+a.sn+" "+H+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),T.resetTransmuxer(),E||!1;var de=B?0:Object(d.updateFragPTSDTS)(U,a,Z.startPTS,Z.endPTS,Z.startDTS,Z.endDTS);return T.hls.trigger(n.Events.LEVEL_PTS_UPDATED,{details:U,level:N,drift:de,type:H,frag:a,start:Z.startPTS,end:Z.endPTS}),!0}return E},!1);M?(this.state=R.PARSED,this.hls.trigger(n.Events.FRAG_PARSED,{frag:a,part:_})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(y,[{key:"state",get:function(){return this._state},set:function(a){var _=this._state;_!==a&&(this._state=a,this.log(_+"->"+a))}}]),y}(j.default)},"./src/controller/buffer-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return c});var Y=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),W=D("./src/utils/buffer-helper.ts"),n=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),b=D("./src/controller/buffer-operation-queue.ts"),m=Object(n.getMediaSource)(),g=/([ha]vc.)(?:\.[^.,]+)+/,c=function(){function d(l){var h=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 o=h.hls,s=h.media,A=h.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),s&&(h.updateMediaElementDuration(),o.trigger(j.Events.MEDIA_ATTACHED,{media:s})),A&&A.removeEventListener("sourceopen",h._onMediaSourceOpen),h.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var p=d.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var h=this.hls;h.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(j.Events.BUFFER_RESET,this.onBufferReset,this),h.on(j.Events.BUFFER_APPENDING,this.onBufferAppending,this),h.on(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(j.Events.BUFFER_EOS,this.onBufferEos,this),h.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),h.on(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),h.on(j.Events.FRAG_PARSED,this.onFragParsed,this),h.on(j.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var h=this.hls;h.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(j.Events.BUFFER_RESET,this.onBufferReset,this),h.off(j.Events.BUFFER_APPENDING,this.onBufferAppending,this),h.off(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(j.Events.BUFFER_EOS,this.onBufferEos,this),h.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),h.off(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),h.off(j.Events.FRAG_PARSED,this.onFragParsed,this),h.off(j.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(h,o){var s=2;(o.audio&&!o.video||!o.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(h,o){var s=this.media=o.media;if(s&&m){var A=this.mediaSource=new m;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(A),this._objectUrl=s.src}},p.onMediaDetaching=function(){var h=this.media,o=this.mediaSource,s=this._objectUrl;if(o){if(P.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(A){P.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),h&&(s&&self.URL.revokeObjectURL(s),h.src===s?(h.removeAttribute("src"),h.load()):P.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(j.Events.MEDIA_DETACHED,void 0)},p.onBufferReset=function(){var h=this;this.getSourceBufferTypes().forEach(function(o){var s=h.sourceBuffer[o];try{s&&(h.removeBufferListeners(o),h.mediaSource&&h.mediaSource.removeSourceBuffer(s),h.sourceBuffer[o]=void 0)}catch(A){P.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",A)}}),this._initSourceBuffer()},p.onBufferCodecs=function(h,o){var s=this,A=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(x){if(A){var S=s.tracks[x];if(S&&typeof S.buffer.changeType=="function"){var O=o[x],R=O.codec,C=O.levelCodec,w=O.container,y=(S.levelCodec||S.codec).replace(g,"$1"),u=(C||R).replace(g,"$1");if(y!==u){var v=w+";codecs="+(C||R);s.appendChangeType(x,v)}}}else s.pendingTracks[x]=o[x]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(h,o){var s=this,A=this.operationQueue,x={execute:function(){var O=s.sourceBuffer[h];O&&(P.logger.log("[buffer-controller]: changing "+h+" sourceBuffer type to "+o),O.changeType(o)),A.shiftAndExecuteNext(h)},onStart:function(){},onComplete:function(){},onError:function(O){P.logger.warn("[buffer-controller]: Failed to change "+h+" SourceBuffer type",O)}};A.append(x,h)},p.onBufferAppending=function(h,o){var s=this,A=this.hls,x=this.operationQueue,S=this.tracks,O=o.data,R=o.type,C=o.frag,w=o.part,y=o.chunkMeta,u=y.buffering[R],v=self.performance.now();u.start=v;var a=C.stats.buffering,_=w?w.stats.buffering:null;a.start===0&&(a.start=v),_&&_.start===0&&(_.start=v);var N=S.audio,B=R==="audio"&&y.id===1&&(N==null?void 0:N.container)==="audio/mpeg",T={execute:function(){if(u.executeStart=self.performance.now(),B){var M=s.sourceBuffer[R];if(M){var E=C.start-M.timestampOffset;Math.abs(E)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+C.start+" (delta: "+E+") sn: "+C.sn+")"),M.timestampOffset=C.start)}}s.appendExecutor(O,R)},onStart:function(){},onComplete:function(){var M=self.performance.now();u.executeEnd=u.end=M,a.first===0&&(a.first=M),_&&_.first===0&&(_.first=M);var E=s.sourceBuffer,H={};for(var Z in E)H[Z]=W.BufferHelper.getBuffered(E[Z]);s.appendError=0,s.hls.trigger(j.Events.BUFFER_APPENDED,{type:R,frag:C,part:w,chunkMeta:y,parent:C.type,timeRanges:H})},onError:function(M){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+R+" SourceBuffer",M);var E={type:G.ErrorTypes.MEDIA_ERROR,parent:C.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?E.details=G.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,E.details=G.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>A.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),E.fatal=!0)),A.trigger(j.Events.ERROR,E)}};x.append(T,R)},p.onBufferFlushing=function(h,o){var s=this,A=this.operationQueue,x=function(O){return{execute:s.removeExecutor.bind(s,O,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(j.Events.BUFFER_FLUSHED,{type:O})},onError:function(C){P.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",C)}}};o.type?A.append(x(o.type),o.type):this.getSourceBufferTypes().forEach(function(S){A.append(x(S),S)})},p.onFragParsed=function(h,o){var s=this,A=o.frag,x=o.part,S=[],O=x?x.elementaryStreams:A.elementaryStreams;O[L.ElementaryStreamTypes.AUDIOVIDEO]?S.push("audiovideo"):(O[L.ElementaryStreamTypes.AUDIO]&&S.push("audio"),O[L.ElementaryStreamTypes.VIDEO]&&S.push("video"));var R=function(){var w=self.performance.now();A.stats.buffering.end=w,x&&(x.stats.buffering.end=w);var y=x?x.stats:A.stats;s.hls.trigger(j.Events.FRAG_BUFFERED,{frag:A,part:x,stats:y,id:A.type})};S.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(R,S)},p.onFragChanged=function(h,o){this.flushBackBuffer()},p.onBufferEos=function(h,o){var s=this,A=this.getSourceBufferTypes().reduce(function(x,S){var O=s.sourceBuffer[S];return(!o.type||o.type===S)&&(O&&!O.ended&&(O.ended=!0,P.logger.log("[buffer-controller]: "+S+" sourceBuffer now EOS"))),x&&!!(!O||O.ended)},!0);A&&this.blockBuffers(function(){var x=s.mediaSource;if(!x||x.readyState!=="open")return;x.endOfStream()})},p.onLevelUpdated=function(h,o){var s=o.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},p.flushBackBuffer=function(){var h=this.hls,o=this.details,s=this.media,A=this.sourceBuffer;if(!s||o===null)return;var x=this.getSourceBufferTypes();if(!x.length)return;var S=o.live&&h.config.liveBackBufferLength!==null?h.config.liveBackBufferLength:h.config.backBufferLength;if(!Object(Y.isFiniteNumber)(S)||S<0)return;var O=s.currentTime,R=o.levelTargetDuration,C=Math.max(S,R),w=Math.floor(O/R)*R-C;x.forEach(function(y){var u=A[y];if(u){var v=W.BufferHelper.getBuffered(u);v.length>0&&w>v.start(0)&&(h.trigger(j.Events.BACK_BUFFER_REACHED,{bufferEnd:w}),o.live&&h.trigger(j.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:w}),h.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:w,type:y}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var h=this.details,o=this.hls,s=this.media,A=this.mediaSource,x=h.fragments[0].start+h.totalduration,S=s.duration,O=Object(Y.isFiniteNumber)(A.duration)?A.duration:0;h.live&&o.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(h)):(x>O&&x>S||!Object(Y.isFiniteNumber)(S))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+x.toFixed(3)),A.duration=x)},p.updateSeekableRange=function(h){var o=this.mediaSource,s=h.fragments,A=s.length;if(A&&h.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var x=Math.max(0,s[0].start),S=Math.max(x,x+h.totalduration);o.setLiveSeekableRange(x,S)}},p.checkPendingTracks=function(){var h=this.bufferCodecEventsExpected,o=this.operationQueue,s=this.pendingTracks,A=Object.keys(s).length;if(A&&!h||A===2){this.createSourceBuffers(s),this.pendingTracks={};var x=this.getSourceBufferTypes();if(x.length===0){this.hls.trigger(j.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}x.forEach(function(S){o.executeNext(S)})}},p.createSourceBuffers=function(h){var o=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var x in h)if(!o[x]){var S=h[x];if(!S)throw Error("source buffer exists for track "+x+", however track does not");var O=S.levelCodec||S.codec,R=S.container+";codecs="+O;P.logger.log("[buffer-controller]: creating sourceBuffer("+R+")");try{var C=o[x]=s.addSourceBuffer(R),w=x;this.addBufferListener(w,"updatestart",this._onSBUpdateStart),this.addBufferListener(w,"updateend",this._onSBUpdateEnd),this.addBufferListener(w,"error",this._onSBUpdateError),this.tracks[x]={buffer:C,codec:O,container:S.container,levelCodec:S.levelCodec,id:S.id},A++}catch(y){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+y.message),this.hls.trigger(j.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:y,mimeType:R})}}A&&this.hls.trigger(j.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(h){var o=this.operationQueue,s=o.current(h);s.onStart()},p._onSBUpdateEnd=function(h){var o=this.operationQueue,s=o.current(h);s.onComplete(),o.shiftAndExecuteNext(h)},p._onSBUpdateError=function(h,o){P.logger.error("[buffer-controller]: "+h+" SourceBuffer error",o),this.hls.trigger(j.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(h);s&&s.onError(o)},p.removeExecutor=function(h,o,s){var A=this.media,x=this.mediaSource,S=this.operationQueue,O=this.sourceBuffer,R=O[h];if(!A||!x||!R){P.logger.warn("[buffer-controller]: Attempting to remove from the "+h+" SourceBuffer, but it does not exist"),S.shiftAndExecuteNext(h);return}var C=Object(Y.isFiniteNumber)(A.duration)?A.duration:Infinity,w=Object(Y.isFiniteNumber)(x.duration)?x.duration:Infinity,y=Math.max(0,o),u=Math.min(s,C,w);u>y?(P.logger.log("[buffer-controller]: Removing ["+y+","+u+"] from the "+h+" SourceBuffer"),console.assert(!R.updating,h+" sourceBuffer must not be updating"),R.remove(y,u)):S.shiftAndExecuteNext(h)},p.appendExecutor=function(h,o){var s=this.operationQueue,A=this.sourceBuffer,x=A[o];if(!x){P.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(o);return}x.ended=!1,console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.appendBuffer(h)},p.blockBuffers=function(h,o){var s=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(h);return}var A=this.operationQueue,x=o.map(function(S){return A.appendBlocker(S)});Promise.all(x).then(function(){h(),o.forEach(function(S){var O=s.sourceBuffer[S];(!O||!O.updating)&&A.shiftAndExecuteNext(S)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(h,o,s){var A=this.sourceBuffer[h];if(!A)return;var x=s.bind(this,h);this.listeners[h].push({event:o,listener:x}),A.addEventListener(o,x)},p.removeBufferListeners=function(h){var o=this.sourceBuffer[h];if(!o)return;this.listeners[h].forEach(function(s){o.removeEventListener(s.event,s.listener)})},d}()},"./src/controller/buffer-operation-queue.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return j});var Y=D("./src/utils/logger.ts"),j=function(){function P(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var G=P.prototype;return G.append=function(n,L){var b=this.queues[L];b.push(n),b.length===1&&this.buffers[L]&&this.executeNext(L)},G.insertAbort=function(n,L){var b=this.queues[L];b.unshift(n),this.executeNext(L)},G.appendBlocker=function(n){var L,b=new Promise(function(g){L=g}),m={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(m,n),b},G.executeNext=function(n){var L=this.buffers,b=this.queues,m=L[n],g=b[n];if(g.length){var c=g[0];try{c.execute()}catch(d){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),c.onError(d),(!m||!m.updating)&&(g.shift(),this.executeNext(n))}}},G.shiftAndExecuteNext=function(n){this.queues[n].shift(),this.executeNext(n)},G.current=function(n){return this.queues[n][0]},P}()},"./src/controller/cap-level-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts");function j(W,n){for(var L=0;L<n.length;L++){var b=n[L];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(W,b.key,b)}}function P(W,n,L){return n&&j(W.prototype,n),L&&j(W,L),W}var G=function(){function W(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 n=W.prototype;return n.setStreamController=function(b){this.streamController=b},n.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},n.registerListeners=function(){var b=this.hls;b.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},n.unregisterListener=function(){var b=this.hls;b.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},n.onFpsDropLevelCapping=function(b,m){W.isLevelAllowed(m.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(m.droppedLevel)},n.onMediaAttaching=function(b,m){this.media=m.media instanceof HTMLVideoElement?m.media:null},n.onManifestParsed=function(b,m){var g=this.hls;this.restrictedLevels=[],this.firstLevel=m.firstLevel,g.config.capLevelToPlayerSize&&m.video&&this.startCapping()},n.onBufferCodecs=function(b,m){var g=this.hls;g.config.capLevelToPlayerSize&&m.video&&this.startCapping()},n.onMediaDetaching=function(){this.stopCapping()},n.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var m=this.hls;m.autoLevelCapping=this.getMaxLevel(b.length-1),m.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=m.autoLevelCapping}}},n.getMaxLevel=function(b){var m=this,g=this.hls.levels;if(!g.length)return-1;var c=g.filter(function(d,p){return W.isLevelAllowed(p,m.restrictedLevels)&&p<=b});return this.clientRect=null,W.getMaxLevelByMediaSize(c,this.mediaWidth,this.mediaHeight)},n.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()},n.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},n.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,m={width:0,height:0};if(b){var g=b.getBoundingClientRect();m.width=g.width,m.height=g.height,!m.width&&!m.height&&(m.width=g.right-g.left||b.width||0,m.height=g.bottom-g.top||b.height||0)}return this.clientRect=m,m},W.isLevelAllowed=function(b,m){return m===void 0&&(m=[]),m.indexOf(b)===-1},W.getMaxLevelByMediaSize=function(b,m,g){if(!b||!b.length)return-1;for(var c=function(o,s){return s?o.width!==s.width||o.height!==s.height:!0},d=b.length-1,p=0;p<b.length;p+=1){var l=b[p];if((l.width>=m||l.height>=g)&&c(l,b[p+1])){d=p;break}}return d},P(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(m){}return b}}]),W}();X.default=G},"./src/controller/cmcd-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return c});var Y=D("./src/events.ts"),j=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function W(d,p){for(var l=0;l<p.length;l++){var h=p[l];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(d,h.key,h)}}function n(d,p,l){return p&&W(d.prototype,p),l&&W(d,l),d}function L(d,p){var l=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(l)return(l=l.call(d)).next.bind(l);if(Array.isArray(d)||(l=b(d))||p&&d&&typeof d.length=="number"){l&&(d=l);var h=0;return function(){return h>=d.length?{done:!0}:{done:!1,value:d[h++]}}}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 b(d,p){if(!d)return;if(typeof d=="string")return m(d,p);var l=Object.prototype.toString.call(d).slice(8,-1);if(l==="Object"&&d.constructor&&(l=d.constructor.name),l==="Map"||l==="Set")return Array.from(d);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return m(d,p)}function m(d,p){(p==null||p>d.length)&&(p=d.length);for(var l=0,h=new Array(p);l<p;l++)h[l]=d[l];return h}function g(){return g=Object.assign||function(d){for(var p=1;p<arguments.length;p++){var l=arguments[p];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(d[h]=l[h])}return d},g.apply(this,arguments)}var c=function(){function d(l){var h=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(){h.initialized&&(h.starved=!0),h.buffering=!0},this.onPlaying=function(){h.initialized||(h.initialized=!0),h.buffering=!1},this.applyPlaylistData=function(A){try{h.apply(A,{ot:j.CMCDObjectType.MANIFEST,su:!h.initialized})}catch(x){G.logger.warn("Could not generate manifest CMCD data.",x)}},this.applyFragmentData=function(A){try{var x=A.frag,S=h.hls.levels[x.level],O=h.getObjectType(x),R={d:x.duration*1e3,ot:O};(O===j.CMCDObjectType.VIDEO||O===j.CMCDObjectType.AUDIO||O==j.CMCDObjectType.MUXED)&&(R.br=S.bitrate/1e3,R.tb=h.getTopBandwidth(O),R.bl=h.getBufferLength(O)),h.apply(A,R)}catch(C){G.logger.warn("Could not generate segment CMCD data.",C)}},this.hls=l;var o=this.config=l.config,s=o.cmcd;s!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||d.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var p=d.prototype;return p.registerListeners=function(){var h=this.hls;h.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),h.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var h=this.hls;h.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),h.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(h,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(h,o){var s,A;this.audioBuffer=(s=o.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(A=o.tracks.video)===null||A===void 0?void 0:A.buffer},p.createData=function(){var h;return{v:j.CMCDVersion,sf:j.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(h=this.media)===null||h===void 0?void 0:h.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},p.apply=function(h,o){o===void 0&&(o={}),g(o,this.createData());var s=o.ot===j.CMCDObjectType.INIT||o.ot===j.CMCDObjectType.VIDEO||o.ot===j.CMCDObjectType.MUXED;if(this.starved&&s&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var A=d.toHeaders(o);if(!Object.keys(A).length)return;h.headers||(h.headers={}),g(h.headers,A)}else{var x=d.toQuery(o);if(!x)return;h.url=d.appendQueryToUri(h.url,x)}},p.getObjectType=function(h){var o=h.type;return o==="subtitle"?j.CMCDObjectType.TIMED_TEXT:h.sn==="initSegment"?j.CMCDObjectType.INIT:o==="audio"?j.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?j.CMCDObjectType.VIDEO:j.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(h){for(var o=0,s=h===j.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=L(s),x;!(x=A()).done;){var S=x.value;S.bitrate>o&&(o=S.bitrate)}return o>0?o:NaN},p.getBufferLength=function(h){var o=this.hls.media,s=h===j.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!o)return NaN;var A=P.BufferHelper.bufferInfo(s,o.currentTime,this.config.maxBufferHole);return A.len*1e3},p.createPlaylistLoader=function(){var h=this.config.pLoader,o=this.applyPlaylistData,s=h||this.config.loader;return function(){function A(S){this.loader=void 0,this.loader=new s(S)}var x=A.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(O,R,C){o(O),this.loader.load(O,R,C)},n(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},p.createFragmentLoader=function(){var h=this.config.fLoader,o=this.applyFragmentData,s=h||this.config.loader;return function(){function A(S){this.loader=void 0,this.loader=new s(S)}var x=A.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(O,R,C){o(O),this.loader.load(O,R,C)},n(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},d.uuid=function(){var h=URL.createObjectURL(new Blob),o=h.toString();return URL.revokeObjectURL(h),o.substr(o.lastIndexOf("/")+1)},d.serialize=function(h){for(var o=[],s=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},A=function(B){return Math.round(B)},x=function(B){return A(B/100)*100},S=function(B){return encodeURIComponent(B)},O={br:A,d:A,bl:x,dl:x,mtp:x,nor:S,rtp:x,tb:A},R=Object.keys(h||{}).sort(),C=L(R),w;!(w=C()).done;){var y=w.value,u=h[y];if(!s(u))continue;if(y==="v"&&u===1)continue;if(y=="pr"&&u===1)continue;var v=O[y];v&&(u=v(u));var a=typeof u,_=void 0;y==="ot"||y==="sf"||y==="st"?_=y+"="+u:a==="boolean"?_=y:a==="number"?_=y+"="+u:_=y+"="+JSON.stringify(u),o.push(_)}return o.join(",")},d.toHeaders=function(h){for(var o=Object.keys(h),s={},A=["Object","Request","Session","Status"],x=[{},{},{},{}],S={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},O=0,R=o;O<R.length;O++){var C=R[O],w=S[C]!=null?S[C]:1;x[w][C]=h[C]}for(var y=0;y<x.length;y++){var u=d.serialize(x[y]);u&&(s["CMCD-"+A[y]]=u)}return s},d.toQuery=function(h){return"CMCD="+encodeURIComponent(d.serialize(h))},d.appendQueryToUri=function(h,o){if(!o)return h;var s=h.includes("?")?"&":"?";return""+h+s+o},d}()},"./src/controller/eme-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts"),j=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function W(c,d){for(var p=0;p<d.length;p++){var l=d[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function n(c,d,p){return d&&W(c.prototype,d),p&&W(c,p),c}var L=3,b=function(d,p,l){var h={audioCapabilities:[],videoCapabilities:[]};return d.forEach(function(o){h.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:l.audioRobustness||""})}),p.forEach(function(o){h.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:l.videoRobustness||""})}),[h]},m=function(d,p,l,h){switch(d){case G.KeySystems.WIDEVINE:return b(p,l,h);default:throw new Error("Unknown key-system: "+d)}},g=function(){function c(p){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=p,this._config=p.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 d=c.prototype;return d.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},d._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)},d._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)},d.getLicenseServerUrl=function(l){switch(l){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},d._attemptKeySystemAccess=function(l,h,o){var s=this,A=m(l,h,o,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var x=this.requestMediaKeySystemAccess(l,A);this.mediaKeysPromise=x.then(function(S){return s._onMediaKeySystemAccessObtained(l,S)}),x.catch(function(S){P.logger.error('Failed to obtain key-system "'+l+'" access:',S)})},d._onMediaKeySystemAccessObtained=function(l,h){var o=this;P.logger.log('Access for key-system "'+l+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:h,mediaKeySystemDomain:l};this._mediaKeysList.push(s);var A=Promise.resolve().then(function(){return h.createMediaKeys()}).then(function(x){return s.mediaKeys=x,P.logger.log('Media-keys created for key-system "'+l+'"'),o._onMediaKeysCreated(),x});return A.catch(function(x){P.logger.error("Failed to create media-keys:",x)}),A},d._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(h){h.mediaKeysSession||(h.mediaKeysSession=h.mediaKeys.createSession(),l._onNewMediaKeySession(h.mediaKeysSession))})},d._onNewMediaKeySession=function(l){var h=this;P.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(o){h._onKeySessionMessage(l,o.message)},!1)},d._onKeySessionMessage=function(l,h){P.logger.log("Got EME message event, creating license request"),this._requestLicense(h,function(o){P.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),l.update(o)})},d.onMediaEncrypted=function(l){var h=this;if(P.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(A){if(!h._media)return;h._attemptSetMediaKeys(A),h._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(o).catch(o)},d._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var h=this._mediaKeysList[0];if(!h||!h.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(h.mediaKeys),this._hasSetMediaKeys=!0}},d._generateRequestWithPreferredKeySession=function(l,h){var o=this,s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var A=s.mediaKeysSession;if(!A){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!h){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+l+'" init data type'),s.mediaKeysSessionInitialized=!0,A.generateRequest(l,h).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(x){P.logger.error("Error generating key-session request:",x),o.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},d._createLicenseXhr=function(l,h,o){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,l,h,o);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,s,l),A=void 0}catch(x){P.logger.error(x)}try{s.readyState||s.open("POST",l,!0),A&&A.call(this.hls,s,l)}catch(x){throw new Error("issue setting up KeySystem license XHR "+x)}return s},d._onLicenseRequestReadyStageChange=function(l,h,o,s){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var A=l.response,x=this._licenseResponseCallback;if(x)try{A=x.call(this.hls,l,h)}catch(O){P.logger.error(O)}s(A)}else{if(P.logger.error("License Request XHR failed ("+h+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var S=L-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+S+" attempts left"),this._requestLicense(o,s)}break}},d._generateLicenseRequestChallenge=function(l,h){switch(l.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return h}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},d._requestLicense=function(l,h){P.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(o.mediaKeySystemDomain),A=this._createLicenseXhr(s,l,h);P.logger.log("Sending license request to URL: "+s);var x=this._generateLicenseRequestChallenge(o,l);A.send(x)}catch(S){P.logger.error("Failure requesting DRM license: "+S),this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.KEY_SYSTEM_ERROR,details:j.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},d.onMediaAttached=function(l,h){if(!this._emeEnabled)return;var o=h.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},d.onMediaDetached=function(){var l=this._media,h=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(h.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},d.onManifestParsed=function(l,h){if(!this._emeEnabled)return;var o=h.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),s=h.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,o,s)},n(c,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),c}();X.default=g},"./src/controller/fps-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts"),j=D("./src/utils/logger.ts"),P=function(){function G(n){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=n,this.registerListeners()}var W=G.prototype;return W.setStreamController=function(L){this.streamController=L},W.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(L,b){var m=this.hls.config;if(m.capLevelOnFPSDrop){var g=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=g,g&&typeof g.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),m.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(L,b,m){var g=performance.now();if(b){if(this.lastTime){var c=g-this.lastTime,d=m-this.lastDroppedFrames,p=b-this.lastDecodedFrames,l=1e3*d/c,h=this.hls;if(h.trigger(Y.Events.FPS_DROP,{currentDropped:d,currentDecoded:p,totalDroppedFrames:m}),l>0&&d>h.config.fpsDroppedMonitoringThreshold*p){var o=h.currentLevel;j.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=o)&&(o=o-1,h.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:h.currentLevel}),h.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=g,this.lastDroppedFrames=m,this.lastDecodedFrames=b}},W.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var b=L.getVideoPlaybackQuality();this.checkFPS(L,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},G}();X.default=P},"./src/controller/fragment-finders.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"findFragmentByPDT",function(){return P}),D.d(X,"findFragmentByPTS",function(){return G}),D.d(X,"fragmentWithinToleranceTest",function(){return W}),D.d(X,"pdtWithinToleranceTest",function(){return n}),D.d(X,"findFragWithCC",function(){return L});var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/binary-search.ts");function P(b,m,g){if(m===null||!Array.isArray(b)||!b.length||!Object(Y.isFiniteNumber)(m))return null;var c=b[0].programDateTime;if(m<(c||0))return null;var d=b[b.length-1].endProgramDateTime;if(m>=(d||0))return null;g=g||0;for(var p=0;p<b.length;++p){var l=b[p];if(n(m,g,l))return l}return null}function G(b,m,g,c){g===void 0&&(g=0),c===void 0&&(c=0);var d=null;if(b?d=m[b.sn-m[0].sn+1]||null:g===0&&m[0].start===0&&(d=m[0]),d&&W(g,c,d)===0)return d;var p=j.default.search(m,W.bind(null,g,c));return p||d}function W(b,m,g){b===void 0&&(b=0),m===void 0&&(m=0);var c=Math.min(m,g.duration+(g.deltaPTS?g.deltaPTS:0));return g.start+g.duration-c<=b?1:g.start-c>b&&g.start?-1:0}function n(b,m,g){var c=Math.min(m,g.duration+(g.deltaPTS?g.deltaPTS:0))*1e3,d=g.endProgramDateTime||0;return d-c>b}function L(b,m){return j.default.search(b,function(g){return g.cc<m?1:g.cc>m?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"FragmentState",function(){return P}),D.d(X,"FragmentTracker",function(){return G});var Y=D("./src/events.ts"),j=D("./src/types/loader.ts"),P;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(P||(P={}));var G=function(){function L(m){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=m,this._registerListeners()}var b=L.prototype;return b._registerListeners=function(){var g=this.hls;g.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),g.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),g.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var g=this.hls;g.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),g.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),g.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(g,c){if(c===j.PlaylistLevelType.MAIN){var d=this.activeFragment,p=this.activeParts;if(!d)return null;if(p)for(var l=p.length;l--;){var h=p[l],o=h?h.end:d.appendedPTS;if(h.start<=g&&o!==void 0&&g<=o)return l>9&&(this.activeParts=p.slice(l-9)),h}else if(d.start<=g&&d.appendedPTS!==void 0&&g<=d.appendedPTS)return d}return this.getBufferedFrag(g,c)},b.getBufferedFrag=function(g,c){for(var d=this.fragments,p=Object.keys(d),l=p.length;l--;){var h=d[p[l]];if((h==null?void 0:h.body.type)===c&&h.buffered){var o=h.body;if(o.start<=g&&g<=o.end)return o}}return null},b.detectEvictedFragments=function(g,c,d){var p=this;Object.keys(this.fragments).forEach(function(l){var h=p.fragments[l];if(!h)return;if(!h.buffered){h.body.type===d&&p.removeFragment(h.body);return}var o=h.range[g];if(!o)return;o.time.some(function(s){var A=!p.isTimeBuffered(s.startPTS,s.endPTS,c);return A&&p.removeFragment(h.body),A})})},b.detectPartialFragments=function(g){var c=this,d=this.timeRanges,p=g.frag,l=g.part;if(!d||p.sn==="initSegment")return;var h=n(p),o=this.fragments[h];if(!o)return;Object.keys(d).forEach(function(s){var A=p.elementaryStreams[s];if(!A)return;var x=d[s],S=l!==null||A.partial===!0;o.range[s]=c.getBufferedTimes(p,l,S,x)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},b.fragBuffered=function(g){var c=n(g),d=this.fragments[c];d&&(d.backtrack=d.loaded=null,d.buffered=!0)},b.getBufferedTimes=function(g,c,d,p){for(var l={time:[],partial:d},h=c?c.start:g.start,o=c?c.end:g.end,s=g.minEndPTS||o,A=g.maxStartPTS||h,x=0;x<p.length;x++){var S=p.start(x)-this.bufferPadding,O=p.end(x)+this.bufferPadding;if(A>=S&&s<=O){l.time.push({startPTS:Math.max(h,p.start(x)),endPTS:Math.min(o,p.end(x))});break}else if(h<O&&o>S)l.partial=!0,l.time.push({startPTS:Math.max(h,p.start(x)),endPTS:Math.min(o,p.end(x))});else if(o<=S)break}return l},b.getPartialFragment=function(g){var c=null,d,p,l,h=0,o=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(A){var x=s[A];if(!x)return;W(x)&&(p=x.body.start-o,l=x.body.end+o,g>=p&&g<=l&&(d=Math.min(g-p,l-g),h<=d&&(c=x.body,h=d)))}),c},b.getState=function(g){var c=n(g),d=this.fragments[c];return d?d.buffered?W(d)?P.PARTIAL:P.OK:d.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},b.backtrack=function(g,c){var d=n(g),p=this.fragments[d];if(!p||p.backtrack)return null;var l=p.backtrack=c||p.loaded;return p.loaded=null,l},b.getBacktrackData=function(g){var c=n(g),d=this.fragments[c];if(d){var p,l=d.backtrack;if(l!=null&&(p=l.payload)!==null&&p!==void 0&&p.byteLength)return l;this.removeFragment(g)}return null},b.isTimeBuffered=function(g,c,d){for(var p,l,h=0;h<d.length;h++){if(p=d.start(h)-this.bufferPadding,l=d.end(h)+this.bufferPadding,g>=p&&c<=l)return!0;if(c<=p)return!1}return!1},b.onFragLoaded=function(g,c){var d=c.frag,p=c.part;if(d.sn==="initSegment"||d.bitrateTest||p)return;var l=n(d);this.fragments[l]={body:d,loaded:c,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(g,c){var d=this,p=c.frag,l=c.part,h=c.timeRanges;if(p.type===j.PlaylistLevelType.MAIN)if(this.activeFragment=p,l){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(l)}else this.activeParts=null;this.timeRanges=h,Object.keys(h).forEach(function(s){var A=h[s];if(d.detectEvictedFragments(s,A),!l)for(var x=0;x<A.length;x++)p.appendedPTS=Math.max(A.end(x),p.appendedPTS||0)})},b.onFragBuffered=function(g,c){this.detectPartialFragments(c)},b.hasFragment=function(g){var c=n(g);return!!this.fragments[c]},b.removeFragmentsInRange=function(g,c,d){var p=this;Object.keys(this.fragments).forEach(function(l){var h=p.fragments[l];if(!h)return;if(h.buffered){var o=h.body;o.type===d&&o.start<c&&o.end>g&&p.removeFragment(o)}})},b.removeFragment=function(g){var c=n(g);g.stats.loaded=0,g.clearElementaryStreamInfo(),delete this.fragments[c]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function W(L){var b,m;return L.buffered&&(((b=L.range.video)===null||b===void 0?void 0:b.partial)||((m=L.range.audio)===null||m===void 0?void 0:m.partial))}function n(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"STALL_MINIMUM_DURATION_MS",function(){return W}),D.d(X,"MAX_START_GAP_JUMP",function(){return n}),D.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d(X,"SKIP_BUFFER_RANGE_START",function(){return b}),D.d(X,"default",function(){return m});var Y=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),P=D("./src/events.ts"),G=D("./src/utils/logger.ts"),W=250,n=2,L=.1,b=.05,m=function(){function g(d,p,l,h){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=d,this.media=p,this.fragmentTracker=l,this.hls=h}var c=g.prototype;return c.destroy=function(){this.hls=this.fragmentTracker=this.media=null},c.poll=function(p){var l=this.config,h=this.media,o=this.stalled,s=h.currentTime,A=h.seeking,x=this.seeking&&!A,S=!this.seeking&&A;if(this.seeking=A,s!==p){if(this.moved=!0,o!==null){if(this.stallReported){var O=self.performance.now()-o;G.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((S||x)&&(this.stalled=null),h.paused||h.ended||h.playbackRate===0||!Y.BufferHelper.getBuffered(h).length)return;var R=Y.BufferHelper.bufferInfo(h,s,0),C=R.len>0,w=R.nextStart||0;if(!C&&!w)return;if(A){var y=R.len>n,u=!w||w-s>n&&!this.fragmentTracker.getPartialFragment(s);if(y||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,a=Math.max(w,R.start||0)-s,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=_==null||((v=_.details)===null||v===void 0)?void 0:v.live,B=N?_.details.targetduration*2:n;if(a>0&&a<=B){this._trySkipBufferHole(null);return}}var T=self.performance.now();if(o===null){this.stalled=T;return}var U=T-o;!A&&U>=W&&this._reportStall(R.len);var M=Y.BufferHelper.bufferInfo(h,s,l.maxBufferHole);this._tryFixBufferStall(M,U)},c._tryFixBufferStall=function(p,l){var h=this.config,o=this.fragmentTracker,s=this.media,A=s.currentTime,x=o.getPartialFragment(A);if(x){var S=this._trySkipBufferHole(x);if(S)return}p.len>h.maxBufferHole&&l>h.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},c._reportStall=function(p){var l=this.hls,h=this.media,o=this.stallReported;o||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+h.currentTime+" due to low buffer (buffer="+p+")"),l.trigger(P.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},c._trySkipBufferHole=function(p){for(var l=this.config,h=this.hls,o=this.media,s=o.currentTime,A=0,x=Y.BufferHelper.getBuffered(o),S=0;S<x.length;S++){var O=x.start(S);if(s+l.maxBufferHole>=A&&s<O){var R=Math.max(O+b,o.currentTime+L);return G.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+R),this.moved=!0,this.stalled=null,o.currentTime=R,p&&h.trigger(P.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+R,frag:p}),R}A=x.end(S)}return 0},c._tryNudgeBuffer=function(){var p=this.config,l=this.hls,h=this.media,o=h.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<p.nudgeMaxRetry){var A=o+s*p.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+o+" to "+A),h.currentTime=A,l.trigger(P.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+p.nudgeMaxRetry+" nudges"),l.trigger(P.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},g}()},"./src/controller/id3-track-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts"),j=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),G=.25,W=function(){function n(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var L=n.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var m=this.hls;m.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var m=this.hls;m.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(m,g){this.media=g.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(j.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(m){if(!this.media)return;for(var g=0;g<m.length;g++){var c=m[g];if(c.kind==="metadata"&&c.label==="id3")return Object(j.sendAddTrackEvent)(c,this.media),c}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(m,g){if(!this.media)return;var c=g.frag,d=g.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<d.length;l++){var h=P.getID3Frames(d[l].data);if(h){var o=d[l].pts,s=l<d.length-1?d[l+1].pts:c.end,A=s-o;A<=0&&(s=o+G);for(var x=0;x<h.length;x++){var S=h[x];if(!P.isTimeStampFrame(S)){var O=new p(o,s,"");O.value=S,this.id3Track.addCue(O)}}}}},L.onBufferFlushing=function(m,g){var c=g.startOffset,d=g.endOffset,p=g.type;if(!p||p==="audio"){var l=this.id3Track;l&&Object(j.removeCuesInRange)(l,c,d)}},n}();X.default=W},"./src/controller/latency-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return n});var Y=D("./src/errors.ts"),j=D("./src/events.ts"),P=D("./src/utils/logger.ts");function G(L,b){for(var m=0;m<b.length;m++){var g=b[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(L,g.key,g)}}function W(L,b,m){return b&&G(L.prototype,b),m&&G(L,m),L}var n=function(){function L(m){var g=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 g.timeupdate()},this.hls=m,this.config=m.config,this.registerListeners()}var b=L.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(j.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(j.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(j.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(j.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(j.Events.ERROR,this.onError)},b.onMediaAttached=function(g,c){this.media=c.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(g,c){var d=c.details;this.levelDetails=d,d.advanced&&this.timeupdate(),!d.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(g,c){if(c.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var g=this.media,c=this.levelDetails;if(!g||!c)return;this.currentTime=g.currentTime;var d=this.computeLatency();if(d===null)return;this._latency=d;var p=this.config,l=p.lowLatencyMode,h=p.maxLiveSyncPlaybackRate;if(!l||h===1)return;var o=this.targetLatency;if(o===null)return;var s=d-o,A=Math.min(this.maxLatency,o+c.targetduration),x=s<A;if(c.live&&x&&s>.05&&this.forwardBufferLength>1){var S=Math.min(2,Math.max(1,h)),O=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;g.playbackRate=Math.min(S,Math.max(1,O))}else g.playbackRate!==1&&g.playbackRate!==0&&(g.playbackRate=1)},b.estimateLiveEdge=function(){var g=this.levelDetails;return g===null?null:g.edge+g.age},b.computeLatency=function(){var g=this.estimateLiveEdge();return g===null?null:g-this.currentTime},W(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var g=this.config,c=this.levelDetails;return g.liveMaxLatencyDuration!==void 0?g.liveMaxLatencyDuration:c?g.liveMaxLatencyDurationCount*c.targetduration:0}},{key:"targetLatency",get:function(){var g=this.levelDetails;if(g===null)return null;var c=g.holdBack,d=g.partHoldBack,p=g.targetduration,l=this.config,h=l.liveSyncDuration,o=l.liveSyncDurationCount,s=l.lowLatencyMode,A=this.hls.userConfig,x=s&&d||c;(A.liveSyncDuration||A.liveSyncDurationCount||x===0)&&(x=h!==void 0?h:o*p);var S=p,O=1;return x+Math.min(this.stallCount*O,S)}},{key:"liveSyncPosition",get:function(){var g=this.estimateLiveEdge(),c=this.targetLatency,d=this.levelDetails;if(g===null||c===null||d===null)return null;var p=d.edge,l=g-c-this.edgeStalled,h=p-d.totalduration,o=p-(this.config.lowLatencyMode&&d.partTarget||d.targetduration);return Math.min(Math.max(h,l),o)}},{key:"drift",get:function(){var g=this.levelDetails;return g===null?1:g.drift}},{key:"edgeStalled",get:function(){var g=this.levelDetails;if(g===null)return 0;var c=(this.config.lowLatencyMode&&g.partTarget||g.targetduration)*3;return Math.max(g.age-c,0)}},{key:"forwardBufferLength",get:function(){var g=this.media,c=this.levelDetails;if(!g||!c)return 0;var d=g.buffered.length;return d?g.buffered.end(d-1):c.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return l});var Y=D("./src/types/level.ts"),j=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),W=D("./src/controller/level-helper.ts"),n=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function b(){return b=Object.assign||function(h){for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var A in s)Object.prototype.hasOwnProperty.call(s,A)&&(h[A]=s[A])}return h},b.apply(this,arguments)}function m(h,o){for(var s=0;s<o.length;s++){var A=o[s];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(h,A.key,A)}}function g(h,o,s){return o&&m(h.prototype,o),s&&m(h,s),h}function c(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,d(h,o)}function d(h,o){return d=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},d(h,o)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(h){c(o,h);function o(A){var x;return x=h.call(this,A,"[level-controller]")||this,x._levels=[],x._firstLevel=-1,x._startLevel=void 0,x.currentLevelIndex=-1,x.manualLevelIndex=-1,x.onParsedComplete=void 0,x._registerListeners(),x}var s=o.prototype;return s._registerListeners=function(){var x=this.hls;x.on(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(j.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(j.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var x=this.hls;x.off(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(j.Events.FRAG_LOADED,this.onFragLoaded,this),x.off(j.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,h.prototype.destroy.call(this)},s.startLoad=function(){var x=this._levels;x.forEach(function(S){S.loadError=0}),h.prototype.startLoad.call(this)},s.onManifestLoaded=function(x,S){var O=[],R=[],C=[],w,y={},u,v=!1,a=!1,_=!1;if(S.levels.forEach(function(U){var M=U.attrs;v=v||!!(U.width&&U.height),a=a||!!U.videoCodec,_=_||!!U.audioCodec,p&&U.audioCodec&&U.audioCodec.indexOf("mp4a.40.34")!==-1&&(U.audioCodec=void 0);var E=U.bitrate+"-"+U.attrs.RESOLUTION+"-"+U.attrs.CODECS;u=y[E],u?u.url.push(U.url):(u=new Y.Level(U),y[E]=u,O.push(u)),M&&(M.AUDIO&&Object(W.addGroupId)(u,"audio",M.AUDIO),M.SUBTITLES&&Object(W.addGroupId)(u,"text",M.SUBTITLES))}),(v||a)&&_&&(O=O.filter(function(U){var M=U.videoCodec,E=U.width,H=U.height;return!!M||!!(E&&H)})),O=O.filter(function(U){var M=U.audioCodec,E=U.videoCodec;return(!M||Object(G.isCodecSupportedInMp4)(M,"audio"))&&(!E||Object(G.isCodecSupportedInMp4)(E,"video"))}),S.audioTracks&&(R=S.audioTracks.filter(function(U){return!U.audioCodec||Object(G.isCodecSupportedInMp4)(U.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(R)),S.subtitles&&(C=S.subtitles,Object(W.assignTrackIdsByGroup)(C)),O.length>0){w=O[0].bitrate,O.sort(function(U,M){return U.bitrate-M.bitrate}),this._levels=O;for(var N=0;N<O.length;N++)if(O[N].bitrate===w){this._firstLevel=N,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+w);break}var B=_&&!a,T={levels:O,audioTracks:R,subtitleTracks:C,firstLevel:this._firstLevel,stats:S.stats,audio:_,video:a,altAudio:!B&&R.some(function(U){return!!U.url})};this.hls.trigger(j.Events.MANIFEST_PARSED,T),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(j.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:S.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(x,S){if(h.prototype.onError.call(this,x,S),S.fatal)return;var O=S.context,R=this._levels[this.currentLevelIndex];if(O&&(O.type===L.PlaylistContextType.AUDIO_TRACK&&R.audioGroupIds&&O.groupId===R.audioGroupIds[R.urlId]||O.type===L.PlaylistContextType.SUBTITLE_TRACK&&R.textGroupIds&&O.groupId===R.textGroupIds[R.urlId])){this.redundantFailover(this.currentLevelIndex);return}var C=!1,w=!0,y;switch(S.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(S.frag){var u=this._levels[S.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(y=S.frag.level)):y=S.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(w=!1),y=O.level),C=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:y=S.level,C=!0;break}y!==void 0&&this.recoverLevel(S,y,C,w)},s.recoverLevel=function(x,S,O,R){var C=x.details,w=this._levels[S];if(w.loadError++,O){var y=this.retryLoadingOrFail(x);if(y)x.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(R){var u=w.url.length;if(u>1&&w.loadError<u)x.levelRetry=!0,this.redundantFailover(S);else if(this.manualLevelIndex===-1){var v=S===0?this._levels.length-1:S-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(C+": switch to "+v),x.levelRetry=!0,this.hls.nextAutoLevel=v)}}},s.redundantFailover=function(x){var S=this._levels[x],O=S.url.length;if(O>1){var R=(S.urlId+1)%O;this.warn("Switching to redundant URL-id "+R),this._levels.forEach(function(C){C.urlId=R}),this.level=x}},s.onFragLoaded=function(x,S){var O=S.frag;if(O!==void 0&&O.type===L.PlaylistLevelType.MAIN){var R=this._levels[O.level];R!==void 0&&(R.fragmentError=0,R.loadError=0)}},s.onLevelLoaded=function(x,S){var O,R=S.level,C=S.details,w=this._levels[R];if(!w){var y;this.warn("Invalid level index "+R),(y=S.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(C.deltaUpdateFailed=!0);return}R===this.currentLevelIndex?(w.fragmentError===0&&(w.loadError=0,this.retryCount=0),this.playlistLoaded(R,S,w.details)):(O=S.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(C.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(x,S){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var R=-1,C=this.hls.audioTracks[S.id].groupId,w=0;w<O.audioGroupIds.length;w++)if(O.audioGroupIds[w]===C){R=w;break}R!==O.urlId&&(O.urlId=R,this.startLoad())}},s.loadPlaylist=function(x){var S=this.currentLevelIndex,O=this._levels[S];if(this.canLoad&&O&&O.url.length>0){var R=O.urlId,C=O.url[R];if(x)try{C=x.addDirectives(C)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("Attempt loading level index "+S+(x?" at sn "+x.msn+" part "+x.part:"")+" with URL-id "+R+" "+C),this.clearTimer(),this.hls.trigger(j.Events.LEVEL_LOADING,{url:C,level:S,id:R,deliveryDirectives:x||null})}},s.removeLevel=function(x,S){var O=function(w,y){return y!==S},R=this._levels.filter(function(C,w){return w!==x?!0:C.url.length>1&&S!==void 0?(C.url=C.url.filter(O),C.audioGroupIds&&(C.audioGroupIds=C.audioGroupIds.filter(O)),C.textGroupIds&&(C.textGroupIds=C.textGroupIds.filter(O)),C.urlId=0,!0):!1}).map(function(C,w){var y=C.details;return y!=null&&y.fragments&&y.fragments.forEach(function(u){u.level=w}),C});this._levels=R,this.hls.trigger(j.Events.LEVELS_UPDATED,{levels:R})},g(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(x){var S,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===x&&(S=O[x])!==null&&S!==void 0&&S.details)return;if(x<0||x>=O.length){var R=x<0;if(this.hls.trigger(j.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:x,fatal:R,reason:"invalid level idx"}),R)return;x=Math.min(x,O.length-1)}this.clearTimer();var C=this.currentLevelIndex,w=O[C],y=O[x];this.log("switching to level "+x+" from "+C),this.currentLevelIndex=x;var u=b({},y,{level:x,maxBitrate:y.maxBitrate,uri:y.uri,urlId:y.urlId});delete u._urlId,this.hls.trigger(j.Events.LEVEL_SWITCHING,u);var v=y.details;if(!v||v.live){var a=this.switchParams(y.uri,w==null?void 0:w.details);this.loadPlaylist(a)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(x){this.manualLevelIndex=x,this._startLevel===void 0&&(this._startLevel=x),x!==-1&&(this.level=x)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(x){this._firstLevel=x}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var x=this.hls.config.startLevel;return x!==void 0?x:this._firstLevel}else return this._startLevel},set:function(x){this._startLevel=x}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(x){this.level=x,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=x)}}]),o}(n.default)},"./src/controller/level-helper.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"addGroupId",function(){return P}),D.d(X,"assignTrackIdsByGroup",function(){return G}),D.d(X,"updatePTS",function(){return W}),D.d(X,"updateFragPTSDTS",function(){return L}),D.d(X,"mergeDetails",function(){return b}),D.d(X,"mapPartIntersection",function(){return m}),D.d(X,"mapFragmentIntersection",function(){return g}),D.d(X,"adjustSliding",function(){return c}),D.d(X,"addSliding",function(){return d}),D.d(X,"computeReloadInterval",function(){return p}),D.d(X,"getFragmentWithSN",function(){return l}),D.d(X,"getPartWith",function(){return h});var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/logger.ts");function P(o,s,A){switch(s){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(A);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(A);break}}function G(o){var s={};o.forEach(function(A){var x=A.groupId||"";A.id=s[x]=s[x]||0,s[x]++})}function W(o,s,A){var x=o[s],S=o[A];n(x,S)}function n(o,s){var A=s.startPTS;if(Object(Y.isFiniteNumber)(A)){var x=0,S;s.sn>o.sn?(x=A-o.start,S=o):(x=o.start-A,S=s),S.duration!==x&&(S.duration=x)}else if(s.sn>o.sn){var O=o.cc===s.cc;O&&o.minEndPTS?s.start=o.start+(o.minEndPTS-o.start):s.start=o.start+o.duration}else s.start=Math.max(o.start-s.duration,0)}function L(o,s,A,x,S,O){var R=x-A;R<=0&&(j.logger.warn("Fragment should have a positive duration",s),x=A+s.duration,O=S+s.duration);var C=A,w=x,y=s.startPTS,u=s.endPTS;if(Object(Y.isFiniteNumber)(y)){var v=Math.abs(y-A);Object(Y.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(v,s.deltaPTS):s.deltaPTS=v,C=Math.max(A,y),A=Math.min(A,y),S=Math.min(S,s.startDTS),w=Math.min(x,u),x=Math.max(x,u),O=Math.max(O,s.endDTS)}s.duration=x-A;var a=A-s.start;s.appendedPTS=x,s.start=s.startPTS=A,s.maxStartPTS=C,s.startDTS=S,s.endPTS=x,s.minEndPTS=w,s.endDTS=O;var _=s.sn;if(!o||_<o.startSN||_>o.endSN)return 0;var N,B=_-o.startSN,T=o.fragments;for(T[B]=s,N=B;N>0;N--)n(T[N],T[N-1]);for(N=B;N<T.length-1;N++)n(T[N],T[N+1]);return o.fragmentHint&&n(T[T.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,a}function b(o,s){for(var A=null,x=o.fragments,S=x.length-1;S>=0;S--){var O=x[S].initSegment;if(O){A=O;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var R=0,C;if(g(o,s,function(N,B){N.relurl&&(R=N.cc-B.cc),Object(Y.isFiniteNumber)(N.startPTS)&&Object(Y.isFiniteNumber)(N.endPTS)&&(B.start=B.startPTS=N.startPTS,B.startDTS=N.startDTS,B.appendedPTS=N.appendedPTS,B.maxStartPTS=N.maxStartPTS,B.endPTS=N.endPTS,B.endDTS=N.endDTS,B.minEndPTS=N.minEndPTS,B.duration=N.endPTS-N.startPTS,B.duration&&(C=B),s.PTSKnown=s.alignedSliding=!0),B.elementaryStreams=N.elementaryStreams,B.loader=N.loader,B.stats=N.stats,B.urlId=N.urlId,N.initSegment&&(B.initSegment=N.initSegment,A=N.initSegment)}),A){var w=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;w.forEach(function(N){var B;(!N.initSegment||N.initSegment.relurl===((B=A)===null||B===void 0?void 0:B.relurl))&&(N.initSegment=A)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(N){return!N}),s.deltaUpdateFailed)){j.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=s.skippedSegments;y--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var u=s.fragments;if(R){j.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<u.length;v++)u[v].cc+=R}s.skippedSegments&&(s.startCC=s.fragments[0].cc),m(o.partList,s.partList,function(N,B){B.elementaryStreams=N.elementaryStreams,B.stats=N.stats}),C?L(s,C,C.startPTS,C.endPTS,C.startDTS,C.endDTS):c(o,s),u.length&&(s.totalduration=s.edge-u[0].start),s.driftStartTime=o.driftStartTime,s.driftStart=o.driftStart;var a=s.advancedDateTime;if(s.advanced&&a){var _=s.edge;s.driftStart||(s.driftStartTime=a,s.driftStart=_),s.driftEndTime=a,s.driftEnd=_}else s.driftEndTime=o.driftEndTime,s.driftEnd=o.driftEnd,s.advancedDateTime=o.advancedDateTime}function m(o,s,A){if(o&&s)for(var x=0,S=0,O=o.length;S<=O;S++){var R=o[S],C=s[S+x];R&&C&&R.index===C.index&&R.fragment.sn===C.fragment.sn?A(R,C):x--}}function g(o,s,A){for(var x=s.skippedSegments,S=Math.max(o.startSN,s.startSN)-s.startSN,O=(o.fragmentHint?1:0)+(x?s.endSN:Math.min(o.endSN,s.endSN))-s.startSN,R=s.startSN-o.startSN,C=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,w=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,y=S;y<=O;y++){var u=w[R+y],v=C[y];x&&!v&&y<x&&(v=s.fragments[y]=u),u&&v&&A(u,v)}}function c(o,s){var A=s.startSN+s.skippedSegments-o.startSN,x=o.fragments;if(A<0||A>=x.length)return;d(s,x[A].start)}function d(o,s){if(s){for(var A=o.fragments,x=o.skippedSegments;x<A.length;x++)A[x].start+=s;o.fragmentHint&&(o.fragmentHint.start+=s)}}function p(o,s){var A=1e3*o.levelTargetDuration,x=A/2,S=o.age,O=S>0&&S<A*3,R=s.loading.end-s.loading.start,C,w=o.availabilityDelay;if(o.updated===!1)if(O){var y=333*o.misses;C=Math.max(Math.min(x,R*2),y),o.availabilityDelay=(o.availabilityDelay||0)+C}else C=x;else O?(w=Math.min(w||A/2,S),o.availabilityDelay=w,C=w+A-S):C=A-R;return Math.round(C)}function l(o,s,A){if(!o||!o.details)return null;var x=o.details,S=x.fragments[s-x.startSN];return S||(S=x.fragmentHint,S&&S.sn===s?S:s<x.startSN&&A&&A.sn===s?A:null)}function h(o,s,A){if(!o||!o.details)return null;var x=o.details.partList;if(x)for(var S=x.length;S--;){var O=x[S];if(O.index===A&&O.fragment.sn===s)return O}return null}},"./src/controller/stream-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return x});var Y=D("./src/polyfills/number.ts"),j=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),G=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),n=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),b=D("./src/loader/fragment.ts"),m=D("./src/demux/transmuxer-interface.ts"),g=D("./src/types/transmuxer.ts"),c=D("./src/controller/gap-controller.ts"),d=D("./src/errors.ts"),p=D("./src/utils/logger.ts");function l(S,O){for(var R=0;R<O.length;R++){var C=O[R];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(S,C.key,C)}}function h(S,O,R){return O&&l(S.prototype,O),R&&l(S,R),S}function o(S,O){S.prototype=Object.create(O.prototype),S.prototype.constructor=S,s(S,O)}function s(S,O){return s=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},s(S,O)}var A=100,x=function(S){o(O,S);function O(C,w){var y;return y=S.call(this,C,w,"[stream-controller]")||this,y.audioCodecSwap=!1,y.gapController=null,y.level=-1,y._forceStartLoad=!1,y.altAudio=!1,y.audioOnly=!1,y.fragPlaying=null,y.onvplaying=null,y.onvseeked=null,y.fragLastKbps=0,y.stalled=!1,y.couldBacktrack=!1,y.audioCodecSwitch=!1,y.videoBuffer=null,y._registerListeners(),y}var R=O.prototype;return R._registerListeners=function(){var w=this.hls;w.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),w.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.on(G.Events.ERROR,this.onError,this),w.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),w.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var w=this.hls;w.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.off(G.Events.ERROR,this.onError,this),w.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),w.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},R.startLoad=function(w){if(this.levels){var y=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=u.startLevel;v===-1&&(u.config.testBandwidth?(v=0,this.bitrateTest=!0):v=u.nextAutoLevel),this.level=u.nextLoadLevel=v,this.loadedmetadata=!1}y>0&&w===-1&&(this.log("Override startPosition with lastCurrentTime @"+y.toFixed(3)),w=y),this.state=j.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=w,this.tick()}else this._forceStartLoad=!0,this.state=j.State.STOPPED},R.stopLoad=function(){this._forceStartLoad=!1,S.prototype.stopLoad.call(this)},R.doTick=function(){switch(this.state){case j.State.IDLE:this.doTickIdle();break;case j.State.WAITING_LEVEL:{var w,y=this.levels,u=this.level,v=y==null||((w=y[u])===null||w===void 0)?void 0:w.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=j.State.IDLE;break}break}case j.State.FRAG_LOADING_WAITING_RETRY:{var a,_=self.performance.now(),N=this.retryDate;(!N||_>=N||(a=this.media)!==null&&a!==void 0&&a.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=j.State.IDLE)}break;default:break}this.onTickEnd()},R.onTickEnd=function(){S.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},R.doTickIdle=function(){var w,y,u=this.hls,v=this.levelLastLoaded,a=this.levels,_=this.media,N=u.config,B=u.nextLoadLevel;if(v===null||!_&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!a||!a[B])return;var T=a[B];this.level=u.nextLoadLevel=B;var U=T.details;if(!U||this.state===j.State.WAITING_LEVEL||U.live&&this.levelLastLoaded!==B){this.state=j.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,L.PlaylistLevelType.MAIN);if(M===null)return;var E=M.len,H=this.getMaxBufferLength(T.maxBitrate);if(E>=H)return;if(this._streamEnded(M,U)){var Z={};this.altAudio&&(Z.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,Z),this.state=j.State.ENDED;return}var oe=M.end,de=this.getNextFragment(oe,U);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Te=de.sn-U.startSN;Te>1&&(de=U.fragments[Te-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===n.FragmentState.OK&&this.nextLoadPosition>oe){var be=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,be,L.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,U)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((w=de.decryptdata)===null||w===void 0?void 0:w.keyFormat)==="identity"&&!((y=de.decryptdata)!==null&&y!==void 0&&y.key)?this.loadKey(de,U):this.loadFragment(de,U,oe)},R.loadFragment=function(w,y,u){var v,a=this.fragmentTracker.getState(w);if(this.fragCurrent=w,a===n.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(w);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else a=n.FragmentState.NOT_LOADED}a===n.FragmentState.NOT_LOADED||a===n.FragmentState.PARTIAL?w.sn==="initSegment"?this._loadInitSegment(w):this.bitrateTest?(w.bitrateTest=!0,this.log("Fragment "+w.sn+" of level "+w.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(w)):(this.startFragRequested=!0,S.prototype.loadFragment.call(this,w,y,u)):a===n.FragmentState.APPENDING?this.reduceMaxBufferLength(w.duration)&&this.fragmentTracker.removeFragment(w):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},R.getAppendedFrag=function(w){var y=this.fragmentTracker.getAppendedFrag(w,L.PlaylistLevelType.MAIN);return y&&"fragment"in y?y.fragment:y},R.getBufferedFrag=function(w){return this.fragmentTracker.getBufferedFrag(w,L.PlaylistLevelType.MAIN)},R.followingBufferedFrag=function(w){return w?this.getBufferedFrag(w.end+.5):null},R.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},R.nextLevelSwitch=function(){var w=this.levels,y=this.media;if(y!=null&&y.readyState){var u,v=this.getAppendedFrag(y.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!y.paused&&w){var a=this.hls.nextLoadLevel,_=w[a],N=this.fragLastKbps;N&&this.fragCurrent?u=this.fragCurrent.duration*_.maxBitrate/(1e3*N)+1:u=0}else u=0;var B=this.getBufferedFrag(y.currentTime+u);if(B){var T=this.followingBufferedFrag(B);if(T){this.abortCurrentFrag();var U=T.maxStartPTS?T.maxStartPTS:T.start,M=T.duration,E=Math.max(B.end,U+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(E,Number.POSITIVE_INFINITY)}}}},R.abortCurrentFrag=function(){var w=this.fragCurrent;this.fragCurrent=null,w!=null&&w.loader&&w.loader.abort(),this.state===j.State.KEY_LOADING&&(this.state=j.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},R.flushMainBuffer=function(w,y){S.prototype.flushMainBuffer.call(this,w,y,this.altAudio?"video":null)},R.onMediaAttached=function(w,y){S.prototype.onMediaAttached.call(this,w,y);var u=y.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new c.default(this.config,u,this.fragmentTracker,this.hls)},R.onMediaDetaching=function(){var w=this.media;w&&(w.removeEventListener("playing",this.onvplaying),w.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),S.prototype.onMediaDetaching.call(this)},R.onMediaPlaying=function(){this.tick()},R.onMediaSeeked=function(){var w=this.media,y=w?w.currentTime:null;Object(Y.isFiniteNumber)(y)&&this.log("Media seeked to "+y.toFixed(3)),this.tick()},R.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},R.onManifestParsed=function(w,y){var u=!1,v=!1,a;y.levels.forEach(function(_){a=_.audioCodec,a&&(a.indexOf("mp4a.40.2")!==-1&&(u=!0),a.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=u&&v&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=y.levels,this.startFragRequested=!1},R.onLevelLoading=function(w,y){var u=this.levels;if(!u||this.state!==j.State.IDLE)return;var v=u[y.level];(!v.details||v.details.live&&this.levelLastLoaded!==y.level||this.waitForCdnTuneIn(v.details))&&(this.state=j.State.WAITING_LEVEL)},R.onLevelLoaded=function(w,y){var u,v=this.levels,a=y.level,_=y.details,N=_.totalduration;if(!v){this.warn("Levels were reset while loading level "+a);return}this.log("Level "+a+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+N);var B=this.fragCurrent;B&&(this.state===j.State.FRAG_LOADING||this.state===j.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==y.level&&B.loader&&(this.state=j.State.IDLE,B.loader.abort()));var T=v[a],U=0;if(_.live||(u=T.details)!==null&&u!==void 0&&u.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;U=this.alignPlaylists(_,T.details)}if(T.details=_,this.levelLastLoaded=a,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:_,level:a}),this.state===j.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=j.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,U),this.tick()},R._handleFragmentLoadProgress=function(w){var y,u=w.frag,v=w.part,a=w.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var N=_[u.level],B=N.details;if(!B){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var T=N.videoCodec,U=B.PTSKnown||!B.live,M=(y=u.initSegment)===null||y===void 0?void 0:y.data,E=this._getAudioCodec(N),H=this.transmuxer=this.transmuxer||new m.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Z=v?v.index:-1,oe=Z!==-1,de=new g.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,a.byteLength,Z,oe),Te=this.initPTS[u.cc];H.push(a,M,E,T,u,v,B.totalduration,U,de,Te)},R.onAudioTrackSwitching=function(w,y){var u=this.altAudio,v=!!y.url,a=y.id;if(!v){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 N=this.hls;u&&N.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:a})}},R.onAudioTrackSwitched=function(w,y){var u=y.id,v=!!this.hls.audioTracks[u].url;if(v){var a=this.videoBuffer;a&&this.mediaBuffer!==a&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=a)}this.altAudio=v,this.tick()},R.onBufferCreated=function(w,y){var u=y.tracks,v,a,_=!1;for(var N in u){var B=u[N];if(B.id==="main"){if(a=N,v=B,N==="video"){var T=u[N];T&&(this.videoBuffer=T.buffer)}}else _=!0}_&&v?(this.log("Alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},R.onFragBuffered=function(w,y){var u=y.frag,v=y.part;if(u&&u.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(v?" p: "+v.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===j.State.PARSED&&(this.state=j.State.IDLE);return}var a=v?v.stats:u.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,v)},R.onError=function(w,y){switch(y.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,y);break;case d.ErrorDetails.LEVEL_LOAD_ERROR:case d.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==j.State.ERROR&&(y.fatal?(this.warn(""+y.details),this.state=j.State.ERROR):!y.levelRetry&&this.state===j.State.WAITING_LEVEL&&(this.state=j.State.IDLE));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(y.parent==="main"&&(this.state===j.State.PARSING||this.state===j.State.PARSED)){var u=!0,v=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);v&&v.len>.5&&(u=!this.reduceMaxBufferLength(v.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},R.checkBuffer=function(){var w=this.media,y=this.gapController;if(!w||!y||!w.readyState)return;var u=W.BufferHelper.getBuffered(w);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):y.poll(this.lastCurrentTime),this.lastCurrentTime=w.currentTime},R.onFragLoadEmergencyAborted=function(){this.state=j.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},R.onBufferFlushed=function(w,y){var u=y.type;if(u!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(u===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,u,L.PlaylistLevelType.MAIN)}},R.onLevelsUpdated=function(w,y){this.levels=y.levels},R.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},R.seekToStartPos=function(){var w=this.media,y=w.currentTime,u=this.startPosition;if(u>=0&&y<u){if(w.seeking){p.logger.log("could not seek to "+u+", already seeking at "+y);return}var v=W.BufferHelper.getBuffered(w),a=v.length?v.start(0):0,_=a-u;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(p.logger.log("adjusting start position by "+_+" to match buffer start"),u+=_,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+y),w.currentTime=u}},R._getAudioCodec=function(w){var y=this.config.defaultAudioCodec||w.audioCodec;return this.audioCodecSwap&&y&&(this.log("Swapping audio codec"),y.indexOf("mp4a.40.5")!==-1?y="mp4a.40.2":y="mp4a.40.5"),y},R._loadBitrateTestFrag=function(w){var y=this;this._doFragLoad(w).then(function(u){var v=y.hls;if(!u||v.nextLoadLevel||y.fragContextChanged(w))return;y.fragLoadError=0,y.state=j.State.IDLE,y.startFragRequested=!1,y.bitrateTest=!1;var a=w.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),v.trigger(G.Events.FRAG_LOADED,u)})},R._handleTransmuxComplete=function(w){var y,u="main",v=this.hls,a=w.remuxResult,_=w.chunkMeta,N=this.getCurrentContext(_);if(!N){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var B=N.frag,T=N.part,U=N.level,M=a.video,E=a.text,H=a.id3,Z=a.initSegment,oe=this.altAudio?void 0:a.audio;if(this.fragContextChanged(B))return;if(this.state=j.State.PARSING,Z){Z.tracks&&(this._bufferInitSegment(U,Z.tracks,B,_),v.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:u,tracks:Z.tracks}));var de=Z.initPTS,Te=Z.timescale;Object(Y.isFiniteNumber)(de)&&(this.initPTS[B.cc]=de,v.trigger(G.Events.INIT_PTS_FOUND,{frag:B,id:u,initPTS:de,timescale:Te}))}if(M&&a.independent!==!1){if(U.details){var be=M.startPTS,Ae=M.endPTS,Ce=M.startDTS,_e=M.endDTS;if(T)T.elementaryStreams[M.type]={startPTS:be,endPTS:Ae,startDTS:Ce,endDTS:_e};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<be){this.backtrack(B);return}B.setElementaryStreamInfo(M.type,B.start,Ae,B.start,_e,!0)}B.setElementaryStreamInfo(M.type,be,Ae,Ce,_e),this.bufferFragmentData(M,B,T,_)}}else if(a.independent===!1){this.backtrack(B);return}if(oe){var V=oe.startPTS,I=oe.endPTS,F=oe.startDTS,J=oe.endDTS;T&&(T.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:V,endPTS:I,startDTS:F,endDTS:J}),B.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,V,I,F,J),this.bufferFragmentData(oe,B,T,_)}if(H!=null&&(y=H.samples)!==null&&y!==void 0&&y.length){var ne={frag:B,id:u,samples:H.samples};v.trigger(G.Events.FRAG_PARSING_METADATA,ne)}if(E){var z={frag:B,id:u,samples:E.samples};v.trigger(G.Events.FRAG_PARSING_USERDATA,z)}},R._bufferInitSegment=function(w,y,u,v){var a=this;if(this.state!==j.State.PARSING)return;this.audioOnly=!!y.audio&&!y.video,this.altAudio&&!this.audioOnly&&delete y.audio;var _=y.audio,N=y.video,B=y.audiovideo;if(_){var T=w.audioCodec,U=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(T&&(T.indexOf("mp4a.40.5")!==-1?T="mp4a.40.2":T="mp4a.40.5"),_.metadata.channelCount!==1&&U.indexOf("firefox")===-1&&(T="mp4a.40.5")),U.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(T="mp4a.40.2",this.log("Android: force audio codec to "+T)),w.audioCodec&&w.audioCodec!==T&&this.log('Swapping manifest audio codec "'+w.audioCodec+'" for "'+T+'"'),_.levelCodec=T,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(T||"")+"/"+(w.audioCodec||"")+"/"+_.codec+"]")}N&&(N.levelCodec=w.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(w.videoCodec||"")+"/"+N.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(w.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,y),Object.keys(y).forEach(function(M){var E=y[M],H=E.initSegment;H!=null&&H.byteLength&&a.hls.trigger(G.Events.BUFFER_APPENDING,{type:M,data:H,frag:u,part:null,chunkMeta:v,parent:u.type})}),this.tick()},R.backtrack=function(w){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(w);var y=this.fragmentTracker.backtrack(w);this.fragPrevious=null,this.nextLoadPosition=w.start,y?this.resetFragmentLoading(w):this.state=j.State.BACKTRACKING},R.checkFragmentChanged=function(){var w=this.media,y=null;if(w&&w.readyState>1&&w.seeking===!1){var u=w.currentTime;if(W.BufferHelper.isBuffered(w,u)?y=this.getAppendedFrag(u):W.BufferHelper.isBuffered(w,u+.1)&&(y=this.getAppendedFrag(u+.1)),y){var v=this.fragPlaying,a=y.level;(!v||y.sn!==v.sn||v.level!==a||y.urlId!==v.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:y}),(!v||v.level!==a)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:a}),this.fragPlaying=y)}}},h(O,[{key:"nextLevel",get:function(){var w=this.nextBufferedFrag;return w?w.level:-1}},{key:"currentLevel",get:function(){var w=this.media;if(w){var y=this.getAppendedFrag(w.currentTime);if(y)return y.level}return-1}},{key:"nextBufferedFrag",get:function(){var w=this.media;if(w){var y=this.getAppendedFrag(w.currentTime);return this.followingBufferedFrag(y)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(j.default)},"./src/controller/subtitle-stream-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"SubtitleStreamController",function(){return o});var Y=D("./src/events.ts"),j=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),W=D("./src/utils/discontinuities.ts"),n=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),b=D("./src/controller/base-stream-controller.ts"),m=D("./src/types/loader.ts"),g=D("./src/types/level.ts");function c(s,A){for(var x=0;x<A.length;x++){var S=A[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(s,S.key,S)}}function d(s,A,x){return A&&c(s.prototype,A),x&&c(s,x),s}function p(s,A){s.prototype=Object.create(A.prototype),s.prototype.constructor=s,l(s,A)}function l(s,A){return l=Object.setPrototypeOf||function(S,O){return S.__proto__=O,S},l(s,A)}var h=500,o=function(s){p(A,s);function A(S,O){var R;return R=s.call(this,S,O,"[subtitle-stream-controller]")||this,R.levels=[],R.currentTrackId=-1,R.tracksBuffered=[],R.mainDetails=null,R._registerListeners(),R}var x=A.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var O=this.hls;O.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(Y.Events.ERROR,this.onError,this),O.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x._unregisterListeners=function(){var O=this.hls;O.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(Y.Events.ERROR,this.onError,this),O.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(h),this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},x.onLevelLoaded=function(O,R){this.mainDetails=R.details},x.onSubtitleFragProcessed=function(O,R){var C=R.frag,w=R.success;if(this.fragPrevious=C,this.state=b.State.IDLE,!w)return;var y=this.tracksBuffered[this.currentTrackId];if(!y)return;for(var u,v=C.start,a=0;a<y.length;a++)if(v>=y[a].start&&v<=y[a].end){u=y[a];break}var _=C.start+C.duration;u?u.end=_:(u={start:v,end:_},y.push(u)),this.fragmentTracker.fragBuffered(C)},x.onBufferFlushing=function(O,R){var C=R.startOffset,w=R.endOffset;if(C===0&&w!==Number.POSITIVE_INFINITY){var y=this.currentTrackId,u=this.levels;if(!u.length||!u[y]||!u[y].details)return;var v=u[y].details,a=v.targetduration,_=w-a;if(_<=0)return;R.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(N){for(var B=0;B<N.length;){if(N[B].end<=_){N.shift();continue}else if(N[B].start<_)N[B].start=_;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(C,_,m.PlaylistLevelType.SUBTITLE)}},x.onError=function(O,R){var C,w=R.frag;if(!w||w.type!==m.PlaylistLevelType.SUBTITLE)return;(C=this.fragCurrent)!==null&&C!==void 0&&C.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},x.onSubtitleTracksUpdated=function(O,R){var C=this,w=R.subtitleTracks;this.tracksBuffered=[],this.levels=w.map(function(y){return new g.Level(y)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(y){C.tracksBuffered[y.id]=[]}),this.mediaBuffer=null},x.onSubtitleTrackSwitch=function(O,R){if(this.currentTrackId=R.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var C=this.levels[this.currentTrackId];C!=null&&C.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,C&&this.setInterval(h)},x.onSubtitleTrackLoaded=function(O,R){var C,w=R.details,y=R.id,u=this.currentTrackId,v=this.levels;if(!v.length)return;var a=v[u];if(y>=v.length||y!==u||!a)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,w.live||(C=a.details)!==null&&C!==void 0&&C.live){var _=this.mainDetails;if(w.deltaUpdateFailed||!_)return;var N=_.fragments[0];if(!a.details)w.hasProgramDateTime&&_.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(w,_):N&&Object(n.addSliding)(w,N.start);else{var B=this.alignPlaylists(w,a.details);B===0&&N&&Object(n.addSliding)(w,N.start)}}if(a.details=w,this.levelLastLoaded=y,this.tick(),w.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var T=Object(G.findFragmentByPTS)(null,w.fragments,this.media.currentTime,0);T||(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}},x._handleFragmentLoadComplete=function(O){var R=O.frag,C=O.payload,w=R.decryptdata,y=this.hls;if(this.fragContextChanged(R))return;if(C&&C.byteLength>0&&w&&w.key&&w.iv&&w.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(C),w.key.buffer,w.iv.buffer).then(function(v){var a=performance.now();y.trigger(Y.Events.FRAG_DECRYPTED,{frag:R,payload:v,stats:{tstart:u,tdecrypt:a}})})}},x.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var O,R=this.currentTrackId,C=this.levels;if(!C.length||!C[R]||!C[R].details)return;var w=C[R].details,y=w.targetduration,u=this.config,v=this.media,a=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-y,u.maxBufferHole),_=a.end,N=a.len,B=this.getMaxBufferLength()+y;if(N>B)return;console.assert(w,"Subtitle track details are defined on idle subtitle stream controller tick");var T=w.fragments,U=T.length,M=w.edge,E,H=this.fragPrevious;if(_<M){var Z=u.maxFragLookUpTolerance;H&&w.hasProgramDateTime&&(E=Object(G.findFragmentByPDT)(T,H.endProgramDateTime,Z)),E||(E=Object(G.findFragmentByPTS)(H,T,_,Z),!E&&H&&H.start<T[0].start&&(E=T[0]))}else E=T[U-1];(O=E)!==null&&O!==void 0&&O.encrypted?(j.logger.log("Loading key for "+E.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:E})):E&&this.fragmentTracker.getState(E)===L.FragmentState.NOT_LOADED&&this.loadFragment(E,w,_)}},x.loadFragment=function(O,R,C){this.fragCurrent=O,s.prototype.loadFragment.call(this,O,R,C)},d(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(b.default)},"./src/controller/subtitle-track-controller.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/events.ts"),j=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function W(c,d){for(var p=0;p<d.length;p++){var l=d[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(c,l.key,l)}}function n(c,d,p){return d&&W(c.prototype,d),p&&W(c,p),c}function L(c,d){c.prototype=Object.create(d.prototype),c.prototype.constructor=c,b(c,d)}function b(c,d){return b=Object.setPrototypeOf||function(l,h){return l.__proto__=h,l},b(c,d)}var m=function(c){L(d,c);function d(l){var h;return h=c.call(this,l,"[subtitle-track-controller]")||this,h.media=null,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.selectDefaultTrack=!0,h.queuedDefaultTrack=-1,h.trackChangeListener=function(){return h.onTextTracksChanged()},h.asyncPollTrackChange=function(){return h.pollTrackChange(0)},h.useTextTrackPolling=!1,h.subtitlePollingInterval=-1,h.subtitleDisplay=!0,h.registerListeners(),h}var p=d.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},p.registerListeners=function(){var h=this.hls;h.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),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.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),h.on(Y.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var h=this.hls;h.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),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.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),h.off(Y.Events.ERROR,this.onError,this)},p.onMediaAttached=function(h,o){if(this.media=o.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)},p.pollTrackChange=function(h){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,h)},p.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 h=g(this.media.textTracks);h.forEach(function(o){Object(j.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(h,o){this.tracks=o.subtitleTracks},p.onSubtitleTrackLoaded=function(h,o){var s=o.id,A=o.details,x=this.trackId,S=this.tracksInGroup[x];if(!S){this.warn("Invalid subtitle track id "+s);return}var O=S.details;S.details=o.details,this.log("subtitle track "+s+" loaded ["+A.startSN+"-"+A.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,O))},p.onLevelLoading=function(h,o){this.switchLevel(o.level)},p.onLevelSwitching=function(h,o){this.switchLevel(o.level)},p.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.textGroupIds))return;var s=o.textGroupIds[o.urlId];if(this.groupId!==s){var A=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,x=this.tracks.filter(function(R){return!s||R.groupId===s});this.tracksInGroup=x;var S=this.findTrackId(A==null?void 0:A.name)||this.findTrackId();this.groupId=s;var O={subtitleTracks:x};this.log("Updating subtitle tracks, "+x.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,O),S!==-1&&this.setSubtitleTrack(S,A)}},p.findTrackId=function(h){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var A=o[s];if((!this.selectDefaultTrack||A.default)&&(!h||h===A.name))return A.id}return-1},p.onError=function(h,o){if(c.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},p.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,A=o.groupId,x=o.url;if(h)try{x=h.addDirectives(x)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:x,id:s,groupId:A,deliveryDirectives:h||null})}},p.toggleTrackModes=function(h){var o=this,s=this.media,A=this.subtitleDisplay,x=this.trackId;if(!s)return;var S=g(s.textTracks),O=S.filter(function(w){return w.groupId===o.groupId});if(h===-1)[].slice.call(S).forEach(function(w){w.mode="disabled"});else{var R=O[x];R&&(R.mode="disabled")}var C=O[h];C&&(C.mode=A?"showing":"hidden")},p.setSubtitleTrack=function(h,o){var s,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=h;return}if(this.trackId!==h&&this.toggleTrackModes(h),this.trackId===h&&(h===-1||(s=A[h])!==null&&s!==void 0&&s.details)||h<-1||h>=A.length)return;this.clearTimer();var x=A[h];if(this.log("Switching to subtitle track "+h),this.trackId=h,x){var S=x.id,O=x.groupId,R=O===void 0?"":O,C=x.name,w=x.type,y=x.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:S,groupId:R,name:C,type:w,url:y});var u=this.switchParams(x.url,o==null?void 0:o.details);this.loadPlaylist(u)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:h})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var h=-1,o=g(this.media.textTracks),s=0;s<o.length;s++)if(o[s].mode==="hidden")h=s;else if(o[s].mode==="showing"){h=s;break}this.subtitleTrack!==h&&(this.subtitleTrack=h)},n(d,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(h,o)}}]),d}(P.default);function g(c){for(var d=[],p=0;p<c.length;p++){var l=c[p];l.kind==="subtitles"&&l.label&&d.push(c[p])}return d}X.default=m},"./src/controller/timeline-controller.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"TimelineController",function(){return g});var Y=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),W=D("./src/utils/webvtt-parser.ts"),n=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),b=D("./src/types/loader.ts"),m=D("./src/utils/logger.ts"),g=function(){function l(o){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=p(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.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 s=new G.default(this,"textTrack1"),A=new G.default(this,"textTrack2"),x=new G.default(this,"textTrack3"),S=new G.default(this,"textTrack4");this.cea608Parser1=new P.default(1,s,A),this.cea608Parser2=new P.default(3,x,S)}o.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(j.Events.FRAG_LOADING,this.onFragLoading,this),o.on(j.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(j.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(j.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(j.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(j.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var h=l.prototype;return h.destroy=function(){var s=this.hls;s.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(j.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(j.Events.FRAG_LOADING,this.onFragLoading,this),s.off(j.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(j.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(j.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(j.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(j.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},h.addCues=function(s,A,x,S,O){for(var R=!1,C=O.length;C--;){var w=O[C],y=d(w[0],w[1],A,x);if(y>=0&&(w[0]=Math.min(w[0],A),w[1]=Math.max(w[1],x),R=!0,y/(x-A)>.5))return}if(R||O.push([A,x]),this.config.renderTextTracksNatively){var u=this.captionsTracks[s];this.Cues.newCue(u,A,x,S)}else{var v=this.Cues.newCue(null,A,x,S);this.hls.trigger(j.Events.CUES_PARSED,{type:"captions",cues:v,track:s})}},h.onInitPtsFound=function(s,A){var x=this,S=A.frag,O=A.id,R=A.initPTS,C=A.timescale,w=this.unparsedVttFrags;O==="main"&&(this.initPTS[S.cc]=R,this.timescale[S.cc]=C),w.length&&(this.unparsedVttFrags=[],w.forEach(function(y){x.onFragLoaded(j.Events.FRAG_LOADED,y)}))},h.getExistingTrack=function(s){var A=this.media;if(A)for(var x=0;x<A.textTracks.length;x++){var S=A.textTracks[x];if(S[s])return S}return null},h.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},h.createNativeTrack=function(s){if(this.captionsTracks[s])return;var A=this.captionsProperties,x=this.captionsTracks,S=this.media,O=A[s],R=O.label,C=O.languageCode,w=this.getExistingTrack(s);if(w)x[s]=w,Object(n.clearCurrentCues)(x[s]),Object(n.sendAddTrackEvent)(x[s],S);else{var y=this.createTextTrack("captions",R,C);y&&(y[s]=!0,x[s]=y)}},h.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var A=this.captionsProperties[s];if(!A)return;var x=A.label,S={_id:s,label:x,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[s]=S,this.hls.trigger(j.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[S]})},h.createTextTrack=function(s,A,x){var S=this.media;return S?S.addTextTrack(s,A,x):void 0},h.onMediaAttaching=function(s,A){this.media=A.media,this._cleanTracks()},h.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(A){Object(n.clearCurrentCues)(s[A]),delete s[A]}),this.nonNativeCaptionsTracks={}},h.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),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())},h._cleanTracks=function(){var s=this.media;if(!s)return;var A=s.textTracks;if(A)for(var x=0;x<A.length;x++)Object(n.clearCurrentCues)(A[x])},h.onSubtitleTracksUpdated=function(s,A){var x=this;this.textTracks=[];var S=A.subtitleTracks||[],O=S.some(function(y){return y.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var R=this.tracks&&S&&this.tracks.length===S.length;if(this.tracks=S||[],this.config.renderTextTracksNatively){var C=this.media?this.media.textTracks:[];this.tracks.forEach(function(y,u){var v;if(u<C.length){for(var a=null,_=0;_<C.length;_++)if(c(C[_],y)){a=C[_];break}a&&(v=a)}v?Object(n.clearCurrentCues)(v):(v=x.createTextTrack("subtitles",y.name,y.lang),v&&(v.mode="disabled")),v&&(v.groupId=y.groupId,x.textTracks.push(v))})}else if(!R&&this.tracks&&this.tracks.length){var w=this.tracks.map(function(y){return{label:y.name,kind:y.type.toLowerCase(),default:y.default,subtitleTrack:y}});this.hls.trigger(j.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:w})}}},h.onManifestLoaded=function(s,A){var x=this;this.config.enableCEA708Captions&&A.captions&&A.captions.forEach(function(S){var O=/(?:CC|SERVICE)([1-4])/.exec(S.instreamId);if(!O)return;var R="textTrack"+O[1],C=x.captionsProperties[R];if(!C)return;C.label=S.name,S.lang&&(C.languageCode=S.lang),C.media=S})},h.onFragLoading=function(s,A){var x=this.cea608Parser1,S=this.cea608Parser2,O=this.lastSn,R=this.lastPartIndex;if(!this.enabled||!(x&&S))return;if(A.frag.type===b.PlaylistLevelType.MAIN){var C,w,y=A.frag.sn,u=(C=A==null||((w=A.part)===null||w===void 0)?void 0:w.index)!=null?C:-1;y===O+1||y===O&&u===R+1||(x.reset(),S.reset()),this.lastSn=y,this.lastPartIndex=u}},h.onFragLoaded=function(s,A){var x=A.frag,S=A.payload,O=this.initPTS,R=this.unparsedVttFrags;if(x.type===b.PlaylistLevelType.SUBTITLE)if(S.byteLength){if(!Object(Y.isFiniteNumber)(O[x.cc])){R.push(A),O.length&&this.hls.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Missing initial subtitle PTS")});return}var C=x.decryptdata;if(C==null||C.key==null||C.method!=="AES-128"){var w=this.tracks[x.level],y=this.vttCCs;y[x.cc]||(y[x.cc]={start:x.start,prevCC:this.prevCC,new:!0},this.prevCC=x.cc),w&&w.textCodec===L.IMSC1_CODEC?this._parseIMSC1(x,S):this._parseVTTs(x,S,y)}}else this.hls.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Empty subtitle payload")})},h._parseIMSC1=function(s,A){var x=this,S=this.hls;Object(L.parseIMSC1)(A,this.initPTS[s.cc],this.timescale[s.cc],function(O){x._appendCues(O,s.level),S.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(O){m.logger.log("Failed to parse IMSC1: "+O),S.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:O})})},h._parseVTTs=function(s,A,x){var S=this,O=this.hls;Object(W.parseWebVTT)(A,this.initPTS[s.cc],this.timescale[s.cc],x,s.cc,s.start,function(R){S._appendCues(R,s.level),O.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(R){S._fallbackToIMSC1(s,A),m.logger.log("Failed to parse VTT cue: "+R),O.trigger(j.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:R})})},h._fallbackToIMSC1=function(s,A){var x=this,S=this.tracks[s.level];S.textCodec||Object(L.parseIMSC1)(A,this.initPTS[s.cc],this.timescale[s.cc],function(){S.textCodec=L.IMSC1_CODEC,x._parseIMSC1(s,A)},function(){S.textCodec="wvtt"})},h._appendCues=function(s,A){var x=this.hls;if(this.config.renderTextTracksNatively){var S=this.textTracks[A];if(S.mode==="disabled")return;s.forEach(function(C){return Object(n.addCueToTrack)(S,C)})}else{var O=this.tracks[A],R=O.default?"default":"subtitles"+A;x.trigger(j.Events.CUES_PARSED,{type:"subtitles",cues:s,track:R})}},h.onFragDecrypted=function(s,A){var x=A.frag;if(x.type===b.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[x.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(j.Events.FRAG_LOADED,A)}},h.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},h.onFragParsingUserdata=function(s,A){var x=this.cea608Parser1,S=this.cea608Parser2;if(!this.enabled||!(x&&S))return;for(var O=0;O<A.samples.length;O++){var R=A.samples[O].bytes;if(R){var C=this.extractCea608Data(R);x.addData(A.samples[O].pts,C[0]),S.addData(A.samples[O].pts,C[1])}}},h.onBufferFlushing=function(s,A){var x=A.startOffset,S=A.endOffset,O=A.endOffsetSubtitles,R=A.type,C=this.media;if(!C||C.currentTime<S)return;if(!R||R==="video"){var w=this.captionsTracks;Object.keys(w).forEach(function(u){return Object(n.removeCuesInRange)(w[u],x,S)})}if(this.config.renderTextTracksNatively&&(x===0&&O!==void 0)){var y=this.textTracks;Object.keys(y).forEach(function(u){return Object(n.removeCuesInRange)(y[u],x,O)})}},h.extractCea608Data=function(s){for(var A=s[0]&31,x=2,S=[[],[]],O=0;O<A;O++){var R=s[x++],C=127&s[x++],w=127&s[x++],y=(4&R)!==0,u=3&R;if(C===0&&w===0)continue;y&&((u===0||u===1)&&(S[u].push(C),S[u].push(w)))}return S},l}();function c(l,h){return l&&l.label===h.name&&!(l.textTrack1||l.textTrack2)}function d(l,h,o,s){return Math.min(h,s)-Math.max(l,o)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return Y});var Y=function(){function j(G,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=W}var P=j.prototype;return P.decrypt=function(W,n){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,W)},j}()},"./src/crypt/aes-decryptor.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"removePadding",function(){return j}),D.d(X,"default",function(){return P});var Y=D("./src/utils/typed-array.ts");function j(G){var W=G.byteLength,n=W&&new DataView(G.buffer).getUint8(W-1);return n?Object(Y.sliceUint8)(G,0,W-n):G}var P=function(){function G(){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 W=G.prototype;return W.uint8ArrayToUint32Array_=function(L){for(var b=new DataView(L),m=new Uint32Array(4),g=0;g<4;g++)m[g]=b.getUint32(g*4);return m},W.initTable=function(){var L=this.sBox,b=this.invSBox,m=this.subMix,g=m[0],c=m[1],d=m[2],p=m[3],l=this.invSubMix,h=l[0],o=l[1],s=l[2],A=l[3],x=new Uint32Array(256),S=0,O=0,R=0;for(R=0;R<256;R++)R<128?x[R]=R<<1:x[R]=R<<1^283;for(R=0;R<256;R++){var C=O^O<<1^O<<2^O<<3^O<<4;C=C>>>8^C&255^99,L[S]=C,b[C]=S;var w=x[S],y=x[w],u=x[y],v=x[C]*257^C*16843008;g[S]=v<<24|v>>>8,c[S]=v<<16|v>>>16,d[S]=v<<8|v>>>24,p[S]=v,v=u*16843009^y*65537^w*257^S*16843008,h[C]=v<<24|v>>>8,o[C]=v<<16|v>>>16,s[C]=v<<8|v>>>24,A[C]=v,S?(S=w^x[x[x[u^w]]],O^=x[x[O]]):S=O=1}},W.expandKey=function(L){for(var b=this.uint8ArrayToUint32Array_(L),m=!0,g=0;g<b.length&&m;)m=b[g]===this.key[g],g++;if(m)return;this.key=b;var c=this.keySize=b.length;if(c!==4&&c!==6&&c!==8)throw new Error("Invalid aes key size="+c);var d=this.ksRows=(c+6+1)*4,p,l,h=this.keySchedule=new Uint32Array(d),o=this.invKeySchedule=new Uint32Array(d),s=this.sBox,A=this.rcon,x=this.invSubMix,S=x[0],O=x[1],R=x[2],C=x[3],w,y;for(p=0;p<d;p++){if(p<c){w=h[p]=b[p];continue}y=w,p%c===0?(y=y<<8|y>>>24,y=s[y>>>24]<<24|s[y>>>16&255]<<16|s[y>>>8&255]<<8|s[y&255],y^=A[p/c|0]<<24):c>6&&p%c===4&&(y=s[y>>>24]<<24|s[y>>>16&255]<<16|s[y>>>8&255]<<8|s[y&255]),h[p]=w=(h[p-c]^y)>>>0}for(l=0;l<d;l++)p=d-l,l&3?y=h[p]:y=h[p-4],l<4||p<=4?o[l]=y:o[l]=S[s[y>>>24]]^O[s[y>>>16&255]]^R[s[y>>>8&255]]^C[s[y&255]],o[l]=o[l]>>>0},W.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},W.decrypt=function(L,b,m){for(var g=this.keySize+6,c=this.invKeySchedule,d=this.invSBox,p=this.invSubMix,l=p[0],h=p[1],o=p[2],s=p[3],A=this.uint8ArrayToUint32Array_(m),x=A[0],S=A[1],O=A[2],R=A[3],C=new Int32Array(L),w=new Int32Array(C.length),y,u,v,a,_,N,B,T,U,M,E,H,Z,oe,de=this.networkToHostOrderSwap;b<C.length;){for(U=de(C[b]),M=de(C[b+1]),E=de(C[b+2]),H=de(C[b+3]),_=U^c[0],N=H^c[1],B=E^c[2],T=M^c[3],Z=4,oe=1;oe<g;oe++)y=l[_>>>24]^h[N>>16&255]^o[B>>8&255]^s[T&255]^c[Z],u=l[N>>>24]^h[B>>16&255]^o[T>>8&255]^s[_&255]^c[Z+1],v=l[B>>>24]^h[T>>16&255]^o[_>>8&255]^s[N&255]^c[Z+2],a=l[T>>>24]^h[_>>16&255]^o[N>>8&255]^s[B&255]^c[Z+3],_=y,N=u,B=v,T=a,Z=Z+4;y=d[_>>>24]<<24^d[N>>16&255]<<16^d[B>>8&255]<<8^d[T&255]^c[Z],u=d[N>>>24]<<24^d[B>>16&255]<<16^d[T>>8&255]<<8^d[_&255]^c[Z+1],v=d[B>>>24]<<24^d[T>>16&255]<<16^d[_>>8&255]<<8^d[N&255]^c[Z+2],a=d[T>>>24]<<24^d[_>>16&255]<<16^d[N>>8&255]<<8^d[B&255]^c[Z+3],w[b]=de(y^x),w[b+1]=de(a^S),w[b+2]=de(v^O),w[b+3]=de(u^R),x=U,S=M,O=E,R=H,b=b+4}return w.buffer},G}()},"./src/crypt/decrypter.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return b});var Y=D("./src/crypt/aes-crypto.ts"),j=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),n=D("./src/utils/typed-array.ts"),L=16,b=function(){function m(c,d,p){var l=p===void 0?{}:p,h=l.removePKCS7Padding,o=h===void 0?!0:h;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=c,this.config=d,this.removePKCS7Padding=o,o)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(A){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var g=m.prototype;return g.destroy=function(){this.observer=null},g.isSync=function(){return this.config.enableSoftwareAES},g.flush=function(){var d=this.currentResult;if(!d){this.reset();return}var p=new Uint8Array(d);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(p):p},g.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},g.decrypt=function(d,p,l,h){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(d),p,l);var o=this.flush();o&&h(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(d),p,l).then(h)},g.softwareDecrypt=function(d,p,l){var h=this.currentIV,o=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(d=Object(W.appendUint8Array)(s,d),this.remainderData=null);var A=this.getValidChunk(d);if(!A.length)return null;h&&(l=h);var x=this.softwareDecrypter;x||(x=this.softwareDecrypter=new P.default),x.expandKey(p);var S=o;return this.currentResult=x.decrypt(A.buffer,0,l),this.currentIV=Object(n.sliceUint8)(A,-16).buffer,S||null},g.webCryptoDecrypt=function(d,p,l){var h=this,o=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new j.default(o,p)),this.fastAesKey.expandKey().then(function(s){if(!o)return Promise.reject(new Error("web crypto not initialized"));var A=new Y.default(o,l);return A.decrypt(d.buffer,s)}).catch(function(s){return h.onWebCryptoError(s,d,p,l)})},g.onWebCryptoError=function(d,p,l,h){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",d),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,l,h)},g.getValidChunk=function(d){var p=d,l=d.length-d.length%L;return l!==d.length&&(p=Object(n.sliceUint8)(d,0,l),this.remainderData=Object(n.sliceUint8)(d,l)),p},g.logOnce=function(d){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+d),this.logEnabled=!1},m}()},"./src/crypt/fast-aes-key.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return Y});var Y=function(){function j(G,W){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=W}var P=j.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},j}()},"./src/demux/aacdemuxer.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/demux/base-audio-demuxer.ts"),j=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function W(b,m){b.prototype=Object.create(m.prototype),b.prototype.constructor=b,n(b,m)}function n(b,m){return n=Object.setPrototypeOf||function(c,d){return c.__proto__=d,c},n(b,m)}var L=function(b){W(m,b);function m(c,d){var p;return p=b.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=c,p.config=d,p}var g=m.prototype;return g.resetInitSegment=function(d,p,l){b.prototype.resetInitSegment.call(this,d,p,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:d,duration:l,inputTimeScale:9e4,dropped:0}},m.probe=function(d){if(!d)return!1;for(var p=G.getID3Data(d,0)||[],l=p.length,h=d.length;l<h;l++)if(j.probe(d,l))return P.logger.log("ADTS sync word found !"),!0;return!1},g.canParse=function(d,p){return j.canParse(d,p)},g.appendFrame=function(d,p,l){j.initTrackConfig(d,this.observer,p,l,d.manifestCodec);var h=j.appendFrame(d,p,l,this.initPTS,this.frameIndex);if(h&&h.missing===0)return h},m}(Y.default);L.minProbeByteLength=9,X.default=L},"./src/demux/adts.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"getAudioConfig",function(){return G}),D.d(X,"isHeaderPattern",function(){return W}),D.d(X,"getHeaderLength",function(){return n}),D.d(X,"getFullFrameLength",function(){return L}),D.d(X,"canGetFrameLength",function(){return b}),D.d(X,"isHeader",function(){return m}),D.d(X,"canParse",function(){return g}),D.d(X,"probe",function(){return c}),D.d(X,"initTrackConfig",function(){return d}),D.d(X,"getFrameDuration",function(){return p}),D.d(X,"parseFrameHeader",function(){return l}),D.d(X,"appendFrame",function(){return h});var Y=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),P=D("./src/events.ts");function G(o,s,A,x){var S,O,R,C,w=navigator.userAgent.toLowerCase(),y=x,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];S=((s[A+2]&192)>>>6)+1;var v=(s[A+2]&60)>>>2;if(v>u.length-1){o.trigger(P.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return R=(s[A+2]&1)<<2,R|=(s[A+3]&192)>>>6,Y.logger.log("manifest codec:"+x+", ADTS type:"+S+", samplingIndex:"+v),/firefox/i.test(w)?v>=6?(S=5,C=new Array(4),O=v-3):(S=2,C=new Array(2),O=v):w.indexOf("android")!==-1?(S=2,C=new Array(2),O=v):(S=5,C=new Array(4),x&&(x.indexOf("mp4a.40.29")!==-1||x.indexOf("mp4a.40.5")!==-1)||!x&&v>=6?O=v-3:((x&&x.indexOf("mp4a.40.2")!==-1&&(v>=6&&R===1||/vivaldi/i.test(w))||!x&&R===1)&&(S=2,C=new Array(2)),O=v)),C[0]=S<<3,C[0]|=(v&14)>>1,C[1]|=(v&1)<<7,C[1]|=R<<3,S===5&&(C[1]|=(O&14)>>1,C[2]=(O&1)<<7,C[2]|=2<<2,C[3]=0),{config:C,samplerate:u[v],channelCount:R,codec:"mp4a.40."+S,manifestCodec:y}}function W(o,s){return o[s]===255&&(o[s+1]&246)===240}function n(o,s){return o[s+1]&1?7:9}function L(o,s){return(o[s+3]&3)<<11|o[s+4]<<3|(o[s+5]&224)>>>5}function b(o,s){return s+5<o.length}function m(o,s){return s+1<o.length&&W(o,s)}function g(o,s){return b(o,s)&&W(o,s)&&L(o,s)<=o.length-s}function c(o,s){if(m(o,s)){var A=n(o,s);if(s+A>=o.length)return!1;var x=L(o,s);if(x<=A)return!1;var S=s+x;return S===o.length||m(o,S)}return!1}function d(o,s,A,x,S){if(!o.samplerate){var O=G(s,A,x,S);if(!O)return;o.config=O.config,o.samplerate=O.samplerate,o.channelCount=O.channelCount,o.codec=O.codec,o.manifestCodec=O.manifestCodec,Y.logger.log("parsed codec:"+o.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function p(o){return 1024*9e4/o}function l(o,s,A,x,S){var O=n(o,s),R=L(o,s);if(R-=O,R>0){var C=A+x*S;return{headerLength:O,frameLength:R,stamp:C}}}function h(o,s,A,x,S){var O=p(o.samplerate),R=l(s,A,x,S,O);if(R){var C=R.frameLength,w=R.headerLength,y=R.stamp,u=w+C,v=Math.max(0,A+u-s.length),a;v?(a=new Uint8Array(u-w),a.set(s.subarray(A+w,s.length),0)):a=s.subarray(A+w,A+u);var _={unit:a,pts:y};return v||o.samples.push(_),{sample:_,length:u,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"initPTSFn",function(){return L});var Y=D("./src/polyfills/number.ts"),j=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),W=D("./src/utils/typed-array.ts"),n=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var m=b.prototype;return m.resetInitSegment=function(c,d,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},m.resetTimeStamp=function(){},m.resetContiguity=function(){},m.canParse=function(c,d){return!1},m.appendFrame=function(c,d,p){},m.demux=function(c,d){this.cachedData&&(c=Object(G.appendUint8Array)(this.cachedData,c),this.cachedData=null);var p=j.getID3Data(c,0),l=p?p.length:0,h,o,s=this._audioTrack,A=this._id3Track,x=p?j.getTimeStamp(p):void 0,S=c.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(x,d)),p&&p.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),o=this.initPTS;l<S;){if(this.canParse(c,l)){var O=this.appendFrame(s,c,l);O?(this.frameIndex++,o=O.sample.pts,l+=O.length,h=l):l=S}else j.canParse(c,l)?(p=j.getID3Data(c,l),A.samples.push({pts:o,dts:o,data:p}),l+=p.length,h=l):l++;if(l===S&&h!==S){var R=Object(W.sliceUint8)(c,h);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,R):this.cachedData=R}}return{audioTrack:s,avcTrack:Object(P.dummyTrack)(),id3Track:A,textTrack:Object(P.dummyTrack)()}},m.demuxSampleAes=function(c,d,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},m.flush=function(c){var d=this.cachedData;return d&&(this.cachedData=null,this.demux(d,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},m.destroy=function(){},b}(),L=function(m,g){return Object(Y.isFiniteNumber)(m)?m*90:g*9e4};X.default=n},"./src/demux/chunk-cache.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return Y});var Y=function(){function P(){this.chunks=[],this.dataLength=0}var G=P.prototype;return G.push=function(n){this.chunks.push(n),this.dataLength+=n.length},G.flush=function(){var n=this.chunks,L=this.dataLength,b;if(n.length)n.length===1?b=n[0]:b=j(n,L);else return new Uint8Array(0);return this.reset(),b},G.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function j(P,G){for(var W=new Uint8Array(G),n=0,L=0;L<P.length;L++){var b=P[L];W.set(b,n),n+=b.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"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(le,X,D){"use strict";D.r(X);var Y=D("./src/utils/logger.ts"),j=function(){function P(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var G=P.prototype;return G.loadWord=function(){var n=this.data,L=this.bytesAvailable,b=n.byteLength-L,m=new Uint8Array(4),g=Math.min(4,L);if(g===0)throw new Error("no bytes available");m.set(n.subarray(b,b+g)),this.word=new DataView(m.buffer).getUint32(0),this.bitsAvailable=g*8,this.bytesAvailable-=g},G.skipBits=function(n){var L;this.bitsAvailable>n?(this.word<<=n,this.bitsAvailable-=n):(n-=this.bitsAvailable,L=n>>3,n-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=n,this.bitsAvailable-=n)},G.readBits=function(n){var L=Math.min(this.bitsAvailable,n),b=this.word>>>32-L;return n>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=n-L,L>0&&this.bitsAvailable?b<<L|this.readBits(L):b},G.skipLZ=function(){var n;for(n=0;n<this.bitsAvailable;++n)if((this.word&2147483648>>>n)!==0)return this.word<<=n,this.bitsAvailable-=n,n;return this.loadWord(),n+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var n=this.skipLZ();return this.readBits(n+1)-1},G.readEG=function(){var n=this.readUEG();return 1&n?1+n>>>1:-1*(n>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(n){for(var L=8,b=8,m,g=0;g<n;g++)b!==0&&(m=this.readEG(),b=(L+m+256)%256),L=b===0?L:b},G.readSPS=function(){var n=0,L=0,b=0,m=0,g,c,d,p=this.readUByte.bind(this),l=this.readBits.bind(this),h=this.readUEG.bind(this),o=this.readBoolean.bind(this),s=this.skipBits.bind(this),A=this.skipEG.bind(this),x=this.skipUEG.bind(this),S=this.skipScalingList.bind(this);p();var O=p();if(l(5),s(3),p(),x(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var R=h();if(R===3&&s(1),x(),x(),s(1),o())for(c=R!==3?8:12,d=0;d<c;d++)o()&&(d<6?S(16):S(64))}x();var C=h();if(C===0)h();else if(C===1)for(s(1),A(),A(),g=h(),d=0;d<g;d++)A();x(),s(1);var w=h(),y=h(),u=l(1);u===0&&s(1),s(1),o()&&(n=h(),L=h(),b=h(),m=h());var v=[1,1];if(o()&&o()){var a=p();switch(a){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((w+1)*16-n*2-L*2),height:(2-u)*(y+1)*16-(u?2:4)*(b+m),pixelRatio:v}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();X.default=j},"./src/demux/id3.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"isHeader",function(){return Y}),D.d(X,"isFooter",function(){return j}),D.d(X,"getID3Data",function(){return P}),D.d(X,"canParse",function(){return W}),D.d(X,"getTimeStamp",function(){return n}),D.d(X,"isTimeStampFrame",function(){return L}),D.d(X,"getID3Frames",function(){return m}),D.d(X,"decodeFrame",function(){return g}),D.d(X,"utf8ArrayToStr",function(){return h}),D.d(X,"testables",function(){return o});var Y=function(S,O){return O+10<=S.length&&(S[O]===73&&S[O+1]===68&&S[O+2]===51&&(S[O+3]<255&&S[O+4]<255&&(S[O+6]<128&&S[O+7]<128&&S[O+8]<128&&S[O+9]<128)))},j=function(S,O){return O+10<=S.length&&(S[O]===51&&S[O+1]===68&&S[O+2]===73&&(S[O+3]<255&&S[O+4]<255&&(S[O+6]<128&&S[O+7]<128&&S[O+8]<128&&S[O+9]<128)))},P=function(S,O){for(var R=O,C=0;Y(S,O);){C+=10;var w=G(S,O+6);C+=w,j(S,O+10)&&(C+=10),O+=C}return C>0?S.subarray(R,R+C):void 0},G=function(S,O){var R=0;return R=(S[O]&127)<<21,R|=(S[O+1]&127)<<14,R|=(S[O+2]&127)<<7,R|=S[O+3]&127,R},W=function(S,O){return Y(S,O)&&G(S,O+6)+10<=S.length-O},n=function(S){for(var O=m(S),R=0;R<O.length;R++){var C=O[R];if(L(C))return l(C)}return},L=function(S){return S&&S.key==="PRIV"&&S.info==="com.apple.streaming.transportStreamTimestamp"},b=function(S){var O=String.fromCharCode(S[0],S[1],S[2],S[3]),R=G(S,4),C=10;return{type:O,size:R,data:S.subarray(C,C+R)}},m=function(S){for(var O=0,R=[];Y(S,O);){var C=G(S,O+6);O+=10;for(var w=O+C;O+8<w;){var y=b(S.subarray(O)),u=g(y);u&&R.push(u),O+=y.size+10}j(S,O)&&(O+=10)}return R},g=function(S){return S.type==="PRIV"?c(S):S.type[0]==="W"?p(S):d(S)},c=function(S){if(S.size<2)return;var O=h(S.data,!0),R=new Uint8Array(S.data.subarray(O.length+1));return{key:S.type,info:O,data:R.buffer}},d=function(S){if(S.size<2)return;if(S.type==="TXXX"){var O=1,R=h(S.data.subarray(O),!0);O+=R.length+1;var C=h(S.data.subarray(O));return{key:S.type,info:R,data:C}}var w=h(S.data.subarray(1));return{key:S.type,data:w}},p=function(S){if(S.type==="WXXX"){if(S.size<2)return;var O=1,R=h(S.data.subarray(O),!0);O+=R.length+1;var C=h(S.data.subarray(O));return{key:S.type,info:R,data:C}}var w=h(S.data);return{key:S.type,data:w}},l=function(S){if(S.data.byteLength===8){var O=new Uint8Array(S.data),R=O[3]&1,C=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return C/=45,R&&(C+=4772185884e-2),Math.round(C)}return},h=function(S,O){O===void 0&&(O=!1);var R=A();if(R){var C=R.decode(S);if(O){var w=C.indexOf("\0");return w!==-1?C.substring(0,w):C}return C.replace(/\0/g,"")}for(var y=S.length,u,v,a,_="",N=0;N<y;){if(u=S[N++],u===0&&O)return _;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(u);break;case 12:case 13:v=S[N++],_+=String.fromCharCode((u&31)<<6|v&63);break;case 14:v=S[N++],a=S[N++],_+=String.fromCharCode((u&15)<<12|(v&63)<<6|(a&63)<<0);break;default:}}return _},o={decodeTextFrame:d},s;function A(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/demux/base-audio-demuxer.ts"),j=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function W(b,m){b.prototype=Object.create(m.prototype),b.prototype.constructor=b,n(b,m)}function n(b,m){return n=Object.setPrototypeOf||function(c,d){return c.__proto__=d,c},n(b,m)}var L=function(b){W(m,b);function m(){return b.apply(this,arguments)||this}var g=m.prototype;return g.resetInitSegment=function(d,p,l){b.prototype.resetInitSegment.call(this,d,p,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:d,duration:l,inputTimeScale:9e4,dropped:0}},m.probe=function(d){if(!d)return!1;for(var p=j.getID3Data(d,0)||[],l=p.length,h=d.length;l<h;l++)if(G.probe(d,l))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},g.canParse=function(d,p){return G.canParse(d,p)},g.appendFrame=function(d,p,l){return this.initPTS===null?void 0:G.appendFrame(d,p,l,this.initPTS,this.frameIndex)},m}(Y.default);L.minProbeByteLength=4,X.default=L},"./src/demux/mp4demuxer.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/utils/mp4-tools.ts"),j=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function G(n,L){this.remainderData=null,this.config=void 0,this.config=L}var W=G.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},G.probe=function(L){return Object(Y.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},W.demux=function(L){var b=L,m=Object(j.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(Y.appendUint8Array)(this.remainderData,L));var g=Object(Y.segmentValidRange)(b);this.remainderData=g.remainder,m.samples=g.valid||new Uint8Array}else m.samples=b;return{audioTrack:Object(j.dummyTrack)(),avcTrack:m,id3Track:Object(j.dummyTrack)(),textTrack:Object(j.dummyTrack)()}},W.flush=function(){var L=Object(j.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(j.dummyTrack)(),avcTrack:L,id3Track:Object(j.dummyTrack)(),textTrack:Object(j.dummyTrack)()}},W.demuxSampleAes=function(L,b,m){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},G}();P.minProbeByteLength=1024,X.default=P},"./src/demux/mpegaudio.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"appendFrame",function(){return n}),D.d(X,"parseHeader",function(){return L}),D.d(X,"isHeaderPattern",function(){return b}),D.d(X,"isHeader",function(){return m}),D.d(X,"canParse",function(){return g}),D.d(X,"probe",function(){return c});var Y=null,j=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],W=[0,1,1,4];function n(d,p,l,h,o){if(l+24>p.length)return;var s=L(p,l);if(s&&l+s.frameLength<=p.length){var A=s.samplesPerFrame*9e4/s.sampleRate,x=h+o*A,S={unit:p.subarray(l,l+s.frameLength),pts:x,dts:x};return d.config=[],d.channelCount=s.channelCount,d.samplerate=s.sampleRate,d.samples.push(S),{sample:S,length:s.frameLength,missing:0}}}function L(d,p){var l=d[p+1]>>3&3,h=d[p+1]>>1&3,o=d[p+2]>>4&15,s=d[p+2]>>2&3;if(l!==1&&o!==0&&o!==15&&s!==3){var A=d[p+2]>>1&1,x=d[p+3]>>6,S=l===3?3-h:h===3?3:4,O=j[S*14+o-1]*1e3,R=l===3?0:l===2?1:2,C=P[R*3+s],w=x===3?1:2,y=G[l][h],u=W[h],v=y*8*u,a=Math.floor(y*O/C+A)*u;if(Y===null){var _=navigator.userAgent||"",N=_.match(/Chrome\/(\d+)/i);Y=N?parseInt(N[1]):0}var B=!!Y&&Y<=87;return B&&h===2&&O>=224e3&&x===0&&(d[p+3]=d[p+3]|128),{sampleRate:C,channelCount:w,frameLength:a,samplesPerFrame:v}}}function b(d,p){return d[p]===255&&(d[p+1]&224)===224&&(d[p+1]&6)!==0}function m(d,p){return p+1<d.length&&b(d,p)}function g(d,p){var l=4;return b(d,p)&&l<=d.length-p}function c(d,p){if(p+1<d.length&&b(d,p)){var l=4,h=L(d,p),o=l;h!=null&&h.frameLength&&(o=h.frameLength);var s=p+o;return s===d.length||m(d,s)}return!1}},"./src/demux/sample-aes.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/crypt/decrypter.ts"),j=D("./src/demux/tsdemuxer.ts"),P=function(){function G(n,L,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new Y.default(n,L,{removePKCS7Padding:!1})}var W=G.prototype;return W.decryptBuffer=function(L,b){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,b)},W.decryptAacSample=function(L,b,m,g){var c=L[b].unit,d=c.subarray(16,c.length-c.length%16),p=d.buffer.slice(d.byteOffset,d.byteOffset+d.length),l=this;this.decryptBuffer(p,function(h){var o=new Uint8Array(h);c.set(o,16),g||l.decryptAacSamples(L,b+1,m)})},W.decryptAacSamples=function(L,b,m){for(;;b++){if(b>=L.length){m();return}if(L[b].unit.length<32)continue;var g=this.decrypter.isSync();if(this.decryptAacSample(L,b,m,g),!g)return}},W.getAvcEncryptedData=function(L){for(var b=Math.floor((L.length-48)/160)*16+16,m=new Int8Array(b),g=0,c=32;c<=L.length-16;c+=160,g+=16)m.set(L.subarray(c,c+16),g);return m},W.getAvcDecryptedUnit=function(L,b){for(var m=new Uint8Array(b),g=0,c=32;c<=L.length-16;c+=160,g+=16)L.set(m.subarray(g,g+16),c);return L},W.decryptAvcSample=function(L,b,m,g,c,d){var p=Object(j.discardEPB)(c.data),l=this.getAvcEncryptedData(p),h=this;this.decryptBuffer(l.buffer,function(o){c.data=h.getAvcDecryptedUnit(p,o),d||h.decryptAvcSamples(L,b,m+1,g)})},W.decryptAvcSamples=function(L,b,m,g){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,m=0){if(b>=L.length){g();return}for(var c=L[b].units;!(m>=c.length);m++){var d=c[m];if(d.data.length<=48||d.type!==1&&d.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(L,b,m,g,d,p),!p)return}}},G}();X.default=P},"./src/demux/transmuxer-interface.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return c});var Y=D("./node_modules/webworkify-webpack/index.js"),j=D.n(Y),P=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),W=D("./src/utils/logger.ts"),n=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),b=D("./node_modules/eventemitter3/index.js"),m=D.n(b),g=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},c=function(){function d(l,h,o,s){var A=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=l,this.id=h,this.onTransmuxComplete=o,this.onFlush=s;var x=l.config,S=function(y,u){u=u||{},u.frag=A.frag,u.id=A.id,l.trigger(y,u)};this.observer=new b.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,S),this.observer.on(P.Events.ERROR,S);var O={mp4:g.isTypeSupported("video/mp4"),mpeg:g.isTypeSupported("audio/mpeg"),mp3:g.isTypeSupported('audio/mp4; codecs="mp3"')},R=navigator.vendor;if(x.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var C;try{C=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),C.addEventListener("message",this.onwmsg),C.onerror=function(w){l.trigger(P.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(w.message+" ("+w.filename+":"+w.lineno+")")})},C.postMessage({cmd:"init",typeSupported:O,vendor:R,id:h,config:JSON.stringify(x)})}catch(w){W.logger.warn("Error in worker:",w),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),C&&self.URL.revokeObjectURL(C.objectURL),this.transmuxer=new G.default(this.observer,O,x,R,h),this.worker=null}}else this.transmuxer=new G.default(this.observer,O,x,R,h)}var p=d.prototype;return p.destroy=function(){var h=this.worker;if(h)h.removeEventListener("message",this.onwmsg),h.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},p.push=function(h,o,s,A,x,S,O,R,C,w){var y=this;C.transmuxing.start=self.performance.now();var u=this.transmuxer,v=this.worker,a=S?S.start:x.start,_=x.decryptdata,N=this.frag,B=!(N&&x.cc===N.cc),T=!(N&&C.level===N.level),U=N?C.sn-N.sn:-1,M=this.part?C.part-this.part.index:1,E=!T&&(U===1||U===0&&M===1),H=self.performance.now();(T||U||x.stats.parsing.start===0)&&(x.stats.parsing.start=H),S&&(M||!E)&&(S.stats.parsing.start=H);var Z=new G.TransmuxState(B,E,R,T,a);if(!E||B){W.logger.log("[transmuxer-interface, "+x.type+"]: Starting new transmux session for sn: "+C.sn+" p: "+C.part+" level: "+C.level+" id: "+C.id+`
discontinuity: `+B+`
trackSwitch: `+T+`
contiguous: `+E+`
accurateTimeOffset: `+R+`
timeOffset: `+a);var oe=new G.TransmuxConfig(s,A,o,O,w);this.configureTransmuxer(oe)}if(this.frag=x,this.part=S,v)v.postMessage({cmd:"demux",data:h,decryptdata:_,chunkMeta:C,state:Z},h instanceof ArrayBuffer?[h]:[]);else if(u){var de=u.push(h,_,C,Z);Object(G.isPromise)(de)?de.then(function(Te){y.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(de)}},p.flush=function(h){var o=this;h.transmuxing.start=self.performance.now();var s=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:h});else if(s){var x=s.flush(h);Object(G.isPromise)(x)?x.then(function(S){o.handleFlushResult(S,h)}):this.handleFlushResult(x,h)}},p.handleFlushResult=function(h,o){var s=this;h.forEach(function(A){s.handleTransmuxComplete(A)}),this.onFlush(o)},p.onWorkerMessage=function(h){var o=h.data,s=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,s.trigger(o.event,o.data);break}}},p.configureTransmuxer=function(h){var o=this.worker,s=this.transmuxer;o?o.postMessage({cmd:"configure",config:h}):s&&s.configure(h)},p.handleTransmuxComplete=function(h){h.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(h)},d}()},"./src/demux/transmuxer-worker.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return n});var Y=D("./src/demux/transmuxer.ts"),j=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),W=D.n(G);function n(c){var d=new G.EventEmitter,p=function(h,o){c.postMessage({event:h,data:o})};d.on(j.Events.FRAG_DECRYPTED,p),d.on(j.Events.ERROR,p),c.addEventListener("message",function(l){var h=l.data;switch(h.cmd){case"init":{var o=JSON.parse(h.config);c.transmuxer=new Y.default(d,h.typeSupported,o,h.vendor,h.id),Object(P.enableLogs)(o.debug),p("init",null);break}case"configure":{c.transmuxer.configure(h.config);break}case"demux":{var s=c.transmuxer.push(h.data,h.decryptdata,h.chunkMeta,h.state);Object(Y.isPromise)(s)?s.then(function(S){L(c,S)}):L(c,s);break}case"flush":{var A=h.chunkMeta,x=c.transmuxer.flush(A);Object(Y.isPromise)(x)?x.then(function(S){m(c,S,A)}):m(c,x,A);break}default:break}})}function L(c,d){if(g(d.remuxResult))return;var p=[],l=d.remuxResult,h=l.audio,o=l.video;h&&b(p,h),o&&b(p,o),c.postMessage({event:"transmuxComplete",data:d},p)}function b(c,d){d.data1&&c.push(d.data1.buffer),d.data2&&c.push(d.data2.buffer)}function m(c,d,p){d.forEach(function(l){L(c,l)}),c.postMessage({event:"flush",data:p})}function g(c){return!c.audio&&!c.video&&!c.text&&!c.id3&&!c.initSegment}},"./src/demux/transmuxer.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return o}),D.d(X,"isPromise",function(){return x}),D.d(X,"TransmuxConfig",function(){return S}),D.d(X,"TransmuxState",function(){return O});var Y=D("./src/events.ts"),j=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),W=D("./src/demux/mp4demuxer.ts"),n=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),b=D("./src/remux/mp4-remuxer.ts"),m=D("./src/remux/passthrough-remuxer.ts"),g=D("./src/demux/chunk-cache.ts"),c=D("./src/utils/mp4-tools.ts"),d=D("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(R){d.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var l=[{demux:n.default,remux:b.default},{demux:W.default,remux:m.default},{demux:G.default,remux:b.default},{demux:L.default,remux:b.default}],h=1024;l.forEach(function(R){var C=R.demux;h=Math.max(h,C.minProbeByteLength)});var o=function(){function R(w,y,u,v,a){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 g.default,this.observer=w,this.typeSupported=y,this.config=u,this.vendor=v,this.id=a}var C=R.prototype;return C.configure=function(y){this.transmuxConfig=y,this.decrypter&&this.decrypter.reset()},C.push=function(y,u,v,a){var _=this,N=v.transmuxing;N.executeStart=p();var B=new Uint8Array(y),T=this.cache,U=this.config,M=this.currentTransmuxState,E=this.transmuxConfig;a&&(this.currentTransmuxState=a);var H=s(B,u);if(H&&H.method==="AES-128"){var Z=this.getDecrypter();if(U.enableSoftwareAES){var oe=Z.softwareDecrypt(B,H.key.buffer,H.iv.buffer);if(!oe)return N.executeEnd=p(),A(v);B=new Uint8Array(oe)}else return this.decryptionPromise=Z.webCryptoDecrypt(B,H.key.buffer,H.iv.buffer).then(function(Oe){var ke=_.push(Oe,null,v);return _.decryptionPromise=null,ke}),this.decryptionPromise}var de=a||M,Te=de.contiguous,be=de.discontinuity,Ae=de.trackSwitch,Ce=de.accurateTimeOffset,_e=de.timeOffset,ge=E.audioCodec,V=E.videoCodec,I=E.defaultInitPts,F=E.duration,J=E.initSegmentData;if((be||Ae)&&this.resetInitSegment(J,ge,V,F),be&&this.resetInitialTimestamp(I),Te||this.resetContiguity(),this.needsProbing(B,be,Ae)){if(T.dataLength){var ne=T.flush();B=Object(c.appendUint8Array)(ne,B)}this.configureTransmuxer(B,E)}var z=this.transmux(B,H,_e,Ce,v),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,N.executeEnd=p(),z},C.flush=function(y){var u=this,v=y.transmuxing;v.executeStart=p();var a=this.decrypter,_=this.cache,N=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return u.flush(y)});var T=[],U=N.timeOffset;if(a){var M=a.flush();M&&T.push(this.push(M,null,y))}var E=_.dataLength;_.reset();var H=this.demuxer,Z=this.remuxer;if(!H||!Z)return E>=h&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=p(),[A(y)];var oe=H.flush(U);return x(oe)?oe.then(function(de){return u.flushRemux(T,de,y),T}):(this.flushRemux(T,oe,y),T)},C.flushRemux=function(y,u,v){var a=u.audioTrack,_=u.avcTrack,N=u.id3Track,B=u.textTrack,T=this.currentTransmuxState,U=T.accurateTimeOffset,M=T.timeOffset;d.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var E=this.remuxer.remux(a,_,N,B,M,U,!0,this.id);y.push({remuxResult:E,chunkMeta:v}),v.transmuxing.executeEnd=p()},C.resetInitialTimestamp=function(y){var u=this.demuxer,v=this.remuxer;if(!u||!v)return;u.resetTimeStamp(y),v.resetTimeStamp(y)},C.resetContiguity=function(){var y=this.demuxer,u=this.remuxer;if(!y||!u)return;y.resetContiguity(),u.resetNextTimestamp()},C.resetInitSegment=function(y,u,v,a){var _=this.demuxer,N=this.remuxer;if(!_||!N)return;_.resetInitSegment(u,v,a),N.resetInitSegment(y,u,v)},C.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},C.transmux=function(y,u,v,a,_){var N;return u&&u.method==="SAMPLE-AES"?N=this.transmuxSampleAes(y,u,v,a,_):N=this.transmuxUnencrypted(y,v,a,_),N},C.transmuxUnencrypted=function(y,u,v,a){var _=this.demuxer.demux(y,u,!1,!this.config.progressive),N=_.audioTrack,B=_.avcTrack,T=_.id3Track,U=_.textTrack,M=this.remuxer.remux(N,B,T,U,u,v,!1,this.id);return{remuxResult:M,chunkMeta:a}},C.transmuxSampleAes=function(y,u,v,a,_){var N=this;return this.demuxer.demuxSampleAes(y,u,v).then(function(B){var T=N.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,v,a,!1,N.id);return{remuxResult:T,chunkMeta:_}})},C.configureTransmuxer=function(y,u){for(var v=this.config,a=this.observer,_=this.typeSupported,N=this.vendor,B=u.audioCodec,T=u.defaultInitPts,U=u.duration,M=u.initSegmentData,E=u.videoCodec,H,Z=0,oe=l.length;Z<oe;Z++)if(l[Z].demux.probe(y)){H=l[Z];break}H||(d.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:W.default,remux:m.default});var de=this.demuxer,Te=this.remuxer,be=H.remux,Ae=H.demux;(!Te||!(Te instanceof be))&&(this.remuxer=new be(a,v,_,N)),(!de||!(de instanceof Ae))&&(this.demuxer=new Ae(a,v,_),this.probe=Ae.probe),this.resetInitSegment(M,B,E,U),this.resetInitialTimestamp(T)},C.needsProbing=function(y,u,v){return!this.demuxer||!this.remuxer||u||v},C.getDecrypter=function(){var y=this.decrypter;return y||(y=this.decrypter=new P.default(this.observer,this.config)),y},R}();function s(R,C){var w=null;return R.byteLength>0&&C!=null&&C.key!=null&&C.iv!==null&&C.method!=null&&(w=C),w}var A=function(C){return{remuxResult:{},chunkMeta:C}};function x(R){return"then"in R&&R.then instanceof Function}var S=function(C,w,y,u,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=C,this.videoCodec=w,this.initSegmentData=y,this.duration=u,this.defaultInitPts=v},O=function(C,w,y,u,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=C,this.contiguous=w,this.accurateTimeOffset=y,this.trackSwitch=u,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"discardEPB",function(){return A});var Y=D("./src/demux/adts.ts"),j=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),W=D("./src/demux/sample-aes.ts"),n=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),b=D("./src/utils/logger.ts"),m=D("./src/errors.ts"),g={video:1,audio:2,id3:3,text:4},c=function(){function x(O,R,C){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=O,this.config=R,this.typeSupported=C}x.probe=function(R){var C=x.syncOffset(R);return C<0?!1:(C&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+C+", junk ahead ?"),!0)},x.syncOffset=function(R){for(var C=Math.min(1e3,R.length-3*188),w=0;w<C;){if(R[w]===71&&R[w+188]===71&&R[w+2*188]===71)return w;w++}return-1},x.createTrack=function(R,C){return{container:R==="video"||R==="audio"?"video/mp2t":void 0,type:R,id:g[R],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:R==="audio"?C:void 0}};var S=x.prototype;return S.resetInitSegment=function(R,C,w){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",w),this._audioTrack=x.createTrack("audio",w),this._id3Track=x.createTrack("id3",w),this._txtTrack=x.createTrack("text",w),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=R,this.videoCodec=C,this._duration=w},S.resetTimeStamp=function(){},S.resetContiguity=function(){var R=this._audioTrack,C=this._avcTrack,w=this._id3Track;R&&(R.pesData=null),C&&(C.pesData=null),w&&(w.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},S.demux=function(R,C,w,y){w===void 0&&(w=!1),y===void 0&&(y=!1),w||(this.sampleAes=null);var u,v=this._avcTrack,a=this._audioTrack,_=this._id3Track,N=v.pid,B=v.pesData,T=a.pid,U=_.pid,M=a.pesData,E=_.pesData,H=!1,Z=this.pmtParsed,oe=this._pmtId,de=R.length;if(this.remainderData&&(R=Object(L.appendUint8Array)(this.remainderData,R),de=R.length,this.remainderData=null),de<188&&!y)return this.remainderData=R,{audioTrack:a,avcTrack:v,id3Track:_,textTrack:this._txtTrack};var Te=Math.max(0,x.syncOffset(R));de-=(de+Te)%188,de<R.byteLength&&!y&&(this.remainderData=new Uint8Array(R.buffer,de,R.buffer.byteLength-de));for(var be=Te;be<de;be+=188)if(R[be]===71){var Ae=!!(R[be+1]&64),Ce=((R[be+1]&31)<<8)+R[be+2],_e=(R[be+3]&48)>>4,ge=void 0;if(_e>1){if(ge=be+5+R[be+4],ge===be+188)continue}else ge=be+4;switch(Ce){case N:Ae&&(B&&(u=h(B))&&this.parseAVCPES(u,!1),B={data:[],size:0}),B&&(B.data.push(R.subarray(ge,be+188)),B.size+=be+188-ge);break;case T:Ae&&(M&&(u=h(M))&&(a.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),M={data:[],size:0}),M&&(M.data.push(R.subarray(ge,be+188)),M.size+=be+188-ge);break;case U:Ae&&(E&&(u=h(E))&&this.parseID3PES(u),E={data:[],size:0}),E&&(E.data.push(R.subarray(ge,be+188)),E.size+=be+188-ge);break;case 0:Ae&&(ge+=R[ge]+1),oe=this._pmtId=p(R,ge);break;case oe:{Ae&&(ge+=R[ge]+1);var V=l(R,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,w);N=V.avc,N>0&&(v.pid=N),T=V.audio,T>0&&(a.pid=T,a.isAAC=V.isAAC),U=V.id3,U>0&&(_.pid=U),H&&!Z&&(b.logger.log("reparse from beginning"),H=!1,be=Te-188),Z=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=B,a.pesData=M,_.pesData=E;var I={audioTrack:a,avcTrack:v,id3Track:_,textTrack:this._txtTrack};return y&&this.extractRemainingSamples(I),I},S.flush=function(){var R=this.remainderData;this.remainderData=null;var C;return R?C=this.demux(R,-1,!1,!0):C={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(C),this.sampleAes?this.decrypt(C,this.sampleAes):C},S.extractRemainingSamples=function(R){var C=R.audioTrack,w=R.avcTrack,y=R.id3Track,u=w.pesData,v=C.pesData,a=y.pesData,_;u&&(_=h(u))?(this.parseAVCPES(_,!0),w.pesData=null):w.pesData=u,v&&(_=h(v))?(C.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),C.pesData=null):(v!=null&&v.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=v),a&&(_=h(a))?(this.parseID3PES(_),y.pesData=null):y.pesData=a},S.demuxSampleAes=function(R,C,w){var y=this.demux(R,w,!0,!this.config.progressive),u=this.sampleAes=new W.default(this.observer,this.config,C);return this.decrypt(y,u)},S.decrypt=function(R,C){return new Promise(function(w){var y=R.audioTrack,u=R.avcTrack;y.samples&&y.isAAC?C.decryptAacSamples(y.samples,0,function(){u.samples?C.decryptAvcSamples(u.samples,0,0,function(){w(R)}):w(R)}):u.samples&&C.decryptAvcSamples(u.samples,0,0,function(){w(R)})})},S.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},S.parseAVCPES=function(R,C){var w=this,y=this._avcTrack,u=this.parseAVCNALu(R.data),v=!1,a=this.avcSample,_,N=!1;R.data=null,a&&u.length&&!y.audFound&&(o(a,y),a=this.avcSample=d(!1,R.pts,R.dts,"")),u.forEach(function(B){switch(B.type){case 1:{_=!0,a||(a=w.avcSample=d(!0,R.pts,R.dts,"")),v&&(a.debug+="NDR "),a.frame=!0;var T=B.data;if(N&&T.length>4){var U=new P.default(T).readSliceType();(U===2||U===4||U===7||U===9)&&(a.key=!0)}break}case 5:_=!0,a||(a=w.avcSample=d(!0,R.pts,R.dts,"")),v&&(a.debug+="IDR "),a.key=!0,a.frame=!0;break;case 6:{_=!0,v&&a&&(a.debug+="SEI ");var M=new P.default(A(B.data));M.readUByte();for(var E=0,H=0,Z=!1,oe=0;!Z&&M.bytesAvailable>1;){E=0;do oe=M.readUByte(),E+=oe;while(oe===255);H=0;do oe=M.readUByte(),H+=oe;while(oe===255);if(E===4&&M.bytesAvailable!==0){Z=!0;var de=M.readUByte();if(de===181){var Te=M.readUShort();if(Te===49){var be=M.readUInt();if(be===1195456820){var Ae=M.readUByte();if(Ae===3){for(var Ce=M.readUByte(),_e=M.readUByte(),ge=31&Ce,V=[Ce,_e],I=0;I<ge;I++)V.push(M.readUByte()),V.push(M.readUByte()),V.push(M.readUByte());s(w._txtTrack.samples,{type:3,pts:R.pts,bytes:V})}}}}}else if(E===5&&M.bytesAvailable!==0){if(Z=!0,H>16){for(var F=[],J=0;J<16;J++)F.push(M.readUByte().toString(16)),(J===3||J===5||J===7||J===9)&&F.push("-");for(var ne=H-16,z=new Uint8Array(ne),me=0;me<ne;me++)z[me]=M.readUByte();s(w._txtTrack.samples,{pts:R.pts,payloadType:E,uuid:F.join(""),userData:Object(G.utf8ArrayToStr)(z),userDataBytes:z})}}else if(H<M.bytesAvailable)for(var Oe=0;Oe<H;Oe++)M.readUByte()}break}case 7:if(_=!0,N=!0,v&&a&&(a.debug+="SPS "),!y.sps){var ke=new P.default(B.data),ce=ke.readSPS();y.width=ce.width,y.height=ce.height,y.pixelRatio=ce.pixelRatio,y.sps=[B.data],y.duration=w._duration;for(var ye=B.data.subarray(1,4),Se="avc1.",Le=0;Le<3;Le++){var Be=ye[Le].toString(16);Be.length<2&&(Be="0"+Be),Se+=Be}y.codec=Se}break;case 8:_=!0,v&&a&&(a.debug+="PPS "),y.pps||(y.pps=[B.data]);break;case 9:_=!1,y.audFound=!0,a&&o(a,y),a=w.avcSample=d(!1,R.pts,R.dts,v?"AUD ":"");break;case 12:_=!1;break;default:_=!1,a&&(a.debug+="unknown NAL "+B.type+" ");break}if(a&&_){var We=a.units;We.push(B)}}),C&&a&&(o(a,y),this.avcSample=null)},S.getLastNalUnit=function(){var R,C=this.avcSample,w;if(!C||C.units.length===0){var y=this._avcTrack.samples;C=y[y.length-1]}if((R=C)!==null&&R!==void 0&&R.units){var u=C.units;w=u[u.length-1]}return w},S.parseAVCNALu=function(R){var C=R.byteLength,w=this._avcTrack,y=w.naluState||0,u=y,v=[],a=0,_,N,B,T=-1,U=0;for(y===-1&&(T=0,U=R[0]&31,y=0,a=1);a<C;){if(_=R[a++],!y){y=_?0:1;continue}if(y===1){y=_?0:2;continue}if(!_)y=3;else if(_===1){if(T>=0){var M={data:R.subarray(T,a-y-1),type:U};v.push(M)}else{var E=this.getLastNalUnit();if(E&&(u&&a<=4-u&&(E.state&&(E.data=E.data.subarray(0,E.data.byteLength-u))),N=a-y-1,N>0)){var H=new Uint8Array(E.data.byteLength+N);H.set(E.data,0),H.set(R.subarray(0,N),E.data.byteLength),E.data=H,E.state=0}}a<C?(B=R[a]&31,T=a,U=B,y=0):y=-1}else y=0}if(T>=0&&y>=0){var Z={data:R.subarray(T,C),type:U,state:y};v.push(Z)}if(v.length===0){var oe=this.getLastNalUnit();if(oe){var de=new Uint8Array(oe.data.byteLength+R.byteLength);de.set(oe.data,0),de.set(R,oe.data.byteLength),oe.data=de}}return w.naluState=y,v},S.parseAACPES=function(R){var C=0,w=this._audioTrack,y=this.aacOverFlow,u=R.data;if(y){this.aacOverFlow=null;var v=y.sample.unit.byteLength,a=Math.min(y.missing,v),_=v-a;y.sample.unit.set(u.subarray(0,a),_),w.samples.push(y.sample),C=y.missing}var N,B;for(N=C,B=u.length;N<B-1&&!Y.isHeader(u,N);N++);if(N!==C){var T,U;if(N<B-1?(T="AAC PES did not start with ADTS header,offset:"+N,U=!1):(T="no ADTS header found in AAC PES",U=!0),b.logger.warn("parsing error:"+T),this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:U,reason:T}),U)return}Y.initTrackConfig(w,this.observer,u,N,this.audioCodec);var M;if(R.pts!==void 0)M=R.pts;else if(y){var E=Y.getFrameDuration(w.samplerate);M=y.sample.pts+E}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;N<B;)if(Y.isHeader(u,N)){if(N+5<B){var Z=Y.appendFrame(w,u,N,M,H);if(Z)if(Z.missing)this.aacOverFlow=Z;else{N+=Z.length,H++;continue}}break}else N++},S.parseMPEGPES=function(R){var C=R.data,w=C.length,y=0,u=0,v=R.pts;if(v===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<w;)if(j.isHeader(C,u)){var a=j.appendFrame(this._audioTrack,C,u,v,y);if(a)u+=a.length,y++;else break}else u++},S.parseID3PES=function(R){if(R.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(R)},x}();c.minProbeByteLength=188;function d(x,S,O,R){return{key:x,frame:!1,pts:S,dts:O,units:[],debug:R,length:0}}function p(x,S){return(x[S+10]&31)<<8|x[S+11]}function l(x,S,O,R){var C={audio:-1,avc:-1,id3:-1,isAAC:!0},w=(x[S+1]&15)<<8|x[S+2],y=S+3+w-4,u=(x[S+10]&15)<<8|x[S+11];for(S+=12+u;S<y;){var v=(x[S+1]&31)<<8|x[S+2];switch(x[S]){case 207:if(!R){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=v);break;case 21:C.id3===-1&&(C.id3=v);break;case 219:if(!R){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=v);break;case 3:case 4:O?C.audio===-1&&(C.audio=v,C.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}S+=((x[S+3]&15)<<8|x[S+4])+5}return C}function h(x){var S=0,O,R,C,w,y,u=x.data;if(!x||x.size===0)return null;for(;u[0].length<19&&u.length>1;){var v=new Uint8Array(u[0].length+u[1].length);v.set(u[0]),v.set(u[1],u[0].length),u[0]=v,u.splice(1,1)}O=u[0];var a=(O[0]<<16)+(O[1]<<8)+O[2];if(a===1){if(R=(O[4]<<8)+O[5],R&&R>x.size-6)return null;var _=O[7];_&192&&(w=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,_&64?(y=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,w-y>60*9e4&&(b.logger.warn(Math.round((w-y)/9e4)+"s delta between PTS and DTS, align them"),w=y)):y=w),C=O[8];var N=C+9;if(x.size<=N)return null;x.size-=N;for(var B=new Uint8Array(x.size),T=0,U=u.length;T<U;T++){O=u[T];var M=O.byteLength;if(N)if(N>M){N-=M;continue}else O=O.subarray(N),M-=N,N=0;B.set(O,S),S+=M}return R&&(R-=C+3),{data:B,pts:w,dts:y,len:R}}return null}function o(x,S){if(x.units.length&&x.frame){if(x.pts===void 0){var O=S.samples,R=O.length;if(R){var C=O[R-1];x.pts=C.pts,x.dts=C.dts}else{S.dropped++;return}}S.samples.push(x)}x.debug.length&&b.logger.log(x.pts+"/"+x.dts+":"+x.debug)}function s(x,S){var O=x.length;if(O>0){if(S.pts>=x[O-1].pts)x.push(S);else for(var R=O-1;R>=0;R--)if(S.pts<x[R].pts){x.splice(R,0,S);break}}else x.push(S)}function A(x){for(var S=x.byteLength,O=[],R=1;R<S-2;)x[R]===0&&x[R+1]===0&&x[R+2]===3?(O.push(R+2),R+=2):R++;if(O.length===0)return x;var C=S-O.length,w=new Uint8Array(C),y=0;for(R=0;R<C;y++,R++)y===O[0]&&(y++,O.shift()),w[R]=x[y];return w}X.default=c},"./src/errors.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"ErrorTypes",function(){return Y}),D.d(X,"ErrorDetails",function(){return j});var Y;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Y||(Y={}));var j;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(j||(j={}))},"./src/events.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"Events",function(){return Y});var Y;(function(j){j.MEDIA_ATTACHING="hlsMediaAttaching",j.MEDIA_ATTACHED="hlsMediaAttached",j.MEDIA_DETACHING="hlsMediaDetaching",j.MEDIA_DETACHED="hlsMediaDetached",j.BUFFER_RESET="hlsBufferReset",j.BUFFER_CODECS="hlsBufferCodecs",j.BUFFER_CREATED="hlsBufferCreated",j.BUFFER_APPENDING="hlsBufferAppending",j.BUFFER_APPENDED="hlsBufferAppended",j.BUFFER_EOS="hlsBufferEos",j.BUFFER_FLUSHING="hlsBufferFlushing",j.BUFFER_FLUSHED="hlsBufferFlushed",j.MANIFEST_LOADING="hlsManifestLoading",j.MANIFEST_LOADED="hlsManifestLoaded",j.MANIFEST_PARSED="hlsManifestParsed",j.LEVEL_SWITCHING="hlsLevelSwitching",j.LEVEL_SWITCHED="hlsLevelSwitched",j.LEVEL_LOADING="hlsLevelLoading",j.LEVEL_LOADED="hlsLevelLoaded",j.LEVEL_UPDATED="hlsLevelUpdated",j.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",j.LEVELS_UPDATED="hlsLevelsUpdated",j.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",j.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",j.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",j.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",j.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",j.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",j.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",j.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",j.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",j.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",j.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",j.CUES_PARSED="hlsCuesParsed",j.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",j.INIT_PTS_FOUND="hlsInitPtsFound",j.FRAG_LOADING="hlsFragLoading",j.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",j.FRAG_LOADED="hlsFragLoaded",j.FRAG_DECRYPTED="hlsFragDecrypted",j.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",j.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",j.FRAG_PARSING_METADATA="hlsFragParsingMetadata",j.FRAG_PARSED="hlsFragParsed",j.FRAG_BUFFERED="hlsFragBuffered",j.FRAG_CHANGED="hlsFragChanged",j.FPS_DROP="hlsFpsDrop",j.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",j.ERROR="hlsError",j.DESTROYING="hlsDestroying",j.KEY_LOADING="hlsKeyLoading",j.KEY_LOADED="hlsKeyLoaded",j.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",j.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return x});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),j=D.n(Y),P=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),W=D("./src/controller/id3-track-controller.ts"),n=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),b=D("./src/controller/fragment-tracker.ts"),m=D("./src/controller/stream-controller.ts"),g=D("./src/is-supported.ts"),c=D("./src/utils/logger.ts"),d=D("./src/config.ts"),p=D("./node_modules/eventemitter3/index.js"),l=D.n(p),h=D("./src/events.ts"),o=D("./src/errors.ts");function s(S,O){for(var R=0;R<O.length;R++){var C=O[R];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(S,C.key,C)}}function A(S,O,R){return O&&s(S.prototype,O),R&&s(S,R),S}var x=function(){S.isSupported=function(){return Object(g.isSupported)()};function S(R){R===void 0&&(R={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 C=this.config=Object(d.mergeConfig)(S.DefaultConfig,R);this.userConfig=R,Object(c.enableLogs)(C.debug),this._autoLevelCapping=-1,C.progressive&&Object(d.enableStreamingMode)(C);var w=C.abrController,y=C.bufferController,u=C.capLevelController,v=C.fpsController,a=this.abrController=new w(this),_=this.bufferController=new y(this),N=this.capLevelController=new u(this),B=new v(this),T=new P.default(this),U=new G.default(this),M=new W.default(this),E=this.levelController=new L.default(this),H=new b.FragmentTracker(this),Z=this.streamController=new m.default(this,H);N.setStreamController(Z),B.setStreamController(Z);var oe=[E,Z];this.networkControllers=oe;var de=[T,U,a,_,N,B,M,H];this.audioTrackController=this.createController(C.audioTrackController,null,oe),this.createController(C.audioStreamController,H,oe),this.subtitleTrackController=this.createController(C.subtitleTrackController,null,oe),this.createController(C.subtitleStreamController,H,oe),this.createController(C.timelineController,null,de),this.emeController=this.createController(C.emeController,null,de),this.cmcdController=this.createController(C.cmcdController,null,de),this.latencyController=this.createController(n.default,null,de),this.coreComponents=de}var O=S.prototype;return O.createController=function(C,w,y){if(C){var u=w?new C(this,w):new C(this);return y&&y.push(u),u}return null},O.on=function(C,w,y){y===void 0&&(y=this),this._emitter.on(C,w,y)},O.once=function(C,w,y){y===void 0&&(y=this),this._emitter.once(C,w,y)},O.removeAllListeners=function(C){this._emitter.removeAllListeners(C)},O.off=function(C,w,y,u){y===void 0&&(y=this),this._emitter.off(C,w,y,u)},O.listeners=function(C){return this._emitter.listeners(C)},O.emit=function(C,w,y){return this._emitter.emit(C,w,y)},O.trigger=function(C,w){if(this.config.debug)return this.emit(C,C,w);try{return this.emit(C,C,w)}catch(y){c.logger.error("An internal error happened while handling event "+C+'. Error message: "'+y.message+'". Here is a stacktrace:',y),this.trigger(h.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:C,error:y})}return!1},O.listenerCount=function(C){return this._emitter.listenerCount(C)},O.destroy=function(){c.logger.log("destroy"),this.trigger(h.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(C){return C.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(C){return C.destroy()}),this.coreComponents.length=0},O.attachMedia=function(C){c.logger.log("attachMedia"),this._media=C,this.trigger(h.Events.MEDIA_ATTACHING,{media:C})},O.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(h.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(C){this.stopLoad();var w=this.media,y=this.url,u=this.url=Y.buildAbsoluteURL(self.location.href,C,{alwaysNormalize:!0});c.logger.log("loadSource:"+u),w&&y&&y!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(w)),this.trigger(h.Events.MANIFEST_LOADING,{url:C})},O.startLoad=function(C){C===void 0&&(C=-1),c.logger.log("startLoad("+C+")"),this.networkControllers.forEach(function(w){w.startLoad(C)})},O.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach(function(C){C.stopLoad()})},O.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){c.logger.log("recoverMediaError");var C=this._media;this.detachMedia(),C&&this.attachMedia(C)},O.removeLevel=function(C,w){w===void 0&&(w=0),this.levelController.removeLevel(C,w)},A(S,[{key:"levels",get:function(){var C=this.levelController.levels;return C||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(C){c.logger.log("set currentLevel:"+C),this.loadLevel=C,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(C){c.logger.log("set nextLevel:"+C),this.levelController.manualLevel=C,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(C){c.logger.log("set loadLevel:"+C),this.levelController.manualLevel=C}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(C){this.levelController.nextLoadLevel=C}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(C){c.logger.log("set firstLevel:"+C),this.levelController.firstLevel=C}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(C){c.logger.log("set startLevel:"+C),C!==-1&&(C=Math.max(C,this.minAutoLevel)),this.levelController.startLevel=C}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(C){var w=!!C;w!==this.config.capLevelToPlayerSize&&(w?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=w)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(C){this._autoLevelCapping!==C&&(c.logger.log("set autoLevelCapping:"+C),this._autoLevelCapping=C)}},{key:"bandwidthEstimate",get:function(){var C=this.abrController.bwEstimator;return C?C.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var C=this.levels,w=this.config.minAutoBitrate;if(!C)return 0;for(var y=C.length,u=0;u<y;u++)if(C[u].maxBitrate>w)return u;return 0}},{key:"maxAutoLevel",get:function(){var C=this.levels,w=this.autoLevelCapping,y;return w===-1&&C&&C.length?y=C.length-1:y=w,y}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(C){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,C)}},{key:"audioTracks",get:function(){var C=this.audioTrackController;return C?C.audioTracks:[]}},{key:"audioTrack",get:function(){var C=this.audioTrackController;return C?C.audioTrack:-1},set:function(C){var w=this.audioTrackController;w&&(w.audioTrack=C)}},{key:"subtitleTracks",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTrack:-1},set:function(C){var w=this.subtitleTrackController;w&&(w.subtitleTrack=C)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var C=this.subtitleTrackController;return C?C.subtitleDisplay:!1},set:function(C){var w=this.subtitleTrackController;w&&(w.subtitleDisplay=C)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(C){this.config.lowLatencyMode=C}},{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 h.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return S.defaultConfig?S.defaultConfig:d.hlsDefaultConfig},set:function(C){S.defaultConfig=C}}]),S}();x.defaultConfig=void 0},"./src/is-supported.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"isSupported",function(){return P}),D.d(X,"changeTypeSupported",function(){return G});var Y=D("./src/utils/mediasource-helper.ts");function j(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var W=Object(Y.getMediaSource)();if(!W)return!1;var n=j(),L=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!n||n.prototype&&typeof n.prototype.appendBuffer=="function"&&typeof n.prototype.remove=="function";return!!L&&!!b}function G(){var W,n=j();return typeof(n==null||((W=n.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return c}),D.d(X,"LoadError",function(){return p});var Y=D("./src/polyfills/number.ts"),j=D("./src/errors.ts");function P(l,h){l.prototype=Object.create(h.prototype),l.prototype.constructor=l,b(l,h)}function G(l){var h=typeof Map=="function"?new Map:void 0;return G=function(s){if(s===null||!L(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof h!="undefined"){if(h.has(s))return h.get(s);h.set(s,A)}function A(){return W(s,arguments,m(this).constructor)}return A.prototype=Object.create(s.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),b(A,s)},G(l)}function W(l,h,o){return n()?W=Reflect.construct:W=function(A,x,S){var O=[null];O.push.apply(O,x);var R=Function.bind.apply(A,O),C=new R;return S&&b(C,S.prototype),C},W.apply(null,arguments)}function n(){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(l){return!1}}function L(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function b(l,h){return b=Object.setPrototypeOf||function(s,A){return s.__proto__=A,s},b(l,h)}function m(l){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},m(l)}var g=Math.pow(2,17),c=function(){function l(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var h=l.prototype;return h.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},h.abort=function(){this.loader&&this.loader.abort()},h.load=function(s,A){var x=this,S=s.url;if(!S)return Promise.reject(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(S?"part list":"url")));this.abort();var O=this.config,R=O.fLoader,C=O.loader;return new Promise(function(w,y){x.loader&&x.loader.destroy();var u=x.loader=s.loader=R?new R(O):new C(O),v=d(s),a={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:g};s.stats=u.stats,u.load(v,a,{onSuccess:function(N,B,T,U){x.resetLoader(s,u),w({frag:s,part:null,payload:N.data,networkDetails:U})},onError:function(N,B,T){x.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:N,networkDetails:T}))},onAbort:function(N,B,T){x.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:T}))},onTimeout:function(N,B,T){x.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:T}))},onProgress:function(N,B,T,U){A&&A({frag:s,part:null,payload:T,networkDetails:U})}})})},h.loadPart=function(s,A,x){var S=this;this.abort();var O=this.config,R=O.fLoader,C=O.loader;return new Promise(function(w,y){S.loader&&S.loader.destroy();var u=S.loader=s.loader=R?new R(O):new C(O),v=d(s,A),a={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:g};A.stats=u.stats,u.load(v,a,{onSuccess:function(N,B,T,U){S.resetLoader(s,u),S.updateStatsFromPart(s,A);var M={frag:s,part:A,payload:N.data,networkDetails:U};x(M),w(M)},onError:function(N,B,T){S.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:A,response:N,networkDetails:T}))},onAbort:function(N,B,T){s.stats.aborted=A.stats.aborted,S.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:A,networkDetails:T}))},onTimeout:function(N,B,T){S.resetLoader(s,u),y(new p({type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:A,networkDetails:T}))}})})},h.updateStatsFromPart=function(s,A){var x=s.stats,S=A.stats,O=S.total;if(x.loaded+=S.loaded,O){var R=Math.round(s.duration/A.duration),C=Math.min(Math.round(x.loaded/O),R),w=R-C,y=w*Math.round(x.loaded/C);x.total=x.loaded+y}else x.total=Math.max(x.loaded,x.total);var u=x.loading,v=S.loading;u.start?u.first+=v.first-v.start:(u.start=v.start,u.first=v.first),u.end=v.end},h.resetLoader=function(s,A){s.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},l}();function d(l,h){h===void 0&&(h=null);var o=h||l,s={frag:l,part:h,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},A=o.byteRangeStartOffset,x=o.byteRangeEndOffset;return Object(Y.isFiniteNumber)(A)&&Object(Y.isFiniteNumber)(x)&&(s.rangeStart=A,s.rangeEnd=x),s}var p=function(l){P(h,l);function h(o){for(var s,A=arguments.length,x=new Array(A>1?A-1:0),S=1;S<A;S++)x[S-1]=arguments[S];return s=l.call.apply(l,[this].concat(x))||this,s.data=void 0,s.data=o,s}return h}(G(Error))},"./src/loader/fragment.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"ElementaryStreamTypes",function(){return c}),D.d(X,"BaseSegment",function(){return d}),D.d(X,"Fragment",function(){return p}),D.d(X,"Part",function(){return l});var Y=D("./src/polyfills/number.ts"),j=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(j),G=D("./src/utils/logger.ts"),W=D("./src/loader/level-key.ts"),n=D("./src/loader/load-stats.ts");function L(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,b(h,o)}function b(h,o){return b=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},b(h,o)}function m(h,o){for(var s=0;s<o.length;s++){var A=o[s];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(h,A.key,A)}}function g(h,o,s){return o&&m(h.prototype,o),s&&m(h,s),h}var c;(function(h){h.AUDIO="audio",h.VIDEO="video",h.AUDIOVIDEO="audiovideo"})(c||(c={}));var d=function(){function h(s){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[c.AUDIO]=null,A[c.VIDEO]=null,A[c.AUDIOVIDEO]=null,A),this.baseurl=s}var o=h.prototype;return o.setByteRange=function(A,x){var S=A.split("@",2),O=[];S.length===1?O[0]=x?x.byteRangeEndOffset:0:O[0]=parseInt(S[1]),O[1]=parseInt(S[0])+O[0],this._byteRange=O},g(h,[{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(j.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),h}(),p=function(h){L(o,h);function o(A,x){var S;return S=h.call(this,x)||this,S._decryptdata=null,S.rawProgramDateTime=null,S.programDateTime=null,S.tagList=[],S.duration=0,S.sn=0,S.levelkey=void 0,S.type=void 0,S.loader=null,S.level=-1,S.cc=0,S.startPTS=void 0,S.endPTS=void 0,S.appendedPTS=void 0,S.startDTS=void 0,S.endDTS=void 0,S.start=0,S.deltaPTS=void 0,S.maxStartPTS=void 0,S.minEndPTS=void 0,S.stats=new n.LoadStats,S.urlId=0,S.data=void 0,S.bitrateTest=!1,S.title=null,S.initSegment=null,S.type=A,S}var s=o.prototype;return s.createInitializationVector=function(x){for(var S=new Uint8Array(16),O=12;O<16;O++)S[O]=x>>8*(15-O)&255;return S},s.setDecryptDataFromLevelKey=function(x,S){var O=x;return(x==null?void 0:x.method)==="AES-128"&&x.uri&&!x.iv&&(O=W.LevelKey.fromURI(x.uri),O.method=x.method,O.iv=this.createInitializationVector(S),O.keyFormat="identity"),O},s.setElementaryStreamInfo=function(x,S,O,R,C,w){w===void 0&&(w=!1);var y=this.elementaryStreams,u=y[x];if(!u){y[x]={startPTS:S,endPTS:O,startDTS:R,endDTS:C,partial:w};return}u.startPTS=Math.min(u.startPTS,S),u.endPTS=Math.max(u.endPTS,O),u.startDTS=Math.min(u.startDTS,R),u.endDTS=Math.max(u.endDTS,C)},s.clearElementaryStreamInfo=function(){var x=this.elementaryStreams;x[c.AUDIO]=null,x[c.VIDEO]=null,x[c.AUDIOVIDEO]=null},g(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var x=this.sn;typeof x!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),x=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,x)}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 x=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+x*1e3}},{key:"encrypted",get:function(){var x;return!!((x=this.decryptdata)!==null&&x!==void 0&&x.keyFormat&&this.decryptdata.uri)}}]),o}(d),l=function(h){L(o,h);function o(s,A,x,S,O){var R;R=h.call(this,x)||this,R.fragOffset=0,R.duration=0,R.gap=!1,R.independent=!1,R.relurl=void 0,R.fragment=void 0,R.index=void 0,R.stats=new n.LoadStats,R.duration=s.decimalFloatingPoint("DURATION"),R.gap=s.bool("GAP"),R.independent=s.bool("INDEPENDENT"),R.relurl=s.enumeratedString("URI"),R.fragment=A,R.index=S;var C=s.enumeratedString("BYTERANGE");return C&&R.setByteRange(C,O),O&&(R.fragOffset=O.fragOffset+O.duration),R}return g(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),o}(d)},"./src/loader/key-loader.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return G});var Y=D("./src/events.ts"),j=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=function(){function W(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var n=W.prototype;return n._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},n._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},n.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var m=this.loaders[b];m&&m.destroy()}this.loaders={}},n.onKeyLoading=function(b,m){var g=m.frag,c=g.type,d=this.loaders[c];if(!g.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=g.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(d&&(P.logger.warn("abort previous key loader for type:"+c),d.abort()),!p){P.logger.warn("key uri is falsy");return}var h=l.loader,o=g.loader=this.loaders[c]=new h(l);this.decrypturl=p,this.decryptkey=null;var s={url:p,frag:g,responseType:"arraybuffer"},A={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(s,A,x)}else this.decryptkey&&(g.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:g}))},n.loadsuccess=function(b,m,g){var c=g.frag;if(!c.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=c.decryptdata.key=new Uint8Array(b.data),c.loader=null,delete this.loaders[c.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:c})},n.loaderror=function(b,m){var g=m.frag,c=g.loader;c&&c.abort(),delete this.loaders[g.type],this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:g,response:b})},n.loadtimeout=function(b,m){var g=m.frag,c=g.loader;c&&c.abort(),delete this.loaders[g.type],this.hls.trigger(Y.Events.ERROR,{type:j.ErrorTypes.NETWORK_ERROR,details:j.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:g})},W}()},"./src/loader/level-details.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"LevelDetails",function(){return W});var Y=D("./src/polyfills/number.ts");function j(n,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(n,m.key,m)}}function P(n,L,b){return L&&j(n.prototype,L),b&&j(n,b),n}var G=10,W=function(){function n(b){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=b}var L=n.prototype;return L.reloaded=function(m){if(!m){this.advanced=!0,this.updated=!0;return}var g=this.lastPartSn-m.lastPartSn,c=this.lastPartIndex-m.lastPartIndex;this.updated=this.endSN!==m.endSN||!!c||!!g,this.advanced=this.endSN>m.endSN||g>0||g===0&&c>0,this.updated||this.advanced?this.misses=Math.floor(m.misses*.6):this.misses=m.misses+1,this.availabilityDelay=m.availabilityDelay},P(n,[{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||G}},{key:"drift",get:function(){var m=this.driftEndTime-this.driftStartTime;if(m>0){var g=this.driftEnd-this.driftStart;return g*1e3/m}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var m;return(m=this.fragments)!==null&&m!==void 0&&m.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 m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),n}()},"./src/loader/level-key.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"LevelKey",function(){return W});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),j=D.n(Y);function P(n,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(n,m.key,m)}}function G(n,L,b){return L&&P(n.prototype,L),b&&P(n,b),n}var W=function(){n.fromURL=function(b,m){return new n(b,m)},n.fromURI=function(b){return new n(b)};function n(L,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(Y.buildAbsoluteURL)(L,b,{alwaysNormalize:!0}):this._uri=L}return G(n,[{key:"uri",get:function(){return this._uri}}]),n}()},"./src/loader/load-stats.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"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(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return o});var Y=D("./src/polyfills/number.ts"),j=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(j),G=D("./src/loader/fragment.ts"),W=D("./src/loader/level-details.ts"),n=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),b=D("./src/utils/logger.ts"),m=D("./src/utils/codecs.ts"),g=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,c=/#EXT-X-MEDIA:(.*)/g,d=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function h(O){var R,C;return l.test((R=(C=j.parseURL(O))===null||C===void 0?void 0:C.path)!=null?R:"")}var o=function(){function O(){}return O.findGroup=function(C,w){for(var y=0;y<C.length;y++){var u=C[y];if(u.id===w)return u}},O.convertAVC1ToAVCOTI=function(C){var w=C.split(".");if(w.length>2){var y=w.shift()+".";return y+=parseInt(w.shift()).toString(16),y+=("000"+parseInt(w.shift()).toString(16)).substr(-4),y}return C},O.resolve=function(C,w){return j.buildAbsoluteURL(w,C,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(C,w){var y=[],u={},v=!1;g.lastIndex=0;for(var a;(a=g.exec(C))!=null;)if(a[1]){var _=new L.AttrList(a[1]),N={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:O.resolve(a[2],w)},B=_.decimalResolution("RESOLUTION");B&&(N.width=B.width,N.height=B.height),s((_.CODECS||"").split(/[ ,]+/).filter(function(U){return U}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=O.convertAVC1ToAVCOTI(N.videoCodec)),y.push(N)}else if(a[3]){var T=new L.AttrList(a[3]);T["DATA-ID"]&&(v=!0,u[T["DATA-ID"]]=T)}return{levels:y,sessionData:v?u:null}},O.parseMasterPlaylistMedia=function(C,w,y,u){u===void 0&&(u=[]);var v,a=[],_=0;for(c.lastIndex=0;(v=c.exec(C))!==null;){var N=new L.AttrList(v[1]);if(N.TYPE===y){var B={attrs:N,bitrate:0,id:_++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:y,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?O.resolve(N.URI,w):""};if(u.length){var T=O.findGroup(u,B.groupId)||u[0];A(B,T,"audioCodec"),A(B,T,"textCodec")}a.push(B)}}return a},O.parseLevelPlaylist=function(C,w,y,u,v){var a=new W.LevelDetails(w),_=a.fragments,N=null,B=0,T=0,U=0,M=0,E=null,H=new G.Fragment(u,w),Z,oe,de,Te=-1,be=!1;for(d.lastIndex=0,a.m3u8=C;(Z=d.exec(C))!==null;){be&&(be=!1,H=new G.Fragment(u,w),H.start=U,H.sn=B,H.cc=M,H.level=y,N&&(H.initSegment=N,H.rawProgramDateTime=N.rawProgramDateTime));var Ae=Z[1];if(Ae){H.duration=parseFloat(Ae);var Ce=(" "+Z[2]).slice(1);H.title=Ce||null,H.tagList.push(Ce?["INF",Ae,Ce]:["INF",Ae])}else if(Z[3])Object(Y.isFiniteNumber)(H.duration)&&(H.start=U,de&&(H.levelkey=de),H.sn=B,H.level=y,H.cc=M,H.urlId=v,_.push(H),H.relurl=(" "+Z[3]).slice(1),S(H,E),E=H,U+=H.duration,B++,T=0,be=!0);else if(Z[4]){var _e=(" "+Z[4]).slice(1);E?H.setByteRange(_e,E):H.setByteRange(_e)}else if(Z[5])H.rawProgramDateTime=(" "+Z[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Te===-1&&(Te=_.length);else{if(Z=Z[0].match(p),!Z){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<Z.length&&!(typeof Z[oe]!="undefined");oe++);var ge=(" "+Z[oe]).slice(1),V=(" "+Z[oe+1]).slice(1),I=Z[oe+2]?(" "+Z[oe+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":a.type=V.toUpperCase();break;case"MEDIA-SEQUENCE":B=a.startSN=parseInt(V);break;case"SKIP":{var F=new L.AttrList(V),J=F.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(J)){a.skippedSegments=J;for(var ne=J;ne--;)_.unshift(null);B+=J}var z=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");z&&(a.recentlyRemovedDateranges=z.split(" "));break}case"TARGETDURATION":a.targetduration=parseFloat(V);break;case"VERSION":a.version=parseInt(V);break;case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(V||I)&&H.tagList.push(I?[V,I]:[V]);break;case"DIS":M++;case"GAP":H.tagList.push([ge]);break;case"BITRATE":H.tagList.push([ge,V]);break;case"DISCONTINUITY-SEQ":M=parseInt(V);break;case"KEY":{var me,Oe=new L.AttrList(V),ke=Oe.enumeratedString("METHOD"),ce=Oe.URI,ye=Oe.hexadecimalInteger("IV"),Se=Oe.enumeratedString("KEYFORMATVERSIONS"),Le=Oe.enumeratedString("KEYID"),Be=(me=Oe.enumeratedString("KEYFORMAT"))!=null?me:"identity",We=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(We.indexOf(Be)>-1){b.logger.warn("Keyformat "+Be+" is not supported from the manifest");continue}else if(Be!=="identity")continue;ke&&(de=n.LevelKey.fromURL(w,ce),ce&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ke)>=0&&(de.method=ke,de.keyFormat=Be,Le&&(de.keyID=Le),Se&&(de.keyFormatVersions=Se),de.iv=ye));break}case"START":{var Ke=new L.AttrList(V),Xe=Ke.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Xe)&&(a.startTimeOffset=Xe);break}case"MAP":{var lt=new L.AttrList(V);H.relurl=lt.URI,lt.BYTERANGE&&H.setByteRange(lt.BYTERANGE),H.level=y,H.sn="initSegment",de&&(H.levelkey=de),H.initSegment=null,N=H,be=!0;break}case"SERVER-CONTROL":{var Je=new L.AttrList(V);a.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),a.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var qe=new L.AttrList(V);a.partTarget=qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=a.partList;Pe||(Pe=a.partList=[]);var pt=T>0?Pe[Pe.length-1]:void 0,ut=T++,ue=new G.Part(new L.AttrList(V),H,w,ut,pt);Pe.push(ue),H.duration+=ue.duration;break}case"PRELOAD-HINT":{var q=new L.AttrList(V);a.preloadHint=q;break}case"RENDITION-REPORT":{var te=new L.AttrList(V);a.renditionReports=a.renditionReports||[],a.renditionReports.push(te);break}default:b.logger.warn("line parsed but not handled: "+Z);break}}}E&&!E.relurl?(_.pop(),U-=E.duration,a.partList&&(a.fragmentHint=E)):a.partList&&(S(H,E),H.cc=M,a.fragmentHint=H);var se=_.length,he=_[0],ie=_[se-1];if(U+=a.skippedSegments*a.targetduration,U>0&&se&&ie){a.averagetargetduration=U/se;var ae=ie.sn;a.endSN=ae!=="initSegment"?ae:0,he&&(a.startCC=he.cc,he.initSegment||a.fragments.every(function(fe){return fe.relurl&&h(fe.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new G.Fragment(u,w),H.relurl=ie.relurl,H.level=y,H.sn="initSegment",he.initSegment=H,a.needSidxRanges=!0))}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(U+=a.fragmentHint.duration),a.totalduration=U,a.endCC=M,Te>0&&x(_,Te),a},O}();function s(O,R){["video","audio","text"].forEach(function(C){var w=O.filter(function(u){return Object(m.isCodecType)(u,C)});if(w.length){var y=w.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});R[C+"Codec"]=y.length>0?y[0]:w[0],O=O.filter(function(u){return w.indexOf(u)===-1})}}),R.unknownCodecs=O}function A(O,R,C){var w=R[C];w&&(O[C]=w)}function x(O,R){for(var C=O[R],w=R;w--;){var y=O[w];if(!y)return;y.programDateTime=C.programDateTime-y.duration*1e3,C=y}}function S(O,R){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):R!=null&&R.programDateTime&&(O.programDateTime=R.endProgramDateTime),Object(Y.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/polyfills/number.ts"),j=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),n=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),b=D("./src/utils/attr-list.ts");function m(d){var p=d.type;switch(p){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function g(d,p){var l=d.url;return(l===void 0||l.indexOf("data:")===0)&&(l=p.url),l}var c=function(){function d(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var p=d.prototype;return p.registerListeners=function(){var h=this.hls;h.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(j.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),h.on(j.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var h=this.hls;h.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(j.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),h.off(j.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(h){var o=this.hls.config,s=o.pLoader,A=o.loader,x=s||A,S=new x(o);return h.loader=S,this.loaders[h.type]=S,S},p.getInternalLoader=function(h){return this.loaders[h.type]},p.resetInternalLoader=function(h){this.loaders[h]&&delete this.loaders[h]},p.destroyInternalLoaders=function(){for(var h in this.loaders){var o=this.loaders[h];o&&o.destroy(),this.resetInternalLoader(h)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(h,o){var s=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},p.onLevelLoading=function(h,o){var s=o.id,A=o.level,x=o.url,S=o.deliveryDirectives;this.load({id:s,groupId:null,level:A,responseType:"text",type:L.PlaylistContextType.LEVEL,url:x,deliveryDirectives:S})},p.onAudioTrackLoading=function(h,o){var s=o.id,A=o.groupId,x=o.url,S=o.deliveryDirectives;this.load({id:s,groupId:A,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:x,deliveryDirectives:S})},p.onSubtitleTrackLoading=function(h,o){var s=o.id,A=o.groupId,x=o.url,S=o.deliveryDirectives;this.load({id:s,groupId:A,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:x,deliveryDirectives:S})},p.load=function(h){var o,s=this.hls.config,A=this.getInternalLoader(h);if(A){var x=A.context;if(x&&x.url===h.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+h.type),A.abort()}var S,O,R,C;switch(h.type){case L.PlaylistContextType.MANIFEST:S=s.manifestLoadingMaxRetry,O=s.manifestLoadingTimeOut,R=s.manifestLoadingRetryDelay,C=s.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:S=0,O=s.levelLoadingTimeOut;break;default:S=s.levelLoadingMaxRetry,O=s.levelLoadingTimeOut,R=s.levelLoadingRetryDelay,C=s.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(h),(o=h.deliveryDirectives)!==null&&o!==void 0&&o.part){var w;if(h.type===L.PlaylistContextType.LEVEL&&h.level!==null?w=this.hls.levels[h.level].details:h.type===L.PlaylistContextType.AUDIO_TRACK&&h.id!==null?w=this.hls.audioTracks[h.id].details:h.type===L.PlaylistContextType.SUBTITLE_TRACK&&h.id!==null&&(w=this.hls.subtitleTracks[h.id].details),w){var y=w.partTarget,u=w.targetduration;y&&u&&(O=Math.min(Math.max(y*3,u*.8)*1e3,O))}}var v={timeout:O,maxRetry:S,retryDelay:R,maxRetryDelay:C,highWaterMark:0},a={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};A.load(h,v,a)},p.loadsuccess=function(h,o,s,A){if(A===void 0&&(A=null),s.isSidxRequest){this.handleSidxRequest(h,s),this.handlePlaylistLoaded(h,o,s,A);return}this.resetInternalLoader(s.type);var x=h.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(h,s,"no EXTM3U delimiter",A);return}o.parsing.start=performance.now(),x.indexOf("#EXTINF:")>0||x.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(h,o,s,A):this.handleMasterPlaylist(h,o,s,A)},p.loaderror=function(h,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!1,h)},p.loadtimeout=function(h,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!0)},p.handleMasterPlaylist=function(h,o,s,A){var x=this.hls,S=h.data,O=g(h,s),R=n.default.parseMasterPlaylist(S,O),C=R.levels,w=R.sessionData;if(!C.length){this.handleManifestParsingError(h,s,"no level found in manifest",A);return}var y=C.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),u=C.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),v=n.default.parseMasterPlaylistMedia(S,O,"AUDIO",y),a=n.default.parseMasterPlaylistMedia(S,O,"SUBTITLES",u),_=n.default.parseMasterPlaylistMedia(S,O,"CLOSED-CAPTIONS");if(v.length){var N=v.some(function(B){return!B.url});!N&&C[0].audioCodec&&!C[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}x.trigger(j.Events.MANIFEST_LOADED,{levels:C,audioTracks:v,subtitles:a,captions:_,url:O,stats:o,networkDetails:A,sessionData:w})},p.handleTrackOrLevelPlaylist=function(h,o,s,A){var x=this.hls,S=s.id,O=s.level,R=s.type,C=g(h,s),w=Object(Y.isFiniteNumber)(S)?S:0,y=Object(Y.isFiniteNumber)(O)?O:w,u=m(s),v=n.default.parseLevelPlaylist(h.data,C,y,u,w);if(!v.fragments.length){x.trigger(j.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:C,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(R===L.PlaylistContextType.MANIFEST){var a={attrs:new b.AttrList({}),bitrate:0,details:v,name:"",url:C};x.trigger(j.Events.MANIFEST_LOADED,{levels:[a],audioTracks:[],url:C,stats:o,networkDetails:A,sessionData:null})}if(o.parsing.end=performance.now(),v.needSidxRanges){var _,N=(_=v.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:N,isSidxRequest:!0,type:R,level:O,levelDetails:v,id:S,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=v,this.handlePlaylistLoaded(h,o,s,A)},p.handleSidxRequest=function(h,o){var s=Object(W.parseSegmentIndex)(new Uint8Array(h.data));if(!s)return;var A=s.references,x=o.levelDetails;A.forEach(function(S,O){var R=S.info,C=x.fragments[O];C.byteRange.length===0&&C.setByteRange(String(1+R.end-R.start)+"@"+String(R.start)),C.initSegment&&C.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(h,o,s,A){this.hls.trigger(j.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===L.PlaylistContextType.MANIFEST,url:h.url,reason:s,response:h,context:o,networkDetails:A})},p.handleNetworkError=function(h,o,s,A){s===void 0&&(s=!1),G.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+h.type+" level: "+h.level+" id: "+h.id+' group-id: "'+h.groupId+'"');var x=P.ErrorDetails.UNKNOWN,S=!1,O=this.getInternalLoader(h);switch(h.type){case L.PlaylistContextType.MANIFEST:x=s?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,S=!0;break;case L.PlaylistContextType.LEVEL:x=s?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,S=!1;break;case L.PlaylistContextType.AUDIO_TRACK:x=s?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,S=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:x=s?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,S=!1;break}O&&this.resetInternalLoader(h.type);var R={type:P.ErrorTypes.NETWORK_ERROR,details:x,fatal:S,url:h.url,loader:O,context:h,networkDetails:o};A&&(R.response=A),this.hls.trigger(j.Events.ERROR,R)},p.handlePlaylistLoaded=function(h,o,s,A){var x=s.type,S=s.level,O=s.id,R=s.groupId,C=s.loader,w=s.levelDetails,y=s.deliveryDirectives;if(!(w!=null&&w.targetduration)){this.handleManifestParsingError(h,s,"invalid target duration",A);return}if(!C)return;w.live&&(C.getCacheAge&&(w.ageHeader=C.getCacheAge()||0),(!C.getCacheAge||isNaN(w.ageHeader))&&(w.ageHeader=0));switch(x){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(j.Events.LEVEL_LOADED,{details:w,level:S||0,id:O||0,stats:o,networkDetails:A,deliveryDirectives:y});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(j.Events.AUDIO_TRACK_LOADED,{details:w,id:O||0,groupId:R||"",stats:o,networkDetails:A,deliveryDirectives:y});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADED,{details:w,id:O||0,groupId:R||"",stats:o,networkDetails:A,deliveryDirectives:y});break}},d}();X.default=c},"./src/polyfills/number.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"isFiniteNumber",function(){return Y}),D.d(X,"MAX_SAFE_INTEGER",function(){return j});var Y=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},j=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,X,D){"use strict";D.r(X);var Y=function(){function j(){}return j.getSilentFrame=function(G,W){switch(G){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===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(W===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(W===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(W===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(W===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},j}();X.default=Y},"./src/remux/mp4-generator.ts":function(le,X,D){"use strict";D.r(X);var Y=Math.pow(2,32)-1,j=function(){function P(){}return P.init=function(){P.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 W;for(W in P.types)P.types.hasOwnProperty(W)&&(P.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var n=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]);P.HDLR_TYPES={video:n,audio:L};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),m=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=m,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var g=new Uint8Array([105,115,111,109]),c=new Uint8Array([97,118,99,49]),d=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,g,d,g,c),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,b))},P.box=function(W){for(var n=8,L=arguments.length,b=new Array(L>1?L-1:0),m=1;m<L;m++)b[m-1]=arguments[m];for(var g=b.length,c=g;g--;)n+=b[g].byteLength;var d=new Uint8Array(n);for(d[0]=n>>24&255,d[1]=n>>16&255,d[2]=n>>8&255,d[3]=n&255,d.set(W,4),g=0,n=8;g<c;g++)d.set(b[g],n),n+=b[g].byteLength;return d},P.hdlr=function(W){return P.box(P.types.hdlr,P.HDLR_TYPES[W])},P.mdat=function(W){return P.box(P.types.mdat,W)},P.mdhd=function(W,n){n*=W;var L=Math.floor(n/(Y+1)),b=Math.floor(n%(Y+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,L>>24,L>>16&255,L>>8&255,L&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},P.mdia=function(W){return P.box(P.types.mdia,P.mdhd(W.timescale,W.duration),P.hdlr(W.type),P.minf(W))},P.mfhd=function(W){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},P.minf=function(W){return W.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(W)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(W))},P.moof=function(W,n,L){return P.box(P.types.moof,P.mfhd(W),P.traf(L,n))},P.moov=function(W){for(var n=W.length,L=[];n--;)L[n]=P.trak(W[n]);return P.box.apply(null,[P.types.moov,P.mvhd(W[0].timescale,W[0].duration)].concat(L).concat(P.mvex(W)))},P.mvex=function(W){for(var n=W.length,L=[];n--;)L[n]=P.trex(W[n]);return P.box.apply(null,[P.types.mvex].concat(L))},P.mvhd=function(W,n){n*=W;var L=Math.floor(n/(Y+1)),b=Math.floor(n%(Y+1)),m=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,L>>24,L>>16&255,L>>8&255,L&255,b>>24,b>>16&255,b>>8&255,b&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 P.box(P.types.mvhd,m)},P.sdtp=function(W){var n=W.samples||[],L=new Uint8Array(4+n.length),b,m;for(b=0;b<n.length;b++)m=n[b].flags,L[b+4]=m.dependsOn<<4|m.isDependedOn<<2|m.hasRedundancy;return P.box(P.types.sdtp,L)},P.stbl=function(W){return P.box(P.types.stbl,P.stsd(W),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(W){var n=[],L=[],b,m,g;for(b=0;b<W.sps.length;b++)m=W.sps[b],g=m.byteLength,n.push(g>>>8&255),n.push(g&255),n=n.concat(Array.prototype.slice.call(m));for(b=0;b<W.pps.length;b++)m=W.pps[b],g=m.byteLength,L.push(g>>>8&255),L.push(g&255),L=L.concat(Array.prototype.slice.call(m));var c=P.box(P.types.avcC,new Uint8Array([1,n[3],n[4],n[5],252|3,224|W.sps.length].concat(n).concat([W.pps.length]).concat(L))),d=W.width,p=W.height,l=W.pixelRatio[0],h=W.pixelRatio[1];return P.box(P.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,d>>8&255,d&255,p>>8&255,p&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]),c,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,h>>24,h>>16&255,h>>8&255,h&255])))},P.esds=function(W){var n=W.config.length;return new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(W.config).concat([6,1,2]))},P.mp4a=function(W){var n=W.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,n>>8&255,n&255,0,0]),P.box(P.types.esds,P.esds(W)))},P.mp3=function(W){var n=W.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,n>>8&255,n&255,0,0]))},P.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(W)):P.box(P.types.stsd,P.STSD,P.mp4a(W)):P.box(P.types.stsd,P.STSD,P.avc1(W))},P.tkhd=function(W){var n=W.id,L=W.duration*W.timescale,b=W.width,m=W.height,g=Math.floor(L/(Y+1)),c=Math.floor(L%(Y+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255,c>>24,c>>16&255,c>>8&255,c&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,b>>8&255,b&255,0,0,m>>8&255,m&255,0,0]))},P.traf=function(W,n){var L=P.sdtp(W),b=W.id,m=Math.floor(n/(Y+1)),g=Math.floor(n%(Y+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,g>>24,g>>16&255,g>>8&255,g&255])),P.trun(W,L.length+16+20+8+16+8+8),L)},P.trak=function(W){return W.duration=W.duration||4294967295,P.box(P.types.trak,P.tkhd(W),P.mdia(W))},P.trex=function(W){var n=W.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(W,n){var L=W.samples||[],b=L.length,m=12+16*b,g=new Uint8Array(m),c,d,p,l,h,o;for(n+=8+m,g.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),c=0;c<b;c++)d=L[c],p=d.duration,l=d.size,h=d.flags,o=d.cts,g.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&240<<8,h.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*c);return P.box(P.types.trun,g)},P.initSegment=function(W){P.types||P.init();var n=P.moov(W),L=new Uint8Array(P.FTYP.byteLength+n.byteLength);return L.set(P.FTYP),L.set(n,P.FTYP.byteLength),L},P}();j.types=void 0,j.HDLR_TYPES=void 0,j.STTS=void 0,j.STSC=void 0,j.STCO=void 0,j.STSZ=void 0,j.VMHD=void 0,j.SMHD=void 0,j.STSD=void 0,j.FTYP=void 0,j.DINF=void 0,X.default=j},"./src/remux/mp4-remuxer.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return o}),D.d(X,"normalizePts",function(){return s});var Y=D("./src/polyfills/number.ts"),j=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),W=D("./src/errors.ts"),n=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),b=D("./src/utils/timescale-conversion.ts");function m(){return m=Object.assign||function(O){for(var R=1;R<arguments.length;R++){var C=arguments[R];for(var w in C)Object.prototype.hasOwnProperty.call(C,w)&&(O[w]=C[w])}return O},m.apply(this,arguments)}var g=10*1e3,c=1024,d=1152,p=null,l=null,h=!1,o=function(){function O(C,w,y,u){if(u===void 0&&(u=""),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=C,this.config=w,this.typeSupported=y,this.ISGenerated=!1,p===null){var v=navigator.userAgent||"",a=v.match(/Chrome\/(\d+)/i);p=a?parseInt(a[1]):0}if(l===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);l=_?parseInt(_[1]):0}h=!!p&&p<75||!!l&&l<600}var R=O.prototype;return R.destroy=function(){},R.resetTimeStamp=function(w){n.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=w},R.resetNextTimestamp=function(){n.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},R.resetInitSegment=function(){n.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},R.getVideoStartPts=function(w){var y=!1,u=w.reduce(function(v,a){var _=a.pts-v;return _<-4294967296?(y=!0,s(v,a.pts)):_>0?v:a.pts},w[0].pts);return y&&n.logger.debug("PTS rollover detected"),u},R.remux=function(w,y,u,v,a,_,N,B){var T,U,M,E,H,Z,oe=a,de=a,Te=w.pid>-1,be=y.pid>-1,Ae=y.samples.length,Ce=w.samples.length>0,_e=Ae>1,ge=(!Te||Ce)&&(!be||_e)||this.ISGenerated||N;if(ge){this.ISGenerated||(M=this.generateIS(w,y,a));var V=this.isVideoContiguous,I=-1;if(_e&&(I=A(y.samples),!V&&this.config.forceKeyFrameOnDiscontinuity))if(Z=!0,I>0){n.logger.warn("[mp4-remuxer]: Dropped "+I+" out of "+Ae+" video samples due to a missing keyframe");var F=this.getVideoStartPts(y.samples);y.samples=y.samples.slice(I),y.dropped+=I,de+=(y.samples[0].pts-F)/(y.timescale||9e4)}else I===-1&&(n.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ae+" video samples"),Z=!1);if(this.ISGenerated){if(Ce&&_e){var J=this.getVideoStartPts(y.samples),ne=s(w.samples[0].pts,J)-J,z=ne/y.inputTimeScale;oe+=Math.max(0,z),de+=Math.max(0,-z)}if(Ce){if(w.samplerate||(n.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(w,y,a)),U=this.remuxAudio(w,oe,this.isAudioContiguous,_,be||_e||B===L.PlaylistLevelType.AUDIO?de:void 0),_e){var me=U?U.endPTS-U.startPTS:0;y.inputTimeScale||(n.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(w,y,a)),T=this.remuxVideo(y,de,V,me)}}else _e&&(T=this.remuxVideo(y,de,V,0));T&&(T.firstKeyFrame=I,T.independent=I!==-1)}}return this.ISGenerated&&(u.samples.length&&(H=this.remuxID3(u,a)),v.samples.length&&(E=this.remuxText(v,a))),{audio:U,video:T,initSegment:M,independent:Z,text:E,id3:H}},R.generateIS=function(w,y,u){var v=w.samples,a=y.samples,_=this.typeSupported,N={},B=!Object(Y.isFiniteNumber)(this._initPTS),T="audio/mp4",U,M,E;if(B&&(U=M=Infinity),w.config&&v.length&&(w.timescale=w.samplerate,w.isAAC||(_.mpeg?(T="audio/mpeg",w.codec=""):_.mp3&&(w.codec="mp3")),N.audio={id:"audio",container:T,codec:w.codec,initSegment:!w.isAAC&&_.mpeg?new Uint8Array(0):P.default.initSegment([w]),metadata:{channelCount:w.channelCount}},B&&(E=w.inputTimeScale,U=M=v[0].pts-Math.round(E*u))),y.sps&&y.pps&&a.length&&(y.timescale=y.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:y.codec,initSegment:P.default.initSegment([y]),metadata:{width:y.width,height:y.height}},B)){E=y.inputTimeScale;var H=this.getVideoStartPts(a),Z=Math.round(E*u);M=Math.min(M,s(a[0].dts,H)-Z),U=Math.min(U,H-Z)}if(Object.keys(N).length)return this.ISGenerated=!0,B&&(this._initPTS=U,this._initDTS=M),{tracks:N,initPTS:U,timescale:E}},R.remuxVideo=function(w,y,u,v){var a=w.inputTimeScale,_=w.samples,N=[],B=_.length,T=this._initPTS,U=this.nextAvcDts,M=8,E,H,Z,oe=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Te=0,be=!1;if(!u||U===null){var Ae=y*a,Ce=_[0].pts-s(_[0].dts,_[0].pts);U=Ae-Ce}for(var _e=0;_e<B;_e++){var ge=_[_e];if(ge.pts=s(ge.pts-T,U),ge.dts=s(ge.dts-T,U),ge.dts>ge.pts){var V=9e4*.2;Te=Math.max(Math.min(Te,ge.pts-ge.dts),-1*V)}ge.dts<_[_e>0?_e-1:_e].dts&&(be=!0)}be&&_.sort(function(Kt,Ve){var Ue=Kt.dts-Ve.dts,Et=Kt.pts-Ve.pts;return Ue||Et}),H=_[0].dts,Z=_[_.length-1].dts;var I=Math.round((Z-H)/(B-1));if(Te<0){if(Te<I*-2){n.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-I,!0)+" ms");for(var F=Te,J=0;J<B;J++)_[J].dts=F=Math.max(F,_[J].pts-I),_[J].pts=Math.max(F,_[J].pts)}else{n.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var ne=0;ne<B;ne++)_[ne].dts=_[ne].dts+Te}H=_[0].dts}if(u){var z=H-U,me=z>I,Oe=z<-1;if(me||Oe){me?n.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(z,!0)+" ms ("+z+"dts) hole between fragments detected, filling it"):n.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-z,!0)+" ms ("+z+"dts) overlapping between fragments detected"),H=U;var ke=_[0].pts-z;_[0].dts=H,_[0].pts=ke,n.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(ke,!0)+"/"+Object(b.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(z,!0)+" ms")}}h&&(H=Math.max(0,H));for(var ce=0,ye=0,Se=0;Se<B;Se++){for(var Le=_[Se],Be=Le.units,We=Be.length,Ke=0,Xe=0;Xe<We;Xe++)Ke+=Be[Xe].data.length;ye+=Ke,ce+=We,Le.length=Ke,Le.dts=Math.max(Le.dts,H),Le.pts=Math.max(Le.pts,Le.dts,0),oe=Math.min(Le.pts,oe),de=Math.max(Le.pts,de)}Z=_[B-1].dts;var lt=ye+4*ce+8,Je;try{Je=new Uint8Array(lt)}catch(Kt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:lt,reason:"fail allocating video mdat "+lt});return}var qe=new DataView(Je.buffer);qe.setUint32(0,lt),Je.set(P.default.types.mdat,4);for(var Pe=0;Pe<B;Pe++){for(var pt=_[Pe],ut=pt.units,ue=0,q=0,te=ut.length;q<te;q++){var se=ut[q],he=se.data,ie=se.data.byteLength;qe.setUint32(M,ie),M+=4,Je.set(he,M),M+=ie,ue+=4+ie}if(Pe<B-1)E=_[Pe+1].dts-pt.dts;else{var ae=this.config,fe=pt.dts-_[Pe>0?Pe-1:Pe].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var pe=Math.floor(ae.maxBufferHole*a),xe=(v?oe+v*a:this.nextAudioPts)-pt.pts;xe>pe?(E=xe-fe,E<0&&(E=fe),n.logger.log("[mp4-remuxer]: It is approximately "+xe/90+" ms to the next segment; using duration "+E/90+" ms for the last video frame.")):E=fe}else E=fe}var Re=Math.round(pt.pts-pt.dts);N.push(new x(pt.key,E,ue,Re))}if(N.length&&p&&p<70){var Ne=N[0].flags;Ne.dependsOn=2,Ne.isNonSync=0}console.assert(E!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=U=Z+E,this.isVideoContiguous=!0;var Ye=P.default.moof(w.sequenceNumber++,H,m({},w,{samples:N})),dt="video",gt={data1:Ye,data2:Je,startPTS:oe/a,endPTS:(de+E)/a,startDTS:H/a,endDTS:U/a,type:dt,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:w.dropped};return w.samples=[],w.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),gt},R.remuxAudio=function(w,y,u,v,a){var _=w.inputTimeScale,N=w.samplerate?w.samplerate:_,B=_/N,T=w.isAAC?c:d,U=T*B,M=this._initPTS,E=!w.isAAC&&this.typeSupported.mpeg,H=[],Z=w.samples,oe=E?0:8,de=this.nextAudioPts||-1,Te=y*_;if(this.isAudioContiguous=u=u||Z.length&&de>0&&(v&&Math.abs(Te-de)<9e3||Math.abs(s(Z[0].pts-M,Te)-de)<20*U),Z.forEach(function(he){he.pts=s(he.pts-M,Te)}),!u||de<0){if(Z=Z.filter(function(he){return he.pts>=0}),!Z.length)return;a===0?de=0:v?de=Math.max(0,Te):de=Z[0].pts}if(w.isAAC)for(var be=a!==void 0,Ae=this.config.maxAudioFramesDrift,Ce=0,_e=de;Ce<Z.length;Ce++){var ge=Z[Ce],V=ge.pts,I=V-_e,F=Math.abs(1e3*I/_);if(I<=-Ae*U&&be)Ce===0&&(n.logger.warn("Audio frame @ "+(V/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*I/_)+" ms."),this.nextAudioPts=de=_e=V);else if(I>=Ae*U&&F<g&&be){var J=Math.round(I/U);_e=V-J*U,_e<0&&(J--,_e+=U),Ce===0&&(this.nextAudioPts=de=_e),n.logger.warn("[mp4-remuxer]: Injecting "+J+" audio frame @ "+(_e/_).toFixed(3)+"s due to "+Math.round(1e3*I/_)+" ms gap.");for(var ne=0;ne<J;ne++){var z=Math.max(_e,0),me=j.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);me||(n.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=ge.unit.subarray()),Z.splice(Ce,0,{unit:me,pts:z}),_e+=U,Ce++}}ge.pts=_e,_e+=U}for(var Oe=null,ke=null,ce,ye=0,Se=Z.length;Se--;)ye+=Z[Se].unit.byteLength;for(var Le=0,Be=Z.length;Le<Be;Le++){var We=Z[Le],Ke=We.unit,Xe=We.pts;if(ke!==null){var lt=H[Le-1];lt.duration=Math.round((Xe-ke)/B)}else if(u&&w.isAAC&&(Xe=de),Oe=Xe,ye>0){ye+=oe;try{ce=new Uint8Array(ye)}catch(he){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ye,reason:"fail allocating audio mdat "+ye});return}if(!E){var Je=new DataView(ce.buffer);Je.setUint32(0,ye),ce.set(P.default.types.mdat,4)}}else return;ce.set(Ke,oe);var qe=Ke.byteLength;oe+=qe,H.push(new x(!0,T,qe,0)),ke=Xe}var Pe=H.length;if(!Pe)return;var pt=H[H.length-1];this.nextAudioPts=de=ke+B*pt.duration;var ut=E?new Uint8Array(0):P.default.moof(w.sequenceNumber++,Oe/B,m({},w,{samples:H}));w.samples=[];var ue=Oe/_,q=de/_,te="audio",se={data1:ut,data2:ce,startPTS:ue,endPTS:q,startDTS:ue,endDTS:q,type:te,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(ce.length,"MDAT length must not be zero"),se},R.remuxEmptyAudio=function(w,y,u,v){var a=w.inputTimeScale,_=w.samplerate?w.samplerate:a,N=a/_,B=this.nextAudioPts,T=(B!==null?B:v.startDTS*a)+this._initDTS,U=v.endDTS*a+this._initDTS,M=N*c,E=Math.ceil((U-T)/M),H=j.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);if(n.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){n.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Z=[],oe=0;oe<E;oe++){var de=T+oe*M;Z.push({unit:H,pts:de,dts:de})}return w.samples=Z,this.remuxAudio(w,y,u,!1)},R.remuxID3=function(w,y){var u=w.samples.length;if(!u)return;for(var v=w.inputTimeScale,a=this._initPTS,_=this._initDTS,N=0;N<u;N++){var B=w.samples[N];B.pts=s(B.pts-a,y*v)/v,B.dts=s(B.dts-_,y*v)/v}var T=w.samples;return w.samples=[],{samples:T}},R.remuxText=function(w,y){var u=w.samples.length;if(!u)return;for(var v=w.inputTimeScale,a=this._initPTS,_=0;_<u;_++){var N=w.samples[_];N.pts=s(N.pts-a,y*v)/v}w.samples.sort(function(T,U){return T.pts-U.pts});var B=w.samples;return w.samples=[],{samples:B}},O}();function s(O,R){var C;if(R===null)return O;for(R<O?C=-8589934592:C=8589934592;Math.abs(O-R)>4294967296;)O+=C;return O}function A(O){for(var R=0;R<O.length;R++)if(O[R].key)return R;return-1}var x=function(R,C,w,y){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=C,this.size=w,this.cts=y,this.flags=new S(R)},S=function(R){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=R?2:1,this.isNonSync=R?0:1}},"./src/remux/passthrough-remuxer.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),W=function(){function b(){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 m=b.prototype;return m.destroy=function(){},m.resetTimeStamp=function(c){this.initPTS=c,this.lastEndDTS=null},m.resetNextTimestamp=function(){this.lastEndDTS=null},m.resetInitSegment=function(c,d,p){this.audioCodec=d,this.videoCodec=p,this.generateInitSegment(c),this.emitInitSegment=!0},m.generateInitSegment=function(c){var d=this.audioCodec,p=this.videoCodec;if(!c||!c.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(j.parseInitSegment)(c);d||(d=L(l.audio,P.ElementaryStreamTypes.AUDIO)),p||(p=L(l.video,P.ElementaryStreamTypes.VIDEO));var h={};l.audio&&l.video?h.audiovideo={container:"video/mp4",codec:d+","+p,initSegment:c,id:"main"}:l.audio?h.audio={container:"audio/mp4",codec:d,initSegment:c,id:"audio"}:l.video?h.video={container:"video/mp4",codec:p,initSegment:c,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=h},m.remux=function(c,d,p,l,h){var o=this.initPTS,s=this.lastEndDTS,A={audio:void 0,video:void 0,text:l,id3:p,initSegment:void 0};Object(Y.isFiniteNumber)(s)||(s=this.lastEndDTS=h||0);var x=d.samples;if(!x||!x.length)return A;var S={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(x),O=this.initData),!O||!O.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(S.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(o)||(this.initPTS=S.initPTS=o=n(O,x,s));var R=Object(j.getDuration)(x,O),C=s,w=R+C;Object(j.offsetStartDTS)(O,x,o),R>0?this.lastEndDTS=w:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!O.audio,u=!!O.video,v="";y&&(v+="audio"),u&&(v+="video");var a={data1:x,startPTS:C,startDTS:C,endPTS:w,endDTS:w,type:v,hasAudio:y,hasVideo:u,nb:1,dropped:0};return A.audio=a.type==="audio"?a:void 0,A.video=a.type!=="audio"?a:void 0,A.text=l,A.id3=p,A.initSegment=S,A},b}(),n=function(m,g,c){return Object(j.getStartDTS)(m,g)-c};function L(b,m){var g=b==null?void 0:b.codec;return g&&g.length>4?g:g==="hvc1"?"hvc1.1.c.L120.90":g==="av01"?"av01.0.04M.08":g==="avc1"||m===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=W},"./src/task-loop.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return Y});var Y=function(){function j(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=j.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},j}()},"./src/types/cmcd.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"CMCDVersion",function(){return Y}),D.d(X,"CMCDObjectType",function(){return j}),D.d(X,"CMCDStreamingFormat",function(){return P}),D.d(X,"CMCDStreamType",function(){return G});var Y=1,j;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(j||(j={}));var P;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(P||(P={}));var G;(function(W){W.VOD="v",W.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"HlsSkip",function(){return P}),D.d(X,"getSkipValue",function(){return G}),D.d(X,"HlsUrlParameters",function(){return W}),D.d(X,"Level",function(){return n});function Y(L,b){for(var m=0;m<b.length;m++){var g=b[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(L,g.key,g)}}function j(L,b,m){return b&&Y(L.prototype,b),m&&Y(L,m),L}var P;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(P||(P={}));function G(L,b){var m=L.canSkipUntil,g=L.canSkipDateRanges,c=L.endSN,d=b!==void 0?b-c:0;return m&&d<m?g?P.v2:P.Yes:P.No}var W=function(){function L(m,g,c){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=m,this.part=g,this.skip=c}var b=L.prototype;return b.addDirectives=function(g){var c=new self.URL(g);return this.msn!==void 0&&c.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&c.searchParams.set("_HLS_part",this.part.toString()),this.skip&&c.searchParams.set("_HLS_skip",this.skip),c.toString()},L}(),n=function(){function L(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(m){return m}).join(",").replace(/\.[^.,]+/g,"")}return j(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(m){var g=m%this.url.length;this._urlId!==g&&(this.details=void 0,this._urlId=g)}}]),L}()},"./src/types/loader.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"PlaylistContextType",function(){return Y}),D.d(X,"PlaylistLevelType",function(){return j});var Y;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var j;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(j||(j={}))},"./src/types/transmuxer.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"ChunkMetadata",function(){return Y});var Y=function(G,W,n,L,b,m){L===void 0&&(L=0),b===void 0&&(b=-1),m===void 0&&(m=!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=j(),this.buffering={audio:j(),video:j(),audiovideo:j()},this.level=G,this.sn=W,this.id=n,this.size=L,this.part=b,this.partial=m};function j(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"AttrList",function(){return P});var Y=/^(\d+)x(\d+)$/,j=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function G(n){typeof n=="string"&&(n=G.parseAttrList(n));for(var L in n)n.hasOwnProperty(L)&&(this[L]=n[L])}var W=G.prototype;return W.decimalInteger=function(L){var b=parseInt(this[L],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},W.hexadecimalInteger=function(L){if(this[L]){var b=(this[L]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var m=new Uint8Array(b.length/2),g=0;g<b.length/2;g++)m[g]=parseInt(b.slice(g*2,g*2+2),16);return m}else return null},W.hexadecimalIntegerAsNumber=function(L){var b=parseInt(this[L],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},W.decimalFloatingPoint=function(L){return parseFloat(this[L])},W.optionalFloat=function(L,b){var m=this[L];return m?parseFloat(m):b},W.enumeratedString=function(L){return this[L]},W.bool=function(L){return this[L]==="YES"},W.decimalResolution=function(L){var b=Y.exec(this[L]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},G.parseAttrList=function(L){var b,m={},g='"';for(j.lastIndex=0;(b=j.exec(L))!==null;){var c=b[2];c.indexOf(g)===0&&c.lastIndexOf(g)===c.length-1&&(c=c.slice(1,-1)),m[b[1]]=c}return m},G}()},"./src/utils/binary-search.ts":function(le,X,D){"use strict";D.r(X);var Y={search:function(P,G){for(var W=0,n=P.length-1,L=null,b=null;W<=n;){L=(W+n)/2|0,b=P[L];var m=G(b);if(m>0)W=L+1;else if(m<0)n=L-1;else return b}return null}};X.default=Y},"./src/utils/buffer-helper.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"BufferHelper",function(){return P});var Y=D("./src/utils/logger.ts"),j={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function G(){}return G.isBuffered=function(n,L){try{if(n){for(var b=G.getBuffered(n),m=0;m<b.length;m++)if(L>=b.start(m)&&L<=b.end(m))return!0}}catch(g){}return!1},G.bufferInfo=function(n,L,b){try{if(n){var m=G.getBuffered(n),g=[],c;for(c=0;c<m.length;c++)g.push({start:m.start(c),end:m.end(c)});return this.bufferedInfo(g,L,b)}}catch(d){}return{len:0,start:L,end:L,nextStart:void 0}},G.bufferedInfo=function(n,L,b){L=Math.max(0,L),n.sort(function(S,O){var R=S.start-O.start;return R||O.end-S.end});var m=[];if(b)for(var g=0;g<n.length;g++){var c=m.length;if(c){var d=m[c-1].end;n[g].start-d<b?n[g].end>d&&(m[c-1].end=n[g].end):m.push(n[g])}else m.push(n[g])}else m=n;for(var p=0,l,h=L,o=L,s=0;s<m.length;s++){var A=m[s].start,x=m[s].end;if(L+b>=A&&L<x)h=A,o=x,p=o-L;else if(L+b<A){l=A;break}}return{len:p,start:h||0,end:o||0,nextStart:l}},G.getBuffered=function(n){try{return n.buffered}catch(L){return Y.logger.log("failed to get media.buffered",L),j}},G}()},"./src/utils/cea-608-parser.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"Row",function(){return o}),D.d(X,"CaptionScreen",function(){return s});var Y=D("./src/utils/logger.ts"),j={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},P=function(w){var y=w;return j.hasOwnProperty(w)&&(y=j[w]),String.fromCharCode(y)},G=15,W=100,n={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},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m={25:2,26:4,29:6,30:8,31:10,27:13,28:15},g=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],c;(function(C){C[C.ERROR=0]="ERROR",C[C.TEXT=1]="TEXT",C[C.WARNING=2]="WARNING",C[C.INFO=2]="INFO",C[C.DEBUG=3]="DEBUG",C[C.DATA=3]="DATA"})(c||(c={}));var d=function(){function C(){this.time=null,this.verboseLevel=c.ERROR}var w=C.prototype;return w.log=function(u,v){this.verboseLevel>=u&&Y.logger.log(this.time+" ["+u+"] "+v)},C}(),p=function(w){for(var y=[],u=0;u<w.length;u++)y.push(w[u].toString(16));return y},l=function(){function C(y,u,v,a,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=y||"white",this.underline=u||!1,this.italics=v||!1,this.background=a||"black",this.flash=_||!1}var w=C.prototype;return w.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},w.setStyles=function(u){for(var v=["foreground","underline","italics","background","flash"],a=0;a<v.length;a++){var _=v[a];u.hasOwnProperty(_)&&(this[_]=u[_])}},w.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},w.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},w.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},w.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},C}(),h=function(){function C(y,u,v,a,_,N){this.uchar=void 0,this.penState=void 0,this.uchar=y||" ",this.penState=new l(u,v,a,_,N)}var w=C.prototype;return w.reset=function(){this.uchar=" ",this.penState.reset()},w.setChar=function(u,v){this.uchar=u,this.penState.copy(v)},w.setPenState=function(u){this.penState.copy(u)},w.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},w.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},w.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},C}(),o=function(){function C(y){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<W;u++)this.chars.push(new h);this.logger=y,this.pos=0,this.currPenState=new l}var w=C.prototype;return w.equals=function(u){for(var v=!0,a=0;a<W;a++)if(!this.chars[a].equals(u.chars[a])){v=!1;break}return v},w.copy=function(u){for(var v=0;v<W;v++)this.chars[v].copy(u.chars[v])},w.isEmpty=function(){for(var u=!0,v=0;v<W;v++)if(!this.chars[v].isEmpty()){u=!1;break}return u},w.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(c.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(c.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},w.moveCursor=function(u){var v=this.pos+u;if(u>1)for(var a=this.pos+1;a<v+1;a++)this.chars[a].setPenState(this.currPenState);this.setCursor(v)},w.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},w.insertChar=function(u){u>=144&&this.backSpace();var v=P(u);if(this.pos>=W){this.logger.log(c.ERROR,"Cannot insert "+u.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},w.clearFromPos=function(u){var v;for(v=u;v<W;v++)this.chars[v].reset()},w.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},w.clearToEndOfRow=function(){this.clearFromPos(this.pos)},w.getTextString=function(){for(var u=[],v=!0,a=0;a<W;a++){var _=this.chars[a].uchar;_!==" "&&(v=!1),u.push(_)}return v?"":u.join("")},w.setPenStyles=function(u){this.currPenState.setStyles(u);var v=this.chars[this.pos];v.setPenState(this.currPenState)},C}(),s=function(){function C(y){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<G;u++)this.rows.push(new o(y));this.logger=y,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var w=C.prototype;return w.reset=function(){for(var u=0;u<G;u++)this.rows[u].clear();this.currRow=G-1},w.equals=function(u){for(var v=!0,a=0;a<G;a++)if(!this.rows[a].equals(u.rows[a])){v=!1;break}return v},w.copy=function(u){for(var v=0;v<G;v++)this.rows[v].copy(u.rows[v])},w.isEmpty=function(){for(var u=!0,v=0;v<G;v++)if(!this.rows[v].isEmpty()){u=!1;break}return u},w.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},w.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},w.insertChar=function(u){var v=this.rows[this.currRow];v.insertChar(u)},w.setPen=function(u){var v=this.rows[this.currRow];v.setPenStyles(u)},w.moveCursor=function(u){var v=this.rows[this.currRow];v.moveCursor(u)},w.setCursor=function(u){this.logger.log(c.INFO,"setCursor: "+u);var v=this.rows[this.currRow];v.setCursor(u)},w.setPAC=function(u){this.logger.log(c.INFO,"pacData = "+JSON.stringify(u));var v=u.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var a=0;a<G;a++)this.rows[a].clear();var _=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var B=N.rows[_].cueStartTime,T=this.logger.time;if(B&&T!==null&&B<T)for(var U=0;U<this.nrRollUpRows;U++)this.rows[v-this.nrRollUpRows+U+1].copy(N.rows[_+U])}}this.currRow=v;var M=this.rows[this.currRow];if(u.indent!==null){var E=u.indent,H=Math.max(E-1,0);M.setCursor(u.indent),u.color=M.chars[H].penState.foreground}var Z={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(Z)},w.setBkgData=function(u){this.logger.log(c.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},w.setRollUpRows=function(u){this.nrRollUpRows=u},w.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(c.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(c.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(u,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(c.INFO,"Rolling up")},w.getDisplayText=function(u){u=u||!1;for(var v=[],a="",_=-1,N=0;N<G;N++){var B=this.rows[N].getTextString();B&&(_=N+1,u?v.push("Row "+_+": '"+B+"'"):v.push(B.trim()))}return v.length>0&&(u?a="["+v.join(" | ")+"]":a=v.join(`
`)),a},w.getTextAndFormat=function(){return this.rows},C}(),A=function(){function C(y,u,v){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=y,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new s(v),this.nonDisplayedMemory=new s(v),this.lastOutputScreen=new s(v),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var w=C.prototype;return w.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},w.getHandler=function(){return this.outputFilter},w.setHandler=function(u){this.outputFilter=u},w.setPAC=function(u){this.writeScreen.setPAC(u)},w.setBkgData=function(u){this.writeScreen.setBkgData(u)},w.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(c.INFO,"MODE="+u),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=u},w.insertChars=function(u){for(var v=0;v<u.length;v++)this.writeScreen.insertChar(u[v]);var a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(c.INFO,a+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(c.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},w.ccRCL=function(){this.logger.log(c.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},w.ccBS=function(){if(this.logger.log(c.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},w.ccAOF=function(){},w.ccAON=function(){},w.ccDER=function(){this.logger.log(c.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},w.ccRU=function(u){this.logger.log(c.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},w.ccFON=function(){this.logger.log(c.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},w.ccRDC=function(){this.logger.log(c.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},w.ccTR=function(){this.logger.log(c.INFO,"TR"),this.setMode("MODE_TEXT")},w.ccRTD=function(){this.logger.log(c.INFO,"RTD"),this.setMode("MODE_TEXT")},w.ccEDM=function(){this.logger.log(c.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},w.ccCR=function(){this.logger.log(c.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},w.ccENM=function(){this.logger.log(c.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},w.ccEOC=function(){if(this.logger.log(c.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(c.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},w.ccTO=function(u){this.logger.log(c.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},w.ccMIDROW=function(u){var v={flash:!1};if(v.underline=u%2===1,v.italics=u>=46,v.italics)v.foreground="white";else{var a=Math.floor(u/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=_[a]}this.logger.log(c.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},w.outputDataUpdate=function(u){u===void 0&&(u=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},w.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},C}(),x=function(){function C(y,u,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var a=new d;this.channels=[null,new A(y,u,a),new A(y+1,v,a)],this.cmdHistory=R(),this.logger=a}var w=C.prototype;return w.getHandler=function(u){return this.channels[u].getHandler()},w.setHandler=function(u,v){this.channels[u].setHandler(v)},w.addData=function(u,v){var a,_,N,B=!1;this.logger.time=u;for(var T=0;T<v.length;T+=2){if(_=v[T]&127,N=v[T+1]&127,_===0&&N===0)continue;if(this.logger.log(c.DATA,"["+p([v[T],v[T+1]])+"] -> ("+p([_,N])+")"),a=this.parseCmd(_,N),a||(a=this.parseMidrow(_,N)),a||(a=this.parsePAC(_,N)),a||(a=this.parseBackgroundAttributes(_,N)),!a&&(B=this.parseChars(_,N),B)){var U=this.currentChannel;if(U&&U>0){var M=this.channels[U];M.insertChars(B)}else this.logger.log(c.WARNING,"No channel found yet. TEXT-MODE?")}!a&&!B&&this.logger.log(c.WARNING,"Couldn't parse cleaned data "+p([_,N])+" orig: "+p([v[T],v[T+1]]))}},w.parseCmd=function(u,v){var a=this.cmdHistory,_=(u===20||u===28||u===21||u===29)&&v>=32&&v<=47,N=(u===23||u===31)&&v>=33&&v<=35;if(!(_||N))return!1;if(O(u,v,a))return S(null,null,a),this.logger.log(c.DEBUG,"Repeated command ("+p([u,v])+") is dropped"),!0;var B=u===20||u===21||u===23?1:2,T=this.channels[B];return u===20||u===21||u===28||u===29?v===32?T.ccRCL():v===33?T.ccBS():v===34?T.ccAOF():v===35?T.ccAON():v===36?T.ccDER():v===37?T.ccRU(2):v===38?T.ccRU(3):v===39?T.ccRU(4):v===40?T.ccFON():v===41?T.ccRDC():v===42?T.ccTR():v===43?T.ccRTD():v===44?T.ccEDM():v===45?T.ccCR():v===46?T.ccENM():v===47&&T.ccEOC():T.ccTO(v-32),S(u,v,a),this.currentChannel=B,!0},w.parseMidrow=function(u,v){var a=0;if((u===17||u===25)&&v>=32&&v<=47){if(u===17?a=1:a=2,a!==this.currentChannel)return this.logger.log(c.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[a];return _?(_.ccMIDROW(v),this.logger.log(c.DEBUG,"MIDROW ("+p([u,v])+")"),!0):!1}return!1},w.parsePAC=function(u,v){var a,_=this.cmdHistory,N=(u>=17&&u<=23||u>=25&&u<=31)&&v>=64&&v<=127,B=(u===16||u===24)&&v>=64&&v<=95;if(!(N||B))return!1;if(O(u,v,_))return S(null,null,_),!0;var T=u<=23?1:2;v>=64&&v<=95?a=T===1?n[u]:b[u]:a=T===1?L[u]:m[u];var U=this.channels[T];return U?(U.setPAC(this.interpretPAC(a,v)),S(u,v,_),this.currentChannel=T,!0):!1},w.interpretPAC=function(u,v){var a,_={color:null,italics:!1,indent:null,underline:!1,row:u};return v>95?a=v-96:a=v-64,_.underline=(a&1)===1,a<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(a/2)]:a<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((a-16)/2)*4,_},w.parseChars=function(u,v){var a,_=null,N=null;if(u>=25?(a=2,N=u-8):(a=1,N=u),N>=17&&N<=19){var B;N===17?B=v+80:N===18?B=v+112:B=v+144,this.logger.log(c.INFO,"Special char '"+P(B)+"' in channel "+a),_=[B]}else u>=32&&u<=127&&(_=v===0?[u]:[u,v]);if(_){var T=p(_);this.logger.log(c.DEBUG,"Char codes = "+T.join(",")),S(u,v,this.cmdHistory)}return _},w.parseBackgroundAttributes=function(u,v){var a=(u===16||u===24)&&v>=32&&v<=47,_=(u===23||u===31)&&v>=45&&v<=47;if(!(a||_))return!1;var N,B={};u===16||u===24?(N=Math.floor((v-32)/2),B.background=g[N],v%2===1&&(B.background=B.background+"_semi")):v===45?B.background="transparent":(B.foreground="black",v===47&&(B.underline=!0));var T=u<=23?1:2,U=this.channels[T];return U.setBkgData(B),S(u,v,this.cmdHistory),!0},w.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var v=this.channels[u];v&&v.reset()}this.cmdHistory=R()},w.cueSplitAtTime=function(u){for(var v=0;v<this.channels.length;v++){var a=this.channels[v];a&&a.cueSplitAtTime(u)}},C}();function S(C,w,y){y.a=C,y.b=w}function O(C,w,y){return y.a===C&&y.b===w}function R(){return{a:null,b:null}}X.default=x},"./src/utils/codecs.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"isCodecType",function(){return j}),D.d(X,"isCodecSupportedInMp4",function(){return P});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 j(G,W){var n=Y[W];return!!n&&n[G.slice(0,4)]===!0}function P(G,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/utils/vttparser.ts"),j=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),G=/\s/,W={newCue:function(L,b,m,g){for(var c=[],d,p,l,h,o,s=self.VTTCue||self.TextTrackCue,A=0;A<g.rows.length;A++)if(d=g.rows[A],l=!0,h=0,o="",!d.isEmpty()){for(var x=0;x<d.chars.length;x++)G.test(d.chars[x].uchar)&&l?h++:(o+=d.chars[x].uchar,l=!1);d.cueStartTime=b,b===m&&(m+=1e-4),h>=16?h--:h++;var S=Object(Y.fixLineBreaks)(o.trim()),O=Object(j.generateCueId)(b,m,S);(!L||!L.cues||!L.cues.getCueById(O))&&(p=new s(b,m,S),p.id=O,p.line=A+1,p.align="left",p.position=10+Math.min(80,Math.floor(h*8/32)*10),c.push(p))}return L&&c.length&&(c.sort(function(R,C){return R.line==="auto"||C.line==="auto"?0:R.line>8&&C.line>8?C.line-R.line:R.line-C.line}),c.forEach(function(R){return Object(P.addCueToTrack)(L,R)})),c}};X.default=W},"./src/utils/discontinuities.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"findFirstFragWithCC",function(){return G}),D.d(X,"shouldAlignOnDiscontinuities",function(){return W}),D.d(X,"findDiscontinuousReferenceFrag",function(){return n}),D.d(X,"adjustSlidingStart",function(){return b}),D.d(X,"alignStream",function(){return m}),D.d(X,"alignPDT",function(){return c}),D.d(X,"alignFragmentByPDTDelta",function(){return d}),D.d(X,"alignMediaPlaylistByPDT",function(){return p});var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function G(l,h){for(var o=null,s=0,A=l.length;s<A;s++){var x=l[s];if(x&&x.cc===h){o=x;break}}return o}function W(l,h,o){return!!(h.details&&(o.endCC>o.startCC||l&&l.cc<o.startCC))}function n(l,h){var o=l.fragments,s=h.fragments;if(!s.length||!o.length){j.logger.log("No fragments to align");return}var A=G(o,s[0].cc);if(!A||A&&!A.startPTS){j.logger.log("No frag in previous level to align on");return}return A}function L(l,h){if(l){var o=l.start+h;l.start=l.startPTS=o,l.endPTS=o+l.duration}}function b(l,h){for(var o=h.fragments,s=0,A=o.length;s<A;s++)L(o[s],l);h.fragmentHint&&L(h.fragmentHint,l),h.alignedSliding=!0}function m(l,h,o){if(!h)return;g(l,o,h),!o.alignedSliding&&h.details&&c(o,h.details),!o.alignedSliding&&h.details&&!o.skippedSegments&&Object(P.adjustSliding)(h.details,o)}function g(l,h,o){if(W(l,o,h)){var s=n(o.details,h);s&&Object(Y.isFiniteNumber)(s.start)&&(j.logger.log("Adjusting PTS using last level due to CC increase within current level "+h.url),b(s.start,h))}}function c(l,h){if(!h.fragments.length||!l.hasProgramDateTime||!h.hasProgramDateTime)return;var o=h.fragments[0].programDateTime,s=l.fragments[0].programDateTime,A=(s-o)/1e3+h.fragments[0].start;A&&Object(Y.isFiniteNumber)(A)&&(j.logger.log("Adjusting PTS using programDateTime delta "+(s-o)+"ms, sliding:"+A.toFixed(3)+" "+l.url+" "),b(A,l))}function d(l,h){var o=l.programDateTime;if(!o)return;var s=(o-h)/1e3;l.start=l.startPTS=s,l.endPTS=s+l.duration}function p(l,h){if(!h.fragments.length||!l.hasProgramDateTime||!h.hasProgramDateTime)return;var o=h.fragments[0].programDateTime,s=h.fragments[0].start,A=o-s*1e3;l.fragments.forEach(function(x){d(x,A)}),l.fragmentHint&&d(l.fragmentHint,A),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/utils/ewma.ts"),j=function(){function P(W,n,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(W),this.fast_=new Y.default(n)}var G=P.prototype;return G.update=function(n,L){var b=this.slow_,m=this.fast_;this.slow_.halfLife!==n&&(this.slow_=new Y.default(n,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new Y.default(L,m.getEstimate(),m.getTotalWeight()))},G.sample=function(n,L){n=Math.max(n,this.minDelayMs_);var b=8*L,m=n/1e3,g=b/m;this.fast_.sample(m,g),this.slow_.sample(m,g)},G.canEstimate=function(){var n=this.fast_;return n&&n.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},P}();X.default=j},"./src/utils/ewma.ts":function(le,X,D){"use strict";D.r(X);var Y=function(){function j(G,W,n){W===void 0&&(W=0),n===void 0&&(n=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=W,this.totalWeight_=n}var P=j.prototype;return P.sample=function(W,n){var L=Math.pow(this.alpha_,W);this.estimate_=n*(1-L)+L*this.estimate_,this.totalWeight_+=W},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},j}();X.default=Y},"./src/utils/fetch-loader.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"fetchSupported",function(){return d});var Y=D("./src/polyfills/number.ts"),j=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function G(s,A){s.prototype=Object.create(A.prototype),s.prototype.constructor=s,m(s,A)}function W(s){var A=typeof Map=="function"?new Map:void 0;return W=function(S){if(S===null||!b(S))return S;if(typeof S!="function")throw new TypeError("Super expression must either be null or a function");if(typeof A!="undefined"){if(A.has(S))return A.get(S);A.set(S,O)}function O(){return n(S,arguments,g(this).constructor)}return O.prototype=Object.create(S.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),m(O,S)},W(s)}function n(s,A,x){return L()?n=Reflect.construct:n=function(O,R,C){var w=[null];w.push.apply(w,R);var y=Function.bind.apply(O,w),u=new y;return C&&m(u,C.prototype),u},n.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(s){return!1}}function b(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function m(s,A){return m=Object.setPrototypeOf||function(S,O){return S.__proto__=O,S},m(s,A)}function g(s){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(x){return x.__proto__||Object.getPrototypeOf(x)},g(s)}function c(){return c=Object.assign||function(s){for(var A=1;A<arguments.length;A++){var x=arguments[A];for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&(s[S]=x[S])}return s},c.apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var p=function(){function s(x){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=x.fetchSetup||h,this.controller=new self.AbortController,this.stats=new j.LoadStats}var A=s.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var S=this.response;(!S||!S.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var S;this.abortInternal(),(S=this.callbacks)!==null&&S!==void 0&&S.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(S,O,R){var C=this,w=this.stats;if(w.loading.start)throw new Error("Loader can only be used once.");w.loading.start=self.performance.now();var y=l(S,this.controller.signal),u=R.onProgress,v=S.responseType==="arraybuffer",a=v?"byteLength":"length";this.context=S,this.config=O,this.callbacks=R,this.request=this.fetchSetup(S,y),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){C.abortInternal(),R.onTimeout(w,S,C.response)},O.timeout),self.fetch(this.request).then(function(_){if(C.response=C.loader=_,!_.ok){var N=_.status,B=_.statusText;throw new o(B||"fetch, bad network response",N,_)}return w.loading.first=Math.max(self.performance.now(),w.loading.start),w.total=parseInt(_.headers.get("Content-Length")||"0"),u&&Object(Y.isFiniteNumber)(O.highWaterMark)?C.loadProgressively(_,w,S,O.highWaterMark,u):v?_.arrayBuffer():_.text()}).then(function(_){var N=C.response;self.clearTimeout(C.requestTimeout),w.loading.end=Math.max(self.performance.now(),w.loading.first),w.loaded=w.total=_[a];var B={url:N.url,data:_};u&&!Object(Y.isFiniteNumber)(O.highWaterMark)&&u(w,S,_,N),R.onSuccess(B,w,S,N)}).catch(function(_){if(self.clearTimeout(C.requestTimeout),w.aborted)return;var N=_.code||0;R.onError({code:N,text:_.message},S,_.details)})},A.getCacheAge=function(){var S=null;if(this.response){var O=this.response.headers.get("age");S=O?parseFloat(O):null}return S},A.loadProgressively=function(S,O,R,C,w){C===void 0&&(C=0);var y=new P.default,u=S.body.getReader(),v=function a(){return u.read().then(function(_){if(_.done)return y.dataLength&&w(O,R,y.flush(),S),Promise.resolve(new ArrayBuffer(0));var N=_.value,B=N.length;return O.loaded+=B,B<C||y.dataLength?(y.push(N),y.dataLength>=C&&w(O,R,y.flush(),S)):w(O,R,N,S),a()}).catch(function(){return Promise.reject()})};return v()},s}();function l(s,A){var x={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(c({},s.headers))};return s.rangeEnd&&x.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),x}function h(s,A){return new self.Request(s.url,A)}var o=function(s){G(A,s);function A(x,S,O){var R;return R=s.call(this,x)||this,R.code=void 0,R.details=void 0,R.code=S,R.details=O,R}return A}(W(Error));X.default=p},"./src/utils/imsc1-ttml-parser.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"IMSC1_CODEC",function(){return b}),D.d(X,"parseIMSC1",function(){return d});var Y=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),n=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(C){for(var w=1;w<arguments.length;w++){var y=arguments[w];for(var u in y)Object.prototype.hasOwnProperty.call(y,u)&&(C[u]=y[u])}return C},L.apply(this,arguments)}var b="stpp.ttml.im1t",m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,g=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,c={left:"start",center:"center",right:"end",start:"start",end:"end"};function d(C,w,y,u,v){var a=Object(Y.findBox)(new Uint8Array(C),["mdat"]);if(a.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var _=a[0],N=Object(G.utf8ArrayToStr)(new Uint8Array(C,_.start,_.end-_.start)),B=Object(W.toTimescaleFromScale)(w,1,y);try{u(p(N,B))}catch(T){v(T)}}function p(C,w){var y=new DOMParser,u=y.parseFromString(C,"text/xml"),v=u.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(a).reduce(function(M,E){return M[E]=v.getAttribute("ttp:"+E)||a[E],M},{}),N=v.getAttribute("xml:space")!=="preserve",B=h(l(v,"styling","style")),T=h(l(v,"layout","region")),U=l(v,"body","[begin]");return[].map.call(U,function(M){var E=o(M,N);if(!E||!M.hasAttribute("begin"))return null;var H=S(M.getAttribute("begin"),_),Z=S(M.getAttribute("dur"),_),oe=S(M.getAttribute("end"),_);if(H===null)throw x(M);if(oe===null){if(Z===null)throw x(M);oe=H+Z}var de=new P.default(H-w,oe-w,E);de.id=Object(n.generateCueId)(de.startTime,de.endTime,de.text);var Te=T[M.getAttribute("region")],be=B[M.getAttribute("style")];de.position=10,de.size=80;var Ae=s(Te,be),Ce=Ae.textAlign;if(Ce){var _e=c[Ce];_e&&(de.lineAlign=_e),de.align=Ce}return L(de,Ae),de}).filter(function(M){return M!==null})}function l(C,w,y){var u=C.getElementsByTagName(w)[0];return u?[].slice.call(u.querySelectorAll(y)):[]}function h(C){return C.reduce(function(w,y){var u=y.getAttribute("xml:id");return u&&(w[u]=y),w},{})}function o(C,w){return[].slice.call(C.childNodes).reduce(function(y,u,v){var a;return u.nodeName==="br"&&v?y+`
`:(a=u.childNodes)!==null&&a!==void 0&&a.length?o(u,w):w?y+u.textContent.trim().replace(/\s+/g," "):y+u.textContent},"")}function s(C,w){var y="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(v,a){var _=A(w,y,a)||A(C,y,a);return _&&(v[a]=_),v},{})}function A(C,w,y){return C.hasAttributeNS(w,y)?C.getAttributeNS(w,y):null}function x(C){return new Error("Could not parse ttml timestamp "+C)}function S(C,w){if(!C)return null;var y=Object(j.parseTimeStamp)(C);return y===null&&(m.test(C)?y=O(C,w):g.test(C)&&(y=R(C,w))),y}function O(C,w){var y=m.exec(C),u=(y[4]|0)+(y[5]|0)/w.subFrameRate;return(y[1]|0)*3600+(y[2]|0)*60+(y[3]|0)+u/w.frameRate}function R(C,w){var y=g.exec(C),u=Number(y[1]),v=y[2];switch(v){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/w.frameRate;case"t":return u/w.tickRate}return u}},"./src/utils/logger.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"enableLogs",function(){return n}),D.d(X,"logger",function(){return L});var Y=function(){},j={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},P=j;function G(b){var m=self.console[b];return m?m.bind(self.console,"["+b+"] >"):Y}function W(b){for(var m=arguments.length,g=new Array(m>1?m-1:0),c=1;c<m;c++)g[c-1]=arguments[c];g.forEach(function(d){P[d]=b[d]?b[d].bind(b):G(d)})}function n(b){if(self.console&&b===!0||typeof b=="object"){W(b,"debug","log","info","warn","error");try{P.log()}catch(m){P=j}}else P=j}var L=P},"./src/utils/mediakeys-helper.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"KeySystems",function(){return Y}),D.d(X,"requestMediaKeySystemAccess",function(){return j});var Y;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var j=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"bin2str",function(){return W}),D.d(X,"readUint16",function(){return n}),D.d(X,"readUint32",function(){return L}),D.d(X,"writeUint32",function(){return b}),D.d(X,"findBox",function(){return m}),D.d(X,"parseSegmentIndex",function(){return g}),D.d(X,"parseInitSegment",function(){return c}),D.d(X,"getStartDTS",function(){return d}),D.d(X,"getDuration",function(){return p}),D.d(X,"computeRawDurationFromSamples",function(){return l}),D.d(X,"offsetStartDTS",function(){return h}),D.d(X,"segmentValidRange",function(){return o}),D.d(X,"appendUint8Array",function(){return s});var Y=D("./src/utils/typed-array.ts"),j=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,G=[].push;function W(A){return String.fromCharCode.apply(null,A)}function n(A,x){"data"in A&&(x+=A.start,A=A.data);var S=A[x]<<8|A[x+1];return S<0?65536+S:S}function L(A,x){"data"in A&&(x+=A.start,A=A.data);var S=A[x]<<24|A[x+1]<<16|A[x+2]<<8|A[x+3];return S<0?4294967296+S:S}function b(A,x,S){"data"in A&&(x+=A.start,A=A.data),A[x]=S>>24,A[x+1]=S>>16&255,A[x+2]=S>>8&255,A[x+3]=S&255}function m(A,x){var S=[];if(!x.length)return S;var O,R,C;"data"in A?(O=A.data,R=A.start,C=A.end):(O=A,R=0,C=O.byteLength);for(var w=R;w<C;){var y=L(O,w),u=W(O.subarray(w+4,w+8)),v=y>1?w+y:C;if(u===x[0])if(x.length===1)S.push({data:O,start:w+8,end:v});else{var a=m({data:O,start:w+8,end:v},x.slice(1));a.length&&G.apply(S,a)}w=v}return S}function g(A){var x=m(A,["moov"]),S=x[0],O=S?S.end:null,R=m(A,["sidx"]);if(!R||!R[0])return null;var C=[],w=R[0],y=w.data[0],u=y===0?8:16,v=L(w,u);u+=4;var a=0,_=0;y===0?u+=8:u+=16,u+=2;var N=w.end+_,B=n(w,u);u+=2;for(var T=0;T<B;T++){var U=u,M=L(w,U);U+=4;var E=M&2147483647,H=(M&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Z=L(w,U);U+=4,C.push({referenceSize:E,subsegmentDuration:Z,info:{duration:Z/v,start:N,end:N+E-1}}),N+=E,U+=4,u=U}return{earliestPresentationTime:a,timescale:v,version:y,referencesCount:B,references:C,moovEndOffset:O}}function c(A){for(var x=[],S=m(A,["moov","trak"]),O=0;O<S.length;O++){var R=S[O],C=m(R,["tkhd"])[0];if(C){var w=C.data[C.start],y=w===0?12:20,u=L(C,y),v=m(R,["mdia","mdhd"])[0];if(v){w=v.data[v.start],y=w===0?12:20;var a=L(v,y),_=m(R,["mdia","hdlr"])[0];if(_){var N=W(_.data.subarray(_.start+8,_.start+12)),B={soun:j.ElementaryStreamTypes.AUDIO,vide:j.ElementaryStreamTypes.VIDEO}[N];if(B){var T=m(R,["mdia","minf","stbl","stsd"])[0],U=void 0;T&&(U=W(T.data.subarray(T.start+12,T.start+16))),x[u]={timescale:a,type:B},x[B]={timescale:a,id:u,codec:U}}}}}}var M=m(A,["moov","mvex","trex"]);return M.forEach(function(E){var H=L(E,4),Z=x[H];Z&&(Z.default={duration:L(E,12),flags:L(E,20)})}),x}function d(A,x){return m(x,["moof","traf"]).reduce(function(S,O){var R=m(O,["tfdt"])[0],C=R.data[R.start],w=m(O,["tfhd"]).reduce(function(y,u){var v=L(u,4),a=A[v];if(a){var _=L(R,4);C===1&&(_*=Math.pow(2,32),_+=L(R,8));var N=a.timescale||9e4,B=_/N;if(isFinite(B)&&(y===null||B<y))return B}return y},null);return w!==null&&isFinite(w)&&(S===null||w<S)?w:S},null)||0}function p(A,x){for(var S=0,O=0,R=0,C=m(A,["moof","traf"]),w=0;w<C.length;w++){var y=C[w],u=m(y,["tfhd"])[0],v=L(u,4),a=x[v];if(!a)continue;var _=a.default,N=L(u,0)|(_==null?void 0:_.flags),B=_==null?void 0:_.duration;N&8&&(N&2?B=L(u,12):B=L(u,8));for(var T=a.timescale||9e4,U=m(y,["trun"]),M=0;M<U.length;M++){if(B){var E=L(U[M],4);S=B*E}else S=l(U[M]);a.type===j.ElementaryStreamTypes.VIDEO?O+=S/T:a.type===j.ElementaryStreamTypes.AUDIO&&(R+=S/T)}}if(O===0&&R===0){var H=g(A);if(H!=null&&H.references)return H.references.reduce(function(Z,oe){return Z+oe.info.duration||0},0)}return O||R}function l(A){var x=L(A,0),S=8;x&1&&(S+=4),x&4&&(S+=4);for(var O=0,R=L(A,4),C=0;C<R;C++){if(x&256){var w=L(A,S);O+=w,S+=4}x&512&&(S+=4),x&1024&&(S+=4),x&2048&&(S+=4)}return O}function h(A,x,S){m(x,["moof","traf"]).forEach(function(O){m(O,["tfhd"]).forEach(function(R){var C=L(R,4),w=A[C];if(!w)return;var y=w.timescale||9e4;m(O,["tfdt"]).forEach(function(u){var v=u.data[u.start],a=L(u,4);if(v===0)b(u,4,a-S*y);else{a*=Math.pow(2,32),a+=L(u,8),a-=S*y,a=Math.max(a,0);var _=Math.floor(a/(P+1)),N=Math.floor(a%(P+1));b(u,4,_),b(u,8,N)}})})})}function o(A){var x={valid:null,remainder:null},S=m(A,["moof"]);if(S){if(S.length<2)return x.remainder=A,x}else return x;var O=S[S.length-1];return x.valid=Object(Y.sliceUint8)(A,0,O.start-8),x.remainder=Object(Y.sliceUint8)(A,O.start-8),x}function s(A,x){var S=new Uint8Array(A.length+x.length);return S.set(A),S.set(x,A.length),S}},"./src/utils/output-filter.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"default",function(){return Y});var Y=function(){function j(G,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=W}var P=j.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(W,n,L){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=n,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},j}()},"./src/utils/texttrack-utils.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"sendAddTrackEvent",function(){return j}),D.d(X,"addCueToTrack",function(){return P}),D.d(X,"clearCurrentCues",function(){return G}),D.d(X,"removeCuesInRange",function(){return W}),D.d(X,"getCuesInRange",function(){return L});var Y=D("./src/utils/logger.ts");function j(b,m){var g;try{g=new Event("addtrack")}catch(c){g=document.createEvent("Event"),g.initEvent("addtrack",!1,!1)}g.track=b,m.dispatchEvent(g)}function P(b,m){var g=b.mode;if(g==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(m.id))try{if(b.addCue(m),!b.cues.getCueById(m.id))throw new Error("addCue is failed for: "+m)}catch(d){Y.logger.debug("[texttrack-utils]: "+d);var c=new self.TextTrackCue(m.startTime,m.endTime,m.text);c.id=m.id,b.addCue(c)}g==="disabled"&&(b.mode=g)}function G(b){var m=b.mode;if(m==="disabled"&&(b.mode="hidden"),b.cues)for(var g=b.cues.length;g--;)b.removeCue(b.cues[g]);m==="disabled"&&(b.mode=m)}function W(b,m,g){var c=b.mode;if(c==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var d=L(b.cues,m,g),p=0;p<d.length;p++)b.removeCue(d[p]);c==="disabled"&&(b.mode=c)}function n(b,m){if(m<b[0].startTime)return 0;var g=b.length-1;if(m>b[g].endTime)return-1;for(var c=0,d=g;c<=d;){var p=Math.floor((d+c)/2);if(m<b[p].startTime)d=p-1;else if(m>b[p].startTime&&c<g)c=p+1;else return p}return b[c].startTime-m<m-b[d].startTime?c:d}function L(b,m,g){var c=[],d=n(b,m);if(d>-1)for(var p=d,l=b.length;p<l;p++){var h=b[p];if(h.startTime>=m&&h.endTime<=g)c.push(h);else if(h.startTime>g)return c}return c}},"./src/utils/time-ranges.ts":function(le,X,D){"use strict";D.r(X);var Y={toString:function(P){for(var G="",W=P.length,n=0;n<W;n++)G+="["+P.start(n).toFixed(3)+","+P.end(n).toFixed(3)+"]";return G}};X.default=Y},"./src/utils/timescale-conversion.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"toTimescaleFromBase",function(){return j}),D.d(X,"toTimescaleFromScale",function(){return P}),D.d(X,"toMsFromMpegTsClock",function(){return G}),D.d(X,"toMpegTsClockFromTimescale",function(){return W});var Y=9e4;function j(n,L,b,m){b===void 0&&(b=1),m===void 0&&(m=!1);var g=n*L*b;return m?Math.round(g):g}function P(n,L,b,m){return b===void 0&&(b=1),m===void 0&&(m=!1),j(n,L,1/b,m)}function G(n,L){return L===void 0&&(L=!1),j(n,1e3,1/Y,L)}function W(n,L){return L===void 0&&(L=1),j(n,Y,1/L)}},"./src/utils/typed-array.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"sliceUint8",function(){return Y});function Y(j,P,G){return Uint8Array.prototype.slice?j.slice(P,G):new Uint8Array(Array.prototype.slice.call(j,P,G))}},"./src/utils/vttcue.ts":function(le,X,D){"use strict";D.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],j=["start","middle","end","left","right"];function P(b,m){if(typeof m!="string")return!1;if(!Array.isArray(b))return!1;var g=m.toLowerCase();return~b.indexOf(g)?g:!1}function G(b){return P(Y,b)}function W(b){return P(j,b)}function n(b){for(var m=arguments.length,g=new Array(m>1?m-1:0),c=1;c<m;c++)g[c-1]=arguments[c];for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var l in p)b[l]=p[l]}return b}function L(b,m,g){var c=this,d={enumerable:!0};c.hasBeenReset=!1;var p="",l=!1,h=b,o=m,s=g,A=null,x="",S=!0,O="auto",R="start",C=50,w="middle",y=50,u="middle";Object.defineProperty(c,"id",n({},d,{get:function(){return p},set:function(a){p=""+a}})),Object.defineProperty(c,"pauseOnExit",n({},d,{get:function(){return l},set:function(a){l=!!a}})),Object.defineProperty(c,"startTime",n({},d,{get:function(){return h},set:function(a){if(typeof a!="number")throw new TypeError("Start time must be set to a number.");h=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},d,{get:function(){return o},set:function(a){if(typeof a!="number")throw new TypeError("End time must be set to a number.");o=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},d,{get:function(){return s},set:function(a){s=""+a,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},d,{get:function(){return A},set:function(a){A=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},d,{get:function(){return x},set:function(a){var _=G(a);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},d,{get:function(){return S},set:function(a){S=!!a,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},d,{get:function(){return O},set:function(a){if(typeof a!="number"&&a!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},d,{get:function(){return R},set:function(a){var _=W(a);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");R=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},d,{get:function(){return C},set:function(a){if(a<0||a>100)throw new Error("Position must be between 0 and 100.");C=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},d,{get:function(){return w},set:function(a){var _=W(a);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");w=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},d,{get:function(){return y},set:function(a){if(a<0||a>100)throw new Error("Size must be between 0 and 100.");y=a,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},d,{get:function(){return u},set:function(a){var _=W(a);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");u=_,this.hasBeenReset=!0}})),c.displayState=void 0}return L.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"parseTimeStamp",function(){return P}),D.d(X,"fixLineBreaks",function(){return m}),D.d(X,"VTTParser",function(){return g});var Y=D("./src/utils/vttcue.ts"),j=function(){function c(){}var d=c.prototype;return d.decode=function(l,h){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},c}();function P(c){function d(l,h,o,s){return(l|0)*3600+(h|0)*60+(o|0)+parseFloat(s||0)}var p=c.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?d(p[2],p[3],0,p[4]):d(p[1],p[2],p[3],p[4]):null}var G=function(){function c(){this.values=Object.create(null)}var d=c.prototype;return d.set=function(l,h){!this.get(l)&&h!==""&&(this.values[l]=h)},d.get=function(l,h,o){return o?this.has(l)?this.values[l]:h[o]:this.has(l)?this.values[l]:h},d.has=function(l){return l in this.values},d.alt=function(l,h,o){for(var s=0;s<o.length;++s)if(h===o[s]){this.set(l,h);break}},d.integer=function(l,h){/^-?\d+$/.test(h)&&this.set(l,parseInt(h,10))},d.percent=function(l,h){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(h)){var o=parseFloat(h);if(o>=0&&o<=100)return this.set(l,o),!0}return!1},c}();function W(c,d,p,l){var h=l?c.split(l):[c];for(var o in h){if(typeof h[o]!="string")continue;var s=h[o].split(p);if(s.length!==2)continue;var A=s[0],x=s[1];d(A,x)}}var n=new Y.default(0,0,""),L=n.align==="middle"?"middle":"center";function b(c,d,p){var l=c;function h(){var A=P(c);if(A===null)throw new Error("Malformed timestamp: "+l);return c=c.replace(/^[^\sa-zA-Z-]+/,""),A}function o(A,x){var S=new G;W(A,function(C,w){var y;switch(C){case"region":for(var u=p.length-1;u>=0;u--)if(p[u].id===w){S.set(C,p[u].region);break}break;case"vertical":S.alt(C,w,["rl","lr"]);break;case"line":y=w.split(","),S.integer(C,y[0]),S.percent(C,y[0])&&S.set("snapToLines",!1),S.alt(C,y[0],["auto"]),y.length===2&&S.alt("lineAlign",y[1],["start",L,"end"]);break;case"position":y=w.split(","),S.percent(C,y[0]),y.length===2&&S.alt("positionAlign",y[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":S.percent(C,w);break;case"align":S.alt(C,w,["start",L,"end","left","right"]);break}},/:/,/\s/),x.region=S.get("region",null),x.vertical=S.get("vertical","");var O=S.get("line","auto");O==="auto"&&n.line===-1&&(O=-1),x.line=O,x.lineAlign=S.get("lineAlign","start"),x.snapToLines=S.get("snapToLines",!0),x.size=S.get("size",100),x.align=S.get("align",L);var R=S.get("position","auto");R==="auto"&&n.position===50&&(R=x.align==="start"||x.align==="left"?0:x.align==="end"||x.align==="right"?100:50),x.position=R}function s(){c=c.replace(/^\s+/,"")}if(s(),d.startTime=h(),s(),c.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);c=c.substr(3),s(),d.endTime=h(),s(),o(c,d)}function m(c){return c.replace(/<br(?: \/)?>/gi,`
`)}var g=function(){function c(){this.state="INITIAL",this.buffer="",this.decoder=new j,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var d=c.prototype;return d.parse=function(l){var h=this;l&&(h.buffer+=h.decoder.decode(l,{stream:!0}));function o(){var R=h.buffer,C=0;for(R=m(R);C<R.length&&R[C]!=="\r"&&R[C]!==`
`;)++C;var w=R.substr(0,C);return R[C]==="\r"&&++C,R[C]===`
`&&++C,h.buffer=R.substr(C),w}function s(R){W(R,function(C,w){},/:/)}try{var A="";if(h.state==="INITIAL"){if(!/\r\n|\n/.test(h.buffer))return this;A=o();var x=A.match(/^()?WEBVTT([ \t].*)?$/);if(!x||!x[0])throw new Error("Malformed WebVTT signature.");h.state="HEADER"}for(var S=!1;h.buffer;){if(!/\r\n|\n/.test(h.buffer))return this;S?S=!1:A=o();switch(h.state){case"HEADER":/:/.test(A)?s(A):A||(h.state="ID");continue;case"NOTE":A||(h.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){h.state="NOTE";break}if(!A)continue;if(h.cue=new Y.default(0,0,""),h.state="CUE",A.indexOf("-->")===-1){h.cue.id=A;continue}case"CUE":if(!h.cue){h.state="BADCUE";continue}try{b(A,h.cue,h.regionList)}catch(R){h.cue=null,h.state="BADCUE";continue}h.state="CUETEXT";continue;case"CUETEXT":{var O=A.indexOf("-->")!==-1;if(!A||O&&(S=!0)){h.oncue&&h.cue&&h.oncue(h.cue),h.cue=null,h.state="ID";continue}if(h.cue===null)continue;h.cue.text&&(h.cue.text+=`
`),h.cue.text+=A}continue;case"BADCUE":A||(h.state="ID")}}}catch(R){h.state==="CUETEXT"&&h.cue&&h.oncue&&h.oncue(h.cue),h.cue=null,h.state=h.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},d.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(h){l.onparsingerror&&l.onparsingerror(h)}return l.onflush&&l.onflush(),this},c}()},"./src/utils/webvtt-parser.ts":function(le,X,D){"use strict";D.r(X),D.d(X,"generateCueId",function(){return g}),D.d(X,"parseWebVTT",function(){return d});var Y=D("./src/polyfills/number.ts"),j=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),W=D("./src/remux/mp4-remuxer.ts"),n=/\r\n|\n\r|\n|\r/g,L=function(l,h,o){return o===void 0&&(o=0),l.substr(o,h.length)===h},b=function(l){var h=parseInt(l.substr(-3)),o=parseInt(l.substr(-6,2)),s=parseInt(l.substr(-9,2)),A=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(h)||!Object(Y.isFiniteNumber)(o)||!Object(Y.isFiniteNumber)(s)||!Object(Y.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return h+=1e3*o,h+=60*1e3*s,h+=60*60*1e3*A,h},m=function(l){for(var h=5381,o=l.length;o;)h=h*33^l.charCodeAt(--o);return(h>>>0).toString()};function g(p,l,h){return m(p.toString())+m(l.toString())+m(h)}var c=function(l,h,o){var s=l[h],A=l[s.prevCC];if(!A||!A.new&&s.new){l.ccOffset=l.presentationOffset=s.start,s.new=!1;return}for(;(x=A)!==null&&x!==void 0&&x.new;){var x;l.ccOffset+=s.start-A.start,s.new=!1,s=A,A=l[s.prevCC]}l.presentationOffset=o};function d(p,l,h,o,s,A,x,S){var O=new j.VTTParser,R=Object(P.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(n,`
`).split(`
`),C=[],w=Object(G.toMpegTsClockFromTimescale)(l,h),y="00:00.000",u=0,v=0,a,_=!0,N=!1;O.oncue=function(B){var T=o[s],U=o.ccOffset,M=(u-w)/9e4;if(T!=null&&T.new&&(v!==void 0?U=o.ccOffset=T.start:c(o,s,M)),M&&(U=M-o.presentationOffset),N){var E=B.endTime-B.startTime,H=Object(W.normalizePts)((B.startTime+U-v)*9e4,A*9e4)/9e4;B.startTime=H,B.endTime=H+E}var Z=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(Z)),B.id||(B.id=g(B.startTime,B.endTime,Z)),B.endTime>0&&C.push(B)},O.onparsingerror=function(B){a=B},O.onflush=function(){if(a){S(a);return}x(C)},R.forEach(function(B){if(_)if(L(B,"X-TIMESTAMP-MAP=")){_=!1,N=!0,B.substr(16).split(",").forEach(function(T){L(T,"LOCAL:")?y=T.substr(6):L(T,"MPEGTS:")&&(u=parseInt(T.substr(7)))});try{v=b(y)/1e3}catch(T){N=!1,a=T}return}else B===""&&(_=!1);O.parse(B+`
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(le,X,D){"use strict";D.r(X);var Y=D("./src/utils/logger.ts"),j=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,G=function(){function W(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 j.LoadStats,this.retryDelay=0}var n=W.prototype;return n.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},n.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},n.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},n.load=function(b,m,g){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=m,this.callbacks=g,this.retryDelay=m.retryDelay,this.loadInternal()},n.loadInternal=function(){var b=this.config,m=this.context;if(!b)return;var g=this.loader=new self.XMLHttpRequest,c=this.stats;c.loading.first=0,c.loaded=0;var d=this.xhrSetup;try{if(d)try{d(g,m.url)}catch(h){g.open("GET",m.url,!0),d(g,m.url)}g.readyState||g.open("GET",m.url,!0);var p=this.context.headers;if(p)for(var l in p)g.setRequestHeader(l,p[l])}catch(h){this.callbacks.onError({code:g.status,text:h.message},m,g);return}m.rangeEnd&&g.setRequestHeader("Range","bytes="+m.rangeStart+"-"+(m.rangeEnd-1)),g.onreadystatechange=this.readystatechange.bind(this),g.onprogress=this.loadprogress.bind(this),g.responseType=m.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),g.send()},n.readystatechange=function(){var b=this.context,m=this.loader,g=this.stats;if(!b||!m)return;var c=m.readyState,d=this.config;if(g.aborted)return;if(c>=2)if(self.clearTimeout(this.requestTimeout),g.loading.first===0&&(g.loading.first=Math.max(self.performance.now(),g.loading.start)),c===4){m.onreadystatechange=null,m.onprogress=null;var p=m.status;if(p>=200&&p<300){g.loading.end=Math.max(self.performance.now(),g.loading.first);var l,h;if(b.responseType==="arraybuffer"?(l=m.response,h=l.byteLength):(l=m.responseText,h=l.length),g.loaded=g.total=h,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(g,b,l,m),!this.callbacks)return;var s={url:m.responseURL,data:l};this.callbacks.onSuccess(s,g,b,m)}else g.retry>=d.maxRetry||p>=400&&p<499?(Y.logger.error(p+" while loading "+b.url),this.callbacks.onError({code:p,text:m.statusText},b,m)):(Y.logger.warn(p+" while loading "+b.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,d.maxRetryDelay),g.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout)},n.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},n.loadprogress=function(b){var m=this.stats;m.loaded=b.loaded,b.lengthComputable&&(m.total=b.total)},n.getCacheAge=function(){var b=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var m=this.loader.getResponseHeader("age");b=m?parseFloat(m):null}return b},W}();X.default=G}}).default})},vHTk:function(rt,we,$){rt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);