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

371 lines
1.1 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[249,5,7,10],{"+NIl":function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){"use strict";ie.defineMode("stex",function(Y,M){"use strict";function H(p,m){p.cmdState.push(m)}function O(p){return p.cmdState.length>0?p.cmdState[p.cmdState.length-1]:null}function I(p){var m=p.cmdState.pop();m&&m.closeBracket()}function j(p){for(var m=p.cmdState,y=m.length-1;y>=0;y--){var a=m[y];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function N(p,m,y){return function(){this.name=p,this.bracketNo=0,this.style=m,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=N("importmodule","tag",["string","builtin"]),P.documentclass=N("documentclass","tag",["","atom"]),P.usepackage=N("usepackage","tag",["atom"]),P.begin=N("begin","tag",["atom"]),P.end=N("end","tag",["atom"]),P.label=N("label","tag",["atom"]),P.ref=N("ref","tag",["atom"]),P.eqref=N("eqref","tag",["atom"]),P.cite=N("cite","tag",["atom"]),P.bibitem=N("bibitem","tag",["atom"]),P.Bibitem=N("Bibitem","tag",["atom"]),P.RBibitem=N("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(p,m){p.f=m}function c(p,m){var y;if(p.match(/^\\[a-zA-Z@]+/)){var a=p.current().slice(1);return y=P.hasOwnProperty(a)?P[a]:P.DEFAULT,y=new y,H(m,y),R(m,_),y.style}if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/\\]/))return"tag";if(p.match("\\["))return R(m,function(o,l){return f(o,l,"\\]")}),"keyword";if(p.match("\\("))return R(m,function(o,l){return f(o,l,"\\)")}),"keyword";if(p.match("$$"))return R(m,function(o,l){return f(o,l,"$$")}),"keyword";if(p.match("$"))return R(m,function(o,l){return f(o,l,"$")}),"keyword";var i=p.next();if(i=="%")return p.skipToEnd(),"comment";if(i=="}"||i=="]"){if(y=O(m),y)y.closeBracket(i),R(m,_);else return"error";return"bracket"}else return i=="{"||i=="["?(y=P.DEFAULT,y=new y,H(m,y),"bracket"):/\d/.test(i)?(p.eatWhile(/[\w.%]/),"atom"):(p.eatWhile(/[\w\-_]/),y=j(m),y.name=="begin"&&(y.argument=p.current()),y.styleIdentifier())}function f(p,m,y){if(p.eatSpace())return null;if(y&&p.match(y))return R(m,c),"keyword";if(p.match(/^\\[a-zA-Z@]+/))return"tag";if(p.match(/^[a-zA-Z]+/))return"variable-2";if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/]/))return"tag";if(p.match(/^[\^_&]/))return"tag";if(p.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(p.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=p.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(p.skipToEnd(),"comment"):"error"}function _(p,m){var y=p.peek(),a;return y=="{"||y=="["?(a=O(m),a.openBracket(y),p.eat(y),R(m,c),"bracket"):/[ \t\r]/.test(y)?(p.eat(y),null):(R(m,c),I(m),c(p,m))}return{startState:function(){var p=M.inMathMode?function(m,y){return f(m,y)}:c;return{cmdState:[],f:p}},copyState:function(p){return{cmdState:p.cmdState.slice(),f:p.f}},token:function(p,m){return m.f(p,m)},blankLine:function(p){p.f=c,p.cmdState.length=0},lineComment:"%"}}),ie.defineMIME("text/x-stex","stex"),ie.defineMIME("text/x-latex","stex")})},"+ua5":function(Wt,Me,$){},"/cxE":function(Wt,Me,$){"use strict";$.d(Me,"e",function(){return M}),$.d(Me,"f",function(){return H}),$.d(Me,"g",function(){return O}),$.d(Me,"d",function(){return j}),$.d(Me,"a",function(){return N}),$.d(Me,"b",function(){return P}),$.d(Me,"c",function(){return R});var ie=function(){function c(){this.listeners=[],this.unexpectedErrorHandler=function(f){setTimeout(function(){throw f.stack?new Error(f.message+`
`+f.stack):f},0)}}return c.prototype.emit=function(f){this.listeners.forEach(function(_){_(f)})},c.prototype.onUnexpectedError=function(f){this.unexpectedErrorHandler(f),this.emit(f)},c.prototype.onUnexpectedExternalError=function(f){this.unexpectedErrorHandler(f)},c}(),Y=new ie;function M(c){j(c)||Y.onUnexpectedError(c);return}function H(c){j(c)||Y.onUnexpectedExternalError(c);return}function O(c){if(c instanceof Error){var f=c.name,_=c.message,p=c.stacktrace||c.stack;return{$isError:!0,name:f,message:_,stack:p}}return c}var I="Canceled";function j(c){return c instanceof Error&&c.name===I&&c.message===I}function N(){var c=new Error(I);return c.name=c.message,c}function P(c){return c?new Error("Illegal argument: "+c):new Error("Illegal argument")}function R(c){return c?new Error("Illegal state: "+c):new Error("Illegal state")}},"19Vz":function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){ie.defineOption("placeholder","",function(N,P,R){var c=R&&R!=ie.Init;if(P&&!c)N.on("blur",O),N.on("change",I),N.on("swapDoc",I),ie.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){H(N)}),I(N);else if(!P&&c){N.off("blur",O),N.off("change",I),N.off("swapDoc",I),ie.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),Y(N);var f=N.getWrapperElement();f.className=f.className.replace(" CodeMirror-empty","")}P&&!N.hasFocus()&&O(N)});function Y(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function M(N){Y(N);var P=N.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=N.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var R=N.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),P.appendChild(R),N.display.lineSpace.insertBefore(P,N.display.lineSpace.firstChild)}function H(N){setTimeout(function(){var P=!1,R=N.getInputField();R.nodeName=="TEXTAREA"?P=!R.value:N.lineCount()==1&&(P=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),P?M(N):Y(N)},20)}function O(N){j(N)&&M(N)}function I(N){var P=N.getWrapperElement(),R=j(N);P.className=P.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?M(N):Y(N)}function j(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){"use strict";var Y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},M={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ie.defineMode("xml",function(H,O){var I=H.indentUnit,j={},N=O.htmlMode?Y:M;for(var P in N)j[P]=N[P];for(var P in O)j[P]=O[P];var R,c;function f(u,D){function S(K){return D.tokenize=K,K(u,D)}var w=u.next();if(w=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?S(m("atom","]]>")):null:u.match("--")?S(m("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),S(y(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),D.tokenize=m("meta","?>"),"meta"):(R=u.eat("/")?"closeTag":"openTag",D.tokenize=_,"tag bracket");if(w=="&"){var b;return u.eat("#")?u.eat("x")?b=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):b=u.eatWhile(/[\d]/)&&u.eat(";"):b=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),b?"atom":"error"}else return u.eatWhile(/[^&<]/),null}f.isInText=!0;function _(u,D){var S=u.next();if(S==">"||S=="/"&&u.eat(">"))return D.tokenize=f,R=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return R="equals",null;if(S=="<"){D.tokenize=f,D.state=l,D.tagName=D.tagStart=null;var w=D.tokenize(u,D);return w?w+" tag error":"tag error"}else return/[\'\"]/.test(S)?(D.tokenize=p(S),D.stringStartCol=u.column(),D.tokenize(u,D)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function p(u){var D=function(S,w){for(;!S.eol();)if(S.next()==u){w.tokenize=_;break}return"string"};return D.isInAttribute=!0,D}function m(u,D){return function(S,w){for(;!S.eol();){if(S.match(D)){w.tokenize=f;break}S.next()}return u}}function y(u){return function(D,S){for(var w;(w=D.next())!=null;){if(w=="<")return S.tokenize=y(u+1),S.tokenize(D,S);if(w==">")if(u==1){S.tokenize=f;break}else return S.tokenize=y(u-1),S.tokenize(D,S)}return"meta"}}function a(u,D,S){this.prev=u.context,this.tagName=D,this.indent=u.indented,this.startOfLine=S,(j.doNotIndent.hasOwnProperty(D)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function o(u,D){for(var S;;){if(!u.context)return;if(S=u.context.tagName,!j.contextGrabbers.hasOwnProperty(S)||!j.contextGrabbers[S].hasOwnProperty(D))return;i(u)}}function l(u,D,S){return u=="openTag"?(S.tagStart=D.column(),C):u=="closeTag"?g:l}function C(u,D,S){return u=="word"?(S.tagName=D.current(),c="tag",A):j.allowMissingTagName&&u=="endTag"?(c="tag bracket",A(u,D,S)):(c="error",C)}function g(u,D,S){if(u=="word"){var w=D.current();return S.context&&S.context.tagName!=w&&j.implicitlyClosed.hasOwnProperty(S.context.tagName)&&i(S),S.context&&S.context.tagName==w||j.matchClosing===!1?(c="tag",v):(c="tag error",L)}else return j.allowMissingTagName&&u=="endTag"?(c="tag bracket",v(u,D,S)):(c="error",L)}function v(u,D,S){return u!="endTag"?(c="error",v):(i(S),l)}function L(u,D,S){return c="error",v(u,D,S)}function A(u,D,S){if(u=="word")return c="attribute",T;if(u=="endTag"||u=="selfcloseTag"){var w=S.tagName,b=S.tagStart;return S.tagName=S.tagStart=null,u=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(w)?o(S,w):(o(S,w),S.context=new a(S,w,b==S.indented)),l}return c="error",A}function T(u,D,S){return u=="equals"?x:(j.allowMissing||(c="error"),A(u,D,S))}function x(u,D,S){return u=="string"?h:u=="word"&&j.allowUnquoted?(c="string",A):(c="error",A(u,D,S))}function h(u,D,S){return u=="string"?h:A(u,D,S)}return{startState:function(u){var D={tokenize:f,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(D.baseIndent=u),D},token:function(u,D){if(!D.tagName&&u.sol()&&(D.indented=u.indentation()),u.eatSpace())return null;R=null;var S=D.tokenize(u,D);return(S||R)&&S!="comment"&&(c=null,D.state=D.state(R||S,u,D),c&&(S=c=="error"?S+" error":c)),S},indent:function(u,D,S){var w=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+I;if(w&&w.noIndent)return ie.Pass;if(u.tokenize!=_&&u.tokenize!=f)return S?S.match(/^(\s*)/)[0].length:0;if(u.tagName)return j.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+I*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(D))return 0;var b=D&&/^<(\/)?([\w_:\.-]*)/.exec(D);if(b&&b[1])for(;w;)if(w.tagName==b[2]){w=w.prev;break}else if(j.implicitlyClosed.hasOwnProperty(w.tagName))w=w.prev;else break;else if(b)for(;w;){var K=j.contextGrabbers[w.tagName];if(K&&K.hasOwnProperty(b[2]))w=w.prev;else break}for(;w&&w.prev&&!w.startOfLine;)w=w.prev;return w?w.indent+I:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(u){u.state==x&&(u.state=A)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var D=[],S=u.context;S;S=S.prev)S.tagName&&D.push(S.tagName);return D.reverse()}}}),ie.defineMIME("text/xml","xml"),ie.defineMIME("application/xml","xml"),ie.mimeModes.hasOwnProperty("text/html")||ie.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return M});var ie=$("JYp7"),Y=function(){function H(O){this.element=O,this.next=H.Undefined,this.prev=H.Undefined}return H.Undefined=new H(void 0),H}(),M=function(){function H(){this._first=Y.Undefined,this._last=Y.Undefined,this._size=0}return Object.defineProperty(H.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),H.prototype.isEmpty=function(){return this._first===Y.Undefined},H.prototype.clear=function(){this._first=Y.Undefined,this._last=Y.Undefined,this._size=0},H.prototype.unshift=function(O){return this._insert(O,!1)},H.prototype.push=function(O){return this._insert(O,!0)},H.prototype._insert=function(O,I){var j=this,N=new Y(O);if(this._first===Y.Undefined)this._first=N,this._last=N;else if(I){var P=this._last;this._last=N,N.prev=P,P.next=N}else{var R=this._first;this._first=N,N.next=R,R.prev=N}this._size+=1;var c=!1;return function(){c||(c=!0,j._remove(N))}},H.prototype.shift=function(){if(this._first===Y.Undefined)return;var O=this._first.element;return this._remove(this._first),O},H.prototype.pop=function(){if(this._last===Y.Undefined)return;var O=this._last.element;return this._remove(this._last),O},H.prototype._remove=function(O){if(O.prev!==Y.Undefined&&O.next!==Y.Undefined){var I=O.prev;I.next=O.next,O.next.prev=I}else O.prev===Y.Undefined&&O.next===Y.Undefined?(this._first=Y.Undefined,this._last=Y.Undefined):O.next===Y.Undefined?(this._last=this._last.prev,this._last.next=Y.Undefined):O.prev===Y.Undefined&&(this._first=this._first.next,this._first.prev=Y.Undefined);this._size-=1},H.prototype.iterator=function(){var O,I=this._first;return{next:function(){return I===Y.Undefined?ie.c:(O?O.value=I.element:O={done:!1,value:I.element},I=I.next,O)}}},H.prototype.toArray=function(){for(var O=[],I=this._first;I!==Y.Undefined;I=I.next)O.push(I.element);return O},H}()},"55Ip":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return o}),$.d(Me,"b",function(){return A});var ie=$("Ty5D"),Y=$("dI71"),M=$("q1tI"),H=$.n(M),O=$("YS25"),I=$("17x9"),j=$.n(I),N=$("wx14"),P=$("zLVn"),R=$("9R94"),c=function(x){Object(Y.a)(h,x);function h(){for(var D,S=arguments.length,w=new Array(S),b=0;b<S;b++)w[b]=arguments[b];return D=x.call.apply(x,[this].concat(w))||this,D.history=Object(O.a)(D.props),D}var u=h.prototype;return u.render=function(){return H.a.createElement(ie.c,{history:this.history,children:this.props.children})},h}(H.a.Component),f=function(x){Object(Y.a)(h,x);function h(){for(var D,S=arguments.length,w=new Array(S),b=0;b<S;b++)w[b]=arguments[b];return D=x.call.apply(x,[this].concat(w))||this,D.history=Object(O.b)(D.props),D}var u=h.prototype;return u.render=function(){return H.a.createElement(ie.c,{history:this.history,children:this.props.children})},h}(H.a.Component),_=function(h,u){return typeof h=="function"?h(u):h},p=function(h,u){return typeof h=="string"?Object(O.c)(h,null,null,u):h},m=function(h){return h},y=H.a.forwardRef;typeof y=="undefined"&&(y=m);function a(x){return!!(x.metaKey||x.altKey||x.ctrlKey||x.shiftKey)}var i=y(function(x,h){var u=x.innerRef,D=x.navigate,S=x.onClick,w=Object(P.a)(x,["innerRef","navigate","onClick"]),b=w.target,K=Object(N.a)({},w,{onClick:function(Q){try{S&&S(Q)}catch(V){throw Q.preventDefault(),V}!Q.defaultPrevented&&Q.button===0&&(!b||b==="_self")&&!a(Q)&&(Q.preventDefault(),D())}});return m!==y?K.ref=h||u:K.ref=u,H.a.createElement("a",K)}),o=y(function(x,h){var u=x.component,D=u===void 0?i:u,S=x.replace,w=x.to,b=x.innerRef,K=Object(P.a)(x,["component","replace","to","innerRef"]);return H.a.createElement(ie.e.Consumer,null,function(X){X||Object(R.a)(!1);var Q=X.history,V=p(_(w,X.location),X.location),W=V?Q.createHref(V):"",te=Object(N.a)({},K,{href:W,navigate:function(){var ge=_(w,X.location),Oe=S?Q.replace:Q.push;Oe(ge)}});return m!==y?te.ref=h||b:te.innerRef=b,H.a.createElement(D,te)})});if(!1)var l,C;var g=function(h){return h},v=H.a.forwardRef;typeof v=="undefined"&&(v=g);function L(){for(var x=arguments.length,h=new Array(x),u=0;u<x;u++)h[u]=arguments[u];return h.filter(function(D){return D}).join(" ")}var A=v(function(x,h){var u=x["aria-current"],D=u===void 0?"page":u,S=x.activeClassName,w=S===void 0?"active":S,b=x.activeStyle,K=x.className,X=x.exact,Q=x.isActive,V=x.location,W=x.sensitive,te=x.strict,ue=x.style,ge=x.to,Oe=x.innerRef,qe=Object(P.a)(x,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(ie.e.Consumer,null,function(Ke){Ke||Object(R.a)(!1);var Be=V||Ke.location,Xe=p(_(ge,Be),Be),Fe=Xe.pathname,xe=Fe&&Fe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),oe=xe?Object(ie.f)(Be.pathname,{path:xe,exact:X,sensitive:W,strict:te}):null,Re=!!(Q?Q(oe,Be):oe),dt=Re?L(K,w):K,at=Re?Object(N.a)({},ue,{},b):ue,ut=Object(N.a)({"aria-current":Re&&D||null,className:dt,style:at,to:Xe},qe);return g!==v?ut.ref=h||Oe:ut.innerRef=Oe,H.a.createElement(o,ut)})});if(!1)var T},"746U":function(Wt,Me,$){"use strict";$.d(Me,"d",function(){return Y}),$.d(Me,"j",function(){return M}),$.d(Me,"i",function(){return H}),$.d(Me,"h",function(){return O}),$.d(Me,"e",function(){return I}),$.d(Me,"k",function(){return j}),$.d(Me,"l",function(){return N}),$.d(Me,"a",function(){return P}),$.d(Me,"f",function(){return c}),$.d(Me,"g",function(){return f}),$.d(Me,"m",function(){return _}),$.d(Me,"c",function(){return y}),$.d(Me,"b",function(){return a}),$.d(Me,"n",function(){return i}),$.d(Me,"o",function(){return o});var ie={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function Y(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ie.number&&l.constructor===Array)}function M(l){return typeof l===ie.string||l instanceof String}function H(l){return typeof l===ie.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function O(l){return(typeof l===ie.number||l instanceof Number)&&!isNaN(l)}function I(l){return l===!0||l===!1}function j(l){return typeof l===ie.undefined}function N(l){return j(l)||l===null}function P(l,C){if(!l)throw new Error(C?"Unexpected type, expected '"+C+"'":"Unexpected type")}var R=Object.prototype.hasOwnProperty;function c(l){if(!H(l))return!1;for(var C in l)if(R.call(l,C))return!1;return!0}function f(l){return typeof l===ie.function}function _(l,C){for(var g=Math.min(l.length,C.length),v=0;v<g;v++)p(l[v],C[v])}function p(l,C){if(M(C)){if(typeof l!==C)throw new Error("argument does not match constraint: typeof "+C)}else if(f(C)){try{if(l instanceof C)return}catch(g){}if(!N(l)&&l.constructor===C)return;if(C.length===1&&C.call(void 0,l)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function m(l){for(var C=[],g=Object.getPrototypeOf(l);Object.prototype!==g;)C=C.concat(Object.getOwnPropertyNames(g)),g=Object.getPrototypeOf(g);return C}function y(l){for(var C=[],g=0,v=m(l);g<v.length;g++){var L=v[g];typeof l[L]=="function"&&C.push(L)}return C}function a(l,C){for(var g=function(x){return function(){var h=Array.prototype.slice.call(arguments,0);return C(x,h)}},v={},L=0,A=l;L<A.length;L++){var T=A[L];v[T]=g(T)}return v}function i(l){return l===null?void 0:l}function o(l){return typeof l=="undefined"?null:l}},"7Cbv":function(Wt,Me,$){"use strict";var ie=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function M(){if(!ie)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ie(Y)}var H=/^(?:[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 O(_){return typeof _=="string"&&H.test(_)}for(var I=O,j=[],N=0;N<256;++N)j.push((N+256).toString(16).substr(1));function P(_){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=(j[_[p+0]]+j[_[p+1]]+j[_[p+2]]+j[_[p+3]]+"-"+j[_[p+4]]+j[_[p+5]]+"-"+j[_[p+6]]+j[_[p+7]]+"-"+j[_[p+8]]+j[_[p+9]]+"-"+j[_[p+10]]+j[_[p+11]]+j[_[p+12]]+j[_[p+13]]+j[_[p+14]]+j[_[p+15]]).toLowerCase();if(!I(m))throw TypeError("Stringified UUID is invalid");return m}var R=P;function c(_,p,m){_=_||{};var y=_.random||(_.rng||M)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,p){m=m||0;for(var a=0;a<16;++a)p[m+a]=y[a];return p}return R(y)}var f=Me.a=c},"7ahc":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return C});var ie=$("k1fw"),Y=$("0Owb"),M=$("+L6B"),H=$("2/Rp"),O=$("y8nQ"),I=$("Vl3Y"),j=$("tJVT"),N=$("OaEy"),P=$("2fM7"),R=$("q1tI"),c=$.n(R),f=$("VrN/"),_=$.n(f),p=$("p77/"),m=$.n(p),y=$("c5Ni"),a=$.n(y),i=P.a.Option,o={labelCol:{span:4},wrapperCol:{span:20}},l={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"]};Me.b=function(g){var v=g.callback,L=g.onCancel,A=Object(R.useState)("python"),T=Object(j.a)(A,2),x=T[0],h=T[1];function u(S){h(l[S][1])}function D(S){v(S)}return c.a.createElement(I.a,Object(Y.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:D}),c.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(P.a,{onChange:u},Object.keys(l).map(function(S){return c.a.createElement(i,{key:S,value:S},l[S][0])}))),c.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(C,{mode:x})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(H.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function C(g){var v=g.value,L=g.onChange,A=g.mode,T=g.options,x=T===void 0?{}:T,h=Object(R.useRef)(),u=Object(R.useState)(),D=Object(j.a)(u,2),S=D[0],w=D[1];return Object(R.useEffect)(function(){if(S){function b(K){var X=K.getValue();L&&L(X)}return S.on("change",b),function(){S.off("change",b)}}},[S,L]),Object(R.useEffect)(function(){S&&S.setOption("mode",A)},[S,A]),Object(R.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(R.useEffect)(function(){if(h.current&&!S){var b=_.a.fromTextArea(h.current,Object(ie.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},x));w(b)}},[h.current,S]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:h}))}},"7qnI":function(Wt,Me,$){"use strict";var ie=$("5Dmo"),Y=$("3S7+"),M=$("fWQN"),H=$("mtLc"),O=$("yKVA"),I=$("879j"),j=$("5NDa"),N=$("5rEg"),P=$("q1tI"),R=$.n(P),c=$("O2Wb"),f=$.n(c),_=N.a.TextArea,p=function(m){Object(O.a)(a,m);var y=Object(I.a)(a);function a(){return Object(M.a)(this,a),y.apply(this,arguments)}return Object(H.a)(a,[{key:"render",value:function(){var o=this,l=this.props,C=l.index,g=l.onAnswerChange,v=l.addChildAnswer,L=l.exerciseIsPublish,A=l.answers,T=l.activeOptionErrorIndex,x=l.flex,h=x===void 0?"0 0 1000px":x;return R.a.createElement("div",{className:f.a.flex},R.a.createElement("div",{className:"".concat(f.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",C+1,"):"),R.a.createElement("div",{className:"".concat(f.a.flex," ").concat(f.a.flex1),style:{flexDirection:"column"}},A.map(function(u,D){var S="".concat(C,"-").concat(D);return R.a.createElement("div",{className:"".concat(f.a.flex," ").concat(f.a.flex1),key:D},R.a.createElement("div",{className:f.a.flex1,style:{flex:h}},R.a.createElement("div",null,R.a.createElement(_,{className:S===T?f.a.error:"",spellCheck:!1,rows:4,value:u||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(D==0?"":"(\u53EF\u9009)"),onChange:function(b){return g(C,D,b.target.value)},style:{minHeight:95}}))),!L&&R.a.createElement(R.a.Fragment,null,D!=0&&R.a.createElement(Y.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(f.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswer(C,D)},style:{float:"right"}})),D===0&&R.a.createElement(Y.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(f.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswermain(C,D)},style:{float:"right"}})),R.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},R.a.createElement("i",{className:"".concat(f.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return v(C)},style:{float:"right",visibility:D==A.length-1?"":"hidden"}}))))})))}}]),a}(P.Component);Me.a=p},"8EBN":function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){"use strict";ie.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Y=0;Y<ie.modeInfo.length;Y++){var M=ie.modeInfo[Y];M.mimes&&(M.mime=M.mimes[0])}ie.findModeByMIME=function(H){H=H.toLowerCase();for(var O=0;O<ie.modeInfo.length;O++){var I=ie.modeInfo[O];if(I.mime==H)return I;if(I.mimes){for(var j=0;j<I.mimes.length;j++)if(I.mimes[j]==H)return I}}if(/\+xml$/.test(H))return ie.findModeByMIME("application/xml");if(/\+json$/.test(H))return ie.findModeByMIME("application/json")},ie.findModeByExtension=function(H){H=H.toLowerCase();for(var O=0;O<ie.modeInfo.length;O++){var I=ie.modeInfo[O];if(I.ext){for(var j=0;j<I.ext.length;j++)if(I.ext[j]==H)return I}}},ie.findModeByFileName=function(H){for(var O=0;O<ie.modeInfo.length;O++){var I=ie.modeInfo[O];if(I.file&&I.file.test(H))return I}var j=H.lastIndexOf("."),N=j>-1&&H.substring(j+1,H.length);if(N)return ie.findModeByExtension(N)},ie.findModeByName=function(H){H=H.toLowerCase();for(var O=0;O<ie.modeInfo.length;O++){var I=ie.modeInfo[O];if(I.name.toLowerCase()==H)return I;if(I.alias){for(var j=0;j<I.alias.length;j++)if(I.alias[j].toLowerCase()==H)return I}}}})},"8HAY":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return I}),$.d(Me,"b",function(){return j});var ie=$("pmY6"),Y=$("MI8n"),M=function(){var N=function(P,R){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var _ in f)f.hasOwnProperty(_)&&(c[_]=f[_])},N(P,R)};return function(P,R){N(P,R);function c(){this.constructor=P}P.prototype=R===null?Object.create(R):(c.prototype=R.prototype,new c)}}(),H=function(N,P,R,c){function f(_){return _ instanceof R?_:new R(function(p){p(_)})}return new(R||(R=Promise))(function(_,p){function m(i){try{a(c.next(i))}catch(o){p(o)}}function y(i){try{a(c.throw(i))}catch(o){p(o)}}function a(i){i.done?_(i.value):f(i.value).then(m,y)}a((c=c.apply(N,P||[])).next())})},O=function(N,P){var R={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},c,f,_,p;return p={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function m(a){return function(i){return y([a,i])}}function y(a){if(c)throw new TypeError("Generator is already executing.");for(;R;)try{if(c=1,f&&(_=a[0]&2?f.return:a[0]?f.throw||((_=f.return)&&_.call(f),0):f.next)&&!(_=_.call(f,a[1])).done)return _;(f=0,_)&&(a=[a[0]&2,_.value]);switch(a[0]){case 0:case 1:_=a;break;case 4:return R.label++,{value:a[1],done:!1};case 5:R.label++,f=a[1],a=[0];continue;case 7:a=R.ops.pop(),R.trys.pop();continue;default:if(!(_=R.trys,_=_.length>0&&_[_.length-1])&&(a[0]===6||a[0]===2)){R=0;continue}if(a[0]===3&&(!_||a[1]>_[0]&&a[1]<_[3])){R.label=a[1];break}if(a[0]===6&&R.label<_[1]){R.label=_[1],_=a;break}if(_&&R.label<_[2]){R.label=_[2],R.ops.push(a);break}_[2]&&R.ops.pop(),R.trys.pop();continue}a=P.call(N,R)}catch(i){a=[6,i],f=0}finally{c=_=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},I=function(N){M(P,N);function P(R,c,f,_,p){c===void 0&&(c=""),f===void 0&&(f=""),_===void 0&&(_=!0);var m=N.call(this)||this;return m._onDidChange=m._register(new Y.a),m.onDidChange=m._onDidChange.event,m._enabled=!0,m._checked=!1,m._id=R,m._label=c,m._cssClass=f,m._enabled=_,m._actionCallback=p,m}return Object.defineProperty(P.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"label",{get:function(){return this._label},set:function(R){this._setLabel(R)},enumerable:!0,configurable:!0}),P.prototype._setLabel=function(R){this._label!==R&&(this._label=R,this._onDidChange.fire({label:R}))},Object.defineProperty(P.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(R){this._setTooltip(R)},enumerable:!0,configurable:!0}),P.prototype._setTooltip=function(R){this._tooltip!==R&&(this._tooltip=R,this._onDidChange.fire({tooltip:R}))},Object.defineProperty(P.prototype,"class",{get:function(){return this._cssClass},set:function(R){this._setClass(R)},enumerable:!0,configurable:!0}),P.prototype._setClass=function(R){this._cssClass!==R&&(this._cssClass=R,this._onDidChange.fire({class:R}))},Object.defineProperty(P.prototype,"enabled",{get:function(){return this._enabled},set:function(R){this._setEnabled(R)},enumerable:!0,configurable:!0}),P.prototype._setEnabled=function(R){this._enabled!==R&&(this._enabled=R,this._onDidChange.fire({enabled:R}))},Object.defineProperty(P.prototype,"checked",{get:function(){return this._checked},set:function(R){this._setChecked(R)},enumerable:!0,configurable:!0}),P.prototype._setChecked=function(R){this._checked!==R&&(this._checked=R,this._onDidChange.fire({checked:R}))},P.prototype.run=function(R,c){return this._actionCallback?this._actionCallback(R):Promise.resolve(!0)},P}(ie.a),j=function(N){M(P,N);function P(){var R=N!==null&&N.apply(this,arguments)||this;return R._onDidBeforeRun=R._register(new Y.a),R.onDidBeforeRun=R._onDidBeforeRun.event,R._onDidRun=R._register(new Y.a),R.onDidRun=R._onDidRun.event,R}return P.prototype.run=function(R,c){return H(this,void 0,void 0,function(){var f,_;return O(this,function(p){switch(p.label){case 0:if(!R.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:R}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.runAction(R,c)];case 2:return f=p.sent(),this._onDidRun.fire({action:R,result:f}),[3,4];case 3:return _=p.sent(),this._onDidRun.fire({action:R,error:_}),[3,4];case 4:return[2]}})})},P.prototype.runAction=function(R,c){var f=c?R.run(c):R.run();return Promise.resolve(f)},P}(ie.a)},"8hTe":function(Wt,Me,$){Wt.exports={button:"button___1wy9m"}},"9Bee":function(Wt,Me,$){"use strict";var ie=$("DYRE"),Y=$("zeV3"),M=$("+L6B"),H=$("2/Rp"),O=$("k1fw"),I=$("9og8"),j=$("tJVT"),N=$("WmNS"),P=$.n(N),R=$("q1tI"),c=$.n(R),f=$("vg9a"),_=$("DlQD"),p=$.n(_),m=$("rUJ1");function y(B,d){var E=B.match(/^(\s+)(?:```)/);if(E===null)return d;var F=E[1];return d.split(`
`).map(function(G){var U=G.match(/^\s+/);if(U===null)return G;var se=Object(j.a)(U,1),He=se[0];return He.length>=F.length?G.slice(F.length):G}).join(`
`)}var a=[],i=["<ul>"],o=new p.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){a.length=0,i=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(B,d,E,F){if(d>=B.length||B[d].level<=E)return d;var G=B[d];F.push("<li><a href='#"+G.anchor+"'>"+G.text+"</a>"),d++;var U=[];return d=v(B,d,G.level,U),U.length>0&&(F.push("<ul>"),U.forEach(function(se){F.push(se)}),F.push("</ul>")),F.push("</li>"),d=v(B,d,E,F),d}function L(){return v(a,0,0,i),i.push("</ul>"),i.join("")}var A={heading:function(d){var E=l.exec(d);if(E)return{type:"heading",raw:E[0],depth:E[1].length,text:E[2]}},fences:function(d){var E=this.rules.block.fences.exec(d);if(E){var F=E[0],G=y(F,E[3]||""),U=E[2]?E[2].trim():E[2];if(["latex","katex","math"].indexOf(U)>=0){var se=h(),He=G;G=se,u[se]={type:"block",expression:He}}return{type:"code",raw:F,lang:U,text:G}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,h=function(){return"__special_katext_id_".concat(x++,"__")},u={};function D(){return u}function S(){x=0,u={}}function w(B){return B=B.replace(T,function(d,E){var F=h();return u[F]={type:"inline",expression:E},F}),B}var b=o.listitem;o.listitem=function(B){return b(w(B))};var K=o.paragraph;o.paragraph=function(B){return K(w(B))};var X=o.tablecell;o.tablecell=function(B,d){return X(w(B),d)},o.code=function(B,d,E){var F=(d||"").match(/\S*/)[0];return F?["latex","katex","math"].indexOf(F)>=0?"<p class='editormd-tex'>".concat(B,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(d,'">').concat(E?B:Object(m.escape)(B,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(E?B:Object(m.escape)(B,!0))+"</code></pre>"},o.heading=function(B,d,E){var F=this.options.headerPrefix+E.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:F,level:d,text:B}),"<h"+d+' id="'+F+'">'+B+"</h"+d+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:A,renderer:o});var Q=p.a,V=$("SJMd"),W=$("ulZh"),te=$.n(W),ue=$("m3rI"),ge=$("Oy/b"),Oe=$("p5ED"),qe=$("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ke=function(B,d){return(Ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,F){E.__proto__=F}||function(E,F){for(var G in F)Object.prototype.hasOwnProperty.call(F,G)&&(E[G]=F[G])})(B,d)};function Be(B,d){function E(){this.constructor=B}Ke(B,d),B.prototype=d===null?Object.create(d):(E.prototype=d.prototype,new E)}function Xe(B,d,E,F){return new(E||(E=Promise))(function(G,U){function se(Ct){try{Ye(F.next(Ct))}catch(Ge){U(Ge)}}function He(Ct){try{Ye(F.throw(Ct))}catch(Ge){U(Ge)}}function Ye(Ct){var Ge;Ct.done?G(Ct.value):(Ge=Ct.value,Ge instanceof E?Ge:new E(function(yt){yt(Ge)})).then(se,He)}Ye((F=F.apply(B,d||[])).next())})}function Fe(B,d){var E,F,G,U,se={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return U={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(U[Symbol.iterator]=function(){return this}),U;function He(Ye){return function(Ct){return function(Ge){if(E)throw new TypeError("Generator is already executing.");for(;se;)try{if(E=1,F&&(G=2&Ge[0]?F.return:Ge[0]?F.throw||((G=F.return)&&G.call(F),0):F.next)&&!(G=G.call(F,Ge[1])).done)return G;switch(F=0,G&&(Ge=[2&Ge[0],G.value]),Ge[0]){case 0:case 1:G=Ge;break;case 4:return se.label++,{value:Ge[1],done:!1};case 5:se.label++,F=Ge[1],Ge=[0];continue;case 7:Ge=se.ops.pop(),se.trys.pop();continue;default:if(!(G=se.trys,(G=G.length>0&&G[G.length-1])||Ge[0]!==6&&Ge[0]!==2)){se=0;continue}if(Ge[0]===3&&(!G||Ge[1]>G[0]&&Ge[1]<G[3])){se.label=Ge[1];break}if(Ge[0]===6&&se.label<G[1]){se.label=G[1],G=Ge;break}if(G&&se.label<G[2]){se.label=G[2],se.ops.push(Ge);break}G[2]&&se.ops.pop(),se.trys.pop();continue}Ge=d.call(B,se)}catch(yt){Ge=[6,yt],F=0}finally{E=G=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Ye,Ct])}}}function xe(){for(var B=0,d=0,E=arguments.length;d<E;d++)B+=arguments[d].length;var F=Array(B),G=0;for(d=0;d<E;d++)for(var U=arguments[d],se=0,He=U.length;se<He;se++,G++)F[G]=U[se];return F}var oe=function(){function B(){}return B.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},B.setAttributes=function(d,E){for(var F=0,G=E;F<G.length;F++){var U=G[F],se=U[0],He=U[1];d.setAttribute(se,He)}},B.createRect=function(d,E,F){var G=document.createElementNS("http://www.w3.org/2000/svg","rect");return G.setAttribute("width",d.toString()),G.setAttribute("height",E.toString()),F&&B.setAttributes(G,F),G},B.createLine=function(d,E,F,G,U){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",d.toString()),se.setAttribute("y1",E.toString()),se.setAttribute("x2",F.toString()),se.setAttribute("y2",G.toString()),U&&B.setAttributes(se,U),se},B.createPolygon=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",d),E&&B.setAttributes(F,E),F},B.createCircle=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(d/2).toString()),F.setAttribute("cy",(d/2).toString()),F.setAttribute("r",d.toString()),E&&B.setAttributes(F,E),F},B.createEllipse=function(d,E,F){var G=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return G.setAttribute("cx",(d/2).toString()),G.setAttribute("cy",(E/2).toString()),G.setAttribute("rx",(d/2).toString()),G.setAttribute("ry",(E/2).toString()),F&&B.setAttributes(G,F),G},B.createGroup=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return d&&B.setAttributes(E,d),E},B.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},B.createMarker=function(d,E,F,G,U,se,He){var Ye=document.createElementNS("http://www.w3.org/2000/svg","marker");return B.setAttributes(Ye,[["id",d],["orient",E],["markerWidth",F.toString()],["markerHeight",G.toString()],["refX",U.toString()],["refY",se.toString()]]),Ye.appendChild(He),Ye},B.createText=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),d&&B.setAttributes(E,d),E},B.createTSpan=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=d,E&&B.setAttributes(F,E),F},B.createImage=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return d&&B.setAttributes(E,d),E},B.createPoint=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=d,F.y=E,F},B.createPath=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",d),E&&B.setAttributes(F,E),F},B}(),Re=function(){function B(){}return B.addKey=function(d){B.key=d},Object.defineProperty(B,"isLicensed",{get:function(){return!!B.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(B.key)},enumerable:!1,configurable:!0}),B}(),dt=function(){function B(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return B.prototype.rasterize=function(d,E,F){var G=this;return new Promise(function(U){var se=F!==void 0?F:document.createElement("canvas");d===null&&(G.markersOnly=!0,G.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",E.width.baseVal.valueAsString),He.setAttribute("height",E.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+E.viewBox.baseVal.width.toString()+" "+E.viewBox.baseVal.height.toString()),He.innerHTML=E.innerHTML,G.naturalSize===!0?(He.width.baseVal.value=d.naturalWidth,He.height.baseVal.value=d.naturalHeight):G.width!==void 0&&G.height!==void 0&&(He.width.baseVal.value=G.width,He.height.baseVal.value=G.height),se.width=He.width.baseVal.value,se.height=He.height.baseVal.value;var Ye=He.outerHTML,Ct=se.getContext("2d");G.markersOnly!==!0&&Ct.drawImage(d,0,0,se.width,se.height);var Ge=window.URL,yt=new Image(se.width,se.height);yt.setAttribute("crossOrigin","anonymous");var Qt=new Blob([Ye],{type:"image/svg+xml"}),Bn=Ge.createObjectURL(Qt);yt.onload=function(){Ct.drawImage(yt,0,0),Ge.revokeObjectURL(Bn);var er=se.toDataURL(G.imageType,G.imageQuality);U(er)},yt.src=Bn})},B}(),at=function(){},ut=function(){function B(d){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+d+"_"}return Object.defineProperty(B.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),B.prototype.addClass=function(d){return this.styleSheet===void 0&&this.addStyleSheet(),d.name=""+this.classNamePrefix+d.localName,this.classes.push(d),this.styleSheet.sheet.insertRule("."+d.name+" {"+d.style+"}",this.styleSheet.sheet.cssRules.length),d},B.prototype.addRule=function(d){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(d),this.styleSheet.sheet.insertRule(d.selector+" {"+d.style+"}",this.styleSheet.sheet.cssRules.length)},B.prototype.addStyleSheet=function(){var d;this.styleSheet=document.createElement("style"),((d=this.styleSheetRoot)!==null&&d!==void 0?d:document.head).appendChild(this.styleSheet),this.addRule(new ce("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ce("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ce("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new he("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new he("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},B.prototype.removeStyleSheet=function(){var d;this.styleSheet&&(((d=this.styleSheetRoot)!==null&&d!==void 0?d:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},B}(),ce=function(B,d){this.selector=B,this.style=d},he=function(B,d){this.localName=B,this.style=d},Le=function(){function B(d,E,F,G,U){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=d,this.displayMode=E,this.markerItems=F,this.uiStyleSettings=G,this.styles=U,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return B.prototype.show=function(d){var E=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=d,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",this.uiContainer.appendChild(F),this.addActionButton(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(U){var se=document.createElement("div");se.className=""+E.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",U.typeName),se.innerHTML=U.icon,se.addEventListener("click",function(){E.markerToolbarButtonClicked(se,U)}),E.buttons.push(se),E.markerButtons.push(se)}),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 G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",G.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(G),this.addActionButton(G,'<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(G,'<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()},B.prototype.addButtonClickListener=function(d){this.buttonClickListeners.push(d)},B.prototype.removeButtonClickListener=function(d){this.buttonClickListeners.indexOf(d)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(d),1)},B.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},B.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var d=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var E=0;E<this.markerButtons.length;E++)E<d||E===d&&this.markerButtons.length-1===d?this.markerButtonBlock.appendChild(this.markerButtons[E]):(E===d&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[E]))}},B.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")},B.prototype.resetButtonStyles=function(){var d=this;this.buttons.forEach(function(E){E.className=E.className.replace(d.uiStyleSettings.toolbarButtonStyleColorsClassName?d.uiStyleSettings.toolbarButtonStyleColorsClassName:d.toolbarButtonStyleColorsClass.name,"").trim(),E.className=E.className.replace(d.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?d.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:d.toolbarActiveButtonStyleColorsClass.name,"").trim(),E.className+=" "+(d.uiStyleSettings.toolbarButtonStyleColorsClassName?d.uiStyleSettings.toolbarButtonStyleColorsClassName:d.toolbarButtonStyleColorsClass.name)})},B.prototype.addActionButton=function(d,E,F){var G=this,U=document.createElement("div");switch(U.className=""+this.toolbarButtonStyleClass.name,U.innerHTML=E,U.setAttribute("data-action",F),U.addEventListener("click",function(){G.actionToolbarButtonClicked(U,F)}),F){case"select":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":U.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":U.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":U.style.fill=this.uiStyleSettings.closeButtonColor}d.appendChild(U),this.buttons.push(U)},B.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new he("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 he("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new he("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new he("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 he("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var d=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new he("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*d)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*d)+`px;
padding: `+d+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new he("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new he("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ce("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ce("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},B.prototype.markerToolbarButtonClicked=function(d,E){this.setActiveButton(d),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("marker",E)}),this.markerButtonOverflowBlock.style.display="none"},B.prototype.actionToolbarButtonClicked=function(d,E){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("action",E)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},B.prototype.setActiveButton=function(d){this.resetButtonStyles(),d.className=d.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),d.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},B.prototype.setActiveMarkerButton=function(d){var E=this.markerButtons.find(function(F){return F.getAttribute("data-type-name")===d});E&&this.setActiveButton(E)},B.prototype.setCurrentMarker=function(d){var E=this;this.currentMarker=d,this.buttons.filter(function(F){return/delete|notes/.test(F.getAttribute("data-action"))}).forEach(function(F){E.currentMarker===void 0?(F.style.fillOpacity="0.4",F.style.pointerEvents="none"):(F.style.fillOpacity="1",F.style.pointerEvents="all")})},B}(),Ve=function(){function B(d,E,F,G){this.panels=[],this.panelButtons=[],this.markerjsContainer=d,this.displayMode=E,this.uiStyleSettings=F,this.styles=G,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return B.prototype.addStyles=function(){var d;this.toolboxStyleClass=this.styles.addClass(new he("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 he("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var E=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new he("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new he("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new he("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 he("toolbox-panel-row_colors",`
background-color: `+((d=this.uiStyleSettings.toolboxBackgroundColor)!==null&&d!==void 0?d:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new he("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
padding: `+E+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new he("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new he("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ce("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ce("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},B.prototype.show=function(d){var E;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=d,this.uiContainer.className=this.toolboxStyleClass.name+" "+((E=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},B.prototype.setPanelButtons=function(d){var E,F,G=this;this.panels=d,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((E=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(U){var se;U.uiStyleSettings=G.uiStyleSettings;var He=document.createElement("div");He.className=G.toolboxButtonStyleClass.name+" "+((se=G.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:G.toolboxButtonStyleColorsClass.name),He.innerHTML=U.icon,He.title=U.title,He.addEventListener("click",function(){G.panelButtonClick(U)}),G.panelButtons.push(He),G.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},B.prototype.panelButtonClick=function(d){var E=this,F=-1;if(d!==this.activePanel){F=this.panels.indexOf(d),this.panelRow.innerHTML="";var G=d.getUi();G.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(G),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=d}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){E.displayMode==="inline"?E.panelRow.style.display="none":E.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(U,se){var He,Ye;U.className=E.toolboxButtonStyleClass.name+" "+(se===F?""+((He=E.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:E.toolboxActiveButtonStyleColorsClass.name):""+((Ye=E.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ye!==void 0?Ye:E.toolboxButtonStyleColorsClass.name))})},B}(),et=function(B,d){this.title=B,this.icon=d},tt=function(B){function d(E,F,G,U){var se=B.call(this,E,U||'<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 se.colors=[],se.addTransparent=!1,se.colorBoxes=[],se.colors=F,se.currentColor=G,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.whiteSpace="nowrap",this.colors.forEach(function(G){var U=E.getColorBox(G);F.appendChild(U),E.colorBoxes.push(U)}),F},d.prototype.getColorBox=function(E){var F=this,G=this.uiStyleSettings.toolbarHeight/4,U=this.uiStyleSettings.toolbarHeight-G,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=U-2+"px",se.style.height=U-2+"px",se.style.padding="1px",se.style.marginRight="2px",se.style.marginBottom="2px",se.style.borderWidth="2px",se.style.borderStyle="solid",se.style.borderRadius=(U+2)/2+"px",se.style.borderColor=E===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){F.setCurrentColor(E,se)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=U-2+"px",He.style.height=U-2+"px",He.style.backgroundColor=E,He.style.borderRadius=U/2+"px",E==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.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>`),se.appendChild(He),se},d.prototype.setCurrentColor=function(E,F){var G=this;this.currentColor=E,this.colorBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(E)},d}(et),rt=function(){function B(d,E,F){this._state="new",this._isSelected=!1,this._container=d,this._overlayContainer=E,this.globalSettings=F,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(B.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),B.prototype.ownsTarget=function(d){return!1},Object.defineProperty(B.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),B.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},B.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},B.prototype.pointerDown=function(d,E){},B.prototype.dblClick=function(d,E){},B.prototype.manipulate=function(d){},B.prototype.pointerUp=function(d){this.stateChanged()},B.prototype.dispose=function(){},B.prototype.addMarkerVisualToContainer=function(d){this.container.childNodes.length>0?this.container.insertBefore(d,this.container.childNodes[0]):this.container.appendChild(d)},B.prototype.getState=function(){return{typeName:B.typeName,state:this.state,notes:this.notes}},B.prototype.restoreState=function(d){this._state=d.state,this.notes=d.notes},B.prototype.scale=function(d,E){},B.prototype.colorChanged=function(d){this.onColorChanged&&this.onColorChanged(d),this.stateChanged()},B.prototype.fillColorChanged=function(d){this.onFillColorChanged&&this.onFillColorChanged(d),this.stateChanged()},B.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var d=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),d.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(d)&&this.onStateChanged(this)}},B.typeName="MarkerBase",B}(),it=function(){function B(){this.findGripByVisual=this.findGripByVisual.bind(this)}return B.prototype.findGripByVisual=function(d){return this.topLeft.ownsTarget(d)?this.topLeft:this.topCenter.ownsTarget(d)?this.topCenter:this.topRight.ownsTarget(d)?this.topRight:this.centerLeft.ownsTarget(d)?this.centerLeft:this.centerRight.ownsTarget(d)?this.centerRight:this.bottomLeft.ownsTarget(d)?this.bottomLeft:this.bottomCenter.ownsTarget(d)?this.bottomCenter:this.bottomRight.ownsTarget(d)?this.bottomRight:void 0},B}(),Dt=function(){function B(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return B.prototype.ownsTarget=function(d){return d===this.visual||d===this.visual.childNodes[0]||d===this.visual.childNodes[1]},B}(),Et=function(){function B(){}return B.toITransformMatrix=function(d){return{a:d.a,b:d.b,c:d.c,d:d.d,e:d.e,f:d.f}},B.toSVGMatrix=function(d,E){return d.a=E.a,d.b=E.b,d.c=E.c,d.d=E.d,d.e=E.e,d.f=E.f,d},B}(),xt=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.left=0,U.top=0,U.width=0,U.height=0,U.defaultSize={x:50,y:20},U.offsetX=0,U.offsetY=0,U.rotationAngle=0,U.CB_DISTANCE=10,U._suppressMarkerCreateEvent=!1,U.container.transform.baseVal.appendItem(oe.createTransform()),U.setupControlBox(),U}return Be(d,B),Object.defineProperty(d.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"visual",{get:function(){return this._visual},set:function(E){this._visual=E;var F=oe.createTransform();this._visual.transform.baseVal.appendItem(F)},enumerable:!1,configurable:!0}),d.prototype.ownsTarget=function(E){return!!B.prototype.ownsTarget.call(this,E)||!!(this.controlGrips.findGripByVisual(E)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(E))},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="new"&&(this.left=E.x,this.top=E.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var G=this.unrotatePoint(E);if(this.manipulationStartX=G.x,this.manipulationStartY=G.y,this.offsetX=G.x-this.left,this.offsetY=G.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(F),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F)){this.activeGrip=this.rotatorGrip;var U=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=U.x-this.width/2,this.top=U.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var se=this.container.transform.baseVal.getItem(0);se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},d.prototype.pointerUp=function(E){var F=this.state;B.prototype.pointerUp.call(this,E),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(E),this._state="select",F==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},d.prototype.moveVisual=function(E){this.visual.style.transform="translate("+E.x+"px, "+E.y+"px)"},d.prototype.manipulate=function(E){var F=this.unrotatePoint(E);this.state==="creating"?this.resize(E):this.state==="move"?(this.left=this.manipulationStartLeft+(F.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(F.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(F):this.state==="rotate"&&this.rotate(E)},d.prototype.resize=function(E){var F=this.manipulationStartLeft,G=this.manipulationStartWidth,U=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:F=this.manipulationStartLeft+E.x-this.manipulationStartX,G=this.manipulationStartWidth+this.manipulationStartLeft-F;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:G=this.manipulationStartWidth+E.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:U=this.manipulationStartTop+E.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-U;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+E.y-this.manipulationStartY}G>=0?(this.left=F,this.width=G):(this.left=F+G,this.width=-G),se>=0?(this.top=U,this.height=se):(this.top=U+se,this.height=-se),this.setSize()},d.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},d.prototype.rotate=function(E){if(Math.abs(E.x-this.centerX)>.1){var F=Math.sign(E.x-this.centerX);this.rotationAngle=180*Math.atan((E.y-this.centerY)/(E.x-this.centerX))/Math.PI+90*F,this.applyRotation()}},d.prototype.applyRotation=function(){var E=this.container.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(E,0)},d.prototype.rotatePoint=function(E){if(this.rotationAngle===0)return E;var F=this.container.getCTM(),G=oe.createPoint(E.x,E.y);return{x:(G=G.matrixTransform(F)).x,y:G.y}},d.prototype.unrotatePoint=function(E){if(this.rotationAngle===0)return E;var F=this.container.getCTM();F=F.inverse();var G=oe.createPoint(E.x,E.y);return{x:(G=G.matrixTransform(F)).x,y:G.y}},d.prototype.select=function(){B.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},d.prototype.deselect=function(){B.prototype.deselect.call(this),this.controlBox.style.display="none"},d.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var E=oe.createTransform();E.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(E),this.container.appendChild(this.controlBox),this.controlRect=oe.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=oe.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 it,this.addControlGrips(),this.controlBox.style.display="none"},d.prototype.adjustControlBox=function(){var E=this.controlBox.transform.baseVal.getItem(0);E.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(E,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()},d.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()},d.prototype.createGrip=function(){var E=new Dt;return E.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(E.visual),E},d.prototype.positionGrips=function(){var E=this.controlGrips.topLeft.GRIP_SIZE,F=-E/2,G=F,U=(this.width+this.CB_DISTANCE)/2-E/2,se=(this.height+this.CB_DISTANCE)/2-E/2,He=this.height+this.CB_DISTANCE-E/2,Ye=this.width+this.CB_DISTANCE-E/2;this.positionGrip(this.controlGrips.topLeft.visual,F,G),this.positionGrip(this.controlGrips.topCenter.visual,U,G),this.positionGrip(this.controlGrips.topRight.visual,Ye,G),this.positionGrip(this.controlGrips.centerLeft.visual,F,se),this.positionGrip(this.controlGrips.centerRight.visual,Ye,se),this.positionGrip(this.controlGrips.bottomLeft.visual,F,He),this.positionGrip(this.controlGrips.bottomCenter.visual,U,He),this.positionGrip(this.controlGrips.bottomRight.visual,Ye,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,U,G-3*this.CB_DISTANCE)},d.prototype.positionGrip=function(E,F,G){var U=E.transform.baseVal.getItem(0);U.setTranslate(F,G),E.transform.baseVal.replaceItem(U,0)},d.prototype.hideControlBox=function(){this.controlBox.style.display="none"},d.prototype.showControlBox=function(){this.controlBox.style.display=""},d.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Et.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Et.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},B.prototype.getState.call(this))},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E);var F=E;this.left=F.left,this.top=F.top,this.width=F.width,this.height=F.height,this.rotationAngle=F.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,F.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,F.containerTransformMatrix))},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F);var G=this.rotatePoint({x:this.left,y:this.top}),U=this.unrotatePoint({x:G.x*E,y:G.y*F});this.left=U.x,this.top=U.y,this.width=this.width*E,this.height=this.height*F,this.adjustControlBox()},d}(rt),ct=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.createVisual=U.createVisual.bind(U),U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.visual)},d.prototype.createVisual=function(){this.visual=oe.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)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},d.prototype.manipulate=function(E){B.prototype.manipulate.call(this,E)},d.prototype.resize=function(E){B.prototype.resize.call(this,E),this.setSize()},d.prototype.setSize=function(){B.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},d.prototype.pointerUp=function(E){B.prototype.pointerUp.call(this,E),this.setSize()},d.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},d.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},d.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},d.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},d.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},B.prototype.getState.call(this))},d.prototype.restoreState=function(E){var F=E;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),B.prototype.restoreState.call(this,E),this.setSize()},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.setSize()},d.title="Rectangle marker",d}(xt),Ft=function(B){function d(E,F,G,U){var se=B.call(this,E,U||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return se.widths=[],se.widthBoxes=[],se.widths=F,se.currentWidth=G,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.widths.forEach(function(G){var U=document.createElement("div");U.style.display="flex",U.style.flexGrow="2",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=G===E.currentWidth?E.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){E.setCurrentWidth(G,U)}),F.appendChild(U);var se=document.createElement("div");se.innerText=G.toString(),se.style.marginRight="5px",U.appendChild(se);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var Ye=document.createElement("hr");Ye.style.minWidth="20px",Ye.style.border="0px",Ye.style.borderTop=G+"px solid "+E.uiStyleSettings.toolboxColor,Ye.style.flexGrow="2",He.appendChild(Ye),U.appendChild(He),E.widthBoxes.push(U)}),F},d.prototype.setCurrentWidth=function(E,F){var G=this;this.currentWidth=E,this.widthBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},d}(et),wt=function(B){function d(E,F,G,U){var se=B.call(this,E,U||'<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 se.styles=[],se.styleBoxes=[],se.styles=F,se.currentStyle=G,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.styles.forEach(function(G){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/E.styles.length-5+"%",U.style.borderColor=G===E.currentStyle?E.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){E.setCurrentStyle(G,U)}),F.appendChild(U);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+E.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(G!==""?'stroke-dasharray="'+G+'"':"")+` />
</svg>`;se.innerHTML=He,U.appendChild(se),E.styleBoxes.push(U)}),F},d.prototype.setCurrentStyle=function(E,F){var G=this;this.currentStyle=E,this.styleBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},d}(et),Pt=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.strokeColor=G.defaultColor,U.strokeWidth=G.defaultStrokeWidth,U.strokeDasharray=G.defaultStrokeDasharray,U.strokePanel=new tt("Line color",G.defaultColorSet,G.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new Ft("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new wt("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return Be(d,B),Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=B.prototype.getState.call(this);return E.typeName=d.typeName,E},d.typeName="FrameMarker",d.title="Frame marker",d.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',d}(ct),We=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},gt=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.x1=0,U.y1=0,U.x2=0,U.y2=0,U.defaultLength=50,U.manipulationStartX=0,U.manipulationStartY=0,U.manipulationStartX1=0,U.manipulationStartY1=0,U.manipulationStartX2=0,U.manipulationStartY2=0,U.setupControlBox(),U}return Be(d,B),d.prototype.ownsTarget=function(E){return!!B.prototype.ownsTarget.call(this,E)||!(!this.grip1.ownsTarget(E)&&!this.grip2.ownsTarget(E))},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.manipulationStartX=E.x,this.manipulationStartY=E.y,this.state==="new"&&(this.x1=E.x,this.y1=E.y,this.x2=E.x,this.y2=E.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(F)?this.activeGrip=this.grip1:this.grip2.ownsTarget(F)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},d.prototype.pointerUp=function(E){var F=this.state;B.prototype.pointerUp.call(this,E),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(E),this._state="select",F==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},d.prototype.adjustVisual=function(){},d.prototype.manipulate=function(E){this.state==="creating"?this.resize(E):this.state==="move"?(this.x1=this.manipulationStartX1+E.x-this.manipulationStartX,this.y1=this.manipulationStartY1+E.y-this.manipulationStartY,this.x2=this.manipulationStartX2+E.x-this.manipulationStartX,this.y2=this.manipulationStartY2+E.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(E)},d.prototype.resize=function(E){switch(this.activeGrip){case this.grip1:this.x1=E.x,this.y1=E.y;break;case this.grip2:case void 0:this.x2=E.x,this.y2=E.y}this.adjustVisual(),this.adjustControlBox()},d.prototype.select=function(){B.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},d.prototype.deselect=function(){B.prototype.deselect.call(this),this.controlBox.style.display="none"},d.prototype.setupControlBox=function(){this.controlBox=oe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},d.prototype.adjustControlBox=function(){this.positionGrips()},d.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},d.prototype.createGrip=function(){var E=new Dt;return E.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(E.visual),E},d.prototype.positionGrips=function(){var E=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-E/2,this.y1-E/2),this.positionGrip(this.grip2.visual,this.x2-E/2,this.y2-E/2)},d.prototype.positionGrip=function(E,F,G){var U=E.transform.baseVal.getItem(0);U.setTranslate(F,G),E.transform.baseVal.replaceItem(U,0)},d.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},B.prototype.getState.call(this))},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E);var F=E;this.x1=F.x1,this.y1=F.y1,this.x2=F.x2,this.y2=F.y2},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.x1=this.x1*E,this.y1=this.y1*F,this.x2=this.x2*E,this.y2=this.y2*F,this.adjustVisual(),this.adjustControlBox()},d}(rt),Ut=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.strokeColor=G.defaultColor,U.strokeWidth=G.defaultStrokeWidth,U.strokeDasharray=G.defaultStrokeDasharray,U.strokePanel=new tt("Line color",G.defaultColorSet,G.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new Ft("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new wt("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorLine&&E!==this.visibleLine)},d.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.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)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},d.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()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},d.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},d.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},d.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E);var F=E;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.createVisual(),this.adjustVisual()},d.typeName="LineMarker",d.title="Line marker",d.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',d}(gt),Qe=function(B){function d(E,F,G,U){var se=B.call(this,E,U||'<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 se.fonts=[],se.fontBoxes=[],se.fonts=F,se.currentFont=G,se.setCurrentFont=se.setCurrentFont.bind(se),se}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.flexGrow="2",this.fonts.forEach(function(G){var U=document.createElement("div");U.style.display="inline-block",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/E.fonts.length-5+"%",U.style.borderColor=G===E.currentFont?E.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){E.setCurrentFont(G,U)}),F.appendChild(U);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=G,se.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(He),U.appendChild(se),E.fontBoxes.push(U)}),F},d.prototype.setCurrentFont=function(E,F){var G=this;this.currentFont=E,this.fontBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},d}(et),ot=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.color="transparent",U.padding=5,U.DEFAULT_TEXT="your text here",U.text=U.DEFAULT_TEXT,U.isMoved=!1,U.color=G.defaultColor,U.fontFamily=G.defaultFontFamily,U.defaultSize={x:100,y:30},U.setColor=U.setColor.bind(U),U.setFont=U.setFont.bind(U),U.renderText=U.renderText.bind(U),U.sizeText=U.sizeText.bind(U),U.textEditDivClicked=U.textEditDivClicked.bind(U),U.showTextEditor=U.showTextEditor.bind(U),U.setSize=U.setSize.bind(U),U.positionTextEditor=U.positionTextEditor.bind(U),U.colorPanel=new tt("Color",G.defaultColorSet,G.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.fontFamilyPanel=new Qe("Font",G.defaultFontFamilies,G.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U}return Be(d,B),d.prototype.ownsTarget=function(E){if(B.prototype.ownsTarget.call(this,E)||E===this.visual||E===this.textElement||E===this.bgRectangle)return!0;var F=!1;return this.textElement.childNodes.forEach(function(G){G===E&&(F=!0)}),F},d.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},d.prototype.renderText=function(){var E=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(F){E.textElement.appendChild(oe.createTSpan(F.trim()===""?" ":F.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},d.prototype.getTextScale=function(){var E=this.textElement.getBBox(),F=1;if(E.width>0&&E.height>0){var G=(1*this.width-this.width*this.padding*2/100)/E.width,U=(1*this.height-this.height*this.padding*2/100)/E.height;F=Math.min(G,U)}return F},d.prototype.getTextPosition=function(E){var F=this.textElement.getBBox(),G=0,U=0;return F.width>0&&F.height>0&&(G=(this.width-F.width*E)/2,U=this.height/2-F.height*E/2),{x:G,y:U}},d.prototype.sizeText=function(){var E=this.textElement.getBBox(),F=this.getTextScale(),G=this.getTextPosition(F);G.y-=E.y*F,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+G.x+"px, "+G.y+"px) scale("+F+", "+F+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(G.x,G.y),this.textElement.transform.baseVal.getItem(1).setScale(F,F))},d.prototype.manipulate=function(E){B.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},d.prototype.resize=function(E){B.prototype.resize.call(this,E),this.isMoved=!0,this.setSize(),this.sizeText()},d.prototype.setSize=function(){B.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},d.prototype.pointerUp=function(E){var F=this.state;F==="creating"&&(this._suppressMarkerCreateEvent=!0),B.prototype.pointerUp.call(this,E),this.setSize(),(F==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},d.prototype.showTextEditor=function(){var E=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(F){F.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var F=Number.parseFloat(E.textEditor.style.fontSize);E.textEditor.clientWidth>=Number.parseInt(E.textEditor.style.maxWidth)&&F>.9;)F-=.1,E.textEditor.style.fontSize=Math.max(F,.9)+"em"}),this.textEditor.addEventListener("keyup",function(F){F.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(F){if(F.clipboardData){var G=F.clipboardData.getData("text"),U=window.getSelection();if(!U.rangeCount)return!1;U.deleteFromDocument(),U.getRangeAt(0).insertNode(document.createTextNode(G)),F.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){E.textEditDivClicked(E.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},d.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var E=this.getTextScale(),F=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),G=this.textElement.getBBox(),U={x:G.width*E,y:G.height*E};F.x-=U.x/2,F.y-=U.y/2,this.textEditor.style.top=F.y+"px",this.textEditor.style.left=F.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-F.x+"px",this.textEditor.style.fontSize=Math.max(16*E,12)+"px",this.textElement.style.display="none"}},d.prototype.textEditDivClicked=function(E){this.text=E.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},d.prototype.select=function(){B.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},d.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),B.prototype.deselect.call(this)},d.prototype.dblClick=function(E,F){B.prototype.dblClick.call(this,E,F),this.showTextEditor()},d.prototype.setColor=function(E){this.textElement&&oe.setAttributes(this.textElement,[["fill",E]]),this.color=E,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(E)},d.prototype.setFont=function(E){this.textElement&&oe.setAttributes(this.textElement,[["font-family",E]]),this.fontFamily=E,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},d.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},d.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){var F=E;this.color=F.color,this.fontFamily=F.fontFamily,this.padding=F.padding,this.text=F.text,this.createVisual(),B.prototype.restoreState.call(this,E),this.setSize()},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.setSize(),this.sizeText(),this.positionTextEditor()},d.typeName="TextMarker",d.title="Text marker",d.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>',d}(xt),Ae=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.color="transparent",U.lineWidth=3,U.drawing=!1,U.pixelRatio=1,U.color=G.defaultColor,U.lineWidth=G.defaultStrokeWidth,U.pixelRatio=G.freehandPixelRatio,U.setColor=U.setColor.bind(U),U.addCanvas=U.addCanvas.bind(U),U.finishCreation=U.finishCreation.bind(U),U.setLineWidth=U.setLineWidth.bind(U),U.colorPanel=new tt("Color",G.defaultColorSet,G.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.lineWidthPanel=new Ft("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),U.lineWidthPanel.onWidthChanged=U.setLineWidth,U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.drawingImage)},d.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var E=oe.createTransform();this.visual.transform.baseVal.appendItem(E),this.addMarkerVisualToContainer(this.visual)},d.prototype.pointerDown=function(E,F){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(E.x,E.y),this.drawing=!0):B.prototype.pointerDown.call(this,E,F)},d.prototype.manipulate=function(E){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(E.x,E.y),this.canvasContext.stroke()):B.prototype.manipulate.call(this,E)},d.prototype.resize=function(E){B.prototype.resize.call(this,E),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},d.prototype.pointerUp=function(E){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):B.prototype.pointerUp.call(this,E)},d.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)},d.prototype.select=function(){this.state==="creating"&&this.finishCreation(),B.prototype.select.call(this)},d.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),B.prototype.deselect.call(this)},d.prototype.finishCreation=function(){for(var E=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),F=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],G=F[0],U=F[1],se=F[2],He=F[3],Ye=!1,Ct=0;Ct<this.canvasElement.height;Ct++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)E.data[Ct*this.canvasElement.width*4+4*Ge+3]>0&&(Ye=!0,Ct<U&&(U=Ct),Ge<G&&(G=Ge),Ct>He&&(He=Ct),Ge>se&&(se=Ge));if(Ye){this.left=G/this.pixelRatio,this.top=U/this.pixelRatio,this.width=(se-G)/this.pixelRatio,this.height=(He-U)/this.pixelRatio;var yt=document.createElement("canvas");yt.width=se-G,yt.height=He-U,yt.getContext("2d").putImageData(this.canvasContext.getImageData(G,U,se-G,He-U),0,0),this.drawingImgUrl=yt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},d.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},d.prototype.setColor=function(E){this.color=E,this.colorChanged(E)},d.prototype.setLineWidth=function(E){this.lineWidth=E},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({drawingImgUrl:this.drawingImgUrl},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){this.createVisual(),B.prototype.restoreState.call(this,E),this.drawingImgUrl=E.drawingImgUrl,this.setDrawingImage()},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.setDrawingImage()},d.typeName="FreehandMarker",d.title="Freehand marker",d.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>',d}(xt),be=function(B){function d(E,F,G){var U=B.call(this,E,G||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return U.typeBoxes=[],U.currentType=F,U.setCurrentType=U.setCurrentType.bind(U),U}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2";for(var G=function(He){var Ye="both";switch(He){case 0:Ye="both";break;case 1:Ye="start";break;case 2:Ye="end";break;case 3:Ye="none"}var Ct=document.createElement("div");if(Ct.style.display="flex",Ct.style.flexGrow="2",Ct.style.alignItems="center",Ct.style.justifyContent="space-between",Ct.style.padding="5px",Ct.style.borderWidth="2px",Ct.style.borderStyle="solid",Ct.style.borderColor=Ye===U.currentType?U.uiStyleSettings.toolboxAccentColor:"transparent",Ct.addEventListener("click",function(){E.setCurrentType(Ye,Ct)}),F.appendChild(Ct),Ye==="both"||Ye==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.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="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",Ct.appendChild(Ge)}var yt=document.createElement("div");yt.style.display="flex",yt.style.alignItems="center",yt.style.minHeight="20px",yt.style.flexGrow="2";var Qt=document.createElement("hr");if(Qt.style.minWidth="20px",Qt.style.border="0px",Qt.style.borderTop="3px solid "+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee"),Qt.style.flexGrow="2",yt.appendChild(Qt),Ct.appendChild(yt),Ye==="both"||Ye==="end"){var Bn=document.createElement("div");Bn.style.display="flex",Bn.style.alignItems="center",Bn.style.minHeight="20px",Bn.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="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Bn.style.marginRight="5px",Ct.appendChild(Bn)}U.typeBoxes.push(Ct)},U=this,se=0;se<4;se++)G(se);return F},d.prototype.setCurrentType=function(E,F){var G=this;this.currentType=E,this.typeBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},d}(et),Se=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.arrowType="end",U.arrowBaseHeight=10,U.arrowBaseWidth=10,U.getArrowPoints=U.getArrowPoints.bind(U),U.setArrowType=U.setArrowType.bind(U),U.arrowTypePanel=new be("Arrow type","end"),U.arrowTypePanel.onArrowTypeChanged=U.setArrowType,U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.arrow1&&E!==this.arrow2)},d.prototype.getArrowPoints=function(E,F){var G=this.arrowBaseWidth+2*this.strokeWidth,U=this.arrowBaseHeight+2*this.strokeWidth;return E-G/2+","+(F+U/2)+" "+E+","+(F-U/2)+" "+(E+G/2)+","+(F+U/2)},d.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="creating"&&this.createTips()},d.prototype.adjustVisual=function(){if(B.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",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.arrow1.transform.baseVal.getItem(0);F.setRotate(E,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(F,0);var G=this.arrow2.transform.baseVal.getItem(0);G.setRotate(E+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(G,0)}},d.prototype.setArrowType=function(E){this.arrowType=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({arrowType:this.arrowType},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E);var F=E;this.arrowType=F.arrowType,this.createTips(),this.adjustVisual()},d.typeName="ArrowMarker",d.title="Arrow marker",d.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',d}(Ut),re=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.fillColor=G.defaultFillColor,U.strokeWidth=0,U.fillPanel=new tt("Color",G.defaultColorSet,G.defaultFillColor),U.fillPanel.onColorChanged=U.setFillColor,U}return Be(d,B),Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=B.prototype.getState.call(this);return E.typeName=d.typeName,E},d.typeName="CoverMarker",d.title="Cover marker",d.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',d}(ct),ae=function(B){function d(E,F,G,U){var se=B.call(this,E,U||'<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 se.opacities=[],se.opacityBoxes=[],se.opacities=F,se.currentOpacity=G,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return Be(d,B),d.prototype.getUi=function(){var E=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",F.style.justifyContent="space-between",this.opacities.forEach(function(G){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="center",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=G===E.currentOpacity?E.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){E.setCurrentOpacity(G,U)}),F.appendChild(U);var se=document.createElement("div");se.innerText=100*G+"%",U.appendChild(se),E.opacityBoxes.push(U)}),F},d.prototype.setCurrentOpacity=function(E,F){var G=this;this.currentOpacity=E,this.opacityBoxes.forEach(function(U){U.style.borderColor=U===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},d}(et),fe=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.setOpacity=U.setOpacity.bind(U),U.fillColor=G.defaultHighlightColor,U.strokeWidth=0,U.opacity=G.defaultHighlightOpacity,U.fillPanel=new tt("Color",G.defaultColorSet,U.fillColor),U.fillPanel.onColorChanged=U.setFillColor,U.opacityPanel=new ae("Opacity",G.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return Be(d,B),d.prototype.setOpacity=function(E){this.opacity=E,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=B.prototype.getState.call(this);return E.typeName=d.typeName,E},d.typeName="HighlightMarker",d.title="Highlight marker",d.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>',d}(re),Ee='<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>',je=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.bgColor="transparent",U.tipPosition={x:0,y:0},U.tipBase1Position={x:0,y:0},U.tipBase2Position={x:0,y:0},U.tipMoving=!1,U.color=G.defaultStrokeColor,U.bgColor=G.defaultFillColor,U.fontFamily=G.defaultFontFamily,U.defaultSize={x:100,y:30},U.setBgColor=U.setBgColor.bind(U),U.getTipPoints=U.getTipPoints.bind(U),U.positionTip=U.positionTip.bind(U),U.setTipPoints=U.setTipPoints.bind(U),U.colorPanel=new tt("Text color",G.defaultColorSet,U.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>'),U.colorPanel.onColorChanged=U.setColor,U.bgColorPanel=new tt("Fill color",G.defaultColorSet,U.bgColor,Ee),U.bgColorPanel.onColorChanged=U.setBgColor,U.fontFamilyPanel=new Qe("Font",G.defaultFontFamilies,G.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U.tipGrip=new Dt,U.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),U.controlBox.appendChild(U.tipGrip.visual),U}return Be(d,B),d.prototype.ownsTarget=function(E){return B.prototype.ownsTarget.call(this,E)||this.tipGrip.ownsTarget(E)||this.tip===E},d.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},d.prototype.pointerDown=function(E,F){this.state==="new"&&B.prototype.pointerDown.call(this,E,F),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(F)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):B.prototype.pointerDown.call(this,E,F)},d.prototype.pointerUp=function(E){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,B.prototype.pointerUp.call(this,E);else{var F=this.state==="creating";B.prototype.pointerUp.call(this,E),this.setTipPoints(F),this.positionTip()}},d.prototype.manipulate=function(E){if(this.tipMoving){var F=this.unrotatePoint(E);this.tipPosition={x:F.x-this.manipulationStartLeft,y:F.y-this.manipulationStartTop},this.positionTip()}else B.prototype.manipulate.call(this,E)},d.prototype.setBgColor=function(E){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",E]]),oe.setAttributes(this.tip,[["fill",E]])),this.bgColor=E,this.fillColorChanged(E)},d.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},d.prototype.setTipPoints=function(E){E===void 0&&(E=!1);var F=Math.min(this.height/2,15),G=this.height/5;E&&(this.tipPosition={x:F+G/2,y:this.height+20});var U=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:0},this.tipBase2Position={x:F+G,y:0}):(this.tipBase1Position={x:0,y:F},this.tipBase2Position={x:0,y:F+G}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-G,y:0},this.tipBase2Position={x:this.width-F,y:0}):(this.tipBase1Position={x:this.width,y:F},this.tipBase2Position={x:this.width,y:F+G}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?U<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-G,y:this.height},this.tipBase2Position={x:this.width-F,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-F-G},this.tipBase2Position={x:this.width,y:this.height-F}):U<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:this.height},this.tipBase2Position={x:F+G,y:this.height}):(this.tipBase1Position={x:0,y:this.height-F},this.tipBase2Position={x:0,y:this.height-F-G})},d.prototype.resize=function(E){B.prototype.resize.call(this,E),this.positionTip()},d.prototype.positionTip=function(){oe.setAttributes(this.tip,[["points",this.getTipPoints()]]);var E=this.tipGrip.visual.transform.baseVal.getItem(0);E.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(E,0)},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),d.prototype.select=function(){this.positionTip(),B.prototype.select.call(this)},d.prototype.getState=function(){var E=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){var F=E;this.bgColor=F.bgColor,this.tipPosition=F.tipPosition,B.prototype.restoreState.call(this,E),this.createTip(),this.setTipPoints()},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.tipPosition={x:this.tipPosition.x*E,y:this.tipPosition.y*F},this.positionTip()},d.typeName="CalloutMarker",d.title="Callout marker",d.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>',d}(ot),Te=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.strokeColor=G.defaultColor,U.strokeWidth=G.defaultStrokeWidth,U.strokeDasharray=G.defaultStrokeDasharray,U.fillColor=G.defaultFillColor,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.setOpacity=U.setOpacity.bind(U),U.createVisual=U.createVisual.bind(U),U.strokePanel=new tt("Line color",xe(G.defaultColorSet,["transparent"]),G.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.fillPanel=new tt("Fill color",xe(G.defaultColorSet,["transparent"]),U.fillColor,Ee),U.fillPanel.onColorChanged=U.setFillColor,U.strokeWidthPanel=new Ft("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new wt("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U.opacityPanel=new ae("Opacity",G.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.visual)},d.prototype.createVisual=function(){this.visual=oe.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)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},d.prototype.manipulate=function(E){B.prototype.manipulate.call(this,E)},d.prototype.resize=function(E){B.prototype.resize.call(this,E),this.setSize()},d.prototype.setSize=function(){B.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},d.prototype.pointerUp=function(E){B.prototype.pointerUp.call(this,E),this.setSize()},d.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},d.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(E),this.stateChanged()},d.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},d.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},d.prototype.setOpacity=function(E){this.opacity=E,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){var F=E;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),B.prototype.restoreState.call(this,E),this.setSize()},d.prototype.scale=function(E,F){B.prototype.scale.call(this,E,F),this.setSize()},d.typeName="EllipseMarker",d.title="Ellipse marker",d.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>',d}(xt),Ne=function(B){function d(E,F,G){return B.call(this,E,F,G)||this}return Be(d,B),Object.defineProperty(d.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.tip1&&E!==this.tip2)},d.prototype.createTips=function(){this.tip1=oe.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(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.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(oe.createTransform()),this.visual.appendChild(this.tip2)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.state==="creating"&&this.createTips()},d.prototype.adjustVisual=function(){if(B.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.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()]]),oe.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 E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.tip1.transform.baseVal.getItem(0);F.setRotate(E,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(F,0);var G=this.tip2.transform.baseVal.getItem(0);G.setRotate(E+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(G,0)}},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=B.prototype.getState.call(this);return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E),this.createTips(),this.adjustVisual()},d.typeName="MeasurementMarker",d.title="Measurement marker",d.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>',d}(Ut),st=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.strokePanel.colors=G.defaultColorSet,U.fillColor="transparent",U}return Be(d,B),Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=B.prototype.getState.call(this);return E.typeName=d.typeName,E},d.typeName="EllipseFrameMarker",d.title="Ellipse frame marker",d.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>',d}(Te),pt=function(){function B(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(B.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),B.prototype.addUndoStep=function(d){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(d)||(this.undoStack.push(d),JSON.stringify(this.lastRedoStep)!==JSON.stringify(d)&&this.redoStack.splice(0,this.redoStack.length))},B.prototype.replaceLastUndoStep=function(d){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=d)},B.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},B.prototype.undo=function(){if(this.undoStack.length>1){var d=this.undoStack.pop();return d!==void 0&&this.redoStack.push(d),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},B.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},B}(),St=function(B){function d(E,F,G){var U=B.call(this,E,F,G)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.curveX=0,U.curveY=0,U.manipulationStartCurveX=0,U.manipulationStartCurveY=0,U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.positionGrips=U.positionGrips.bind(U),U.addControlGrips=U.addControlGrips.bind(U),U.adjustVisual=U.adjustVisual.bind(U),U.setupControlBox=U.setupControlBox.bind(U),U.resize=U.resize.bind(U),U.strokeColor=G.defaultColor,U.strokeWidth=G.defaultStrokeWidth,U.strokeDasharray=G.defaultStrokeDasharray,U.strokePanel=new tt("Line color",G.defaultColorSet,G.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new Ft("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new wt("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return Be(d,B),d.prototype.ownsTarget=function(E){return!(!B.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorCurve&&E!==this.visibleCurve&&!this.curveGrip.ownsTarget(E))},d.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},d.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.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)},d.prototype.pointerDown=function(E,F){B.prototype.pointerDown.call(this,E,F),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=E.x,this.curveY=E.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(F)&&(this.activeGrip=this.curveGrip,this._state="resize")},d.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},d.prototype.setupControlBox=function(){B.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.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)},d.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,B.prototype.addControlGrips.call(this)},d.prototype.positionGrips=function(){B.prototype.positionGrips.call(this);var E=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-E/2,this.curveY-E/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()))},d.prototype.manipulate=function(E){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+E.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+E.y-this.manipulationStartY),B.prototype.manipulate.call(this,E)},d.prototype.resize=function(E){this.activeGrip===this.curveGrip&&(this.curveX=E.x,this.curveY=E.y),B.prototype.resize.call(this,E),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},d.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},d.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},d.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual()},d.prototype.scale=function(E,F){this.curveX=this.curveX*E,this.curveY=this.curveY*F,B.prototype.scale.call(this,E,F)},Object.defineProperty(d.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),d.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},B.prototype.getState.call(this));return E.typeName=d.typeName,E},d.prototype.restoreState=function(E){B.prototype.restoreState.call(this,E);var F=E;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.curveX=F.curveX,this.curveY=F.curveY,this.createVisual(),this.adjustVisual()},d.typeName="CurveMarker",d.title="Curve marker",d.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>',d}(gt),$t=function(){function B(d,E){E===void 0&&(E=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=d,this.cancelable=E}return Object.defineProperty(B.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),B.prototype.preventDefault=function(){this._defaultPrevented=!0},B}(),_t=function(B){function d(E,F,G){var U=B.call(this,E,!1)||this;return U.dataUrl=F,U.state=G,U}return Be(d,B),d}($t),$e=function(B){function d(E,F,G){G===void 0&&(G=!1);var U=B.call(this,E,G)||this;return U.marker=F,U}return Be(d,B),d}($t),bn=function(){function B(){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 B.prototype.addEventListener=function(d,E){this[d].push(E)},B.prototype.removeEventListener=function(d,E){var F=this[d].indexOf(E);F>-1&&this[d].splice(F,1)},B}(),ze=function(){function B(d){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new We,this._isOpen=!1,this.undoRedoManager=new pt,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 bn,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=B.instanceCounter++,this.styles=new ut(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=d,this.targetRoot=document.body,this.width=d.clientWidth,this.height=d.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(B.prototype,"ALL_MARKER_TYPES",{get:function(){return[Pt,Ae,Se,ot,st,Te,fe,je,Ne,re,Ut,St]},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Pt,Ae,Se,ot,Te,fe,je]},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Pt,Ae,Se,ot,fe]},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(d){var E=this;this._availableMarkerTypes.splice(0),d.forEach(function(F){if(typeof F=="string"){var G=E.ALL_MARKER_TYPES.find(function(U){return U.typeName===F});G!==void 0&&E._availableMarkerTypes.push(G)}else E._availableMarkerTypes.push(F)})},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(d){this._zoomLevel=d,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(B.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),B.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},B.prototype.show=function(){var d=this;this.styles.styleSheetRoot===void 0&&at.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=at.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(E){return E(new $t(d))})},B.prototype.render=function(){return Xe(this,void 0,void 0,function(){var d;return Fe(this,function(E){switch(E.label){case 0:return this.setCurrentMarker(),(d=new dt).naturalSize=this.renderAtNaturalSize,d.imageType=this.renderImageType,d.imageQuality=this.renderImageQuality,d.markersOnly=this.renderMarkersOnly,d.width=this.renderWidth,d.height=this.renderHeight,[4,d.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return E.sent(),[4,d.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,E.sent()]}})})},B.prototype.close=function(d){var E=this;if(d===void 0&&(d=!1),this.isOpen){var F=!1;d||this.eventListeners.beforeclose.forEach(function(G){var U=new $t(E,!0);G(U),U.defaultPrevented&&(F=!0)}),F||(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(G){return G(new $t(E))}),this.detachEvents(),this._isOpen=!1)}},B.prototype.addMarkersToToolbar=function(){for(var d,E=[],F=0;F<arguments.length;F++)E[F]=arguments[F];(d=this._availableMarkerTypes).push.apply(d,E)},B.prototype.addRenderEventListener=function(d){this.addEventListener("render",function(E){d(E.dataUrl,E.state)})},B.prototype.removeRenderEventListener=function(d){},B.prototype.addCloseEventListener=function(d){this.addEventListener("close",function(){d()})},B.prototype.removeCloseEventListener=function(d){},B.prototype.setupResizeObserver=function(){var d=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){d.resize(d.target.clientWidth,d.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return d.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},B.prototype.onPopupTargetResize=function(){var d=1*this.target.clientWidth/this.target.clientHeight,E=this.editorCanvas.clientWidth/d>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*d:this.editorCanvas.clientWidth,F=E<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/d;this.resize(E,F)},B.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},B.prototype.resize=function(d,E){this._isResizing=!0;var F=d/this.imageWidth,G=E/this.imageHeight;this.imageWidth=Math.round(d),this.imageHeight=Math.round(E),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(F,G),this._isResizing=!1},B.prototype.scaleMarkers=function(d,E){var F,G=this;this._currentMarker&&this._currentMarker instanceof ot?this._currentMarker.scale(d,E):(F=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(U){U!==G._currentMarker&&U.scale(d,E)}),F!==void 0&&this.setCurrentMarker(F)},B.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"},B.prototype.setTopLeft=function(){var d=this.editingTarget.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=d.left-E.left,this.top=d.top-E.top},B.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)},B.prototype.addDefs=function(){for(var d,E=[],F=0;F<arguments.length;F++)E[F]=arguments[F];this.defs=oe.createDefs(),this.addDefsToImage(),(d=this.defs).append.apply(d,E)},B.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},B.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)},B.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},B.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},B.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)},B.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},B.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)},B.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 d=document.createElement("a");d.href="https://markerjs.com/",d.target="_blank",d.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>',d.title="Powered by marker.js",d.style.display="grid",d.style.alignItems="center",d.style.justifyItems="center",d.style.padding="3px",d.style.width="20px",d.style.height="20px",this.logoUI.appendChild(d),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},B.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")},B.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"},B.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},B.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 d=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=d+"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 Le(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 Ve(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},B.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},B.prototype.removeMarker=function(d){this.markerImage.removeChild(d.container),this.markers.indexOf(d)>-1&&this.markers.splice(this.markers.indexOf(d),1),d.dispose()},B.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())},B.prototype.toolbarButtonClicked=function(d,E){if(d==="marker"&&E!==void 0)this.createNewMarker(E);else if(d==="action")switch(E){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()}},B.prototype.deleteSelectedMarker=function(){var d=this;if(this._currentMarker!==void 0){var E=!1;if(this.eventListeners.markerbeforedelete.forEach(function(G){var U=new $e(d,d._currentMarker,!0);G(U),U.defaultPrevented&&(E=!0)}),!E){var F=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(G){return G(new $e(d,F))})}}},B.prototype.clear=function(){var d=this,E=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var He=new $e(d,void 0,!0);se(He),He.defaultPrevented&&(E=!0)}),!E)){this.setCurrentMarker();for(var F=function(se){var He=G.markers[se];G.setCurrentMarker(G.markers[se]),G._currentMarker.dispose(),G.markerImage.removeChild(G._currentMarker.container),G.markers.splice(G.markers.indexOf(G._currentMarker),1),G.eventListeners.markerdelete.forEach(function(Ye){return Ye(new $e(d,He))})},G=this,U=this.markers.length-1;U>=0;U--)F(U);this.addUndoStep()}},Object.defineProperty(B.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),B.prototype.showNotesEditor=function(){var d;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=(d=this._currentMarker.notes)!==null&&d!==void 0?d:"",this.overlayContainer.appendChild(this.notesArea))},B.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)},B.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},B.prototype.addUndoStep=function(){var d=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var E=this.getState(),F=this.undoRedoManager.getLastUndoStep();if(!F||F.width===E.width&&F.height===E.height){var G=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(E),G<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(U){return U(new $t(d))})}else this.undoRedoManager.replaceLastUndoStep(E),this.eventListeners.statechange.forEach(function(U){return U(new $t(d))})}},B.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},B.prototype.undoStep=function(){var d=this,E=this.undoRedoManager.undo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new $t(d))}))},B.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},B.prototype.redoStep=function(){var d=this,E=this.undoRedoManager.redo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new $t(d))}))},B.prototype.stepZoom=function(){var d=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=d<this.zoomSteps.length-1?this.zoomSteps[d+1]:this.zoomSteps[0]},B.prototype.panTo=function(d){this.contentDiv.scrollBy({left:this.prevPanPoint.x-d.x,top:this.prevPanPoint.y-d.y}),this.prevPanPoint=d},B.prototype.startRenderAndClose=function(){return Xe(this,void 0,void 0,function(){var d,E,F=this;return Fe(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return d=G.sent(),E=this.getState(),this.eventListeners.render.forEach(function(U){return U(new _t(F,d,E))}),this.close(!0),[2]}})})},B.prototype.getState=function(d){d===!0&&this.setCurrentMarker();var E={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(F){return E.markers.push(F.getState())}),E},B.prototype.restoreState=function(d){var E=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);d.markers.forEach(function(F){var G=E._availableMarkerTypes.find(function(se){return se.typeName===F.typeName});if(G!==void 0){var U=E.addNewMarker(G);U.restoreState(F),E.markers.push(U)}}),d.width&&d.height&&(d.width!==this.imageWidth||d.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/d.width,this.imageHeight/d.height),this.eventListeners.restorestate.forEach(function(F){return F(new $t(E))})},B.prototype.addNewMarker=function(d){var E=oe.createGroup();return this.markerImage.appendChild(E),new d(E,this.overlayContainer,this.settings)},B.prototype.createNewMarker=function(d){var E,F=this;(E=typeof d=="string"?this._availableMarkerTypes.find(function(G){return G.typeName===d}):d)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(E),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(E.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(G){return G(new $e(F,F._currentMarker))}))},B.prototype.markerCreated=function(d){var E=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(d),this.setCurrentMarker(d),d instanceof Ae&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ae):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(F){return F(new $e(E,E._currentMarker))})},B.prototype.colorChanged=function(d){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=d,this.settings.defaultStrokeColor=d)},B.prototype.fillColorChanged=function(d){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=d)},B.prototype.markerStateChanged=function(d){var E=this;this.eventListeners.markerchange.forEach(function(F){return F(new $e(E,d))})},B.prototype.setCurrentMarker=function(d){var E=this;this._currentMarker!==d&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(F){return F(new $e(E,E._currentMarker))})),this._currentMarker=d,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(F){return F(new $e(E,E._currentMarker))}))},B.prototype.onPointerDown=function(d){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||d.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var E=this.markers.find(function(F){return F.ownsTarget(d.target)});E!==void 0?(this.setCurrentMarker(E),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(d.clientX,d.clientY),d.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:d.clientX,y:d.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(d.clientX,d.clientY))},B.prototype.onDblClick=function(d){if(this._isFocused||this.focus(),this.mode==="select"){var E=this.markers.find(function(F){return F.ownsTarget(d.target)});E!==void 0&&E!==this._currentMarker&&this.setCurrentMarker(E),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(d.clientX,d.clientY),d.target):this.setCurrentMarker()}},B.prototype.onPointerMove=function(d){this.touchPoints!==1&&d.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||d.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(d.clientX,d.clientY)):this.zoomLevel>1&&this.panTo({x:d.clientX,y:d.clientY}))},B.prototype.onPointerUp=function(d){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(d.clientX,d.clientY)),this.isDragging=!1,this.addUndoStep()},B.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},B.prototype.onKeyUp=function(d){this._currentMarker===void 0||this.notesArea!==void 0||d.key!=="Delete"&&d.key!=="Backspace"||this.deleteSelectedMarker()},B.prototype.clientToLocalCoordinates=function(d,E){var F=this.markerImage.getBoundingClientRect();return{x:(d-F.left)/this.zoomLevel,y:(E-F.top)/this.zoomLevel}},B.prototype.onWindowResize=function(){this.positionUI()},B.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var d=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=d+"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()},B.prototype.addLicenseKey=function(d){Re.addKey(d)},B.prototype.addEventListener=function(d,E){this.eventListeners.addEventListener(d,E)},B.prototype.removeEventListener=function(d,E){this.eventListeners.removeEventListener(d,E)},B.prototype.renderState=function(d){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(d),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(B.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),B.prototype.focus=function(){var d=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(E){return E(new $t(d))}))},B.prototype.blur=function(){var d=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(E){return E(new $t(d))}))},B.instanceCounter=0,B}();/* **********************************
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 vn=function(B,d){return(vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,F){E.__proto__=F}||function(E,F){for(var G in F)Object.prototype.hasOwnProperty.call(F,G)&&(E[G]=F[G])})(B,d)};function ln(B,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function E(){this.constructor=B}vn(B,d),B.prototype=d===null?Object.create(d):(E.prototype=d.prototype,new E)}function Ht(B,d,E,F){return new(E||(E=Promise))(function(G,U){function se(Ct){try{Ye(F.next(Ct))}catch(Ge){U(Ge)}}function He(Ct){try{Ye(F.throw(Ct))}catch(Ge){U(Ge)}}function Ye(Ct){var Ge;Ct.done?G(Ct.value):(Ge=Ct.value,Ge instanceof E?Ge:new E(function(yt){yt(Ge)})).then(se,He)}Ye((F=F.apply(B,d||[])).next())})}function an(B,d){var E,F,G,U,se={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return U={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(U[Symbol.iterator]=function(){return this}),U;function He(Ye){return function(Ct){return function(Ge){if(E)throw new TypeError("Generator is already executing.");for(;se;)try{if(E=1,F&&(G=2&Ge[0]?F.return:Ge[0]?F.throw||((G=F.return)&&G.call(F),0):F.next)&&!(G=G.call(F,Ge[1])).done)return G;switch(F=0,G&&(Ge=[2&Ge[0],G.value]),Ge[0]){case 0:case 1:G=Ge;break;case 4:return se.label++,{value:Ge[1],done:!1};case 5:se.label++,F=Ge[1],Ge=[0];continue;case 7:Ge=se.ops.pop(),se.trys.pop();continue;default:if(!(G=se.trys,(G=G.length>0&&G[G.length-1])||Ge[0]!==6&&Ge[0]!==2)){se=0;continue}if(Ge[0]===3&&(!G||Ge[1]>G[0]&&Ge[1]<G[3])){se.label=Ge[1];break}if(Ge[0]===6&&se.label<G[1]){se.label=G[1],G=Ge;break}if(G&&se.label<G[2]){se.label=G[2],se.ops.push(Ge);break}G[2]&&se.ops.pop(),se.trys.pop();continue}Ge=d.call(B,se)}catch(yt){Ge=[6,yt],F=0}finally{E=G=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Ye,Ct])}}}var gn=function(){function B(){}return B.addKey=function(d){B.key=d},Object.defineProperty(B,"isLicensed",{get:function(){return!!B.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(B.key)},enumerable:!1,configurable:!0}),B}(),kt=function(){function B(){}return B.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},B.setAttributes=function(d,E){for(var F=0,G=E;F<G.length;F++){var U=G[F],se=U[0],He=U[1];d.setAttribute(se,He)}},B.createRect=function(d,E,F){var G=document.createElementNS("http://www.w3.org/2000/svg","rect");return G.setAttribute("width",d.toString()),G.setAttribute("height",E.toString()),F&&B.setAttributes(G,F),G},B.createLine=function(d,E,F,G,U){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",d.toString()),se.setAttribute("y1",E.toString()),se.setAttribute("x2",F.toString()),se.setAttribute("y2",G.toString()),U&&B.setAttributes(se,U),se},B.createPolygon=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",d),E&&B.setAttributes(F,E),F},B.createCircle=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(d/2).toString()),F.setAttribute("cy",(d/2).toString()),F.setAttribute("r",d.toString()),E&&B.setAttributes(F,E),F},B.createEllipse=function(d,E,F){var G=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return G.setAttribute("cx",(d/2).toString()),G.setAttribute("cy",(E/2).toString()),G.setAttribute("rx",(d/2).toString()),G.setAttribute("ry",(E/2).toString()),F&&B.setAttributes(G,F),G},B.createGroup=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return d&&B.setAttributes(E,d),E},B.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},B.createMarker=function(d,E,F,G,U,se,He){var Ye=document.createElementNS("http://www.w3.org/2000/svg","marker");return B.setAttributes(Ye,[["id",d],["orient",E],["markerWidth",F.toString()],["markerHeight",G.toString()],["refX",U.toString()],["refY",se.toString()]]),Ye.appendChild(He),Ye},B.createText=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),d&&B.setAttributes(E,d),E},B.createTSpan=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=d,E&&B.setAttributes(F,E),F},B.createImage=function(d){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return d&&B.setAttributes(E,d),E},B.createPoint=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=d,F.y=E,F},B.createPath=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",d),E&&B.setAttributes(F,E),F},B.createElement=function(d,E){var F=document.createElementNS("http://www.w3.org/2000/svg",d);return E&&B.setAttributes(F,E),F},B.getHollowRectanglePath=function(d,E,F,G,U,se,He,Ye){return"M"+d+","+E+"V"+(E+G)+"H"+(d+F)+"V"+E+"H"+U+"V"+se+"H"+(U+He)+"V"+(se+Ye)+"H"+U+"V"+E+"Z"},B}(),Mt=function(){function B(d){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+d+"_"}return Object.defineProperty(B.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),B.prototype.addClass=function(d){return this.styleSheet===void 0&&this.addStyleSheet(),d.name=""+this.classNamePrefix+d.localName,this.classes.push(d),this.styleSheet.sheet.insertRule("."+d.name+" {"+d.style+"}",this.styleSheet.sheet.cssRules.length),d},B.prototype.addRule=function(d){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(d),this.styleSheet.sheet.insertRule(d.selector+" {"+d.style+"}",this.styleSheet.sheet.cssRules.length)},B.prototype.addStyleSheet=function(){var d;this.styleSheet=document.createElement("style"),((d=this.styleSheetRoot)!==null&&d!==void 0?d:document.head).appendChild(this.styleSheet),this.addRule(new mt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new mt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new mt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new It("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new It("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},B.prototype.removeStyleSheet=function(){var d;this.styleSheet&&(((d=this.styleSheetRoot)!==null&&d!==void 0?d:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},B}(),mt=function(B,d){this.selector=B,this.style=d},It=function(B,d){this.localName=B,this.style=d},un=function(){function B(){this.blocks=[],this.display=""}return B.prototype.addButtonBlock=function(d){d.className=this.blockClassName,d.buttonClassName=this.buttonClassName,d.buttonColorsClassName=this.buttonColorsClassName,d.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(d)},B.prototype.addElementBlock=function(d){d.className===void 0&&(d.className=this.blockClassName),this.blocks.push(d)},B.prototype.getUI=function(){var d=document.createElement("div");return d.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,d.style.display=this.display,this.blocks.forEach(function(E){return d.appendChild(E.getUI())}),d},B}(),pn=function(){function B(){}return B.prototype.getUI=function(){var d=document.createElement("div");if(d.className=this.className,this.minWidth!==void 0&&(d.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":d.style.justifyContent="flex-start";break;case"center":d.style.justifyContent="center";break;case"end":d.style.justifyContent="flex-end"}return d.style.whiteSpace="nowrap",d},B}(),Zt=function(B){function d(){var E=B!==null&&B.apply(this,arguments)||this;return E.buttons=[],E}return ln(d,B),d.prototype.addButton=function(E){E.className=this.buttonClassName,E.colorsClassName=this.buttonColorsClassName,E.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(E)},d.prototype.getUI=function(){var E=B.prototype.getUI.call(this);return this.buttons.forEach(function(F){return E.appendChild(F.getUI())}),E},d}(pn),zt=function(){function B(d,E){this._isActive=!1,this._isHidden=!1,this._icon=d,this.title=E,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(B.prototype,"icon",{get:function(){return this._icon},set:function(d){this._icon=d,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isActive",{get:function(){return this._isActive},set:function(d){this._isActive=d,this.adjustClassName()},enumerable:!1,configurable:!0}),B.prototype.getUI=function(){var d=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 d.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},B.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,"")))},B.prototype.hide=function(){this._isHidden=!0},B}(),Tt=function(B){function d(){var E=B!==null&&B.apply(this,arguments)||this;return E.elements=[],E}return ln(d,B),d.prototype.addElement=function(E){this.elements.push(E)},d.prototype.getUI=function(){var E=B.prototype.getUI.call(this);return this.elements.forEach(function(F){return E.appendChild(F)}),E},d}(pn),zn=function(){function B(d,E){this.horizontal=d,this.vertical=E}return Object.defineProperty(B.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),B.prototype.getVerticalLength=function(d){return d/this.ratio},B.prototype.getHorizontalLength=function(d){return d*this.ratio},B}(),Pn=function(){function B(){}return B.getIcon=function(d,E){if(d>0&&E>0){var F=new zn(d,E),G=F.ratio>=1?20:F.getHorizontalLength(20),U=F.ratio<1?20:F.getVerticalLength(20),se=document.createElementNS("http://www.w3.org/2000/svg","svg");se.setAttribute("xmlns","http://www.w3.org/2000/svg"),se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(se);var He=kt.createDefs();se.appendChild(He);var Ye=kt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(Ye);var Ct=kt.createPath(kt.getHollowRectanglePath((24-G)/2,(24-U)/2,G,U,(24-G)/2+2,(24-U)/2+2,G-4,U-4));se.appendChild(Ct);var Ge=kt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(kt.createTSpan(d+":"+E)),se.appendChild(Ge);var yt=Ge.getBBox();kt.setAttributes(Ge,[["x",((24-yt.width)/2).toString()],["y",((24-yt.height)/2-yt.y).toString()]]);var Qt=kt.createPath(kt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(yt.width))/2,(24-Math.ceil(yt.height))/2,Math.ceil(yt.width),Math.ceil(yt.height)));return Ye.appendChild(Qt),kt.setAttributes(Ct,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(se),se.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>'},B}(),Dn=function(B){function d(E,F,G){var U=B.call(this,E,F)||this;return U.isDropdownOpen=!1,U.onClick=U.dropdownButtonClicked,U.dropdownButtons=G,U}return ln(d,B),d.prototype.setupDropdown=function(){var E=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(F){F.className=E.className,F.colorsClassName=E.colorsClassName,E.dropdownBlock.appendChild(F.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},d.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},d.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},d.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},d.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},d.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},d}(zt),Jt=function(){function B(d,E){this.GRIP_SIZE=10,this.color=d,this.fillColor=E,this.visual=kt.createGroup(),this.visual.appendChild(kt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(kt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return B.prototype.ownsTarget=function(d){return d===this.visual||d===this.visual.childNodes[0]||d===this.visual.childNodes[1]},B.prototype.setCenter=function(d,E){this.visual.childNodes.forEach(function(F){return kt.setAttributes(F,[["cx",d.toString()],["cy",E.toString()]])})},B}(),Un=function(){function B(d,E,F,G){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=d,this.canvasHeight=E,this.margin=F,this.container=G,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(B.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(d){this._aspectRatio=d,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(d){this._isGridVisible=d,this.gridContainer&&kt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(d){this._zoomFactor=d,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),B.prototype.open=function(){var d=this;this.cropShadeElement=kt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=kt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var E=0;E<this.numberOfGridLines;E++)this.horizontalGridLines.push(kt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(kt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(F){return d.gridContainer.appendChild(F)}),this.verticalGridLines.forEach(function(F){return d.gridContainer.appendChild(F)}),this.cropRectElement=kt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Jt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Jt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Jt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Jt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},B.prototype.setCropRectangle=function(d){this.cropRect=d;var E=Object.assign({},this.cropRect);this.zoomFactor!==1&&(E.width=this.cropRect.width*this.zoomFactor,E.height=this.cropRect.height*this.zoomFactor,E.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-E.width/2,E.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-E.height/2),kt.setAttributes(this.cropRectElement,[["x",E.x.toString()],["y",E.y.toString()],["width",E.width.toString()],["height",E.height.toString()]]);var F=E.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(U,se){var He=E.y+F*(se+1);kt.setAttributes(U,[["x1",""+E.x],["y1",""+He],["x2",""+(E.x+E.width)],["y2",""+He]])});var G=E.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(U,se){var He=E.x+G*(se+1);kt.setAttributes(U,[["x1",""+He],["y1",""+E.y],["x2",""+He],["y2",""+(E.y+E.height)]])}),kt.setAttributes(this.cropShadeElement,[["d",kt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,E.x,E.y,E.width,E.height)]]),this.topLeftGrip.setCenter(E.x,E.y),this.topRightGrip.setCenter(E.x+E.width,E.y),this.bottomLeftGrip.setCenter(E.x,E.y+E.height),this.bottomRightGrip.setCenter(E.x+E.width,E.y+E.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},B.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)},B.prototype.clientToLocalCoordinates=function(d,E){var F=this.container.getBoundingClientRect();return{x:d-F.left+this.margin,y:E-F.top+this.margin}},B.prototype.onPointerDown=function(d){this.container.setPointerCapture(d.pointerId),this.previousPoint=this.clientToLocalCoordinates(d.clientX,d.clientY),this.cropRectElement===d.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(d.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(d.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(d.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(d.target)&&(this.activeGrip=this.bottomRightGrip)},B.prototype.onPointerMove=function(d){if(this.isMoving)this.move(this.clientToLocalCoordinates(d.clientX,d.clientY));else if(this.activeGrip){var E=this.clientToLocalCoordinates(d.clientX,d.clientY);this.resize(E)}d.preventDefault()},B.prototype.onPointerUp=function(d){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(d.pointerId)},B.prototype.move=function(d){var E=d.x-this.previousPoint.x,F=d.y-this.previousPoint.y;this.zoomFactor!==1&&(E=-E/this.zoomFactor,F=-F/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+E),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+F),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=d},B.prototype.resize=function(d){var E=Object.assign({},this.cropRect),F=d.x-this.previousPoint.x,G=d.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:E.x+F<this.margin&&(F=this.margin-E.x),E.x+=F,E.width=this.cropRect.x+this.cropRect.width-E.x;break;case this.bottomRightGrip:case this.topRightGrip:E.width+F>this.canvasWidth*this.zoomFactor&&(F=this.canvasWidth*this.zoomFactor-E.width),E.width+=F}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(E.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(F),E.height=this.aspectRatio.getVerticalLength(E.width)):(E.y+=G,E.height=this.cropRect.y+this.cropRect.height-E.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?E.height=this.aspectRatio.getVerticalLength(E.width):E.height+=G}E.width<10&&(E.x=this.cropRect.x,E.width=10),E.height<10&&(E.y=this.cropRect.y,E.height=10),this.previousPoint=d,E.x>=this.margin&&E.y>=this.margin&&E.x-this.margin+E.width<=this.canvasWidth&&E.y-this.margin+E.height<=this.canvasHeight&&(this.cropRect=E,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},B.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var d=this.cropRect.x+this.cropRect.width/2,E=this.cropRect.y+this.cropRect.height/2,F=this.aspectRatio.getHorizontalLength(this.cropRect.height),G=this.aspectRatio.getVerticalLength(this.cropRect.width);F/this.canvasWidth<G/this.canvasHeight?this.cropRect.width=F:this.cropRect.height=G,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=d-this.cropRect.width/2,this.cropRect.y=E-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)}},B.prototype.getRescaledRect=function(d,E,F,G,U,se){var He=F/d,Ye=G/E;return{x:(U.x-se)*He+se,y:(U.y-se)*Ye+se,width:U.width*He,height:U.height*Ye}},B.prototype.scaleCanvas=function(d,E){var F=this.getRescaledRect(this.canvasWidth,this.canvasHeight,d,E,this.cropRect,this.margin);this.canvasWidth=d,this.canvasHeight=E,this.onCropChange&&this.onCropChange(F),this.setCropRectangle(F)},B}(),Qn=function(){function B(d){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=d,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(B.prototype,"angle",{get:function(){return this._angle},set:function(d){this._angle=d,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),B.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},B.prototype.onPointerDown=function(d){this.controlContainer.setPointerCapture(d.pointerId),this.isDragging=!0,this.previousPoint={x:d.clientX,y:d.clientY}},B.prototype.onPointerMove=function(d){this.isDragging&&(this.onAngleChange&&this.onAngleChange((d.clientX-this.previousPoint.x)/5),this.previousPoint.x=d.clientX)},B.prototype.onPointerUp=function(d){this.isDragging&&this.onAngleChange&&this.onAngleChange((d.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(d.pointerId)},B.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var d=this.angleLabelText.getBBox();kt.setAttributes(this.angleLabelElement,[["x",((this.width-d.width)/2).toString()],["y",(this.height/2).toString()]])}},B.prototype.positionScaleShape=function(){if(this.scaleShape){var d=this.scaleShape.transform.baseVal.getItem(0);d.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(d,0)}},B.prototype.getVisual=function(){var d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.setAttribute("width",this.width+"px"),d.setAttribute("height",this.height+"px"),d.setAttribute("viewBox","0 0 "+this.width+" "+this.height),d.style.flexShrink="0",document.body.appendChild(d);for(var E="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,F=1;F<=this.width/5+10;F++){var G=F%5==0?this.height/3:this.height/6;E+="h4v"+-G+"h1v"+G}E+="v1H0Z",this.scaleShape=kt.createPath(E);var U=kt.createTransform();this.scaleShape.transform.baseVal.appendItem(U),d.appendChild(this.scaleShape),this.angleLabelElement=kt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=kt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var se=kt.createTSpan("");return se.innerHTML="&deg;",this.angleLabelElement.appendChild(se),d.appendChild(this.angleLabelElement),document.body.removeChild(d),d},B}(),Gn=function(){function B(){this.naturalSize=!1,this.imageType="image/png"}return B.prototype.rasterize=function(d,E,F,G,U,se,He){var Ye=this;return new Promise(function(Ct){var Ge=document.createElement("canvas");Ge.width=d.width.baseVal.value-2*G,Ge.height=d.height.baseVal.value-2*G;var yt=1,Qt=1;Ye.naturalSize===!0?(yt=E.naturalWidth/(d.width.baseVal.value-2*G)/se,Qt=E.naturalHeight/(d.height.baseVal.value-2*G)/He,Ge.width=E.naturalWidth/se,Ge.height=E.naturalHeight/He):Ye.width!==void 0&&Ye.height!==void 0&&(yt=Ye.width/F.width,Qt=Ye.height/F.height,Ge.width*=yt,Ge.height*=Qt);var Bn=Ge.getContext("2d");Bn.translate(Ge.width/2,Ge.height/2),Bn.rotate(U*Math.PI/180),Bn.scale(se,He),Bn.translate(-Ge.width/2,-Ge.height/2),Bn.drawImage(E,0,0,Ge.width,Ge.height);var er=document.createElement("canvas");er.width=F.width*yt,er.height=F.height*Qt,er.getContext("2d").putImageData(Bn.getImageData((F.x-G)*yt,(F.y-G)*Qt,F.width*yt,F.height*Qt),0,0),Ct(er.toDataURL(Ye.imageType,Ye.imageQuality))})},B}(),Je=function(){function B(d){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=B.instanceCounter++,this.styles=new Mt(this.instanceNo),this.target=d,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(B.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(d){this._zoomToCropEnabled=d,d?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(d){this._isGridVisible=d,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"gridLines",{get:function(){return this._gridLines},set:function(d){this._gridLines=d,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(d){this._rotationAngle=d,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"aspectRatio",{get:function(){var d;return(d=this._aspectRatio)!==null&&d!==void 0?d:this.aspectRatios[0]},set:function(d){this._aspectRatio=d},enumerable:!1,configurable:!0}),B.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},B.prototype.show=function(){this.showUI(),this.open()},B.prototype.close=function(d){d===void 0&&(d=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),d||this.closeEventListeners.forEach(function(E){return E()}),this._isOpen=!1)},B.prototype.addRenderEventListener=function(d){this.renderEventListeners.push(d)},B.prototype.removeRenderEventListener=function(d){this.renderEventListeners.indexOf(d)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(d),1)},B.prototype.addCloseEventListener=function(d){this.closeEventListeners.push(d)},B.prototype.removeCloseEventListener=function(d){this.closeEventListeners.indexOf(d)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(d),1)},B.prototype.setupResizeObserver=function(){var d=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){d.resize(d.target.clientWidth,d.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))},B.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var d=1*this.target.clientWidth/this.target.clientHeight,E=this.contentDiv.clientWidth/d>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*d:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,F=E+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/d;this.resize(E,F)}},B.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},B.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",kt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},B.prototype.resize=function(d,E){this.imageWidth=Math.round(d),this.imageHeight=Math.round(E),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()},B.prototype.setEditingTarget=function(){var d=document.createElement("canvas");d.width=this.target.naturalWidth,d.height=this.target.naturalHeight,d.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var E=d.toDataURL();kt.setAttributes(this.editingTarget,[["href",E]]),this.setEditingTargetSize()},B.prototype.setTopLeft=function(){var d=this.target.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=d.left-E.left-this.CANVAS_MARGIN,this.top=d.top-E.top-this.CANVAS_MARGIN},B.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=kt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=kt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=kt.createGroup(),this.editingTargetRotationScaleContainer=kt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var d=kt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(d);var E=kt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(E),this.editingTargetContainer=kt.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)},B.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},B.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=kt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Un(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()},B.prototype.zoomToCrop=function(){if(this.cropRect){var d=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,E=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=d+"px "+E+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-d+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-E+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},B.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)},B.prototype.cropRectChanged=function(d){this.cropRect=d,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},B.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},B.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"},B.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},B.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 d=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,E=this.target.offsetTop>d+this.CANVAS_MARGIN?this.target.offsetTop-(d+this.CANVAS_MARGIN):0;this.coverDiv.style.top=E+"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},B.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},B.prototype.addTopToolbar=function(){var d=this;this.topToolbar=new un,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 E=new Zt;E.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(E);var F=[];this.aspectRatios.forEach(function(Qt){var Bn=new zt(Pn.getIcon(Qt.horizontal,Qt.vertical),Qt.horizontal===0&&Qt.vertical===0?"FREE":Qt.horizontal+":"+Qt.vertical);Bn.onClick=function(){return d.ratioButtonClicked(Qt)},F.push(Bn)}),this.aspectRatioButton=new Dn(Pn.getIcon(0,0),"Aspect ratio",F),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,E.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var G=new zt('<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");G.isActive=this.isGridVisible,G.onClick=function(){d.isGridVisible=!d.isGridVisible,G.isActive=d.isGridVisible},E.addButton(G);var U=new zt('<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(U.isActive=this.zoomToCropEnabled,U.onClick=function(){d.zoomToCropEnabled=!d.zoomToCropEnabled,U.isActive=d.zoomToCropEnabled},E.addButton(U),!gn.isLicensed){var se=new Tt;this.topToolbar.addElementBlock(se);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ye=document.createElement("a");Ye.style.color="currentColor",Ye.href="https://markerjs.com/products/cropro",Ye.target="_blank",Ye.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>',He.appendChild(Ye),se.addElement(He)}var Ct=new Zt;Ct.minWidth=3*this.toolbarHeight+"px",Ct.contentAlign="end",this.topToolbar.addButtonBlock(Ct);var Ge=new zt('<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");Ge.onClick=this.startRenderAndClose,Ct.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var yt=new zt('<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");yt.onClick=this.close,Ct.addButton(yt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(yt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},B.prototype.addBottomToolbar=function(){var d=this;this.bottomToolbar=new un,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 E=new Zt;E.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(E);var F=new zt('<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");F.onClick=this.rotateLeftButtonClicked,E.addButton(F);var G=new zt('<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");G.onClick=this.rotateRightButtonClicked,E.addButton(G);var U=new Tt;U.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(U),this.straightener=new Qn("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(Ct){d.rotateBy(Ct),d.straightener.angle=d.rotationAngle},U.addElement(this.straightener.getUI());var se=new Zt;se.minWidth=2*this.toolbarHeight+"px",se.contentAlign="end",this.bottomToolbar.addButtonBlock(se);var He=new zt('<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");He.onClick=this.flipHorizontallyButtonClicked,se.addButton(He);var Ye=new zt('<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");Ye.onClick=this.flipVerticallyButtonClicked,se.addButton(Ye)},B.prototype.ratioButtonClicked=function(d){this.aspectRatio=d,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},B.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Pn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},B.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new zn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},B.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},B.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},B.prototype.restoreState=function(d){if(d){var E=this.cropLayer.getRescaledRect(d.width,d.height,this.imageWidth,this.imageHeight,d.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(E),this.cropRectChanged(E),this.flippedHorizontally=d.flippedHorizontally,this.flippedVertically=d.flippedVertically,this.applyFlip(),this.rotationAngle=d.rotationAngle,this.applyRotation()}},B.prototype.clientToLocalCoordinates=function(d,E){var F=this.cropImage.getBoundingClientRect();return{x:d-F.left,y:E-F.top}},B.prototype.onWindowResize=function(){this.positionUI()},B.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var d=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=d+"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()},B.prototype.rotateLeftButtonClicked=function(){var d=this.rotationAngle-90;this.rotationAngle%90!=0&&(d+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(d)},B.prototype.rotateRightButtonClicked=function(){var d=this.rotationAngle+90;this.rotationAngle%90!=0&&(d-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(d)},B.prototype.rotateTo=function(d){d=(d=d>180?d-360:d)<=-180?d+360:d,this.rotationAngle=d,this.applyRotation()},B.prototype.rotateBy=function(d){this.rotateTo((this.rotationAngle+d)%360)},B.prototype.applyRotation=function(){var d=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var E=this.editingTargetRotationContainer.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(E,0);var F=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/F.width,this.imageHeight/F.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=d},B.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},B.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},B.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},B.prototype.startRenderAndClose=function(){return Ht(this,void 0,void 0,function(){var d,E;return an(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return d=F.sent(),E=this.getState(),this.renderEventListeners.forEach(function(G){return G(d,E)}),this.close(!0),[2]}})})},B.prototype.render=function(){return Ht(this,void 0,void 0,function(){var d;return an(this,function(E){switch(E.label){case 0:return(d=new Gn).naturalSize=this.renderAtNaturalSize,d.imageType=this.renderImageType,d.imageQuality=this.renderImageQuality,d.width=this.renderWidth,d.height=this.renderHeight,this.unzoomFromCrop(),kt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,d.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 E.sent(),[4,d.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,E.sent()]}})})},B.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new It("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 It("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new It("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var d=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new It("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*d)+`px;
height: `+(this.toolbarHeight-2*d)+`px;
padding: `+d+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new It("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new It("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new mt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new mt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new It("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 It("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new It("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 It("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*d)+`px;
padding: `+d+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new It("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},B.instanceCounter=0,B}(),vt=$("8hTe"),Xt=$.n(vt),Gt=/<pre[^>]*>/g;function Bt(B){var d=document.createElement("div");return d.innerHTML=B,d.childNodes.length===0?"":d.childNodes[0].nodeValue}var qt=Me.a=function(B){var d=B.value,E=d===void 0?"":d,F=B.edit,G=F===void 0?!1:F,U=B.className,se=B.showTextOnly,He=B.showLines,Ye=B.replaces,Ct=B.zoomImg,Ge=B.hasMask,yt=B.style,Qt=yt===void 0?{}:yt,Bn=B.stylesPrev,er=Bn===void 0?{}:Bn,mn=String(E),At=Object(R.useRef)(),Nt=Object(R.useRef)(),on=Object(R.useState)(""),dn=Object(j.a)(on,2),En=dn[0],Fn=dn[1],cn=Object(R.useState)("office"),Er=Object(j.a)(cn,2),Qr=Er[0],ni=Er[1],wi=function(){var jn=new Je(Nt.current);jn.displayMode="popup",jn.addRenderEventListener(function(){var fr=Object(I.a)(P.a.mark(function xn(pr){var Yn;return P.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return At.current.style.display="none",vr.next=3,Object(qe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pr}});case 3:Yn=vr.sent,Yn!=null&&Yn.id&&Ye(Nt.current.getAttribute("src").replace(ue.a.API_SERVER,""),"/api/attachments/".concat(Yn==null?void 0:Yn.id,"?type=").concat(Yn.content_type));case 5:case"end":return vr.stop()}},xn)}));return function(xn){return fr.apply(this,arguments)}}()),jn.show()},Ki=function(){var jn=new ze(Nt.current);jn.settings.displayMode="popup",jn.addEventListener("render",function(){var fr=Object(I.a)(P.a.mark(function xn(pr){var Yn;return P.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:if(At.current.style.display="none",!Nt.current){vr.next=6;break}return vr.next=4,Object(qe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pr.dataUrl}});case 4:Yn=vr.sent,Yn!=null&&Yn.id&&Ye(Nt.current.getAttribute("src").replace(ue.a.API_SERVER,""),"/api/attachments/".concat(Yn==null?void 0:Yn.id,"?type=").concat(Yn.content_type));case 6:case"end":return vr.stop()}},xn)}));return function(xn){return fr.apply(this,arguments)}}()),jn.show(),window.markerArea=jn},hr=Object(R.useMemo)(function(){try{var rr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jn=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;mn=mn.replace(rr,"("+ue.a.API_SERVER+"/api/attachments/").replace(jn,'"'+ue.a.API_SERVER+"/api/attachments/").replace(fr,'"'+ue.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,`
`),mn=mn.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ri){}var xn=Q(mn),pr=D();if(mn.match(/\[TOC\]/)&&(xn=xn.replace("<p>[TOC]</p>",L()),C()),xn=xn.replace(/(__special_katext_id_\d+__)/g,function(ri,vr){var jr=pr[vr],zi=jr.type,ci=jr.expression;return Object(ge.renderToString)(Bt(ci)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),xn=xn.replace(/▁/g,"\u2581\u2581\u2581"),S(),se){var Yn=document.createElement("div");return Yn.innerHTML=xn,Yn.innerText}return setTimeout(function(){return Oi()},500),xn},[mn]),_r=Object(R.useRef)();g.WebkitLineClamp=He,He&&(Qt=Object(O.a)(Object(O.a)({},Qt),g));function gi(rr){var jn=rr.target;if(jn.tagName.toUpperCase()==="IMG"){if(Ct){var fr=jn.getAttribute("src");Fn(fr),ni("image")}}else if(jn.tagName.toUpperCase()==="A"){var xn=jn.getAttribute("href");if(xn.indexOf("office")>-1)rr.preventDefault(),Fn(xn),ni("office");else if(xn.indexOf("application/pdf")>-1)rr.preventDefault(),Fn(xn),ni("pdf");else if(xn.indexOf("type=text")>-1)rr.preventDefault(),Fn(xn),ni("html");else if(xn.startsWith("#")){rr.preventDefault();var pr=document.getElementById(xn.replace("#",""));pr&&pr.scrollIntoView(!0)}}}var Oi=function(){var jn,fr=(jn=_r.current)===null||jn===void 0?void 0:jn.querySelectorAll("video");fr==null||fr.forEach(function(xn){if(xn.oncontextmenu=function(){return!1},xn.src.indexOf(".m3u8")>-1&&!xn.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var pr=new te.a;pr.loadSource(xn.src),pr.attachMedia(xn)}}})};Object(R.useEffect)(function(){if(_r.current&&hr&&(hr.match(Gt)&&window.PR.prettyPrint()),_r.current)return _r.current.addEventListener("click",gi),function(){_r.current.removeEventListener("click",gi),S(),C()}},[hr,_r.current,gi]);var qi=function(jn){if(!G)return;jn.target.nodeName==="IMG"?(At.current.style.display="flex",At.current.style.width=jn.target.clientWidth+"px",At.current.style.height=jn.target.clientHeight+"px",At.current.style.top=jn.target.offsetTop+"px",At.current.style.left=jn.target.offsetLeft+"px",Nt.current.src=jn.target.getAttribute("src")):At.current.style.display="none"};return c.a.createElement("div",{style:{position:"relative"}},c.a.createElement("div",{ref:_r,style:Object(O.a)({},Qt),className:"".concat(U||""," markdown-body ").concat(Xt.a.mdBody),onMouseOver:qi,dangerouslySetInnerHTML:{__html:hr}}),c.a.createElement("div",{ref:At,className:Xt.a.button},c.a.createElement(Y.a,null,c.a.createElement(H.a,{onClick:function(){return wi()}},"\u88C1\u526A"),c.a.createElement(H.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),c.a.createElement("img",{ref:Nt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),c.a.createElement(Oe.a,{close:!0,data:En,hasMask:Ge,type:En!=null&&En.length?Qr:"",style:Object(O.a)({},er),onClose:function(){return Fn("")}}))}},"9VGf":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return M});var ie=$("q1tI"),Y=$.n(ie);function M(H,O){var I=Object(ie.useRef)();Object(ie.useEffect)(function(){I.current=H}),Object(ie.useEffect)(function(){function j(){I.current()}if(O!==null){var N=setInterval(j,O);return function(){return clearInterval(N)}}},[O])}},BU3w:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return I});var ie=$("MNnm"),Y="rc-util-key";function M(j){if(j.attachTo)return j.attachTo;var N=document.querySelector("head");return N||document.body}function H(j){var N,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ie.a)())return null;var R=document.createElement("style");if((N=P.csp)===null||N===void 0?void 0:N.nonce){var c;R.nonce=(c=P.csp)===null||c===void 0?void 0:c.nonce}R.innerHTML=j;var f=M(P),_=f.firstChild;return P.prepend&&f.prepend?f.prepend(R):P.prepend&&_?f.insertBefore(R,_):f.appendChild(R),R}var O=new Map;function I(j,N){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=M(P);if(!O.has(R)){var c=H("",P),f=c.parentNode;O.set(R,f),f.removeChild(c)}var _=Array.from(O.get(R).children).find(function(i){return i.tagName==="STYLE"&&i[Y]===N});if(_){var p,m;if(((p=P.csp)===null||p===void 0?void 0:p.nonce)&&_.nonce!==((m=P.csp)===null||m===void 0?void 0:m.nonce)){var y;_.nonce=(y=P.csp)===null||y===void 0?void 0:y.nonce}return _.innerHTML!==j&&(_.innerHTML=j),_}var a=H(j,P);return a[Y]=N,a}},Bd2K:function(Wt,Me,$){(function(ie){ie($("VrN/"),$("osHv"))})(function(ie){ie.defineOption("autoCloseTags",!1,function(P,R,c){if(c!=ie.Init&&c&&P.removeKeyMap("autoCloseTags"),!R)return;var f={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(f["'/'"]=function(_){return I(_)}),(typeof R!="object"||R.whenOpening!==!1)&&(f["'>'"]=function(_){return H(_)}),P.addKeyMap(f)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],M=["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 H(P){if(P.getOption("disableInput"))return ie.Pass;for(var R=P.listSelections(),c=[],f=P.getOption("autoCloseTags"),_=0;_<R.length;_++){if(!R[_].empty())return ie.Pass;var p=R[_].head,m=P.getTokenAt(p),y=ie.innerMode(P.getMode(),m.state),a=y.state,i=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(a),o=i&&i.name;if(!o)return ie.Pass;var l=y.mode.configuration=="html",C=typeof f=="object"&&f.dontCloseTags||l&&Y,g=typeof f=="object"&&f.indentTags||l&&M;m.end>p.ch&&(o=o.slice(0,o.length-m.end+p.ch));var v=o.toLowerCase();if(!o||m.type=="string"&&(m.end!=p.ch||!/[\"\']/.test(m.string.charAt(m.string.length-1))||m.string.length==1)||m.type=="tag"&&i.close||m.string.indexOf("/")==p.ch-m.start-1||C&&j(C,v)>-1||N(P,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(a)||[],o,p,!0))return ie.Pass;var L=typeof f=="object"&&f.emptyTags;if(L&&j(L,o)>-1){c[_]={text:"/>",newPos:ie.Pos(p.line,p.ch+2)};continue}var A=g&&j(g,v)>-1;c[_]={indent:A,text:">"+(A?`
`:"")+"</"+o+">",newPos:A?ie.Pos(p.line+1,0):ie.Pos(p.line,p.ch+1)}}for(var T=typeof f=="object"&&f.dontIndentOnAutoClose,_=R.length-1;_>=0;_--){var x=c[_];P.replaceRange(x.text,R[_].head,R[_].anchor,"+insert");var h=P.listSelections().slice(0);h[_]={head:x.newPos,anchor:x.newPos},P.setSelections(h),!T&&x.indent&&(P.indentLine(x.newPos.line,null,!0),P.indentLine(x.newPos.line+1,null,!0))}}function O(P,R){for(var c=P.listSelections(),f=[],_=R?"/":"</",p=P.getOption("autoCloseTags"),m=typeof p=="object"&&p.dontIndentOnSlash,y=0;y<c.length;y++){if(!c[y].empty())return ie.Pass;var a=c[y].head,i=P.getTokenAt(a),o=ie.innerMode(P.getMode(),i.state),l=o.state;if(R&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return ie.Pass;var C,g=o.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(g&&o.mode.name=="javascript")C=_+"script";else if(g&&o.mode.name=="css")C=_+"style";else{var v=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(l);if(!v||v.length&&N(P,v,v[v.length-1],a))return ie.Pass;C=_+v[v.length-1]}P.getLine(a.line).charAt(i.end)!=">"&&(C+=">"),f[y]=C}if(P.replaceSelections(f),c=P.listSelections(),!m)for(var y=0;y<c.length;y++)(y==c.length-1||c[y].head.line<c[y+1].head.line)&&P.indentLine(c[y].head.line)}function I(P){return P.getOption("disableInput")?ie.Pass:O(P,!0)}ie.commands.closeTag=function(P){return O(P)};function j(P,R){if(P.indexOf)return P.indexOf(R);for(var c=0,f=P.length;c<f;++c)if(P[c]==R)return c;return-1}function N(P,R,c,f,_){if(!ie.scanForClosingTag)return!1;var p=Math.min(P.lastLine()+1,f.line+500),m=ie.scanForClosingTag(P,f,null,p);if(!m||m.tag!=c)return!1;for(var y=_?1:0,a=R.length-1;a>=0&&R[a]==c;a--)++y;f=m.to;for(var a=1;a<y;a++){var i=ie.scanForClosingTag(P,f,null,p);if(!i||i.tag!=c)return!1;f=i.to}return!0}})},BdwD:function(Wt,Me,$){"use strict";var ie=$("+L6B"),Y=$("2/Rp"),M=$("0Owb"),H=$("k1fw"),O=$("q1tI"),I=$.n(O),j=$("FOrL"),N=$.n(j),P=function(c){var f=c.buttonProps,_=f===void 0?{}:f,p=c.styles,m=p===void 0?{}:p,y=c.customText,a=c.ButtonText,i=c.ButtonClick,o=c.Buttonclass,l=c.ButtonTwo;return I.a.createElement("section",{className:"tc animated fadeIn",style:Object(H.a)(Object(H.a)({},{color:"#999",margin:"200px auto"}),m)},I.a.createElement("img",{src:N.a}),I.a.createElement("p",{className:"mt20 font14"},y||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),a&&I.a.createElement(Y.a,Object(M.a)({className:o,onClick:i},_),a),l&&l)};Me.a=P},BjJ7:function(Wt,Me,$){"use strict";$.d(Me,"d",function(){return Y}),$.d(Me,"c",function(){return M}),$.d(Me,"e",function(){return H}),$.d(Me,"b",function(){return O}),$.d(Me,"a",function(){return j});var ie=$("m3rI");function Y(N){var P=!0;if(N.length>0){for(var R=0;R<N.length;R++)if(N[R].compile_success==0||!N[R].compile_success){P=!1;break}}else P=!1;return P}function M(N){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],c=0;c<N.length;c++){var f=N[c],_=P?"".concat(P,"/").concat(f.name):"".concat(f.name);R.push({title:f.name,isLeaf:!(f.type==="tree"),key:_})}return R}function H(N,P,R){for(var c=0;c<N.length;c++){var f=N[c];if(f.key===P){f.children=R;break}f.children&&H(f.children,P,R)}return N}function O(N,P,R){var c;return function(){var f=this,_=arguments,p=function(){c=null,R||N.apply(f,_)},m=R&&!c;clearTimeout(c),c=setTimeout(p,P),m&&N.apply(f,_)}}var I=!0,j=ie.a.API_SERVER},"C+DQ":function(Wt,Me,$){},"C/vA":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return ie});function ie(Y){var M=this,H=!1,O;return function(){return H||(H=!0,O=Y.apply(M,arguments)),O}}},"Cg/j":function(Wt,Me,$){"use strict";$.d(Me,"b",function(){return ie}),$.d(Me,"a",function(){return Y}),$.d(Me,"c",function(){return H}),$.d(Me,"d",function(){return O});var ie;(function(I){I.serviceIds=new Map,I.DI_TARGET="$di$target",I.DI_DEPENDENCIES="$di$dependencies";function j(N){return N[I.DI_DEPENDENCIES]||[]}I.getServiceDependencies=j})(ie||(ie={}));var Y=H("instantiationService");function M(I,j,N,P){j[ie.DI_TARGET]===j?j[ie.DI_DEPENDENCIES].push({id:I,index:N,optional:P}):(j[ie.DI_DEPENDENCIES]=[{id:I,index:N,optional:P}],j[ie.DI_TARGET]=j)}function H(I){if(ie.serviceIds.has(I))return ie.serviceIds.get(I);var j=function(N,P,R){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");M(j,N,R,!1)};return j.toString=function(){return I},ie.serviceIds.set(I,j),j}function O(I){return function(j,N,P){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");M(I,j,P,!0)}}},DlQD:function(Wt,Me,$){(function(ie,Y){Wt.exports=Y()})(this,function(){"use strict";function ie(Ae,be){for(var Se=0;Se<be.length;Se++){var re=be[Se];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ae,re.key,re)}}function Y(Ae,be,Se){return be&&ie(Ae.prototype,be),Se&&ie(Ae,Se),Ae}function M(Ae,be){if(!Ae)return;if(typeof Ae=="string")return H(Ae,be);var Se=Object.prototype.toString.call(Ae).slice(8,-1);if(Se==="Object"&&Ae.constructor&&(Se=Ae.constructor.name),Se==="Map"||Se==="Set")return Array.from(Ae);if(Se==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Se))return H(Ae,be)}function H(Ae,be){(be==null||be>Ae.length)&&(be=Ae.length);for(var Se=0,re=new Array(be);Se<be;Se++)re[Se]=Ae[Se];return re}function O(Ae,be){var Se;if(typeof Symbol=="undefined"||Ae[Symbol.iterator]==null){if(Array.isArray(Ae)||(Se=M(Ae))||be&&Ae&&typeof Ae.length=="number"){Se&&(Ae=Se);var re=0;return function(){return re>=Ae.length?{done:!0}:{done:!1,value:Ae[re++]}}}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 Se=Ae[Symbol.iterator](),Se.next.bind(Se)}function I(Ae,be){return be={exports:{}},Ae(be,be.exports),be.exports}var j=I(function(Ae){function be(){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 Se(re){Ae.exports.defaults=re}Ae.exports={defaults:be(),getDefaults:be,changeDefaults:Se}}),N=j.defaults,P=j.getDefaults,R=j.changeDefaults,c=/[&<>"']/,f=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=function(be){return m[be]};function a(Ae,be){if(be){if(c.test(Ae))return Ae.replace(f,y)}else if(_.test(Ae))return Ae.replace(p,y);return Ae}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(Ae){return Ae.replace(i,function(be,Se){return Se=Se.toLowerCase(),Se==="colon"?":":Se.charAt(0)==="#"?Se.charAt(1)==="x"?String.fromCharCode(parseInt(Se.substring(2),16)):String.fromCharCode(+Se.substring(1)):""})}var l=/(^|[^\[])\^/g;function C(Ae,be){Ae=Ae.source||Ae,be=be||"";var Se={replace:function(ae,fe){return fe=fe.source||fe,fe=fe.replace(l,"$1"),Ae=Ae.replace(ae,fe),Se},getRegex:function(){return new RegExp(Ae,be)}};return Se}var g=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(Ae,be,Se){if(Ae){var re;try{re=decodeURIComponent(o(Se)).replace(g,"").toLowerCase()}catch(ae){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}be&&!v.test(Se)&&(Se=u(be,Se));try{Se=encodeURI(Se).replace(/%25/g,"%")}catch(ae){return null}return Se}var A={},T=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ae,be){A[" "+Ae]||(T.test(Ae)?A[" "+Ae]=Ae+"/":A[" "+Ae]=b(Ae,"/",!0)),Ae=A[" "+Ae];var Se=Ae.indexOf(":")===-1;return be.substring(0,2)==="//"?Se?be:Ae.replace(x,"$1")+be:be.charAt(0)==="/"?Se?be:Ae.replace(h,"$1")+be:Ae+be}var D={exec:function(){}};function S(Ae){for(var be=1,Se,re;be<arguments.length;be++){Se=arguments[be];for(re in Se)Object.prototype.hasOwnProperty.call(Se,re)&&(Ae[re]=Se[re])}return Ae}function w(Ae,be){var Se=Ae.replace(/\|/g,function(fe,Ee,je){for(var Te=!1,Ne=Ee;--Ne>=0&&je[Ne]==="\\";)Te=!Te;return Te?"|":" |"}),re=Se.split(/ \|/),ae=0;if(re.length>be)re.splice(be);else for(;re.length<be;)re.push("");for(;ae<re.length;ae++)re[ae]=re[ae].trim().replace(/\\\|/g,"|");return re}function b(Ae,be,Se){var re=Ae.length;if(re===0)return"";for(var ae=0;ae<re;){var fe=Ae.charAt(re-ae-1);if(fe===be&&!Se)ae++;else if(fe!==be&&Se)ae++;else break}return Ae.substr(0,re-ae)}function K(Ae,be){if(Ae.indexOf(be[1])===-1)return-1;for(var Se=Ae.length,re=0,ae=0;ae<Se;ae++)if(Ae[ae]==="\\")ae++;else if(Ae[ae]===be[0])re++;else if(Ae[ae]===be[1]&&(re--,re<0))return ae;return-1}function X(Ae){Ae&&Ae.sanitize&&!Ae.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 Q={escape:a,unescape:o,edit:C,cleanUrl:L,resolveUrl:u,noopTest:D,merge:S,splitCells:w,rtrim:b,findClosingBracket:K,checkSanitizeDeprecation:X},V=j.defaults,W=Q.rtrim,te=Q.splitCells,ue=Q.escape,ge=Q.findClosingBracket;function Oe(Ae,be,Se){var re=be.href,ae=be.title?ue(be.title):null,fe=Ae[1].replace(/\\([\[\]])/g,"$1");return Ae[0].charAt(0)!=="!"?{type:"link",raw:Se,href:re,title:ae,text:fe}:{type:"image",raw:Se,href:re,title:ae,text:ue(fe)}}function qe(Ae,be){var Se=Ae.match(/^(\s+)(?:```)/);if(Se===null)return be;var re=Se[1];return be.split(`
`).map(function(ae){var fe=ae.match(/^\s+/);if(fe===null)return ae;var Ee=fe[0];return Ee.length>=re.length?ae.slice(re.length):ae}).join(`
`)}var Ke=function(){function Ae(Se){this.options=Se||V}var be=Ae.prototype;return be.space=function(re){var ae=this.rules.block.newline.exec(re);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
`}},be.code=function(re,ae){var fe=this.rules.block.code.exec(re);if(fe){var Ee=ae[ae.length-1];if(Ee&&Ee.type==="paragraph")return{raw:fe[0],text:fe[0].trimRight()};var je=fe[0].replace(/^ {4}/gm,"");return{type:"code",raw:fe[0],codeBlockStyle:"indented",text:this.options.pedantic?je:W(je,`
`)}}},be.fences=function(re){var ae=this.rules.block.fences.exec(re);if(ae){var fe=ae[0],Ee=qe(fe,ae[3]||"");return{type:"code",raw:fe,lang:ae[2]?ae[2].trim():ae[2],text:Ee}}},be.heading=function(re){var ae=this.rules.block.heading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},be.nptable=function(re){var ae=this.rules.block.nptable.exec(re);if(ae){var fe={type:"table",header:te(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 Ee=fe.align.length,je;for(je=0;je<Ee;je++)/^ *-+: *$/.test(fe.align[je])?fe.align[je]="right":/^ *:-+: *$/.test(fe.align[je])?fe.align[je]="center":/^ *:-+ *$/.test(fe.align[je])?fe.align[je]="left":fe.align[je]=null;for(Ee=fe.cells.length,je=0;je<Ee;je++)fe.cells[je]=te(fe.cells[je],fe.header.length);return fe}}},be.hr=function(re){var ae=this.rules.block.hr.exec(re);if(ae)return{type:"hr",raw:ae[0]}},be.blockquote=function(re){var ae=this.rules.block.blockquote.exec(re);if(ae){var fe=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:fe}}},be.list=function(re){var ae=this.rules.block.list.exec(re);if(ae){for(var fe=ae[0],Ee=ae[2],je=Ee.length>1,Te=Ee[Ee.length-1]===")",Ne={type:"list",raw:fe,ordered:je,start:je?+Ee.slice(0,-1):"",loose:!1,items:[]},st=ae[0].match(this.rules.block.item),pt=!1,St,$t,_t,$e,bn,ze,vn,ln=st.length,Ht=0;Ht<ln;Ht++)St=st[Ht],fe=St,$t=St.length,St=St.replace(/^ *([*+-]|\d+[.)]) */,""),~St.indexOf(`
`)&&($t-=St.length,St=this.options.pedantic?St.replace(/^ {1,4}/gm,""):St.replace(new RegExp("^ {1,"+$t+"}","gm"),"")),Ht!==ln-1&&(_t=this.rules.block.bullet.exec(st[Ht+1])[0],(je?_t.length===1||!Te&&_t[_t.length-1]===")":_t.length>1||this.options.smartLists&&_t!==Ee)&&($e=st.slice(Ht+1).join(`
`),Ne.raw=Ne.raw.substring(0,Ne.raw.length-$e.length),Ht=ln-1)),bn=pt||/\n\n(?!\s*$)/.test(St),Ht!==ln-1&&(pt=St.charAt(St.length-1)===`
`,bn||(bn=pt)),bn&&(Ne.loose=!0),ze=/^\[[ xX]\] /.test(St),vn=void 0,ze&&(vn=St[1]!==" ",St=St.replace(/^\[[ xX]\] +/,"")),Ne.items.push({type:"list_item",raw:fe,task:ze,checked:vn,loose:bn,text:St});return Ne}},be.html=function(re){var ae=this.rules.block.html.exec(re);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]):ue(ae[0]):ae[0]}},be.def=function(re){var ae=this.rules.block.def.exec(re);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]}}},be.table=function(re){var ae=this.rules.block.table.exec(re);if(ae){var fe={type:"table",header:te(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 Ee=fe.align.length,je;for(je=0;je<Ee;je++)/^ *-+: *$/.test(fe.align[je])?fe.align[je]="right":/^ *:-+: *$/.test(fe.align[je])?fe.align[je]="center":/^ *:-+ *$/.test(fe.align[je])?fe.align[je]="left":fe.align[je]=null;for(Ee=fe.cells.length,je=0;je<Ee;je++)fe.cells[je]=te(fe.cells[je].replace(/^ *\| *| *\| *$/g,""),fe.header.length);return fe}}},be.lheading=function(re){var ae=this.rules.block.lheading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},be.paragraph=function(re){var ae=this.rules.block.paragraph.exec(re);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
`?ae[1].slice(0,-1):ae[1]}},be.text=function(re,ae){var fe=this.rules.block.text.exec(re);if(fe){var Ee=ae[ae.length-1];return Ee&&Ee.type==="text"?{raw:fe[0],text:fe[0]}:{type:"text",raw:fe[0],text:fe[0]}}},be.escape=function(re){var ae=this.rules.inline.escape.exec(re);if(ae)return{type:"escape",raw:ae[0],text:ue(ae[1])}},be.tag=function(re,ae,fe){var Ee=this.rules.inline.tag.exec(re);if(Ee)return!ae&&/^<a /i.test(Ee[0])?ae=!0:ae&&/^<\/a>/i.test(Ee[0])&&(ae=!1),!fe&&/^<(pre|code|kbd|script)(\s|>)/i.test(Ee[0])?fe=!0:fe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Ee[0])&&(fe=!1),{type:this.options.sanitize?"text":"html",raw:Ee[0],inLink:ae,inRawBlock:fe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):ue(Ee[0]):Ee[0]}},be.link=function(re){var ae=this.rules.inline.link.exec(re);if(ae){var fe=ge(ae[2],"()");if(fe>-1){var Ee=ae[0].indexOf("!")===0?5:4,je=Ee+ae[1].length+fe;ae[2]=ae[2].substring(0,fe),ae[0]=ae[0].substring(0,je).trim(),ae[3]=""}var Te=ae[2],Ne="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Te);st?(Te=st[1],Ne=st[3]):Ne=""}else Ne=ae[3]?ae[3].slice(1,-1):"";Te=Te.trim().replace(/^<([\s\S]*)>$/,"$1");var pt=Oe(ae,{href:Te&&Te.replace(this.rules.inline._escapes,"$1"),title:Ne&&Ne.replace(this.rules.inline._escapes,"$1")},ae[0]);return pt}},be.reflink=function(re,ae){var fe;if((fe=this.rules.inline.reflink.exec(re))||(fe=this.rules.inline.nolink.exec(re))){var Ee=(fe[2]||fe[1]).replace(/\s+/g," ");if(Ee=ae[Ee.toLowerCase()],!Ee||!Ee.href){var je=fe[0].charAt(0);return{type:"text",raw:je,text:je}}var Te=Oe(fe,Ee,fe[0]);return Te}},be.strong=function(re,ae,fe){fe===void 0&&(fe="");var Ee=this.rules.inline.strong.start.exec(re);if(Ee&&(!Ee[1]||Ee[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ae=ae.slice(-1*re.length);var je=Ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;je.lastIndex=0;for(var Te;(Ee=je.exec(ae))!=null;)if(Te=this.rules.inline.strong.middle.exec(ae.slice(0,Ee.index+3)),Te)return{type:"strong",raw:re.slice(0,Te[0].length),text:re.slice(2,Te[0].length-2)}}},be.em=function(re,ae,fe){fe===void 0&&(fe="");var Ee=this.rules.inline.em.start.exec(re);if(Ee&&(!Ee[1]||Ee[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ae=ae.slice(-1*re.length);var je=Ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;je.lastIndex=0;for(var Te;(Ee=je.exec(ae))!=null;)if(Te=this.rules.inline.em.middle.exec(ae.slice(0,Ee.index+2)),Te)return{type:"em",raw:re.slice(0,Te[0].length),text:re.slice(1,Te[0].length-1)}}},be.codespan=function(re){var ae=this.rules.inline.code.exec(re);if(ae){var fe=ae[2].replace(/\n/g," "),Ee=/[^ ]/.test(fe),je=fe.startsWith(" ")&&fe.endsWith(" ");return Ee&&je&&(fe=fe.substring(1,fe.length-1)),fe=ue(fe,!0),{type:"codespan",raw:ae[0],text:fe}}},be.br=function(re){var ae=this.rules.inline.br.exec(re);if(ae)return{type:"br",raw:ae[0]}},be.del=function(re){var ae=this.rules.inline.del.exec(re);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},be.autolink=function(re,ae){var fe=this.rules.inline.autolink.exec(re);if(fe){var Ee,je;return fe[2]==="@"?(Ee=ue(this.options.mangle?ae(fe[1]):fe[1]),je="mailto:"+Ee):(Ee=ue(fe[1]),je=Ee),{type:"link",raw:fe[0],text:Ee,href:je,tokens:[{type:"text",raw:Ee,text:Ee}]}}},be.url=function(re,ae){var fe;if(fe=this.rules.inline.url.exec(re)){var Ee,je;if(fe[2]==="@")Ee=ue(this.options.mangle?ae(fe[0]):fe[0]),je="mailto:"+Ee;else{var Te;do Te=fe[0],fe[0]=this.rules.inline._backpedal.exec(fe[0])[0];while(Te!==fe[0]);Ee=ue(fe[0]),fe[1]==="www."?je="http://"+Ee:je=Ee}return{type:"link",raw:fe[0],text:Ee,href:je,tokens:[{type:"text",raw:Ee,text:Ee}]}}},be.inlineText=function(re,ae,fe){var Ee=this.rules.inline.text.exec(re);if(Ee){var je;return ae?je=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):ue(Ee[0]):Ee[0]:je=ue(this.options.smartypants?fe(Ee[0]):Ee[0]),{type:"text",raw:Ee[0],text:je}}},Ae}(),Be=Q.noopTest,Xe=Q.edit,Fe=Q.merge,xe={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:Be,table:Be,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};xe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,xe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,xe.def=Xe(xe.def).replace("label",xe._label).replace("title",xe._title).getRegex(),xe.bullet=/(?:[*+-]|\d{1,9}[.)])/,xe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,xe.item=Xe(xe.item,"gm").replace(/bull/g,xe.bullet).getRegex(),xe.list=Xe(xe.list).replace(/bull/g,xe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+xe.def.source+")").getRegex(),xe._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",xe._comment=/<!--(?!-?>)[\s\S]*?-->/,xe.html=Xe(xe.html,"i").replace("comment",xe._comment).replace("tag",xe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xe.paragraph=Xe(xe._paragraph).replace("hr",xe.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",xe._tag).getRegex(),xe.blockquote=Xe(xe.blockquote).replace("paragraph",xe.paragraph).getRegex(),xe.normal=Fe({},xe),xe.gfm=Fe({},xe.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*|$)"}),xe.gfm.nptable=Xe(xe.gfm.nptable).replace("hr",xe.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",xe._tag).getRegex(),xe.gfm.table=Xe(xe.gfm.table).replace("hr",xe.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",xe._tag).getRegex(),xe.pedantic=Fe({},xe.normal,{html:Xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xe._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:Be,paragraph:Xe(xe.normal._paragraph).replace("hr",xe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",xe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Be,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:Be,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=Xe(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=Xe(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=Xe(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=Xe(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=Xe(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=Xe(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=Xe(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=Xe(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=Xe(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=Xe(oe._blockSkip,"g").getRegex(),oe.overlapSkip=Xe(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=Xe(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=Xe(oe.tag).replace("comment",xe._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=Xe(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=Xe(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=Xe(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=Fe({},oe),oe.pedantic=Fe({},oe.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:Xe(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:Xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=Fe({},oe.normal,{escape:Xe(oe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=Xe(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=Fe({},oe.gfm,{br:Xe(oe.br).replace("{2,}","*").getRegex(),text:Xe(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Re={block:xe,inline:oe},dt=j.defaults,at=Re.block,ut=Re.inline;function ce(Ae){return Ae.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 he(Ae){var be="",Se,re,ae=Ae.length;for(Se=0;Se<ae;Se++)re=Ae.charCodeAt(Se),Math.random()>.5&&(re="x"+re.toString(16)),be+="&#"+re+";";return be}var Le=function(){function Ae(Se){this.tokens=[],this.tokens.links=Object.create(null),this.options=Se||dt,this.options.tokenizer=this.options.tokenizer||new Ke,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:at.normal,inline:ut.normal};this.options.pedantic?(re.block=at.pedantic,re.inline=ut.pedantic):this.options.gfm&&(re.block=at.gfm,this.options.breaks?re.inline=ut.breaks:re.inline=ut.gfm),this.tokenizer.rules=re}Ae.lex=function(re,ae){var fe=new Ae(ae);return fe.lex(re)};var be=Ae.prototype;return be.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},be.blockTokens=function(re,ae,fe){ae===void 0&&(ae=[]),fe===void 0&&(fe=!0),re=re.replace(/^ +$/gm,"");for(var Ee,je,Te,Ne;re;){if(Ee=this.tokenizer.space(re)){re=re.substring(Ee.raw.length),Ee.type&&ae.push(Ee);continue}if(Ee=this.tokenizer.code(re,ae)){re=re.substring(Ee.raw.length),Ee.type?ae.push(Ee):(Ne=ae[ae.length-1],Ne.raw+=`
`+Ee.raw,Ne.text+=`
`+Ee.text);continue}if(Ee=this.tokenizer.fences(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.heading(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.nptable(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.hr(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.blockquote(re)){re=re.substring(Ee.raw.length),Ee.tokens=this.blockTokens(Ee.text,[],fe),ae.push(Ee);continue}if(Ee=this.tokenizer.list(re)){for(re=re.substring(Ee.raw.length),Te=Ee.items.length,je=0;je<Te;je++)Ee.items[je].tokens=this.blockTokens(Ee.items[je].text,[],!1);ae.push(Ee);continue}if(Ee=this.tokenizer.html(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(fe&&(Ee=this.tokenizer.def(re))){re=re.substring(Ee.raw.length),this.tokens.links[Ee.tag]||(this.tokens.links[Ee.tag]={href:Ee.href,title:Ee.title});continue}if(Ee=this.tokenizer.table(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.lheading(re)){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(fe&&(Ee=this.tokenizer.paragraph(re))){re=re.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.text(re,ae)){re=re.substring(Ee.raw.length),Ee.type?ae.push(Ee):(Ne=ae[ae.length-1],Ne.raw+=`
`+Ee.raw,Ne.text+=`
`+Ee.text);continue}if(re){var st="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return ae},be.inline=function(re){var ae,fe,Ee,je,Te,Ne,st=re.length;for(ae=0;ae<st;ae++){Ne=re[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:[]},je=Ne.header.length,fe=0;fe<je;fe++)Ne.tokens.header[fe]=[],this.inlineTokens(Ne.header[fe],Ne.tokens.header[fe]);for(je=Ne.cells.length,fe=0;fe<je;fe++)for(Te=Ne.cells[fe],Ne.tokens.cells[fe]=[],Ee=0;Ee<Te.length;Ee++)Ne.tokens.cells[fe][Ee]=[],this.inlineTokens(Te[Ee],Ne.tokens.cells[fe][Ee]);break}case"blockquote":{this.inline(Ne.tokens);break}case"list":{for(je=Ne.items.length,fe=0;fe<je;fe++)this.inline(Ne.items[fe].tokens);break}}}return re},be.inlineTokens=function(re,ae,fe,Ee,je){ae===void 0&&(ae=[]),fe===void 0&&(fe=!1),Ee===void 0&&(Ee=!1),je===void 0&&(je="");var Te,Ne=re,st;if(this.tokens.links){var pt=Object.keys(this.tokens.links);if(pt.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(Ne))!=null;)pt.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(Ne=Ne.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(Ne))!=null;)Ne=Ne.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Te=this.tokenizer.escape(re)){re=re.substring(Te.raw.length),ae.push(Te);continue}if(Te=this.tokenizer.tag(re,fe,Ee)){re=re.substring(Te.raw.length),fe=Te.inLink,Ee=Te.inRawBlock,ae.push(Te);continue}if(Te=this.tokenizer.link(re)){re=re.substring(Te.raw.length),Te.type==="link"&&(Te.tokens=this.inlineTokens(Te.text,[],!0,Ee)),ae.push(Te);continue}if(Te=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Te.raw.length),Te.type==="link"&&(Te.tokens=this.inlineTokens(Te.text,[],!0,Ee)),ae.push(Te);continue}if(Te=this.tokenizer.strong(re,Ne,je)){re=re.substring(Te.raw.length),Te.tokens=this.inlineTokens(Te.text,[],fe,Ee),ae.push(Te);continue}if(Te=this.tokenizer.em(re,Ne,je)){re=re.substring(Te.raw.length),Te.tokens=this.inlineTokens(Te.text,[],fe,Ee),ae.push(Te);continue}if(Te=this.tokenizer.codespan(re)){re=re.substring(Te.raw.length),ae.push(Te);continue}if(Te=this.tokenizer.br(re)){re=re.substring(Te.raw.length),ae.push(Te);continue}if(Te=this.tokenizer.del(re)){re=re.substring(Te.raw.length),Te.tokens=this.inlineTokens(Te.text,[],fe,Ee),ae.push(Te);continue}if(Te=this.tokenizer.autolink(re,he)){re=re.substring(Te.raw.length),ae.push(Te);continue}if(!fe&&(Te=this.tokenizer.url(re,he))){re=re.substring(Te.raw.length),ae.push(Te);continue}if(Te=this.tokenizer.inlineText(re,Ee,ce)){re=re.substring(Te.raw.length),je=Te.raw.slice(-1),ae.push(Te);continue}if(re){var St="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(St);break}else throw new Error(St)}}return ae},Y(Ae,null,[{key:"rules",get:function(){return{block:at,inline:ut}}}]),Ae}(),Ve=j.defaults,et=Q.cleanUrl,tt=Q.escape,rt=function(){function Ae(Se){this.options=Se||Ve}var be=Ae.prototype;return be.code=function(re,ae,fe){var Ee=(ae||"").match(/\S*/)[0];if(this.options.highlight){var je=this.options.highlight(re,Ee);je!=null&&je!==re&&(fe=!0,re=je)}return Ee?'<pre><code class="'+this.options.langPrefix+tt(Ee,!0)+'">'+(fe?re:tt(re,!0))+`</code></pre>
`:"<pre><code>"+(fe?re:tt(re,!0))+`</code></pre>
`},be.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},be.html=function(re){return re},be.heading=function(re,ae,fe,Ee){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+Ee.slug(fe)+'">'+re+"</h"+ae+`>
`:"<h"+ae+">"+re+"</h"+ae+`>
`},be.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},be.list=function(re,ae,fe){var Ee=ae?"ol":"ul",je=ae&&fe!==1?' start="'+fe+'"':"";return"<"+Ee+je+`>
`+re+"</"+Ee+`>
`},be.listitem=function(re){return"<li>"+re+`</li>
`},be.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},be.paragraph=function(re){return"<p>"+re+`</p>
`},be.table=function(re,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ae+`</table>
`},be.tablerow=function(re){return`<tr>
`+re+`</tr>
`},be.tablecell=function(re,ae){var fe=ae.header?"th":"td",Ee=ae.align?"<"+fe+' align="'+ae.align+'">':"<"+fe+">";return Ee+re+"</"+fe+`>
`},be.strong=function(re){return"<strong>"+re+"</strong>"},be.em=function(re){return"<em>"+re+"</em>"},be.codespan=function(re){return"<code>"+re+"</code>"},be.br=function(){return this.options.xhtml?"<br/>":"<br>"},be.del=function(re){return"<del>"+re+"</del>"},be.link=function(re,ae,fe){if(re=et(this.options.sanitize,this.options.baseUrl,re),re===null)return fe;var Ee='<a href="'+tt(re)+'"';return ae&&(Ee+=' title="'+ae+'"'),Ee+=">"+fe+"</a>",Ee},be.image=function(re,ae,fe){if(re=et(this.options.sanitize,this.options.baseUrl,re),re===null)return fe;var Ee='<img src="'+re+'" alt="'+fe+'"';return ae&&(Ee+=' title="'+ae+'"'),Ee+=this.options.xhtml?"/>":">",Ee},be.text=function(re){return re},Ae}(),it=function(){function Ae(){}var be=Ae.prototype;return be.strong=function(re){return re},be.em=function(re){return re},be.codespan=function(re){return re},be.del=function(re){return re},be.html=function(re){return re},be.text=function(re){return re},be.link=function(re,ae,fe){return""+fe},be.image=function(re,ae,fe){return""+fe},be.br=function(){return""},Ae}(),Dt=function(){function Ae(){this.seen={}}var be=Ae.prototype;return be.slug=function(re){var ae=re.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},Ae}(),Et=j.defaults,xt=Q.unescape,ct=function(){function Ae(Se){this.options=Se||Et,this.options.renderer=this.options.renderer||new rt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new it,this.slugger=new Dt}Ae.parse=function(re,ae){var fe=new Ae(ae);return fe.parse(re)};var be=Ae.prototype;return be.parse=function(re,ae){ae===void 0&&(ae=!0);var fe="",Ee,je,Te,Ne,st,pt,St,$t,_t,$e,bn,ze,vn,ln,Ht,an,gn,kt,Mt=re.length;for(Ee=0;Ee<Mt;Ee++){$e=re[Ee];switch($e.type){case"space":continue;case"hr":{fe+=this.renderer.hr();continue}case"heading":{fe+=this.renderer.heading(this.parseInline($e.tokens),$e.depth,xt(this.parseInline($e.tokens,this.textRenderer)),this.slugger);continue}case"code":{fe+=this.renderer.code($e.text,$e.lang,$e.escaped);continue}case"table":{for($t="",St="",Ne=$e.header.length,je=0;je<Ne;je++)St+=this.renderer.tablecell(this.parseInline($e.tokens.header[je]),{header:!0,align:$e.align[je]});for($t+=this.renderer.tablerow(St),_t="",Ne=$e.cells.length,je=0;je<Ne;je++){for(pt=$e.tokens.cells[je],St="",st=pt.length,Te=0;Te<st;Te++)St+=this.renderer.tablecell(this.parseInline(pt[Te]),{header:!1,align:$e.align[Te]});_t+=this.renderer.tablerow(St)}fe+=this.renderer.table($t,_t);continue}case"blockquote":{_t=this.parse($e.tokens),fe+=this.renderer.blockquote(_t);continue}case"list":{for(bn=$e.ordered,ze=$e.start,vn=$e.loose,Ne=$e.items.length,_t="",je=0;je<Ne;je++)Ht=$e.items[je],an=Ht.checked,gn=Ht.task,ln="",Ht.task&&(kt=this.renderer.checkbox(an),vn?Ht.tokens.length>0&&Ht.tokens[0].type==="text"?(Ht.tokens[0].text=kt+" "+Ht.tokens[0].text,Ht.tokens[0].tokens&&Ht.tokens[0].tokens.length>0&&Ht.tokens[0].tokens[0].type==="text"&&(Ht.tokens[0].tokens[0].text=kt+" "+Ht.tokens[0].tokens[0].text)):Ht.tokens.unshift({type:"text",text:kt}):ln+=kt),ln+=this.parse(Ht.tokens,vn),_t+=this.renderer.listitem(ln,gn,an);fe+=this.renderer.list(_t,bn,ze);continue}case"html":{fe+=this.renderer.html($e.text);continue}case"paragraph":{fe+=this.renderer.paragraph(this.parseInline($e.tokens));continue}case"text":{for(_t=$e.tokens?this.parseInline($e.tokens):$e.text;Ee+1<Mt&&re[Ee+1].type==="text";)$e=re[++Ee],_t+=`
`+($e.tokens?this.parseInline($e.tokens):$e.text);fe+=ae?this.renderer.paragraph(_t):_t;continue}default:{var mt='Token with "'+$e.type+'" type was not found.';if(this.options.silent){console.error(mt);return}else throw new Error(mt)}}}return fe},be.parseInline=function(re,ae){ae=ae||this.renderer;var fe="",Ee,je,Te=re.length;for(Ee=0;Ee<Te;Ee++){je=re[Ee];switch(je.type){case"escape":{fe+=ae.text(je.text);break}case"html":{fe+=ae.html(je.text);break}case"link":{fe+=ae.link(je.href,je.title,this.parseInline(je.tokens,ae));break}case"image":{fe+=ae.image(je.href,je.title,je.text);break}case"strong":{fe+=ae.strong(this.parseInline(je.tokens,ae));break}case"em":{fe+=ae.em(this.parseInline(je.tokens,ae));break}case"codespan":{fe+=ae.codespan(je.text);break}case"br":{fe+=ae.br();break}case"del":{fe+=ae.del(this.parseInline(je.tokens,ae));break}case"text":{fe+=ae.text(je.text);break}default:{var Ne='Token with "'+je.type+'" type was not found.';if(this.options.silent){console.error(Ne);return}else throw new Error(Ne)}}}return fe},Ae}(),Ft=Q.merge,wt=Q.checkSanitizeDeprecation,Pt=Q.escape,We=j.getDefaults,gt=j.changeDefaults,Ut=j.defaults;function Qe(Ae,be,Se){if(typeof Ae=="undefined"||Ae===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ae!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ae)+", string expected");if(typeof be=="function"&&(Se=be,be=null),be=Ft({},Qe.defaults,be||{}),wt(be),Se){var re=be.highlight,ae;try{ae=Le.lex(Ae,be)}catch(Te){return Se(Te)}var fe=function(Ne){var st;if(!Ne)try{st=ct.parse(ae,be)}catch(pt){Ne=pt}return be.highlight=re,Ne?Se(Ne):Se(null,st)};if(!re||re.length<3)return fe();if(delete be.highlight,!ae.length)return fe();var Ee=0;Qe.walkTokens(ae,function(Te){Te.type==="code"&&(Ee++,setTimeout(function(){re(Te.text,Te.lang,function(Ne,st){if(Ne)return fe(Ne);st!=null&&st!==Te.text&&(Te.text=st,Te.escaped=!0),Ee--,Ee===0&&fe()})},0))}),Ee===0&&fe();return}try{var je=Le.lex(Ae,be);return be.walkTokens&&Qe.walkTokens(je,be.walkTokens),ct.parse(je,be)}catch(Te){if(Te.message+=`
Please report this to https://github.com/markedjs/marked.`,be.silent)return"<p>An error occurred:</p><pre>"+Pt(Te.message+"",!0)+"</pre>";throw Te}}Qe.options=Qe.setOptions=function(Ae){return Ft(Qe.defaults,Ae),gt(Qe.defaults),Qe},Qe.getDefaults=We,Qe.defaults=Ut,Qe.use=function(Ae){var be=Ft({},Ae);if(Ae.renderer&&function(){var re=Qe.defaults.renderer||new rt,ae=function(je){var Te=re[je];re[je]=function(){for(var Ne=arguments.length,st=new Array(Ne),pt=0;pt<Ne;pt++)st[pt]=arguments[pt];var St=Ae.renderer[je].apply(re,st);return St===!1&&(St=Te.apply(re,st)),St}};for(var fe in Ae.renderer)ae(fe);be.renderer=re}(),Ae.tokenizer&&function(){var re=Qe.defaults.tokenizer||new Ke,ae=function(je){var Te=re[je];re[je]=function(){for(var Ne=arguments.length,st=new Array(Ne),pt=0;pt<Ne;pt++)st[pt]=arguments[pt];var St=Ae.tokenizer[je].apply(re,st);return St===!1&&(St=Te.apply(re,st)),St}};for(var fe in Ae.tokenizer)ae(fe);be.tokenizer=re}(),Ae.walkTokens){var Se=Qe.defaults.walkTokens;be.walkTokens=function(re){Ae.walkTokens(re),Se&&Se(re)}}Qe.setOptions(be)},Qe.walkTokens=function(Ae,be){for(var Se=O(Ae),re;!(re=Se()).done;){var ae=re.value;be(ae);switch(ae.type){case"table":{for(var fe=O(ae.tokens.header),Ee;!(Ee=fe()).done;){var je=Ee.value;Qe.walkTokens(je,be)}for(var Te=O(ae.tokens.cells),Ne;!(Ne=Te()).done;)for(var st=Ne.value,pt=O(st),St;!(St=pt()).done;){var $t=St.value;Qe.walkTokens($t,be)}break}case"list":{Qe.walkTokens(ae.items,be);break}default:ae.tokens&&Qe.walkTokens(ae.tokens,be)}}},Qe.Parser=ct,Qe.parser=ct.parse,Qe.Renderer=rt,Qe.TextRenderer=it,Qe.Lexer=Le,Qe.lexer=Le.lex,Qe.Tokenizer=Ke,Qe.Slugger=Dt,Qe.parse=Qe;var ot=Qe;return ot})},ELLl:function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},M=ie.Pos;ie.defineOption("autoCloseBrackets",!1,function(m,y,a){a&&a!=ie.Init&&(m.removeKeyMap(O),m.state.closeBrackets=null),y&&(I(H(y,"pairs")),m.state.closeBrackets=y,m.addKeyMap(O))});function H(m,y){return y=="pairs"&&typeof m=="string"?m:typeof m=="object"&&m[y]!=null?m[y]:Y[y]}var O={Backspace:P,Enter:R};function I(m){for(var y=0;y<m.length;y++){var a=m.charAt(y),i="'"+a+"'";O[i]||(O[i]=j(a))}}I(Y.pairs+"`");function j(m){return function(y){return f(y,m)}}function N(m){var y=m.state.closeBrackets;if(!y||y.override)return y;var a=m.getModeAt(m.getCursor());return a.closeBrackets||y}function P(m){var y=N(m);if(!y||m.getOption("disableInput"))return ie.Pass;for(var a=H(y,"pairs"),i=m.listSelections(),o=0;o<i.length;o++){if(!i[o].empty())return ie.Pass;var l=_(m,i[o].head);if(!l||a.indexOf(l)%2!=0)return ie.Pass}for(var o=i.length-1;o>=0;o--){var C=i[o].head;m.replaceRange("",M(C.line,C.ch-1),M(C.line,C.ch+1),"+delete")}}function R(m){var y=N(m),a=y&&H(y,"explode");if(!a||m.getOption("disableInput"))return ie.Pass;for(var i=m.listSelections(),o=0;o<i.length;o++){if(!i[o].empty())return ie.Pass;var l=_(m,i[o].head);if(!l||a.indexOf(l)%2!=0)return ie.Pass}m.operation(function(){var C=m.lineSeparator()||`
`;m.replaceSelection(C+C,null),m.execCommand("goCharLeft"),i=m.listSelections();for(var g=0;g<i.length;g++){var v=i[g].head.line;m.indentLine(v,null,!0),m.indentLine(v+1,null,!0)}})}function c(m){var y=ie.cmpPos(m.anchor,m.head)>0;return{anchor:new M(m.anchor.line,m.anchor.ch+(y?-1:1)),head:new M(m.head.line,m.head.ch+(y?1:-1))}}function f(m,y){var a=N(m);if(!a||m.getOption("disableInput"))return ie.Pass;var i=H(a,"pairs"),o=i.indexOf(y);if(o==-1)return ie.Pass;for(var l=H(a,"closeBefore"),C=H(a,"triples"),g=i.charAt(o+1)==y,v=m.listSelections(),L=o%2==0,A,T=0;T<v.length;T++){var x=v[T],h=x.head,u,D=m.getRange(h,M(h.line,h.ch+1));if(L&&!x.empty())u="surround";else if((g||!L)&&D==y)g&&p(m,h)?u="both":C.indexOf(y)>=0&&m.getRange(h,M(h.line,h.ch+3))==y+y+y?u="skipThree":u="skip";else if(g&&h.ch>1&&C.indexOf(y)>=0&&m.getRange(M(h.line,h.ch-2),h)==y+y){if(h.ch>2&&/\bstring/.test(m.getTokenTypeAt(M(h.line,h.ch-2))))return ie.Pass;u="addFour"}else if(g){var S=h.ch==0?" ":m.getRange(M(h.line,h.ch-1),h);if(!ie.isWordChar(D)&&S!=y&&!ie.isWordChar(S))u="both";else return ie.Pass}else if(L&&(D.length===0||/\s/.test(D)||l.indexOf(D)>-1))u="both";else return ie.Pass;if(!A)A=u;else if(A!=u)return ie.Pass}var w=o%2?i.charAt(o-1):y,b=o%2?y:i.charAt(o+1);m.operation(function(){if(A=="skip")m.execCommand("goCharRight");else if(A=="skipThree")for(var K=0;K<3;K++)m.execCommand("goCharRight");else if(A=="surround"){for(var X=m.getSelections(),K=0;K<X.length;K++)X[K]=w+X[K]+b;m.replaceSelections(X,"around"),X=m.listSelections().slice();for(var K=0;K<X.length;K++)X[K]=c(X[K]);m.setSelections(X)}else A=="both"?(m.replaceSelection(w+b,null),m.triggerElectric(w+b),m.execCommand("goCharLeft")):A=="addFour"&&(m.replaceSelection(w+w+w+w,"before"),m.execCommand("goCharRight"))})}function _(m,y){var a=m.getRange(M(y.line,y.ch-1),M(y.line,y.ch+1));return a.length==2?a:null}function p(m,y){var a=m.getTokenAt(M(y.line,y.ch+1));return/\bstring/.test(a.type)&&a.start==y.ch&&(y.ch==0||!/\bstring/.test(m.getTokenTypeAt(y)))}})},FOrL:function(Wt,Me,$){Wt.exports=$.p+"static/nodata.a6b3f948.png"},HmJG:function(Wt,Me,$){},JYp7:function(Wt,Me,$){"use strict";$.d(Me,"c",function(){return Y}),$.d(Me,"d",function(){return M}),$.d(Me,"f",function(){return O}),$.d(Me,"a",function(){return I}),$.d(Me,"b",function(){return j}),$.d(Me,"e",function(){return N});var ie=function(){var P=function(R,c){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,_){f.__proto__=_}||function(f,_){for(var p in _)_.hasOwnProperty(p)&&(f[p]=_[p])},P(R,c)};return function(R,c){P(R,c);function f(){this.constructor=R}R.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)}}(),Y={done:!0,value:void 0},M;(function(P){var R={next:function(){return Y}};function c(){return R}P.empty=c;function f(g){var v=!1;return{next:function(){return v?Y:(v=!0,{done:!1,value:g})}}}P.single=f;function _(g,v,L){return v===void 0&&(v=0),L===void 0&&(L=g.length),{next:function(){return v>=L?Y:{done:!1,value:g[v++]}}}}P.fromArray=_;function p(g){return{next:function(){var v=g.next();return v.done?Y:{done:!1,value:v.value}}}}P.fromNativeIterator=p;function m(g){return g?Array.isArray(g)?P.fromArray(g):g:P.empty()}P.from=m;function y(g,v){return{next:function(){var L=g.next();return L.done?Y:{done:!1,value:v(L.value)}}}}P.map=y;function a(g,v){return{next:function(){for(;;){var L=g.next();if(L.done)return Y;if(v(L.value))return{done:!1,value:L.value}}}}}P.filter=a;function i(g,v){for(var L=g.next();!L.done;L=g.next())v(L.value)}P.forEach=i;function o(g,v){v===void 0&&(v=Number.POSITIVE_INFINITY);var L=[];if(v===0)return L;for(var A=0,T=g.next();!T.done&&!(L.push(T.value),++A>=v);T=g.next());return L}P.collect=o;function l(){for(var g=[],v=0;v<arguments.length;v++)g[v]=arguments[v];var L=0;return{next:function(){if(L>=g.length)return Y;var A=g[L],T=A.next();return T.done?(L++,this.next()):T}}}P.concat=l;function C(g){return new H(g)}P.chain=C})(M||(M={}));var H=function(){function P(R){this.it=R}return P.prototype.next=function(){return this.it.next()},P}();function O(P){return Array.isArray(P)?M.fromArray(P):P||M.empty()}var I=function(){function P(R,c,f,_){c===void 0&&(c=0),f===void 0&&(f=R.length),_===void 0&&(_=c-1),this.items=R,this.start=c,this.end=f,this.index=_}return P.prototype.first=function(){return this.index=this.start,this.current()},P.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},P.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},P}(),j=function(P){ie(R,P);function R(c,f,_,p){return f===void 0&&(f=0),_===void 0&&(_=c.length),p===void 0&&(p=f-1),P.call(this,c,f,_,p)||this}return R.prototype.current=function(){return P.prototype.current.call(this)},R.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},R.prototype.first=function(){return this.index=this.start,this.current()},R.prototype.last=function(){return this.index=this.end-1,this.current()},R.prototype.parent=function(){return null},R}(I),N=function(){function P(R,c){this.iterator=R,this.fn=c}return P.prototype.next=function(){return this.fn(this.iterator.next())},P}()},LdHM:function(Wt,Me,$){"use strict";$.d(Me,"b",function(){return l}),$.d(Me,"a",function(){return g});var ie=$("1OyB"),Y=$("vuIU"),M=$("Ji7U"),H=$("LK+K"),O=$("q1tI"),I=$("rePB"),j=$("Ff2n"),N=$("ODXe"),P=$("4IlW"),R=$("bX4T"),c=$("YrtM"),f=$("TSYQ"),_=$.n(f),p=$("+nKL"),m=$("8OUc"),y=function(te,ue){var ge=te.prefixCls,Oe=te.id,qe=te.flattenOptions,Ke=te.childrenAsData,Be=te.values,Xe=te.searchValue,Fe=te.multiple,xe=te.defaultActiveFirstOption,oe=te.height,Re=te.itemHeight,dt=te.notFoundContent,at=te.open,ut=te.menuItemSelectedIcon,ce=te.virtual,he=te.onSelect,Le=te.onToggleOpen,Ve=te.onActiveValue,et=te.onScroll,tt=te.onMouseEnter,rt="".concat(ge,"-item"),it=Object(c.a)(function(){return qe},[at,qe],function(ot,Ae){return Ae[0]&&ot[1]!==Ae[1]}),Dt=O.useRef(null),Et=function(Ae){Ae.preventDefault()},xt=function(Ae){Dt.current&&Dt.current.scrollTo({index:Ae})},ct=function(Ae){for(var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Se=it.length,re=0;re<Se;re+=1){var ae=(Ae+re*be+Se)%Se,fe=it[ae],Ee=fe.group,je=fe.data;if(!Ee&&!je.disabled)return ae}return-1},Ft=O.useState(function(){return ct(0)}),wt=Object(N.a)(Ft,2),Pt=wt[0],We=wt[1],gt=function(Ae){We(Ae);var be=it[Ae];if(!be){Ve(null,-1);return}Ve(be.data.value,Ae)};O.useEffect(function(){gt(xe!==!1?ct(0):-1)},[it.length,Xe]),O.useEffect(function(){var ot=setTimeout(function(){if(!Fe&&at&&Be.size===1){var Ae=Array.from(Be)[0],be=it.findIndex(function(Se){var re=Se.data;return re.value===Ae});gt(be),xt(be)}});return function(){return clearTimeout(ot)}},[at]);var Ut=function(Ae){Ae!==void 0&&he(Ae,{selected:!Be.has(Ae)}),Fe||Le(!1)};if(O.useImperativeHandle(ue,function(){return{onKeyDown:function(Ae){var be=Ae.which;switch(be){case P.a.UP:case P.a.DOWN:{var Se=0;if(be===P.a.UP?Se=-1:be===P.a.DOWN&&(Se=1),Se!==0){var re=ct(Pt+Se,Se);xt(re),gt(re)}break}case P.a.ENTER:{var ae=it[Pt];ae&&!ae.data.disabled?Ut(ae.data.value):Ut(void 0),at&&Ae.preventDefault();break}case P.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(Ae){xt(Ae)}}}),it.length===0)return O.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),className:"".concat(rt,"-empty"),onMouseDown:Et},dt);function Qe(ot){var Ae=it[ot];if(!Ae)return null;var be=Ae.data||{},Se=be.value,re=be.label,ae=be.children,fe=Object(R.a)(be,!0),Ee=Ke?ae:re;return Ae?O.createElement("div",Object.assign({"aria-label":typeof Ee=="string"?Ee:null},fe,{key:ot,role:"option",id:"".concat(Oe,"_list_").concat(ot),"aria-selected":Be.has(Se)}),Se):null}return O.createElement(O.Fragment,null,O.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Qe(Pt-1),Qe(Pt),Qe(Pt+1)),O.createElement(p.a,{itemKey:"key",ref:Dt,data:it,height:oe,itemHeight:Re,fullHeight:!1,onMouseDown:Et,onScroll:et,virtual:ce,onMouseEnter:tt},function(ot,Ae){var be,Se=ot.group,re=ot.groupOption,ae=ot.data,fe=ae.label,Ee=ae.key;if(Se)return O.createElement("div",{className:_()(rt,"".concat(rt,"-group"))},fe!==void 0?fe:Ee);var je=ae.disabled,Te=ae.value,Ne=ae.title,st=ae.children,pt=ae.style,St=ae.className,$t=Object(j.a)(ae,["disabled","value","title","children","style","className"]),_t=Be.has(Te),$e="".concat(rt,"-option"),bn=_()(rt,$e,St,(be={},Object(I.a)(be,"".concat($e,"-grouped"),re),Object(I.a)(be,"".concat($e,"-active"),Pt===Ae&&!je),Object(I.a)(be,"".concat($e,"-disabled"),je),Object(I.a)(be,"".concat($e,"-selected"),_t),be)),ze=Ke?st:fe,vn=!ut||typeof ut=="function"||_t;return O.createElement("div",Object.assign({},$t,{"aria-selected":_t,className:bn,title:Ne,onMouseMove:function(){if(Pt===Ae||je)return;gt(Ae)},onClick:function(){je||Ut(Te)},style:pt}),O.createElement("div",{className:"".concat($e,"-content")},ze||Te),O.isValidElement(ut)||_t,vn&&O.createElement(m.a,{className:"".concat(rt,"-option-state"),customizeIcon:ut,customizeIconProps:{isSelected:_t}},_t?"\u2713":null))}))},a=O.forwardRef(y);a.displayName="OptionList";var i=a,o=function(){return null};o.isSelectOption=!0;var l=o,C=function(){return null};C.isSelectOptGroup=!0;var g=C,v=$("VTBJ"),L=$("Zm9Q");function A(W){var te=W.key,ue=W.props,ge=ue.children,Oe=ue.value,qe=Object(j.a)(ue,["children","value"]);return Object(v.a)({key:te,value:Oe!==void 0?Oe:te,children:ge},qe)}function T(W){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(W).map(function(ue,ge){if(!O.isValidElement(ue)||!ue.type)return null;var Oe=ue.type.isSelectOptGroup,qe=ue.key,Ke=ue.props,Be=Ke.children,Xe=Object(j.a)(Ke,["children"]);return te||!Oe?A(ue):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(qe===null?ge:qe,"__"),label:qe},Xe),{},{options:T(Be)})}).filter(function(ue){return ue})}var x=$("2Qr1"),h=$("qNPg"),u=$("U8pU"),D=$("Kwbf"),S=$("WKfj");function w(W){var te=W.mode,ue=W.options,ge=W.children,Oe=W.backfill,qe=W.allowClear,Ke=W.placeholder,Be=W.getInputElement,Xe=W.showSearch,Fe=W.onSearch,xe=W.defaultOpen,oe=W.autoFocus,Re=W.labelInValue,dt=W.value,at=W.inputValue,ut=W.optionLabelProp,ce=te==="multiple"||te==="tags",he=Xe!==void 0?Xe:ce||te==="combobox",Le=ue||T(ge);if(Object(D.a)(te!=="tags"||Le.every(function(rt){return!rt.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var Ve=Le.some(function(rt){return rt.options?rt.options.some(function(it){return typeof("value"in it?it.value:it.key)=="number"}):typeof("value"in rt?rt.value:rt.key)=="number"});Object(D.a)(!Ve,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(D.a)(te!=="combobox"||!ut,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(D.a)(te==="combobox"||!Oe,"`backfill` only works with `combobox` mode."),Object(D.a)(te==="combobox"||!Be,"`getInputElement` only work with `combobox` mode."),Object(D.b)(te!=="combobox"||!Be||!qe||!Ke,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Fe&&!he&&te!=="combobox"&&te!=="tags"&&Object(D.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(D.b)(!xe||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),dt!=null){var et=Object(S.d)(dt);Object(D.a)(!Re||et.every(function(rt){return Object(u.a)(rt)==="object"&&("key"in rt||"value"in rt)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(D.a)(!ce||Array.isArray(dt),"`value` should be array when `mode` is `multiple` or `tags`")}if(ge){var tt=null;Object(L.a)(ge).some(function(rt){if(!O.isValidElement(rt)||!rt.type)return!1;var it=rt.type;if(it.isSelectOption)return!1;if(it.isSelectOptGroup){var Dt=Object(L.a)(rt.props.children).every(function(Et){return!O.isValidElement(Et)||!rt.type||Et.type.isSelectOption?!0:(tt=Et.type,!1)});return!Dt}return tt=it,!0}),tt&&Object(D.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(tt.displayName||tt.name||tt,"`.")),Object(D.a)(at===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var b=w,K=Object(h.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:T,flattenOptions:x.d,getLabeledValue:x.e,filterOptions:x.b,isValueDisabled:x.g,findValueOption:x.c,warningProps:b,fillOptionsWithMissingValue:x.a}),X=function(W){Object(M.a)(ue,W);var te=Object(H.a)(ue);function ue(){var ge;return Object(ie.a)(this,ue),ge=te.apply(this,arguments),ge.selectRef=O.createRef(),ge.focus=function(){ge.selectRef.current.focus()},ge.blur=function(){ge.selectRef.current.blur()},ge}return Object(Y.a)(ue,[{key:"render",value:function(){return O.createElement(K,Object.assign({ref:this.selectRef},this.props))}}]),ue}(O.Component);X.Option=l,X.OptGroup=g;var Q=X,V=Me.c=Q},M8RZ:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return P});var ie=$("fWQN"),Y=$("mtLc"),M=$("yKVA"),H=$("879j"),O=$("q1tI"),I=$.n(O),j=$("i8i4"),N=$.n(j),P=function(R){Object(M.a)(f,R);var c=Object(H.a)(f);function f(_){var p;Object(ie.a)(this,f),p=c.call(this,_);var m=window.document;return p.node=m.createElement("div"),m.body.appendChild(p.node),p}return Object(Y.a)(f,[{key:"render",value:function(){var p=this.props.children;return Object(j.createPortal)(p,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(I.a.Component)},MI8n:function(Wt,Me,$){"use strict";$.d(Me,"b",function(){return I}),$.d(Me,"a",function(){return P}),$.d(Me,"e",function(){return R}),$.d(Me,"d",function(){return c}),$.d(Me,"c",function(){return f}),$.d(Me,"f",function(){return _});var ie=$("/cxE"),Y=$("C/vA"),M=$("pmY6"),H=$("24hK"),O=function(){var p=function(m,y){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var o in i)i.hasOwnProperty(o)&&(a[o]=i[o])},p(m,y)};return function(m,y){p(m,y);function a(){this.constructor=m}m.prototype=y===null?Object.create(y):(a.prototype=y.prototype,new a)}}(),I;(function(p){p.None=function(){return M.a.None};function m(b){return function(K,X,Q){X===void 0&&(X=null);var V=!1,W;return W=b(function(te){return V?void 0:(W?W.dispose():V=!0,K.call(X,te))},null,Q),V&&W.dispose(),W}}p.once=m;function y(b,K){return g(function(X,Q,V){return Q===void 0&&(Q=null),b(function(W){return X.call(Q,K(W))},null,V)})}p.map=y;function a(b,K){return g(function(X,Q,V){return Q===void 0&&(Q=null),b(function(W){K(W),X.call(Q,W)},null,V)})}p.forEach=a;function i(b,K){return g(function(X,Q,V){return Q===void 0&&(Q=null),b(function(W){return K(W)&&X.call(Q,W)},null,V)})}p.filter=i;function o(b){return b}p.signal=o;function l(){for(var b=[],K=0;K<arguments.length;K++)b[K]=arguments[K];return function(X,Q,V){return Q===void 0&&(Q=null),M.e.apply(void 0,b.map(function(W){return W(function(te){return X.call(Q,te)},null,V)}))}}p.any=l;function C(b,K,X){var Q=X;return y(b,function(V){return Q=K(Q,V),Q})}p.reduce=C;function g(b){var K,X=new P({onFirstListenerAdd:function(){K=b(X.fire,X)},onLastListenerRemove:function(){K.dispose()}});return X.event}p.snapshot=g;function v(b,K,X,Q,V){X===void 0&&(X=100),Q===void 0&&(Q=!1);var W,te=void 0,ue=void 0,ge=0,Oe=new P({leakWarningThreshold:V,onFirstListenerAdd:function(){W=b(function(qe){ge++,te=K(te,qe),Q&&!ue&&(Oe.fire(te),te=void 0),clearTimeout(ue),ue=setTimeout(function(){var Ke=te;te=void 0,ue=void 0,(!Q||ge>1)&&Oe.fire(Ke),ge=0},X)})},onLastListenerRemove:function(){W.dispose()}});return Oe.event}p.debounce=v;function L(b){var K=new Date().getTime();return y(m(b),function(X){return new Date().getTime()-K})}p.stopwatch=L;function A(b){var K=!0,X;return i(b,function(Q){var V=K||Q!==X;return K=!1,X=Q,V})}p.latch=A;function T(b,K,X){K===void 0&&(K=!1),X===void 0&&(X=[]);var Q=X.slice(),V=b(function(ue){Q?Q.push(ue):te.fire(ue)}),W=function(){Q&&Q.forEach(function(ue){return te.fire(ue)}),Q=null},te=new P({onFirstListenerAdd:function(){V||(V=b(function(ue){return te.fire(ue)}))},onFirstListenerDidAdd:function(){Q&&(K?setTimeout(W):W())},onLastListenerRemove:function(){V&&V.dispose(),V=null}});return te.event}p.buffer=T;var x=function(){function b(K){this.event=K}return b.prototype.map=function(K){return new b(y(this.event,K))},b.prototype.forEach=function(K){return new b(a(this.event,K))},b.prototype.filter=function(K){return new b(i(this.event,K))},b.prototype.reduce=function(K,X){return new b(C(this.event,K,X))},b.prototype.latch=function(){return new b(A(this.event))},b.prototype.debounce=function(K,X,Q,V){return X===void 0&&(X=100),Q===void 0&&(Q=!1),new b(v(this.event,K,X,Q,V))},b.prototype.on=function(K,X,Q){return this.event(K,X,Q)},b.prototype.once=function(K,X,Q){return m(this.event)(K,X,Q)},b}();function h(b){return new x(b)}p.chain=h;function u(b,K,X){X===void 0&&(X=function(ue){return ue});var Q=function(){for(var ue=[],ge=0;ge<arguments.length;ge++)ue[ge]=arguments[ge];return te.fire(X.apply(void 0,ue))},V=function(){return b.on(K,Q)},W=function(){return b.removeListener(K,Q)},te=new P({onFirstListenerAdd:V,onLastListenerRemove:W});return te.event}p.fromNodeEventEmitter=u;function D(b,K,X){X===void 0&&(X=function(ue){return ue});var Q=function(){for(var ue=[],ge=0;ge<arguments.length;ge++)ue[ge]=arguments[ge];return te.fire(X.apply(void 0,ue))},V=function(){return b.addEventListener(K,Q)},W=function(){return b.removeEventListener(K,Q)},te=new P({onFirstListenerAdd:V,onLastListenerRemove:W});return te.event}p.fromDOMEventEmitter=D;function S(b){var K=new P,X=!1;return b.then(void 0,function(){return null}).then(function(){X?K.fire(void 0):setTimeout(function(){return K.fire(void 0)},0)}),X=!0,K.event}p.fromPromise=S;function w(b){return new Promise(function(K){return m(b)(K)})}p.toPromise=w})(I||(I={}));var j=-1,N=function(){function p(m,y){y===void 0&&(y=Math.random().toString(18).slice(2,5)),this.customThreshold=m,this.name=y,this._warnCountdown=0}return p.prototype.dispose=function(){this._stacks&&this._stacks.clear()},p.prototype.check=function(m){var y=this,a=j;if(typeof this.customThreshold=="number"&&(a=this.customThreshold),a<=0||m<a)return;this._stacks||(this._stacks=new Map);var i=new Error().stack.split(`
`).slice(3).join(`
`),o=this._stacks.get(i)||0;if(this._stacks.set(i,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;var l,C=0;this._stacks.forEach(function(g,v){(!l||C<g)&&(l=v,C=g)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+m+" listeners already. MOST frequent listener ("+C+"):"),console.warn(l)}return function(){var g=y._stacks.get(i)||0;y._stacks.set(i,g-1)}},p}(),P=function(){function p(m){this._disposed=!1,this._options=m,this._leakageMon=j>0?new N(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(p.prototype,"event",{get:function(){var m=this;return this._event||(this._event=function(y,a,i){m._listeners||(m._listeners=new H.a);var o=m._listeners.isEmpty();o&&m._options&&m._options.onFirstListenerAdd&&m._options.onFirstListenerAdd(m);var l=m._listeners.push(a?[y,a]:y);o&&m._options&&m._options.onFirstListenerDidAdd&&m._options.onFirstListenerDidAdd(m),m._options&&m._options.onListenerDidAdd&&m._options.onListenerDidAdd(m,y,a);var C;m._leakageMon&&(C=m._leakageMon.check(m._listeners.size));var g;return g={dispose:function(){if(C&&C(),g.dispose=p._noop,!m._disposed&&(l(),m._options&&m._options.onLastListenerRemove)){var v=m._listeners&&!m._listeners.isEmpty();v||m._options.onLastListenerRemove(m)}}},i instanceof M.b?i.add(g):Array.isArray(i)&&i.push(g),g}),this._event},enumerable:!0,configurable:!0}),p.prototype.fire=function(m){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new H.a);for(var y=this._listeners.iterator(),a=y.next();!a.done;a=y.next())this._deliveryQueue.push([a.value,m]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),o=i[0],l=i[1];try{typeof o=="function"?o.call(void 0,l):o[0].call(o[1],l)}catch(C){Object(ie.e)(C)}}}},p.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},p._noop=function(){},p}(),R=function(p){O(m,p);function m(y){var a=p.call(this,y)||this;return a._isPaused=0,a._eventQueue=new H.a,a._mergeFn=y&&y.merge,a}return m.prototype.pause=function(){this._isPaused++},m.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var y=this._eventQueue.toArray();this._eventQueue.clear(),p.prototype.fire.call(this,this._mergeFn(y))}else for(;!this._isPaused&&this._eventQueue.size!==0;)p.prototype.fire.call(this,this._eventQueue.shift())},m.prototype.fire=function(y){this._listeners&&(this._isPaused!==0?this._eventQueue.push(y):p.prototype.fire.call(this,y))},m}(P),c=function(){function p(){var m=this;this.hasListeners=!1,this.events=[],this.emitter=new P({onFirstListenerAdd:function(){return m.onFirstListenerAdd()},onLastListenerRemove:function(){return m.onLastListenerRemove()}})}return Object.defineProperty(p.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),p.prototype.add=function(m){var y=this,a={event:m,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){y.hasListeners&&y.unhook(a);var o=y.events.indexOf(a);y.events.splice(o,1)};return Object(M.h)(Object(Y.a)(i))},p.prototype.onFirstListenerAdd=function(){var m=this;this.hasListeners=!0,this.events.forEach(function(y){return m.hook(y)})},p.prototype.onLastListenerRemove=function(){var m=this;this.hasListeners=!1,this.events.forEach(function(y){return m.unhook(y)})},p.prototype.hook=function(m){var y=this;m.listener=m.event(function(a){return y.emitter.fire(a)})},p.prototype.unhook=function(m){m.listener&&m.listener.dispose(),m.listener=null},p.prototype.dispose=function(){this.emitter.dispose()},p}(),f=function(){function p(){this.buffers=[]}return p.prototype.wrapEvent=function(m){var y=this;return function(a,i,o){return m(function(l){var C=y.buffers[y.buffers.length-1];C?C.push(function(){return a.call(i,l)}):a.call(i,l)},void 0,o)}},p.prototype.bufferEvents=function(m){var y=[];this.buffers.push(y);var a=m();return this.buffers.pop(),y.forEach(function(i){return i()}),a},p}(),_=function(){function p(){var m=this;this.listening=!1,this.inputEvent=I.None,this.inputEventListener=M.a.None,this.emitter=new P({onFirstListenerDidAdd:function(){m.listening=!0,m.inputEventListener=m.inputEvent(m.emitter.fire,m.emitter)},onLastListenerRemove:function(){m.listening=!1,m.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(p.prototype,"input",{set:function(m){this.inputEvent=m,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=m(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),p.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},p}()},N0LK:function(Wt,Me,$){"use strict";$.d(Me,"x",function(){return ie}),$.d(Me,"F",function(){return Y}),$.d(Me,"r",function(){return H}),$.d(Me,"o",function(){return O}),$.d(Me,"p",function(){return I}),$.d(Me,"Q",function(){return j}),$.d(Me,"K",function(){return P}),$.d(Me,"k",function(){return R}),$.d(Me,"N",function(){return c}),$.d(Me,"m",function(){return f}),$.d(Me,"l",function(){return _}),$.d(Me,"I",function(){return p}),$.d(Me,"H",function(){return m}),$.d(Me,"q",function(){return y}),$.d(Me,"t",function(){return a}),$.d(Me,"D",function(){return i}),$.d(Me,"e",function(){return o}),$.d(Me,"f",function(){return l}),$.d(Me,"B",function(){return C}),$.d(Me,"C",function(){return g}),$.d(Me,"n",function(){return L}),$.d(Me,"O",function(){return T}),$.d(Me,"c",function(){return x}),$.d(Me,"d",function(){return h}),$.d(Me,"z",function(){return u}),$.d(Me,"A",function(){return D}),$.d(Me,"u",function(){return S}),$.d(Me,"E",function(){return b}),$.d(Me,"G",function(){return K}),$.d(Me,"i",function(){return Q}),$.d(Me,"g",function(){return W}),$.d(Me,"v",function(){return ue}),$.d(Me,"h",function(){return ge}),$.d(Me,"y",function(){return Oe}),$.d(Me,"w",function(){return qe}),$.d(Me,"a",function(){return Ke}),$.d(Me,"P",function(){return Be}),$.d(Me,"L",function(){return Xe}),$.d(Me,"J",function(){return Fe}),$.d(Me,"j",function(){return xe}),$.d(Me,"M",function(){return oe}),$.d(Me,"s",function(){return Re}),$.d(Me,"b",function(){return dt});function ie(ce){return!ce||typeof ce!="string"?!0:ce.trim().length===0}function Y(ce,he,Le){Le===void 0&&(Le="0");for(var Ve=""+ce,et=[Ve],tt=Ve.length;tt<he;tt++)et.push(Le);return et.reverse().join("")}var M=/{(\d+)}/g;function H(ce){for(var he=[],Le=1;Le<arguments.length;Le++)he[Le-1]=arguments[Le];return he.length===0?ce:ce.replace(M,function(Ve,et){var tt=parseInt(et,10);return isNaN(tt)||tt<0||tt>=he.length?Ve:he[tt]})}function O(ce){return ce.replace(/[<>&]/g,function(he){switch(he){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return he}})}function I(ce){return ce.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function j(ce,he){he===void 0&&(he=" ");var Le=N(ce,he);return P(Le,he)}function N(ce,he){if(!ce||!he)return ce;var Le=he.length;if(Le===0||ce.length===0)return ce;for(var Ve=0;ce.indexOf(he,Ve)===Ve;)Ve=Ve+Le;return ce.substring(Ve)}function P(ce,he){if(!ce||!he)return ce;var Le=he.length,Ve=ce.length;if(Le===0||Ve===0)return ce;for(var et=Ve,tt=-1;!(tt=ce.lastIndexOf(he,et-1),tt===-1||tt+Le!==et);){if(tt===0)return"";et=tt}return ce.substring(0,et)}function R(ce){return ce.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function c(ce,he){if(ce.length<he.length)return!1;if(ce===he)return!0;for(var Le=0;Le<he.length;Le++)if(ce[Le]!==he[Le])return!1;return!0}function f(ce,he){var Le=ce.length-he.length;return Le>0?ce.indexOf(he,Le)===Le:Le===0?ce===he:!1}function _(ce,he,Le){if(Le===void 0&&(Le={}),!ce)throw new Error("Cannot create regex from empty string");he||(ce=I(ce)),Le.wholeWord&&(/\B/.test(ce.charAt(0))||(ce="\\b"+ce),/\B/.test(ce.charAt(ce.length-1))||(ce=ce+"\\b"));var Ve="";return Le.global&&(Ve+="g"),Le.matchCase||(Ve+="i"),Le.multiline&&(Ve+="m"),Le.unicode&&(Ve+="u"),new RegExp(ce,Ve)}function p(ce){if(ce.source==="^"||ce.source==="^$"||ce.source==="$"||ce.source==="^\\s*$")return!1;var he=ce.exec("");return!!(he&&ce.lastIndex===0)}function m(ce){return(ce.global?"g":"")+(ce.ignoreCase?"i":"")+(ce.multiline?"m":"")+(ce.unicode?"u":"")}function y(ce){for(var he=0,Le=ce.length;he<Le;he++){var Ve=ce.charCodeAt(he);if(Ve!==32&&Ve!==9)return he}return-1}function a(ce,he,Le){he===void 0&&(he=0),Le===void 0&&(Le=ce.length);for(var Ve=he;Ve<Le;Ve++){var et=ce.charCodeAt(Ve);if(et!==32&&et!==9)return ce.substring(he,Ve)}return ce.substring(he,Le)}function i(ce,he){he===void 0&&(he=ce.length-1);for(var Le=he;Le>=0;Le--){var Ve=ce.charCodeAt(Le);if(Ve!==32&&Ve!==9)return Le}return-1}function o(ce,he){return ce<he?-1:ce>he?1:0}function l(ce,he){for(var Le=Math.min(ce.length,he.length),Ve=0;Ve<Le;Ve++){var et=ce.charCodeAt(Ve),tt=he.charCodeAt(Ve);if(et===tt)continue;g(et)&&(et+=32),g(tt)&&(tt+=32);var rt=et-tt;if(rt===0)continue;return C(et)&&C(tt)?rt:o(ce.toLowerCase(),he.toLowerCase())}return ce.length<he.length?-1:ce.length>he.length?1:0}function C(ce){return ce>=97&&ce<=122}function g(ce){return ce>=65&&ce<=90}function v(ce){return C(ce)||g(ce)}function L(ce,he){return ce.length===he.length&&A(ce,he)}function A(ce,he,Le){Le===void 0&&(Le=ce.length);for(var Ve=0;Ve<Le;Ve++){var et=ce.charCodeAt(Ve),tt=he.charCodeAt(Ve);if(et===tt)continue;if(v(et)&&v(tt)){var rt=Math.abs(et-tt);if(rt!==0&&rt!==32)return!1}else if(String.fromCharCode(et).toLowerCase()!==String.fromCharCode(tt).toLowerCase())return!1}return!0}function T(ce,he){var Le=he.length;return he.length>ce.length?!1:A(ce,he,Le)}function x(ce,he){var Le,Ve=Math.min(ce.length,he.length);for(Le=0;Le<Ve;Le++)if(ce.charCodeAt(Le)!==he.charCodeAt(Le))return Le;return Ve}function h(ce,he){var Le,Ve=Math.min(ce.length,he.length),et=ce.length-1,tt=he.length-1;for(Le=0;Le<Ve;Le++)if(ce.charCodeAt(et-Le)!==he.charCodeAt(tt-Le))return Le;return Ve}function u(ce){return 55296<=ce&&ce<=56319}function D(ce){return 56320<=ce&&ce<=57343}function S(ce,he,Le){var Ve=ce.charCodeAt(Le);if(u(Ve)&&Le+1<he){var et=ce.charCodeAt(Le+1);if(D(et))return(Ve-55296<<10)+(et-56320)+65536}return Ve}function w(ce,he){var Le=ce.charCodeAt(he-1);if(D(Le)&&he>1){var Ve=ce.charCodeAt(he-2);if(u(Ve))return(Ve-55296<<10)+(Le-56320)+65536}return Le}function b(ce,he){var Le=at.getInstance(),Ve=he,et=ce.length,tt=S(ce,et,he);he+=tt>=65536?2:1;for(var rt=Le.getGraphemeBreakType(tt);he<et;){var it=S(ce,et,he),Dt=Le.getGraphemeBreakType(it);if(dt(rt,Dt))break;he+=it>=65536?2:1,rt=Dt}return he-Ve}function K(ce,he){var Le=at.getInstance(),Ve=he,et=w(ce,he);he-=et>=65536?2:1;for(var tt=Le.getGraphemeBreakType(et);he>0;){var rt=w(ce,he),it=Le.getGraphemeBreakType(rt);if(dt(it,tt))break;he-=rt>=65536?2:1,tt=it}return Ve-he}var X=/(?:[\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 Q(ce){return X.test(ce)}var V=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function W(ce){return V.test(ce)}var te=/^[\t\n\r\x20-\x7E]*$/;function ue(ce){return te.test(ce)}function ge(ce){for(var he=0,Le=ce.length;he<Le;he++)if(Oe(ce.charCodeAt(he)))return!0;return!1}function Oe(ce){return ce=+ce,ce>=11904&&ce<=55215||ce>=63744&&ce<=64255||ce>=65281&&ce<=65374}function qe(ce){return ce>=127462&&ce<=127487||ce>=9728&&ce<=10175||ce>=127744&&ce<=128591||ce>=128640&&ce<=128764||ce>=128992&&ce<=129003||ce>=129280&&ce<=129535||ce>=129648&&ce<=129651||ce>=129656&&ce<=129666||ce>=129680&&ce<=129685}var Ke=String.fromCharCode(65279);function Be(ce){return!!(ce&&ce.length>0&&ce.charCodeAt(0)===65279)}function Xe(ce){return btoa(encodeURIComponent(ce))}function Fe(ce,he){for(var Le="",Ve=0;Ve<he;Ve++)Le+=ce;return Le}function xe(ce,he){return he===void 0&&(he=!1),ce?(he&&(ce=ce.replace(/\\./g,"")),ce.toLowerCase()!==ce):!1}function oe(ce){var he=90-65+1;return ce=ce%(2*he),ce<he?String.fromCharCode(97+ce):String.fromCharCode(65+ce-he)}function Re(ce){var he=at.getInstance();return he.getGraphemeBreakType(ce)}function dt(ce,he){return ce===0?he!==5&&he!==7:ce===2&&he===3?!1:ce===4||ce===2||ce===3||(he===4||he===2||he===3)?!0:ce===8&&(he===8||he===9||he===11||he===12)||((ce===11||ce===9)&&(he===9||he===10)||((ce===12||ce===10)&&he===10||(he===5||he===13||(he===7||(ce===1||ce===13&&he===14)))))?!1:!(ce===6&&he===6)}var at=function(){function ce(){this._data=ut()}return ce.getInstance=function(){return ce._INSTANCE||(ce._INSTANCE=new ce),ce._INSTANCE},ce.prototype.getGraphemeBreakType=function(he){if(he<32)return he===10?3:he===13?2:4;if(he<127)return 0;for(var Le=this._data,Ve=Le.length/3,et=1;et<=Ve;)if(he<Le[3*et])et=2*et;else if(he>Le[3*et+1])et=2*et+1;else return Le[3*et+2];return 0},ce._INSTANCE=null,ce}();function ut(){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]")}},NcEG:function(Wt,Me,$){"use strict";$.r(Me);var ie=$("+L6B"),Y=$("2/Rp"),M=$("5NDa"),H=$("5rEg"),O=$("Znn+"),I=$("ZTPi"),j=$("2qtc"),N=$("kLXV"),P=$("14J3"),R=$("BMrR"),c=$("jCWc"),f=$("kPKH"),_=$("sPJy"),p=$("bE4q"),m=$("/zsF"),y=$("PArb"),a=$("miYZ"),i=$("tsqr"),o=$("9og8"),l=$("k1fw"),C=$("oBTY"),g=$("y8nQ"),v=$("Vl3Y"),L=$("tJVT"),A=$("PpiC"),T=$("B9cy"),x=$("Ol7k"),h=$("lUTK"),u=$("BvKs"),D=$("WmNS"),S=$.n(D),w=$("q1tI"),b=$.n(w),K=$("Ty5D"),X=$("55Ip"),Q=$("9kvl"),V=$("tgas"),W=$("jb+D"),te=$("BdwD"),ue=$("giR+"),ge=$("fyUT"),Oe=$("sRBo"),qe=$("kaz8"),Ke=$("5Dmo"),Be=$("3S7+"),Xe=$("V0Rq"),Fe=$("Ot1p"),xe=$("9Bee"),oe=$("xvzu"),Re=$.n(oe),dt=["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"],at=function(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.onRef,bn=$e===void 0?function(){}:$e,ze=Ne.editData,vn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ln=Object(w.useState)([]),Ht=Object(L.a)(ln,2),an=Ht[0],gn=Ht[1],kt=Object(w.useState)(),Mt=Object(L.a)(kt,2),mt=Mt[0],It=Mt[1],un=Object(w.useState)([]),pn=Object(L.a)(un,2),Zt=pn[0],zt=pn[1],Tt=Object(w.useState)(""),zn=Object(L.a)(Tt,2),Pn=zn[0],Dn=zn[1],Jt=Object(w.useState)(5),Un=Object(L.a)(Jt,2),Qn=Un[0],Gn=Un[1],Je=Object(w.useState)(!1),vt=Object(L.a)(Je,2),Xt=vt[0],Gt=vt[1],Bt=Object(K.i)();Object(w.useEffect)(function(){gn(["","","",""])},[]),Object(w.useEffect)(function(){if(!(ze!=null&&ze.question_choices)){Gt(!0);return}Dn(ze==null?void 0:ze.question_title),Gn(parseInt(ze==null?void 0:ze.question_score)),gn(ze==null?void 0:ze.question_choices.map(function(U){return U.choice_text}));var G=[];ze==null||ze.standard_answer.map(function(U,se){G.push(U-1)}),zt(G)},[ze]),Object(w.useImperativeHandle)(st,function(){return{onSave:qt,isEdit:Xt}});var qt=function(){var G=Object(o.a)(S.a.mark(function U(){var se,He,Ye;return S.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:if(Pn){Ge.next=3;break}return i.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Ge.abrupt("return",!1);case 3:if(se=an.findIndex(function(yt){return!yt}),!(se>-1)){Ge.next=7;break}return i.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(dt[se]," \u9009\u9879\u7684\u5185\u5BB9")),Ge.abrupt("return",!1);case 7:if(Zt.length){Ge.next=10;break}return i.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Ge.abrupt("return",!1);case 10:if(!(Zt.length<1)){Ge.next=13;break}return i.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Ge.abrupt("return",!1);case 13:if(He=an.map(function(yt,Qt){return{choice_text:yt,is_answer:Zt.includes(Qt)?Qt+1:0}}),!ze.question_id){Ge.next=20;break}return Ge.next=17,_t({type:"exercise/editExerciseQuestion",payload:{id:ze.question_id,question_title:Pn,question_type:1,question_score:"5.0",question_choices:He.map(function(yt){return yt.choice_text}),standard_answers:He.filter(function(yt){return yt.is_answer}).map(function(yt){return yt.is_answer})}});case 17:Ye=Ge.sent,Ge.next=23;break;case 20:return Ge.next=22,_t({type:"exercise/addExerciseQuestion",payload:{categoryId:Bt.categoryId,question_title:Pn,question_type:1,question_score:"5.0",question_choices:He.map(function(yt){return yt.choice_text}),standard_answers:He.filter(function(yt){return yt.is_answer}).map(function(yt){return yt.is_answer})}});case 22:Ye=Ge.sent;case 23:Ye.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),Gt(!1),_t({type:"exercise/editExercise",payload:Object(l.a)({},Bt)}));case 24:case"end":return Ge.stop()}},U)}));return function(){return G.apply(this,arguments)}}(),B=[{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"}],d=function(){var G=Object(o.a)(S.a.mark(function U(se){return S.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:Ye.t0=se.id,Ye.next=Ye.t0==="del"?3:Ye.t0==="up"||Ye.t0==="down"?5:Ye.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function Ge(){return S.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(Xe.m)({id:ze.question_id});case 2:_t({type:"exercise/editExercise",payload:Object(l.a)({},Bt)});case 3:case"end":return Qt.stop()}},Ge)}))()}}),Ye.abrupt("break",11);case 5:return Ye.next=7,_t({type:"exercise/exeriseMoveUpDown",payload:{id:ze.question_id,opr:se.id}});case 7:return _t({type:"exercise/editExercise",payload:Object(l.a)({},Bt)}),Ye.abrupt("break",11);case 9:return Gt(!0),Ye.abrupt("break",11);case 11:case"end":return Ye.stop()}},U)}));return function(se){return G.apply(this,arguments)}}(),E=function(){var U;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u591A\u9009\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),!ze.hideAction&&B.map(function(se,He){return se.id==="up"&&ze.key===1||se.id==="down"&&ze.key===ze.len?null:b.a.createElement(Be.a,{key:He,placement:"bottom",title:se.name},b.a.createElement("span",{onClick:function(){return d(se)},className:se.icon}))})),b.a.createElement("div",{className:"mt5"},b.a.createElement(xe.a,{value:ze.question_title})),b.a.createElement("div",{className:Re.a.questionChoices},ze==null||((U=ze.question_choices)===null||U===void 0)?void 0:U.map(function(se,He){return b.a.createElement(R.a,null,b.a.createElement(f.a,null,b.a.createElement(qe.a,{key:He,checked:ze.standard_answer.includes(He+1),disabled:!0},dt[He],".")),b.a.createElement(f.a,{flex:"1"},b.a.createElement("span",{className:"c-black font14"},b.a.createElement(xe.a,{value:se.choice_text}))))})))},F=function(){return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.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")),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u9898\u5E72\uFF1A")),b.a.createElement(Fe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Pn,onChange:function(se){return Dn(se)}}),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",b.a.createElement("span",{className:Re.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),an.map(function(U,se){return b.a.createElement("div",{className:Re.a.choiceWrap,key:se},b.a.createElement(Be.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},b.a.createElement("div",{className:"".concat(Re.a.answer," ").concat(Zt.includes(se)?Re.a.activeAnswer:""),onClick:function(){Zt.includes(se)?zt(Zt.filter(function(Ye){return Ye!==se})):zt([].concat(Object(C.a)(Zt),[se]))}},dt[se])),b.a.createElement("div",{className:Re.a.editorWrap},mt===se?b.a.createElement(Fe.a,{id:"single-question-option-".concat(se),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:U,onChange:function(Ye){an[se]=Ye,gn(an)}}):b.a.createElement("div",{className:Re.a.htmlWrap,onClick:function(){return It(se)}},b.a.createElement(xe.a,{value:U}))),se>1&&b.a.createElement(Be.a,{title:"\u5220\u9664"},b.a.createElement("i",{className:"".concat(Re.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return gn(an.filter(function(Ye,Ct){return Ct!==se}))}})),se<7&&se===an.length-1&&b.a.createElement(Be.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},b.a.createElement("i",{className:"".concat(Re.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return gn([].concat(Object(C.a)(an),[""]))}})))}),b.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"),b.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",b.a.createElement(ge.a,{value:Qn,max:1e4,min:-1,onChange:function(se){Gn(se)}})," \u5206"),b.a.createElement("aside",{className:"tr"},ze.question_id&&b.a.createElement(Y.a,{type:"default",onClick:function(){return Gt(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return qt()}},"\u4FDD\u5B58")))};return b.a.createElement("section",{className:Re.a.wrap},!Xt&&E(),Xt&&F())},ut=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(at)),ce=$("7Kak"),he=$("9yH6"),Le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ve=function(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.onRef,bn=$e===void 0?function(){}:$e,ze=Ne.editData,vn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ln=Object(w.useState)([]),Ht=Object(L.a)(ln,2),an=Ht[0],gn=Ht[1],kt=Object(w.useState)(),Mt=Object(L.a)(kt,2),mt=Mt[0],It=Mt[1],un=Object(w.useState)([]),pn=Object(L.a)(un,2),Zt=pn[0],zt=pn[1],Tt=Object(w.useState)(""),zn=Object(L.a)(Tt,2),Pn=zn[0],Dn=zn[1],Jt=Object(w.useState)(0),Un=Object(L.a)(Jt,2),Qn=Un[0],Gn=Un[1],Je=Object(w.useState)(!1),vt=Object(L.a)(Je,2),Xt=vt[0],Gt=vt[1],Bt=Object(K.i)();Object(w.useEffect)(function(){gn(["","","",""])},[]),Object(w.useEffect)(function(){if(!(ze!=null&&ze.question_choices)){Gt(!0);return}Dn(ze==null?void 0:ze.question_title),Gn(parseInt(ze==null?void 0:ze.question_score)),gn(ze==null?void 0:ze.question_choices.map(function(U){return U.choice_text}));var G=[];ze==null||ze.standard_answer.map(function(U,se){G.push(U-1)}),zt(G)},[ze]),Object(w.useImperativeHandle)(st,function(){return{onSave:qt,isEdit:Xt}});var qt=function(){var G=Object(o.a)(S.a.mark(function U(){var se,He,Ye;return S.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:if(Pn){Ge.next=3;break}return i.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Ge.abrupt("return",!1);case 3:if(se=an.findIndex(function(yt){return!yt}),!(se>-1)){Ge.next=7;break}return i.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Le[se]," \u9009\u9879\u7684\u5185\u5BB9")),Ge.abrupt("return",!1);case 7:if(Zt.length){Ge.next=10;break}return i.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Ge.abrupt("return",!1);case 10:if(!(Zt.length<1)){Ge.next=13;break}return i.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Ge.abrupt("return",!1);case 13:if(He=an.map(function(yt,Qt){return{choice_text:yt,is_answer:Zt.includes(Qt)?Qt+1:0}}),!ze.question_id){Ge.next=20;break}return Ge.next=17,Object(V.u)({id:ze.question_id,question_title:Pn,question_type:1,question_score:Qn,question_choices:He.map(function(yt){return yt.choice_text}),standard_answers:He.filter(function(yt){return yt.is_answer}).map(function(yt){return yt.is_answer})});case 17:Ye=Ge.sent,Ge.next=23;break;case 20:return Ge.next=22,Object(V.a)({exercise_bank_id:Bt.topicId,question_title:Pn,question_type:1,question_score:"5.0",question_choices:He.map(function(yt){return yt.choice_text}),standard_answers:He.filter(function(yt){return yt.is_answer}).map(function(yt){return yt.is_answer})});case 22:Ye=Ge.sent;case 23:return Ye.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),Gt(!1)),Ge.next=26,_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Bt)});case 26:case"end":return Ge.stop()}},U)}));return function(){return G.apply(this,arguments)}}(),B=[{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"}],d=function(){var G=Object(o.a)(S.a.mark(function U(se){return S.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:Ye.t0=se.id,Ye.next=Ye.t0==="del"?3:Ye.t0==="up"||Ye.t0==="down"?5:Ye.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function Ge(){return S.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(V.e)({pollsId:ze.question_id});case 2:_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Bt)});case 3:case"end":return Qt.stop()}},Ge)}))()}}),Ye.abrupt("break",11);case 5:return Ye.next=7,Object(V.j)({exerciseId:ze==null?void 0:ze.question_id,opr:se.id});case 7:return _t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Bt)}),Ye.abrupt("break",11);case 9:return Gt(!0),Ye.abrupt("break",11);case 11:case"end":return Ye.stop()}},U)}));return function(se){return G.apply(this,arguments)}}(),E=function(){var U;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u5355\u9009\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),!ze.hideAction&&B.map(function(se,He){return se.id==="up"&&ze.key===1||se.id==="down"&&ze.key===ze.len?null:b.a.createElement(Be.a,{key:He,placement:"bottom",title:se.name},b.a.createElement("span",{onClick:function(){return d(se)},className:se.icon}))})),b.a.createElement("div",{className:"mt5"},b.a.createElement(xe.a,{value:ze.question_title})),b.a.createElement("div",{className:Re.a.questionChoices},ze==null||((U=ze.question_choices)===null||U===void 0)?void 0:U.map(function(se,He){return b.a.createElement(R.a,null,b.a.createElement(f.a,null,b.a.createElement(he.a,{key:He,checked:ze.standard_answer.includes(He+1),disabled:!0},Le[He],".")),b.a.createElement(f.a,{flex:"1"},b.a.createElement("span",{className:"c-black font14"},b.a.createElement(xe.a,{value:se.choice_text}))))})))},F=function(){return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.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")),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u9898\u5E72\uFF1A")),b.a.createElement(Fe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Pn,onChange:function(se){return Dn(se)}}),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",b.a.createElement("span",{className:Re.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),an.map(function(U,se){return b.a.createElement("div",{className:Re.a.choiceWrap,key:se},b.a.createElement(Be.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},b.a.createElement("div",{className:"".concat(Re.a.answer," ").concat(Zt.includes(se)?Re.a.activeAnswer:""),onClick:function(){Zt.includes(se)?zt(Zt.filter(function(Ye){return Ye!==se})):zt([].concat(Object(C.a)(Zt),[se]))}},Le[se])),b.a.createElement("div",{className:Re.a.editorWrap},mt===se?b.a.createElement(Fe.a,{id:"single-question-option-".concat(se),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:U,onChange:function(Ye){an[se]=Ye,gn(an)}}):b.a.createElement("div",{className:Re.a.htmlWrap,onClick:function(){return It(se)}},b.a.createElement(xe.a,{value:U}))),se>1&&b.a.createElement(Be.a,{title:"\u5220\u9664"},b.a.createElement("i",{className:"".concat(Re.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return gn(an.filter(function(Ye,Ct){return Ct!==se}))}})),se<7&&se===an.length-1&&b.a.createElement(Be.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},b.a.createElement("i",{className:"".concat(Re.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return gn([].concat(Object(C.a)(an),[""]))}})))}),b.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"),b.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",b.a.createElement(ge.a,{value:Qn,max:1e4,min:-1,onChange:function(se){Gn(se)}})," \u5206"),b.a.createElement("aside",{className:"tr"},ze.question_id&&b.a.createElement(Y.a,{type:"default",onClick:function(){return Gt(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return qt()}},"\u4FDD\u5B58")))};return b.a.createElement("section",{className:Re.a.wrap},!Xt&&E(),Xt&&F())},et=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(Ve)),tt=["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"],rt=function(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.onRef,bn=$e===void 0?function(){}:$e,ze=Ne.editData,vn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ln=Object(w.useState)(),Ht=Object(L.a)(ln,2),an=Ht[0],gn=Ht[1],kt=Object(w.useState)(""),Mt=Object(L.a)(kt,2),mt=Mt[0],It=Mt[1],un=Object(w.useState)(!1),pn=Object(L.a)(un,2),Zt=pn[0],zt=pn[1],Tt=Object(w.useState)(5),zn=Object(L.a)(Tt,2),Pn=zn[0],Dn=zn[1],Jt=Object(K.i)();Object(w.useEffect)(function(){if(!(ze!=null&&ze.question_choices)){zt(!0);return}It(ze==null?void 0:ze.question_title),Dn(ze==null?void 0:ze.question_score),gn(ze.standard_answer[0]+"")},[ze]),Object(w.useImperativeHandle)(st,function(){return{onSave:Un,isEdit:Zt}});var Un=function(){var Xt=Object(o.a)(S.a.mark(function Gt(){var Bt,qt;return S.a.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(mt){d.next=3;break}return i.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),d.abrupt("return",!1);case 3:if(an){d.next=6;break}return i.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),d.abrupt("return",!1);case 6:if(Bt=[{choice_text:"\u6B63\u786E",is_answer:an==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:an==="2"?2:0}],!ze.question_id){d.next=13;break}return d.next=10,Object(V.u)({id:ze.question_id,question_title:mt,question_type:2,question_score:Pn,question_choices:Bt.map(function(E){return E.choice_text}),standard_answers:Bt.filter(function(E){return E.is_answer}).map(function(E){return E.is_answer})});case 10:qt=d.sent,d.next=16;break;case 13:return d.next=15,Object(V.a)({exercise_bank_id:Jt.topicId,question_title:mt,question_type:2,question_score:Pn,question_choices:Bt.map(function(E){return E.choice_text}),standard_answers:Bt.filter(function(E){return E.is_answer}).map(function(E){return E.is_answer})});case 15:qt=d.sent;case 16:return qt.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),zt(!1)),_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Jt)}),d.abrupt("return",{name:mt,choices:Bt});case 19:case"end":return d.stop()}},Gt)}));return function(){return Xt.apply(this,arguments)}}(),Qn=[{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"}],Gn=function(){var Xt=Object(o.a)(S.a.mark(function Gt(Bt){return S.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:B.t0=Bt.id,B.next=B.t0==="del"?3:B.t0==="up"||B.t0==="down"?5:B.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function E(){return S.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(V.e)({pollsId:ze.question_id});case 2:_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Jt)});case 3:case"end":return G.stop()}},E)}))()}}),B.abrupt("break",11);case 5:return B.next=7,Object(V.j)({exerciseId:ze==null?void 0:ze.question_id,opr:Bt.id});case 7:return _t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Jt)}),B.abrupt("break",11);case 9:return zt(!0),B.abrupt("break",11);case 11:case"end":return B.stop()}},Gt)}));return function(Bt){return Xt.apply(this,arguments)}}(),Je=function(){var Gt;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),!ze.hideAction&&Qn.map(function(Bt,qt){return Bt.id==="up"&&ze.key===1||Bt.id==="down"&&ze.key===ze.len?null:b.a.createElement(Be.a,{key:qt,placement:"bottom",title:Bt.name},b.a.createElement("span",{onClick:function(){return Gn(Bt)},className:Bt.icon}))})),b.a.createElement("div",{className:"mt5"},ze.question_title),b.a.createElement("div",{className:Re.a.questionChoices},ze==null||((Gt=ze.question_choices)===null||Gt===void 0)?void 0:Gt.map(function(Bt,qt){return b.a.createElement(he.a,{key:qt,checked:ze.standard_answer.includes(qt+1),disabled:!0},tt[qt],". ",b.a.createElement("span",{className:"c-black font14"},Bt.choice_text))})))},vt=function(){return b.a.createElement("aside",null,b.a.createElement("div",null,b.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"),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u9898\u5E72\uFF1A")),b.a.createElement(Fe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:mt,onChange:function(Bt){return It(Bt)}}),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.required},"*"),b.a.createElement("span",{className:Re.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",b.a.createElement("span",{className:Re.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),b.a.createElement(he.a.Group,{buttonStyle:"solid",value:an,onChange:function(Bt){return gn(Bt.target.value)}},b.a.createElement(he.a.Button,{value:"1",className:"".concat(Re.a.radio," mr40")},"\u6B63\u786E"),b.a.createElement(he.a.Button,{value:"2",className:Re.a.radio},"\u9519\u8BEF")),b.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"),b.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",b.a.createElement(ge.a,{value:Pn,max:1e4,min:-1,onChange:function(Bt){Dn(Bt)}})," \u5206"),b.a.createElement("aside",{className:"tr"},ze.question_id&&b.a.createElement(Y.a,{type:"default",onClick:function(){return zt(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Un()}},"\u4FDD\u5B58")))};return b.a.createElement("section",{className:Re.a.wrap},!Zt&&Je(),Zt&&vt())},it=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(rt)),Dt=$("kqOp"),Et=$("7qnI"),xt=$("1vsH"),ct=["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"],Ft=function(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.editData,bn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","editData"]),ze=Object(w.useState)(""),vn=Object(L.a)(ze,2),ln=vn[0],Ht=vn[1],an=Object(w.useState)(""),gn=Object(L.a)(an,2),kt=gn[0],Mt=gn[1],mt=Object(w.useState)([]),It=Object(L.a)(mt,2),un=It[0],pn=It[1],Zt=Object(w.useState)(""),zt=Object(L.a)(Zt,2),Tt=zt[0],zn=zt[1],Pn=Object(w.useState)(),Dn=Object(L.a)(Pn,2),Jt=Dn[0],Un=Dn[1],Qn=Object(w.useState)(!1),Gn=Object(L.a)(Qn,2),Je=Gn[0],vt=Gn[1],Xt=Object(w.useState)(5),Gt=Object(L.a)(Xt,2),Bt=Gt[0],qt=Gt[1],B=Object(w.useState)(!1),d=Object(L.a)(B,2),E=d[0],F=d[1],G=Object(K.i)();Object(w.useEffect)(function(){if(!($e!=null&&$e.question_title)){F(!0);return}Ht($e==null?void 0:$e.question_title),Un($e==null?void 0:$e.is_ordered),qt($e==null?void 0:$e.question_score);var mn=$e==null?void 0:$e.standard_answer.map(function(At){return At.answer_text});pn(mn)},[pt.editData]),Object(w.useEffect)(function(){vt(!1)},[E]),Object(w.useImperativeHandle)(st,function(){return{onSave:U,isEdit:E}});var U=function(){var mn=Object(o.a)(S.a.mark(function At(){var Nt,on,dn;return S.a.wrap(function(Fn){for(;;)switch(Fn.prev=Fn.next){case 0:if(Nt=[],on=!1,un.forEach(function(cn,Er){Nt.push({choice_id:Er+1,answer_text:[]}),cn.forEach(function(Qr,ni){Nt[Er].answer_text.push(Qr),(!Qr||!Object(xt.Z)(Qr,1e4))&&(zn("".concat(Er,"-").concat(ni)),i.b.info(Qr?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),on=!0)})}),!on){Fn.next=5;break}return Fn.abrupt("return",!1);case 5:if(!$e.question_id){Fn.next=11;break}return Fn.next=8,Object(V.u)({id:$e.question_id,question_title:ln,question_type:3,question_score:Bt,is_ordered:Jt,standard_answers:Nt});case 8:dn=Fn.sent,Fn.next=14;break;case 11:return Fn.next=13,Object(V.a)({exercise_bank_id:G.topicId,question_title:ln,question_type:3,question_score:Bt,is_ordered:Jt,standard_answers:Nt});case 13:dn=Fn.sent;case 14:return dn.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),F(!1)),_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},G)}),Fn.abrupt("return",{name:ln,analysis:kt,standard_answers:Nt,is_ordered:Jt});case 17:case"end":return Fn.stop()}},At)}));return function(){return mn.apply(this,arguments)}}(),se=function(At,Nt,on){var dn=un.slice();if(Nt&&dn.splice(At,Nt),on&&Je)for(var En=0;En<on;En++)dn.splice(At+En,0,[""]);vt(!0),pn(dn)},He=function(At,Nt,on){zn("");var dn=un.slice();dn[At][Nt]=on,pn(dn)},Ye=function(At){var Nt=un.slice();Nt[At]=[].concat(Object(C.a)(Nt[At]),[""]),pn(Nt)},Ct=function(At,Nt){var on=un.slice();if(!on[At][Nt]){on[At]=on[At].filter(function(dn,En){return En!==Nt}),pn(on);return}N.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:Re.a.modal,onOk:function(){on[At]=on[At].filter(function(En,Fn){return Fn!==Nt}),pn(on)}})},Ge=function(At){N.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:Re.a.modal,onOk:function(){var on=un.slice();on=un.filter(function(dn,En){return At!==En}),pn(on)}})},yt=function(){return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.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")),b.a.createElement("div",null,b.a.createElement(Dt.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:ln,onChange:function(Nt){return Ht(Nt)},showNullButton:!0,onPlaceholderChange:se})),b.a.createElement("div",{className:"mt20"},un.map(function(At,Nt){return b.a.createElement(Et.a,{key:Nt,answers:At,index:Nt,is_md:!0,activeOptionErrorIndex:Tt,onAnswerChange:He,addChildAnswer:Ye,deleteChildAnswer:Ct,deleteChildAnswermain:Ge})})),b.a.createElement("div",{className:"mt20"},un.length>1&&b.a.createElement("span",null,b.a.createElement(qe.a,{checked:Jt,onChange:function(Nt){return Un(Nt.target.checked)},className:"".concat(Re.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),b.a.createElement("span",{className:"".concat(Re.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"))),b.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",b.a.createElement(ge.a,{value:Bt,max:1e4,min:-1,onChange:function(Nt){qt(Nt)}})," \u5206"),b.a.createElement("aside",{className:"tr"},$e.question_id&&b.a.createElement(Y.a,{type:"default",onClick:function(){return F(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return U()}},"\u4FDD\u5B58")))},Qt=[{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"}],Bn=function(){var mn=Object(o.a)(S.a.mark(function At(Nt){return S.a.wrap(function(dn){for(;;)switch(dn.prev=dn.next){case 0:dn.t0=Nt.id,dn.next=dn.t0==="del"?3:dn.t0==="up"||dn.t0==="down"?5:dn.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function Fn(){return S.a.wrap(function(Er){for(;;)switch(Er.prev=Er.next){case 0:return Er.next=2,Object(V.e)({pollsId:$e.question_id});case 2:_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},G)});case 3:case"end":return Er.stop()}},Fn)}))()}}),dn.abrupt("break",11);case 5:return dn.next=7,Object(V.j)({exerciseId:$e==null?void 0:$e.question_id,opr:Nt.id});case 7:return _t({type:"polls/getExerciseBanks",payload:Object(l.a)({},G)}),dn.abrupt("break",11);case 9:return F(!0),dn.abrupt("break",11);case 11:case"end":return dn.stop()}},At)}));return function(Nt){return mn.apply(this,arguments)}}(),er=function(){var At;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},$e.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",$e.question_score,"\u5206\uFF09"),!$e.hideAction&&Qt.map(function(Nt,on){return Nt.id==="up"&&$e.key===1||Nt.id==="down"&&$e.key===$e.len?null:b.a.createElement(Be.a,{key:on,placement:"bottom",title:Nt.name},b.a.createElement("span",{onClick:function(){return Bn(Nt)},className:Nt.icon}))})),b.a.createElement("div",{className:"mt5"},$e.question_title),b.a.createElement("div",{className:Re.a.questionChoices},$e==null||((At=$e.standard_answer)===null||At===void 0)?void 0:At.map(function(Nt,on){return b.a.createElement(R.a,null,b.a.createElement(f.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",Nt.choice_id,"\uFF09\uFF1A"),b.a.createElement(f.a,{flex:"1"},b.a.createElement(H.a,{key:on,checked:$e.standard_answer.includes(on),disabled:!0,value:Nt.answer_text})))})))};return b.a.createElement("section",{className:Re.a.wrap},!E&&er(),E&&yt())},wt=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(Ft)),Pt=["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(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.onRef,bn=$e===void 0?function(){}:$e,ze=Ne.editData,vn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","onRef","editData"]),ln=Object(w.useState)(""),Ht=Object(L.a)(ln,2),an=Ht[0],gn=Ht[1],kt=Object(w.useState)(""),Mt=Object(L.a)(kt,2),mt=Mt[0],It=Mt[1],un=Object(w.useState)(""),pn=Object(L.a)(un,2),Zt=pn[0],zt=pn[1],Tt=Object(w.useState)(5),zn=Object(L.a)(Tt,2),Pn=zn[0],Dn=zn[1],Jt=Object(w.useState)(!1),Un=Object(L.a)(Jt,2),Qn=Un[0],Gn=Un[1],Je=Object(K.i)();Object(w.useEffect)(function(){var B;if(!(ze!=null&&ze.question_title)){Gn(!0);return}gn(ze==null?void 0:ze.question_title),zt(ze==null||((B=ze.standard_answer)===null||B===void 0)?void 0:B[0]),Dn(ze==null?void 0:ze.question_score)},[pt.editData]),Object(w.useImperativeHandle)(st,function(){return{onSave:vt,isEdit:Qn}});var vt=function(){var B=Object(o.a)(S.a.mark(function d(){var E;return S.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(an){G.next=3;break}return i.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),G.abrupt("return",!1);case 3:if(!ze.question_id){G.next=9;break}return G.next=6,Object(V.u)({id:ze.question_id,question_title:an,question_type:4,question_score:Pn,standard_answers:[Zt]});case 6:E=G.sent,G.next=12;break;case 9:return G.next=11,Object(V.a)({exercise_bank_id:Je.topicId,question_title:an,question_type:4,question_score:Pn,standard_answers:[Zt]});case 11:E=G.sent;case 12:return E.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),Gn(!1),_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Je)})),G.abrupt("return",{name:an,answer_texts:[Zt],analysis:mt});case 14:case"end":return G.stop()}},d)}));return function(){return B.apply(this,arguments)}}(),Xt=function(){return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.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")),b.a.createElement(Fe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:an,onChange:function(E){return gn(E)}}),b.a.createElement("p",{className:Re.a.titleWrap},b.a.createElement("span",{className:Re.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),b.a.createElement(Fe.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Zt,onChange:function(E){return zt(E)}}),b.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",b.a.createElement(ge.a,{value:Pn,max:1e4,min:-1,onChange:function(E){Dn(E)}})," \u5206"),b.a.createElement("aside",{className:"tr"},ze.question_id&&b.a.createElement(Y.a,{type:"default",onClick:function(){return Gn(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return vt()}},"\u4FDD\u5B58")))},Gt=[{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"}],Bt=function(){var B=Object(o.a)(S.a.mark(function d(E){return S.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:G.t0=E.id,G.next=G.t0==="del"?3:G.t0==="up"||G.t0==="down"?5:G.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function se(){return S.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return Ye.next=2,Object(V.e)({pollsId:ze.question_id});case 2:_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Je)});case 3:case"end":return Ye.stop()}},se)}))()}}),G.abrupt("break",11);case 5:return G.next=7,Object(V.j)({exerciseId:ze==null?void 0:ze.question_id,opr:E.id});case 7:return _t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Je)}),G.abrupt("break",11);case 9:return Gn(!0),G.abrupt("break",11);case 11:case"end":return G.stop()}},d)}));return function(E){return B.apply(this,arguments)}}(),qt=function(){return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},ze.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",ze.question_score,"\u5206\uFF09"),!ze.hideAction&&Gt.map(function(d,E){return d.id==="up"&&ze.key===1||d.id==="down"&&ze.key===ze.len?null:b.a.createElement(Be.a,{key:E,placement:"bottom",title:d.name},b.a.createElement("span",{onClick:function(){return Bt(d)},className:d.icon}))})),b.a.createElement("div",{className:"mt5"},ze.question_title),b.a.createElement("div",{className:Re.a.questionChoices},b.a.createElement("p",null,b.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),b.a.createElement(xe.a,{value:Zt})))};return b.a.createElement("section",{className:Re.a.wrap},!Qn&&qt(),Qn&&Xt())},gt=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(We)),Ut=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Qe=function(Ne,st){var pt=Ne.problemset,St=Ne.globalSetting,$t=Ne.loading,_t=Ne.dispatch,$e=Ne.editData,bn=Object(A.a)(Ne,["problemset","globalSetting","loading","dispatch","editData"]),ze=Object(w.useState)(""),vn=Object(L.a)(ze,2),ln=vn[0],Ht=vn[1],an=Object(w.useState)(""),gn=Object(L.a)(an,2),kt=gn[0],Mt=gn[1],mt=Object(w.useState)(""),It=Object(L.a)(mt,2),un=It[0],pn=It[1],Zt=Object(w.useState)([]),zt=Object(L.a)(Zt,2),Tt=zt[0],zn=zt[1],Pn=Object(w.useState)(""),Dn=Object(L.a)(Pn,2),Jt=Dn[0],Un=Dn[1],Qn=Object(w.useState)(),Gn=Object(L.a)(Qn,2),Je=Gn[0],vt=Gn[1],Xt=Object(w.useState)(!1),Gt=Object(L.a)(Xt,2),Bt=Gt[0],qt=Gt[1],B=Object(w.useState)([]),d=Object(L.a)(B,2),E=d[0],F=d[1],G=Object(w.useState)(!1),U=Object(L.a)(G,2),se=U[0],He=U[1],Ye=Object(K.i)();Object(w.useEffect)(function(){var er;$e.edit&&He(!0),Ht($e.shixun_name),Mt($e.question_title);var mn=[];(er=$e.shixun)===null||er===void 0||er.map(function(At){mn.push(At.challenge_score)}),F(mn)},[$e]),Object(w.useEffect)(function(){qt(!1)},[se]),Object(w.useImperativeHandle)(st,function(){return{onSave:Ct,isEdit:se}});var Ct=function(){var er=Object(o.a)(S.a.mark(function mn(){var At,Nt,on;return S.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:if(At=[],Nt=!1,!Nt){En.next=4;break}return En.abrupt("return",!1);case 4:if(!$e.question_id){En.next=10;break}return En.next=7,Object(V.u)({id:$e.question_id,question_title:kt,shixun_name:ln,shixun_id:$e.shixun_id,question_type:5,question_scores:E});case 7:on=En.sent,En.next=13;break;case 10:return En.next=12,Object(V.a)({exercise_bank_id:Ye.topicId,question_title:kt,shixun_name:ln,shixun_id:$e.shixun_id,question_type:5,question_scores:E});case 12:on=En.sent;case 13:return on.status===0&&(i.b.success("\u4FDD\u5B58\u6210\u529F"),He(!1)),En.next=16,_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Ye)});case 16:return En.abrupt("return",{name:kt,analysis:un,standard_answers:At,is_ordered:Je});case 17:case"end":return En.stop()}},mn)}));return function(){return er.apply(this,arguments)}}(),Ge=function(){var mn;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.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")),b.a.createElement("div",{className:"mt10"},b.a.createElement(H.a,{defaultValue:ln,onChange:function(Nt){Ht(Nt.target.value)}})),b.a.createElement("div",{className:"mt10"},b.a.createElement(Fe.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:kt,onChange:function(Nt){Mt(Nt)}})),b.a.createElement("div",{className:"mt20"},(mn=$e.shixun)===null||mn===void 0?void 0:mn.map(function(At,Nt){return b.a.createElement(R.a,{gutter:[20,20]},b.a.createElement(f.a,{flex:"1"},Nt+1,".",At.challenge_name),b.a.createElement(f.a,null,b.a.createElement(ge.a,{defaultValue:E[Nt],onChange:function(dn){E[Nt]=dn,F(E),console.log("srore:L",E[Nt])}})))})),b.a.createElement("div",{className:"mt20"},Tt.length>1&&b.a.createElement("span",null,b.a.createElement(qe.a,{checked:Je,onChange:function(Nt){return vt(Nt.target.checked)},className:"".concat(Re.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),b.a.createElement("span",{className:"".concat(Re.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"))),b.a.createElement("aside",{className:"tr"},!($e!=null&&$e.edit)&&b.a.createElement(Y.a,{type:"default",onClick:function(){return He(!1)}},"\u53D6\u6D88"),b.a.createElement(Y.a,{className:"ml20",type:"primary",onClick:function(){return Ct()}},"\u4FDD\u5B58")))},yt=[{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"}],Qt=function(){var er=Object(o.a)(S.a.mark(function mn(At){return S.a.wrap(function(on){for(;;)switch(on.prev=on.next){case 0:on.t0=At.id,on.next=on.t0==="del"?3:on.t0==="up"||on.t0==="down"?5:on.t0==="edit"?9:11;break;case 3:return N.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(o.a)(S.a.mark(function En(){return S.a.wrap(function(cn){for(;;)switch(cn.prev=cn.next){case 0:return cn.next=2,Object(V.e)({pollsId:$e.question_id});case 2:_t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Ye)});case 3:case"end":return cn.stop()}},En)}))()}}),on.abrupt("break",11);case 5:return on.next=7,Object(V.j)({exerciseId:$e==null?void 0:$e.question_id,opr:At.id});case 7:return _t({type:"polls/getExerciseBanks",payload:Object(l.a)({},Ye)}),on.abrupt("break",11);case 9:return He(!0),on.abrupt("break",11);case 11:case"end":return on.stop()}},mn)}));return function(At){return er.apply(this,arguments)}}(),Bn=function(){var mn;return b.a.createElement("aside",null,b.a.createElement("div",{className:Re.a.questionType},b.a.createElement("div",null,b.a.createElement("span",{className:"font16 c-blue"},$e.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",$e.question_score,"\u5206\uFF09"),b.a.createElement("div",{className:"tr"},b.a.createElement(X.a,{target:"_blank",to:"/shixuns/".concat($e.shixun_identifier,"/challenges")},"\u5B9E\u8BAD\u8BE6\u60C5"),!$e.hideAction&&yt.map(function(At,Nt){return At.id==="up"&&$e.key===1||At.id==="down"&&$e.key===$e.len?null:b.a.createElement(Be.a,{key:Nt,placement:"bottom",title:At.name},b.a.createElement("span",{onClick:function(){return Qt(At)},className:At.icon}))}))),b.a.createElement("div",{className:"font16"},$e.shixun_name),b.a.createElement("div",{className:"mt30"}),(mn=$e.shixun)===null||mn===void 0?void 0:mn.map(function(At,Nt){return b.a.createElement("div",{key:Nt},"\u7B2C",Nt+1,"\u5173 ",b.a.createElement("span",{className:"ml10"},At.challenge_name)," ",b.a.createElement("span",{className:"ml10"},At.challenge_score))}))};return b.a.createElement("section",{className:Re.a.wrap},!se&&Bn(),se&&Ge())},ot=Object(Q.a)(function(Te){var Ne=Te.problemset,st=Te.loading,pt=Te.globalSetting;return{problemset:Ne,globalSetting:pt,loading:st.effects}},null,null,{forwardRef:!0})(Object(w.forwardRef)(Qe)),Ae=$("UU91"),be=$.n(Ae),Se=$("fJjg"),re=u.a.SubMenu,ae=x.a.Content,fe=x.a.Sider,Ee=function(Ne){var st,pt,St,$t,_t,$e,bn,ze,vn,ln,Ht,an,gn,kt,Mt,mt,It,un,pn,Zt,zt,Tt,zn,Pn,Dn,Jt,Un,Qn,Gn,Je,vt,Xt,Gt,Bt,qt,B,d,E,F,G,U,se,He,Ye,Ct,Ge,yt,Qt,Bn,er,mn,At,Nt,on,dn,En,Fn,cn=Ne.polls,Er=Ne.globalSetting,Qr=Ne.loading,ni=Ne.user,wi=Ne.dispatch,Ki=Object(A.a)(Ne,["polls","globalSetting","loading","user","dispatch"]),hr=Object(K.i)(),_r=Object(K.h)(),gi=ni.userInfo,Oi=v.a.useForm(),qi=Object(L.a)(Oi,1),rr=qi[0],jn=Object(w.useState)([]),fr=Object(L.a)(jn,2),xn=fr[0],pr=fr[1],Yn=Object(w.useState)(!1),ri=Object(L.a)(Yn,2),vr=ri[0],jr=ri[1],zi=[{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}],ci=Object(w.useRef)();Object(w.useEffect)(function(){var mr;if((mr=cn.exerciseBanks)!==null&&mr!==void 0&&mr.exercise_questions){var Vn,Ar,Tr,ii,Rr;pr(Object(C.a)((Vn=cn.exerciseBanks)===null||Vn===void 0?void 0:Vn.exercise_questions)),rr.setFieldsValue({exercise_name:(Ar=cn.exerciseBanks)===null||Ar===void 0||((Tr=Ar.exercise)===null||Tr===void 0)?void 0:Tr.exercise_name,exercise_description:(ii=cn.exerciseBanks)===null||ii===void 0||((Rr=ii.exercise)===null||Rr===void 0)?void 0:Rr.exercise_description})}},[cn.exerciseBanks]),Object(w.useEffect)(function(){wi({type:"polls/getExerciseBanks",payload:Object(l.a)({},hr)})},[hr.categoryId]);var hi=function(){var mr=Object(o.a)(S.a.mark(function Vn(){var Ar,Tr,ii;return S.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,rr.validateFields();case 2:return ii=rr.getFieldValue(),ii.is_md=!0,ii.topicId=(Ar=cn.exerciseBanks)===null||Ar===void 0||((Tr=Ar.exercise)===null||Tr===void 0)?void 0:Tr.id,jr(!1),Kt.next=8,Object(V.v)(Object(l.a)({},ii));case 8:wi({type:"polls/getExerciseBanks",payload:Object(l.a)({},hr)});case 9:case"end":return Kt.stop()}},Vn)}));return function(){return mr.apply(this,arguments)}}(),_i=function(){var mr=Object(o.a)(S.a.mark(function Vn(Ar){var Tr;return S.a.wrap(function(Rr){for(;;)switch(Rr.prev=Rr.next){case 0:return Rr.next=2,ci==null?void 0:ci.current;case 2:if(Tr=Rr.sent,!(Tr!=null&&Tr.isEdit)){Rr.next=6;break}return i.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),Rr.abrupt("return");case 6:Ar===5?wi({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}):pr([].concat(Object(C.a)(xn),[{question_type:Ar}]));case 7:case"end":return Rr.stop()}},Vn)}));return function(Ar){return mr.apply(this,arguments)}}(),Nr=function(){wi({type:"userDetail/setActionTabs",payload:{key:"UserDetail-SendToClass",params:{object_id:[hr.topicId],object_type:"exercise"}}})},Gi=function(){return xn==null?void 0:xn.map(function(Vn,Ar){if(Vn.key=Ar+1,Vn.len=xn.length,Vn.question_type===0)return b.a.createElement("aside",null,b.a.createElement(et,{ref:ci,editData:Vn}),b.a.createElement(y.a,null));if(Vn.question_type===1)return b.a.createElement("aside",null,b.a.createElement(ut,{ref:ci,editData:Vn}),b.a.createElement(y.a,null));if(Vn.question_type===2)return b.a.createElement("aside",null,b.a.createElement(it,{ref:ci,editData:Vn}),b.a.createElement(y.a,null));if(Vn.question_type===3)return b.a.createElement("aside",null,b.a.createElement(wt,{editData:Vn}),b.a.createElement(y.a,null));if(Vn.question_type===4)return b.a.createElement("aside",null,b.a.createElement(gt,{editData:Vn}),b.a.createElement(y.a,null));if(Vn.question_type===5)return b.a.createElement("aside",null,b.a.createElement(ot,{editData:Vn}),b.a.createElement(y.a,null))})};return b.a.createElement("section",{className:"edu-container"},b.a.createElement("section",{className:"animated fadeIn"},b.a.createElement("aside",{className:"mt10"},gi&&b.a.createElement(p.a,{separator:">"},b.a.createElement(p.a.Item,null,b.a.createElement(X.a,{to:"/users/".concat(hr.username,"/").concat(hr.topictype==="personal"?"topics":"topicbank","/").concat(hr.topictype)},hr.topictype==="personal"?"\u6211\u7684\u9898\u5E93":"\u516C\u5171\u9898\u5E93")),b.a.createElement(p.a.Item,null,"\u8BE6\u60C5"))),b.a.createElement("aside",{className:[be.a.title,"mt20"].join(" ")},b.a.createElement(R.a,{style:{width:"100%"},align:"middle"},b.a.createElement(f.a,{flex:"1"},b.a.createElement("strong",{className:"font20 ml5"},(st=cn.exerciseBanks)===null||st===void 0||((pt=st.exercise)===null||pt===void 0)?void 0:pt.exercise_name),b.a.createElement(xt.k,{status:[(St=cn.exerciseBanks)!==null&&St!==void 0&&($t=St.exercise)!==null&&$t!==void 0&&$t.is_public?"\u516C\u5F00":"\u79C1\u6709"]})),b.a.createElement(f.a,null,b.a.createElement(X.a,{className:"font16 c-light-black",to:"/users/".concat(gi.login,"/topics/").concat(hr.topictype)},"\u8FD4\u56DE"))))),b.a.createElement("section",{className:[be.a.bg,"pl30","pr30","pb30","mt20 relative"].join(" ")},b.a.createElement("div",{className:be.a.export},((_t=cn.exerciseBanks)===null||_t===void 0?void 0:_t.authorize)&&b.a.createElement(b.a.Fragment,null,b.a.createElement("a",{onClick:function(Vn){Vn.preventDefault(),N.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var Ar=Object(o.a)(S.a.mark(function ii(){var Rr;return S.a.wrap(function(en){for(;;)switch(en.prev=en.next){case 0:return en.next=2,Object(W.j)({object_type:"normal",object_id:[hr.topicId]});case 2:Rr=en.sent,Rr.status===0&&Q.d.push("/users/".concat(hr.username,"/topics/personal"));case 4:case"end":return en.stop()}},ii)}));function Tr(){return Ar.apply(this,arguments)}return Tr}()})}},"\u5220\u9664"),b.a.createElement(X.a,{to:"/users/".concat(gi.login,"/topics/").concat(hr.topicId,"/").concat(hr.topictype,"/exercise/edit")},"\u7F16\u8F91")),b.a.createElement("a",{onClick:function(Vn){Vn.preventDefault(),Nr()}},"\u53D1\u9001")),b.a.createElement(I.a,{className:be.a.tabs},b.a.createElement(I.a.TabPane,{tab:b.a.createElement("span",{className:"font16 pt10 pb12"},"\u5185\u5BB9\u8BE6\u60C5"),key:"1"},b.a.createElement("div",{className:"c-light-black"},($e=cn.exerciseBanks)===null||$e===void 0||((bn=$e.exercise)===null||bn===void 0)?void 0:bn.exercise_description))),vr&&b.a.createElement(v.a,{layout:"vertical",form:rr},b.a.createElement(v.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},b.a.createElement(H.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),b.a.createElement(v.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},b.a.createElement(H.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"})),b.a.createElement(v.a.Item,{className:"tr"},b.a.createElement(Y.a,{type:"primary",onClick:function(){hi()}},"\u4FDD\u5B58")))),b.a.createElement("p",{className:"mt10",style:{display:"flex"}},b.a.createElement("span",{className:"fl",style:{flex:"1"}},!!((ze=cn.exerciseBanks)!==null&&ze!==void 0&&(vn=ze.exercise_types)!==null&&vn!==void 0&&vn.q_singles)&&b.a.createElement("span",{className:"ml20"},"\u5355\u9009\u9898",(ln=cn.exerciseBanks)===null||ln===void 0||((Ht=ln.exercise_types)===null||Ht===void 0)?void 0:Ht.q_singles,"\u9898\uFF0C\u5171",(an=cn.exerciseBanks)===null||an===void 0||((gn=an.exercise_types)===null||gn===void 0)?void 0:gn.q_singles_scores,"\u5206"),!!((kt=cn.exerciseBanks)!==null&&kt!==void 0&&(Mt=kt.exercise_types)!==null&&Mt!==void 0&&Mt.q_doubles)&&b.a.createElement("span",{className:"ml20"},"\u591A\u9009\u9898",(mt=cn.exerciseBanks)===null||mt===void 0||((It=mt.exercise_types)===null||It===void 0)?void 0:It.q_doubles,"\u9898\uFF0C\u5171",(un=cn.exerciseBanks)===null||un===void 0||((pn=un.exercise_types)===null||pn===void 0)?void 0:pn.q_doubles_scores,"\u5206"),!!((Zt=cn.exerciseBanks)!==null&&Zt!==void 0&&(zt=Zt.exercise_types)!==null&&zt!==void 0&&zt.q_judges)&&b.a.createElement("span",{className:"ml20"},"\u5224\u65AD\u9898",(Tt=cn.exerciseBanks)===null||Tt===void 0||((zn=Tt.exercise_types)===null||zn===void 0)?void 0:zn.q_judges,"\u9898\uFF0C\u5171",(Pn=cn.exerciseBanks)===null||Pn===void 0||((Dn=Pn.exercise_types)===null||Dn===void 0)?void 0:Dn.q_judges_scores,"\u5206"),!!((Jt=cn.exerciseBanks)!==null&&Jt!==void 0&&(Un=Jt.exercise_types)!==null&&Un!==void 0&&Un.q_nulls)&&b.a.createElement("span",{className:"ml20"},"\u586B\u7A7A\u9898",(Qn=cn.exerciseBanks)===null||Qn===void 0||((Gn=Qn.exercise_types)===null||Gn===void 0)?void 0:Gn.q_nulls,"\u9898\uFF0C\u5171",(Je=cn.exerciseBanks)===null||Je===void 0||((vt=Je.exercise_types)===null||vt===void 0)?void 0:vt.q_nulls_scores,"\u5206"),!!((Xt=cn.exerciseBanks)!==null&&Xt!==void 0&&(Gt=Xt.exercise_types)!==null&&Gt!==void 0&&Gt.q_mains)&&b.a.createElement("span",{className:"ml20"},"\u7B80\u7B54\u9898",(Bt=cn.exerciseBanks)===null||Bt===void 0||((qt=Bt.exercise_types)===null||qt===void 0)?void 0:qt.q_mains,"\u9898\uFF0C\u5171",(B=cn.exerciseBanks)===null||B===void 0||((d=B.exercise_types)===null||d===void 0)?void 0:d.q_mains_scores,"\u5206"),!!((E=cn.exerciseBanks)!==null&&E!==void 0&&(F=E.exercise_types)!==null&&F!==void 0&&F.q_shixuns)&&b.a.createElement("span",{className:"ml20"},"\u5B9E\u8BAD\u9898",(G=cn.exerciseBanks)===null||G===void 0||((U=G.exercise_types)===null||U===void 0)?void 0:U.q_shixuns,"\u9898\uFF0C\u5171",(se=cn.exerciseBanks)===null||se===void 0||((He=se.exercise_types)===null||He===void 0)?void 0:He.q_shixuns_scores,"\u5206"),!!((Ye=cn.exerciseBanks)!==null&&Ye!==void 0&&(Ct=Ye.exercise_types)!==null&&Ct!==void 0&&Ct.q_pros)&&b.a.createElement("span",{className:"ml20"},"\u7F16\u7A0B\u9898",(Ge=cn.exerciseBanks)===null||Ge===void 0||((yt=Ge.exercise_types)===null||yt===void 0)?void 0:yt.q_pros,"\u9898\uFF0C\u5171",(Qt=cn.exerciseBanks)===null||Qt===void 0||((Bn=Qt.exercise_types)===null||Bn===void 0)?void 0:Bn.q_pros_scores,"\u5206")),b.a.createElement("span",{className:"fr"},!!((er=cn.exerciseBanks)!==null&&er!==void 0&&(mn=er.exercise_types)!==null&&mn!==void 0&&mn.q_counts)&&b.a.createElement("span",null,"\u5408\u8BA1 ",b.a.createElement("span",{className:"color-blue"},(At=cn.exerciseBanks)===null||At===void 0||((Nt=At.exercise_types)===null||Nt===void 0)?void 0:Nt.q_counts)," \u9898\uFF0C \u5171 ",b.a.createElement("span",{className:"".concat(((on=cn.exerciseBanks)===null||on===void 0||((dn=on.exercise_types)===null||dn===void 0)?void 0:dn.q_scores)>100?"color-red font-bd":"color-orange")},(En=cn.exerciseBanks)===null||En===void 0||((Fn=En.exercise_types)===null||Fn===void 0)?void 0:Fn.q_scores)," \u5206"))),b.a.createElement("section",{className:[be.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},xn!=""&&Gi(),xn==""&&b.a.createElement(te.a,null)),b.a.createElement(Se.a,null))},je=Me.default=Object(Q.a)(function(Te){var Ne=Te.polls,st=Te.loading,pt=Te.user,St=Te.globalSetting;return{polls:Ne,globalSetting:St,user:pt,loading:st.effects}})(Ee)},Nska:function(Wt,Me,$){Wt.exports={wrap:"wrap___1qNoS",title:"title___18s87",radioWrap:"radioWrap___3ZobS",radio:"radio___19YEl",colorFF0000:"colorFF0000___2BuLq",pagination:"pagination___18hXH"}},O2Wb:function(Wt,Me,$){Wt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},Ot1p:function(Wt,Me,$){"use strict";var ie=$("2qtc"),Y=$("kLXV"),M=$("rAM+"),H=$("miYZ"),O=$("tsqr"),I=$("9og8"),j=$("tJVT"),N=$("jrin"),P=$("WmNS"),R=$.n(P),c=$("q1tI"),f=$.n(c),_=$("VrN/"),p=$.n(_),m=$("bdgK"),y=$("p77/"),a=$("Bd2K"),i=$("ELLl"),o=$("19Vz"),l=$("lZu9"),C=$("+NIl"),g=$("kSUc"),v=$("9Bee"),L=function(Te){var Ne=Te.value,st=Ne===void 0?"":Ne,pt=Te.className,St=Te.showTextOnly,$t=Te.showLines,_t=Te.style,$e=_t===void 0?{}:_t,bn=Object(c.useMemo)(function(){return""},[st]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:bn}}))},A=$("0Owb"),T=$("dejd"),x=$("C+DQ"),h=$("1vsH"),u=$("m3rI"),D=[{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 S(Te){var Ne=Te.onActionCallback,st=Te.title,pt=Te.icon,St=Te.actionName,$t=Te.className,_t=$t===void 0?"":$t,$e=Te.children;function bn(){Ne(St)}return f.a.createElement("a",{title:st,className:_t,onClick:bn},f.a.createElement("i",{className:"md-iconfont ".concat(pt)}),$e)}var w=function(Te){var Ne=Te.watch,st=Te.showNullButton,pt=Te.onActionCallback,St=Te.fullScreen,$t=Te.insertTemp,_t=Te.hidetoolBar,$e=Te.uuid,bn=Te.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.D)("_educoder_session"),"&key=").concat($e,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var ze=[].concat(D,[{title:"".concat(Ne?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ne?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!_t&&ze.map(function(vn,ln){return f.a.createElement("li",{key:ln},vn.actionName?f.a.createElement(S,Object(A.a)({},vn,{onActionCallback:pt})):f.a.createElement("span",{className:"v-line"}))}),st?f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:pt},f.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,$t&&f.a.createElement("li",null,f.a.createElement(S,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat($t),onActionCallback:pt},f.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),f.a.createElement("li",{className:"btn-full-screen"},f.a.createElement(S,{icon:"".concat(St?"icon-shrink":"icon-enlarge"),title:St?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:pt})))},b=$("M8RZ"),K=$("+L6B"),X=$("2/Rp"),Q=$("y8nQ"),V=$("Vl3Y"),W=$("5NDa"),te=$("5rEg"),ue={labelCol:{span:4},wrapperCol:{span:20}},ge=function(Te){var Ne=Te.callback,st=Te.onCancel;function pt(St){Ne(St)}return f.a.createElement(V.a,Object(A.a)({},ue,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:pt}),f.a.createElement(V.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement(te.a,null)),f.a.createElement(V.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement(te.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(X.a,{type:"ghost",onClick:st},"\u53D6\u6D88")))},Oe=$("7ahc"),qe=$("k1fw"),Ke=$("HmJG"),Be=$("BjJ7"),Xe=V.a.useForm,Fe={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},oe=function(Te){var Ne=Te.callback,st=Te.onCancel,pt=Xe(),St=Object(j.a)(pt,1),$t=St[0],_t=Object(c.useRef)();function $e(vn){Ne(Object(qe.a)(Object(qe.a)({},vn),{},{name:_t.current}))}function bn(vn,ln){$t.setFieldsValue({src:"/api/attachments/".concat(vn.id,"?type=").concat(vn.content_type),type:ln.type})}function ze(vn){var ln=vn.target.files[0];_t.current=ln.name,dt(ln,bn)}return f.a.createElement(V.a,Object(A.a)({form:$t},xe,{className:"upload-image-panel",onFinish:$e}),f.a.createElement(V.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(V.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},f.a.createElement(te.a,{style:Fe})),f.a.createElement(Re,{onFileChange:ze}))),f.a.createElement(V.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},f.a.createElement(te.a,{style:{width:264}})),f.a.createElement(V.a.Item,{style:{textAlign:"right"}},f.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(X.a,{type:"ghost",onClick:st},"\u53D6\u6D88")))};function Re(Te){var Ne=Te.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:Ne}))}function dt(Te,Ne){if(!Te)throw new String("\u6CA1\u6709\u6587\u4EF6");var st=new FormData;st.append("editormd-image-file",Te),st.append("file_param_name","editormd-image-file"),st.append("byxhr","true");var pt=new window.XMLHttpRequest;pt.withCredentials=!0,pt.addEventListener("load",function(St){Ne(JSON.parse(St.target.responseText),Te)},!1),pt.addEventListener("error",function(St){console.error(St)},!1),pt.open("POST","".concat(Be.a,"/api/attachments.json")),pt.send(st)}var at=$("giR+"),ut=$("fyUT"),ce=$("7Kak"),he=$("9yH6"),Le=he.a.Group,Ve={margin:"0 8px"},et=function(Te){var Ne=Te.callback,st=Te.onCancel;function pt(St){Ne(St)}return f.a.createElement(V.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:pt},f.a.createElement("div",{className:"flex-container"},f.a.createElement("span",{style:Ve},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:Ve},"\u884C\u6570"),f.a.createElement(V.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(ut.a,null)),f.a.createElement("span",{style:Ve},"\u5217\u6570"),f.a.createElement(V.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(ut.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12}},f.a.createElement("span",{style:Ve},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(V.a.Item,{name:"align"},f.a.createElement(Le,null,f.a.createElement(he.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(he.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(he.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(he.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(X.a,{type:"ghost",onClick:st},"\u53D6\u6D88")))},tt=$("ErOA"),rt=$("7Cbv"),it="link",Dt="upload-image",Et="code-block",xt="add-table",ct="------------",Ft={default:ct,left:":".concat(ct),center:":".concat(ct,":"),right:"".concat(ct,":")},wt=$("9VGf"),Pt,We;function gt(){}var Ut=0,Qe=1e4,ot="\u2581",Ae=`
**\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 be(Te){return/^\d+$/.test(Te)?"".concat(Te,"px"):Te}var Se=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=Se?"Cmd":"Ctrl",ae=["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"],fe=(Pt={},Object(N.a)(Pt,re+"-B","bold"),Object(N.a)(Pt,re+"-I","italic"),Pt),Ee=(We={},Object(N.a)(We,it,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(We,Et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(We,Dt,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(We,xt,"\u6DFB\u52A0\u8868\u683C"),We),je=Me.a=function(Te){var Ne=Te.defaultValue,st=Ne===void 0?"":Ne,pt=Te.onChange,St=Te.width,$t=St===void 0?"100%":St,_t=Te.height,$e=_t===void 0?400:_t,bn=Te.miniToolbar,ze=bn===void 0?!1:bn,vn=Te.isFocus,ln=vn===void 0?!1:vn,Ht=Te.watch,an=Te.insertTemp,gn=Te.mode,kt=gn===void 0?"markdown":gn,Mt=Te.id,mt=Mt===void 0?"markdown-editor-id":Mt,It=Te.showResizeBar,un=It===void 0?!1:It,pn=Te.noStorage,Zt=pn===void 0?!1:pn,zt=Te.showNullButton,Tt=zt===void 0?!1:zt,zn=Te.hidetoolBar,Pn=zn===void 0?!1:zn,Dn=Te.fullScreen,Jt=Dn===void 0?!1:Dn,Un=Te.onBlur,Qn=Te.onCMBeforeChange,Gn=Te.onFullScreen,Je=Te.className,vt=Je===void 0?"":Je,Xt=Te.disablePaste,Gt=Xt===void 0?!1:Xt,Bt=Te.placeholder,qt=Bt===void 0?"":Bt,B=Te.values,d=B===void 0?"":B,E=Object(c.useState)(null),F=Object(j.a)(E,2),G=F[0],U=F[1],se=Object(c.useState)(st),He=Object(j.a)(se,2),Ye=He[0],Ct=He[1],Ge=Object(c.useState)(Ht),yt=Object(j.a)(Ge,2),Qt=yt[0],Bn=yt[1],er=Object(c.useState)(Jt),mn=Object(j.a)(er,2),At=mn[0],Nt=mn[1],on=Object(c.useState)(""),dn=Object(j.a)(on,2),En=dn[0],Fn=dn[1],cn=Object(c.useState)(0),Er=Object(j.a)(cn,2),Qr=Er[0],ni=Er[1],wi=Object(c.useState)($e),Ki=Object(j.a)(wi,2),hr=Ki[0],_r=Ki[1],gi=Object(c.useState)(!1),Oi=Object(j.a)(gi,2),qi=Oi[0],rr=Oi[1],jn=Object(c.useRef)(Object(rt.a)()),fr=Object(c.useRef)(!1),xn=Object(c.useRef)(),pr=Object(c.useRef)(),Yn=Object(c.useRef)(),ri=Object(c.useRef)(),vr=Object(c.useRef)(),jr=function(){var Kt=Object(I.a)(R.a.mark(function en(){var tn,An;return R.a.wrap(function(tr){for(;;)switch(tr.prev=tr.next){case 0:return tr.next=2,Object(tt.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:jn.current}});case 2:An=tr.sent,An!=null&&(tn=An.attachments)!==null&&tn!==void 0&&tn.length&&(console.log("cm:",G,pr),An.attachments.map(function(In){In.content_type.indexOf("image")>-1?G.replaceSelection("![,](/api/attachments/".concat(In.id,"?type=").concat(In.content_type,")")):In.content_type.indexOf("video")>-1?G.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):In.content_type.indexOf("pdf")>-1?G.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(In.id,"?type=").concat(In.content_type,'&disposition=inline" target="_blank">').concat(In.name,"</a>")):G.replaceSelection("[".concat(In.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(In.id,"?type=").concat(In.content_type,")"))}));case 4:case"end":return tr.stop()}},en)}));return function(){return Kt.apply(this,arguments)}}();Object(c.useEffect)(function(){Ct(d),G==null||G.setValue(d)},[d]),Object(c.useEffect)(function(){Gn==null||Gn(At)},[At]),Object(c.useEffect)(function(){if(pr.current){var Kt=p.a.fromTextArea(pr.current,{mode:kt,lineNumbers:!ze,lineWrapping:!0,value:st,autoCloseTags:!0,autoCloseBrackets:!0});ln&&Kt.focus();function en(tn,An){if(Gt){An.preventDefault();return}var Wn=An.clipboardData;if(Wn){var tr=Wn.types.toString(),In=Wn.items;if(tr==="Files"||Wn.types.indexOf("Files")>-1){if(An.preventDefault(),kt=="stex")return;try{var kr,Zr=In[1];((kr=In[0])===null||kr===void 0?void 0:kr.kind)==="file"&&(Zr=In[0]);var Ln=Zr.getAsFile(),Pi=Ln.name.split(".").pop();dt(Ln,function($n){if($n.id){var Ur,yi,ai;(Ln==null||((Ur=Ln.type)===null||Ur===void 0)?void 0:Ur.indexOf("image"))>-1?Kt.replaceSelection("![,](/api/attachments/".concat($n.id,"?type=").concat($n.content_type,")")):(Ln==null||((yi=Ln.type)===null||yi===void 0)?void 0:yi.indexOf("video"))>-1?Kt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,'"></video>')):(Ln==null||((ai=Ln.type)===null||ai===void 0)?void 0:ai.indexOf("pdf"))>-1?Kt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,"?type=").concat(Ln.type,'&disposition=inline" target="_blank">').concat(Ln.name,"</a>")):ae.includes(Pi)?Kt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,'?type=office&disposition=inline" target="_blank">').concat(Ln.name,"</a>")):Kt.replaceSelection("[".concat(Ln.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,"?type=").concat($n.content_type,")"))}else($n==null?void 0:$n.status)===401&&(document.location.href="/user/login")})}catch($n){O.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Kt.on("paste",en),Kt.on("dragleave",function(tn,An){Yn.current.classList.remove("mouse-hover-md")}),Kt.on("dragover",function(tn,An){Yn.current.classList.add("mouse-hover-md")}),Kt.on("drop",function(tn,An){Yn.current.classList.add("mouse-hover-md");var Wn;if(Wn=An.dataTransfer.files,Wn.length>0){An.preventDefault(),An.stopPropagation();for(var tr=function(Zr){var Ln=Wn[Zr],Pi=Ln.name.split(".").pop();dt(Ln,function($n){if($n.id){var Ur,yi,ai;(Ln==null||((Ur=Ln.type)===null||Ur===void 0)?void 0:Ur.indexOf("image"))>-1?Kt.replaceSelection("![,](/api/attachments/".concat($n.id,"?type=").concat($n.content_type,")")):(Ln==null||((yi=Ln.type)===null||yi===void 0)?void 0:yi.indexOf("video"))>-1?Kt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,'"></video>')):(Ln==null||((ai=Ln.type)===null||ai===void 0)?void 0:ai.indexOf("pdf"))>-1?Kt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,"?type=").concat(Ln.type,'&disposition=inline" target="_blank">').concat(Ln.name,"</a>")):ae.includes(Pi)?Kt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,'?type=office&disposition=inline" target="_blank">').concat(Ln.name,"</a>")):Kt.replaceSelection("[".concat(Ln.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat($n.id,"?type=").concat($n.content_type,")"))}else($n==null?void 0:$n.status)===401&&(document.location.href="/user/login")})},In=0;In<Wn.length;In++)tr(In)}}),U(Kt),function(){Kt.off("paste",en)}}},[]);var zi=Object(c.useCallback)(function(){if(Yn.current)try{}catch(Kt){console.log(Kt,"---- to set md editor body height")}},[hr,Yn,At]);Object(c.useEffect)(function(){function Kt(){var tn=new m.default(function(An){var Wn=Object(M.a)(An),tr;try{for(Wn.s();!(tr=Wn.n()).done;){var In=tr.value;(In.target.offsetHeight>0||In.target.offsetWidth>0)&&(zi(),G.setSize("100%","100%"),G.refresh())}}catch(kr){Wn.e(kr)}finally{Wn.f()}});return tn.observe(pr.current.parentElement),tn}if(G){var en=Kt();return function(){en.unobserve(pr.current.parentElement)}}},[G,zi]),Object(c.useEffect)(function(){if(G){for(var Kt=[],en=function(){var In=An[tn];Wn=Object(j.a)(In,2);var kr=Wn[0],Zr=Wn[1],Ln=Object(N.a)({},kr,function(){ci(Zr)});Kt.push(Ln),G.addKeyMap(Ln)},tn=0,An=Object.entries(fe);tn<An.length;tn++){var Wn;en()}return xn.current=setInterval(function(){fr.current&&jr()},4e3),function(){clearInterval(xn.current);var tr=Object(M.a)(Kt),In;try{for(tr.s();!(In=tr.n()).done;){var kr=In.value;G.removeKeyMap(kr)}}catch(Zr){tr.e(Zr)}finally{tr.f()}}}},[G]),Object(c.useEffect)(function(){Jt!==At&&Nt(Jt)},[Jt]),Object(wt.a)(function(){if(!Zt&&Qr>0){var Kt=new Date().getTime(),en=window.sessionStorage.getItem(mt);Kt>=Qr+Qe&&(!en||en!==Ye)&&(window.sessionStorage.setItem(mt,Ye),rr(!0))}},Qe),Object(c.useEffect)(function(){Bn(Ht)},[G,Ht]),Object(c.useEffect)(function(){G&&(ln&&G.focus())},[G,ln]),Object(c.useEffect)(function(){if(Qt&&G){var Kt=G.getScrollerElement();function en(tn){var An=tn.target;if(vr.current){var Wn=An.scrollTop/An.scrollHeight;vr.current.scrollTop=vr.current.scrollHeight*Wn}}return Kt.addEventListener("scroll",en),function(){Kt.removeEventListener("scroll",en)}}},[G,Qt]),Object(c.useEffect)(function(){if(G&&Qn){function Kt(en,tn){Qn(en,tn)}return G.on("beforeChange",Kt),function(){G.off("beforeChange",Kt)}}},[G,Qn]),Object(c.useEffect)(function(){if(G&&Un){function Kt(){Un(G.getValue())}return G.on("blur",Kt),function(){G.off("blur",Kt)}}},[G,Un]),Object(c.useEffect)(function(){if(G){function Kt(en){var tn=en.getValue();Ct(tn),ni(new Date().getTime()),en.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),pt&&pt(tn)}return G.on("change",Kt),function(){G.off("change",Kt)}}},[G,pt]),Object(c.useEffect)(function(){G&&(st==null?(G.setValue(""),Ct("")):st!==G.getValue()&&(G.setValue(st),Ct(st),G.setCursor(G.lineCount(),0)))},[G,st]);var ci=Object(c.useCallback)(function(Kt){var en=G.getCursor(),tn=G.getSelection(),An=tn.split(`
`);switch(Kt){case"bold":return G.replaceSelection("**"+tn+"**"),tn===""&&G.setCursor(en.line,en.ch+2),G.focus();case"italic":return G.replaceSelection("*"+tn+"*"),tn===""&&G.setCursor(en.line,en.ch+1),G.focus();case"code":return G.replaceSelection("`"+tn+"`"),tn===""&&G.setCursor(en.line,en.ch+1),G.focus();case"inline-latex":return G.replaceSelection("`$$"+tn+"$$`"),tn===""&&G.setCursor(en.line,en.ch+3),G.focus();case"latex":return G.replaceSelection("```latex\n"+tn+"\n```"),G.setCursor(en.line+1,tn.length+1),G.focus();case"line-break":return G.replaceSelection(`<br/>
`),G.focus();case"list-ul":return tn===""?G.replaceSelection("- "+tn):G.replaceSelection(An.map(function(Wn){return Wn===""?"":"- ".concat(Wn)}).join(`
`)),G.focus();case"list-ol":return tn===""?G.replaceSelection("1. "+tn):G.replaceSelection(An.map(function(Wn,tr){return Wn===""?"":"".concat(tr+1,". ").concat(Wn)}).join(`
`)),G.focus();case"add-null-ch":return tn===""&&G.setCursor(en.line,en.ch+1),G.replaceSelection(ot),G.focus();case"inster-template-1":return tn===""&&G.setCursor(en.line,en.ch),G.replaceSelection(Ae),G.focus();case"eraser":return G.setValue(""),G.focus();case"trigger-watch":return Bn(!Qt),G.focus();case"trigger-full-screen":return Nt(!At),G.focus();case it:Fn(it);return;case Et:Fn(Et);return;case Dt:Fn(Dt);return;case xt:Fn(xt);return;default:throw new Error}},[G,Qt,At]),hi=Object(c.useCallback)(function(Kt){Fn("");switch(En){case it:var en=Kt.title,tn=Kt.link;return G.replaceSelection("[".concat(en,"](").concat(tn,")")),G.focus();case Et:var An=Kt.language,Wn=Kt.content;return G.replaceSelection(["```"+An,Wn,"```"].join(`
`)),G.focus();case Dt:var tr=Kt.src,In=Kt.alt,kr=Kt.name;return tr.indexOf("type=image")>-1?G.replaceSelection("![ ".concat(In||""," ]( ").concat(tr,' "').concat(In||"",'" )')):tr.indexOf("type=application/pdf")>-1?G.replaceSelection('<a href="'.concat(tr,'&disposition=inline" target="_blank">').concat(kr,"</a>")):G.replaceSelection('<a href="'.concat(tr,'" target="_blank">').concat(kr,"</a>")),G.focus();case xt:for(var Zr=Kt.row,Ln=Kt.col,Pi=Kt.align,$n=`
`,Ur=0;Ur<Zr;Ur++){for(var yi=[],ai=[],Ea=0;Ea<Ln;Ea++)Ur===1&&ai.push(Ft[Pi]),yi.push(" ");Ur===1&&($n+="| ".concat(ai.join(" | "),` |
`)),$n+="| ".concat(yi.join(Ln===1?"":" | "),` |
`)}return G.replaceSelection($n+`
`),G.focus();default:throw new Error}},[G,En]),_i=Object(c.useMemo)(function(){switch(En){case it:return f.a.createElement(ge,{callback:hi,onCancel:Nr});case Et:return f.a.createElement(Oe.b,{callback:hi,onCancel:Nr});case Dt:return f.a.createElement(oe,{callback:hi,onCancel:Nr});case xt:return f.a.createElement(et,{callback:hi,onCancel:Nr});default:return null}},[En]);function Nr(){Fn("")}Object(c.useEffect)(function(){if(ri.current){var Kt=ri.current,en=!1,tn=0;function An(In){en=!0,tn=In.pageY}function Wn(){en=!1}function tr(In){if(en){var kr=In.pageY-tn;kr<0&&(kr=0),kr>300&&(kr=300);var Zr=$e+kr+"px";_r(Zr)}}return Kt.addEventListener("mousedown",An),document.addEventListener("mousemove",tr),document.addEventListener("mouseup",Wn),function(){Kt.removeEventListener("mousedown",An),document.removeEventListener("mousemove",tr),document.removeEventListener("mouseup",Wn)}}},[G,ri]),Object(c.useEffect)(function(){_r($e)},[$e]);var Gi=be($t),mr=be(hr),Vn={width:Gi,height:mr},Ar=Object(c.useMemo)(function(){if(Qr){var Kt=new Date(Qr),en=Kt.getHours(),tn=Kt.getMinutes(),An=Kt.getSeconds();return en=en<10?"0"+en:en,tn=tn<10?"0"+tn:tn,An=An<10?"0"+An:An,"".concat(en,":").concat(tn,":").concat(An)}return 0},[Qr]);function Tr(){window.sessionStorage.removeItem(mt),rr(!1),ni(0)}function ii(){rr(!1),ni(0),G.setValue(window.sessionStorage.getItem(mt))}function Rr(Kt,en){var tn=G.getValue();tn=tn.replace(Kt,en),Ct(tn),G==null||G.setValue(tn)}return f.a.createElement(c.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:Yn},f.a.createElement("div",{className:"markdown-editor-container ".concat(vt," ").concat(Qt?"on-preview":""," ").concat(ze?"mini":""," ").concat(At?"full-screen":""),style:Vn},f.a.createElement(w,{insertTemp:an,watch:Qt,fullScreen:At,showNullButton:Tt,onActionCallback:ci,hidetoolBar:Pn,uuid:jn.current,setOpenPhones:function(){fr.current=!0}}),f.a.createElement("div",{className:"markdown-editor-body"},f.a.createElement("div",{className:"codemirror-container"},f.a.createElement("textarea",{ref:pr,placeholder:qt})),Qt?f.a.createElement("div",{ref:vr,className:"preview-container"},kt==="stex"&&f.a.createElement(L,{value:Ye}),kt!=="stex"&&f.a.createElement(v.a,{edit:!0,value:Ye,replaces:Rr})):null))),un?f.a.createElement("a",{ref:ri,className:"editor-resize"}):null,f.a.createElement(b.a,null,Ee[En]?f.a.createElement(Y.a,{centered:!0,title:Ee[En],visible:!0,onCancel:Nr,footer:null},_i):null))}},QDVR:function(Wt,Me,$){"use strict";$.d(Me,"e",function(){return Y}),$.d(Me,"d",function(){return M}),$.d(Me,"c",function(){return j}),$.d(Me,"b",function(){return N}),$.d(Me,"a",function(){return R});var ie=function(){var c=function(f,_){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var y in m)m.hasOwnProperty(y)&&(p[y]=m[y])},c(f,_)};return function(f,_){c(f,_);function p(){this.constructor=f}f.prototype=_===null?Object.create(_):(p.prototype=_.prototype,new p)}}();function Y(c){var f=[];return c.forEach(function(_){return f.push(_)}),f}function M(c){var f=[];return c.forEach(function(_,p){return f.push(p)}),f}var H=function(){function c(){this._value="",this._pos=0}return c.prototype.reset=function(f){return this._value=f,this._pos=0,this},c.prototype.next=function(){return this._pos+=1,this},c.prototype.hasNext=function(){return this._pos<this._value.length-1},c.prototype.cmp=function(f){var _=f.charCodeAt(0),p=this._value.charCodeAt(this._pos);return _-p},c.prototype.value=function(){return this._value[this._pos]},c}(),O=function(){function c(f){f===void 0&&(f=!0),this._splitOnBackslash=f}return c.prototype.reset=function(f){return this._value=f.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},c.prototype.hasNext=function(){return this._to<this._value.length},c.prototype.next=function(){this._from=this._to;for(var f=!0;this._to<this._value.length;this._to++){var _=this._value.charCodeAt(this._to);if(_===47||this._splitOnBackslash&&_===92)if(f)this._from++;else break;else f=!1}return this},c.prototype.cmp=function(f){for(var _=0,p=f.length,m=this._from;_<p&&m<this._to;){var y=f.charCodeAt(_)-this._value.charCodeAt(m);if(y!==0)return y;_+=1,m+=1}return p===this._to-this._from?0:_<p?-1:1},c.prototype.value=function(){return this._value.substring(this._from,this._to)},c}(),I=function(){function c(){}return c}(),j=function(){function c(f){this._iter=f}return c.forPaths=function(){return new c(new O)},c.forStrings=function(){return new c(new H)},c.prototype.clear=function(){this._root=void 0},c.prototype.set=function(f,_){var p=this._iter.reset(f),m;for(this._root||(this._root=new I,this._root.segment=p.value()),m=this._root;;){var y=p.cmp(m.segment);if(y>0)m.left||(m.left=new I,m.left.segment=p.value()),m=m.left;else if(y<0)m.right||(m.right=new I,m.right.segment=p.value()),m=m.right;else if(p.hasNext())p.next(),m.mid||(m.mid=new I,m.mid.segment=p.value()),m=m.mid;else break}var a=m.value;return m.value=_,m.key=f,a},c.prototype.get=function(f){for(var _=this._iter.reset(f),p=this._root;p;){var m=_.cmp(p.segment);if(m>0)p=p.left;else if(m<0)p=p.right;else if(_.hasNext())_.next(),p=p.mid;else break}return p?p.value:void 0},c.prototype.findSubstr=function(f){for(var _=this._iter.reset(f),p=this._root,m=void 0;p;){var y=_.cmp(p.segment);if(y>0)p=p.left;else if(y<0)p=p.right;else if(_.hasNext())_.next(),m=p.value||m,p=p.mid;else break}return p&&p.value||m},c.prototype.forEach=function(f){this._forEach(this._root,f)},c.prototype._forEach=function(f,_){f&&(this._forEach(f.left,_),f.value&&_(f.value,f.key),this._forEach(f.mid,_),this._forEach(f.right,_))},c}(),N=function(){function c(){this.map=new Map,this.ignoreCase=!1}return c.prototype.set=function(f,_){this.map.set(this.toKey(f),_)},c.prototype.get=function(f){return this.map.get(this.toKey(f))},c.prototype.toKey=function(f){var _=f.toString();return this.ignoreCase&&(_=_.toLowerCase()),_},c}(),P=function(){function c(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return c.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(c.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),c.prototype.get=function(f,_){_===void 0&&(_=0);var p=this._map.get(f);return p?(_!==0&&this.touch(p,_),p.value):void 0},c.prototype.set=function(f,_,p){p===void 0&&(p=0);var m=this._map.get(f);if(m)m.value=_,p!==0&&this.touch(m,p);else{m={key:f,value:_,next:void 0,previous:void 0};switch(p){case 0:this.addItemLast(m);break;case 1:this.addItemFirst(m);break;case 2:this.addItemLast(m);break;default:this.addItemLast(m);break}this._map.set(f,m),this._size++}},c.prototype.delete=function(f){return!!this.remove(f)},c.prototype.remove=function(f){var _=this._map.get(f);return _?(this._map.delete(f),this.removeItem(_),this._size--,_.value):void 0},c.prototype.forEach=function(f,_){for(var p=this._head;p;)_?f.bind(_)(p.value,p.key,this):f(p.value,p.key,this),p=p.next},c.prototype.trimOld=function(f){if(f>=this.size)return;if(f===0){this.clear();return}for(var _=this._head,p=this.size;_&&p>f;)this._map.delete(_.key),_=_.next,p--;this._head=_,this._size=p,_&&(_.previous=void 0)},c.prototype.addItemFirst=function(f){if(!this._head&&!this._tail)this._tail=f;else if(this._head)f.next=this._head,this._head.previous=f;else throw new Error("Invalid list");this._head=f},c.prototype.addItemLast=function(f){if(!this._head&&!this._tail)this._head=f;else if(this._tail)f.previous=this._tail,this._tail.next=f;else throw new Error("Invalid list");this._tail=f},c.prototype.removeItem=function(f){if(f===this._head&&f===this._tail)this._head=void 0,this._tail=void 0;else if(f===this._head){if(!f.next)throw new Error("Invalid list");f.next.previous=void 0,this._head=f.next}else if(f===this._tail){if(!f.previous)throw new Error("Invalid list");f.previous.next=void 0,this._tail=f.previous}else{var _=f.next,p=f.previous;if(!_||!p)throw new Error("Invalid list");_.previous=p,p.next=_}f.next=void 0,f.previous=void 0},c.prototype.touch=function(f,_){if(!this._head||!this._tail)throw new Error("Invalid list");if(_!==1&&_!==2)return;if(_===1){if(f===this._head)return;var p=f.next,m=f.previous;f===this._tail?(m.next=void 0,this._tail=m):(p.previous=m,m.next=p),f.previous=void 0,f.next=this._head,this._head.previous=f,this._head=f}else if(_===2){if(f===this._tail)return;var p=f.next,m=f.previous;f===this._head?(p.previous=void 0,this._head=p):(p.previous=m,m.next=p),f.next=void 0,f.previous=this._tail,this._tail.next=f,this._tail=f}},c.prototype.toJSON=function(){var f=[];return this.forEach(function(_,p){f.push([p,_])}),f},c}(),R=function(c){ie(f,c);function f(_,p){p===void 0&&(p=1);var m=c.call(this)||this;return m._limit=_,m._ratio=Math.min(Math.max(0,p),1),m}return f.prototype.get=function(_){return c.prototype.get.call(this,_,2)},f.prototype.peek=function(_){return c.prototype.get.call(this,_,0)},f.prototype.set=function(_,p){c.prototype.set.call(this,_,p,2),this.checkTrim()},f.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},f}(P)},SJMd:function(Wt,Me){/**
* @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 $,ie,Y,M=!1,H,O;window.PR_SHOULD_USE_CONTINUATION=!0;var I,j;(function(){var N=window,P=["break,continue,do,else,for,if,return,while"],R=[P,"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"],c=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],f=[c,"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"],_=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[c,"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"],m="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",y=[c,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",i=[P,"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=[P,"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"],l=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[f,p,_,y,a,i,o,l],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",L="kwd",A="com",T="typ",x="lit",h="pun",u="pln",D="tag",S="dec",w="src",b="atn",K="atv",X="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function V(he){for(var Le=0,Ve=!1,et=!1,tt=0,rt=he.length;tt<rt;++tt){var it=he[tt];if(it.ignoreCase)et=!0;else if(/[a-z]/i.test(it.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ve=!0,et=!1;break}}var Dt={b:8,t:9,n:10,v:11,f:12,r:13};function Et(Pt){var We=Pt.charCodeAt(0);if(We!==92)return We;var gt=Pt.charAt(1);return We=Dt[gt],We||("0"<=gt&&gt<="7"?parseInt(Pt.substring(1),8):gt==="u"||gt==="x"?parseInt(Pt.substring(2),16):Pt.charCodeAt(1))}function xt(Pt){if(Pt<32)return(Pt<16?"\\x0":"\\x")+Pt.toString(16);var We=String.fromCharCode(Pt);return We==="\\"||We==="-"||We==="]"||We==="^"?"\\"+We:We}function ct(Pt){var We=Pt.substring(1,Pt.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")),gt=[],Ut=We[0]==="^",Qe=["["];Ut&&Qe.push("^");for(var ot=Ut?1:0,Ae=We.length;ot<Ae;++ot){var be=We[ot];if(/\\[bdsw]/i.test(be))Qe.push(be);else{var Se=Et(be),re;ot+2<Ae&&We[ot+1]==="-"?(re=Et(We[ot+2]),ot+=2):re=Se,gt.push([Se,re]),re<65||Se>122||(re<65||Se>90||gt.push([Math.max(65,Se)|32,Math.min(re,90)|32]),re<97||Se>122||gt.push([Math.max(97,Se)&~32,Math.min(re,122)&~32]))}}gt.sort(function(je,Te){return je[0]-Te[0]||Te[1]-je[1]});for(var ae=[],fe=[],ot=0;ot<gt.length;++ot){var Ee=gt[ot];Ee[0]<=fe[1]+1?fe[1]=Math.max(fe[1],Ee[1]):ae.push(fe=Ee)}for(var ot=0;ot<ae.length;++ot){var Ee=ae[ot];Qe.push(xt(Ee[0])),Ee[1]>Ee[0]&&(Ee[1]+1>Ee[0]&&Qe.push("-"),Qe.push(xt(Ee[1])))}return Qe.push("]"),Qe.join("")}function Ft(Pt){for(var We=Pt.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),gt=We.length,Ut=[],Qe=0,ot=0;Qe<gt;++Qe){var Ae=We[Qe];if(Ae==="(")++ot;else if(Ae.charAt(0)==="\\"){var be=+Ae.substring(1);be&&(be<=ot?Ut[be]=-1:We[Qe]=xt(be))}}for(var Qe=1;Qe<Ut.length;++Qe)Ut[Qe]===-1&&(Ut[Qe]=++Le);for(var Qe=0,ot=0;Qe<gt;++Qe){var Ae=We[Qe];if(Ae==="(")++ot,Ut[ot]||(We[Qe]="(?:");else if(Ae.charAt(0)==="\\"){var be=+Ae.substring(1);be&&be<=ot&&(We[Qe]="\\"+Ut[be])}}for(var Qe=0;Qe<gt;++Qe)We[Qe]==="^"&&We[Qe+1]!=="^"&&(We[Qe]="");if(Pt.ignoreCase&&Ve)for(var Qe=0;Qe<gt;++Qe){var Ae=We[Qe],Se=Ae.charAt(0);Ae.length>=2&&Se==="["?We[Qe]=ct(Ae):Se!=="\\"&&(We[Qe]=Ae.replace(/[a-zA-Z]/g,function(fe){var Ee=fe.charCodeAt(0);return"["+String.fromCharCode(Ee&~32,Ee|32)+"]"}))}return We.join("")}for(var wt=[],tt=0,rt=he.length;tt<rt;++tt){var it=he[tt];if(it.global||it.multiline)throw new Error(""+it);wt.push("(?:"+Ft(it)+")")}return new RegExp(wt.join("|"),et?"gi":"g")}function W(he,Le){var Ve=/(?:^|\s)nocode(?:\s|$)/,et=[],tt=0,rt=[],it=0;function Dt(Et){var xt=Et.nodeType;if(xt==1){if(Ve.test(Et.className))return;for(var ct=Et.firstChild;ct;ct=ct.nextSibling)Dt(ct);var Ft=Et.nodeName.toLowerCase();(Ft==="br"||Ft==="li")&&(et[it]=`
`,rt[it<<1]=tt++,rt[it++<<1|1]=Et)}else if(xt==3||xt==4){var wt=Et.nodeValue;wt.length&&(Le?wt=wt.replace(/\r\n?/g,`
`):wt=wt.replace(/[ \t\r\n]+/g," "),et[it]=wt,rt[it<<1]=tt,tt+=wt.length,rt[it++<<1|1]=Et)}}return Dt(he),{sourceCode:et.join("").replace(/\n$/,""),spans:rt}}function te(he,Le,Ve,et,tt){if(!Ve)return;var rt={sourceNode:he,pre:1,langExtension:null,numberLines:null,sourceCode:Ve,spans:null,basePos:Le,decorations:null};et(rt),tt.push.apply(tt,rt.decorations)}var ue=/\S/;function ge(he){for(var Le=void 0,Ve=he.firstChild;Ve;Ve=Ve.nextSibling){var et=Ve.nodeType;Le=et===1?Le?he:Ve:et===3&&ue.test(Ve.nodeValue)?he:Le}return Le===he?void 0:Le}function Oe(he,Le){var Ve={},et;(function(){for(var it=he.concat(Le),Dt=[],Et={},xt=0,ct=it.length;xt<ct;++xt){var Ft=it[xt],wt=Ft[3];if(wt)for(var Pt=wt.length;--Pt>=0;)Ve[wt.charAt(Pt)]=Ft;var We=Ft[1],gt=""+We;Et.hasOwnProperty(gt)||(Dt.push(We),Et[gt]=null)}Dt.push(/[\0-\uffff]/),et=V(Dt)})();var tt=Le.length,rt=function(it){for(var Dt=it.sourceCode,Et=it.basePos,xt=it.sourceNode,ct=[Et,u],Ft=0,wt=Dt.match(et)||[],Pt={},We=0,gt=wt.length;We<gt;++We){var Ut=wt[We],Qe=Pt[Ut],ot=void 0,Ae;if(typeof Qe=="string")Ae=!1;else{var be=Ve[Ut.charAt(0)];if(be)ot=Ut.match(be[1]),Qe=be[0];else{for(var Se=0;Se<tt;++Se)if(be=Le[Se],ot=Ut.match(be[1]),ot){Qe=be[0];break}ot||(Qe=u)}Ae=Qe.length>=5&&Qe.substring(0,5)==="lang-",Ae&&!(ot&&typeof ot[1]=="string")&&(Ae=!1,Qe=w),Ae||(Pt[Ut]=Qe)}var re=Ft;if(Ft+=Ut.length,!Ae)ct.push(Et+re,Qe);else{var ae=ot[1],fe=Ut.indexOf(ae),Ee=fe+ae.length;ot[2]&&(Ee=Ut.length-ot[2].length,fe=Ee-ae.length);var je=Qe.substring(5);te(xt,Et+re,Ut.substring(0,fe),rt,ct),te(xt,Et+re+fe,ae,oe(je,ae),ct),te(xt,Et+re+Ee,Ut.substring(Ee),rt,ct)}}it.decorations=ct};return rt}function qe(he){var Le=[],Ve=[];he.tripleQuotedStrings?Le.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):he.multiLineStrings?Le.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),he.verbatimStrings&&Ve.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var et=he.hashComments;et&&(he.cStyleComments?(et>1?Le.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ve.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([A,/^#[^\r\n]*/,null,"#"])),he.cStyleComments&&(Ve.push([A,/^\/\/[^\r\n]*/,null]),Ve.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var tt=he.regexLiterals;if(tt){var rt=tt>1?"":`
\r`,it=rt?".":"[\\S\\s]",Dt="/(?=[^/*"+rt+"])(?:[^/\\x5B\\x5C"+rt+"]|\\x5C"+it+"|\\x5B(?:[^\\x5C\\x5D"+rt+"]|\\x5C"+it+")*(?:\\x5D|$))+/";Ve.push(["lang-regex",RegExp("^"+Q+"("+Dt+")")])}var Et=he.types;Et&&Ve.push([T,Et]);var xt=(""+he.keywords).replace(/^ | $/g,"");xt.length&&Ve.push([L,new RegExp("^(?:"+xt.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([u,/^\s+/,null,` \r
\xA0`]);var ct="^.[^\\s\\w.$@'\"`/\\\\]*";return he.regexLiterals&&(ct+="(?!s*/)"),Ve.push([x,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[x,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[h,new RegExp(ct),null]),Oe(Le,Ve)}var Ke=qe({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Be(he,Le,Ve){for(var et=/(?:^|\s)nocode(?:\s|$)/,tt=/\r\n?|\n/,rt=he.ownerDocument,it=rt.createElement("li");he.firstChild;)it.appendChild(he.firstChild);var Dt=[it];function Et(We){var gt=We.nodeType;if(gt==1&&!et.test(We.className))if(We.nodeName==="br")xt(We),We.parentNode&&We.parentNode.removeChild(We);else for(var Ut=We.firstChild;Ut;Ut=Ut.nextSibling)Et(Ut);else if((gt==3||gt==4)&&Ve){var Qe=We.nodeValue,ot=Qe.match(tt);if(ot){var Ae=Qe.substring(0,ot.index);We.nodeValue=Ae;var be=Qe.substring(ot.index+ot[0].length);if(be){var Se=We.parentNode;Se.insertBefore(rt.createTextNode(be),We.nextSibling)}xt(We),Ae||We.parentNode.removeChild(We)}}}function xt(We){for(;!We.nextSibling;)if(We=We.parentNode,!We)return;function gt(ot,Ae){var be=Ae?ot.cloneNode(!1):ot,Se=ot.parentNode;if(Se){var re=gt(Se,1),ae=ot.nextSibling;re.appendChild(be);for(var fe=ae;fe;fe=ae)ae=fe.nextSibling,re.appendChild(fe)}return be}for(var Ut=gt(We.nextSibling,0),Qe;(Qe=Ut.parentNode)&&Qe.nodeType===1;)Ut=Qe;Dt.push(Ut)}for(var ct=0;ct<Dt.length;++ct)Et(Dt[ct]);Le===(Le|0)&&Dt[0].setAttribute("value",Le);var Ft=rt.createElement("ol");Ft.className="linenums";for(var wt=Math.max(0,Le-1|0)||0,ct=0,Pt=Dt.length;ct<Pt;++ct)it=Dt[ct],it.className="L"+(ct+wt)%10,it.firstChild||it.appendChild(rt.createTextNode("\xA0")),Ft.appendChild(it);he.appendChild(Ft)}function Xe(he){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Ve=/\n/g,et=he.sourceCode,tt=et.length,rt=0,it=he.spans,Dt=it.length,Et=0,xt=he.decorations,ct=xt.length,Ft=0;xt[ct]=tt;var wt,Pt;for(Pt=wt=0;Pt<ct;)xt[Pt]!==xt[Pt+2]?(xt[wt++]=xt[Pt++],xt[wt++]=xt[Pt++]):Pt+=2;for(ct=wt,Pt=wt=0;Pt<ct;){for(var We=xt[Pt],gt=xt[Pt+1],Ut=Pt+2;Ut+2<=ct&&xt[Ut+1]===gt;)Ut+=2;xt[wt++]=We,xt[wt++]=gt,Pt=Ut}ct=xt.length=wt;var Qe=he.sourceNode,ot="";Qe&&(ot=Qe.style.display,Qe.style.display="none");try{for(var Ae=null;Et<Dt;){var be=it[Et],Se=it[Et+2]||tt,re=xt[Ft+2]||tt,Ut=Math.min(Se,re),ae=it[Et+1],fe;if(ae.nodeType!==1&&(fe=et.substring(rt,Ut))){Le&&(fe=fe.replace(Ve,"\r")),ae.nodeValue=fe;var Ee=ae.ownerDocument,je=Ee.createElement("span");je.className=xt[Ft+1];var Te=ae.parentNode;Te.replaceChild(je,ae),je.appendChild(ae),rt<Se&&(it[Et+1]=ae=Ee.createTextNode(et.substring(Ut,Se)),Te.insertBefore(ae,je.nextSibling))}rt=Ut,rt>=Se&&(Et+=2),rt>=re&&(Ft+=2)}}finally{Qe&&(Qe.style.display=ot)}}var Fe={};function xe(he,Le){for(var Ve=Le.length;--Ve>=0;){var et=Le[Ve];Fe.hasOwnProperty(et)?N.console&&console.warn("cannot override language handler %s",et):Fe[et]=he}}function oe(he,Le){return he&&Fe.hasOwnProperty(he)||(he=/^\s*</.test(Le)?"default-markup":"default-code"),Fe[he]}xe(Ke,["default-code"]),xe(Oe([],[[u,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["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"]),xe(Oe([[u,/^[\s]+/,null,` \r
`],[K,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[D,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[b,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["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"]),xe(Oe([],[[K,/^[\s\S]+/]]),["uq.val"]),xe(qe({keywords:f,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),xe(qe({keywords:"null,true,false"}),["json"]),xe(qe({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),xe(qe({keywords:_,cStyleComments:!0}),["java"]),xe(qe({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),xe(qe({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),xe(qe({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),xe(qe({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),xe(qe({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),xe(qe({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),xe(Oe([],[[v,/^[\s\S]+/]]),["regex"]);function Re(he){var Le=he.langExtension;try{var Ve=W(he.sourceNode,he.pre),et=Ve.sourceCode;he.sourceCode=et,he.spans=Ve.spans,he.basePos=0,oe(Le,et)(he),Xe(he)}catch(tt){N.console&&console.log(tt&&tt.stack||tt)}}function dt(he,Le,Ve){var et=Ve||!1,tt=Le||null,rt=document.createElement("div");rt.innerHTML="<pre>"+he+"</pre>",rt=rt.firstChild,et&&Be(rt,et,!0);var it={langExtension:tt,numberLines:et,sourceNode:rt,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Re(it),rt.innerHTML}function at(he,Le){var Ve=Le||document.body,et=Ve.ownerDocument||document;function tt(be){return Ve.getElementsByTagName(be)}for(var rt=[tt("pre"),tt("code"),tt("xmp")],it=[],Dt=0;Dt<rt.length;++Dt)for(var Et=0,xt=rt[Dt].length;Et<xt;++Et)it.push(rt[Dt][Et]);rt=null;var ct=Date;ct.now||(ct={now:function(){return+new Date}});var Ft=0,wt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Pt=/\bprettyprint\b/,We=/\bprettyprinted\b/,gt=/pre|xmp/i,Ut=/^code$/i,Qe=/^(?:pre|code|xmp)$/i,ot={};function Ae(){for(var be=N.PR_SHOULD_USE_CONTINUATION?ct.now()+250:Infinity;Ft<it.length&&ct.now()<be;Ft++){for(var Se=it[Ft],re=ot,ae=Se;ae=ae.previousSibling;){var fe=ae.nodeType,Ee=(fe===7||fe===8)&&ae.nodeValue;if(Ee?!/^\??prettify\b/.test(Ee):fe!==3||/\S/.test(ae.nodeValue))break;if(Ee){re={},Ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ln,Ht,an){re[Ht]=an});break}}var je=Se.className;if((re!==ot||Pt.test(je))&&!We.test(je)){for(var Te=!1,Ne=Se.parentNode;Ne;Ne=Ne.parentNode){var st=Ne.tagName;if(Qe.test(st)&&Ne.className&&Pt.test(Ne.className)){Te=!0;break}}if(!Te){Se.className+=" prettyprinted";var pt=re.lang;if(!pt){pt=je.match(wt);var St;!pt&&(St=ge(Se))&&Ut.test(St.tagName)&&(pt=St.className.match(wt)),pt&&(pt=pt[1])}var $t;if(gt.test(Se.tagName))$t=1;else{var _t=Se.currentStyle,$e=et.defaultView,bn=_t?_t.whiteSpace:$e&&$e.getComputedStyle?$e.getComputedStyle(Se,null).getPropertyValue("white-space"):0;$t=bn&&bn.substring(0,3)==="pre"}var ze=re.linenums;(ze=ze==="true"||+ze)||(ze=je.match(/\blinenums\b(?::(\d+))?/),ze=ze?ze[1]&&ze[1].length?+ze[1]:!0:!1),ze&&Be(Se,ze,$t);var vn={langExtension:pt,sourceNode:Se,numberLines:ze,pre:$t,sourceCode:null,basePos:null,spans:null,decorations:null};Re(vn)}}}Ft<it.length?N.setTimeout(Ae,250):typeof he=="function"&&he()}Ae()}var ut=N.PR={createSimpleLexer:Oe,registerLangHandler:xe,sourceDecorator:qe,PR_ATTRIB_NAME:b,PR_ATTRIB_VALUE:K,PR_COMMENT:A,PR_DECLARATION:S,PR_KEYWORD:L,PR_LITERAL:x,PR_NOCODE:X,PR_PLAIN:u,PR_PUNCTUATION:h,PR_SOURCE:w,PR_STRING:v,PR_TAG:D,PR_TYPE:T,prettyPrintOne:M?N.prettyPrintOne=dt:I=dt,prettyPrint:j=M?N.prettyPrint=at:j=at},ce=N.define;typeof ce=="function"&&ce.amd&&ce("google-code-prettify",[],function(){return ut})})()},T8No:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return H}),$.d(Me,"b",function(){return _}),$.d(Me,"d",function(){return p}),$.d(Me,"c",function(){return m}),$.d(Me,"e",function(){return y});var ie=$("N0LK"),Y=$("Cg/j"),M=function(){var a=function(i,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,C){l.__proto__=C}||function(l,C){for(var g in C)C.hasOwnProperty(g)&&(l[g]=C[g])},a(i,o)};return function(i,o){a(i,o);function l(){this.constructor=i}i.prototype=o===null?Object.create(o):(l.prototype=o.prototype,new l)}}(),H=function(){function a(){}return a.has=function(i){return I.create(i)},a.equals=function(i,o){return j.create(i,o)},a.regex=function(i,o){return R.create(i,o)},a.not=function(i){return P.create(i)},a.and=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return f.create(i)},a.or=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return _.create(i)},a.deserialize=function(i,o){return o===void 0&&(o=!1),i?this._deserializeOrExpression(i,o):void 0},a._deserializeOrExpression=function(i,o){var l=this,C=i.split("||");return _.create(C.map(function(g){return l._deserializeAndExpression(g,o)}))},a._deserializeAndExpression=function(i,o){var l=this,C=i.split("&&");return f.create(C.map(function(g){return l._deserializeOne(g,o)}))},a._deserializeOne=function(i,o){if(i=i.trim(),i.indexOf("!=")>=0){var l=i.split("!=");return N.create(l[0].trim(),this._deserializeValue(l[1],o))}if(i.indexOf("==")>=0){var l=i.split("==");return j.create(l[0].trim(),this._deserializeValue(l[1],o))}if(i.indexOf("=~")>=0){var l=i.split("=~");return R.create(l[0].trim(),this._deserializeRegexValue(l[1],o))}return/^\!\s*/.test(i)?P.create(i.substr(1).trim()):I.create(i)},a._deserializeValue=function(i,o){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},a._deserializeRegexValue=function(i,o){if(Object(ie.x)(i)){if(o)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),C=i.lastIndexOf("/");if(l===C||l<0){if(o)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var g=i.slice(l+1,C),v=i[C+1]==="i"?"i":"";try{return new RegExp(g,v)}catch(L){if(o)throw new Error("bad regexp-value '"+i+"', parse error: "+L);return console.warn("bad regexp-value '"+i+"', parse error: "+L),null}},a}();function O(a,i){var o=a.getType(),l=i.getType();if(o!==l)return o-l;switch(o){case 1:return a.cmp(i);case 2:return a.cmp(i);case 3:return a.cmp(i);case 4:return a.cmp(i);case 6:return a.cmp(i);case 7:return a.cmp(i);case 5:return a.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var I=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 1},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return P.create(this.key)},a}(),j=function(){function a(i,o){this.key=i,this.value=o}return a.create=function(i,o){return typeof o=="boolean"?o?I.create(i):P.create(i):new a(i,o)},a.prototype.getType=function(){return 3},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return N.create(this.key,this.value)},a}(),N=function(){function a(i,o){this.key=i,this.value=o}return a.create=function(i,o){return typeof o=="boolean"?o?P.create(i):I.create(i):new a(i,o)},a.prototype.getType=function(){return 4},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return j.create(this.key,this.value)},a}(),P=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 2},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return I.create(this.key)},a}(),R=function(){function a(i,o){this.key=i,this.regexp=o}return a.create=function(i,o){return new a(i,o)},a.prototype.getType=function(){return 6},a.prototype.cmp=function(i){if(this.key<i.key)return-1;if(this.key>i.key)return 1;var o=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return o<l?-1:o>l?1:0},a.prototype.equals=function(i){if(i instanceof a){var o=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&o===l}return!1},a.prototype.evaluate=function(i){var o=i.getValue(this.key);return this.regexp?this.regexp.test(o):!1},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return c.create(this)},a}(),c=function(){function a(i){this._actual=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 7},a.prototype.cmp=function(i){return this._actual.cmp(i._actual)},a.prototype.equals=function(i){return i instanceof a?this._actual.equals(i._actual):!1},a.prototype.evaluate=function(i){return!this._actual.evaluate(i)},a.prototype.keys=function(){return this._actual.keys()},a.prototype.negate=function(){return this._actual},a}(),f=function(){function a(i){this.expr=i}return a.create=function(i){var o=a._normalizeArr(i);return o.length===0?void 0:o.length===1?o[0]:new a(o)},a.prototype.getType=function(){return 5},a.prototype.cmp=function(i){if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(var o=0,l=this.expr.length;o<l;o++){var C=O(this.expr[o],i.expr[o]);if(C!==0)return C}return 0},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var o=0,l=this.expr.length;o<l;o++)if(!this.expr[o].equals(i.expr[o]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var o=0,l=this.expr.length;o<l;o++)if(!this.expr[o].evaluate(i))return!1;return!0},a._normalizeArr=function(i){var o=[];if(i){for(var l=0,C=i.length;l<C;l++){var g=i[l];if(!g)continue;if(g instanceof a){o=o.concat(g.expr);continue}if(g instanceof _)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');o.push(g)}o.sort(O)}return o},a.prototype.keys=function(){for(var i=[],o=0,l=this.expr;o<l.length;o++){var C=l[o];i.push.apply(i,C.keys())}return i},a.prototype.negate=function(){for(var i=[],o=0,l=this.expr;o<l.length;o++){var C=l[o];i.push(C.negate())}return _.create(i)},a}(),_=function(){function a(i){this.expr=i}return a.create=function(i){var o=a._normalizeArr(i);return o.length===0?void 0:o.length===1?o[0]:new a(o)},a.prototype.getType=function(){return 8},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var o=0,l=this.expr.length;o<l;o++)if(!this.expr[o].equals(i.expr[o]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var o=0,l=this.expr.length;o<l;o++)if(this.expr[o].evaluate(i))return!0;return!1},a._normalizeArr=function(i){var o=[];if(i){for(var l=0,C=i.length;l<C;l++){var g=i[l];if(!g)continue;if(g instanceof a){o=o.concat(g.expr);continue}o.push(g)}o.sort(O)}return o},a.prototype.keys=function(){for(var i=[],o=0,l=this.expr;o<l.length;o++){var C=l[o];i.push.apply(i,C.keys())}return i},a.prototype.negate=function(){for(var i=[],o=0,l=this.expr;o<l.length;o++){var C=l[o];i.push(C.negate())}for(var g=function(w){return w instanceof a?w.expr:[w]};i.length>1;){for(var v=i.shift(),L=i.shift(),A=[],T=0,x=g(v);T<x.length;T++)for(var h=x[T],u=0,D=g(L);u<D.length;u++){var S=D[u];A.push(H.and(h,S))}i.unshift(H.or.apply(H,A))}return i[0]},a}(),p=function(a){M(i,a);function i(o,l){var C=a.call(this,o)||this;return C._defaultValue=l,C}return i.prototype.bindTo=function(o){return o.createKey(this.key,this._defaultValue)},i.prototype.getValue=function(o){return o.getContextKeyValue(this.key)},i.prototype.toNegated=function(){return H.not(this.key)},i}(I),m=Object(Y.c)("contextKeyService"),y="setContext"},UU91:function(Wt,Me,$){Wt.exports={flex_box_center:"flex_box_center___W-luD",flex_space_between:"flex_space_between___MDZOl",flex_box_vertical_center:"flex_box_vertical_center___GF3w8",flex_box_center_end:"flex_box_center_end___UZLKo",flex_box_column:"flex_box_column___26ZEG",bg:"bg___Lrg3h",containerTitle:"containerTitle___36aFc",containerDesc:"containerDesc___1ITIo",listItem:"listItem___3yIgk",info:"info___1J349",title:"title___1poFp",titleLeft:"titleLeft___1G4yJ",titleRight:"titleRight___3ZAtk",acitons:"acitons___rsUze",export:"export___23Ina"}},"VrN/":function(Wt,Me,$){(function(ie,Y){Wt.exports=Y()})(this,function(){"use strict";var ie=navigator.userAgent,Y=navigator.platform,M=/gecko\/\d/i.test(ie),H=/MSIE \d/.test(ie),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ie),I=/Edge\/(\d+)/.exec(ie),j=H||O||I,N=j&&(H?document.documentMode||6:+(I||O)[1]),P=!I&&/WebKit\//.test(ie),R=P&&/Qt\/\d+\.\d+/.test(ie),c=!I&&/Chrome\//.test(ie),f=/Opera\//.test(ie),_=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ie),m=/PhantomJS/.test(ie),y=!I&&/AppleWebKit/.test(ie)&&/Mobile\/\w+/.test(ie),a=/Android/.test(ie),i=y||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ie),o=y||/Mac/.test(Y),l=/\bCrOS\b/.test(ie),C=/win/i.test(Y),g=f&&ie.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(f=!1,P=!0);var v=o&&(R||f&&(g==null||g<12.11)),L=M||j&&N>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var r=e.className,n=A(t).exec(r);if(n){var s=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(s?n[1]+s:"")}};function x(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return x(e).appendChild(t)}function u(e,t,r,n){var s=document.createElement(e);if(r&&(s.className=r),n&&(s.style.cssText=n),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)s.appendChild(t[k]);return s}function D(e,t,r,n){var s=u(e,t,r,n);return s.setAttribute("role","presentation"),s}var S;document.createRange?S=function(e,t,r,n){var s=document.createRange();return s.setEnd(n||e,r),s.setStart(e,t),s}:S=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(s){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function w(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 b(){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 K(e,t){var r=e.className;A(t).test(r)||(e.className+=(r?" ":"")+t)}function X(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!A(r[n]).test(t)&&(t+=" "+r[n]);return t}var Q=function(e){e.select()};y?Q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(Q=function(e){try{e.select()}catch(t){}});function V(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function W(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function te(e,t,r,n,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=n||0,z=s||0;;){var J=e.indexOf(" ",k);if(J<0||J>=t)return z+(t-k);z+=J-k,z+=r-z%r,k=J+1}}var ue=function(){this.id=null,this.f=null,this.time=0,this.handler=V(this.onTimeout,this)};ue.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ue.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 ge(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var Oe=50,qe={toString:function(){return"CodeMirror.Pass"}},Ke={scroll:!1},Be={origin:"*mouse"},Xe={origin:"+move"};function Fe(e,t,r){for(var n=0,s=0;;){var k=e.indexOf(" ",n);k==-1&&(k=e.length);var z=k-n;if(k==e.length||s+z>=t)return n+Math.min(z,t-s);if(s+=k-n,s+=r-s%r,n=k+1,s>=t)return n}}var xe=[""];function oe(e){for(;xe.length<=e;)xe.push(Re(xe)+" ");return xe[e]}function Re(e){return e[e.length-1]}function dt(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function at(e,t,r){for(var n=0,s=r(t);n<e.length&&r(e[n])<=s;)n++;e.splice(n,0,t)}function ut(){}function ce(e,t){var r;return Object.create?r=Object.create(e):(ut.prototype=e,r=new ut),t&&W(t,r),r}var he=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Le(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||he.test(e))}function Ve(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function et(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var tt=/[\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 rt(e){return e.charCodeAt(0)>=768&&tt.test(e)}function it(e,t,r){for(;(r<0?t>0:t<e.length)&&rt(e.charAt(t));)t+=r;return t}function Dt(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var s=(t+r)/2,k=n<0?Math.ceil(s):Math.floor(s);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+n}}function Et(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var s=!1,k=0;k<e.length;++k){var z=e[k];(z.from<r&&z.to>t||t==r&&z.to==t)&&(n(Math.max(z.from,t),Math.min(z.to,r),z.level==1?"rtl":"ltr",k),s=!0)}s||n(t,r,"ltr")}var xt=null;function ct(e,t,r){var n;xt=null;for(var s=0;s<e.length;++s){var k=e[s];if(k.from<t&&k.to>t)return s;k.to==t&&(k.from!=k.to&&r=="before"?n=s:xt=s),k.from==t&&(k.from!=k.to&&r!="before"?n=s:xt=s)}return n!=null?n:xt}var Ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,k=/[LRr]/,z=/[Lb1n]/,J=/[1n]/;function Z(ee,me,Ce){this.level=ee,this.from=me,this.to=Ce}return function(ee,me){var Ce=me=="ltr"?"L":"R";if(ee.length==0||me=="ltr"&&!n.test(ee))return!1;for(var Ue=ee.length,Pe=[],nt=0;nt<Ue;++nt)Pe.push(r(ee.charCodeAt(nt)));for(var lt=0,bt=Ce;lt<Ue;++lt){var Lt=Pe[lt];Lt=="m"?Pe[lt]=bt:bt=Lt}for(var jt=0,Rt=Ce;jt<Ue;++jt){var Vt=Pe[jt];Vt=="1"&&Rt=="r"?Pe[jt]="n":k.test(Vt)&&(Rt=Vt,Vt=="r"&&(Pe[jt]="R"))}for(var fn=1,rn=Pe[0];fn<Ue-1;++fn){var On=Pe[fn];On=="+"&&rn=="1"&&Pe[fn+1]=="1"?Pe[fn]="1":On==","&&rn==Pe[fn+1]&&(rn=="1"||rn=="n")&&(Pe[fn]=rn),rn=On}for(var cr=0;cr<Ue;++cr){var Xr=Pe[cr];if(Xr==",")Pe[cr]="N";else if(Xr=="%"){var wr=void 0;for(wr=cr+1;wr<Ue&&Pe[wr]=="%";++wr);for(var bi=cr&&Pe[cr-1]=="!"||wr<Ue&&Pe[wr]=="1"?"1":"N",pi=cr;pi<wr;++pi)Pe[pi]=bi;cr=wr-1}}for(var Br=0,mi=Ce;Br<Ue;++Br){var Jr=Pe[Br];mi=="L"&&Jr=="1"?Pe[Br]="L":k.test(Jr)&&(mi=Jr)}for(var Vr=0;Vr<Ue;++Vr)if(s.test(Pe[Vr])){var Fr=void 0;for(Fr=Vr+1;Fr<Ue&&s.test(Pe[Fr]);++Fr);for(var Lr=(Vr?Pe[Vr-1]:Ce)=="L",vi=(Fr<Ue?Pe[Fr]:Ce)=="L",Fa=Lr==vi?Lr?"L":"R":Ce,ca=Vr;ca<Fr;++ca)Pe[ca]=Fa;Vr=Fr-1}for(var ti=[],Hi,Yr=0;Yr<Ue;)if(z.test(Pe[Yr])){var ps=Yr;for(++Yr;Yr<Ue&&z.test(Pe[Yr]);++Yr);ti.push(new Z(0,ps,Yr))}else{var Zi=Yr,ya=ti.length,ba=me=="rtl"?1:0;for(++Yr;Yr<Ue&&Pe[Yr]!="L";++Yr);for(var di=Zi;di<Yr;)if(J.test(Pe[di])){Zi<di&&(ti.splice(ya,0,new Z(1,Zi,di)),ya+=ba);var ja=di;for(++di;di<Yr&&J.test(Pe[di]);++di);ti.splice(ya,0,new Z(2,ja,di)),ya+=ba,Zi=di}else++di;Zi<Yr&&ti.splice(ya,0,new Z(1,Zi,Yr))}return me=="ltr"&&(ti[0].level==1&&(Hi=ee.match(/^\s+/))&&(ti[0].from=Hi[0].length,ti.unshift(new Z(0,0,Hi[0].length))),Re(ti).level==1&&(Hi=ee.match(/\s+$/))&&(Re(ti).to-=Hi[0].length,ti.push(new Z(0,Ue-Hi[0].length,Ue)))),me=="rtl"?ti.reverse():ti}}();function wt(e,t){var r=e.order;return r==null&&(r=e.order=Ft(e.text,t)),r}var Pt=[],We=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Pt).concat(r)}};function gt(e,t){return e._handlers&&e._handlers[t]||Pt}function Ut(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,s=n&&n[t];if(s){var k=ge(s,r);k>-1&&(n[t]=s.slice(0,k).concat(s.slice(k+1)))}}}function Qe(e,t){var r=gt(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),s=0;s<r.length;++s)r[s].apply(null,n)}function ot(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Qe(e,r||t.type,e,t),fe(t)||t.codemirrorIgnore}function Ae(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)ge(r,t[n])==-1&&r.push(t[n])}function be(e,t){return gt(e,t).length>0}function Se(e){e.prototype.on=function(t,r){We(this,t,r)},e.prototype.off=function(t,r){Ut(this,t,r)}}function re(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 Ee(e){re(e),ae(e)}function je(e){return e.target||e.srcElement}function Te(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(j&&N<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),st;function pt(e){if(st==null){var t=u("span","\u200B");h(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&N<8))}var r=st?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var St;function $t(e){if(St!=null)return St;var t=h(e,document.createTextNode("A\u062EA")),r=S(t,0,1).getBoundingClientRect(),n=S(t,1,2).getBoundingClientRect();return x(e),!r||r.left==r.right?!1:St=n.right-r.right<3}var _t=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var s=e.indexOf(`
`,t);s==-1&&(s=e.length);var k=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),z=k.indexOf("\r");z!=-1?(r.push(k.slice(0,z)),t+=z+1):(r.push(k),t=s+1)}return r}:function(e){return e.split(/\r\n?|\n/)},$e=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},bn=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ze=null;function vn(e){if(ze!=null)return ze;var t=h(e,u("span","x")),r=t.getBoundingClientRect(),n=S(t,0,1).getBoundingClientRect();return ze=Math.abs(r.left-n.left)>1}var ln={},Ht={};function an(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ln[e]=t}function gn(e,t){Ht[e]=t}function kt(e){if(typeof e=="string"&&Ht.hasOwnProperty(e))e=Ht[e];else if(e&&typeof e.name=="string"&&Ht.hasOwnProperty(e.name)){var t=Ht[e.name];typeof t=="string"&&(t={name:t}),e=ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Mt(e,t){t=kt(t);var r=ln[t.name];if(!r)return Mt(e,"text/plain");var n=r(e,t);if(mt.hasOwnProperty(t.name)){var s=mt[t.name];for(var k in s){if(!s.hasOwnProperty(k))continue;n.hasOwnProperty(k)&&(n["_"+k]=n[k]),n[k]=s[k]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)n[z]=t.modeProps[z];return n}var mt={};function It(e,t){var r=mt.hasOwnProperty(e)?mt[e]:mt[e]={};W(t,r)}function un(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var s=t[n];s instanceof Array&&(s=s.concat([])),r[n]=s}return r}function pn(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 Zt(e,t,r){return e.startState?e.startState(t,r):!0}var zt=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};zt.prototype.eol=function(){return this.pos>=this.string.length},zt.prototype.sol=function(){return this.pos==this.lineStart},zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},zt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},zt.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},zt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},zt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},zt.prototype.skipToEnd=function(){this.pos=this.string.length},zt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},zt.prototype.backUp=function(e){this.pos-=e},zt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},zt.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},zt.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(z){return r?z.toLowerCase():z},s=this.string.substr(this.pos,e.length);if(n(s)==n(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)}},zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},zt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},zt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},zt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Tt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var s=r.children[n],k=s.chunkSize();if(t<k){r=s;break}t-=k}return r.lines[t]}function zn(e,t,r){var n=[],s=t.line;return e.iter(t.line,r.line+1,function(k){var z=k.text;s==r.line&&(z=z.slice(0,r.ch)),s==t.line&&(z=z.slice(t.ch)),n.push(z),++s}),n}function Pn(e,t,r){var n=[];return e.iter(t,r,function(s){n.push(s.text)}),n}function Dn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Jt(e){if(e.parent==null)return null;for(var t=e.parent,r=ge(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var s=0;!(n.children[s]==t);++s)r+=n.children[s].chunkSize();return r+t.first}function Un(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var s=e.children[n],k=s.height;if(t<k){e=s;continue e}t-=k,r+=s.chunkSize()}return r}while(!e.lines);for(var z=0;z<e.lines.length;++z){var J=e.lines[z],Z=J.height;if(t<Z)break;t-=Z}return r+z}function Qn(e,t){return t>=e.first&&t<e.first+e.size}function Gn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Je(e,t,r){if(r===void 0&&(r=null),!(this instanceof Je))return new Je(e,t,r);this.line=e,this.ch=t,this.sticky=r}function vt(e,t){return e.line-t.line||e.ch-t.ch}function Xt(e,t){return e.sticky==t.sticky&&vt(e,t)==0}function Gt(e){return Je(e.line,e.ch)}function Bt(e,t){return vt(e,t)<0?t:e}function qt(e,t){return vt(e,t)<0?e:t}function B(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function d(e,t){if(t.line<e.first)return Je(e.first,0);var r=e.first+e.size-1;return t.line>r?Je(r,Tt(e,r).text.length):E(t,Tt(e,t.line).text.length)}function E(e,t){var r=e.ch;return r==null||r>t?Je(e.line,t):r<0?Je(e.line,0):e}function F(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=d(e,t[n]);return r}var G=function(e,t){this.state=e,this.lookAhead=t},U=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};U.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},U.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}},U.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},U.fromSaved=function(e,t,r){return t instanceof G?new U(e,un(e.mode,t.state),r,t.lookAhead):new U(e,un(e.mode,t),r)},U.prototype.save=function(e){var t=e!==!1?un(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new G(t,this.maxLookAhead):t};function se(e,t,r,n){var s=[e.state.modeGen],k={};mn(e,t.text,e.doc.mode,r,function(ee,me){return s.push(ee,me)},k,n);for(var z=r.state,J=function(ee){r.baseTokens=s;var me=e.state.overlays[ee],Ce=1,Ue=0;r.state=!0,mn(e,t.text,me.mode,r,function(Pe,nt){for(var lt=Ce;Ue<Pe;){var bt=s[Ce];bt>Pe&&s.splice(Ce,1,Pe,s[Ce+1],bt),Ce+=2,Ue=Math.min(Pe,bt)}if(!nt)return;if(me.opaque)s.splice(lt,Ce-lt,Pe,"overlay "+nt),Ce=lt+2;else for(;lt<Ce;lt+=2){var Lt=s[lt+1];s[lt+1]=(Lt?Lt+" ":"")+"overlay "+nt}},k),r.state=z,r.baseTokens=null,r.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)J(Z);return{styles:s,classes:k.bgClass||k.textClass?k:null}}function He(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ye(e,Jt(t)),s=t.text.length>e.options.maxHighlightLength&&un(e.doc.mode,n.state),k=se(e,t,n);s&&(n.state=s),t.stateAfter=n.save(!s),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 Ye(e,t,r){var n=e.doc,s=e.display;if(!n.mode.startState)return new U(n,!0,t);var k=At(e,t,r),z=k>n.first&&Tt(n,k-1).stateAfter,J=z?U.fromSaved(n,z,k):new U(n,Zt(n.mode),k);return n.iter(k,t,function(Z){Ct(e,Z.text,J);var ee=J.line;Z.stateAfter=ee==t-1||ee%5==0||ee>=s.viewFrom&&ee<s.viewTo?J.save():null,J.nextLine()}),r&&(n.modeFrontier=J.line),J}function Ct(e,t,r,n){var s=e.doc.mode,k=new zt(t,e.options.tabSize,r);for(k.start=k.pos=n||0,t==""&&Ge(s,r.state);!k.eol();)yt(s,k,r.state),k.start=k.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=pn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function yt(e,t,r,n){for(var s=0;s<10;s++){n&&(n[0]=pn(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 Qt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Bn(e,t,r,n){var s=e.doc,k=s.mode,z;t=d(s,t);var J=Tt(s,t.line),Z=Ye(e,t.line,r),ee=new zt(J.text,e.options.tabSize,Z),me;for(n&&(me=[]);(n||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,z=yt(k,ee,Z.state),n&&me.push(new Qt(ee,z,un(s.mode,Z.state)));return n?me:new Qt(ee,z,Z.state)}function er(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function mn(e,t,r,n,s,k,z){var J=r.flattenSpans;J==null&&(J=e.options.flattenSpans);var Z=0,ee=null,me=new zt(t,e.options.tabSize,n),Ce,Ue=e.options.addModeClass&&[null];for(t==""&&er(Ge(r,n.state),k);!me.eol();){if(me.pos>e.options.maxHighlightLength?(J=!1,z&&Ct(e,t,n,me.pos),me.pos=t.length,Ce=null):Ce=er(yt(r,me,n.state,Ue),k),Ue){var Pe=Ue[0].name;Pe&&(Ce="m-"+(Ce?Pe+" "+Ce:Pe))}if(!J||ee!=Ce){for(;Z<me.start;)Z=Math.min(me.start,Z+5e3),s(Z,ee);ee=Ce}me.start=me.pos}for(;Z<me.pos;){var nt=Math.min(me.pos,Z+5e3);s(nt,ee),Z=nt}}function At(e,t,r){for(var n,s,k=e.doc,z=r?-1:t-(e.doc.mode.innerMode?1e3:100),J=t;J>z;--J){if(J<=k.first)return k.first;var Z=Tt(k,J-1),ee=Z.stateAfter;if(ee&&(!r||J+(ee instanceof G?ee.lookAhead:0)<=k.modeFrontier))return J;var me=te(Z.text,null,e.options.tabSize);(s==null||n>me)&&(s=J-1,n=me)}return s}function Nt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var s=Tt(e,n).stateAfter;if(s&&(!(s instanceof G)||n+s.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var on=!1,dn=!1;function En(){on=!0}function Fn(){dn=!0}function cn(e,t,r){this.marker=e,this.from=t,this.to=r}function Er(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Qr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function ni(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function wi(e,t,r){var n;if(e)for(var s=0;s<e.length;++s){var k=e[s],z=k.marker,J=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);if(J||k.from==t&&z.type=="bookmark"&&(!r||!k.marker.insertLeft)){var Z=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);(n||(n=[])).push(new cn(z,k.from,Z?null:k.to))}}return n}function Ki(e,t,r){var n;if(e)for(var s=0;s<e.length;++s){var k=e[s],z=k.marker,J=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);if(J||k.from==t&&z.type=="bookmark"&&(!r||k.marker.insertLeft)){var Z=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);(n||(n=[])).push(new cn(z,Z?null:k.from-t,k.to==null?null:k.to-t))}}return n}function hr(e,t){if(t.full)return null;var r=Qn(e,t.from.line)&&Tt(e,t.from.line).markedSpans,n=Qn(e,t.to.line)&&Tt(e,t.to.line).markedSpans;if(!r&&!n)return null;var s=t.from.ch,k=t.to.ch,z=vt(t.from,t.to)==0,J=wi(r,s,z),Z=Ki(n,k,z),ee=t.text.length==1,me=Re(t.text).length+(ee?s:0);if(J)for(var Ce=0;Ce<J.length;++Ce){var Ue=J[Ce];if(Ue.to==null){var Pe=Er(Z,Ue.marker);Pe?ee&&(Ue.to=Pe.to==null?null:Pe.to+me):Ue.to=s}}if(Z)for(var nt=0;nt<Z.length;++nt){var lt=Z[nt];if(lt.to!=null&&(lt.to+=me),lt.from==null){var bt=Er(J,lt.marker);bt||(lt.from=me,ee&&(J||(J=[])).push(lt))}else lt.from+=me,ee&&(J||(J=[])).push(lt)}J&&(J=_r(J)),Z&&Z!=J&&(Z=_r(Z));var Lt=[J];if(!ee){var jt=t.text.length-2,Rt;if(jt>0&&J)for(var Vt=0;Vt<J.length;++Vt)J[Vt].to==null&&(Rt||(Rt=[])).push(new cn(J[Vt].marker,null,null));for(var fn=0;fn<jt;++fn)Lt.push(Rt);Lt.push(Z)}return Lt}function _r(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 gi(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Pe){if(Pe.markedSpans)for(var nt=0;nt<Pe.markedSpans.length;++nt){var lt=Pe.markedSpans[nt].marker;lt.readOnly&&(!n||ge(n,lt)==-1)&&(n||(n=[])).push(lt)}}),!n)return null;for(var s=[{from:t,to:r}],k=0;k<n.length;++k)for(var z=n[k],J=z.find(0),Z=0;Z<s.length;++Z){var ee=s[Z];if(vt(ee.to,J.from)<0||vt(ee.from,J.to)>0)continue;var me=[Z,1],Ce=vt(ee.from,J.from),Ue=vt(ee.to,J.to);(Ce<0||!z.inclusiveLeft&&!Ce)&&me.push({from:ee.from,to:J.from}),(Ue>0||!z.inclusiveRight&&!Ue)&&me.push({from:J.to,to:ee.to}),s.splice.apply(s,me),Z+=me.length-3}return s}function Oi(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 qi(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function rr(e){return e.inclusiveLeft?-1:0}function jn(e){return e.inclusiveRight?1:0}function fr(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),s=t.find(),k=vt(n.from,s.from)||rr(e)-rr(t);if(k)return-k;var z=vt(n.to,s.to)||jn(e)-jn(t);return z||t.id-e.id}function xn(e,t){var r=dn&&e.markedSpans,n;if(r)for(var s=void 0,k=0;k<r.length;++k)s=r[k],s.marker.collapsed&&(t?s.from:s.to)==null&&(!n||fr(n,s.marker)<0)&&(n=s.marker);return n}function pr(e){return xn(e,!0)}function Yn(e){return xn(e,!1)}function ri(e,t){var r=dn&&e.markedSpans,n;if(r)for(var s=0;s<r.length;++s){var k=r[s];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!n||fr(n,k.marker)<0)&&(n=k.marker)}return n}function vr(e,t,r,n,s){var k=Tt(e,t),z=dn&&k.markedSpans;if(z)for(var J=0;J<z.length;++J){var Z=z[J];if(!Z.marker.collapsed)continue;var ee=Z.marker.find(0),me=vt(ee.from,r)||rr(Z.marker)-rr(s),Ce=vt(ee.to,n)||jn(Z.marker)-jn(s);if(me>=0&&Ce<=0||me<=0&&Ce>=0)continue;if(me<=0&&(Z.marker.inclusiveRight&&s.inclusiveLeft?vt(ee.to,r)>=0:vt(ee.to,r)>0)||me>=0&&(Z.marker.inclusiveRight&&s.inclusiveLeft?vt(ee.from,n)<=0:vt(ee.from,n)<0))return!0}}function jr(e){for(var t;t=pr(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Yn(e);)e=t.find(1,!0).line;return e}function ci(e){for(var t,r;t=Yn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function hi(e,t){var r=Tt(e,t),n=jr(r);return r==n?t:Jt(n)}function _i(e,t){if(t>e.lastLine())return t;var r=Tt(e,t),n;if(!Nr(e,r))return t;for(;n=Yn(r);)r=n.find(1,!0).line;return Jt(r)+1}function Nr(e,t){var r=dn&&t.markedSpans;if(r)for(var n=void 0,s=0;s<r.length;++s){if(n=r[s],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&Gi(e,t,n))return!0}}function Gi(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return Gi(e,n.line,Er(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var s=void 0,k=0;k<t.markedSpans.length;++k)if(s=t.markedSpans[k],s.marker.collapsed&&!s.marker.widgetNode&&s.from==r.to&&(s.to==null||s.to!=r.from)&&(s.marker.inclusiveLeft||r.marker.inclusiveRight)&&Gi(e,t,s))return!0}function mr(e){e=jr(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var s=r.lines[n];if(s==e)break;t+=s.height}for(var k=r.parent;k;r=k,k=r.parent)for(var z=0;z<k.children.length;++z){var J=k.children[z];if(J==r)break;t+=J.height}return t}function Vn(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=pr(n);){var s=r.find(0,!0);n=s.from.line,t+=s.from.ch-s.to.ch}for(n=e;r=Yn(n);){var k=r.find(0,!0);t-=n.text.length-k.from.ch,n=k.to.line,t+=n.text.length-k.to.ch}return t}function Ar(e){var t=e.display,r=e.doc;t.maxLine=Tt(r,r.first),t.maxLineLength=Vn(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var s=Vn(n);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=n)})}var Tr=function(e,t,r){this.text=e,qi(this,t),this.height=r?r(this):1};Tr.prototype.lineNo=function(){return Jt(this)},Se(Tr);function ii(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oi(e),qi(e,r);var s=n?n(e):1;s!=e.height&&Dn(e,s)}function Rr(e){e.parent=null,Oi(e)}var Kt={},en={};function tn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?en:Kt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function An(e,t){var r=D("span",null,null,P?"padding-right: .1px":null),n={pre:D("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var k=s?t.rest[s-1]:t.line,z=void 0;n.pos=0,n.addToken=tr,$t(e.display.measure)&&(z=wt(k,e.doc.direction))&&(n.addToken=kr(n.addToken,z)),n.map=[];var J=t!=e.display.externalMeasured&&Jt(k);Ln(k,n,He(e,k,J)),k.styleClasses&&(k.styleClasses.bgClass&&(n.bgClass=X(k.styleClasses.bgClass,n.bgClass||"")),k.styleClasses.textClass&&(n.textClass=X(k.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(pt(e.display.measure))),s==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var Z=n.content.lastChild;(/\bcm-tab\b/.test(Z.className)||Z.querySelector&&Z.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Qe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=X(n.pre.className,n.textClass||"")),n}function Wn(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 tr(e,t,r,n,s,k,z){if(!t)return;var J=e.splitSpaces?In(t,e.trailingSpace):t,Z=e.cm.state.specialChars,ee=!1,me;if(!Z.test(t))e.col+=t.length,me=document.createTextNode(J),e.map.push(e.pos,e.pos+t.length,me),j&&N<9&&(ee=!0),e.pos+=t.length;else{me=document.createDocumentFragment();for(var Ce=0;;){Z.lastIndex=Ce;var Ue=Z.exec(t),Pe=Ue?Ue.index-Ce:t.length-Ce;if(Pe){var nt=document.createTextNode(J.slice(Ce,Ce+Pe));j&&N<9?me.appendChild(u("span",[nt])):me.appendChild(nt),e.map.push(e.pos,e.pos+Pe,nt),e.col+=Pe,e.pos+=Pe}if(!Ue)break;Ce+=Pe+1;var lt=void 0;if(Ue[0]==" "){var bt=e.cm.options.tabSize,Lt=bt-e.col%bt;lt=me.appendChild(u("span",oe(Lt),"cm-tab")),lt.setAttribute("role","presentation"),lt.setAttribute("cm-text"," "),e.col+=Lt}else Ue[0]=="\r"||Ue[0]==`
`?(lt=me.appendChild(u("span",Ue[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),lt.setAttribute("cm-text",Ue[0]),e.col+=1):(lt=e.cm.options.specialCharPlaceholder(Ue[0]),lt.setAttribute("cm-text",Ue[0]),j&&N<9?me.appendChild(u("span",[lt])):me.appendChild(lt),e.col+=1);e.map.push(e.pos,e.pos+1,lt),e.pos++}}if(e.trailingSpace=J.charCodeAt(t.length-1)==32,r||n||s||ee||k||z){var jt=r||"";n&&(jt+=n),s&&(jt+=s);var Rt=u("span",[me],jt,k);if(z)for(var Vt in z)z.hasOwnProperty(Vt)&&Vt!="style"&&Vt!="class"&&Rt.setAttribute(Vt,z[Vt]);return e.content.appendChild(Rt)}e.content.appendChild(me)}function In(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",s=0;s<e.length;s++){var k=e.charAt(s);k==" "&&r&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(k="\xA0"),n+=k,r=k==" "}return n}function kr(e,t){return function(r,n,s,k,z,J,Z){s=s?s+" cm-force-border":"cm-force-border";for(var ee=r.pos,me=ee+n.length;;){for(var Ce=void 0,Ue=0;Ue<t.length&&!(Ce=t[Ue],Ce.to>ee&&Ce.from<=ee);Ue++);if(Ce.to>=me)return e(r,n,s,k,z,J,Z);e(r,n.slice(0,Ce.to-ee),s,k,null,J,Z),k=null,n=n.slice(Ce.to-ee),ee=Ce.to}}}function Zr(e,t,r,n){var s=!n&&r.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!n&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",r.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function Ln(e,t,r){var n=e.markedSpans,s=e.text,k=0;if(!n){for(var z=1;z<r.length;z+=2)t.addToken(t,s.slice(k,k=r[z]),tn(r[z+1],t.cm.options));return}for(var J=s.length,Z=0,ee=1,me="",Ce,Ue,Pe=0,nt,lt,bt,Lt,jt;;){if(Pe==Z){nt=lt=bt=Ue="",jt=null,Lt=null,Pe=Infinity;for(var Rt=[],Vt=void 0,fn=0;fn<n.length;++fn){var rn=n[fn],On=rn.marker;if(On.type=="bookmark"&&rn.from==Z&&On.widgetNode)Rt.push(On);else if(rn.from<=Z&&(rn.to==null||rn.to>Z||On.collapsed&&rn.to==Z&&rn.from==Z)){if(rn.to!=null&&rn.to!=Z&&Pe>rn.to&&(Pe=rn.to,lt=""),On.className&&(nt+=" "+On.className),On.css&&(Ue=(Ue?Ue+";":"")+On.css),On.startStyle&&rn.from==Z&&(bt+=" "+On.startStyle),On.endStyle&&rn.to==Pe&&(Vt||(Vt=[])).push(On.endStyle,rn.to),On.title&&((jt||(jt={})).title=On.title),On.attributes)for(var cr in On.attributes)(jt||(jt={}))[cr]=On.attributes[cr];On.collapsed&&(!Lt||fr(Lt.marker,On)<0)&&(Lt=rn)}else rn.from>Z&&Pe>rn.from&&(Pe=rn.from)}if(Vt)for(var Xr=0;Xr<Vt.length;Xr+=2)Vt[Xr+1]==Pe&&(lt+=" "+Vt[Xr]);if(!Lt||Lt.from==Z)for(var wr=0;wr<Rt.length;++wr)Zr(t,0,Rt[wr]);if(Lt&&(Lt.from||0)==Z){if(Zr(t,(Lt.to==null?J+1:Lt.to)-Z,Lt.marker,Lt.from==null),Lt.to==null)return;Lt.to==Z&&(Lt=!1)}}if(Z>=J)break;for(var bi=Math.min(J,Pe);;){if(me){var pi=Z+me.length;if(!Lt){var Br=pi>bi?me.slice(0,bi-Z):me;t.addToken(t,Br,Ce?Ce+nt:nt,bt,Z+Br.length==Pe?lt:"",Ue,jt)}if(pi>=bi){me=me.slice(bi-Z),Z=bi;break}Z=pi,bt=""}me=s.slice(k,k=r[ee++]),Ce=tn(r[ee++],t.cm.options)}}}function Pi(e,t,r){this.line=t,this.rest=ci(t),this.size=this.rest?Jt(Re(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Nr(e,t)}function $n(e,t,r){for(var n=[],s,k=t;k<r;k=s){var z=new Pi(e.doc,Tt(e.doc,k),k);s=k+z.size,n.push(z)}return n}var Ur=null;function yi(e){Ur?Ur.ops.push(e):e.ownsGroup=Ur={ops:[e],delayedCallbacks:[]}}function ai(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var s=e.ops[n];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(r<t.length)}function Ea(e,t){var r=e.ownsGroup;if(!r)return;try{ai(r)}finally{Ur=null,t(r)}}var ea=null;function Or(e,t){var r=gt(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),s;Ur?s=Ur.delayedCallbacks:ea?s=ea:(s=ea=[],setTimeout(go,0));for(var k=function(J){s.push(function(){return r[J].apply(null,n)})},z=0;z<r.length;++z)k(z)}function go(){var e=ea;ea=null;for(var t=0;t<e.length;++t)e[t]()}function yo(e,t,r,n){for(var s=0;s<t.changes.length;s++){var k=t.changes[s];k=="text"?bo(e,t):k=="gutter"?Ka(e,t,r,n):k=="class"?Ha(e,t):k=="widget"&&Go(e,t,n)}t.changes=null}function ha(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),j&&N<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ha(t);t.background=n.insertBefore(u("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function Wa(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):An(e,t)}function bo(e,t){var r=t.text.className,n=Wa(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,Ha(e,t)):r&&(t.text.className=r)}function Ha(e,t){zo(e,t),t.line.wrapClass?ha(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 Ka(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var s=ha(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),s.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var z=ha(t),J=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(J),z.insertBefore(J,t.text),t.line.gutterClass&&(J.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=J.appendChild(u("div",Gn(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var ee=e.display.gutterSpecs[Z].className,me=k.hasOwnProperty(ee)&&k[ee];me&&J.appendChild(u("div",[me],"CodeMirror-gutter-elt","left: "+n.gutterLeft[ee]+"px; width: "+n.gutterWidth[ee]+"px"))}}}function Go(e,t,r){t.alignable&&(t.alignable=null);for(var n=A("CodeMirror-linewidget"),s=t.node.firstChild,k=void 0;s;s=k)k=s.nextSibling,n.test(s.className)&&t.node.removeChild(s);za(e,t,r)}function Eo(e,t,r,n){var s=Wa(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),Ha(e,t),Ka(e,t,r,n),za(e,t,n),t.node}function za(e,t,r){if(xo(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)xo(e,t.rest[n],t,r,!1)}function xo(e,t,r,n,s){if(!t.widgets)return;for(var k=ha(r),z=0,J=t.widgets;z<J.length;++z){var Z=J[z],ee=u("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Vo(Z,ee,r,n),e.display.input.setUneditable(ee),s&&Z.above?k.insertBefore(ee,r.gutter||r.text):k.appendChild(ee),Or(Z,"redraw")}}function Vo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var s=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(s-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function ta(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!w(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;"),h(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Di(e,t){for(var r=je(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 Ga(e){return e.lineSpace.offsetTop}function de(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function we(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function De(e){return Oe-e.display.nativeBarWidth}function pe(e){return e.display.scroller.clientWidth-De(e)-e.display.barWidth}function q(e){return e.display.scroller.clientHeight-De(e)-e.display.barHeight}function le(e,t,r){var n=e.options.lineWrapping,s=n&&pe(e);if(!t.measure.heights||n&&t.measure.width!=s){var k=t.measure.heights=[];if(n){t.measure.width=s;for(var z=t.text.firstChild.getClientRects(),J=0;J<z.length-1;J++){var Z=z[J],ee=z[J+1];Math.abs(Z.bottom-ee.bottom)>2&&k.push((Z.bottom+ee.top)/2-r.top)}}k.push(r.bottom-r.top)}}function ne(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var s=0;s<e.rest.length;s++)if(Jt(e.rest[s])>r)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}function ve(e,t){t=jr(t);var r=Jt(t),n=e.display.externalMeasured=new Pi(e.doc,t,r);n.lineN=r;var s=n.built=An(e,n);return n.text=s.pre,h(e.display.lineMeasure,s.pre),n}function ye(e,t,r,n){return Ie(e,_e(e,t),r,n)}function ke(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function _e(e,t){var r=Jt(t),n=ke(e,r);n&&!n.text?n=null:n&&n.changes&&(yo(e,n,r,xr(e)),e.curOp.forceUpdate=!0),n||(n=ve(e,t));var s=ne(n,t,r);return{line:t,view:n,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function Ie(e,t,r,n,s){t.before&&(r=-1);var k=r+(n||""),z;return t.cache.hasOwnProperty(k)?z=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(le(e,t.view,t.rect),t.hasHeights=!0),z=Ot(e,t,r,n),z.bogus||(t.cache[k]=z)),{left:z.left,right:z.right,top:s?z.rtop:z.top,bottom:s?z.rbottom:z.bottom}}var Ze={left:0,right:0,top:0,bottom:0};function ft(e,t,r){for(var n,s,k,z,J,Z,ee=0;ee<e.length;ee+=3)if(J=e[ee],Z=e[ee+1],t<J?(s=0,k=1,z="left"):t<Z?(s=t-J,k=s+1):(ee==e.length-3||t==Z&&e[ee+3]>t)&&(k=Z-J,s=k-1,t>=Z&&(z="right")),s!=null){if(n=e[ee+2],J==Z&&r==(n.insertLeft?"left":"right")&&(z=r),r=="left"&&s==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)n=e[(ee-=3)+2],z="left";if(r=="right"&&s==Z-J)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)n=e[(ee+=3)+2],z="right";break}return{node:n,start:s,end:k,collapse:z,coverStart:J,coverEnd:Z}}function ht(e,t){var r=Ze;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var s=e.length-1;s>=0&&!((r=e[s]).left!=r.right);s--);return r}function Ot(e,t,r,n){var s=ft(t.map,r,n),k=s.node,z=s.start,J=s.end,Z=s.collapse,ee;if(k.nodeType==3){for(var me=0;me<4;me++){for(;z&&rt(t.line.text.charAt(s.coverStart+z));)--z;for(;s.coverStart+J<s.coverEnd&&rt(t.line.text.charAt(s.coverStart+J));)++J;if(j&&N<9&&z==0&&J==s.coverEnd-s.coverStart?ee=k.parentNode.getBoundingClientRect():ee=ht(S(k,z,J).getClientRects(),n),ee.left||ee.right||z==0)break;J=z,z=z-1,Z="right"}j&&N<11&&(ee=hn(e.display.measure,ee))}else{z>0&&(Z=n="right");var Ce;e.options.lineWrapping&&(Ce=k.getClientRects()).length>1?ee=Ce[n=="right"?Ce.length-1:0]:ee=k.getBoundingClientRect()}if(j&&N<9&&!z&&(!ee||!ee.left&&!ee.right)){var Ue=k.parentNode.getClientRects()[0];Ue?ee={left:Ue.left,right:Ue.left+Wr(e.display),top:Ue.top,bottom:Ue.bottom}:ee=Ze}for(var Pe=ee.top-t.rect.top,nt=ee.bottom-t.rect.top,lt=(Pe+nt)/2,bt=t.view.measure.heights,Lt=0;Lt<bt.length-1&&!(lt<bt[Lt]);Lt++);var jt=Lt?bt[Lt-1]:0,Rt=bt[Lt],Vt={left:(Z=="right"?ee.right:ee.left)-t.rect.left,right:(Z=="left"?ee.left:ee.right)-t.rect.left,top:jt,bottom:Rt};return!ee.left&&!ee.right&&(Vt.bogus=!0),e.options.singleCursorHeightPerLine||(Vt.rtop=Pe,Vt.rbottom=nt),Vt}function hn(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!vn(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function wn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function yn(e){e.display.externalMeasure=null,x(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)wn(e.display.view[t])}function Cn(e){yn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function _n(){return c&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Tn(){return c&&a?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Sn(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=ta(e.widgets[r]));return t}function Hn(e,t,r,n,s){if(!s){var k=Sn(t);r.top+=k,r.bottom+=k}if(n=="line")return r;n||(n="local");var z=mr(t);if(n=="local"?z+=Ga(e.display):z-=e.display.viewOffset,n=="page"||n=="window"){var J=e.display.lineSpace.getBoundingClientRect();z+=J.top+(n=="window"?0:Tn());var Z=J.left+(n=="window"?0:_n());r.left+=Z,r.right+=Z}return r.top+=z,r.bottom+=z,r}function Rn(e,t,r){if(r=="div")return t;var n=t.left,s=t.top;if(r=="page")n-=_n(),s-=Tn();else if(r=="local"||!r){var k=e.display.sizer.getBoundingClientRect();n+=k.left,s+=k.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:n-z.left,top:s-z.top}}function gr(e,t,r,n,s){return n||(n=Tt(e.doc,t.line)),Hn(e,n,ye(e,n,t.ch,s),r)}function kn(e,t,r,n,s,k){n=n||Tt(e.doc,t.line),s||(s=_e(e,n));function z(nt,lt){var bt=Ie(e,s,nt,lt?"right":"left",k);return lt?bt.left=bt.right:bt.right=bt.left,Hn(e,n,bt,r)}var J=wt(n,e.doc.direction),Z=t.ch,ee=t.sticky;if(Z>=n.text.length?(Z=n.text.length,ee="before"):Z<=0&&(Z=0,ee="after"),!J)return z(ee=="before"?Z-1:Z,ee=="before");function me(nt,lt,bt){var Lt=J[lt],jt=Lt.level==1;return z(bt?nt-1:nt,jt!=bt)}var Ce=ct(J,Z,ee),Ue=xt,Pe=me(Z,Ce,ee=="before");return Ue!=null&&(Pe.other=me(Z,Ue,ee!="before")),Pe}function sn(e,t){var r=0;t=d(e.doc,t),e.options.lineWrapping||(r=Wr(e.display)*t.ch);var n=Tt(e.doc,t.line),s=mr(n)+Ga(e.display);return{left:r,right:r,top:s,bottom:s+n.height}}function nn(e,t,r,n,s){var k=Je(e,t,r);return k.xRel=s,n&&(k.outside=n),k}function Mn(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return nn(n.first,0,null,-1,-1);var s=Un(n,r),k=n.first+n.size-1;if(s>k)return nn(n.first+n.size-1,Tt(n,k).text.length,null,1,1);t<0&&(t=0);for(var z=Tt(n,s);;){var J=yr(e,z,s,t,r),Z=ri(z,J.ch+(J.xRel>0||J.outside>0?1:0));if(!Z)return J;var ee=Z.find(1);if(ee.line==s)return ee;z=Tt(n,s=ee.line)}}function Kn(e,t,r,n){n-=Sn(t);var s=t.text.length,k=Dt(function(z){return Ie(e,r,z-1).bottom<=n},s,0);return s=Dt(function(z){return Ie(e,r,z).top>n},k,s),{begin:k,end:s}}function Yt(e,t,r,n){r||(r=_e(e,t));var s=Hn(e,t,Ie(e,r,n),"line").top;return Kn(e,t,r,s)}function Xn(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function yr(e,t,r,n,s){s-=mr(t);var k=_e(e,t),z=Sn(t),J=0,Z=t.text.length,ee=!0,me=wt(t,e.doc.direction);if(me){var Ce=(e.options.lineWrapping?or:Jn)(e,t,r,k,me,n,s);ee=Ce.level!=1,J=ee?Ce.from:Ce.to-1,Z=ee?Ce.to:Ce.from-1}var Ue=null,Pe=null,nt=Dt(function(fn){var rn=Ie(e,k,fn);return rn.top+=z,rn.bottom+=z,Xn(rn,n,s,!1)?(rn.top<=s&&rn.left<=n&&(Ue=fn,Pe=rn),!0):!1},J,Z),lt,bt,Lt=!1;if(Pe){var jt=n-Pe.left<Pe.right-n,Rt=jt==ee;nt=Ue+(Rt?0:1),bt=Rt?"after":"before",lt=jt?Pe.left:Pe.right}else{!ee&&(nt==Z||nt==J)&&nt++,bt=nt==0?"after":nt==t.text.length?"before":Ie(e,k,nt-(ee?1:0)).bottom+z<=s==ee?"after":"before";var Vt=kn(e,Je(r,nt,bt),"line",t,k);lt=Vt.left,Lt=s<Vt.top?-1:s>=Vt.bottom?1:0}return nt=it(t.text,nt,1),nn(r,nt,bt,Lt,n-lt)}function Jn(e,t,r,n,s,k,z){var J=Dt(function(Ce){var Ue=s[Ce],Pe=Ue.level!=1;return Xn(kn(e,Je(r,Pe?Ue.to:Ue.from,Pe?"before":"after"),"line",t,n),k,z,!0)},0,s.length-1),Z=s[J];if(J>0){var ee=Z.level!=1,me=kn(e,Je(r,ee?Z.from:Z.to,ee?"after":"before"),"line",t,n);Xn(me,k,z,!0)&&me.top>z&&(Z=s[J-1])}return Z}function or(e,t,r,n,s,k,z){var J=Kn(e,t,n,z),Z=J.begin,ee=J.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var me=null,Ce=null,Ue=0;Ue<s.length;Ue++){var Pe=s[Ue];if(Pe.from>=ee||Pe.to<=Z)continue;var nt=Pe.level!=1,lt=Ie(e,n,nt?Math.min(ee,Pe.to)-1:Math.max(Z,Pe.from)).right,bt=lt<k?k-lt+1e9:lt-k;(!me||Ce>bt)&&(me=Pe,Ce=bt)}return me||(me=s[s.length-1]),me.from<Z&&(me={from:Z,to:me.to,level:me.level}),me.to>ee&&(me={from:me.from,to:ee,level:me.level}),me}var ir;function Dr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ir==null){ir=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ir.appendChild(document.createTextNode("x")),ir.appendChild(u("br"));ir.appendChild(document.createTextNode("x"))}h(e.measure,ir);var r=ir.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),x(e.measure),r||1}function Wr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");h(e.measure,r);var n=t.getBoundingClientRect(),s=(n.right-n.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function xr(e){for(var t=e.display,r={},n={},s=t.gutters.clientLeft,k=t.gutters.firstChild,z=0;k;k=k.nextSibling,++z){var J=e.display.gutterSpecs[z].className;r[J]=k.offsetLeft+k.clientLeft+s,n[J]=k.clientWidth}return{fixedPos:qr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function qr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ei(e){var t=Dr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Wr(e.display)-3);return function(s){if(Nr(e.doc,s))return 0;var k=0;if(s.widgets)for(var z=0;z<s.widgets.length;z++)s.widgets[z].height&&(k+=s.widgets[z].height);return r?k+(Math.ceil(s.text.length/n)||1)*t:k+t}}function oi(e){var t=e.doc,r=Ei(e);t.iter(function(n){var s=r(n);s!=n.height&&Dn(n,s)})}function Hr(e,t,r,n){var s=e.display;if(!r&&je(t).getAttribute("cm-not-content")=="true")return null;var k,z,J=s.lineSpace.getBoundingClientRect();try{k=t.clientX-J.left,z=t.clientY-J.top}catch(Ce){return null}var Z=Mn(e,k,z),ee;if(n&&Z.xRel>0&&(ee=Tt(e.doc,Z.line).text).length==Z.ch){var me=te(ee,ee.length,e.options.tabSize)-ee.length;Z=Je(Z.line,Math.max(0,Math.round((k-we(e.display).left)/Wr(e.display))-me))}return Z}function dr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function sr(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var s=e.display;if(n&&r<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)dn&&hi(e.doc,t)<s.viewTo&&br(e);else if(r<=s.viewFrom)dn&&_i(e.doc,r+n)>s.viewFrom?br(e):(s.viewFrom+=n,s.viewTo+=n);else if(t<=s.viewFrom&&r>=s.viewTo)br(e);else if(t<=s.viewFrom){var k=xi(e,r,r+n,1);k?(s.view=s.view.slice(k.index),s.viewFrom=k.lineN,s.viewTo+=n):br(e)}else if(r>=s.viewTo){var z=xi(e,t,t,-1);z?(s.view=s.view.slice(0,z.index),s.viewTo=z.lineN):br(e)}else{var J=xi(e,t,t,-1),Z=xi(e,r,r+n,1);J&&Z?(s.view=s.view.slice(0,J.index).concat($n(e,J.lineN,Z.lineN)).concat(s.view.slice(Z.index)),s.viewTo+=n):br(e)}var ee=s.externalMeasured;ee&&(r<ee.lineN?ee.lineN+=n:t<ee.lineN+ee.size&&(s.externalMeasured=null))}function Cr(e,t,r){e.curOp.viewChanged=!0;var n=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var k=n.view[dr(e,t)];if(k.node==null)return;var z=k.changes||(k.changes=[]);ge(z,r)==-1&&z.push(r)}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function xi(e,t,r,n){var s=dr(e,t),k,z=e.display.view;if(!dn||r==e.doc.first+e.doc.size)return{index:s,lineN:r};for(var J=e.display.viewFrom,Z=0;Z<s;Z++)J+=z[Z].size;if(J!=t){if(n>0){if(s==z.length-1)return null;k=J+z[s].size-t,s++}else k=J-t;t+=k,r+=k}for(;hi(e.doc,r)!=r;){if(s==(n<0?0:z.length-1))return null;r+=n*z[s-(n<0?1:0)].size,s+=n}return{index:s,lineN:r}}function Ii(e,t,r){var n=e.display,s=n.view;s.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=$n(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=$n(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(dr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat($n(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,dr(e,r)))),n.viewTo=r}function Ni(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var s=t[n];!s.hidden&&(!s.node||s.changes)&&++r}return r}function ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ai(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},s=n.cursors=document.createDocumentFragment(),k=n.selection=document.createDocumentFragment(),z=0;z<r.sel.ranges.length;z++){if(!t&&z==r.sel.primIndex)continue;var J=r.sel.ranges[z];if(J.from().line>=e.display.viewTo||J.to().line<e.display.viewFrom)continue;var Z=J.empty();(Z||e.options.showCursorWhenSelecting)&&Ui(e,J.head,s),Z||nr(e,J,k)}return n}function Ui(e,t,r){var n=kn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=r.appendChild(u("div","\xA0","CodeMirror-cursor"));if(s.style.left=n.left+"px",s.style.top=n.top+"px",s.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var k=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=n.other.left+"px",k.style.top=n.other.top+"px",k.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function ur(e,t){return e.top-t.top||e.left-t.left}function nr(e,t,r){var n=e.display,s=e.doc,k=document.createDocumentFragment(),z=we(e.display),J=z.left,Z=Math.max(n.sizerWidth,pe(e)-n.sizer.offsetLeft)-z.right,ee=s.direction=="ltr";function me(Rt,Vt,fn,rn){Vt<0&&(Vt=0),Vt=Math.round(Vt),rn=Math.round(rn),k.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+Rt+`px;
top: `+Vt+"px; width: "+(fn==null?Z-Rt:fn)+`px;
height: `+(rn-Vt)+"px"))}function Ce(Rt,Vt,fn){var rn=Tt(s,Rt),On=rn.text.length,cr,Xr;function wr(Br,mi){return gr(e,Je(Rt,Br),"div",rn,mi)}function bi(Br,mi,Jr){var Vr=Yt(e,rn,null,Br),Fr=mi=="ltr"==(Jr=="after")?"left":"right",Lr=Jr=="after"?Vr.begin:Vr.end-(/\s/.test(rn.text.charAt(Vr.end-1))?2:1);return wr(Lr,Fr)[Fr]}var pi=wt(rn,s.direction);return Et(pi,Vt||0,fn==null?On:fn,function(Br,mi,Jr,Vr){var Fr=Jr=="ltr",Lr=wr(Br,Fr?"left":"right"),vi=wr(mi-1,Fr?"right":"left"),Fa=Vt==null&&Br==0,ca=fn==null&&mi==On,ti=Vr==0,Hi=!pi||Vr==pi.length-1;if(vi.top-Lr.top<=3){var Yr=(ee?Fa:ca)&&ti,ps=(ee?ca:Fa)&&Hi,Zi=Yr?J:(Fr?Lr:vi).left,ya=ps?Z:(Fr?vi:Lr).right;me(Zi,Lr.top,ya-Zi,Lr.bottom)}else{var ba,di,ja,ms;Fr?(ba=ee&&Fa&&ti?J:Lr.left,di=ee?Z:bi(Br,Jr,"before"),ja=ee?J:bi(mi,Jr,"after"),ms=ee&&ca&&Hi?Z:vi.right):(ba=ee?bi(Br,Jr,"before"):J,di=!ee&&Fa&&ti?Z:Lr.right,ja=!ee&&ca&&Hi?J:vi.left,ms=ee?bi(mi,Jr,"after"):Z),me(ba,Lr.top,di-ba,Lr.bottom),Lr.bottom<vi.top&&me(J,Lr.bottom,null,vi.top),me(ja,vi.top,ms-ja,vi.bottom)}(!cr||ur(Lr,cr)<0)&&(cr=Lr),ur(vi,cr)<0&&(cr=vi),(!Xr||ur(Lr,Xr)<0)&&(Xr=Lr),ur(vi,Xr)<0&&(Xr=vi)}),{start:cr,end:Xr}}var Ue=t.from(),Pe=t.to();if(Ue.line==Pe.line)Ce(Ue.line,Ue.ch,Pe.ch);else{var nt=Tt(s,Ue.line),lt=Tt(s,Pe.line),bt=jr(nt)==jr(lt),Lt=Ce(Ue.line,Ue.ch,bt?nt.text.length+1:null).end,jt=Ce(Pe.line,bt?0:null,Pe.ch).start;bt&&(Lt.top<jt.top-2?(me(Lt.right,Lt.top,null,Lt.bottom),me(J,jt.top,jt.left,jt.bottom)):me(Lt.right,Lt.top,jt.left-Lt.right,Lt.bottom)),Lt.bottom<jt.top&&me(J,Lt.bottom,null,jt.top)}r.appendChild(k)}function Kr(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()||na(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Co(e){e.state.focused||(e.display.input.focus(),Bi(e))}function Va(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,na(e))},100)}function Bi(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Qe(e,"focus",e,t),e.state.focused=!0,K(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Kr(e)}function na(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Qe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function xa(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var s=t.view[n],k=e.options.lineWrapping,z=void 0,J=0;if(s.hidden)continue;if(j&&N<8){var Z=s.node.offsetTop+s.node.offsetHeight;z=Z-r,r=Z}else{var ee=s.node.getBoundingClientRect();z=ee.bottom-ee.top,!k&&s.text.firstChild&&(J=s.text.firstChild.getBoundingClientRect().right-ee.left-1)}var me=s.line.height-z;if((me>.005||me<-.005)&&(Dn(s.line,z),Xa(s.line),s.rest))for(var Ce=0;Ce<s.rest.length;Ce++)Xa(s.rest[Ce]);if(J>e.display.sizerWidth){var Ue=Math.ceil(J/Wr(e.display));Ue>e.display.maxLineLength&&(e.display.maxLineLength=Ue,e.display.maxLine=s.line,e.display.maxLineChanged=!0)}}}function Xa(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Ca(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Ga(e));var s=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,k=Un(t,n),z=Un(t,s);if(r&&r.ensure){var J=r.ensure.from.line,Z=r.ensure.to.line;J<k?(k=J,z=Un(t,mr(Tt(t,J))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=z&&(k=Un(t,mr(Tt(t,Z))-e.wrapper.clientHeight),z=Z)}return{from:k,to:Math.max(z,k+1)}}function Xo(e,t){if(ot(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),s=null;if(t.top+n.top<0?s=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(s=!1),s!=null&&!m){var k=u("div","\u200B",null,`position: absolute;
top: `+(t.top-r.viewOffset-Ga(e.display))+`px;
height: `+(t.bottom-t.top+De(e)+r.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(s),e.display.lineSpace.removeChild(k)}}function Yo(e,t,r,n){n==null&&(n=0);var s;!e.options.lineWrapping&&t==r&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var z=!1,J=kn(e,t),Z=!r||r==t?J:kn(e,r);s={left:Math.min(J.left,Z.left),top:Math.min(J.top,Z.top)-n,right:Math.max(J.left,Z.left),bottom:Math.max(J.bottom,Z.bottom)+n};var ee=Ya(e,s),me=e.doc.scrollTop,Ce=e.doc.scrollLeft;if(ee.scrollTop!=null&&(aa(e,ee.scrollTop),Math.abs(e.doc.scrollTop-me)>1&&(z=!0)),ee.scrollLeft!=null&&(Ci(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-Ce)>1&&(z=!0)),!z)break}return s}function So(e,t){var r=Ya(e,t);r.scrollTop!=null&&aa(e,r.scrollTop),r.scrollLeft!=null&&Ci(e,r.scrollLeft)}function Ya(e,t){var r=e.display,n=Dr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=q(e),z={};t.bottom-t.top>k&&(t.bottom=t.top+k);var J=e.doc.height+de(r),Z=t.top<n,ee=t.bottom>J-n;if(t.top<s)z.scrollTop=Z?0:t.top;else if(t.bottom>s+k){var me=Math.min(t.top,(ee?J:t.bottom)-k);me!=s&&(z.scrollTop=me)}var Ce=e.options.fixedGutter?0:r.gutters.offsetWidth,Ue=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-Ce,Pe=pe(e)-r.gutters.offsetWidth,nt=t.right-t.left>Pe;return nt&&(t.right=t.left+Pe),t.left<10?z.scrollLeft=0:t.left<Ue?z.scrollLeft=Math.max(0,t.left+Ce-(nt?0:10)):t.right>Pe+Ue-3&&(z.scrollLeft=t.right+(nt?0:10)-Pe),z}function $a(e,t){if(t==null)return;Sa(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ra(e){Sa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ia(e,t,r){(t!=null||r!=null)&&Sa(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function $o(e,t){Sa(e),e.curOp.scrollToPos=t}function Sa(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=sn(e,t.from),n=sn(e,t.to);fa(e,r,n,t.margin)}}function fa(e,t,r,n){var s=Ya(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});ia(e,s.scrollLeft,s.scrollTop)}function aa(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;M||va(e,{top:t}),oa(e,t,!0),M&&va(e),ma(e,100)}function oa(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 Ci(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Nn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Vi(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+de(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+De(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Fi=function(e,t,r){this.cm=r;var n=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=s.tabIndex=-1,e(n),e(s),We(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),We(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var s=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?n: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&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Fi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fi.prototype.zeroWidthHack=function(){var e=o&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ue,this.disableVert=new ue},Fi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var s=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Fi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var pa=function(){};pa.prototype.update=function(){return{bottom:0,right:0}},pa.prototype.setScrollLeft=function(){},pa.prototype.setScrollTop=function(){},pa.prototype.clear=function(){};function Xi(e,t){t||(t=Vi(e));var r=e.display.barWidth,n=e.display.barHeight;Ta(e,t);for(var s=0;s<4&&r!=e.display.barWidth||n!=e.display.barHeight;s++)r!=e.display.barWidth&&e.options.lineWrapping&&xa(e),Ta(e,Vi(e)),r=e.display.barWidth,n=e.display.barHeight}function Ta(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Ja={native:Fi,null:pa};function wa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ja[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),We(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"?Ci(e,t):aa(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Qa=0;function ji(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:++Qa},yi(e.curOp)}function Yi(e){var t=e.curOp;t&&Ea(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;To(r)})}function To(e){for(var t=e.ops,r=0;r<t.length;r++)Jo(t[r]);for(var n=0;n<t.length;n++)Qo(t[n]);for(var s=0;s<t.length;s++)Zo(t[s]);for(var k=0;k<t.length;k++)Za(t[k]);for(var z=0;z<t.length;z++)qo(t[z])}function Jo(e){var t=e.cm,r=t.display;wo(t),e.updateMaxLine&&Ar(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 Si(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Qo(e){e.updatedDisplay=e.mustUpdate&&$i(e.cm,e.update)}function Zo(e){var t=e.cm,r=t.display;e.updatedDisplay&&xa(t),e.barMeasure=Vi(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ye(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+De(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-pe(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Za(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ci(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==b();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Xi(t,e.barMeasure),e.updatedDisplay&&qn(t,e.barMeasure),e.selectionChanged&&Kr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Co(e.cm)}function qo(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&_a(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&oa(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ci(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=Yo(t,d(n,e.scrollToPos.from),d(n,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,s)}var k=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(k)for(var J=0;J<k.length;++J)k[J].lines.length||Qe(k[J],"hide");if(z)for(var Z=0;Z<z.length;++Z)z[Z].lines.length&&Qe(z[Z],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Qe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function si(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Yi(e)}}function Mr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Yi(e)}}}function $r(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Yi(this)}}}function Pr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ji(t);try{return e.apply(this,arguments)}finally{Yi(t)}}}function ma(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,V(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Ye(e,t.highlightFrontier),s=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(n.line>=e.display.viewFrom){var z=k.styles,J=k.text.length>e.options.maxHighlightLength?un(t.mode,n.state):null,Z=se(e,k,n,!0);J&&(n.state=J),k.styles=Z.styles;var ee=k.styleClasses,me=Z.classes;me?k.styleClasses=me:ee&&(k.styleClasses=null);for(var Ce=!z||z.length!=k.styles.length||ee!=me&&(!ee||!me||ee.bgClass!=me.bgClass||ee.textClass!=me.textClass),Ue=0;!Ce&&Ue<z.length;++Ue)Ce=z[Ue]!=k.styles[Ue];Ce&&s.push(n.line),k.stateAfter=n.save(),n.nextLine()}else k.text.length<=e.options.maxHighlightLength&&Ct(e,k.text,n),k.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ma(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),s.length&&si(e,function(){for(var k=0;k<s.length;k++)Cr(e,s[k],"text")})}var Si=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Ca(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=pe(e),this.force=r,this.dims=xr(e),this.events=[]};Si.prototype.signal=function(e,t){be(e,t)&&this.events.push(arguments)},Si.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Qe.apply(null,this.events[e])};function wo(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=De(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=De(e)+"px",t.scrollbarsClipped=!0)}function _o(e){if(e.hasFocus())return null;var t=b();if(!t||!w(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&w(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function Ao(e){if(!e||!e.activeElt||e.activeElt==b())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&w(document.body,e.anchorNode)&&w(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 $i(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return br(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&&Ni(e)==0)return!1;zr(e)&&(br(e),t.dims=xr(e));var s=n.first+n.size,k=Math.max(t.visible.from-e.options.viewportMargin,n.first),z=Math.min(s,t.visible.to+e.options.viewportMargin);r.viewFrom<k&&k-r.viewFrom<20&&(k=Math.max(n.first,r.viewFrom)),r.viewTo>z&&r.viewTo-z<20&&(z=Math.min(s,r.viewTo)),dn&&(k=hi(e.doc,k),z=_i(e.doc,z));var J=k!=r.viewFrom||z!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ii(e,k,z),r.viewOffset=mr(Tt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var Z=Ni(e);if(!J&&Z==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=_o(e);return Z>4&&(r.lineDiv.style.display="none"),Oo(e,r.updateLineNumbers,t.dims),Z>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Ao(ee),x(r.cursorDiv),x(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,J&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ma(e,400)),r.updateLineNumbers=null,!0}function _a(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==pe(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+de(e.display)-q(e),r.top)}),t.visible=Ca(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Ca(e.display,e.doc,r));if(!$i(e,t))break;xa(e);var s=Vi(e);ar(e),Xi(e,s),qn(e,s),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 va(e,t){var r=new Si(e,t);if($i(e,r)){xa(e),_a(e,r);var n=Vi(e);ar(e),Xi(e,n),qn(e,n),r.finish()}}function Oo(e,t,r){var n=e.display,s=e.options.lineNumbers,k=n.lineDiv,z=k.firstChild;function J(nt){var lt=nt.nextSibling;return P&&o&&e.display.currentWheelTarget==nt?nt.style.display="none":nt.parentNode.removeChild(nt),lt}for(var Z=n.view,ee=n.viewFrom,me=0;me<Z.length;me++){var Ce=Z[me];if(!Ce.hidden)if(!Ce.node||Ce.node.parentNode!=k){var Ue=Eo(e,Ce,ee,r);k.insertBefore(Ue,z)}else{for(;z!=Ce.node;)z=J(z);var Pe=s&&t!=null&&t<=ee&&Ce.lineNumber;Ce.changes&&(ge(Ce.changes,"gutter")>-1&&(Pe=!1),yo(e,Ce,ee,r)),Pe&&(x(Ce.lineNumber),Ce.lineNumber.appendChild(document.createTextNode(Gn(e.options,ee)))),z=Ce.node.nextSibling}ee+=Ce.size}for(;z;)z=J(z)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function qn(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+De(e)+"px"}function Nn(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=qr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,k=n+"px",z=0;z<r.length;z++)if(!r[z].hidden){e.options.fixedGutter&&(r[z].gutter&&(r[z].gutter.style.left=k),r[z].gutterBackground&&(r[z].gutterBackground.style.left=k));var J=r[z].alignable;if(J)for(var Z=0;Z<J.length;Z++)J[Z].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=n+s+"px")}function zr(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Gn(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var s=n.measure.appendChild(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=s.firstChild.offsetWidth,z=s.offsetWidth-k;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(k,n.lineGutter.offsetWidth-z)+1,n.lineNumWidth=n.lineNumInnerWidth+z,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Aa(e.display),!0}return!1}function li(e,t){for(var r=[],n=!1,s=0;s<e.length;s++){var k=e[s],z=null;if(typeof k!="string"&&(z=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:k,style:z})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function sa(e){var t=e.gutters,r=e.gutterSpecs;x(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var s=r[n],k=s.className,z=s.style,J=t.appendChild(u("div",null,"CodeMirror-gutter "+k));z&&(J.style.cssText=z),k=="CodeMirror-linenumbers"&&(e.lineGutter=J,J.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Aa(e)}function Li(e){sa(e.display),sr(e),Nn(e)}function ga(e,t,r,n){var s=this;this.input=r,s.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=D("div",null,"CodeMirror-code"),s.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=u("div",null,"CodeMirror-cursors"),s.measure=u("div",null,"CodeMirror-measure"),s.lineMeasure=u("div",null,"CodeMirror-measure"),s.lineSpace=D("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var k=D("div",[s.lineSpace],"CodeMirror-lines");s.mover=u("div",[k],null,"position: relative"),s.sizer=u("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=u("div",null,null,"position: absolute; height: "+Oe+"px; width: 1px;"),s.gutters=u("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=u("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=u("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),j&&N<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!P&&!(M&&i)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=li(n.gutters,n.lineNumbers),sa(s),r.init(s)}var Wi=0,Gr=null;j?Gr=-.53:M?Gr=15:c?Gr=-.7:_&&(Gr=-1/3);function Oa(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 qa(e){var t=Oa(e);return t.x*=Gr,t.y*=Gr,t}function eo(e,t){var r=Oa(t),n=r.x,s=r.y,k=e.display,z=k.scroller,J=z.scrollWidth>z.clientWidth,Z=z.scrollHeight>z.clientHeight;if(!(n&&J||s&&Z))return;if(s&&o&&P){e:for(var ee=t.target,me=k.view;ee!=z;ee=ee.parentNode)for(var Ce=0;Ce<me.length;Ce++)if(me[Ce].node==ee){e.display.currentWheelTarget=ee;break e}}if(n&&!M&&!f&&Gr!=null){s&&Z&&aa(e,Math.max(0,z.scrollTop+s*Gr)),Ci(e,Math.max(0,z.scrollLeft+n*Gr)),(!s||s&&Z)&&re(t),k.wheelStartX=null;return}if(s&&Gr!=null){var Ue=s*Gr,Pe=e.doc.scrollTop,nt=Pe+k.wrapper.clientHeight;Ue<0?Pe=Math.max(0,Pe+Ue-50):nt=Math.min(e.doc.height,nt+Ue+50),va(e,{top:Pe,bottom:nt})}Wi<20&&(k.wheelStartX==null?(k.wheelStartX=z.scrollLeft,k.wheelStartY=z.scrollTop,k.wheelDX=n,k.wheelDY=s,setTimeout(function(){if(k.wheelStartX==null)return;var lt=z.scrollLeft-k.wheelStartX,bt=z.scrollTop-k.wheelStartY,Lt=bt&&k.wheelDY&&bt/k.wheelDY||lt&&k.wheelDX&&lt/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!Lt)return;Gr=(Gr*Wi+Lt)/(Wi+1),++Wi},200)):(k.wheelDX+=n,k.wheelDY+=s))}var ui=function(e,t){this.ranges=e,this.primIndex=t};ui.prototype.primary=function(){return this.ranges[this.primIndex]},ui.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!Xt(r.anchor,n.anchor)||!Xt(r.head,n.head))return!1}return!0},ui.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Zn(Gt(this.ranges[t].anchor),Gt(this.ranges[t].head));return new ui(e,this.primIndex)},ui.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ui.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(vt(t,n.from())>=0&&vt(e,n.to())<=0)return r}return-1};var Zn=function(e,t){this.anchor=e,this.head=t};Zn.prototype.from=function(){return qt(this.anchor,this.head)},Zn.prototype.to=function(){return Bt(this.anchor,this.head)},Zn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ti(e,t,r){var n=e&&e.options.selectionsMayTouch,s=t[r];t.sort(function(Ue,Pe){return vt(Ue.from(),Pe.from())}),r=ge(t,s);for(var k=1;k<t.length;k++){var z=t[k],J=t[k-1],Z=vt(J.to(),z.from());if(n&&!z.empty()?Z>0:Z>=0){var ee=qt(J.from(),z.from()),me=Bt(J.to(),z.to()),Ce=J.empty()?z.from()==z.head:J.from()==J.head;k<=r&&--r,t.splice(--k,2,new Zn(Ce?me:ee,Ce?ee:me))}}return new ui(t,r)}function Ri(e,t){return new ui([new Zn(e,t||e)],0)}function ki(e){return e.text?Je(e.from.line+e.text.length-1,Re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function to(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return ki(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ki(t).ch-t.to.ch),Je(r,n)}function Da(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var s=e.sel.ranges[n];r.push(new Zn(to(s.anchor,t),to(s.head,t)))}return Ti(e.cm,r,e.sel.primIndex)}function Do(e,t,r){return e.line==t.line?Je(r.line,e.ch-t.ch+r.ch):Je(r.line+(e.line-t.line),e.ch)}function Lo(e,t,r){for(var n=[],s=Je(e.first,0),k=s,z=0;z<t.length;z++){var J=t[z],Z=Do(J.from,s,k),ee=Do(ki(J),s,k);if(s=J.to,k=ee,r=="around"){var me=e.sel.ranges[z],Ce=vt(me.head,me.anchor)<0;n[z]=new Zn(Ce?ee:Z,Ce?Z:ee)}else n[z]=new Zn(Z,Z)}return new ui(n,e.sel.primIndex)}function Ji(e){e.doc.mode=Mt(e.options,e.doc.modeOption),no(e)}function no(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,ma(e,100),e.state.modeGen++,e.curOp&&sr(e)}function vs(e,t){return t.from.ch==0&&t.to.ch==0&&Re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,r,n){function s(jt){return r?r[jt]:null}function k(jt,Rt,Vt){ii(jt,Rt,Vt,n),Or(jt,"change",jt,t)}function z(jt,Rt){for(var Vt=[],fn=jt;fn<Rt;++fn)Vt.push(new Tr(ee[fn],s(fn),n));return Vt}var J=t.from,Z=t.to,ee=t.text,me=Tt(e,J.line),Ce=Tt(e,Z.line),Ue=Re(ee),Pe=s(ee.length-1),nt=Z.line-J.line;if(t.full)e.insert(0,z(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(vs(e,t)){var lt=z(0,ee.length-1);k(Ce,Ce.text,Pe),nt&&e.remove(J.line,nt),lt.length&&e.insert(J.line,lt)}else if(me==Ce)if(ee.length==1)k(me,me.text.slice(0,J.ch)+Ue+me.text.slice(Z.ch),Pe);else{var bt=z(1,ee.length-1);bt.push(new Tr(Ue+me.text.slice(Z.ch),Pe,n)),k(me,me.text.slice(0,J.ch)+ee[0],s(0)),e.insert(J.line+1,bt)}else if(ee.length==1)k(me,me.text.slice(0,J.ch)+ee[0]+Ce.text.slice(Z.ch),s(0)),e.remove(J.line+1,nt);else{k(me,me.text.slice(0,J.ch)+ee[0],s(0)),k(Ce,Ue+Ce.text.slice(Z.ch),Pe);var Lt=z(1,ee.length-1);nt>1&&e.remove(J.line+1,nt-1),e.insert(J.line+1,Lt)}Or(e,"change",e,t)}function la(e,t,r){function n(s,k,z){if(s.linked)for(var J=0;J<s.linked.length;++J){var Z=s.linked[J];if(Z.doc==k)continue;var ee=z&&Z.sharedHist;if(r&&!ee)continue;t(Z.doc,ee),n(Z.doc,s,ee)}}n(e,null,!0)}function gs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,oi(e),Ji(e),ys(e),e.options.lineWrapping||Ar(e),e.options.mode=t.modeOption,sr(e)}function ys(e){(e.doc.direction=="rtl"?K:T)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){si(e,function(){ys(e),sr(e)})}function Ro(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 ns(e,t){var r={from:Gt(t.from),to:ki(t),text:zn(e,t.from,t.to)};return xs(e,r,t.from.line,t.to.line+1),la(e,function(n){return xs(n,r,t.from.line,t.to.line+1)},!0),r}function bs(e){for(;e.length;){var t=Re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),Re(e.done);if(e.done.length&&!Re(e.done).ranges)return Re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Re(e.done)}function Es(e,t,r,n){var s=e.history;s.undone.length=0;var k=+new Date,z,J;if((s.lastOp==n||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(s,s.lastOp==n)))J=Re(z.changes),vt(t.from,t.to)==0&&vt(t.from,J.to)==0?J.to=ki(t):z.changes.push(ns(e,t));else{var Z=Re(s.done);for((!Z||!Z.ranges)&&ko(e.sel,s.done),z={changes:[ns(e,t)],generation:s.generation},s.done.push(z);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(r),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=k,s.lastOp=s.lastSelOp=n,s.lastOrigin=s.lastSelOrigin=t.origin,J||Qe(e,"historyAdded")}function ml(e,t,r,n){var s=t.charAt(0);return s=="*"||s=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function vl(e,t,r,n){var s=e.history,k=n&&n.origin;r==s.lastSelOp||k&&s.lastSelOrigin==k&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==k||ml(e,k,Re(s.done),t))?s.done[s.done.length-1]=t:ko(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=k,s.lastSelOp=r,n&&n.clearRedo!==!1&&bs(s.undone)}function ko(e,t){var r=Re(t);r&&r.ranges&&r.equals(e)||t.push(e)}function xs(e,t,r,n){var s=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(z){z.markedSpans&&((s||(s=t["spans_"+e.id]={}))[k]=z.markedSpans),++k})}function gl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],s=0;s<t.text.length;++s)n.push(gl(r[s]));return n}function Cs(e,t){var r=yl(e,t),n=hr(e,t);if(!r)return n;if(!n)return r;for(var s=0;s<r.length;++s){var k=r[s],z=n[s];if(k&&z){e:for(var J=0;J<z.length;++J){for(var Z=z[J],ee=0;ee<k.length;++ee)if(k[ee].marker==Z.marker)continue e;k.push(Z)}}else z&&(r[s]=z)}return r}function La(e,t,r){for(var n=[],s=0;s<e.length;++s){var k=e[s];if(k.ranges){n.push(r?ui.prototype.deepCopy.call(k):k);continue}var z=k.changes,J=[];n.push({changes:J});for(var Z=0;Z<z.length;++Z){var ee=z[Z],me=void 0;if(J.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var Ce in ee)(me=Ce.match(/^spans_(\d+)$/))&&(ge(t,Number(me[1]))>-1&&(Re(J)[Ce]=ee[Ce],delete ee[Ce]))}}return n}function rs(e,t,r,n){if(n){var s=e.anchor;if(r){var k=vt(t,s)<0;k!=vt(r,s)<0?(s=t,t=r):k!=vt(t,r)<0&&(t=r)}return new Zn(s,t)}else return new Zn(r||t,t)}function Mo(e,t,r,n,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),ei(e,new ui([rs(e.sel.primary(),t,r,s)],0),n)}function Ss(e,t,r){for(var n=[],s=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)n[k]=rs(e.sel.ranges[k],t[k],null,s);var z=Ti(e.cm,n,e.sel.primIndex);ei(e,z,r)}function is(e,t,r,n){var s=e.sel.ranges.slice(0);s[t]=r,ei(e,Ti(e.cm,s,e.sel.primIndex),n)}function Ts(e,t,r,n){ei(e,Ri(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(s){this.ranges=[];for(var k=0;k<s.length;k++)this.ranges[k]=new Zn(d(e,s[k].anchor),d(e,s[k].head))},origin:r&&r.origin};return Qe(e,"beforeSelectionChange",e,n),e.cm&&Qe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Ti(e.cm,n.ranges,n.ranges.length-1):t}function ws(e,t,r){var n=e.history.done,s=Re(n);s&&s.ranges?(n[n.length-1]=t,Po(e,t,r)):ei(e,t,r)}function ei(e,t,r){Po(e,t,r),vl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Po(e,t,r){(be(e,"beforeSelectionChange")||e.cm&&be(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(vt(t.primary().head,e.sel.primary().head)<0?-1:1);_s(e,Os(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&ra(e.cm)}function _s(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ae(e.cm)),Or(e,"cursorActivity",e)}function As(e){_s(e,Os(e,e.sel,null,!1))}function Os(e,t,r,n){for(var s,k=0;k<t.ranges.length;k++){var z=t.ranges[k],J=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Z=Io(e,z.anchor,J&&J.anchor,r,n),ee=Io(e,z.head,J&&J.head,r,n);(s||Z!=z.anchor||ee!=z.head)&&(s||(s=t.ranges.slice(0,k)),s[k]=new Zn(Z,ee))}return s?Ti(e.cm,s,t.primIndex):t}function Ra(e,t,r,n,s){var k=Tt(e,t.line);if(k.markedSpans)for(var z=0;z<k.markedSpans.length;++z){var J=k.markedSpans[z],Z=J.marker,ee="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,me="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((J.from==null||(ee?J.from<=t.ch:J.from<t.ch))&&(J.to==null||(me?J.to>=t.ch:J.to>t.ch))){if(s&&(Qe(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(k.markedSpans){--z;continue}else break;if(!Z.atomic)continue;if(r){var Ce=Z.find(n<0?1:-1),Ue=void 0;if((n<0?me:ee)&&(Ce=Ds(e,Ce,-n,Ce&&Ce.line==t.line?k:null)),Ce&&Ce.line==t.line&&(Ue=vt(Ce,r))&&(n<0?Ue<0:Ue>0))return Ra(e,Ce,t,n,s)}var Pe=Z.find(n<0?-1:1);return(n<0?ee:me)&&(Pe=Ds(e,Pe,n,Pe.line==t.line?k:null)),Pe?Ra(e,Pe,t,n,s):null}}return t}function Io(e,t,r,n,s){var k=n||1,z=Ra(e,t,r,k,s)||!s&&Ra(e,t,r,k,!0)||Ra(e,t,r,-k,s)||!s&&Ra(e,t,r,-k,!0);return z||(e.cantEdit=!0,Je(e.first,0))}function Ds(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?d(e,Je(t.line-1)):null:r>0&&t.ch==(n||Tt(e,t.line)).text.length?t.line<e.first+e.size-1?Je(t.line+1,0):null:new Je(t.line,t.ch+r)}function Ls(e){e.setSelection(Je(e.firstLine(),0),Je(e.lastLine()),Ke)}function Rs(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(s,k,z,J){s&&(n.from=d(e,s)),k&&(n.to=d(e,k)),z&&(n.text=z),J!==void 0&&(n.origin=J)}),Qe(e,"beforeChange",e,n),e.cm&&Qe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function ka(e,t,r){if(e.cm){if(!e.cm.curOp)return Mr(e.cm,ka)(e,t,r);if(e.cm.state.suppressEdits)return}if((be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"))&&(t=Rs(e,t,!0),!t))return;var n=on&&!r&&gi(e,t.from,t.to);if(n)for(var s=n.length-1;s>=0;--s)ks(e,{from:n[s].from,to:n[s].to,text:s?[""]:t.text,origin:t.origin});else ks(e,t)}function ks(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var r=Da(e,t);Es(e,t,r,e.cm?e.cm.curOp.id:NaN),ro(e,t,r,hr(e,t));var n=[];la(e,function(s,k){!k&&ge(n,s.history)==-1&&(Ns(s.history,t),n.push(s.history)),ro(s,t,null,hr(s,t))})}function No(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var s=e.history,k,z=e.sel,J=t=="undo"?s.done:s.undone,Z=t=="undo"?s.undone:s.done,ee=0;ee<J.length&&!(k=J[ee],r?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==J.length)return;for(s.lastOrigin=s.lastSelOrigin=null;;)if(k=J.pop(),k.ranges){if(ko(k,Z),r&&!k.equals(e.sel)){ei(e,k,{clearRedo:!1});return}z=k}else if(n){J.push(k);return}else break;var me=[];ko(z,Z),Z.push({changes:me,generation:s.generation}),s.generation=k.generation||++s.maxGeneration;for(var Ce=be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"),Ue=function(lt){var bt=k.changes[lt];if(bt.origin=t,Ce&&!Rs(e,bt,!1))return J.length=0,{};me.push(ns(e,bt));var Lt=lt?Da(e,bt):Re(J);ro(e,bt,Lt,Cs(e,bt)),!lt&&e.cm&&e.cm.scrollIntoView({from:bt.from,to:ki(bt)});var jt=[];la(e,function(Rt,Vt){!Vt&&ge(jt,Rt.history)==-1&&(Ns(Rt.history,bt),jt.push(Rt.history)),ro(Rt,bt,null,Cs(Rt,bt))})},Pe=k.changes.length-1;Pe>=0;--Pe){var nt=Ue(Pe);if(nt)return nt.v}}function Ms(e,t){if(t==0)return;if(e.first+=t,e.sel=new ui(dt(e.sel.ranges,function(s){return new Zn(Je(s.anchor.line+t,s.anchor.ch),Je(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm){sr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Cr(e.cm,n,"gutter")}}function ro(e,t,r,n){if(e.cm&&!e.cm.curOp)return Mr(e.cm,ro)(e,t,r,n);if(t.to.line<e.first){Ms(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 s=t.text.length-1-(e.first-t.from.line);Ms(e,s),t={from:Je(e.first,0),to:Je(t.to.line+s,t.to.ch),text:[Re(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Je(k,Tt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zn(e,t.from,t.to),r||(r=Da(e,t)),e.cm?El(e.cm,t,n):ts(e,t,n),Po(e,r,Ke),e.cantEdit&&Io(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,s=e.display,k=t.from,z=t.to,J=!1,Z=k.line;e.options.lineWrapping||(Z=Jt(jr(Tt(n,k.line))),n.iter(Z,z.line+1,function(Pe){if(Pe==s.maxLine)return J=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ae(e),ts(n,t,r,Ei(e)),e.options.lineWrapping||(n.iter(Z,k.line+t.text.length,function(Pe){var nt=Vn(Pe);nt>s.maxLineLength&&(s.maxLine=Pe,s.maxLineLength=nt,s.maxLineChanged=!0,J=!1)}),J&&(e.curOp.updateMaxLine=!0)),Nt(n,k.line),ma(e,400);var ee=t.text.length-(z.line-k.line)-1;t.full?sr(e):k.line==z.line&&t.text.length==1&&!vs(e.doc,t)?Cr(e,k.line,"text"):sr(e,k.line,z.line+1,ee);var me=be(e,"changes"),Ce=be(e,"change");if(Ce||me){var Ue={from:k,to:z,text:t.text,removed:t.removed,origin:t.origin};Ce&&Or(e,"change",e,Ue),me&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ue)}e.display.selForContextMenu=null}function Ma(e,t,r,n,s){var k;n||(n=r),vt(n,r)<0&&(k=[n,r],r=k[0],n=k[1]),typeof t=="string"&&(t=e.splitLines(t)),ka(e,{from:r,to:n,text:t,origin:s})}function Ps(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,r,n){for(var s=0;s<e.length;++s){var k=e[s],z=!0;if(k.ranges){k.copied||(k=e[s]=k.deepCopy(),k.copied=!0);for(var J=0;J<k.ranges.length;J++)Ps(k.ranges[J].anchor,t,r,n),Ps(k.ranges[J].head,t,r,n);continue}for(var Z=0;Z<k.changes.length;++Z){var ee=k.changes[Z];if(r<ee.from.line)ee.from=Je(ee.from.line+n,ee.from.ch),ee.to=Je(ee.to.line+n,ee.to.ch);else if(t<=ee.to.line){z=!1;break}}z||(e.splice(0,s+1),s=0)}}function Ns(e,t){var r=t.from.line,n=t.to.line,s=t.text.length-(n-r)-1;Is(e.done,r,n,s),Is(e.undone,r,n,s)}function io(e,t,r,n){var s=t,k=t;return typeof t=="number"?k=Tt(e,B(e,t)):s=Jt(t),s==null?null:(n(k,s)&&e.cm&&Cr(e.cm,s,r),k)}function ao(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}ao.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var s=this.lines[r];this.height-=s.height,Rr(s),Or(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function oo(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var s=e[n];t+=s.chunkSize(),r+=s.height,s.parent=this}this.size=t,this.height=r,this.parent=null}oo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],s=n.chunkSize();if(e<s){var k=Math.min(t,s-e),z=n.height;if(n.removeInner(e,k),this.height-=z-n.height,s==k&&(this.children.splice(r--,1),n.parent=null),(t-=k)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ao))){var J=[];this.collapse(J),this.children=[new ao(J)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var s=this.children[n],k=s.chunkSize();if(e<=k){if(s.insertInner(e,t,r),s.lines&&s.lines.length>50){for(var z=s.lines.length%25+25,J=z;J<s.lines.length;){var Z=new ao(s.lines.slice(J,J+=25));s.height-=Z.height,this.children.splice(++n,0,Z),Z.parent=this}s.lines=s.lines.slice(0,z),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 oo(t);if(e.parent){e.size-=r.size,e.height-=r.height;var s=ge(e.parent.children,e);e.parent.children.splice(s+1,0,r)}else{var n=new oo(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var s=this.children[n],k=s.chunkSize();if(e<k){var z=Math.min(t,k-e);if(s.iterN(e,z,r))return!0;if((t-=z)==0)break;e=0}else e-=k}}};var so=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};so.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Jt(r);if(n==null||!t)return;for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(r.widgets=null);var k=ta(this);Dn(r,Math.max(0,r.height-k)),e&&(si(e,function(){Us(e,r,-k),Cr(e,n,"widget")}),Or(e,"lineWidgetCleared",e,this,n))},so.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var s=ta(this)-t;if(!s)return;Nr(this.doc,n)||Dn(n,n.height+s),r&&si(r,function(){r.curOp.forceUpdate=!0,Us(r,n,s),Or(r,"lineWidgetChanged",r,e,Jt(n))})},Se(so);function Us(e,t,r){mr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&$a(e,r)}function xl(e,t,r,n){var s=new so(e,r,n),k=e.cm;return k&&s.noHScroll&&(k.display.alignWidgets=!0),io(e,t,"widget",function(z){var J=z.widgets||(z.widgets=[]);if(s.insertAt==null?J.push(s):J.splice(Math.min(J.length-1,Math.max(0,s.insertAt)),0,s),s.line=z,k&&!Nr(e,z)){var Z=mr(z)<e.scrollTop;Dn(z,z.height+ta(s)),Z&&$a(k,s.height),k.curOp.forceUpdate=!0}return!0}),k&&Or(k,"lineWidgetAdded",k,s,typeof t=="number"?t:Jt(t)),s}var Bs=0,ua=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Bs};ua.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),be(this,"clear")){var r=this.find();r&&Or(this,"clear",r.from,r.to)}for(var n=null,s=null,k=0;k<this.lines.length;++k){var z=this.lines[k],J=Er(z.markedSpans,this);e&&!this.collapsed?Cr(e,Jt(z),"text"):e&&(J.to!=null&&(s=Jt(z)),J.from!=null&&(n=Jt(z))),z.markedSpans=Qr(z.markedSpans,J),J.from==null&&this.collapsed&&!Nr(this.doc,z)&&e&&Dn(z,Dr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var ee=jr(this.lines[Z]),me=Vn(ee);me>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=me,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&sr(e,n,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&As(e.doc)),e&&Or(e,"markerCleared",e,this,n,s),t&&Yi(e),this.parent&&this.parent.clear()},ua.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,s=0;s<this.lines.length;++s){var k=this.lines[s],z=Er(k.markedSpans,this);if(z.from!=null&&(r=Je(t?k:Jt(k),z.from),e==-1))return r;if(z.to!=null&&(n=Je(t?k:Jt(k),z.to),e==1))return n}return r&&{from:r,to:n}},ua.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;si(n,function(){var s=t.line,k=Jt(t.line),z=ke(n,k);if(z&&(wn(z),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Nr(r.doc,s)&&r.height!=null){var J=r.height;r.height=null;var Z=ta(r)-J;Z&&Dn(s,s.height+Z)}Or(n,"markerChanged",n,e)})},ua.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ge(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(ge(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Se(ua);function Pa(e,t,r,n,s){if(n&&n.shared)return Cl(e,t,r,n,s);if(e.cm&&!e.cm.curOp)return Mr(e.cm,Pa)(e,t,r,n,s);var k=new ua(e,s),z=vt(t,r);if(n&&W(n,k,!1),z>0||z==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=D("span",[k.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(vr(e,t.line,t,r,k)||t.line!=r.line&&vr(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");Fn()}k.addToHistory&&Es(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var J=t.line,Z=e.cm,ee;if(e.iter(J,r.line+1,function(Ce){Z&&k.collapsed&&!Z.options.lineWrapping&&jr(Ce)==Z.display.maxLine&&(ee=!0),k.collapsed&&J!=t.line&&Dn(Ce,0),ni(Ce,new cn(k,J==t.line?t.ch:null,J==r.line?r.ch:null)),++J}),k.collapsed&&e.iter(t.line,r.line+1,function(Ce){Nr(e,Ce)&&Dn(Ce,0)}),k.clearOnEnter&&We(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(En(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++Bs,k.atomic=!0),Z){if(ee&&(Z.curOp.updateMaxLine=!0),k.collapsed)sr(Z,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var me=t.line;me<=r.line;me++)Cr(Z,me,"text");k.atomic&&As(Z.doc),Or(Z,"markerAdded",Z,k)}return k}var lo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};lo.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Or(this,"clear")},lo.prototype.find=function(e,t){return this.primary.find(e,t)},Se(lo);function Cl(e,t,r,n,s){n=W(n),n.shared=!1;var k=[Pa(e,t,r,n,s)],z=k[0],J=n.widgetNode;return la(e,function(Z){J&&(n.widgetNode=J.cloneNode(!0)),k.push(Pa(Z,d(Z,t),d(Z,r),n,s));for(var ee=0;ee<Z.linked.length;++ee)if(Z.linked[ee].isParent)return;z=Re(k)}),new lo(k,z)}function Fs(e){return e.findMarks(Je(e.first,0),e.clipPos(Je(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var r=0;r<t.length;r++){var n=t[r],s=n.find(),k=e.clipPos(s.from),z=e.clipPos(s.to);if(vt(k,z)){var J=Pa(e,k,z,n.primary,n.primary.type);n.markers.push(J),J.parent=n}}}function Tl(e){for(var t=function(n){var s=e[n],k=[s.primary.doc];la(s.primary.doc,function(Z){return k.push(Z)});for(var z=0;z<s.markers.length;z++){var J=s.markers[z];ge(k,J.doc)==-1&&(J.parent=null,s.markers.splice(z--,1))}},r=0;r<e.length;r++)t(r)}var wl=0,fi=function(e,t,r,n,s){if(!(this instanceof fi))return new fi(e,t,r,n,s);r==null&&(r=0),oo.call(this,[new ao([new Tr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var k=Je(r,0);this.sel=Ri(k),this.history=new Ro(null),this.id=++wl,this.modeOption=t,this.lineSep=n,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ts(this,{from:k,to:k,text:e}),ei(this,Ri(k),Ke)};fi.prototype=ce(oo.prototype,{constructor:fi,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Pn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Pr(function(e){var t=Je(this.first,0),r=this.first+this.size-1;ka(this,{from:t,to:Je(r,Tt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ia(this.cm,0,0),ei(this,Ri(t),Ke)}),replaceRange:function(e,t,r,n){t=d(this,t),r=r?d(this,r):t,Ma(this,e,t,r,n)},getRange:function(e,t,r){var n=zn(this,d(this,e),d(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Qn(this,e))return Tt(this,e)},getLineNumber:function(e){return Jt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Tt(this,e)),jr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return d(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:Pr(function(e,t,r){Ts(this,d(this,typeof e=="number"?Je(e,t||0):e),null,r)}),setSelection:Pr(function(e,t,r){Ts(this,d(this,e),d(this,t||e),r)}),extendSelection:Pr(function(e,t,r){Mo(this,d(this,e),t&&d(this,t),r)}),extendSelections:Pr(function(e,t){Ss(this,F(this,e),t)}),extendSelectionsBy:Pr(function(e,t){var r=dt(this.sel.ranges,e);Ss(this,F(this,r),t)}),setSelections:Pr(function(e,t,r){if(!e.length)return;for(var n=[],s=0;s<e.length;s++)n[s]=new Zn(d(this,e[s].anchor),d(this,e[s].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),ei(this,Ti(this.cm,n,t),r)}),addSelection:Pr(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Zn(d(this,e),d(this,t||e))),ei(this,Ti(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var s=zn(this,t[n].from(),t[n].to());r=r?r.concat(s):s}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var s=zn(this,r[n].from(),r[n].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[n]=s}return t},replaceSelection:function(e,t,r){for(var n=[],s=0;s<this.sel.ranges.length;s++)n[s]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Pr(function(e,t,r){for(var n=[],s=this.sel,k=0;k<s.ranges.length;k++){var z=s.ranges[k];n[k]={from:z.from(),to:z.to(),text:this.splitLines(e[k]),origin:r}}for(var J=t&&t!="end"&&Lo(this,n,t),Z=n.length-1;Z>=0;Z--)ka(this,n[Z]);J?ws(this,J):this.cm&&ra(this.cm)}),undo:Pr(function(){No(this,"undo")}),redo:Pr(function(){No(this,"redo")}),undoSelection:Pr(function(){No(this,"undo",!0)}),redoSelection:Pr(function(){No(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ro(this.history.maxGeneration),la(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:La(this.history.done),undone:La(this.history.undone)}},setHistory:function(e){var t=this.history=new Ro(this.history.maxGeneration);t.done=La(e.done.slice(0),null,!0),t.undone=La(e.undone.slice(0),null,!0)},setGutterMarker:Pr(function(e,t,r){return io(this,e,"gutter",function(n){var s=n.gutterMarkers||(n.gutterMarkers={});return s[t]=r,!r&&et(s)&&(n.gutterMarkers=null),!0})}),clearGutter:Pr(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&io(t,r,"gutter",function(){return r.gutterMarkers[e]=null,et(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Qn(this,e))return null;if(t=e,e=Tt(this,e),!e)return null}else if(t=Jt(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:Pr(function(e,t,r){return io(this,e,t=="gutter"?"gutter":"class",function(n){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[s])n[s]=r;else{if(A(r).test(n[s]))return!1;n[s]+=" "+r}return!0})}),removeLineClass:Pr(function(e,t,r){return io(this,e,t=="gutter"?"gutter":"class",function(n){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=n[s];if(k)if(r==null)n[s]=null;else{var z=k.match(A(r));if(!z)return!1;var J=z.index+z[0].length;n[s]=k.slice(0,z.index)+(!z.index||J==k.length?"":" ")+k.slice(J)||null}else return!1;return!0})}),addLineWidget:Pr(function(e,t,r){return xl(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Pa(this,d(this,e),d(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=d(this,e),Pa(this,e,e,r,"bookmark")},findMarksAt:function(e){e=d(this,e);var t=[],r=Tt(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var s=r[n];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,r){e=d(this,e),t=d(this,t);var n=[],s=e.line;return this.iter(e.line,t.line+1,function(k){var z=k.markedSpans;if(z)for(var J=0;J<z.length;J++){var Z=z[J];!(Z.to!=null&&s==e.line&&e.ch>=Z.to||Z.from==null&&s!=e.line||Z.from!=null&&s==t.line&&Z.from>=t.ch)&&(!r||r(Z.marker))&&n.push(Z.marker.parent||Z.marker)}++s}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(s){var k=s.text.length+n;if(k>e)return t=e,!0;e-=k,++r}),d(this,Je(r,t))},indexFromPos:function(e){e=d(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new fi(Pn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new fi(Pn(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(n,Fs(this)),n},unlinkDoc:function(e){if(e instanceof Sr&&(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(Fs(this));break}if(e.history==this.history){var n=[e.id];la(e,function(s){return n.push(s.id)},!0),e.history=new Ro(null),e.history.done=La(this.history.done,n),e.history.undone=La(this.history.undone,n)}},iterLinkedDocs:function(e){la(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):_t(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Pr(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)})}),fi.prototype.eachLine=fi.prototype.iter;var js=0;function _l(e){var t=this;if(Ws(t),ot(t,e)||Di(t.display,e))return;re(e),j&&(js=+new Date);var r=Hr(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var s=n.length,k=Array(s),z=0,J=function(){++z==s&&Mr(t,function(){r=d(t.doc,r);var Pe={from:r,to:r,text:t.doc.splitLines(k.filter(function(nt){return nt!=null}).join(t.doc.lineSeparator())),origin:"paste"};ka(t.doc,Pe),ws(t.doc,Ri(d(t.doc,r),d(t.doc,ki(Pe))))})()},Z=function(Pe,nt){if(t.options.allowDropFileTypes&&ge(t.options.allowDropFileTypes,Pe.type)==-1){J();return}var lt=new FileReader;lt.onerror=function(){return J()},lt.onload=function(){var bt=lt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(bt)){J();return}k[nt]=bt,J()},lt.readAsText(Pe)},ee=0;ee<n.length;ee++)Z(n[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var me=e.dataTransfer.getData("Text");if(me){var Ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(Ce=t.listSelections()),Po(t.doc,Ri(r,r)),Ce)for(var Ue=0;Ue<Ce.length;++Ue)Ma(t.doc,"",Ce[Ue].anchor,Ce[Ue].head,"drag");t.replaceSelection(me,"around","paste"),t.display.input.focus()}}catch(Pe){}}}function Al(e,t){if(j&&(!e.state.draggingText||+new Date-js<100)){Ee(t);return}if(ot(e,t)||Di(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),f&&r.parentNode.removeChild(r)}}function Ol(e,t){var r=Hr(e,t);if(!r)return;var n=document.createDocumentFragment();Ui(e,r,n),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,n)}function Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var s=t[n].CodeMirror;s&&r.push(s)}r.length&&r[0].operation(function(){for(var k=0;k<r.length;k++)e(r[k])})}var Ks=!1;function Dl(){if(Ks)return;Ll(),Ks=!0}function Ll(){var e;We(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Hs(Rl)},100))}),We(window,"blur",function(){return Hs(na)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var da={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"},uo=0;uo<10;uo++)da[uo+48]=da[uo+96]=String(uo);for(var Uo=65;Uo<=90;Uo++)da[Uo]=String.fromCharCode(Uo);for(var co=1;co<=12;co++)da[co+111]=da[co+63235]="F"+co;var Qi={};Qi.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"},Qi.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"},Qi.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"},Qi.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"]},Qi.default=o?Qi.macDefault:Qi.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,s,k,z=0;z<t.length-1;z++){var J=t[z];if(/^(cmd|meta|m)$/i.test(J))k=!0;else if(/^a(lt)?$/i.test(J))r=!0;else if(/^(c|ctrl|control)$/i.test(J))n=!0;else if(/^s(hift)?$/i.test(J))s=!0;else throw new Error("Unrecognized modifier name: "+J)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function Ml(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var s=dt(r.split(" "),kl),k=0;k<s.length;k++){var z=void 0,J=void 0;k==s.length-1?(J=s.join(" "),z=n):(J=s.slice(0,k+1).join(" "),z="...");var Z=t[J];if(!Z)t[J]=z;else if(Z!=z)throw new Error("Inconsistent bindings for "+J)}delete e[r]}for(var ee in t)e[ee]=t[ee];return e}function Ia(e,t,r,n){t=Bo(t);var s=t.call?t.call(e,n):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&r(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ia(e,t.fallthrough,r,n);for(var k=0;k<t.fallthrough.length;k++){var z=Ia(e,t.fallthrough[k],r,n);if(z)return z}}}function zs(e){var t=typeof e=="string"?e:da[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(v?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(f&&e.keyCode==34&&e.char)return!1;var r=da[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),Gs(r,e,t))}function Bo(e){return typeof e=="string"?Qi[e]:e}function Na(e,t){for(var r=e.doc.sel.ranges,n=[],s=0;s<r.length;s++){for(var k=t(r[s]);n.length&&vt(k.from,Re(n).to)<=0;){var z=n.pop();if(vt(z.from,k.from)<0){k.from=z.from;break}}n.push(k)}si(e,function(){for(var J=n.length-1;J>=0;J--)Ma(e.doc,"",n[J].from,n[J].to,"+delete");ra(e)})}function as(e,t,r){var n=it(e.text,t+r,r);return n<0||n>e.text.length?null:n}function os(e,t,r){var n=as(e,t.ch,r);return n==null?null:new Je(t.line,n,r<0?"after":"before")}function ss(e,t,r,n,s){if(e){t.doc.direction=="rtl"&&(s=-s);var k=wt(r,t.doc.direction);if(k){var z=s<0?Re(k):k[0],J=s<0==(z.level==1),Z=J?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var me=_e(t,r);ee=s<0?r.text.length-1:0;var Ce=Ie(t,me,ee).top;ee=Dt(function(Ue){return Ie(t,me,Ue).top==Ce},s<0==(z.level==1)?z.from:z.to-1,ee),Z=="before"&&(ee=as(r,ee,1))}else ee=s<0?z.to:z.from;return new Je(n,ee,Z)}}return new Je(n,s<0?r.text.length:0,s<0?"before":"after")}function Pl(e,t,r,n){var s=wt(t,e.doc.direction);if(!s)return os(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=ct(s,r.ch,r.sticky),z=s[k];if(e.doc.direction=="ltr"&&z.level%2==0&&(n>0?z.to>r.ch:z.from<r.ch))return os(t,r,n);var J=function(Lt,jt){return as(t,Lt instanceof Je?Lt.ch:Lt,jt)},Z,ee=function(Lt){return e.options.lineWrapping?(Z=Z||_e(e,t),Yt(e,t,Z,Lt)):{begin:0,end:t.text.length}},me=ee(r.sticky=="before"?J(r,-1):r.ch);if(e.doc.direction=="rtl"||z.level==1){var Ce=z.level==1==n<0,Ue=J(r,Ce?1:-1);if(Ue!=null&&(Ce?Ue<=z.to&&Ue<=me.end:Ue>=z.from&&Ue>=me.begin)){var Pe=Ce?"before":"after";return new Je(r.line,Ue,Pe)}}var nt=function(Lt,jt,Rt){for(var Vt=function(cr,Xr){return Xr?new Je(r.line,J(cr,1),"before"):new Je(r.line,cr,"after")};Lt>=0&&Lt<s.length;Lt+=jt){var fn=s[Lt],rn=jt>0==(fn.level!=1),On=rn?Rt.begin:J(Rt.end,-1);if(fn.from<=On&&On<fn.to)return Vt(On,rn);if(On=rn?fn.from:J(fn.to,-1),Rt.begin<=On&&On<Rt.end)return Vt(On,rn)}},lt=nt(k+n,n,me);if(lt)return lt;var bt=n>0?me.end:J(me.begin,-1);return bt!=null&&!(n>0&&bt==t.text.length)&&(lt=nt(n>0?0:s.length-1,n,ee(bt)),lt)?lt:null}var ho={selectAll:Ls,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ke)},killLine:function(e){return Na(e,function(t){if(t.empty()){var r=Tt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Je(t.head.line+1,0)}:{from:t.head,to:Je(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Na(e,function(t){return{from:Je(t.from().line,0),to:d(e.doc,Je(t.to().line+1,0))}})},delLineLeft:function(e){return Na(e,function(t){return{from:Je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Na(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Na(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Xe)},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")},Xe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?Ys(e,t.head):n},Xe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,s=0;s<r.length;s++){var k=r[s].from(),z=te(e.getLine(k.line),k.ch,n);t.push(oe(n-z%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return si(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var s=t[n].head,k=Tt(e.doc,s.line).text;if(k){if(s.ch==k.length&&(s=new Je(s.line,s.ch-1)),s.ch>0)s=new Je(s.line,s.ch+1),e.replaceRange(k.charAt(s.ch-1)+k.charAt(s.ch-2),Je(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var z=Tt(e.doc,s.line-1).text;z&&(s=new Je(s.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Je(s.line-1,z.length-1),s,"+transpose"))}}r.push(new Zn(s,s))}e.setSelections(r)})},newlineAndIndent:function(e){return si(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);ra(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var r=Tt(e.doc,t),n=jr(r);return n!=r&&(t=Jt(n)),ss(!0,e,n,t,1)}function Il(e,t){var r=Tt(e.doc,t),n=zi(r);return n!=r&&(t=Jt(n)),ss(!0,e,r,t,-1)}function Ys(e,t){var r=Xs(e,t.line),n=Tt(e.doc,r.line),s=wt(n,e.doc.direction);if(!s||s[0].level==0){var k=Math.max(r.ch,n.text.search(/\S/)),z=t.line==r.line&&t.ch<=k&&t.ch;return Je(r.line,z?0:k,r.sticky)}return r}function Fo(e,t,r){if(typeof t=="string"&&(t=ho[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),s=t(e)!=qe}finally{e.display.shift=n,e.state.suppressEdits=!1}return s}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var s=Ia(t,e.state.keyMaps[n],r,e);if(s)return s}return e.options.extraKeys&&Ia(t,e.options.extraKeys,r,e)||Ia(t,e.options.keyMap,r,e)}var Ul=new ue;function fo(e,t,r,n){var s=e.state.keySeq;if(s){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,s+" "+t,r,n))return!0}return $s(e,t,r,n)}function $s(e,t,r,n){var s=Nl(e,t,n);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&Or(e,"keyHandled",e,t,r),(s=="handled"||s=="multi")&&(re(r),Kr(e)),!!s}function Js(e,t){var r=Vs(t,!0);return r?t.shiftKey&&!e.state.keySeq?fo(e,"Shift-"+r,t,function(n){return Fo(e,n,!0)})||fo(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return Fo(e,n)}):fo(e,r,t,function(n){return Fo(e,n)}):!1}function Bl(e,t,r){return fo(e,"'"+r+"'",t,function(n){return Fo(e,n,!0)})}var ls=null;function Qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=b(),ot(t,e))return;j&&N<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=Js(t,e);f&&(ls=n?r:null,!n&&r==88&&!bn&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),M&&!o&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(T(t,"CodeMirror-crosshair"),Ut(document,"keyup",r),Ut(document,"mouseover",r))}We(document,"keyup",r),We(document,"mouseover",r)}function Zs(e){e.keyCode==16&&(this.doc.sel.shift=!1),ot(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Di(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(f&&r==ls){ls=null,re(e);return}if(f&&(!e.which||e.which<10)&&Js(t,e))return;var s=String.fromCharCode(n==null?r:n);if(s=="\b")return;if(Bl(t,e,s))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,r){this.time=e,this.pos=t,this.button=r};us.prototype.compare=function(e,t,r){return this.time+jl>e&&vt(t,this.pos)==0&&r==this.button};var po,mo;function Wl(e,t){var r=+new Date;return mo&&mo.compare(r,e,t)?(po=mo=null,"triple"):po&&po.compare(r,e,t)?(mo=new us(r,e,t),po=null,"double"):(po=new us(r,e,t),mo=null,"single")}function el(e){var t=this,r=t.display;if(ot(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Di(r,e)){P||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(ds(t,e))return;var n=Hr(t,e),s=Te(e),k=n?Wl(n,s):"single";if(window.focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,s,n,k,e))return;s==1?n?zl(t,n,k,e):je(e)==r.scroller&&re(e):s==2?(n&&Mo(t.doc,n),setTimeout(function(){return r.input.focus()},20)):s==3&&(L?t.display.input.onContextMenu(e):Va(t))}function Hl(e,t,r,n,s){var k="Click";return n=="double"?k="Double"+k:n=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,fo(e,Gs(k,s),s,function(z){if(typeof z=="string"&&(z=ho[z]),!z)return!1;var J=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),J=z(e,r)!=qe}finally{e.state.suppressEdits=!1}return J})}function Kl(e,t,r){var n=e.getOption("configureMouse"),s=n?n(e,t,r):{};if(s.unit==null){var k=l?r.shiftKey&&r.metaKey:r.altKey;s.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||r.shiftKey),s.addNew==null&&(s.addNew=o?r.metaKey:r.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(o?r.altKey:r.ctrlKey)),s}function zl(e,t,r,n){j?setTimeout(V(Co,e),0):e.curOp.focus=b();var s=Kl(e,r,n),k=e.doc.sel,z;e.options.dragDrop&&Ne&&!e.isReadOnly()&&r=="single"&&(z=k.contains(t))>-1&&(vt((z=k.ranges[z]).from(),t)<0||t.xRel>0)&&(vt(z.to(),t)>0||t.xRel<0)?Gl(e,n,t,s):Vl(e,n,t,s)}function Gl(e,t,r,n){var s=e.display,k=!1,z=Mr(e,function(ee){P&&(s.scroller.draggable=!1),e.state.draggingText=!1,Ut(s.wrapper.ownerDocument,"mouseup",z),Ut(s.wrapper.ownerDocument,"mousemove",J),Ut(s.scroller,"dragstart",Z),Ut(s.scroller,"drop",z),k||(re(ee),n.addNew||Mo(e.doc,r,null,null,n.extend),P&&!_||j&&N==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),J=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},Z=function(){return k=!0};P&&(s.scroller.draggable=!0),e.state.draggingText=z,z.copy=!n.moveOnDrag,s.scroller.dragDrop&&s.scroller.dragDrop(),We(s.wrapper.ownerDocument,"mouseup",z),We(s.wrapper.ownerDocument,"mousemove",J),We(s.scroller,"dragstart",Z),We(s.scroller,"drop",z),Va(e),setTimeout(function(){return s.input.focus()},20)}function tl(e,t,r){if(r=="char")return new Zn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Zn(Je(t.line,0),d(e.doc,Je(t.line+1,0)));var n=r(e,t);return new Zn(n.from,n.to)}function Vl(e,t,r,n){var s=e.display,k=e.doc;re(t);var z,J,Z=k.sel,ee=Z.ranges;if(n.addNew&&!n.extend?(J=k.sel.contains(r),J>-1?z=ee[J]:z=new Zn(r,r)):(z=k.sel.primary(),J=k.sel.primIndex),n.unit=="rectangle")n.addNew||(z=new Zn(r,r)),r=Hr(e,t,!0,!0),J=-1;else{var me=tl(e,r,n.unit);n.extend?z=rs(z,me.anchor,me.head,n.extend):z=me}n.addNew?J==-1?(J=ee.length,ei(k,Ti(e,ee.concat([z]),J),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[J].empty()&&n.unit=="char"&&!n.extend?(ei(k,Ti(e,ee.slice(0,J).concat(ee.slice(J+1)),0),{scroll:!1,origin:"*mouse"}),Z=k.sel):is(k,J,z,Be):(J=0,ei(k,new ui([z],0),Be),Z=k.sel);var Ce=r;function Ue(Rt){if(vt(Ce,Rt)==0)return;if(Ce=Rt,n.unit=="rectangle"){for(var Vt=[],fn=e.options.tabSize,rn=te(Tt(k,r.line).text,r.ch,fn),On=te(Tt(k,Rt.line).text,Rt.ch,fn),cr=Math.min(rn,On),Xr=Math.max(rn,On),wr=Math.min(r.line,Rt.line),bi=Math.min(e.lastLine(),Math.max(r.line,Rt.line));wr<=bi;wr++){var pi=Tt(k,wr).text,Br=Fe(pi,cr,fn);cr==Xr?Vt.push(new Zn(Je(wr,Br),Je(wr,Br))):pi.length>Br&&Vt.push(new Zn(Je(wr,Br),Je(wr,Fe(pi,Xr,fn))))}Vt.length||Vt.push(new Zn(r,r)),ei(k,Ti(e,Z.ranges.slice(0,J).concat(Vt),J),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Rt)}else{var mi=z,Jr=tl(e,Rt,n.unit),Vr=mi.anchor,Fr;vt(Jr.anchor,Vr)>0?(Fr=Jr.head,Vr=qt(mi.from(),Jr.anchor)):(Fr=Jr.anchor,Vr=Bt(mi.to(),Jr.head));var Lr=Z.ranges.slice(0);Lr[J]=Xl(e,new Zn(d(k,Vr),Fr)),ei(k,Ti(e,Lr,J),Be)}}var Pe=s.wrapper.getBoundingClientRect(),nt=0;function lt(Rt){var Vt=++nt,fn=Hr(e,Rt,!0,n.unit=="rectangle");if(!fn)return;if(vt(fn,Ce)!=0){e.curOp.focus=b(),Ue(fn);var rn=Ca(s,k);(fn.line>=rn.to||fn.line<rn.from)&&setTimeout(Mr(e,function(){nt==Vt&&lt(Rt)}),150)}else{var On=Rt.clientY<Pe.top?-20:Rt.clientY>Pe.bottom?20:0;On&&setTimeout(Mr(e,function(){if(nt!=Vt)return;s.scroller.scrollTop+=On,lt(Rt)}),50)}}function bt(Rt){e.state.selectingText=!1,nt=Infinity,Rt&&(re(Rt),s.input.focus()),Ut(s.wrapper.ownerDocument,"mousemove",Lt),Ut(s.wrapper.ownerDocument,"mouseup",jt),k.history.lastSelOrigin=null}var Lt=Mr(e,function(Rt){Rt.buttons===0||!Te(Rt)?bt(Rt):lt(Rt)}),jt=Mr(e,bt);e.state.selectingText=jt,We(s.wrapper.ownerDocument,"mousemove",Lt),We(s.wrapper.ownerDocument,"mouseup",jt)}function Xl(e,t){var r=t.anchor,n=t.head,s=Tt(e.doc,r.line);if(vt(r,n)==0&&r.sticky==n.sticky)return t;var k=wt(s);if(!k)return t;var z=ct(k,r.ch,r.sticky),J=k[z];if(J.from!=r.ch&&J.to!=r.ch)return t;var Z=z+(J.from==r.ch==(J.level!=1)?0:1);if(Z==0||Z==k.length)return t;var ee;if(n.line!=r.line)ee=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var me=ct(k,n.ch,n.sticky),Ce=me-z||(n.ch-r.ch)*(J.level==1?-1:1);me==Z-1||me==Z?ee=Ce<0:ee=Ce>0}var Ue=k[Z+(ee?-1:0)],Pe=ee==(Ue.level==1),nt=Pe?Ue.from:Ue.to,lt=Pe?"after":"before";return r.ch==nt&&r.sticky==lt?t:new Zn(new Je(r.line,nt,lt),n)}function nl(e,t,r,n){var s,k;if(t.touches)s=t.touches[0].clientX,k=t.touches[0].clientY;else try{s=t.clientX,k=t.clientY}catch(Ue){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&re(t);var z=e.display,J=z.lineDiv.getBoundingClientRect();if(k>J.bottom||!be(e,r))return fe(t);k-=J.top-z.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var ee=z.gutters.childNodes[Z];if(ee&&ee.getBoundingClientRect().right>=s){var me=Un(e.doc,k),Ce=e.display.gutterSpecs[Z];return Qe(e,r,e,me,Ce.className,t),fe(t)}}}function ds(e,t){return nl(e,t,"gutterClick",!0)}function rl(e,t){if(Di(e.display,t)||Yl(e,t))return;if(ot(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return be(e,"gutterContextMenu")?nl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Cn(e)}var Ua={toString:function(){return"CodeMirror.Init"}},al={},jo={};function $l(e){var t=e.optionHandlers;function r(n,s,k,z){e.defaults[n]=s,k&&(t[n]=z?function(J,Z,ee){ee!=Ua&&k(J,Z,ee)}:k)}e.defineOption=r,e.Init=Ua,r("value","",function(n,s){return n.setValue(s)},!0),r("mode",null,function(n,s){n.doc.modeOption=s,Ji(n)},!0),r("indentUnit",2,Ji,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){no(n),Cn(n),sr(n)},!0),r("lineSeparator",null,function(n,s){if(n.doc.lineSep=s,!s)return;var k=[],z=n.doc.first;n.doc.iter(function(Z){for(var ee=0;;){var me=Z.text.indexOf(s,ee);if(me==-1)break;ee=me+s.length,k.push(Je(z,me))}z++});for(var J=k.length-1;J>=0;J--)Ma(n.doc,s,k[J],Je(k[J].line,k[J].ch+s.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,s,k){n.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),k!=Ua&&n.refresh()}),r("specialCharPlaceholder",Wn,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,s){return n.getInputField().spellcheck=s},!0),r("autocorrect",!1,function(n,s){return n.getInputField().autocorrect=s},!0),r("autocapitalize",!1,function(n,s){return n.getInputField().autocapitalize=s},!0),r("rtlMoveVisually",!C),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){il(n),Li(n)},!0),r("keyMap","default",function(n,s,k){var z=Bo(s),J=k!=Ua&&Bo(k);J&&J.detach&&J.detach(n,z),z.attach&&z.attach(n,J||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,s){n.display.gutterSpecs=li(s,n.options.lineNumbers),Li(n)},!0),r("fixedGutter",!0,function(n,s){n.display.gutters.style.left=s?qr(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Xi(n)},!0),r("scrollbarStyle","native",function(n){wa(n),Xi(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,s){n.display.gutterSpecs=li(n.options.gutters,s),Li(n)},!0),r("firstLineNumber",1,Li,!0),r("lineNumberFormatter",function(n){return n},Li,!0),r("showCursorWhenSelecting",!1,ar,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,s){s=="nocursor"&&(na(n),n.display.input.blur()),n.display.input.readOnlyChanged(s)}),r("screenReaderLabel",null,function(n,s){s=s===""?null:s,n.display.input.screenReaderLabelChanged(s)}),r("disableInput",!1,function(n,s){s||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ar,!0),r("singleCursorHeightPerLine",!0,ar,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,no,!0),r("addModeClass",!1,no,!0),r("pollInterval",100),r("undoDepth",200,function(n,s){return n.doc.history.undoDepth=s}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,no,!0),r("moveInputWithCursor",!0,function(n,s){s||n.display.input.resetPosition()}),r("tabindex",null,function(n,s){return n.display.input.getField().tabIndex=s||""}),r("autofocus",null),r("direction","ltr",function(n,s){return n.doc.setDirection(s)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Ua;if(!t!=!n){var s=e.display.dragFunctions,k=t?We:Ut;k(e.display.scroller,"dragstart",s.start),k(e.display.scroller,"dragenter",s.enter),k(e.display.scroller,"dragover",s.over),k(e.display.scroller,"dragleave",s.leave),k(e.display.scroller,"drop",s.drop)}}function Ql(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Ar(e)),oi(e),sr(e),Cn(e),setTimeout(function(){return Xi(e)},100)}function Sr(e,t){var r=this;if(!(this instanceof Sr))return new Sr(e,t);this.options=t=t?W(t):{},W(al,t,!1);var n=t.value;typeof n=="string"?n=new fi(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var s=new Sr.inputStyles[t.inputStyle](this),k=this.display=new ga(e,n,s,t);k.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wa(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 ue,keySeq:null,specialChars:null},t.autofocus&&!i&&k.input.focus(),j&&N<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Dl(),ji(this),this.curOp.forceUpdate=!0,gs(this,n),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Bi(r)},20):na(this);for(var z in jo)jo.hasOwnProperty(z)&&jo[z](this,t[z],Ua);zr(this),t.finishInit&&t.finishInit(this);for(var J=0;J<cs.length;++J)cs[J](this);Yi(this),P&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Sr.defaults=al,Sr.optionHandlers=jo;function Zl(e){var t=e.display;We(t.scroller,"mousedown",Mr(e,el)),j&&N<11?We(t.scroller,"dblclick",Mr(e,function(Z){if(ot(e,Z))return;var ee=Hr(e,Z);if(!ee||ds(e,Z)||Di(e.display,Z))return;re(Z);var me=e.findWordAt(ee);Mo(e.doc,me.anchor,me.head)})):We(t.scroller,"dblclick",function(Z){return ot(e,Z)||re(Z)}),We(t.scroller,"contextmenu",function(Z){return rl(e,Z)}),We(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||rl(e,Z)});var r,n={end:0};function s(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function k(Z){if(Z.touches.length!=1)return!1;var ee=Z.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function z(Z,ee){if(ee.left==null)return!0;var me=ee.left-Z.left,Ce=ee.top-Z.top;return me*me+Ce*Ce>20*20}We(t.scroller,"touchstart",function(Z){if(!ot(e,Z)&&!k(Z)&&!ds(e,Z)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-n.end<=300?n:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),We(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),We(t.scroller,"touchend",function(Z){var ee=t.activeTouch;if(ee&&!Di(t,Z)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var me=e.coordsChar(t.activeTouch,"page"),Ce;!ee.prev||z(ee,ee.prev)?Ce=new Zn(me,me):!ee.prev.prev||z(ee,ee.prev.prev)?Ce=e.findWordAt(me):Ce=new Zn(Je(me.line,0),d(e.doc,Je(me.line+1,0))),e.setSelection(Ce.anchor,Ce.head),e.focus(),re(Z)}s()}),We(t.scroller,"touchcancel",s),We(t.scroller,"scroll",function(){t.scroller.clientHeight&&(aa(e,t.scroller.scrollTop),Ci(e,t.scroller.scrollLeft,!0),Qe(e,"scroll",e))}),We(t.scroller,"mousewheel",function(Z){return eo(e,Z)}),We(t.scroller,"DOMMouseScroll",function(Z){return eo(e,Z)}),We(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){ot(e,Z)||Ee(Z)},over:function(Z){ot(e,Z)||(Ol(e,Z),Ee(Z))},start:function(Z){return Al(e,Z)},drop:Mr(e,_l),leave:function(Z){ot(e,Z)||Ws(e)}};var J=t.input.getField();We(J,"keyup",function(Z){return Zs.call(e,Z)}),We(J,"keydown",Mr(e,Qs)),We(J,"keypress",Mr(e,qs)),We(J,"focus",function(Z){return Bi(e,Z)}),We(J,"blur",function(Z){return na(e,Z)})}var cs=[];Sr.defineInitHook=function(e){return cs.push(e)};function vo(e,t,r,n){var s=e.doc,k;r==null&&(r="add"),r=="smart"&&(s.mode.indent?k=Ye(e,t).state:r="prev");var z=e.options.tabSize,J=Tt(s,t),Z=te(J.text,null,z);J.stateAfter&&(J.stateAfter=null);var ee=J.text.match(/^\s*/)[0],me;if(!n&&!/\S/.test(J.text))me=0,r="not";else if(r=="smart"&&(me=s.mode.indent(k,J.text.slice(ee.length),J.text),me==qe||me>150)){if(!n)return;r="prev"}r=="prev"?t>s.first?me=te(Tt(s,t-1).text,null,z):me=0:r=="add"?me=Z+e.options.indentUnit:r=="subtract"?me=Z-e.options.indentUnit:typeof r=="number"&&(me=Z+r),me=Math.max(0,me);var Ce="",Ue=0;if(e.options.indentWithTabs)for(var Pe=Math.floor(me/z);Pe;--Pe)Ue+=z,Ce+=" ";if(Ue<me&&(Ce+=oe(me-Ue)),Ce!=ee)return Ma(s,Ce,Je(t,0),Je(t,ee.length),"+input"),J.stateAfter=null,!0;for(var nt=0;nt<s.sel.ranges.length;nt++){var lt=s.sel.ranges[nt];if(lt.head.line==t&&lt.head.ch<ee.length){var bt=Je(t,ee.length);is(s,nt,new Zn(bt,bt));break}}}var Mi=null;function Wo(e){Mi=e}function hs(e,t,r,n,s){var k=e.doc;e.display.shift=!1,n||(n=k.sel);var z=+new Date-200,J=s=="paste"||e.state.pasteIncoming>z,Z=_t(t),ee=null;if(J&&n.ranges.length>1)if(Mi&&Mi.text.join(`
`)==t){if(n.ranges.length%Mi.text.length==0){ee=[];for(var me=0;me<Mi.text.length;me++)ee.push(k.splitLines(Mi.text[me]))}}else Z.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(ee=dt(Z,function(Lt){return[Lt]}));for(var Ce=e.curOp.updateInput,Ue=n.ranges.length-1;Ue>=0;Ue--){var Pe=n.ranges[Ue],nt=Pe.from(),lt=Pe.to();Pe.empty()&&(r&&r>0?nt=Je(nt.line,nt.ch-r):e.state.overwrite&&!J?lt=Je(lt.line,Math.min(Tt(k,lt.line).text.length,lt.ch+Re(Z).length)):J&&Mi&&Mi.lineWise&&Mi.text.join(`
`)==Z.join(`
`)&&(nt=lt=Je(nt.line,0)));var bt={from:nt,to:lt,text:ee?ee[Ue%ee.length]:Z,origin:s||(J?"paste":e.state.cutIncoming>z?"cut":"+input")};ka(e.doc,bt),Or(e,"inputRead",e,bt)}t&&!J&&sl(e,t),ra(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&si(t,function(){return hs(t,r,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var s=r.ranges[n];if(s.head.ch>100||n&&r.ranges[n-1].head.line==s.head.line)continue;var k=e.getModeAt(s.head),z=!1;if(k.electricChars){for(var J=0;J<k.electricChars.length;J++)if(t.indexOf(k.electricChars.charAt(J))>-1){z=vo(e,s.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(Tt(e.doc,s.head.line).text.slice(0,s.head.ch))&&(z=vo(e,s.head.line,"smart")));z&&Or(e,"electricInput",e,s.head.line)}}function ll(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var s=e.doc.sel.ranges[n].head.line,k={anchor:Je(s,0),head:Je(s+1,0)};r.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:r}}function ul(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){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 P?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,s){var k=this.options,z=k[n];if(k[n]==s&&n!="mode")return;k[n]=s,t.hasOwnProperty(n)&&Mr(this,t[n])(this,s,z),Qe(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,s){this.state.keyMaps[s?"push":"unshift"](Bo(n))},removeKeyMap:function(n){for(var s=this.state.keyMaps,k=0;k<s.length;++k)if(s[k]==n||s[k].name==n)return s.splice(k,1),!0},addOverlay:$r(function(n,s){var k=n.token?n:e.getMode(this.options,n);if(k.startState)throw new Error("Overlays may not be stateful.");at(this.state.overlays,{mode:k,modeSpec:n,opaque:s&&s.opaque,priority:s&&s.priority||0},function(z){return z.priority}),this.state.modeGen++,sr(this)}),removeOverlay:$r(function(n){for(var s=this.state.overlays,k=0;k<s.length;++k){var z=s[k].modeSpec;if(z==n||typeof n=="string"&&z.name==n){s.splice(k,1),this.state.modeGen++,sr(this);return}}}),indentLine:$r(function(n,s,k){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),Qn(this.doc,n)&&vo(this,n,s,k)}),indentSelection:$r(function(n){for(var s=this.doc.sel.ranges,k=-1,z=0;z<s.length;z++){var J=s[z];if(J.empty())J.head.line>k&&(vo(this,J.head.line,n,!0),k=J.head.line,z==this.doc.sel.primIndex&&ra(this));else{var Z=J.from(),ee=J.to(),me=Math.max(k,Z.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var Ce=me;Ce<k;++Ce)vo(this,Ce,n);var Ue=this.doc.sel.ranges;Z.ch==0&&s.length==Ue.length&&Ue[z].from().ch>0&&is(this.doc,z,new Zn(Z,Ue[z].to()),Ke)}}}),getTokenAt:function(n,s){return Bn(this,n,s)},getLineTokens:function(n,s){return Bn(this,Je(n),s,!0)},getTokenTypeAt:function(n){n=d(this.doc,n);var s=He(this,Tt(this.doc,n.line)),k=0,z=(s.length-1)/2,J=n.ch,Z;if(J==0)Z=s[2];else for(;;){var ee=k+z>>1;if((ee?s[ee*2-1]:0)>=J)z=ee;else if(s[ee*2+1]<J)k=ee+1;else{Z=s[ee*2+2];break}}var me=Z?Z.indexOf("overlay "):-1;return me<0?Z:me==0?null:Z.slice(0,me-1)},getModeAt:function(n){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(n).state).mode:s},getHelper:function(n,s){return this.getHelpers(n,s)[0]},getHelpers:function(n,s){var k=[];if(!r.hasOwnProperty(s))return k;var z=r[s],J=this.getModeAt(n);if(typeof J[s]=="string")z[J[s]]&&k.push(z[J[s]]);else if(J[s])for(var Z=0;Z<J[s].length;Z++){var ee=z[J[s][Z]];ee&&k.push(ee)}else J.helperType&&z[J.helperType]?k.push(z[J.helperType]):z[J.name]&&k.push(z[J.name]);for(var me=0;me<z._global.length;me++){var Ce=z._global[me];Ce.pred(J,this)&&ge(k,Ce.val)==-1&&k.push(Ce.val)}return k},getStateAfter:function(n,s){var k=this.doc;return n=B(k,n==null?k.first+k.size-1:n),Ye(this,n+1,s).state},cursorCoords:function(n,s){var k,z=this.doc.sel.primary();return n==null?k=z.head:typeof n=="object"?k=d(this.doc,n):k=n?z.from():z.to(),kn(this,k,s||"page")},charCoords:function(n,s){return gr(this,d(this.doc,n),s||"page")},coordsChar:function(n,s){return n=Rn(this,n,s||"page"),Mn(this,n.left,n.top)},lineAtHeight:function(n,s){return n=Rn(this,{top:n,left:0},s||"page").top,Un(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,s,k){var z=!1,J;if(typeof n=="number"){var Z=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>Z&&(n=Z,z=!0),J=Tt(this.doc,n)}else J=n;return Hn(this,J,{top:0,left:0},s||"page",k||z).top+(z?this.doc.height-mr(J):0)},defaultTextHeight:function(){return Dr(this.display)},defaultCharWidth:function(){return Wr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,s,k,z,J){var Z=this.display;n=kn(this,d(this.doc,n));var ee=n.bottom,me=n.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),Z.sizer.appendChild(s),z=="over")ee=n.top;else if(z=="above"||z=="near"){var Ce=Math.max(Z.wrapper.clientHeight,this.doc.height),Ue=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(z=="above"||n.bottom+s.offsetHeight>Ce)&&n.top>s.offsetHeight?ee=n.top-s.offsetHeight:n.bottom+s.offsetHeight<=Ce&&(ee=n.bottom),me+s.offsetWidth>Ue&&(me=Ue-s.offsetWidth)}s.style.top=ee+"px",s.style.left=s.style.right="",J=="right"?(me=Z.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(J=="left"?me=0:J=="middle"&&(me=(Z.sizer.clientWidth-s.offsetWidth)/2),s.style.left=me+"px"),k&&So(this,{left:me,top:ee,right:me+s.offsetWidth,bottom:ee+s.offsetHeight})},triggerOnKeyDown:$r(Qs),triggerOnKeyPress:$r(qs),triggerOnKeyUp:Zs,triggerOnMouseDown:$r(el),execCommand:function(n){if(ho.hasOwnProperty(n))return ho[n].call(null,this)},triggerElectric:$r(function(n){sl(this,n)}),findPosH:function(n,s,k,z){var J=1;s<0&&(J=-1,s=-s);for(var Z=d(this.doc,n),ee=0;ee<s&&!(Z=fs(this.doc,Z,J,k,z),Z.hitSide);++ee);return Z},moveH:$r(function(n,s){var k=this;this.extendSelectionsBy(function(z){return k.display.shift||k.doc.extend||z.empty()?fs(k.doc,z.head,n,s,k.options.rtlMoveVisually):n<0?z.from():z.to()},Xe)}),deleteH:$r(function(n,s){var k=this.doc.sel,z=this.doc;k.somethingSelected()?z.replaceSelection("",null,"+delete"):Na(this,function(J){var Z=fs(z,J.head,n,s,!1);return n<0?{from:Z,to:J.head}:{from:J.head,to:Z}})}),findPosV:function(n,s,k,z){var J=1,Z=z;s<0&&(J=-1,s=-s);for(var ee=d(this.doc,n),me=0;me<s;++me){var Ce=kn(this,ee,"div");if(Z==null?Z=Ce.left:Ce.left=Z,ee=cl(this,Ce,J,k),ee.hitSide)break}return ee},moveV:$r(function(n,s){var k=this,z=this.doc,J=[],Z=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(me){if(Z)return n<0?me.from():me.to();var Ce=kn(k,me.head,"div");me.goalColumn!=null&&(Ce.left=me.goalColumn),J.push(Ce.left);var Ue=cl(k,Ce,n,s);return s=="page"&&me==z.sel.primary()&&$a(k,gr(k,Ue,"div").top-Ce.top),Ue},Xe),J.length)for(var ee=0;ee<z.sel.ranges.length;ee++)z.sel.ranges[ee].goalColumn=J[ee]}),findWordAt:function(n){var s=this.doc,k=Tt(s,n.line).text,z=n.ch,J=n.ch;if(k){var Z=this.getHelper(n,"wordChars");(n.sticky=="before"||J==k.length)&&z?--z:++J;for(var ee=k.charAt(z),me=Ve(ee,Z)?function(Ce){return Ve(Ce,Z)}:/\s/.test(ee)?function(Ce){return/\s/.test(Ce)}:function(Ce){return!/\s/.test(Ce)&&!Ve(Ce)};z>0&&me(k.charAt(z-1));)--z;for(;J<k.length&&me(k.charAt(J));)++J}return new Zn(Je(n.line,z),Je(n.line,J))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),Qe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==b()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$r(function(n,s){ia(this,n,s)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-De(this)-this.display.barHeight,width:n.scrollWidth-De(this)-this.display.barWidth,clientHeight:q(this),clientWidth:pe(this)}},scrollIntoView:$r(function(n,s){n==null?(n={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Je(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=s||0,n.from.line!=null?$o(this,n):fa(this,n.from,n.to,n.margin)}),setSize:$r(function(n,s){var k=this,z=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};n!=null&&(this.display.wrapper.style.width=z(n)),s!=null&&(this.display.wrapper.style.height=z(s)),this.options.lineWrapping&&yn(this);var J=this.display.viewFrom;this.doc.iter(J,this.display.viewTo,function(Z){if(Z.widgets){for(var ee=0;ee<Z.widgets.length;ee++)if(Z.widgets[ee].noHScroll){Cr(k,J,"widget");break}}++J}),this.curOp.forceUpdate=!0,Qe(this,"refresh",this)}),operation:function(n){return si(this,n)},startOperation:function(){return ji(this)},endOperation:function(){return Yi(this)},refresh:$r(function(){var n=this.display.cachedTextHeight;sr(this),this.curOp.forceUpdate=!0,Cn(this),ia(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(n==null||Math.abs(n-Dr(this.display))>.5||this.options.lineWrapping)&&oi(this),Qe(this,"refresh",this)}),swapDoc:$r(function(n){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),gs(this,n),Cn(this),this.display.input.reset(),ia(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Or(this,"swapDoc",this,s),s}),phrase:function(n){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,n)?s[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Se(e),e.registerHelper=function(n,s,k){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][s]=k},e.registerGlobalHelper=function(n,s,k,z){e.registerHelper(n,s,z),r[n]._global.push({pred:k,val:z})}}function fs(e,t,r,n,s){var k=t,z=r,J=Tt(e,t.line),Z=s&&e.direction=="rtl"?-r:r;function ee(){var jt=t.line+Z;return jt<e.first||jt>=e.first+e.size?!1:(t=new Je(jt,t.ch,t.sticky),J=Tt(e,jt))}function me(jt){var Rt;if(n=="codepoint"){var Vt=J.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Vt)?Rt=null:Rt=new Je(t.line,Math.max(0,Math.min(J.text.length,t.ch+r*(Vt>=55296&&Vt<56320?2:1))),-r)}else s?Rt=Pl(e.cm,J,t,r):Rt=os(J,t,r);if(Rt==null)if(!jt&&ee())t=ss(s,e.cm,J,t.line,Z);else return!1;else t=Rt;return!0}if(n=="char"||n=="codepoint")me();else if(n=="column")me(!0);else if(n=="word"||n=="group")for(var Ce=null,Ue=n=="group",Pe=e.cm&&e.cm.getHelper(t,"wordChars"),nt=!0;!(r<0&&!me(!nt));nt=!1){var lt=J.text.charAt(t.ch)||`
`,bt=Ve(lt,Pe)?"w":Ue&&lt==`
`?"n":!Ue||/\s/.test(lt)?null:"p";if(Ue&&!nt&&!bt&&(bt="s"),Ce&&Ce!=bt){r<0&&(r=1,me(),t.sticky="after");break}if(bt&&(Ce=bt),r>0&&!me(!nt))break}var Lt=Io(e,t,k,z,!0);return Xt(k,Lt)&&(Lt.hitSide=!0),Lt}function cl(e,t,r,n){var s=e.doc,k=t.left,z;if(n=="page"){var J=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(J-.5*Dr(e.display),3);z=(r>0?t.bottom:t.top)+r*Z}else n=="line"&&(z=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=Mn(e,k,z),!ee.outside);){if(r<0?z<=0:z>=s.height){ee.hitSide=!0;break}z+=r*5}return ee}var lr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ue,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};lr.prototype.init=function(e){var t=this,r=this,n=r.cm,s=r.div=e.lineDiv;ul(s,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function k(J){for(var Z=J.target;Z;Z=Z.parentNode){if(Z==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}We(s,"paste",function(J){if(!k(J)||ot(n,J)||ol(J,n))return;N<=11&&setTimeout(Mr(n,function(){return t.updateFromDOM()}),20)}),We(s,"compositionstart",function(J){t.composing={data:J.data,done:!1}}),We(s,"compositionupdate",function(J){t.composing||(t.composing={data:J.data,done:!1})}),We(s,"compositionend",function(J){t.composing&&(J.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),We(s,"touchstart",function(){return r.forceCompositionEnd()}),We(s,"input",function(){t.composing||t.readFromDOMSoon()});function z(J){if(!k(J)||ot(n,J))return;if(n.somethingSelected())Wo({lineWise:!1,text:n.getSelections()}),J.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var Z=ll(n);Wo({lineWise:!0,text:Z.text}),J.type=="cut"&&n.operation(function(){n.setSelections(Z.ranges,0,Ke),n.replaceSelection("",null,"cut")})}else return;if(J.clipboardData){J.clipboardData.clearData();var ee=Mi.text.join(`
`);if(J.clipboardData.setData("Text",ee),J.clipboardData.getData("Text")==ee){J.preventDefault();return}}var me=dl(),Ce=me.firstChild;n.display.lineSpace.insertBefore(me,n.display.lineSpace.firstChild),Ce.value=Mi.text.join(`
`);var Ue=document.activeElement;Q(Ce),setTimeout(function(){n.display.lineSpace.removeChild(me),Ue.focus(),Ue==s&&r.showPrimarySelection()},50)}We(s,"copy",z),We(s,"cut",z)},lr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},lr.prototype.prepareSelection=function(){var e=Ai(this.cm,!1);return e.focus=document.activeElement==this.div,e},lr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},lr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},lr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),s=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var k=Ho(t,e.anchorNode,e.anchorOffset),z=Ho(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&z&&!z.bad&&vt(qt(k,z),n)==0&&vt(Bt(k,z),s)==0)return;var J=t.display.view,Z=n.line>=t.display.viewFrom&&hl(t,n)||{node:J[0].measure.map[2],offset:0},ee=s.line<t.display.viewTo&&hl(t,s);if(!ee){var me=J[J.length-1].measure,Ce=me.maps?me.maps[me.maps.length-1]:me.map;ee={node:Ce[Ce.length-1],offset:Ce[Ce.length-2]-Ce[Ce.length-3]}}if(!Z||!ee){e.removeAllRanges();return}var Ue=e.rangeCount&&e.getRangeAt(0),Pe;try{Pe=S(Z.node,Z.offset,ee.offset,ee.node)}catch(nt){}Pe&&(!M&&t.state.focused?(e.collapse(Z.node,Z.offset),Pe.collapsed||(e.removeAllRanges(),e.addRange(Pe))):(e.removeAllRanges(),e.addRange(Pe)),Ue&&e.anchorNode==null?e.addRange(Ue):M&&this.startGracePeriod()),this.rememberSelection()},lr.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)},lr.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},lr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},lr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return w(this.div,t)},lr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},lr.prototype.blur=function(){this.div.blur()},lr.prototype.getField=function(){return this.div},lr.prototype.supportsTouch=function(){return!0},lr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():si(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)},lr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},lr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(a&&c&&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=Ho(t,e.anchorNode,e.anchorOffset),n=Ho(t,e.focusNode,e.focusOffset);r&&n&&si(t,function(){ei(t.doc,Ri(r,n),Ke),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},lr.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),s=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Je(n.line-1,Tt(e.doc,n.line-1).length)),s.ch==Tt(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=Je(s.line+1,0)),n.line<t.viewFrom||s.line>t.viewTo-1)return!1;var k,z,J;n.line==t.viewFrom||(k=dr(e,n.line))==0?(z=Jt(t.view[0].line),J=t.view[0].node):(z=Jt(t.view[k].line),J=t.view[k-1].node.nextSibling);var Z=dr(e,s.line),ee,me;if(Z==t.view.length-1?(ee=t.viewTo-1,me=t.lineDiv.lastChild):(ee=Jt(t.view[Z+1].line)-1,me=t.view[Z+1].node.previousSibling),!J)return!1;for(var Ce=e.doc.splitLines(tu(e,J,me,z,ee)),Ue=zn(e.doc,Je(z,0),Je(ee,Tt(e.doc,ee).text.length));Ce.length>1&&Ue.length>1;)if(Re(Ce)==Re(Ue))Ce.pop(),Ue.pop(),ee--;else if(Ce[0]==Ue[0])Ce.shift(),Ue.shift(),z++;else break;for(var Pe=0,nt=0,lt=Ce[0],bt=Ue[0],Lt=Math.min(lt.length,bt.length);Pe<Lt&&lt.charCodeAt(Pe)==bt.charCodeAt(Pe);)++Pe;for(var jt=Re(Ce),Rt=Re(Ue),Vt=Math.min(jt.length-(Ce.length==1?Pe:0),Rt.length-(Ue.length==1?Pe:0));nt<Vt&&jt.charCodeAt(jt.length-nt-1)==Rt.charCodeAt(Rt.length-nt-1);)++nt;if(Ce.length==1&&Ue.length==1&&z==n.line)for(;Pe&&Pe>n.ch&&jt.charCodeAt(jt.length-nt-1)==Rt.charCodeAt(Rt.length-nt-1);)Pe--,nt++;Ce[Ce.length-1]=jt.slice(0,jt.length-nt).replace(/^\u200b+/,""),Ce[0]=Ce[0].slice(Pe).replace(/\u200b+$/,"");var fn=Je(z,Pe),rn=Je(ee,Ue.length?Re(Ue).length-nt:0);if(Ce.length>1||Ce[0]||vt(fn,rn))return Ma(e.doc,Ce,fn,rn,"+input"),!0},lr.prototype.ensurePolled=function(){this.forceCompositionEnd()},lr.prototype.reset=function(){this.forceCompositionEnd()},lr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},lr.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)},lr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&si(this.cm,function(){return sr(e.cm)})},lr.prototype.setUneditable=function(e){e.contentEditable="false"},lr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Mr(this.cm,hs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},lr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},lr.prototype.onContextMenu=function(){},lr.prototype.resetPosition=function(){},lr.prototype.needsContentAttribute=!0;function hl(e,t){var r=ke(e,t.line);if(!r||r.hidden)return null;var n=Tt(e.doc,t.line),s=ne(r,n,t.line),k=wt(n,e.doc.direction),z="left";if(k){var J=ct(k,t.ch);z=J%2?"right":"left"}var Z=ft(s.map,t.ch,z);return Z.offset=Z.collapse=="right"?Z.end:Z.start,Z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ba(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,s){var k="",z=!1,J=e.doc.lineSeparator(),Z=!1;function ee(Pe){return function(nt){return nt.id==Pe}}function me(){z&&(k+=J,Z&&(k+=J),z=Z=!1)}function Ce(Pe){Pe&&(me(),k+=Pe)}function Ue(Pe){if(Pe.nodeType==1){var nt=Pe.getAttribute("cm-text");if(nt){Ce(nt);return}var lt=Pe.getAttribute("cm-marker"),bt;if(lt){var Lt=e.findMarks(Je(n,0),Je(s+1,0),ee(+lt));Lt.length&&(bt=Lt[0].find(0))&&Ce(zn(e.doc,bt.from,bt.to).join(J));return}if(Pe.getAttribute("contenteditable")=="false")return;var jt=/^(pre|div|p|li|table|br)$/i.test(Pe.nodeName);if(!/^br$/i.test(Pe.nodeName)&&Pe.textContent.length==0)return;jt&&me();for(var Rt=0;Rt<Pe.childNodes.length;Rt++)Ue(Pe.childNodes[Rt]);/^(pre|p)$/i.test(Pe.nodeName)&&(Z=!0),jt&&(z=!0)}else Pe.nodeType==3&&Ce(Pe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ue(t),t==r);)t=t.nextSibling,Z=!1;return k}function Ho(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Ba(e.clipPos(Je(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var s=0;s<e.display.view.length;s++){var k=e.display.view[s];if(k.node==n)return nu(k,t,r)}}function nu(e,t,r){var n=e.text.firstChild,s=!1;if(!t||!w(n,t))return Ba(Je(Jt(e.line),0),!0);if(t==n&&(s=!0,t=n.childNodes[r],r=0,!t)){var k=e.rest?Re(e.rest):e.line;return Ba(Je(Jt(k),k.text.length),s)}var z=t.nodeType==3?t:null,J=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,r&&(r=z.nodeValue.length));J.parentNode!=n;)J=J.parentNode;var Z=e.measure,ee=Z.maps;function me(bt,Lt,jt){for(var Rt=-1;Rt<(ee?ee.length:0);Rt++)for(var Vt=Rt<0?Z.map:ee[Rt],fn=0;fn<Vt.length;fn+=3){var rn=Vt[fn+2];if(rn==bt||rn==Lt){var On=Jt(Rt<0?e.line:e.rest[Rt]),cr=Vt[fn]+jt;return(jt<0||rn!=bt)&&(cr=Vt[fn+(jt?1:0)]),Je(On,cr)}}}var Ce=me(z,J,r);if(Ce)return Ba(Ce,s);for(var Ue=J.nextSibling,Pe=z?z.nodeValue.length-r:0;Ue;Ue=Ue.nextSibling){if(Ce=me(Ue,Ue.firstChild,0),Ce)return Ba(Je(Ce.line,Ce.ch-Pe),s);Pe+=Ue.textContent.length}for(var nt=J.previousSibling,lt=r;nt;nt=nt.previousSibling){if(Ce=me(nt,nt.firstChild,-1),Ce)return Ba(Je(Ce.line,Ce.ch+lt),s);lt+=nt.textContent.length}}var Ir=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ue,this.hasSelection=!1,this.composing=null};Ir.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(s.style.width="0px"),We(s,"input",function(){j&&N>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),We(s,"paste",function(z){if(ot(n,z)||ol(z,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function k(z){if(ot(n,z))return;if(n.somethingSelected())Wo({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var J=ll(n);Wo({lineWise:!0,text:J.text}),z.type=="cut"?n.setSelections(J.ranges,null,Ke):(r.prevInput="",s.value=J.text.join(`
`),Q(s))}else return;z.type=="cut"&&(n.state.cutIncoming=+new Date)}We(s,"cut",k),We(s,"copy",k),We(e.scroller,"paste",function(z){if(Di(e,z)||ot(n,z))return;if(!s.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var J=new Event("paste");J.clipboardData=z.clipboardData,s.dispatchEvent(J)}),We(e.lineSpace,"selectstart",function(z){Di(e,z)||re(z)}),We(s,"compositionstart",function(){var z=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:z,range:n.markText(z,n.getCursor("to"),{className:"CodeMirror-composing"})}}),We(s,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ir.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},Ir.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ir.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Ai(e);if(e.options.moveInputWithCursor){var s=kn(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+z.top-k.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+z.left-k.left))}return n},Ir.prototype.showSelection=function(e){var t=this.cm,r=t.display;h(r.cursorDiv,e.cursors),h(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ir.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&&Q(this.textarea),j&&N>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",j&&N>=9&&(this.hasSelection=null))},Ir.prototype.getField=function(){return this.textarea},Ir.prototype.supportsTouch=function(){return!1},Ir.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||b()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ir.prototype.blur=function(){this.textarea.blur()},Ir.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ir.prototype.receivedFocus=function(){this.slowPoll()},Ir.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()})},Ir.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Ir.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||$e(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=r.value;if(s==n&&!t.somethingSelected())return!1;if(j&&N>=9&&this.hasSelection===s||o&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=s.charCodeAt(0);if(k==8203&&!n&&(n="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,J=Math.min(n.length,s.length);z<J&&n.charCodeAt(z)==s.charCodeAt(z);)++z;return si(t,function(){hs(t,s.slice(z),n.length-z,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ir.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ir.prototype.onKeyPress=function(){j&&N>=9&&(this.hasSelection=null),this.fastPoll()},Ir.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Hr(r,e),z=n.scroller.scrollTop;if(!k||f)return;var J=r.options.resetSelectionOnContextMenu;J&&r.doc.sel.contains(k)==-1&&Mr(r,ei)(r.doc,Ri(k),Ke);var Z=s.style.cssText,ee=t.wrapper.style.cssText,me=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-me.top-5)+"px; left: "+(e.clientX-me.left-5)+`px;
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Ce;P&&(Ce=window.scrollY),n.input.focus(),P&&window.scrollTo(null,Ce),n.input.reset(),r.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=Pe,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Ue(){if(s.selectionStart!=null){var lt=r.somethingSelected(),bt="\u200B"+(lt?s.value:"");s.value="\u21DA",s.value=bt,t.prevInput=lt?"":"\u200B",s.selectionStart=1,s.selectionEnd=bt.length,n.selForContextMenu=r.doc.sel}}function Pe(){if(t.contextMenuPending!=Pe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,s.style.cssText=Z,j&&N<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=z),s.selectionStart!=null){(!j||j&&N<9)&&Ue();var lt=0,bt=function(){n.selForContextMenu==r.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="\u200B"?Mr(r,Ls)(r):lt++<10?n.detectingSelectAll=setTimeout(bt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(bt,200)}}if(j&&N>=9&&Ue(),L){Ee(e);var nt=function(){Ut(window,"mouseup",nt),setTimeout(Pe,20)};We(window,"mouseup",nt)}else setTimeout(Pe,50)},Ir.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ir.prototype.setUneditable=function(){},Ir.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?W(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=b();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=J.getValue()}var s;if(e.form&&(We(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var k=e.form;s=k.submit;try{var z=k.submit=function(){n(),k.submit=s,k.submit(),k.submit=z}}catch(Z){}}t.finishInit=function(Z){Z.save=n,Z.getTextArea=function(){return e},Z.toTextArea=function(){Z.toTextArea=isNaN,n(),e.parentNode.removeChild(Z.getWrapperElement()),e.style.display="",e.form&&(Ut(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var J=Sr(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return J}function iu(e){e.off=Ut,e.on=We,e.wheelEventPixels=qa,e.Doc=fi,e.splitLines=_t,e.countColumn=te,e.findColumn=Fe,e.isWordChar=Le,e.Pass=qe,e.signal=Qe,e.Line=Tr,e.changeEnd=ki,e.scrollbarModel=Ja,e.Pos=Je,e.cmpPos=vt,e.modes=ln,e.mimeModes=Ht,e.resolveMode=kt,e.getMode=Mt,e.modeExtensions=mt,e.extendMode=It,e.copyState=un,e.startState=Zt,e.innerMode=pn,e.commands=ho,e.keyMap=Qi,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=Ia,e.normalizeKeyMap=Ml,e.StringStream=zt,e.SharedTextMarker=lo,e.TextMarker=ua,e.LineWidget=so,e.e_preventDefault=re,e.e_stopPropagation=ae,e.e_stop=Ee,e.addClass=K,e.contains=w,e.rmClass=T,e.keyNames=da}$l(Sr),ql(Sr);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ko in fi.prototype)fi.prototype.hasOwnProperty(Ko)&&ge(au,Ko)<0&&(Sr.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(fi.prototype[Ko]));return Se(fi),Sr.inputStyles={textarea:Ir,contenteditable:lr},Sr.defineMode=function(e){!Sr.defaults.mode&&e!="null"&&(Sr.defaults.mode=e),an.apply(this,arguments)},Sr.defineMIME=gn,Sr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Sr.defineMIME("text/plain","null"),Sr.defineExtension=function(e,t){Sr.prototype[e]=t},Sr.defineDocExtension=function(e,t){fi.prototype[e]=t},Sr.fromTextArea=ru,iu(Sr),Sr.version="5.58.2",Sr})},Y1PL:function(Wt,Me,$){"use strict";$.r(Me),$.d(Me,"ResizableTextArea",function(){return ge});var ie=$("wx14"),Y=$("1OyB"),M=$("vuIU"),H=$("Ji7U"),O=$("LK+K"),I=$("q1tI"),j=$("VTBJ"),N=$("rePB"),P=$("Zm9Q"),R=$("Kwbf"),c=$("c+Xe"),f=$("m+aA"),_=$("bdgK"),p=new Map;function m(Ke){Ke.forEach(function(Be){var Xe,Fe=Be.target;(Xe=p.get(Fe))===null||Xe===void 0||Xe.forEach(function(xe){return xe(Fe)})})}var y=new _.default(m),a=null,i=null;function o(Ke,Be){p.has(Ke)||(p.set(Ke,new Set),y.observe(Ke)),p.get(Ke).add(Be)}function l(Ke,Be){p.has(Ke)&&(p.get(Ke).delete(Be),p.get(Ke).size||(y.unobserve(Ke),p.delete(Ke)))}var C=function(Ke){Object(H.a)(Xe,Ke);var Be=Object(O.a)(Xe);function Xe(){return Object(Y.a)(this,Xe),Be.apply(this,arguments)}return Object(M.a)(Xe,[{key:"render",value:function(){return this.props.children}}]),Xe}(I.Component),g=I.createContext(null);function v(Ke){var Be=Ke.children,Xe=Ke.onBatchResize,Fe=I.useRef(0),xe=I.useRef([]),oe=I.useContext(g),Re=I.useCallback(function(dt,at,ut){Fe.current+=1;var ce=Fe.current;xe.current.push({size:dt,element:at,data:ut}),Promise.resolve().then(function(){ce===Fe.current&&(Xe==null||Xe(xe.current),xe.current=[])}),oe==null||oe(dt,at,ut)},[Xe,oe]);return I.createElement(g.Provider,{value:Re},Be)}function L(Ke){var Be=Ke.children,Xe=Ke.disabled,Fe=I.useRef(null),xe=I.useRef(null),oe=I.useContext(g),Re=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),dt=I.isValidElement(Be)&&Object(c.c)(Be),at=dt?Be.ref:null,ut=I.useMemo(function(){return Object(c.a)(at,Fe)},[at,Fe]),ce=I.useRef(Ke);ce.current=Ke;var he=I.useCallback(function(Le){var Ve=ce.current,et=Ve.onResize,tt=Ve.data,rt=Le.getBoundingClientRect(),it=rt.width,Dt=rt.height,Et=Le.offsetWidth,xt=Le.offsetHeight,ct=Math.floor(it),Ft=Math.floor(Dt);if(Re.current.width!==ct||Re.current.height!==Ft||Re.current.offsetWidth!==Et||Re.current.offsetHeight!==xt){var wt={width:ct,height:Ft,offsetWidth:Et,offsetHeight:xt};Re.current=wt;var Pt=Et===Math.round(it)?it:Et,We=xt===Math.round(Dt)?Dt:xt,gt=Object(j.a)(Object(j.a)({},wt),{},{offsetWidth:Pt,offsetHeight:We});oe==null||oe(gt,Le,tt),et&&Promise.resolve().then(function(){et(gt,Le)})}},[]);return I.useEffect(function(){var Le=Object(f.a)(Fe.current)||Object(f.a)(xe.current);return Le&&!Xe&&o(Le,he),function(){return l(Le,he)}},[Fe.current,Xe]),I.createElement(C,{ref:xe},dt?I.cloneElement(Be,{ref:ut}):Be)}var A="rc-observer-key";function T(Ke){var Be=Ke.children,Xe=Object(P.a)(Be);return Xe.map(function(Fe,xe){var oe=(Fe==null?void 0:Fe.key)||"".concat(A,"-").concat(xe);return I.createElement(L,Object(ie.a)({},Ke,{key:oe}),Fe)})}T.Collection=v;var x=T,h=$("bT9E"),u=$("TSYQ"),D=$.n(u),S=`
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
`,w=["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"],b={},K;function X(Ke){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Xe=Ke.getAttribute("id")||Ke.getAttribute("data-reactid")||Ke.getAttribute("name");if(Be&&b[Xe])return b[Xe];var Fe=window.getComputedStyle(Ke),xe=Fe.getPropertyValue("box-sizing")||Fe.getPropertyValue("-moz-box-sizing")||Fe.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(Fe.getPropertyValue("padding-bottom"))+parseFloat(Fe.getPropertyValue("padding-top")),Re=parseFloat(Fe.getPropertyValue("border-bottom-width"))+parseFloat(Fe.getPropertyValue("border-top-width")),dt=w.map(function(ut){return"".concat(ut,":").concat(Fe.getPropertyValue(ut))}).join(";"),at={sizingStyle:dt,paddingSize:oe,borderSize:Re,boxSizing:xe};return Be&&Xe&&(b[Xe]=at),at}function Q(Ke){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Xe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;K||(K=document.createElement("textarea"),K.setAttribute("tab-index","-1"),K.setAttribute("aria-hidden","true"),document.body.appendChild(K)),Ke.getAttribute("wrap")?K.setAttribute("wrap",Ke.getAttribute("wrap")):K.removeAttribute("wrap");var xe=X(Ke,Be),oe=xe.paddingSize,Re=xe.borderSize,dt=xe.boxSizing,at=xe.sizingStyle;K.setAttribute("style","".concat(at,";").concat(S)),K.value=Ke.value||Ke.placeholder||"";var ut=Number.MIN_SAFE_INTEGER,ce=Number.MAX_SAFE_INTEGER,he=K.scrollHeight,Le;if(dt==="border-box"?he+=Re:dt==="content-box"&&(he-=oe),Xe!==null||Fe!==null){K.value=" ";var Ve=K.scrollHeight-oe;Xe!==null&&(ut=Ve*Xe,dt==="border-box"&&(ut=ut+oe+Re),he=Math.max(ut,he)),Fe!==null&&(ce=Ve*Fe,dt==="border-box"&&(ce=ce+oe+Re),Le=he>ce?"":"hidden",he=Math.min(ce,he))}return{height:he,minHeight:ut,maxHeight:ce,overflowY:Le,resize:"none"}}var V=$("Gytx"),W=$.n(V),te;(function(Ke){Ke[Ke.NONE=0]="NONE",Ke[Ke.RESIZING=1]="RESIZING",Ke[Ke.RESIZED=2]="RESIZED"})(te||(te={}));var ue=function(Ke){Object(H.a)(Xe,Ke);var Be=Object(O.a)(Xe);function Xe(Fe){var xe;return Object(Y.a)(this,Xe),xe=Be.call(this,Fe),xe.nextFrameActionId=void 0,xe.resizeFrameId=void 0,xe.textArea=void 0,xe.saveTextArea=function(oe){xe.textArea=oe},xe.handleResize=function(oe){var Re=xe.state.resizeStatus,dt=xe.props,at=dt.autoSize,ut=dt.onResize;if(Re!==te.NONE)return;typeof ut=="function"&&ut(oe),at&&xe.resizeOnNextFrame()},xe.resizeOnNextFrame=function(){cancelAnimationFrame(xe.nextFrameActionId),xe.nextFrameActionId=requestAnimationFrame(xe.resizeTextarea)},xe.resizeTextarea=function(){var oe=xe.props.autoSize;if(!oe||!xe.textArea)return;var Re=oe.minRows,dt=oe.maxRows,at=Q(xe.textArea,!1,Re,dt);xe.setState({textareaStyles:at,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(xe.resizeFrameId),xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:te.RESIZED},function(){xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:te.NONE}),xe.fixFirefoxAutoScroll()})})})})},xe.renderTextArea=function(){var oe=xe.props,Re=oe.prefixCls,dt=Re===void 0?"rc-textarea":Re,at=oe.autoSize,ut=oe.onResize,ce=oe.className,he=oe.disabled,Le=xe.state,Ve=Le.textareaStyles,et=Le.resizeStatus,tt=Object(h.a)(xe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),rt=D()(dt,ce,Object(N.a)({},"".concat(dt,"-disabled"),he));"value"in tt&&(tt.value=tt.value||"");var it=Object(j.a)(Object(j.a)(Object(j.a)({},xe.props.style),Ve),et===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(x,{onResize:xe.handleResize,disabled:!(at||ut)},I.createElement("textarea",Object(ie.a)({},tt,{className:rt,style:it,ref:xe.saveTextArea})))},xe.state={textareaStyles:{},resizeStatus:te.NONE},xe}return Object(M.a)(Xe,[{key:"componentDidUpdate",value:function(xe){(xe.value!==this.props.value||!W()(xe.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 xe=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(xe,oe)}}catch(Re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Xe}(I.Component),ge=ue,Oe=function(Ke){Object(H.a)(Xe,Ke);var Be=Object(O.a)(Xe);function Xe(Fe){var xe;Object(Y.a)(this,Xe),xe=Be.call(this,Fe),xe.resizableTextArea=void 0,xe.focus=function(){xe.resizableTextArea.textArea.focus()},xe.saveTextArea=function(Re){xe.resizableTextArea=Re},xe.handleChange=function(Re){var dt=xe.props.onChange;xe.setValue(Re.target.value,function(){xe.resizableTextArea.resizeTextarea()}),dt&&dt(Re)},xe.handleKeyDown=function(Re){var dt=xe.props,at=dt.onPressEnter,ut=dt.onKeyDown;Re.keyCode===13&&at&&at(Re),ut&&ut(Re)};var oe=typeof Fe.value=="undefined"||Fe.value===null?Fe.defaultValue:Fe.value;return xe.state={value:oe},xe}return Object(M.a)(Xe,[{key:"setValue",value:function(xe,oe){"value"in this.props||this.setState({value:xe},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(ge,Object(ie.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(xe){return"value"in xe?{value:xe.value}:null}}]),Xe}(I.Component),qe=Me.default=Oe},ZW9T:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return x});var ie=$("k1fw"),Y=$("oBTY"),M=$("9og8"),H=$("miYZ"),O=$("tsqr"),I=$("rAM+"),j=$("tJVT"),N=$("PpiC"),P=$("WmNS"),R=$.n(P),c=$("q1tI"),f=$.n(c),_=$("bdgK");function p(h,u,D,S,w){var b=u.getWordUntilPosition(D),K={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},X=S.map(function(Q){return{label:Q,kind:h.languages.CompletionItemKind.Keyword,insertText:Q,insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:K}});return w.map(function(Q){X.push(Object(ie.a)(Object(ie.a)({},Q),{},{range:K}))}),X}var m=function(h){var u={label:"ifelse",kind:h.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];h.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(K,X){var Q=p(h,K,X,D,[u]);return{suggestions:Q}}});var S=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];h.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(K,X){var Q=[{label:"print",kind:h.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],V=p(h,K,X,S,Q);return{suggestions:V}}});var w=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];h.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(K,X){var Q=[u,{label:"main",kind:h.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:h.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],V=p(h,K,X,w,Q);return{suggestions:V}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=$("fjLI"),i=$("LvDl"),o=$("+ua5");function l(h){return/^\d+$/.test(h)?"".concat(h,"px"):h}function C(){}var g=!1,v={"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",Scala:"scale"};function L(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=h;if(Array.isArray(h)){for(var D=0;D<h.length;D++){var S=v[h[D]];if(S)return S}return u[0]}return v[u]||u}var A=null,T=Me.b=function(h){var u=h.width,D=u===void 0?"100%":u,S=h.height,w=S===void 0?"100%":S,b=h.value,K=h.language,X=K===void 0?"javascript":K,Q=h.style,V=Q===void 0?{}:Q,W=h.options,te=W===void 0?{}:W,ue=h.overrideServices,ge=ue===void 0?{}:ue,Oe=h.theme,qe=Oe===void 0?"vs-dark":Oe,Ke=h.onEditBlur,Be=h.onSave,Xe=h.autoHeight,Fe=Xe===void 0?!1:Xe,xe=h.forbidCopy,oe=xe===void 0?!1:xe,Re=h.onChange,dt=Re===void 0?C:Re,at=h.editorDidMount,ut=at===void 0?C:at,ce=h.onFocus,he=ce===void 0?C:ce,Le=h.onBreakPoint,Ve=Le===void 0?C:Le,et=h.breakPointValue,tt=et===void 0?[]:et,rt=h.filename,it=rt===void 0?"educoder.txt":rt,Dt=h.errorLine,Et=h.errorContent,xt=Et===void 0?"":Et,ct=h.highlightLine,Ft=h.openBreakPoint,wt=Ft===void 0?!1:Ft,Pt=Object(N.a)(h,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),We=Object(c.useRef)(),gt=Object(c.useRef)({}),Ut=Object(c.useRef)(),Qe=Object(c.useRef)(),ot=Object(c.useRef)([]),Ae=Object(c.useRef)(!1),be=Object(c.useRef)(),Se=Object(c.useState)(!1),re=Object(j.a)(Se,2),ae=re[0],fe=re[1];function Ee(){var Mt;return We.current&&(Mt=new _.default(function(mt){var It=Object(I.a)(mt),un;try{for(It.s();!(un=It.n()).done;){var pn=un.value;(pn.target.offsetHeight>0||pn.target.offsetWidth>0)&&gt.current.instance.layout()}}catch(Zt){It.e(Zt)}finally{It.f()}}),Mt.observe(We.current)),Mt}function je(){O.b.warn({content:decodeURIComponent(y),key:"monaco-editor-tip"})}var Te=function(){var mt=gt.current.instance;if(b!=null&&mt&&ae){var It=mt.getModel();It&&b!==It.getValue()&&(g=!0,It.setValue(b),mt.layout(),g=!1)}};Object(c.useEffect)(function(){try{var Mt,mt=gt.current.instance;Qe.current&&clearTimeout(Qe.current),Qe.current=setTimeout(function(){Te()},500),mt==null||((Mt=mt.updateOptions)===null||Mt===void 0)||Mt.call(mt,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(b.split(/\r\n|\r|\n/g).length))+3,5)})}catch(It){debugger}},[b,ae,gt.current]),Object(c.useEffect)(function(){try{if(Dt&&gt.current&&gt.current.instance){var Mt=gt.current.instance;Mt.changeViewZones(function(It){var un=document.createElement("div");un.style.padding="10px 20px",un.style.width="calc(100% - 20px)",un.className="my-error-line-wrp",un.innerHTML=xt,It.addZone({afterLineNumber:Dt||11,heightInLines:3,domNode:un})});var mt={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}};Mt.addOverlayWidget(mt),Mt.revealPositionInCenter({lineNumber:20,column:1})}}catch(It){debugger}},[Dt,gt.current,ae]),Object(c.useEffect)(function(){var Mt;if((Mt=gt.current)!==null&&Mt!==void 0&&Mt.instance&&ae&&wt){var mt=gt.current.instance,It=mt.getModel();if(!It)return;var un=function(){var vt=[],Xt=[],Gt=It.getAllDecorations(),Bt=Object(I.a)(Gt),qt;try{for(Bt.s();!(qt=Bt.n()).done;){var B=qt.value;if(B.options.className==="highlighted-line"){var d;vt.push(B==null||((d=B.range)===null||d===void 0)?void 0:d.startLineNumber),Xt.push(B==null?void 0:B.id)}}}catch(F){Bt.e(F)}finally{Bt.f()}It.deltaDecorations(Xt,[]);var E=It.getLineCount();!!ct&&ct<=E&&(mt.deltaDecorations([],[{range:new A.Range(ct,1,ct,It.getLineMaxColumn(ct)),options:{isWholeLine:!0,className:"highlighted-line"}}]),mt.revealLineInCenter(ct))};un();var pn=function(){var vt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Xt=[],Gt=[],Bt=It.getAllDecorations(),qt=Object(I.a)(Bt),B;try{for(qt.s();!(B=qt.n()).done;){var d=B.value;if(d.options.linesDecorationsClassName==="breakpoints"){var E;Xt.push(d==null||((E=d.range)===null||E===void 0)?void 0:E.startLineNumber),Gt.push(d==null?void 0:d.id)}}}catch(F){qt.e(F)}finally{qt.f()}if(vt)return{lines:Xt,ids:Gt};Ve(Xt)},Zt=function(){var Je=Object(M.a)(R.a.mark(function vt(Xt){var Gt;return R.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return Gt={range:new A.Range(Xt,1,Xt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},qt.next=3,It.deltaDecorations([],[Gt]);case 3:pn();case 4:case"end":return qt.stop()}},vt)}));return function(Xt){return Je.apply(this,arguments)}}(),zt=function(){var Je=Object(M.a)(R.a.mark(function vt(Xt){var Gt,Bt,qt,B,d;return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:Gt=[],Bt=mt.getLineDecorations(Xt),qt=Object(I.a)(Bt);try{for(qt.s();!(B=qt.n()).done;)d=B.value,d.options.linesDecorationsClassName==="breakpoints"&&Gt.push(d.id)}catch(G){qt.e(G)}finally{qt.f()}return F.next=6,It.deltaDecorations(Gt,[]);case 6:pn();case 7:case"end":return F.stop()}},vt)}));return function(Xt){return Je.apply(this,arguments)}}(),Tt=function(vt){var Xt=mt.getLineDecorations(vt),Gt=Object(I.a)(Xt),Bt;try{for(Gt.s();!(Bt=Gt.n()).done;){var qt=Bt.value;if(qt.options.linesDecorationsClassName==="breakpoints")return!0}}catch(B){Gt.e(B)}finally{Gt.f()}return!1};if(!Object(i.isEqual)(tt,pn(!0).lines)){It.deltaDecorations(pn(!0).ids,[]);var zn=tt.map(function(Je){return{range:new A.Range(Je,1,Je,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});It.deltaDecorations([],zn)}var Pn=mt.onDidChangeModelContent(function(Je){var vt=mt.getPosition();if(vt){var Xt=vt.lineNumber;It.getLineContent(Xt).trim()===""?zt(Xt):Tt(Xt)&&(zt(Xt),Zt(Xt))}}),Dn=mt.onMouseDown(function(Je){var vt,Xt,Gt;if(Je.target.detail&&(vt=Je.target)!==null&&vt!==void 0&&(Xt=vt.element)!==null&&Xt!==void 0&&(Gt=Xt.className)!==null&&Gt!==void 0&&Gt.includes("line-numbers")){var Bt=Je.target.position.lineNumber;if(It.getLineContent(Bt).trim()==="")return;Tt(Bt)?zt(Bt):Zt(Bt)}}),Jt=function(vt){var Xt={range:new A.Range(vt,1,vt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ot.current=mt.deltaDecorations(ot.current,[Xt])},Un=function(){ot.current=mt.deltaDecorations(ot.current,[])},Qn=mt.onMouseMove(function(Je){var vt,Xt,Gt;if(Un(),Je.target.detail&&(vt=Je.target)!==null&&vt!==void 0&&(Xt=vt.element)!==null&&Xt!==void 0&&(Gt=Xt.className)!==null&&Gt!==void 0&&Gt.includes("line-numbers")){var Bt=Je.target.position.lineNumber;if(It.getLineContent(Bt).trim()==="")return;Jt(Bt)}}),Gn=mt.onMouseLeave(function(){Un()});return function(){Pn.dispose(),Dn.dispose(),Qn.dispose(),Gn.dispose()}}},[gt.current,ae,tt,ct,wt]);function Ne(){var Mt=gt.current.instance;if(Mt){var mt=Mt.getSelection(),It=gt.current.pastePos||{},un=new A.Range(It.startLineNumber||mt.endLineNumber,It.startColumn||mt.endColumn,It.endLineNumber||mt.endLineNumber,It.endColumn||mt.endColumn);setTimeout(function(){Mt.executeEdits("",[{range:un,text:""}])},300)}}function st(Mt){(window.navigator.platform.match("Mac")?Mt.metaKey:Mt.ctrlKey)&&Mt.keyCode==83&&(Mt.preventDefault(),Be())}var pt=function(){if(Fe&&gt.current.instance){var mt=gt.current.instance.getContentHeight();gn(mt<w?w:mt)}else gn(w)};function St(Mt){var mt=document.createEvent("MouseEvents");mt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Mt.dispatchEvent(mt)}var $t=function(mt){var It=mt.keyCode,un=mt.ctrlKey,pn=mt.metaKey,Zt=mt.target,zt=mt.type;return(zt==="paste"||(It===67||It===86)&&(pn||un))&&Zt.nodeName==="TEXTAREA"&&(je(),mt.preventDefault()),!1};function _t(Mt,mt){var It=window.URL||window.webkitURL||window,un=new Blob([mt]),pn=document.createElementNS("http://www.w3.org/1999/xhtml","a");pn.href=It.createObjectURL(un),pn.download=Mt,St(pn)}Object(c.useEffect)(function(){pt()},[pt]),Object(c.useEffect)(function(){We.current&&!ae&&$.e(27).then($.t.bind(null,"M/lh",7)).then(function(Mt){try{A=Mt,gt.current.instance=A.editor.create(We.current,{value:b,language:L(X),theme:qe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},ge);var mt=gt.current.instance,It=a.c._menuItems,un=Object(Y.a)(It).find(function(Zt){return Zt[0]._debugName=="EditorContext"});if(ut(mt,A),setTimeout(function(){pt(),gt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){_t(it||"educoder.txt",mt.getValue())}}),mt.getDomNode().addEventListener("input",function(){Ut.current.autoFormat&&mt.getAction("editor.action.formatDocument").run()})},500),gt.current.subscription=mt.onDidChangeModelContent(function(Zt){debugger;Ae.current?clearTimeout(be.current):(pt(),dt(mt.getValue(),Zt)),be.current=setTimeout(function(){Ae.current=!1},500)}),window.Monaco||m(A,L(X)),oe&&(We.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",$t),window.removeEventListener("paste",$t),window.addEventListener("keydown",$t),window.addEventListener("paste",$t)),window.Monaco=A,Ke&&mt.onDidBlurEditorWidget(function(){Ke(mt.getValue())}),he&&mt.onDidFocusEditorText(function(){he(mt.getValue())}),oe)try{window.addEventListener("paste",Ne)}catch(Zt){}var pn=Ee();return fe(!0),function(){var Zt=gt.current.instance;Zt.dispose();var zt=Zt.getModel();zt&&zt.dispose(),gt.current.subscription&&gt.current.subscription.dispose(),oe&&window.removeEventListener("paste",Ne),pn.unobserve(We.current)}}catch(Zt){debugger}})},[]),Object(c.useEffect)(function(){var Mt=gt.current.instance;if(Mt&&ae)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[Be,ae]),Object(c.useEffect)(function(){var Mt=gt.current.instance;if(Mt&&ae){var mt=L(X);A.editor.setModelLanguage(Mt.getModel(),mt)}},[X,ae]),Object(c.useEffect)(function(){var Mt=gt.current.instance;Mt&&ae&&A.editor.setTheme(qe)},[qe,ae]),Object(c.useEffect)(function(){var Mt=gt.current.instance;Ut.current=te,Mt&&ae&&(Mt.updateOptions(Object(ie.a)({},te)),setTimeout(function(){Mt.getModel().updateOptions(Object(ie.a)({},te))},200))},[JSON.stringify(te),ae]),Object(c.useEffect)(function(){var Mt=gt.current.instance;Mt&&ae&&Mt.layout()},[D,w,ae]);var $e=Object(c.useState)(l(D)),bn=Object(j.a)($e,2),ze=bn[0],vn=bn[1],ln=Object(c.useState)(l(w)),Ht=Object(j.a)(ln,2),an=Ht[0],gn=Ht[1],kt=Object(ie.a)(Object(ie.a)({},V),{},{width:ze,height:an});return f.a.createElement("div",{className:"my-monaco-editor",ref:We,style:kt})};function x(h){var u=h.width,D=u===void 0?"100%":u,S=h.height,w=S===void 0?"100%":S,b=h.original,K=h.modified,X=h.language,Q=h.options,V=Q===void 0?{}:Q,W=Object(c.useRef)(),te=Object(c.useState)(null),ue=Object(j.a)(te,2),ge=ue[0],Oe=ue[1];function qe(Fe){var xe;return W.current&&(xe=new _.default(function(oe){var Re=Object(I.a)(oe),dt;try{for(Re.s();!(dt=Re.n()).done;){var at=dt.value;(at.target.offsetHeight>0||at.target.offsetWidth>0)&&Fe.layout()}}catch(ut){Re.e(ut)}finally{Re.f()}}),xe.observe(W.current)),xe}Object(c.useEffect)(function(){return W.current&&$.e(27).then($.t.bind(null,"M/lh",7)).then(function(Fe){A=Fe;var xe=A.editor.createDiffEditor(W.current,Object(ie.a)(Object(ie.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},V),{},{wordWrap:!0}));Oe(xe);var oe=qe(xe);return function(){xe.dispose();var Re=xe.getModel();Re&&Re.dispose(),oe.unobserve(W.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(c.useEffect)(function(){ge&&ge.setModel({original:A.editor.createModel(b,X),modified:A.editor.createModel(K,X)})},[b,K,X,ge]);var Ke=l(D),Be=l(w),Xe={width:Ke,height:Be};return f.a.createElement("div",{className:"my-diff-editor",ref:W,style:Xe})}},ZpRC:function(Wt,Me,$){"use strict";function ie(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function Y(c,f){return(!f||c!=="hidden")&&c!=="visible"&&c!=="clip"}function M(c,f){if(c.clientHeight<c.scrollHeight||c.clientWidth<c.scrollWidth){var _=getComputedStyle(c,null);return Y(_.overflowY,f)||Y(_.overflowX,f)||function(p){var m=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(a){return null}}(p);return!!m&&(m.clientHeight<p.scrollHeight||m.clientWidth<p.scrollWidth)}(c)}return!1}function H(c,f,_,p,m,y,a,i){return y<c&&a>f||y>c&&a<f?0:y<=c&&i<=_||a>=f&&i>=_?y-c-p:a>f&&i<_||y<c&&i>_?a-f+m:0}var O=function(c,f){var _=window,p=f.scrollMode,m=f.block,y=f.inline,a=f.boundary,i=f.skipOverflowHiddenElements,o=typeof a=="function"?a:function(Ve){return Ve!==a};if(!ie(c))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,C=[],g=c;ie(g)&&o(g);){if((g=g.parentElement)===l){C.push(g);break}g!=null&&g===document.body&&M(g)&&!M(document.documentElement)||g!=null&&M(g,i)&&C.push(g)}for(var v=_.visualViewport?_.visualViewport.width:innerWidth,L=_.visualViewport?_.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,x=c.getBoundingClientRect(),h=x.height,u=x.width,D=x.top,S=x.right,w=x.bottom,b=x.left,K=m==="start"||m==="nearest"?D:m==="end"?w:D+h/2,X=y==="center"?b+u/2:y==="end"?S:b,Q=[],V=0;V<C.length;V++){var W=C[V],te=W.getBoundingClientRect(),ue=te.height,ge=te.width,Oe=te.top,qe=te.right,Ke=te.bottom,Be=te.left;if(p==="if-needed"&&D>=0&&b>=0&&w<=L&&S<=v&&D>=Oe&&w<=Ke&&b>=Be&&S<=qe)return Q;var Xe=getComputedStyle(W),Fe=parseInt(Xe.borderLeftWidth,10),xe=parseInt(Xe.borderTopWidth,10),oe=parseInt(Xe.borderRightWidth,10),Re=parseInt(Xe.borderBottomWidth,10),dt=0,at=0,ut="offsetWidth"in W?W.offsetWidth-W.clientWidth-Fe-oe:0,ce="offsetHeight"in W?W.offsetHeight-W.clientHeight-xe-Re:0;if(l===W)dt=m==="start"?K:m==="end"?K-L:m==="nearest"?H(T,T+L,L,xe,Re,T+K,T+K+h,h):K-L/2,at=y==="start"?X:y==="center"?X-v/2:y==="end"?X-v:H(A,A+v,v,Fe,oe,A+X,A+X+u,u),dt=Math.max(0,dt+T),at=Math.max(0,at+A);else{dt=m==="start"?K-Oe-xe:m==="end"?K-Ke+Re+ce:m==="nearest"?H(Oe,Ke,ue,xe,Re+ce,K,K+h,h):K-(Oe+ue/2)+ce/2,at=y==="start"?X-Be-Fe:y==="center"?X-(Be+ge/2)+ut/2:y==="end"?X-qe+oe+ut:H(Be,qe,ge,Fe,oe+ut,X,X+u,u);var he=W.scrollLeft,Le=W.scrollTop;K+=Le-(dt=Math.max(0,Math.min(Le+dt,W.scrollHeight-ue+ce))),X+=he-(at=Math.max(0,Math.min(he+at,W.scrollWidth-ge+ut)))}Q.push({el:W,top:dt,left:at})}return Q};function I(c){return c===Object(c)&&Object.keys(c).length!==0}function j(c,f){f===void 0&&(f="auto");var _="scrollBehavior"in document.body.style;c.forEach(function(p){var m=p.el,y=p.top,a=p.left;m.scroll&&_?m.scroll({top:y,left:a,behavior:f}):(m.scrollTop=y,m.scrollLeft=a)})}function N(c){return c===!1?{block:"end",inline:"nearest"}:I(c)?c:{block:"start",inline:"nearest"}}function P(c,f){var _=!c.ownerDocument.documentElement.contains(c);if(I(f)&&typeof f.behavior=="function")return f.behavior(_?[]:O(c,f));if(_)return;var p=N(f);return j(O(c,p),p.behavior)}var R=Me.a=P},bT9E:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return Y});var ie=$("VTBJ");function Y(M,H){var O=Object(ie.a)({},M);return Array.isArray(H)&&H.forEach(function(I){delete O[I]}),O}},c5Ni:function(Wt,Me,$){},dejd:function(Wt,Me,$){},dmUQ:function(Wt,Me,$){"use strict";var ie=$("Ff2n"),Y=$("rePB"),M=$("1OyB"),H=$("vuIU"),O=$("Ji7U"),I=$("md7G"),j=$("foSv"),N=$("q1tI"),P=$.n(N),R=$("TSYQ"),c=$.n(R),f=$("4IlW");function _(h,u){var D=Object.keys(h);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(h);u&&(S=S.filter(function(w){return Object.getOwnPropertyDescriptor(h,w).enumerable})),D.push.apply(D,S)}return D}function p(h){for(var u=1;u<arguments.length;u++){var D=arguments[u]!=null?arguments[u]:{};u%2?_(Object(D),!0).forEach(function(S){Object(Y.a)(h,S,D[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(D)):_(Object(D)).forEach(function(S){Object.defineProperty(h,S,Object.getOwnPropertyDescriptor(D,S))})}return h}function m(h){var u=y();return function(){var S=Object(j.a)(h),w;if(u){var b=Object(j.a)(this).constructor;w=Reflect.construct(S,arguments,b)}else w=S.apply(this,arguments);return Object(I.a)(this,w)}}function y(){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(h){return!1}}function a(){}function i(h){h.preventDefault()}var o=function(u){return u.replace(/[^\w.-]+/g,"")},l=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(u){return u!=null},L=function(u,D){return D===u||typeof D=="number"&&typeof u=="number"&&isNaN(D)&&isNaN(u)},A=function(h){Object(O.a)(D,h);var u=m(D);function D(S){var w;Object(M.a)(this,D),w=u.call(this,S),w.onKeyDown=function(X){var Q=w.props,V=Q.onKeyDown,W=Q.onPressEnter;if(X.keyCode===f.a.UP){var te=w.getRatio(X);w.up(X,te,null),w.stop()}else if(X.keyCode===f.a.DOWN){var ue=w.getRatio(X);w.down(X,ue,null),w.stop()}else X.keyCode===f.a.ENTER&&W&&W(X);if(w.recordCursorPosition(),w.lastKeyCode=X.keyCode,V){for(var ge=arguments.length,Oe=new Array(ge>1?ge-1:0),qe=1;qe<ge;qe++)Oe[qe-1]=arguments[qe];V.apply(void 0,[X].concat(Oe))}},w.onKeyUp=function(X){var Q=w.props.onKeyUp;if(w.stop(),w.recordCursorPosition(),Q){for(var V=arguments.length,W=new Array(V>1?V-1:0),te=1;te<V;te++)W[te-1]=arguments[te];Q.apply(void 0,[X].concat(W))}},w.onChange=function(X){var Q=w.props.onChange;w.state.focused&&(w.inputting=!0),w.rawInput=w.props.parser(w.getValueFromEvent(X)),w.setState({inputValue:w.rawInput}),Q(w.toNumber(w.rawInput))},w.onMouseUp=function(){var X=w.props.onMouseUp;w.recordCursorPosition(),X&&X.apply(void 0,arguments)},w.onFocus=function(){var X;w.setState({focused:!0}),(X=w.props).onFocus.apply(X,arguments)},w.onBlur=function(){var X=w.props.onBlur;w.inputting=!1,w.setState({focused:!1});var Q=w.getCurrentValidValue(w.state.inputValue),V=w.setValue(Q,a);if(X){var W=w.input.value,te=w.getInputDisplayValue({focus:!1,value:V});w.input.value=te&&Number(te),X.apply(void 0,arguments),w.input.value=W}},w.getRatio=function(X){var Q=1;return X.metaKey||X.ctrlKey?Q=.1:X.shiftKey&&(Q=10),Q},w.getFullNum=function(X){return isNaN(X)?X:/e/i.test(String(X))?Number(X).toFixed(18).replace(/\.?0+$/,""):X},w.getPrecision=function(X){if(v(w.props.precision))return w.props.precision;var Q=String(X);if(Q.indexOf("e-")>=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var V=0;return Q.indexOf(".")>=0&&(V=Q.length-Q.indexOf(".")-1),V},w.getInputDisplayValue=function(X){var Q=X||w.state,V=Q.focused,W=Q.inputValue,te=Q.value,ue;V?ue=W:ue=w.toPrecisionAsStep(te),ue==null&&(ue="");var ge=w.formatWrapper(ue);return v(w.props.decimalSeparator)&&(ge=ge.toString().replace(".",w.props.decimalSeparator)),ge},w.recordCursorPosition=function(){try{w.cursorStart=w.input.selectionStart,w.cursorEnd=w.input.selectionEnd,w.currentValue=w.input.value,w.cursorBefore=w.input.value.substring(0,w.cursorStart),w.cursorAfter=w.input.value.substring(w.cursorEnd)}catch(X){}},w.restoreByAfter=function(X){if(X===void 0)return!1;var Q=w.input.value,V=Q.lastIndexOf(X);if(V===-1)return!1;var W=w.cursorBefore.length;return w.lastKeyCode===f.a.DELETE&&w.cursorBefore.charAt(W-1)===X[0]?(w.fixCaret(W,W),!0):V+X.length===Q.length?(w.fixCaret(V,V),!0):!1},w.partRestoreByAfter=function(X){return X===void 0?!1:Array.prototype.some.call(X,function(Q,V){var W=X.substring(V);return w.restoreByAfter(W)})},w.isNotCompleteNumber=function(X){return isNaN(X)||X===""||X===null||X&&X.toString().indexOf(".")===X.toString().length-1},w.stop=function(){w.autoStepTimer&&clearTimeout(w.autoStepTimer)},w.down=function(X,Q,V){w.pressingUpOrDown=!0,w.step("down",X,Q,V)},w.up=function(X,Q,V){w.pressingUpOrDown=!0,w.step("up",X,Q,V)},w.saveInput=function(X){w.input=X};var b=S.value;b===void 0&&(b=S.defaultValue),w.state={focused:S.autoFocus};var K=w.getValidValue(w.toNumber(b));return w.state=p(p({},w.state),{},{inputValue:w.toPrecisionAsStep(K),value:K}),w}return Object(H.a)(D,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(w){var b=this.props,K=b.value,X=b.onChange,Q=b.max,V=b.min,W=this.state.focused;if(w){if(!L(w.value,K)||!L(w.max,Q)||!L(w.min,V)){var te=W?K:this.getValidValue(K),ue;this.pressingUpOrDown?ue=te:this.inputting?ue=this.rawInput:ue=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:ue})}var ge="value"in this.props?K:this.state.value;"max"in this.props&&w.max!==Q&&typeof ge=="number"&&ge>Q&&X&&X(Q),"min"in this.props&&w.min!==V&&typeof ge=="number"&&ge<V&&X&&X(V)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var Oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?Oe=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(Oe=this.cursorStart):Oe=this.input.value.length,this.fixCaret(Oe,Oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case f.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case f.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(qe){}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(w){var b=w;return b===""?b="":this.isNotCompleteNumber(parseFloat(b))?b=this.state.value:b=this.getValidValue(b),this.toNumber(b)}},{key:"getValueFromEvent",value:function(w){var b=w.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(b=b.replace(this.props.decimalSeparator,".")),b}},{key:"getValidValue",value:function(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,X=parseFloat(w);return isNaN(X)?w:(X<b&&(X=b),X>K&&(X=K),X)}},{key:"setValue",value:function(w,b){var K=this.props.precision,X=this.isNotCompleteNumber(parseFloat(w))?null:parseFloat(w),Q=this.state.value,V=Q===void 0?null:Q,W=this.state.inputValue,te=W===void 0?null:W,ue=typeof X=="number"?X.toFixed(K):"".concat(X),ge=X!==V||ue!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},b)):this.setState({value:X,inputValue:this.toPrecisionAsStep(w)},b),ge&&this.props.onChange(X),X}},{key:"getMaxPrecision",value:function(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,K=this.props,X=K.precision,Q=K.step;if(v(X))return X;var V=this.getPrecision(b),W=this.getPrecision(Q),te=this.getPrecision(w);return w?Math.max(te,V+W):V+W}},{key:"getPrecisionFactor",value:function(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,K=this.getMaxPrecision(w,b);return Math.pow(10,K)}},{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(w){return this.props.formatter?this.props.formatter(w):w}},{key:"toPrecisionAsStep",value:function(w){if(this.isNotCompleteNumber(w)||w==="")return w;var b=Math.abs(this.getMaxPrecision(w));return isNaN(b)?w.toString():Number(w).toFixed(b)}},{key:"toNumber",value:function(w){var b=this.props.precision,K=this.state.focused,X=w&&w.length>16&&K;return this.isNotCompleteNumber(w)||X?w:v(b)?Math.round(w*Math.pow(10,b))/Math.pow(10,b):Number(w)}},{key:"upStep",value:function(w,b){var K=this.props.step,X=this.getPrecisionFactor(w,b),Q=Math.abs(this.getMaxPrecision(w,b)),V=((X*w+X*K*b)/X).toFixed(Q);return this.toNumber(V)}},{key:"downStep",value:function(w,b){var K=this.props.step,X=this.getPrecisionFactor(w,b),Q=Math.abs(this.getMaxPrecision(w,b)),V=((X*w-X*K*b)/X).toFixed(Q);return this.toNumber(V)}},{key:"step",value:function(w,b){var K=this,X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),b&&(b.persist(),b.preventDefault());var V=this.props;if(V.disabled)return;var W=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(W))return;var te=this["".concat(w,"Step")](W,X),ue=te>V.max||te<V.min;if(te>V.max?te=V.max:te<V.min&&(te=V.min),this.setValue(te,null),this.setState({focused:!0},function(){K.pressingUpOrDown=!1}),ue)return;this.autoStepTimer=setTimeout(function(){K[w](b,X,!0)},Q?l:C)}},{key:"fixCaret",value:function(w,b){if(w===void 0||b===void 0||!this.input||!this.input.value)return;try{var K=this.input.selectionStart,X=this.input.selectionEnd;(w!==K||b!==X)&&this.input.setSelectionRange(w,b)}catch(Q){}}},{key:"render",value:function(){var w,b=this.props,K=b.prefixCls,X=b.disabled,Q=b.readOnly,V=b.useTouch,W=b.autoComplete,te=b.upHandler,ue=b.downHandler,ge=b.className,Oe=b.max,qe=b.min,Ke=b.style,Be=b.title,Xe=b.onMouseEnter,Fe=b.onMouseLeave,xe=b.onMouseOver,oe=b.onMouseOut,Re=b.required,dt=b.onClick,at=b.tabIndex,ut=b.type,ce=b.placeholder,he=b.id,Le=b.inputMode,Ve=b.pattern,et=b.step,tt=b.maxLength,rt=b.autoFocus,it=b.name,Dt=b.onPaste,Et=b.onInput,xt=Object(ie.a)(b,["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"]),ct=this.state,Ft=ct.value,wt=ct.focused,Pt=c()(K,(w={},Object(Y.a)(w,ge,!!ge),Object(Y.a)(w,"".concat(K,"-disabled"),X),Object(Y.a)(w,"".concat(K,"-focused"),wt),w)),We={};Object.keys(xt).forEach(function(Ee){(Ee.substr(0,5)==="data-"||Ee.substr(0,5)==="aria-"||Ee==="role")&&(We[Ee]=xt[Ee])});var gt=!Q&&!X,Ut=this.getInputDisplayValue(null),Qe=(Ft||Ft===0)&&(isNaN(Ft)||Number(Ft)>=Oe),ot=(Ft||Ft===0)&&(isNaN(Ft)||Number(Ft)<=qe),Ae=Qe||X||Q,be=ot||X||Q,Se=c()("".concat(K,"-handler"),"".concat(K,"-handler-up"),Object(Y.a)({},"".concat(K,"-handler-up-disabled"),Ae)),re=c()("".concat(K,"-handler"),"".concat(K,"-handler-down"),Object(Y.a)({},"".concat(K,"-handler-down-disabled"),be)),ae=V?{onTouchStart:Ae?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Ae?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},fe=V?{onTouchStart:be?a:this.down,onTouchEnd:this.stop}:{onMouseDown:be?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Pt,style:Ke,title:Be,onMouseEnter:Xe,onMouseLeave:Fe,onMouseOver:xe,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(K,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Ae,className:Se}),te||P.a.createElement("span",{unselectable:"on",className:"".concat(K,"-handler-up-inner"),onClick:i})),P.a.createElement("span",Object.assign({unselectable:"on"},fe,{role:"button","aria-label":"Decrease Value","aria-disabled":be,className:re}),ue||P.a.createElement("span",{unselectable:"on",className:"".concat(K,"-handler-down-inner"),onClick:i}))),P.a.createElement("div",{className:"".concat(K,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":qe,"aria-valuemax":Oe,"aria-valuenow":Ft,required:Re,type:ut,placeholder:ce,onPaste:Dt,onClick:dt,onMouseUp:this.onMouseUp,className:"".concat(K,"-input"),tabIndex:at,autoComplete:W,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:gt?this.onKeyDown:a,onKeyUp:gt?this.onKeyUp:a,autoFocus:rt,maxLength:tt,readOnly:Q,disabled:X,max:Oe,min:qe,step:et,name:it,title:Be,id:he,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ut),pattern:Ve,inputMode:Le,onInput:Et},We))))}}]),D}(P.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:o,required:!1,autoComplete:"off"};var T=A,x=Me.a=T},fJjg:function(Wt,Me,$){"use strict";var ie=$("2qtc"),Y=$("kLXV"),M=$("7Kak"),H=$("9yH6"),O=$("k1fw"),I=$("miYZ"),j=$("tsqr"),N=$("9og8"),P=$("tJVT"),R=$("PpiC"),c=$("5NDa"),f=$("5rEg"),_=$("WmNS"),p=$.n(_),m=$("q1tI"),y=$.n(m),a=$("9kvl"),i=$("Nska"),o=$.n(i),l=$("1vsH"),C=f.a.Search,g=function(L){var A=L.userDetail,T=L.globalSetting,x=L.loading,h=L.dispatch,u=Object(R.a)(L,["userDetail","globalSetting","loading","dispatch"]),D=Object(m.useState)(""),S=Object(P.a)(D,2),w=S[0],b=S[1],K=Object(m.useState)([]),X=Object(P.a)(K,2),Q=X[0],V=X[1],W=Object(m.useState)(),te=Object(P.a)(W,2),ue=te[0],ge=te[1],Oe=Object(m.useState)(!1),qe=Object(P.a)(Oe,2),Ke=qe[0],Be=qe[1];Object(m.useEffect)(function(){Xe()},[]);var Xe=function(){var xe=Object(N.a)(p.a.mark(function oe(){var Re;return p.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.next=2,h({type:"userDetail/topicGetCourseList",payload:{search:w}});case 2:Re=at.sent,Re&&V((Re==null?void 0:Re.courses)||[]);case 4:case"end":return at.stop()}},oe)}));return function(){return xe.apply(this,arguments)}}(),Fe=function(){var xe=Object(N.a)(p.a.mark(function oe(){var Re,dt,at,ut,ce;return p.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:if(ue){Le.next=4;break}return j.b.info("\u60A8\u9700\u8981\u521B\u5EFA\u8BFE\u5802\uFF0C\u624D\u80FD\u53D1\u9001"),Be(!0),Le.abrupt("return");case 4:return Le.next=6,h({type:"userDetail/topicSendToClass",payload:Object(O.a)({course_id:ue},(Re=A.actionTabs)===null||Re===void 0?void 0:Re.params)});case 6:dt=Le.sent,h({type:"userDetail/setActionTabs",payload:{}}),dt&&dt.status===0&&(ce={normal:"common_homework",group:"group_homework",exercise:"exercise",poll:"poll"},Object(l.O)("/classrooms/".concat(ue,"/").concat(ce[(at=A.actionTabs)===null||at===void 0||((ut=at.params)===null||ut===void 0)?void 0:ut.object_type])));case 9:case"end":return Le.stop()}},oe)}));return function(){return xe.apply(this,arguments)}}();return y.a.createElement(Y.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:A.actionTabs.key==="UserDetail-SendToClass",title:"\u53D1\u9001\u81F3\u8BFE\u5802",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:x["userDetail/sendToClass"],width:600,onOk:Fe,onCancel:function(){h({type:"userDetail/setActionTabs",payload:{}})}},y.a.createElement("div",{className:o.a.wrap},y.a.createElement("div",{className:o.a.title},"\u6E29\u99A8\u63D0\u793A\uFF1A\u9009\u62E9\u7684\u9898\u5C06\u4F1A\u53D1\u9001\u5230\u6307\u5B9A\u8BFE\u5802"),y.a.createElement("div",{className:"mb10"},y.a.createElement(C,{placeholder:"\u8F93\u5165\u8BFE\u5802\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",value:w,onChange:function(oe){return b(oe.target.value)},onSearch:function(oe){b(oe),Xe()}})),y.a.createElement("div",{className:o.a.radioWrap},y.a.createElement(H.a.Group,{value:ue,onChange:function(oe){ge(oe.target.value),Be(!1)}},Q.map(function(xe,oe){return y.a.createElement(H.a,{className:o.a.radio,value:xe.course_id,key:xe.course_id},xe.course_name)}))),Ke&&y.a.createElement("div",{className:o.a.colorFF0000},"\u8BF7\u5148\u9009\u62E9\u8BFE\u5802")))};Me.a=Object(a.a)(function(v){var L=v.userDetail,A=v.loading,T=v.globalSetting;return{userDetail:L,globalSetting:T,loading:A.effects}})(g)},fjLI:function(Wt,Me,$){"use strict";$.d(Me,"e",function(){return R}),$.d(Me,"a",function(){return c}),$.d(Me,"c",function(){return f}),$.d(Me,"d",function(){return p}),$.d(Me,"b",function(){return m});var ie=$("8HAY"),Y=$("Cg/j"),M=$("T8No"),H=$("nnTU"),O=$("MI8n"),I=function(){var y=function(a,i){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,l){o.__proto__=l}||function(o,l){for(var C in l)l.hasOwnProperty(C)&&(o[C]=l[C])},y(a,i)};return function(a,i){y(a,i);function o(){this.constructor=a}a.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}}(),j=function(y,a,i,o){var l=arguments.length,C=l<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,i):o,g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(y,a,i,o);else for(var v=y.length-1;v>=0;v--)(g=y[v])&&(C=(l<3?g(C):l>3?g(a,i,C):g(a,i))||C);return l>3&&C&&Object.defineProperty(a,i,C),C},N=function(y,a){return function(i,o){a(i,o,y)}},P=function(){for(var y=0,a=0,i=arguments.length;a<i;a++)y+=arguments[a].length;for(var o=Array(y),l=0,a=0;a<i;a++)for(var C=arguments[a],g=0,v=C.length;g<v;g++,l++)o[l]=C[g];return o};function R(y){return y.command!==void 0}var c=Object(Y.c)("menuService"),f=new(function(){function y(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new O.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return y.prototype.addCommand=function(a){var i=this;return this._commands.set(a.id,a),this._onDidChangeMenu.fire(0),{dispose:function(){i._commands.delete(a.id)&&i._onDidChangeMenu.fire(0)}}},y.prototype.getCommand=function(a){return this._commands.get(a)},y.prototype.getCommands=function(){var a=new Map;return this._commands.forEach(function(i,o){return a.set(o,i)}),a},y.prototype.appendMenuItem=function(a,i){var o=this,l=this._menuItems.get(a);return l?l.push(i):(l=[i],this._menuItems.set(a,l)),this._onDidChangeMenu.fire(a),{dispose:function(){var C=l.indexOf(i);C>=0&&(l.splice(C,1),o._onDidChangeMenu.fire(a))}}},y.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},y.prototype._appendImplicitItems=function(a){for(var i=new Set,o=a.filter(function(A){return R(A)}),l=0,C=o;l<C.length;l++){var g=C[l],v=g.command,L=g.alt;i.add(v.id),L&&i.add(L.id)}this._commands.forEach(function(A,T){i.has(T)||a.push({command:A})})},y}()),_=function(y){I(a,y);function a(i,o,l){var C=y.call(this,i,o)||this;return C._commandService=l,C}return a.prototype.run=function(){for(var i,o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];return(i=this._commandService).executeCommand.apply(i,P([this.id],o))},a=j([N(2,H.b)],a),a}(ie.a),p=function(y){I(a,y);function a(i){var o=this;return typeof i.title=="string"?o=y.call(this,"",i.title,"submenu")||this:o=y.call(this,"",i.title.value,"submenu")||this,o.item=i,o}return a}(ie.a),m=function(y){I(a,y);function a(i,o,l,C,g){var v=this;return typeof i.title=="string"?v=y.call(this,i.id,i.title,g)||this:v=y.call(this,i.id,i.title.value,g)||this,v._cssClass=void 0,v._enabled=!i.precondition||C.contextMatchesRules(i.precondition),v._checked=Boolean(i.toggled&&C.contextMatchesRules(i.toggled)),v._options=l||{},v.item=i,v.alt=o?new a(o,void 0,v._options,C,g):void 0,v}return a.prototype.dispose=function(){this.alt&&this.alt.dispose(),y.prototype.dispose.call(this)},a.prototype.run=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var l=[];return this._options.arg&&(l=P(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=P(l,i)),y.prototype.run.apply(this,l)},a=j([N(3,M.c),N(4,H.b)],a),a}(_)},k3GJ:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return Eo});var ie=$("rePB"),Y=$("ODXe"),M=$("Ff2n"),H=$("VTBJ"),O=$("q1tI"),I=$("TSYQ"),j=$.n(I),N=$("Zm9Q"),P=$("6cGi"),R=$("KQm4"),c=$("xEkU"),f=$.n(c),_=$("t23M");function p(de){var we=Object(O.useRef)(),De=Object(O.useRef)(!1);function pe(){for(var q=arguments.length,le=new Array(q),ne=0;ne<q;ne++)le[ne]=arguments[ne];De.current||(f.a.cancel(we.current),we.current=f()(function(){de.apply(void 0,le)}))}return Object(O.useEffect)(function(){return function(){De.current=!0,f.a.cancel(we.current)}},[]),pe}function m(de){var we=Object(O.useRef)([]),De=Object(O.useState)({}),pe=Object(Y.a)(De,2),q=pe[1],le=Object(O.useRef)(typeof de=="function"?de():de),ne=p(function(){var ye=le.current;we.current.forEach(function(ke){ye=ke(ye)}),we.current=[],le.current=ye,q({})});function ve(ye){we.current.push(ye),ne()}return[le.current,ve]}var y=$("4IlW");function a(de,we){var De,pe=de.prefixCls,q=de.id,le=de.active,ne=de.rtl,ve=de.tab,ye=ve.key,ke=ve.tab,_e=ve.disabled,Ie=ve.closeIcon,Ze=de.tabBarGutter,ft=de.tabPosition,ht=de.closable,Ot=de.renderWrapper,hn=de.removeAriaLabel,wn=de.editable,yn=de.onClick,Cn=de.onRemove,_n=de.onFocus,Tn="".concat(pe,"-tab");O.useEffect(function(){return Cn},[]);var Sn={};ft==="top"||ft==="bottom"?Sn[ne?"marginLeft":"marginRight"]=Ze:Sn.marginBottom=Ze;var Hn=wn&&ht!==!1&&!_e;function Rn(sn){if(_e)return;yn(sn)}function gr(sn){sn.preventDefault(),sn.stopPropagation(),wn.onEdit("remove",{key:ye,event:sn})}var kn=O.createElement("div",{key:ye,ref:we,className:j()(Tn,(De={},Object(ie.a)(De,"".concat(Tn,"-with-remove"),Hn),Object(ie.a)(De,"".concat(Tn,"-active"),le),Object(ie.a)(De,"".concat(Tn,"-disabled"),_e),De)),style:Sn,onClick:Rn},O.createElement("div",{role:"tab","aria-selected":le,id:q&&"".concat(q,"-tab-").concat(ye),className:"".concat(Tn,"-btn"),"aria-controls":q&&"".concat(q,"-panel-").concat(ye),"aria-disabled":_e,tabIndex:_e?null:0,onClick:function(nn){nn.stopPropagation(),Rn(nn)},onKeyDown:function(nn){[y.a.SPACE,y.a.ENTER].includes(nn.which)&&(nn.preventDefault(),Rn(nn))},onFocus:_n},ke),Hn&&O.createElement("button",{type:"button","aria-label":hn||"remove",tabIndex:0,className:"".concat(Tn,"-remove"),onClick:function(nn){nn.stopPropagation(),gr(nn)}},Ie||wn.removeIcon||"\xD7"));return Ot&&(kn=Ot(kn)),kn}var i=O.forwardRef(a),o={width:0,height:0,left:0,top:0};function l(de,we,De){return Object(O.useMemo)(function(){for(var pe,q=new Map,le=we.get((pe=de[0])===null||pe===void 0?void 0:pe.key)||o,ne=le.left+le.width,ve=0;ve<de.length;ve+=1){var ye=de[ve].key,ke=we.get(ye);if(!ke){var _e;ke=we.get((_e=de[ve-1])===null||_e===void 0?void 0:_e.key)||o}var Ie=q.get(ye)||Object(H.a)({},ke);Ie.right=ne-Ie.left-Ie.width,q.set(ye,Ie)}return q},[de.map(function(pe){return pe.key}).join("_"),we,De])}var C={width:0,height:0,left:0,top:0,right:0};function g(de,we,De,pe,q){var le=q.tabs,ne=q.tabPosition,ve=q.rtl,ye,ke,_e;["top","bottom"].includes(ne)?(ye="width",ke=ve?"right":"left",_e=Math.abs(we.left)):(ye="height",ke="top",_e=-we.top);var Ie=we[ye],Ze=De[ye],ft=pe[ye],ht=Ie;return Ze+ft>Ie&&(ht=Ie-ft),Object(O.useMemo)(function(){if(!le.length)return[0,0];for(var Ot=le.length,hn=Ot,wn=0;wn<Ot;wn+=1){var yn=de.get(le[wn].key)||C;if(yn[ke]+yn[ye]>_e+ht){hn=wn-1;break}}for(var Cn=0,_n=Ot-1;_n>=0;_n-=1){var Tn=de.get(le[_n].key)||C;if(Tn[ke]<_e){Cn=_n+1;break}}return[Cn,hn]},[de,_e,ht,ne,le.map(function(Ot){return Ot.key}).join("_"),ve])}var v=$("wx14"),L=$("1OyB"),A=$("vuIU"),T=$("JX7q"),x=$("Ji7U"),h=$("LK+K"),u=$("I8Z2"),D=$("bT9E"),S=$("2GS6"),w=$("Gytx"),b=$.n(w),K=$("U8pU"),X=/iPhone/i,Q=/iPod/i,V=/iPad/i,W=/\bAndroid(?:.+)Mobile\b/i,te=/Android/i,ue=/\bAndroid(?:.+)SD4930UR\b/i,ge=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,Oe=/Windows Phone/i,qe=/\bWindows(?:.+)ARM\b/i,Ke=/BlackBerry/i,Be=/BB10/i,Xe=/Opera Mini/i,Fe=/\b(CriOS|Chrome)(?:.+)Mobile/i,xe=/Mobile(?:.+)Firefox\b/i;function oe(de,we){return de.test(we)}function Re(de){var we=de||(typeof navigator!="undefined"?navigator.userAgent:""),De=(we||"").split("[FBAN");if(typeof De[1]!="undefined"){var pe=De,q=Object(Y.a)(pe,1);we=q[0]}if(De=we.split("Twitter"),typeof De[1]!="undefined"){var le=De,ne=Object(Y.a)(le,1);we=ne[0]}var ve={apple:{phone:oe(X,we)&&!oe(Oe,we),ipod:oe(Q,we),tablet:!oe(X,we)&&oe(V,we)&&!oe(Oe,we),device:(oe(X,we)||oe(Q,we)||oe(V,we))&&!oe(Oe,we)},amazon:{phone:oe(ue,we),tablet:!oe(ue,we)&&oe(ge,we),device:oe(ue,we)||oe(ge,we)},android:{phone:!oe(Oe,we)&&oe(ue,we)||!oe(Oe,we)&&oe(W,we),tablet:!oe(Oe,we)&&!oe(ue,we)&&!oe(W,we)&&(oe(ge,we)||oe(te,we)),device:!oe(Oe,we)&&(oe(ue,we)||oe(ge,we)||oe(W,we)||oe(te,we))||oe(/\bokhttp\b/i,we)},windows:{phone:oe(Oe,we),tablet:oe(qe,we),device:oe(Oe,we)||oe(qe,we)},other:{blackberry:oe(Ke,we),blackberry10:oe(Be,we),opera:oe(Xe,we),firefox:oe(xe,we),chrome:oe(Fe,we),device:oe(Ke,we)||oe(Be,we)||oe(Xe,we)||oe(xe,we)||oe(Fe,we)},any:null,phone:null,tablet:null};return ve.any=ve.apple.device||ve.android.device||ve.windows.device||ve.other.device,ve.phone=ve.apple.phone||ve.android.phone||ve.windows.phone,ve.tablet=ve.apple.tablet||ve.android.tablet||ve.windows.tablet,ve}var dt=Object(H.a)(Object(H.a)({},Re()),{},{isMobile:Re}),at=dt;function ut(){}function ce(de,we,De){var pe=we||"";return de.key||"".concat(pe,"item_").concat(De)}function he(de){return"".concat(de,"-menu-")}function Le(de,we){var De=-1;O.Children.forEach(de,function(pe){De+=1,pe&&pe.type&&pe.type.isMenuItemGroup?O.Children.forEach(pe.props.children,function(q){De+=1,we(q,De)}):we(pe,De)})}function Ve(de,we,De){if(!de||De.find)return;O.Children.forEach(de,function(pe){if(pe){var q=pe.type;if(!q||!(q.isSubMenu||q.isMenuItem||q.isMenuItemGroup))return;we.indexOf(pe.key)!==-1?De.find=!0:pe.props.children&&Ve(pe.props.children,we,De)}})}var et=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],tt=function(we){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=we&&typeof we.getBoundingClientRect=="function"&&we.getBoundingClientRect().width;if(pe){if(De){var q=getComputedStyle(we),le=q.marginLeft,ne=q.marginRight;pe+=+le.replace("px","")+ +ne.replace("px","")}pe=+pe.toFixed(6)}return pe||0},rt=function(we,De,pe){we&&Object(K.a)(we.style)==="object"&&(we.style[De]=pe)},it=function(){return at.any},Dt=$("bdgK"),Et=$("i8i4"),xt=$.n(Et),ct=$("wgJM"),Ft=$("l4aY"),wt=$("m+aA"),Pt=$("c+Xe"),We=$("zT1h"),gt=$("QC+M");function Ut(de,we,De){return De?de[0]===we[0]:de[0]===we[0]&&de[1]===we[1]}function Qe(de,we,De){var pe=de[we]||{};return Object(H.a)(Object(H.a)({},pe),De)}function ot(de,we,De,pe){for(var q=De.points,le=Object.keys(de),ne=0;ne<le.length;ne+=1){var ve=le[ne];if(Ut(de[ve].points,q,pe))return"".concat(we,"-placement-").concat(ve)}return""}var Ae=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var de=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(de)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(de==null?void 0:de.substr(0,4)))},be=$("MNnm");function Se(de,we){var De={};return De[de.toLowerCase()]=we.toLowerCase(),De["Webkit".concat(de)]="webkit".concat(we),De["Moz".concat(de)]="moz".concat(we),De["ms".concat(de)]="MS".concat(we),De["O".concat(de)]="o".concat(we.toLowerCase()),De}function re(de,we){var De={animationend:Se("Animation","AnimationEnd"),transitionend:Se("Transition","TransitionEnd")};return de&&("AnimationEvent"in we||delete De.animationend.animation,"TransitionEvent"in we||delete De.transitionend.transition),De}var ae=re(Object(be.a)(),typeof window!="undefined"?window:{}),fe={};if(Object(be.a)()){var Ee=document.createElement("div");fe=Ee.style}var je={};function Te(de){if(je[de])return je[de];var we=ae[de];if(we)for(var De=Object.keys(we),pe=De.length,q=0;q<pe;q+=1){var le=De[q];if(Object.prototype.hasOwnProperty.call(we,le)&&le in fe)return je[de]=we[le],je[de]}return""}var Ne=Te("animationend"),st=Te("transitionend"),pt=!!(Ne&&st),St=Ne||"animationend",$t=st||"transitionend";function _t(de,we){if(!de)return null;if(Object(K.a)(de)==="object"){var De=we.replace(/-\w/g,function(pe){return pe[1].toUpperCase()});return de[De]}return"".concat(de,"-").concat(we)}var $e="none",bn="appear",ze="enter",vn="leave",ln="none",Ht="prepare",an="start",gn="active",kt="end";function Mt(de){var we=Object(O.useRef)(!1),De=Object(O.useState)(de),pe=Object(Y.a)(De,2),q=pe[0],le=pe[1];function ne(ve){we.current||le(ve)}return Object(O.useEffect)(function(){return function(){we.current=!0}},[]),[q,ne]}var mt=Object(be.a)()?O.useLayoutEffect:O.useEffect,It=mt,un=function(){var de=O.useRef(null);function we(){ct.a.cancel(de.current)}function De(pe){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;we();var le=Object(ct.a)(function(){q<=1?pe({isCanceled:function(){return le!==de.current}}):De(pe,q-1)});de.current=le}return O.useEffect(function(){return function(){we()}},[]),[De,we]},pn=[Ht,an,gn,kt],Zt=!1,zt=!0;function Tt(de){return de===gn||de===kt}var zn=function(de,we){var De=O.useState(ln),pe=Object(Y.a)(De,2),q=pe[0],le=pe[1],ne=un(),ve=Object(Y.a)(ne,2),ye=ve[0],ke=ve[1];function _e(){le(Ht)}return It(function(){if(q!==ln&&q!==kt){var Ie=pn.indexOf(q),Ze=pn[Ie+1],ft=we(q);ft===Zt?le(Ze):ye(function(ht){function Ot(){if(ht.isCanceled())return;le(Ze)}ft===!0?Ot():Promise.resolve(ft).then(Ot)})}},[de,q]),O.useEffect(function(){return function(){ke()}},[]),[_e,q]},Pn=function(de){var we=Object(O.useRef)(),De=Object(O.useRef)(de);De.current=de;var pe=O.useCallback(function(ne){De.current(ne)},[]);function q(ne){ne&&(ne.removeEventListener($t,pe),ne.removeEventListener(St,pe))}function le(ne){we.current&&we.current!==ne&&q(we.current),ne&&ne!==we.current&&(ne.addEventListener($t,pe),ne.addEventListener(St,pe),we.current=ne)}return O.useEffect(function(){return function(){q(we.current)}},[]),[le,q]};function Dn(de,we,De,pe){var q=pe.motionEnter,le=q===void 0?!0:q,ne=pe.motionAppear,ve=ne===void 0?!0:ne,ye=pe.motionLeave,ke=ye===void 0?!0:ye,_e=pe.motionDeadline,Ie=pe.motionLeaveImmediately,Ze=pe.onAppearPrepare,ft=pe.onEnterPrepare,ht=pe.onLeavePrepare,Ot=pe.onAppearStart,hn=pe.onEnterStart,wn=pe.onLeaveStart,yn=pe.onAppearActive,Cn=pe.onEnterActive,_n=pe.onLeaveActive,Tn=pe.onAppearEnd,Sn=pe.onEnterEnd,Hn=pe.onLeaveEnd,Rn=pe.onVisibleChanged,gr=Mt(),kn=Object(Y.a)(gr,2),sn=kn[0],nn=kn[1],Mn=Mt($e),Kn=Object(Y.a)(Mn,2),Yt=Kn[0],Xn=Kn[1],yr=Mt(null),Jn=Object(Y.a)(yr,2),or=Jn[0],ir=Jn[1],Dr=Object(O.useRef)(!1),Wr=Object(O.useRef)(null),xr=Object(O.useRef)(!1),qr=Object(O.useRef)(null);function Ei(){var ur=De();return ur||qr.current}var oi=Object(O.useRef)(!1);function Hr(ur){var nr=Ei();if(ur&&!ur.deadline&&ur.target!==nr)return;var Kr;Yt===bn&&oi.current?Kr=Tn==null?void 0:Tn(nr,ur):Yt===ze&&oi.current?Kr=Sn==null?void 0:Sn(nr,ur):Yt===vn&&oi.current&&(Kr=Hn==null?void 0:Hn(nr,ur)),Kr!==!1&&!xr.current&&(Xn($e),ir(null))}var dr=Pn(Hr),sr=Object(Y.a)(dr,1),Cr=sr[0],br=O.useMemo(function(){var ur,nr,Kr;switch(Yt){case"appear":return ur={},Object(ie.a)(ur,Ht,Ze),Object(ie.a)(ur,an,Ot),Object(ie.a)(ur,gn,yn),ur;case"enter":return nr={},Object(ie.a)(nr,Ht,ft),Object(ie.a)(nr,an,hn),Object(ie.a)(nr,gn,Cn),nr;case"leave":return Kr={},Object(ie.a)(Kr,Ht,ht),Object(ie.a)(Kr,an,wn),Object(ie.a)(Kr,gn,_n),Kr;default:return{}}},[Yt]),xi=zn(Yt,function(ur){if(ur===Ht){var nr=br[Ht];return nr?nr(Ei()):Zt}if(ar in br){var Kr;ir(((Kr=br[ar])===null||Kr===void 0?void 0:Kr.call(br,Ei(),null))||null)}return ar===gn&&(Cr(Ei()),_e>0&&(clearTimeout(Wr.current),Wr.current=setTimeout(function(){Hr({deadline:!0})},_e))),zt}),Ii=Object(Y.a)(xi,2),Ni=Ii[0],ar=Ii[1],Ai=Tt(ar);oi.current=Ai,It(function(){nn(we);var ur=Dr.current;if(Dr.current=!0,!de)return;var nr;!ur&&we&&ve&&(nr=bn),ur&&we&&le&&(nr=ze),(ur&&!we&&ke||!ur&&Ie&&!we&&ke)&&(nr=vn),nr&&(Xn(nr),Ni())},[we]),Object(O.useEffect)(function(){(Yt===bn&&!ve||Yt===ze&&!le||Yt===vn&&!ke)&&Xn($e)},[ve,le,ke]),Object(O.useEffect)(function(){return function(){clearTimeout(Wr.current),xr.current=!0}},[]),Object(O.useEffect)(function(){sn!==void 0&&Yt===$e&&(Rn==null||Rn(sn))},[sn,Yt]);var Ui=or;return br[Ht]&&ar===an&&(Ui=Object(H.a)({transition:"none"},Ui)),[Yt,ar,Ui,sn!=null?sn:we]}var Jt=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(){return Object(L.a)(this,De),we.apply(this,arguments)}return Object(A.a)(De,[{key:"render",value:function(){return this.props.children}}]),De}(O.Component),Un=Jt;function Qn(de){var we=de;Object(K.a)(de)==="object"&&(we=de.transitionSupport);function De(q){return!!(q.motionName&&we)}var pe=O.forwardRef(function(q,le){var ne=q.visible,ve=ne===void 0?!0:ne,ye=q.removeOnLeave,ke=ye===void 0?!0:ye,_e=q.forceRender,Ie=q.children,Ze=q.motionName,ft=q.leavedClassName,ht=q.eventProps,Ot=De(q),hn=Object(O.useRef)(),wn=Object(O.useRef)();function yn(){try{return Object(wt.a)(hn.current||wn.current)}catch(Xn){return null}}var Cn=Dn(Ot,ve,yn,q),_n=Object(Y.a)(Cn,4),Tn=_n[0],Sn=_n[1],Hn=_n[2],Rn=_n[3],gr=O.useRef(Rn);Rn&&(gr.current=!0);var kn=Object(O.useRef)(le);kn.current=le;var sn=O.useCallback(function(Xn){hn.current=Xn,Object(Pt.b)(kn.current,Xn)},[]),nn,Mn=Object(H.a)(Object(H.a)({},ht),{},{visible:ve});if(!Ie)nn=null;else if(Tn===$e||!De(q))Rn?nn=Ie(Object(H.a)({},Mn),sn):!ke&&gr.current?nn=Ie(Object(H.a)(Object(H.a)({},Mn),{},{className:ft}),sn):_e?nn=Ie(Object(H.a)(Object(H.a)({},Mn),{},{style:{display:"none"}}),sn):nn=null;else{var Kn,Yt;Sn===Ht?Yt="prepare":Tt(Sn)?Yt="active":Sn===an&&(Yt="start"),nn=Ie(Object(H.a)(Object(H.a)({},Mn),{},{className:j()(_t(Ze,Tn),(Kn={},Object(ie.a)(Kn,_t(Ze,"".concat(Tn,"-").concat(Yt)),Yt),Object(ie.a)(Kn,Ze,typeof Ze=="string"),Kn)),style:Hn}),sn)}return O.createElement(Un,{ref:wn},nn)});return pe.displayName="CSSMotion",pe}var Gn=Qn(pt),Je="add",vt="keep",Xt="remove",Gt="removed";function Bt(de){var we;return de&&Object(K.a)(de)==="object"&&"key"in de?we=de:we={key:de},Object(H.a)(Object(H.a)({},we),{},{key:String(we.key)})}function qt(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return de.map(Bt)}function B(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],De=[],pe=0,q=we.length,le=qt(de),ne=qt(we);le.forEach(function(ke){for(var _e=!1,Ie=pe;Ie<q;Ie+=1){var Ze=ne[Ie];if(Ze.key===ke.key){pe<Ie&&(De=De.concat(ne.slice(pe,Ie).map(function(ft){return Object(H.a)(Object(H.a)({},ft),{},{status:Je})})),pe=Ie),De.push(Object(H.a)(Object(H.a)({},Ze),{},{status:vt})),pe+=1,_e=!0;break}}_e||De.push(Object(H.a)(Object(H.a)({},ke),{},{status:Xt}))}),pe<q&&(De=De.concat(ne.slice(pe).map(function(ke){return Object(H.a)(Object(H.a)({},ke),{},{status:Je})})));var ve={};De.forEach(function(ke){var _e=ke.key;ve[_e]=(ve[_e]||0)+1});var ye=Object.keys(ve).filter(function(ke){return ve[ke]>1});return ye.forEach(function(ke){De=De.filter(function(_e){var Ie=_e.key,Ze=_e.status;return Ie!==ke||Ze!==Xt}),De.forEach(function(_e){_e.key===ke&&(_e.status=vt)})}),De}var d=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function E(de){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gn,De=function(pe){Object(x.a)(le,pe);var q=Object(h.a)(le);function le(){var ne;return Object(L.a)(this,le),ne=q.apply(this,arguments),ne.state={keyEntities:[]},ne.removeKey=function(ve){ne.setState(function(ye){var ke=ye.keyEntities;return{keyEntities:ke.map(function(_e){return _e.key!==ve?_e:Object(H.a)(Object(H.a)({},_e),{},{status:Gt})})}})},ne}return Object(A.a)(le,[{key:"render",value:function(){var ve=this,ye=this.state.keyEntities,ke=this.props,_e=ke.component,Ie=ke.children,Ze=ke.onVisibleChanged,ft=Object(M.a)(ke,["component","children","onVisibleChanged"]),ht=_e||O.Fragment,Ot={};return d.forEach(function(hn){Ot[hn]=ft[hn],delete ft[hn]}),delete ft.keys,O.createElement(ht,ft,ye.map(function(hn){var wn=hn.status,yn=Object(M.a)(hn,["status"]),Cn=wn===Je||wn===vt;return O.createElement(we,Object(v.a)({},Ot,{key:yn.key,visible:Cn,eventProps:yn,onVisibleChanged:function(Tn){Ze==null||Ze(Tn,{key:yn.key}),Tn||ve.removeKey(yn.key)}}),Ie)}))}}],[{key:"getDerivedStateFromProps",value:function(ve,ye){var ke=ve.keys,_e=ye.keyEntities,Ie=qt(ke),Ze=B(_e,Ie);return{keyEntities:Ze.filter(function(ft){var ht=_e.find(function(Ot){var hn=Ot.key;return ft.key===hn});return!(ht&&ht.status===Gt&&ft.status===Xt)})}}}]),le}(O.Component);return De.defaultProps={component:"div"},De}var F=E(pt),G=Gn;function U(de){var we=de.prefixCls,De=de.motion,pe=de.animation,q=de.transitionName;return De||(pe?{motionName:"".concat(we,"-").concat(pe)}:q?{motionName:q}:null)}function se(de){var we=de.prefixCls,De=de.visible,pe=de.zIndex,q=de.mask,le=de.maskMotion,ne=de.maskAnimation,ve=de.maskTransitionName;if(!q)return null;var ye={};return(le||ve||ne)&&(ye=Object(H.a)({motionAppear:!0},U({motion:le,prefixCls:we,transitionName:ve,animation:ne}))),O.createElement(G,Object(v.a)({},ye,{visible:De,removeOnLeave:!0}),function(ke){var _e=ke.className;return O.createElement("div",{style:{zIndex:pe},className:j()("".concat(we,"-mask"),_e)})})}var He=$("9mu1"),Ye=$("o0o1"),Ct=$.n(Ye),Ge=$("HaE+"),yt=["measure","align",null,"motion"],Qt=function(de,we){var De=Object(O.useState)(null),pe=Object(Y.a)(De,2),q=pe[0],le=pe[1],ne=Object(O.useRef)(),ve=Object(O.useRef)(!1);function ye(Ie){ve.current||le(Ie)}function ke(){ct.a.cancel(ne.current)}function _e(Ie){ke(),ne.current=Object(ct.a)(function(){ye(function(Ze){switch(q){case"align":return"motion";case"motion":return"stable";default:}return Ze}),Ie==null||Ie()})}return Object(O.useEffect)(function(){ye("measure")},[de]),Object(O.useEffect)(function(){switch(q){case"measure":we();break;default:}q&&(ne.current=Object(ct.a)(Object(Ge.a)(Ct.a.mark(function Ie(){var Ze,ft;return Ct.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:Ze=yt.indexOf(q),ft=yt[Ze+1],ft&&Ze!==-1&&ye(ft);case 3:case"end":return Ot.stop()}},Ie)}))))},[q]),Object(O.useEffect)(function(){return function(){ve.current=!0,ke()}},[]),[q,_e]},Bn=function(de){var we=O.useState({width:0,height:0}),De=Object(Y.a)(we,2),pe=De[0],q=De[1];function le(ve){q({width:ve.offsetWidth,height:ve.offsetHeight})}var ne=O.useMemo(function(){var ve={};if(de){var ye=pe.width,ke=pe.height;de.indexOf("height")!==-1&&ke?ve.height=ke:de.indexOf("minHeight")!==-1&&ke&&(ve.minHeight=ke),de.indexOf("width")!==-1&&ye?ve.width=ye:de.indexOf("minWidth")!==-1&&ye&&(ve.minWidth=ye)}return ve},[de,pe]);return[ne,le]},er=O.forwardRef(function(de,we){var De=de.visible,pe=de.prefixCls,q=de.className,le=de.style,ne=de.children,ve=de.zIndex,ye=de.stretch,ke=de.destroyPopupOnHide,_e=de.forceRender,Ie=de.align,Ze=de.point,ft=de.getRootDomNode,ht=de.getClassNameFromAlign,Ot=de.onAlign,hn=de.onMouseEnter,wn=de.onMouseLeave,yn=de.onMouseDown,Cn=de.onTouchStart,_n=Object(O.useRef)(),Tn=Object(O.useRef)(),Sn=Object(O.useState)(),Hn=Object(Y.a)(Sn,2),Rn=Hn[0],gr=Hn[1],kn=Bn(ye),sn=Object(Y.a)(kn,2),nn=sn[0],Mn=sn[1];function Kn(){ye&&Mn(ft())}var Yt=Qt(De,Kn),Xn=Object(Y.a)(Yt,2),yr=Xn[0],Jn=Xn[1],or=Object(O.useRef)();function ir(){return Ze||ft}function Dr(){var dr;(dr=_n.current)===null||dr===void 0||dr.forceAlign()}function Wr(dr,sr){var Cr=ht(sr);Rn!==Cr&&gr(Cr),yr==="align"&&(Rn!==Cr?Promise.resolve().then(function(){Dr()}):Jn(function(){var br;(br=or.current)===null||br===void 0||br.call(or)}),Ot==null||Ot(dr,sr))}var xr=Object(H.a)({},U(de));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(dr){var sr=xr[dr];xr[dr]=function(Cr,br){return Jn(),sr==null?void 0:sr(Cr,br)}});function qr(){return new Promise(function(dr){or.current=dr})}O.useEffect(function(){!xr.motionName&&yr==="motion"&&Jn()},[xr.motionName,yr]),O.useImperativeHandle(we,function(){return{forceAlign:Dr,getElement:function(){return Tn.current}}});var Ei=Object(H.a)(Object(H.a)({},nn),{},{zIndex:ve,opacity:yr==="motion"||yr==="stable"||!De?void 0:0,pointerEvents:yr==="stable"?void 0:"none"},le),oi=!0;(Ie==null?void 0:Ie.points)&&(yr==="align"||yr==="stable")&&(oi=!1);var Hr=ne;return O.Children.count(ne)>1&&(Hr=O.createElement("div",{className:"".concat(pe,"-content")},ne)),O.createElement(G,Object(v.a)({visible:De,ref:Tn,leavedClassName:"".concat(pe,"-hidden")},xr,{onAppearPrepare:qr,onEnterPrepare:qr,removeOnLeave:ke,forceRender:_e}),function(dr,sr){var Cr=dr.className,br=dr.style,xi=j()(pe,q,Rn,Cr);return O.createElement(He.a,{target:ir(),key:"popup",ref:_n,monitorWindowResize:!0,disabled:oi,align:Ie,onAlign:Wr},O.createElement("div",{ref:sr,className:xi,onMouseEnter:hn,onMouseLeave:wn,onMouseDownCapture:yn,onTouchStartCapture:Cn,style:Object(H.a)(Object(H.a)({},br),Ei)},Hr))})});er.displayName="PopupInner";var mn=er,At=O.forwardRef(function(de,we){var De=de.prefixCls,pe=de.visible,q=de.zIndex,le=de.children,ne=de.mobile;ne=ne===void 0?{}:ne;var ve=ne.popupClassName,ye=ne.popupStyle,ke=ne.popupMotion,_e=ke===void 0?{}:ke,Ie=ne.popupRender,Ze=O.useRef();O.useImperativeHandle(we,function(){return{forceAlign:function(){},getElement:function(){return Ze.current}}});var ft=Object(H.a)({zIndex:q},ye),ht=le;return O.Children.count(le)>1&&(ht=O.createElement("div",{className:"".concat(De,"-content")},le)),Ie&&(ht=Ie(ht)),O.createElement(G,Object(v.a)({visible:pe,ref:Ze,removeOnLeave:!0},_e),function(Ot,hn){var wn=Ot.className,yn=Ot.style,Cn=j()(De,ve,wn);return O.createElement("div",{ref:hn,className:Cn,style:Object(H.a)(Object(H.a)({},yn),ft)},ht)})});At.displayName="MobilePopupInner";var Nt=At,on=["visible","mobile"],dn=O.forwardRef(function(de,we){var De=de.visible,pe=de.mobile,q=Object(M.a)(de,on),le=Object(O.useState)(De),ne=Object(Y.a)(le,2),ve=ne[0],ye=ne[1],ke=Object(O.useState)(!1),_e=Object(Y.a)(ke,2),Ie=_e[0],Ze=_e[1],ft=Object(H.a)(Object(H.a)({},q),{},{visible:ve});Object(O.useEffect)(function(){ye(De),De&&pe&&Ze(Ae())},[De,pe]);var ht=Ie?O.createElement(Nt,Object(v.a)({},ft,{mobile:pe,ref:we})):O.createElement(mn,Object(v.a)({},ft,{ref:we}));return O.createElement("div",null,O.createElement(se,ft),ht)});dn.displayName="Popup";var En=dn,Fn=O.createContext(null),cn=Fn;function Er(){}function Qr(){return""}function ni(de){return de?de.ownerDocument:window.document}var wi=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Ki(de){var we=function(De){Object(x.a)(q,De);var pe=Object(h.a)(q);function q(le){var ne;Object(L.a)(this,q),ne=pe.call(this,le),ne.popupRef=O.createRef(),ne.triggerRef=O.createRef(),ne.attachId=void 0,ne.clickOutsideHandler=void 0,ne.touchOutsideHandler=void 0,ne.contextMenuOutsideHandler1=void 0,ne.contextMenuOutsideHandler2=void 0,ne.mouseDownTimeout=void 0,ne.focusTime=void 0,ne.preClickTime=void 0,ne.preTouchTime=void 0,ne.delayTimer=void 0,ne.hasPopupMouseDown=void 0,ne.onMouseEnter=function(ye){var ke=ne.props.mouseEnterDelay;ne.fireEvents("onMouseEnter",ye),ne.delaySetPopupVisible(!0,ke,ke?null:ye)},ne.onMouseMove=function(ye){ne.fireEvents("onMouseMove",ye),ne.setPoint(ye)},ne.onMouseLeave=function(ye){ne.fireEvents("onMouseLeave",ye),ne.delaySetPopupVisible(!1,ne.props.mouseLeaveDelay)},ne.onPopupMouseEnter=function(){ne.clearDelayTimer()},ne.onPopupMouseLeave=function(ye){var ke;if(ye.relatedTarget&&!ye.relatedTarget.setTimeout&&Object(Ft.a)((ke=ne.popupRef.current)===null||ke===void 0?void 0:ke.getElement(),ye.relatedTarget))return;ne.delaySetPopupVisible(!1,ne.props.mouseLeaveDelay)},ne.onFocus=function(ye){ne.fireEvents("onFocus",ye),ne.clearDelayTimer(),ne.isFocusToShow()&&(ne.focusTime=Date.now(),ne.delaySetPopupVisible(!0,ne.props.focusDelay))},ne.onMouseDown=function(ye){ne.fireEvents("onMouseDown",ye),ne.preClickTime=Date.now()},ne.onTouchStart=function(ye){ne.fireEvents("onTouchStart",ye),ne.preTouchTime=Date.now()},ne.onBlur=function(ye){ne.fireEvents("onBlur",ye),ne.clearDelayTimer(),ne.isBlurToHide()&&ne.delaySetPopupVisible(!1,ne.props.blurDelay)},ne.onContextMenu=function(ye){ye.preventDefault(),ne.fireEvents("onContextMenu",ye),ne.setPopupVisible(!0,ye)},ne.onContextMenuClose=function(){ne.isContextMenuToShow()&&ne.close()},ne.onClick=function(ye){if(ne.fireEvents("onClick",ye),ne.focusTime){var ke;if(ne.preClickTime&&ne.preTouchTime?ke=Math.min(ne.preClickTime,ne.preTouchTime):ne.preClickTime?ke=ne.preClickTime:ne.preTouchTime&&(ke=ne.preTouchTime),Math.abs(ke-ne.focusTime)<20)return;ne.focusTime=0}ne.preClickTime=0,ne.preTouchTime=0,ne.isClickToShow()&&(ne.isClickToHide()||ne.isBlurToHide())&&ye&&ye.preventDefault&&ye.preventDefault();var _e=!ne.state.popupVisible;(ne.isClickToHide()&&!_e||_e&&ne.isClickToShow())&&ne.setPopupVisible(!ne.state.popupVisible,ye)},ne.onPopupMouseDown=function(){if(ne.hasPopupMouseDown=!0,clearTimeout(ne.mouseDownTimeout),ne.mouseDownTimeout=window.setTimeout(function(){ne.hasPopupMouseDown=!1},0),ne.context){var ye;(ye=ne.context).onPopupMouseDown.apply(ye,arguments)}},ne.onDocumentClick=function(ye){if(ne.props.mask&&!ne.props.maskClosable)return;var ke=ye.target,_e=ne.getRootDomNode(),Ie=ne.getPopupDomNode();(!Object(Ft.a)(_e,ke)||ne.isContextMenuOnly())&&!Object(Ft.a)(Ie,ke)&&!ne.hasPopupMouseDown&&ne.close()},ne.getRootDomNode=function(){var ye=ne.props.getTriggerDOMNode;if(ye)return ye(ne.triggerRef.current);try{var ke=Object(wt.a)(ne.triggerRef.current);if(ke)return ke}catch(_e){}return xt.a.findDOMNode(Object(T.a)(ne))},ne.getPopupClassNameFromAlign=function(ye){var ke=[],_e=ne.props,Ie=_e.popupPlacement,Ze=_e.builtinPlacements,ft=_e.prefixCls,ht=_e.alignPoint,Ot=_e.getPopupClassNameFromAlign;return Ie&&Ze&&ke.push(ot(Ze,ft,ye,ht)),Ot&&ke.push(Ot(ye)),ke.join(" ")},ne.getComponent=function(){var ye=ne.props,ke=ye.prefixCls,_e=ye.destroyPopupOnHide,Ie=ye.popupClassName,Ze=ye.onPopupAlign,ft=ye.popupMotion,ht=ye.popupAnimation,Ot=ye.popupTransitionName,hn=ye.popupStyle,wn=ye.mask,yn=ye.maskAnimation,Cn=ye.maskTransitionName,_n=ye.maskMotion,Tn=ye.zIndex,Sn=ye.popup,Hn=ye.stretch,Rn=ye.alignPoint,gr=ye.mobile,kn=ye.forceRender,sn=ne.state,nn=sn.popupVisible,Mn=sn.point,Kn=ne.getPopupAlign(),Yt={};return ne.isMouseEnterToShow()&&(Yt.onMouseEnter=ne.onPopupMouseEnter),ne.isMouseLeaveToHide()&&(Yt.onMouseLeave=ne.onPopupMouseLeave),Yt.onMouseDown=ne.onPopupMouseDown,Yt.onTouchStart=ne.onPopupMouseDown,O.createElement(En,Object(v.a)({prefixCls:ke,destroyPopupOnHide:_e,visible:nn,point:Rn&&Mn,className:Ie,align:Kn,onAlign:Ze,animation:ht,getClassNameFromAlign:ne.getPopupClassNameFromAlign},Yt,{stretch:Hn,getRootDomNode:ne.getRootDomNode,style:hn,mask:wn,zIndex:Tn,transitionName:Ot,maskAnimation:yn,maskTransitionName:Cn,maskMotion:_n,ref:ne.popupRef,motion:ft,mobile:gr,forceRender:kn}),typeof Sn=="function"?Sn():Sn)},ne.attachParent=function(ye){ct.a.cancel(ne.attachId);var ke=ne.props,_e=ke.getPopupContainer,Ie=ke.getDocument,Ze=ne.getRootDomNode(),ft;_e?(Ze||_e.length===0)&&(ft=_e(Ze)):ft=Ie(ne.getRootDomNode()).body,ft?ft.appendChild(ye):ne.attachId=Object(ct.a)(function(){ne.attachParent(ye)})},ne.getContainer=function(){var ye=ne.props.getDocument,ke=ye(ne.getRootDomNode()).createElement("div");return ke.style.position="absolute",ke.style.top="0",ke.style.left="0",ke.style.width="100%",ne.attachParent(ke),ke},ne.setPoint=function(ye){var ke=ne.props.alignPoint;if(!ke||!ye)return;ne.setState({point:{pageX:ye.pageX,pageY:ye.pageY}})},ne.handlePortalUpdate=function(){ne.state.prevPopupVisible!==ne.state.popupVisible&&ne.props.afterPopupVisibleChange(ne.state.popupVisible)},ne.triggerContextValue={onPopupMouseDown:ne.onPopupMouseDown};var ve;return"popupVisible"in le?ve=!!le.popupVisible:ve=!!le.defaultPopupVisible,ne.state={prevPopupVisible:ve,popupVisible:ve},wi.forEach(function(ye){ne["fire".concat(ye)]=function(ke){ne.fireEvents(ye,ke)}}),ne}return Object(A.a)(q,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var ne=this.props,ve=this.state;if(ve.popupVisible){var ye;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(ye=ne.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(We.a)(ye,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(ye=ye||ne.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(We.a)(ye,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(ye=ye||ne.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(We.a)(ye,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(We.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),ct.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var ne;return((ne=this.popupRef.current)===null||ne===void 0?void 0:ne.getElement())||null}},{key:"getPopupAlign",value:function(){var ne=this.props,ve=ne.popupPlacement,ye=ne.popupAlign,ke=ne.builtinPlacements;return ve&&ke?Qe(ke,ve,ye):ye}},{key:"setPopupVisible",value:function(ne,ve){var ye=this.props.alignPoint,ke=this.state.popupVisible;this.clearDelayTimer(),ke!==ne&&("popupVisible"in this.props||this.setState({popupVisible:ne,prevPopupVisible:ke}),this.props.onPopupVisibleChange(ne)),ye&&ve&&ne&&this.setPoint(ve)}},{key:"delaySetPopupVisible",value:function(ne,ve,ye){var ke=this,_e=ve*1e3;if(this.clearDelayTimer(),_e){var Ie=ye?{pageX:ye.pageX,pageY:ye.pageY}:null;this.delayTimer=window.setTimeout(function(){ke.setPopupVisible(ne,Ie),ke.clearDelayTimer()},_e)}else this.setPopupVisible(ne,ye)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(ne){var ve=this.props.children.props,ye=this.props;return ve[ne]&&ye[ne]?this["fire".concat(ne)]:ve[ne]||ye[ne]}},{key:"isClickToShow",value:function(){var ne=this.props,ve=ne.action,ye=ne.showAction;return ve.indexOf("click")!==-1||ye.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var ne=this.props.action;return ne==="contextMenu"||ne.length===1&&ne[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var ne=this.props,ve=ne.action,ye=ne.showAction;return ve.indexOf("contextMenu")!==-1||ye.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var ne=this.props,ve=ne.action,ye=ne.hideAction;return ve.indexOf("click")!==-1||ye.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var ne=this.props,ve=ne.action,ye=ne.showAction;return ve.indexOf("hover")!==-1||ye.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var ne=this.props,ve=ne.action,ye=ne.hideAction;return ve.indexOf("hover")!==-1||ye.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var ne=this.props,ve=ne.action,ye=ne.showAction;return ve.indexOf("focus")!==-1||ye.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var ne=this.props,ve=ne.action,ye=ne.hideAction;return ve.indexOf("focus")!==-1||ye.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var ne;(ne=this.popupRef.current)===null||ne===void 0||ne.forceAlign()}}},{key:"fireEvents",value:function(ne,ve){var ye=this.props.children.props[ne];ye&&ye(ve);var ke=this.props[ne];ke&&ke(ve)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var ne=this.state.popupVisible,ve=this.props,ye=ve.children,ke=ve.forceRender,_e=ve.alignPoint,Ie=ve.className,Ze=ve.autoDestroy,ft=O.Children.only(ye),ht={key:"trigger"};this.isContextMenuToShow()?ht.onContextMenu=this.onContextMenu:ht.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(ht.onClick=this.onClick,ht.onMouseDown=this.onMouseDown,ht.onTouchStart=this.onTouchStart):(ht.onClick=this.createTwoChains("onClick"),ht.onMouseDown=this.createTwoChains("onMouseDown"),ht.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(ht.onMouseEnter=this.onMouseEnter,_e&&(ht.onMouseMove=this.onMouseMove)):ht.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?ht.onMouseLeave=this.onMouseLeave:ht.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(ht.onFocus=this.onFocus,ht.onBlur=this.onBlur):(ht.onFocus=this.createTwoChains("onFocus"),ht.onBlur=this.createTwoChains("onBlur"));var Ot=j()(ft&&ft.props&&ft.props.className,Ie);Ot&&(ht.className=Ot);var hn=Object(H.a)({},ht);Object(Pt.c)(ft)&&(hn.ref=Object(Pt.a)(this.triggerRef,ft.ref));var wn=O.cloneElement(ft,hn),yn;return(ne||this.popupRef.current||ke)&&(yn=O.createElement(de,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!ne&&Ze&&(yn=null),O.createElement(cn.Provider,{value:this.triggerContextValue},wn,yn)}}],[{key:"getDerivedStateFromProps",value:function(ne,ve){var ye=ne.popupVisible,ke={};return ye!==void 0&&ve.popupVisible!==ye&&(ke.popupVisible=ye,ke.prevPopupVisible=ve.popupVisible),ke}}]),q}(O.Component);return we.contextType=cn,we.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Qr,getDocument:ni,onPopupVisibleChange:Er,afterPopupVisibleChange:Er,onPopupAlign:Er,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},we}var hr=Ki(gt.a),_r={adjustX:1,adjustY:1},gi={topLeft:{points:["bl","tl"],overflow:_r,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:_r,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:_r,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:_r,offset:[4,0]}},Oi={topLeft:{points:["bl","tl"],overflow:_r,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:_r,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:_r,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:_r,offset:[4,0]}},qi=gi,rr=0,jn={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},fr=function(we,De,pe){var q=he(De),le=we.getState();we.setState({defaultActiveFirst:Object(H.a)(Object(H.a)({},le.defaultActiveFirst),{},Object(ie.a)({},q,pe))})},xn=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(pe){var q;Object(L.a)(this,De),q=we.call(this,pe),q.onDestroy=function(_e){q.props.onDestroy(_e)},q.onKeyDown=function(_e){var Ie=_e.keyCode,Ze=q.menuInstance,ft=q.props.store,ht=q.getVisible();if(Ie===y.a.ENTER)return q.onTitleClick(_e),fr(ft,q.props.eventKey,!0),!0;if(Ie===y.a.RIGHT)return ht?Ze.onKeyDown(_e):(q.triggerOpenChange(!0),fr(ft,q.props.eventKey,!0)),!0;if(Ie===y.a.LEFT){var Ot;if(ht)Ot=Ze.onKeyDown(_e);else return;return Ot||(q.triggerOpenChange(!1),Ot=!0),Ot}return ht&&(Ie===y.a.UP||Ie===y.a.DOWN)?Ze.onKeyDown(_e):void 0},q.onOpenChange=function(_e){q.props.onOpenChange(_e)},q.onPopupVisibleChange=function(_e){q.triggerOpenChange(_e,_e?"mouseenter":"mouseleave")},q.onMouseEnter=function(_e){var Ie=q.props,Ze=Ie.eventKey,ft=Ie.onMouseEnter,ht=Ie.store;fr(ht,q.props.eventKey,!1),ft({key:Ze,domEvent:_e})},q.onMouseLeave=function(_e){var Ie=q.props,Ze=Ie.parentMenu,ft=Ie.eventKey,ht=Ie.onMouseLeave;Ze.subMenuInstance=Object(T.a)(q),ht({key:ft,domEvent:_e})},q.onTitleMouseEnter=function(_e){var Ie=q.props,Ze=Ie.eventKey,ft=Ie.onItemHover,ht=Ie.onTitleMouseEnter;ft({key:Ze,hover:!0}),ht({key:Ze,domEvent:_e})},q.onTitleMouseLeave=function(_e){var Ie=q.props,Ze=Ie.parentMenu,ft=Ie.eventKey,ht=Ie.onItemHover,Ot=Ie.onTitleMouseLeave;Ze.subMenuInstance=Object(T.a)(q),ht({key:ft,hover:!1}),Ot({key:ft,domEvent:_e})},q.onTitleClick=function(_e){var Ie=Object(T.a)(q),Ze=Ie.props;if(Ze.onTitleClick({key:Ze.eventKey,domEvent:_e}),Ze.triggerSubMenuAction==="hover")return;q.triggerOpenChange(!q.getVisible(),"click"),fr(Ze.store,q.props.eventKey,!1)},q.onSubMenuClick=function(_e){typeof q.props.onClick=="function"&&q.props.onClick(q.addKeyPath(_e))},q.onSelect=function(_e){q.props.onSelect(_e)},q.onDeselect=function(_e){q.props.onDeselect(_e)},q.getPrefixCls=function(){return"".concat(q.props.rootPrefixCls,"-submenu")},q.getActiveClassName=function(){return"".concat(q.getPrefixCls(),"-active")},q.getDisabledClassName=function(){return"".concat(q.getPrefixCls(),"-disabled")},q.getSelectedClassName=function(){return"".concat(q.getPrefixCls(),"-selected")},q.getOpenClassName=function(){return"".concat(q.props.rootPrefixCls,"-submenu-open")},q.getVisible=function(){return q.state.isOpen},q.getMode=function(){return q.state.mode},q.saveMenuInstance=function(_e){q.menuInstance=_e},q.addKeyPath=function(_e){return Object(H.a)(Object(H.a)({},_e),{},{keyPath:(_e.keyPath||[]).concat(q.props.eventKey)})},q.triggerOpenChange=function(_e,Ie){var Ze=q.props.eventKey,ft=function(){q.onOpenChange({key:Ze,item:Object(T.a)(q),trigger:Ie,open:_e})};Ie==="mouseenter"?q.mouseenterTimeout=setTimeout(function(){ft()},0):ft()},q.isChildrenSelected=function(){var _e={find:!1};return Ve(q.props.children,q.props.selectedKeys,_e),_e.find},q.isInlineMode=function(){return q.getMode()==="inline"},q.adjustWidth=function(){if(!q.subMenuTitle||!q.menuInstance)return;var _e=Et.findDOMNode(q.menuInstance);if(_e.offsetWidth>=q.subMenuTitle.offsetWidth)return;_e.style.minWidth="".concat(q.subMenuTitle.offsetWidth,"px")},q.saveSubMenuTitle=function(_e){q.subMenuTitle=_e},q.getBaseProps=function(){var _e=Object(T.a)(q),Ie=_e.props,Ze=q.getMode();return{mode:Ze==="horizontal"?"vertical":Ze,visible:q.getVisible(),level:Ie.level+1,inlineIndent:Ie.inlineIndent,focusable:!1,onClick:q.onSubMenuClick,onSelect:q.onSelect,onDeselect:q.onDeselect,onDestroy:q.onDestroy,selectedKeys:Ie.selectedKeys,eventKey:"".concat(Ie.eventKey,"-menu-"),openKeys:Ie.openKeys,motion:Ie.motion,onOpenChange:q.onOpenChange,subMenuOpenDelay:Ie.subMenuOpenDelay,parentMenu:Object(T.a)(q),subMenuCloseDelay:Ie.subMenuCloseDelay,forceSubMenuRender:Ie.forceSubMenuRender,triggerSubMenuAction:Ie.triggerSubMenuAction,builtinPlacements:Ie.builtinPlacements,defaultActiveFirst:Ie.store.getState().defaultActiveFirst[he(Ie.eventKey)],multiple:Ie.multiple,prefixCls:Ie.rootPrefixCls,id:q.internalMenuId,manualRef:q.saveMenuInstance,itemIcon:Ie.itemIcon,expandIcon:Ie.expandIcon,direction:Ie.direction}},q.getMotion=function(_e,Ie){var Ze=Object(T.a)(q),ft=Ze.haveRendered,ht=q.props,Ot=ht.motion,hn=ht.rootPrefixCls,wn=Object(H.a)(Object(H.a)({},Ot),{},{leavedClassName:"".concat(hn,"-hidden"),removeOnLeave:!1,motionAppear:ft||!Ie||_e!=="inline"});return wn};var le=pe.store,ne=pe.eventKey,ve=le.getState(),ye=ve.defaultActiveFirst;q.isRootMenu=!1;var ke=!1;return ye&&(ke=ye[ne]),fr(le,ne,ke),q.state={mode:pe.mode,isOpen:pe.isOpen},q}return Object(A.a)(De,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var q=this,le=this.props,ne=le.mode,ve=le.parentMenu,ye=le.manualRef,ke=le.isOpen,_e=function(){q.setState({mode:ne,isOpen:ke})},Ie=ke!==this.state.isOpen,Ze=ne!==this.state.mode;if((Ze||Ie)&&(ct.a.cancel(this.updateStateRaf),Ze?this.updateStateRaf=Object(ct.a)(_e):_e()),ye&&ye(this),ne!=="horizontal"||!(ve==null?void 0:ve.isRootMenu)||!ke)return;this.minWidthTimeout=setTimeout(function(){return q.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var q=this.props,le=q.onDestroy,ne=q.eventKey;le&&le(ne),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),ct.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(q,le){var ne=this.getBaseProps();return O.createElement(Ar,Object(v.a)({},ne,{id:this.internalMenuId,className:q,style:le}),this.props.children)}},{key:"renderChildren",value:function(){var q=this,le=this.getBaseProps(),ne=le.mode,ve=le.visible,ye=le.forceSubMenuRender,ke=le.direction,_e=this.getMotion(ne,ve);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||ve||ye,!this.haveOpened)return O.createElement("div",null);var Ie=j()("".concat(le.prefixCls,"-sub"),Object(ie.a)({},"".concat(le.prefixCls,"-rtl"),ke==="rtl"));return this.isInlineMode()?O.createElement(G,Object(v.a)({visible:le.visible,forceRender:ye},_e),function(Ze){var ft=Ze.className,ht=Ze.style,Ot=j()(Ie,ft);return q.renderPopupMenu(Ot,ht)}):this.renderPopupMenu(Ie)}},{key:"render",value:function(){var q,le,ne,ve=Object(H.a)({},this.props),ye=this.getVisible(),ke=this.getPrefixCls(),_e=this.isInlineMode(),Ie=this.getMode(),Ze=j()(ke,"".concat(ke,"-").concat(Ie),(q={},Object(ie.a)(q,ve.className,!!ve.className),Object(ie.a)(q,this.getOpenClassName(),ye),Object(ie.a)(q,this.getActiveClassName(),ve.active||ye&&!_e),Object(ie.a)(q,this.getDisabledClassName(),ve.disabled),Object(ie.a)(q,this.getSelectedClassName(),this.isChildrenSelected()),q));this.internalMenuId||(ve.eventKey?this.internalMenuId="".concat(ve.eventKey,"$Menu"):(rr+=1,this.internalMenuId="$__$".concat(rr,"$Menu")));var ft={},ht={},Ot={};ve.disabled||(ft={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},ht={onClick:this.onTitleClick},Ot={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var hn={},wn=ve.direction,yn=wn==="rtl";_e&&(yn?hn.paddingRight=ve.inlineIndent*ve.level:hn.paddingLeft=ve.inlineIndent*ve.level);var Cn={};this.getVisible()&&(Cn={"aria-owns":this.internalMenuId});var _n=null;Ie!=="horizontal"&&(_n=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(_n=O.createElement(this.props.expandIcon,Object(H.a)({},this.props))));var Tn=O.createElement("div",Object(v.a)({ref:this.saveSubMenuTitle,style:hn,className:"".concat(ke,"-title"),role:"button"},Ot,ht,{"aria-expanded":ye},Cn,{"aria-haspopup":"true",title:typeof ve.title=="string"?ve.title:void 0}),ve.title,_n||O.createElement("i",{className:"".concat(ke,"-arrow")})),Sn=this.renderChildren(),Hn=((le=ve.parentMenu)===null||le===void 0?void 0:le.isRootMenu)?ve.parentMenu.props.getPopupContainer:function(ir){return ir.parentNode},Rn=jn[Ie],gr=ve.popupOffset?{offset:ve.popupOffset}:{},kn=j()((ne={},Object(ie.a)(ne,ve.popupClassName,ve.popupClassName&&!_e),Object(ie.a)(ne,"".concat(ke,"-rtl"),yn),ne)),sn=ve.disabled,nn=ve.triggerSubMenuAction,Mn=ve.subMenuOpenDelay,Kn=ve.forceSubMenuRender,Yt=ve.subMenuCloseDelay,Xn=ve.builtinPlacements;et.forEach(function(ir){return delete ve[ir]}),delete ve.onClick;var yr=yn?Object(H.a)(Object(H.a)({},Oi),Xn):Object(H.a)(Object(H.a)({},gi),Xn);delete ve.direction;var Jn=this.getBaseProps(),or=_e?null:this.getMotion(Jn.mode,Jn.visible);return O.createElement("li",Object(v.a)({},ve,ft,{className:Ze,role:"menuitem"}),O.createElement(hr,{prefixCls:ke,popupClassName:j()("".concat(ke,"-popup"),kn),getPopupContainer:Hn,builtinPlacements:yr,popupPlacement:Rn,popupVisible:_e?!1:ye,popupAlign:gr,popup:_e?null:Sn,action:sn||_e?[]:[nn],mouseEnterDelay:Mn,mouseLeaveDelay:Yt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Kn,popupMotion:or},Tn),_e?Sn:null)}}]),De}(O.Component);xn.defaultProps={onMouseEnter:ut,onMouseLeave:ut,onTitleMouseEnter:ut,onTitleMouseLeave:ut,onTitleClick:ut,manualRef:ut,mode:"vertical",title:""};var pr=Object(u.b)(function(de,we){var De=de.openKeys,pe=de.activeKey,q=de.selectedKeys,le=we.eventKey,ne=we.subMenuKey;return{isOpen:De.indexOf(le)>-1,active:pe[ne]===le,selectedKeys:q}})(xn);pr.isSubMenu=!0;var Yn=pr,ri="menuitem-overflowed",vr=.5,jr=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(){var pe;return Object(L.a)(this,De),pe=we.apply(this,arguments),pe.resizeObserver=null,pe.mutationObserver=null,pe.originalTotalWidth=0,pe.overflowedItems=[],pe.menuItemSizes=[],pe.cancelFrameId=null,pe.state={lastVisibleIndex:void 0},pe.childRef=O.createRef(),pe.getMenuItemNodes=function(){var q=pe.props.prefixCls,le=pe.childRef.current;return le?[].slice.call(le.children).filter(function(ne){return ne.className.split(" ").indexOf("".concat(q,"-overflowed-submenu"))<0}):[]},pe.getOverflowedSubMenuItem=function(q,le,ne){var ve=pe.props,ye=ve.overflowedIndicator,ke=ve.level,_e=ve.mode,Ie=ve.prefixCls,Ze=ve.theme;if(ke!==1||_e!=="horizontal")return null;var ft=pe.props.children[0],ht=ft.props,Ot=ht.children,hn=ht.title,wn=ht.style,yn=Object(M.a)(ht,["children","title","style"]),Cn=Object(H.a)({},wn),_n="".concat(q,"-overflowed-indicator"),Tn="".concat(q,"-overflowed-indicator");le.length===0&&ne!==!0?Cn=Object(H.a)(Object(H.a)({},Cn),{},{display:"none"}):ne&&(Cn=Object(H.a)(Object(H.a)({},Cn),{},{visibility:"hidden",position:"absolute"}),_n="".concat(_n,"-placeholder"),Tn="".concat(Tn,"-placeholder"));var Sn=Ze?"".concat(Ie,"-").concat(Ze):"",Hn={};return et.forEach(function(Rn){yn[Rn]!==void 0&&(Hn[Rn]=yn[Rn])}),O.createElement(Yn,Object(v.a)({title:ye,className:"".concat(Ie,"-overflowed-submenu"),popupClassName:Sn},Hn,{key:_n,eventKey:Tn,disabled:!1,style:Cn}),le)},pe.setChildrenWidthAndResize=function(){if(pe.props.mode!=="horizontal")return;var q=pe.childRef.current;if(!q)return;var le=q.children;if(!le||le.length===0)return;var ne=q.children[le.length-1];rt(ne,"display","inline-block");var ve=pe.getMenuItemNodes(),ye=ve.filter(function(ke){return ke.className.split(" ").indexOf(ri)>=0});ye.forEach(function(ke){rt(ke,"display","inline-block")}),pe.menuItemSizes=ve.map(function(ke){return tt(ke,!0)}),ye.forEach(function(ke){rt(ke,"display","none")}),pe.overflowedIndicatorWidth=tt(q.children[q.children.length-1],!0),pe.originalTotalWidth=pe.menuItemSizes.reduce(function(ke,_e){return ke+_e},0),pe.handleResize(),rt(ne,"display","none")},pe.handleResize=function(){if(pe.props.mode!=="horizontal")return;var q=pe.childRef.current;if(!q)return;var le=tt(q);pe.overflowedItems=[];var ne=0,ve;pe.originalTotalWidth>le+vr&&(ve=-1,pe.menuItemSizes.forEach(function(ye){ne+=ye,ne+pe.overflowedIndicatorWidth<=le&&(ve+=1)})),pe.setState({lastVisibleIndex:ve})},pe}return Object(A.a)(De,[{key:"componentDidMount",value:function(){var q=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var le=this.childRef.current;if(!le)return;this.resizeObserver=new Dt.default(function(ne){ne.forEach(function(){var ve=q.cancelFrameId;cancelAnimationFrame(ve),q.cancelFrameId=requestAnimationFrame(q.setChildrenWidthAndResize)})}),[].slice.call(le.children).concat(le).forEach(function(ne){q.resizeObserver.observe(ne)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){q.resizeObserver.disconnect(),[].slice.call(le.children).concat(le).forEach(function(ne){q.resizeObserver.observe(ne)}),q.setChildrenWidthAndResize()}),this.mutationObserver.observe(le,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(q){var le=this,ne=this.state.lastVisibleIndex;return(q||[]).reduce(function(ve,ye,ke){var _e=ye;if(le.props.mode==="horizontal"){var Ie=le.getOverflowedSubMenuItem(ye.props.eventKey,[]);ne!==void 0&&le.props.className.indexOf("".concat(le.props.prefixCls,"-root"))!==-1&&(ke>ne&&(_e=O.cloneElement(ye,{style:{display:"none"},eventKey:"".concat(ye.props.eventKey,"-hidden"),className:"".concat(ri)})),ke===ne+1&&(le.overflowedItems=q.slice(ne+1).map(function(ft){return O.cloneElement(ft,{key:ft.props.eventKey,mode:"vertical-left"})}),Ie=le.getOverflowedSubMenuItem(ye.props.eventKey,le.overflowedItems)));var Ze=[].concat(Object(R.a)(ve),[Ie,_e]);return ke===q.length-1&&Ze.push(le.getOverflowedSubMenuItem(ye.props.eventKey,[],!0)),Ze}return[].concat(Object(R.a)(ve),[_e])},[])}},{key:"render",value:function(){var q=this.props,le=q.visible,ne=q.prefixCls,ve=q.overflowedIndicator,ye=q.mode,ke=q.level,_e=q.tag,Ie=q.children,Ze=q.theme,ft=Object(M.a)(q,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),ht=_e;return O.createElement(ht,Object(v.a)({ref:this.childRef},ft),this.renderChildren(Ie))}}]),De}(O.Component);jr.defaultProps={tag:"div",className:""};var zi=jr;function ci(de){return de.length?de.every(function(we){return!!we.props.disabled}):!0}function hi(de,we,De){var pe=de.getState();de.setState({activeKey:Object(H.a)(Object(H.a)({},pe.activeKey),{},Object(ie.a)({},we,De))})}function _i(de){return de.eventKey||"0-menu-"}function Nr(de,we){var De=we,pe=de.children,q=de.eventKey;if(De){var le;if(Le(pe,function(ne,ve){ne&&ne.props&&!ne.props.disabled&&De===ce(ne,q,ve)&&(le=!0)}),le)return De}return De=null,de.defaultActiveFirst&&Le(pe,function(ne,ve){!De&&ne&&!ne.props.disabled&&(De=ce(ne,q,ve))}),De}function Gi(de){if(!de)return;var we=this.instanceArray.indexOf(de);we!==-1?this.instanceArray[we]=de:this.instanceArray.push(de)}var mr=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(pe){var q;return Object(L.a)(this,De),q=we.call(this,pe),q.onKeyDown=function(le,ne){var ve=le.keyCode,ye;if(q.getFlatInstanceArray().forEach(function(_e){_e&&_e.props.active&&_e.onKeyDown&&(ye=_e.onKeyDown(le))}),ye)return 1;var ke=null;return(ve===y.a.UP||ve===y.a.DOWN)&&(ke=q.step(ve===y.a.UP?-1:1)),ke?(le.preventDefault(),hi(q.props.store,_i(q.props),ke.props.eventKey),typeof ne=="function"&&ne(ke),1):void 0},q.onItemHover=function(le){var ne=le.key,ve=le.hover;hi(q.props.store,_i(q.props),ve?ne:null)},q.onDeselect=function(le){q.props.onDeselect(le)},q.onSelect=function(le){q.props.onSelect(le)},q.onClick=function(le){q.props.onClick(le)},q.onOpenChange=function(le){q.props.onOpenChange(le)},q.onDestroy=function(le){q.props.onDestroy(le)},q.getFlatInstanceArray=function(){return q.instanceArray},q.step=function(le){var ne=q.getFlatInstanceArray(),ve=q.props.store.getState().activeKey[_i(q.props)],ye=ne.length;if(!ye)return null;le<0&&(ne=ne.concat().reverse());var ke=-1;if(ne.every(function(ft,ht){return ft&&ft.props.eventKey===ve?(ke=ht,!1):!0}),!q.props.defaultActiveFirst&&ke!==-1&&ci(ne.slice(ke,ye-1)))return;var _e=(ke+1)%ye,Ie=_e;do{var Ze=ne[Ie];if(!Ze||Ze.props.disabled)Ie=(Ie+1)%ye;else return Ze}while(Ie!==_e);return null},q.renderCommonMenuItem=function(le,ne,ve){var ye=q.props.store.getState(),ke=Object(T.a)(q),_e=ke.props,Ie=ce(le,_e.eventKey,ne),Ze=le.props;if(!Ze||typeof le.type=="string")return le;var ft=Ie===ye.activeKey,ht=Object(H.a)(Object(H.a)({mode:Ze.mode||_e.mode,level:_e.level,inlineIndent:_e.inlineIndent,renderMenuItem:q.renderMenuItem,rootPrefixCls:_e.prefixCls,index:ne,parentMenu:_e.parentMenu,manualRef:Ze.disabled?void 0:Object(S.a)(le.ref,Gi.bind(Object(T.a)(q))),eventKey:Ie,active:!Ze.disabled&&ft,multiple:_e.multiple,onClick:function(hn){(Ze.onClick||ut)(hn),q.onClick(hn)},onItemHover:q.onItemHover,motion:_e.motion,subMenuOpenDelay:_e.subMenuOpenDelay,subMenuCloseDelay:_e.subMenuCloseDelay,forceSubMenuRender:_e.forceSubMenuRender,onOpenChange:q.onOpenChange,onDeselect:q.onDeselect,onSelect:q.onSelect,builtinPlacements:_e.builtinPlacements,itemIcon:Ze.itemIcon||q.props.itemIcon,expandIcon:Ze.expandIcon||q.props.expandIcon},ve),{},{direction:_e.direction});return(_e.mode==="inline"||it())&&(ht.triggerSubMenuAction="click"),O.cloneElement(le,Object(H.a)(Object(H.a)({},ht),{},{key:Ie||ne}))},q.renderMenuItem=function(le,ne,ve){if(!le)return null;var ye=q.props.store.getState(),ke={openKeys:ye.openKeys,selectedKeys:ye.selectedKeys,triggerSubMenuAction:q.props.triggerSubMenuAction,subMenuKey:ve};return q.renderCommonMenuItem(le,ne,ke)},pe.store.setState({activeKey:Object(H.a)(Object(H.a)({},pe.store.getState().activeKey),{},Object(ie.a)({},pe.eventKey,Nr(pe,pe.activeKey)))}),q.instanceArray=[],q}return Object(A.a)(De,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(q){return this.props.visible||q.visible||this.props.className!==q.className||!b()(this.props.style,q.style)}},{key:"componentDidUpdate",value:function(q){var le=this.props,ne="activeKey"in le?le.activeKey:le.store.getState().activeKey[_i(le)],ve=Nr(le,ne);if(ve!==ne)hi(le.store,_i(le),ve);else if("activeKey"in q){var ye=Nr(q,q.activeKey);ve!==ye&&hi(le.store,_i(le),ve)}}},{key:"render",value:function(){var q=this,le=Object(v.a)({},this.props);this.instanceArray=[];var ne=j()(le.prefixCls,le.className,"".concat(le.prefixCls,"-").concat(le.mode)),ve={className:ne,role:le.role||"menu"};le.id&&(ve.id=le.id),le.focusable&&(ve.tabIndex=0,ve.onKeyDown=this.onKeyDown);var ye=le.prefixCls,ke=le.eventKey,_e=le.visible,Ie=le.level,Ze=le.mode,ft=le.overflowedIndicator,ht=le.theme;return et.forEach(function(Ot){return delete le[Ot]}),delete le.onClick,O.createElement(zi,Object(v.a)({},le,{prefixCls:ye,mode:Ze,tag:"ul",level:Ie,theme:ht,visible:_e,overflowedIndicator:ft},ve),Object(N.a)(le.children).map(function(Ot,hn){return q.renderMenuItem(Ot,hn,ke||"0-menu-")}))}}]),De}(O.Component);mr.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:ut};var Vn=Object(u.b)()(mr),Ar=Vn,Tr=$("Kwbf");function ii(de,we,De){var pe=de.prefixCls,q=de.motion,le=de.defaultMotions,ne=le===void 0?{}:le,ve=de.openAnimation,ye=de.openTransitionName,ke=we.switchingModeFromInline;if(q)return q;if(Object(K.a)(ve)==="object"&&ve)Object(Tr.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof ve=="string")return{motionName:"".concat(pe,"-open-").concat(ve)};if(ye)return{motionName:ye};var _e=ne[De];return _e||(ke?null:ne.other)}var Rr=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(pe){var q;Object(L.a)(this,De),q=we.call(this,pe),q.onSelect=function(ve){var ye=Object(T.a)(q),ke=ye.props;if(ke.selectable){var _e=q.store.getState(),Ie=_e.selectedKeys,Ze=ve.key;ke.multiple?Ie=Ie.concat([Ze]):Ie=[Ze],"selectedKeys"in ke||q.store.setState({selectedKeys:Ie}),ke.onSelect(Object(H.a)(Object(H.a)({},ve),{},{selectedKeys:Ie}))}},q.onClick=function(ve){var ye=q.getRealMenuMode(),ke=Object(T.a)(q),_e=ke.store,Ie=ke.props.onOpenChange;ye!=="inline"&&!("openKeys"in q.props)&&(_e.setState({openKeys:[]}),Ie([])),q.props.onClick(ve)},q.onKeyDown=function(ve,ye){q.innerMenu.getWrappedInstance().onKeyDown(ve,ye)},q.onOpenChange=function(ve){var ye=Object(T.a)(q),ke=ye.props,_e=q.store.getState().openKeys.concat(),Ie=!1,Ze=function(ht){var Ot=!1;if(ht.open)Ot=_e.indexOf(ht.key)===-1,Ot&&_e.push(ht.key);else{var hn=_e.indexOf(ht.key);Ot=hn!==-1,Ot&&_e.splice(hn,1)}Ie=Ie||Ot};Array.isArray(ve)?ve.forEach(Ze):Ze(ve),Ie&&("openKeys"in q.props||q.store.setState({openKeys:_e}),ke.onOpenChange(_e))},q.onDeselect=function(ve){var ye=Object(T.a)(q),ke=ye.props;if(ke.selectable){var _e=q.store.getState().selectedKeys.concat(),Ie=ve.key,Ze=_e.indexOf(Ie);Ze!==-1&&_e.splice(Ze,1),"selectedKeys"in ke||q.store.setState({selectedKeys:_e}),ke.onDeselect(Object(H.a)(Object(H.a)({},ve),{},{selectedKeys:_e}))}},q.onMouseEnter=function(ve){q.restoreModeVerticalFromInline();var ye=q.props.onMouseEnter;ye&&ye(ve)},q.onTransitionEnd=function(ve){var ye=ve.propertyName==="width"&&ve.target===ve.currentTarget,ke=ve.target.className,_e=Object.prototype.toString.call(ke)==="[object SVGAnimatedString]"?ke.animVal:ke,Ie=ve.propertyName==="font-size"&&_e.indexOf("anticon")>=0;(ye||Ie)&&q.restoreModeVerticalFromInline()},q.setInnerMenu=function(ve){q.innerMenu=ve},q.isRootMenu=!0;var le=pe.defaultSelectedKeys,ne=pe.defaultOpenKeys;return"selectedKeys"in pe&&(le=pe.selectedKeys||[]),"openKeys"in pe&&(ne=pe.openKeys||[]),q.store=Object(u.c)({selectedKeys:le,openKeys:ne,activeKey:{"0-menu-":Nr(pe,pe.activeKey)}}),q.state={switchingModeFromInline:!1,prevProps:pe,inlineOpenKeys:[],store:q.store},q}return Object(A.a)(De,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(q){var le=this.props,ne=le.siderCollapsed,ve=le.inlineCollapsed,ye=le.onOpenChange;(!q.inlineCollapsed&&ve||!q.siderCollapsed&&ne)&&ye([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var q=this.props.collapsedWidth,le=this.store,ne=this.prevOpenKeys,ve=this.getInlineCollapsed()&&(q===0||q==="0"||q==="0px");ve?(this.prevOpenKeys=le.getState().openKeys.concat(),this.store.setState({openKeys:[]})):ne&&(this.store.setState({openKeys:ne}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var q=this.props.mode,le=this.state.switchingModeFromInline,ne=this.getInlineCollapsed();return le&&ne?"inline":ne?"vertical":q}},{key:"getInlineCollapsed",value:function(){var q=this.props,le=q.inlineCollapsed,ne=q.siderCollapsed;return ne!==void 0?ne:le}},{key:"restoreModeVerticalFromInline",value:function(){var q=this.state.switchingModeFromInline;q&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var q=Object(H.a)({},Object(D.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),le=this.getRealMenuMode();return q.className+=" ".concat(q.prefixCls,"-root"),q.direction==="rtl"&&(q.className+=" ".concat(q.prefixCls,"-rtl")),q=Object(H.a)(Object(H.a)({},q),{},{mode:le,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:ii(this.props,this.state,le)}),delete q.openAnimation,delete q.openTransitionName,O.createElement(u.a,{store:this.store},O.createElement(Ar,Object(v.a)({},q,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(q,le){var ne=le.prevProps,ve=le.store,ye=ve.getState(),ke={},_e={prevProps:q};return ne.mode==="inline"&&q.mode!=="inline"&&(_e.switchingModeFromInline=!0),"openKeys"in q?ke.openKeys=q.openKeys||[]:((q.inlineCollapsed&&!ne.inlineCollapsed||q.siderCollapsed&&!ne.siderCollapsed)&&(_e.switchingModeFromInline=!0,_e.inlineOpenKeys=ye.openKeys,ke.openKeys=[]),(!q.inlineCollapsed&&ne.inlineCollapsed||!q.siderCollapsed&&ne.siderCollapsed)&&(ke.openKeys=le.inlineOpenKeys,_e.inlineOpenKeys=[])),Object.keys(ke).length&&ve.setState(ke),_e}}]),De}(O.Component);Rr.defaultProps={selectable:!0,onClick:ut,onSelect:ut,onOpenChange:ut,onDeselect:ut,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:O.createElement("span",null,"\xB7\xB7\xB7")};var Kt=Rr,en=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(){var pe;return Object(L.a)(this,De),pe=we.apply(this,arguments),pe.onKeyDown=function(q){var le=q.keyCode;return le===y.a.ENTER?(pe.onClick(q),!0):void 0},pe.onMouseLeave=function(q){var le=pe.props,ne=le.eventKey,ve=le.onItemHover,ye=le.onMouseLeave;ve({key:ne,hover:!1}),ye({key:ne,domEvent:q})},pe.onMouseEnter=function(q){var le=pe.props,ne=le.eventKey,ve=le.onItemHover,ye=le.onMouseEnter;ve({key:ne,hover:!0}),ye({key:ne,domEvent:q})},pe.onClick=function(q){var le=pe.props,ne=le.eventKey,ve=le.multiple,ye=le.onClick,ke=le.onSelect,_e=le.onDeselect,Ie=le.isSelected,Ze={key:ne,keyPath:[ne],item:Object(T.a)(pe),domEvent:q};ye(Ze),ve?Ie?_e(Ze):ke(Ze):Ie||ke(Ze)},pe.saveNode=function(q){pe.node=q},pe}return Object(A.a)(De,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var q=this.props;q.onDestroy&&q.onDestroy(q.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var q,le=Object(H.a)({},this.props),ne=j()(this.getPrefixCls(),le.className,(q={},Object(ie.a)(q,this.getActiveClassName(),!le.disabled&&le.active),Object(ie.a)(q,this.getSelectedClassName(),le.isSelected),Object(ie.a)(q,this.getDisabledClassName(),le.disabled),q)),ve=Object(H.a)(Object(H.a)({},le.attribute),{},{title:typeof le.title=="string"?le.title:void 0,className:ne,role:le.role||"menuitem","aria-disabled":le.disabled});le.role==="option"?ve=Object(H.a)(Object(H.a)({},ve),{},{role:"option","aria-selected":le.isSelected}):(le.role===null||le.role==="none")&&(ve.role="none");var ye={onClick:le.disabled?null:this.onClick,onMouseLeave:le.disabled?null:this.onMouseLeave,onMouseEnter:le.disabled?null:this.onMouseEnter},ke=Object(H.a)({},le.style);le.mode==="inline"&&(le.direction==="rtl"?ke.paddingRight=le.inlineIndent*le.level:ke.paddingLeft=le.inlineIndent*le.level),et.forEach(function(Ie){return delete le[Ie]}),delete le.direction;var _e=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(_e=O.createElement(this.props.itemIcon,this.props)),O.createElement("li",Object(v.a)({},Object(D.a)(le,["onClick","onMouseEnter","onMouseLeave","onSelect"]),ve,ye,{style:ke,ref:this.saveNode}),le.children,_e)}}]),De}(O.Component);en.isMenuItem=!0,en.defaultProps={onSelect:ut,onMouseEnter:ut,onMouseLeave:ut,manualRef:ut};var tn=Object(u.b)(function(de,we){var De=de.activeKey,pe=de.selectedKeys,q=we.eventKey,le=we.subMenuKey;return{active:De[le]===q,isSelected:Array.isArray(pe)?pe.indexOf(q)!==-1:pe===q}})(en),An=tn,Wn=function(de){Object(x.a)(De,de);var we=Object(h.a)(De);function De(){var pe;return Object(L.a)(this,De),pe=we.apply(this,arguments),pe.renderInnerMenuItem=function(q){var le=pe.props,ne=le.renderMenuItem,ve=le.index;return ne(q,ve,pe.props.subMenuKey)},pe}return Object(A.a)(De,[{key:"render",value:function(){var q=Object(v.a)({},this.props),le=q.className,ne=le===void 0?"":le,ve=q.rootPrefixCls,ye="".concat(ve,"-item-group-title"),ke="".concat(ve,"-item-group-list"),_e=q.title,Ie=q.children;return et.forEach(function(Ze){return delete q[Ze]}),delete q.direction,O.createElement("li",Object(v.a)({},q,{onClick:function(ft){return ft.stopPropagation()},className:"".concat(ne," ").concat(ve,"-item-group")}),O.createElement("div",{className:ye,title:typeof _e=="string"?_e:void 0},_e),O.createElement("ul",{className:ke},O.Children.map(Ie,this.renderInnerMenuItem)))}}]),De}(O.Component);Wn.isMenuItemGroup=!0,Wn.defaultProps={disabled:!0};var tr=Wn,In=function(we){var De=we.className,pe=we.rootPrefixCls,q=we.style;return O.createElement("li",{className:"".concat(De," ").concat(pe,"-item-divider"),style:q})};In.defaultProps={disabled:!0,className:"",style:{}};var kr=In,Zr=Kt,Ln=$("eDIo");function Pi(de,we){var De=de.prefixCls,pe=de.editable,q=de.locale,le=de.style;return!pe||pe.showAdd===!1?null:O.createElement("button",{ref:we,type:"button",className:"".concat(De,"-nav-add"),style:le,"aria-label":(q==null?void 0:q.addAriaLabel)||"Add tab",onClick:function(ve){pe.onEdit("add",{event:ve})}},pe.addIcon||"+")}var $n=O.forwardRef(Pi);function Ur(de,we){var De=de.prefixCls,pe=de.id,q=de.tabs,le=de.locale,ne=de.mobile,ve=de.moreIcon,ye=ve===void 0?"More":ve,ke=de.moreTransitionName,_e=de.style,Ie=de.className,Ze=de.editable,ft=de.tabBarGutter,ht=de.rtl,Ot=de.onTabClick,hn=Object(O.useState)(!1),wn=Object(Y.a)(hn,2),yn=wn[0],Cn=wn[1],_n=Object(O.useState)(null),Tn=Object(Y.a)(_n,2),Sn=Tn[0],Hn=Tn[1],Rn="".concat(pe,"-more-popup"),gr="".concat(De,"-dropdown"),kn=Sn!==null?"".concat(Rn,"-").concat(Sn):null,sn=le==null?void 0:le.dropdownAriaLabel,nn=O.createElement(Zr,{onClick:function(or){var ir=or.key,Dr=or.domEvent;Ot(ir,Dr),Cn(!1)},id:Rn,tabIndex:-1,role:"listbox","aria-activedescendant":kn,selectedKeys:[Sn],"aria-label":sn!==void 0?sn:"expanded dropdown"},q.map(function(Jn){return O.createElement(An,{key:Jn.key,id:"".concat(Rn,"-").concat(Jn.key),role:"option","aria-controls":pe&&"".concat(pe,"-panel-").concat(Jn.key),disabled:Jn.disabled},Jn.tab)}));function Mn(Jn){for(var or=q.filter(function(qr){return!qr.disabled}),ir=or.findIndex(function(qr){return qr.key===Sn})||0,Dr=or.length,Wr=0;Wr<Dr;Wr+=1){ir=(ir+Jn+Dr)%Dr;var xr=or[ir];if(!xr.disabled){Hn(xr.key);return}}}function Kn(Jn){var or=Jn.which;if(!yn){[y.a.DOWN,y.a.SPACE,y.a.ENTER].includes(or)&&(Cn(!0),Jn.preventDefault());return}switch(or){case y.a.UP:Mn(-1),Jn.preventDefault();break;case y.a.DOWN:Mn(1),Jn.preventDefault();break;case y.a.ESC:Cn(!1);break;case y.a.SPACE:case y.a.ENTER:Sn!==null&&Ot(Sn,Jn);break}}Object(O.useEffect)(function(){var Jn=document.getElementById(kn);Jn&&Jn.scrollIntoView&&Jn.scrollIntoView(!1)},[Sn]),Object(O.useEffect)(function(){yn||Hn(null)},[yn]);var Yt=Object(ie.a)({},ht?"marginLeft":"marginRight",ft);q.length||(Yt.visibility="hidden",Yt.order=1);var Xn=j()(Object(ie.a)({},"".concat(gr,"-rtl"),ht)),yr=ne?null:O.createElement(Ln.a,{prefixCls:gr,overlay:nn,trigger:["hover"],visible:yn,transitionName:ke,onVisibleChange:Cn,overlayClassName:Xn,mouseEnterDelay:.1,mouseLeaveDelay:.1},O.createElement("button",{type:"button",className:"".concat(De,"-nav-more"),style:Yt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Rn,id:"".concat(pe,"-more"),"aria-expanded":yn,onKeyDown:Kn},ye));return O.createElement("div",{className:j()("".concat(De,"-nav-operations"),Ie),style:_e,ref:we},yr,O.createElement($n,{prefixCls:De,locale:le,editable:Ze}))}var yi=O.forwardRef(Ur),ai=Object(O.createContext)(null),Ea=.1,ea=.01,Or=20,go=Math.pow(.995,Or);function yo(){var de=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(de)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(de.substr(0,4)))}function ha(de,we){var De=Object(O.useState)(),pe=Object(Y.a)(De,2),q=pe[0],le=pe[1],ne=Object(O.useState)(0),ve=Object(Y.a)(ne,2),ye=ve[0],ke=ve[1],_e=Object(O.useState)(0),Ie=Object(Y.a)(_e,2),Ze=Ie[0],ft=Ie[1],ht=Object(O.useState)(),Ot=Object(Y.a)(ht,2),hn=Ot[0],wn=Ot[1],yn=Object(O.useRef)();function Cn(sn){var nn=sn.touches[0],Mn=nn.screenX,Kn=nn.screenY;le({x:Mn,y:Kn}),window.clearInterval(yn.current)}function _n(sn){if(!q)return;sn.preventDefault();var nn=sn.touches[0],Mn=nn.screenX,Kn=nn.screenY;le({x:Mn,y:Kn});var Yt=Mn-q.x,Xn=Kn-q.y;we(Yt,Xn);var yr=Date.now();ke(yr),ft(yr-ye),wn({x:Yt,y:Xn})}function Tn(){if(!q)return;if(le(null),wn(null),hn){var sn=hn.x/Ze,nn=hn.y/Ze,Mn=Math.abs(sn),Kn=Math.abs(nn);if(Math.max(Mn,Kn)<Ea)return;var Yt=sn,Xn=nn;yn.current=window.setInterval(function(){if(Math.abs(Yt)<ea&&Math.abs(Xn)<ea){window.clearInterval(yn.current);return}Yt*=go,Xn*=go,we(Yt*Or,Xn*Or)},Or)}}var Sn=Object(O.useRef)(0),Hn=Object(O.useRef)(!1),Rn=Object(O.useRef)();function gr(sn){var nn=sn.deltaX,Mn=sn.deltaY,Kn=0,Yt=Math.abs(nn),Xn=Math.abs(Mn);Yt===Xn?Kn=Rn.current==="x"?nn:Mn:Yt>Xn?(Kn=nn,Rn.current="x"):(Kn=Mn,Rn.current="y");var yr=Date.now();yr-Sn.current>100&&(Hn.current=!1),(we(-Kn,-Kn)||Hn.current)&&(sn.preventDefault(),Hn.current=!0),Sn.current=yr}var kn=Object(O.useRef)(null);kn.current={onTouchStart:Cn,onTouchMove:_n,onTouchEnd:Tn,onWheel:gr},O.useEffect(function(){function sn(Yt){kn.current.onTouchStart(Yt)}function nn(Yt){kn.current.onTouchMove(Yt)}function Mn(Yt){kn.current.onTouchEnd(Yt)}function Kn(Yt){kn.current.onWheel(Yt)}return document.addEventListener("touchmove",nn,{passive:!1}),document.addEventListener("touchend",Mn,{passive:!1}),de.current.addEventListener("touchstart",sn,{passive:!1}),de.current.addEventListener("wheel",Kn),function(){document.removeEventListener("touchmove",nn),document.removeEventListener("touchend",Mn)}},[])}function zo(){var de=Object(O.useRef)(new Map);function we(pe){return de.current.has(pe)||de.current.set(pe,O.createRef()),de.current.get(pe)}function De(pe){de.current.delete(pe)}return[we,De]}function Wa(de,we){var De=O.useRef(de),pe=O.useState({}),q=Object(Y.a)(pe,2),le=q[1];function ne(ve){var ye=typeof ve=="function"?ve(De.current):ve;ye!==De.current&&we(ye,De.current),De.current=ye,le({})}return[De.current,ne]}var bo=function(we){var De=we.position,pe=we.prefixCls,q=we.extra;if(!q)return null;var le,ne=q;return De==="right"&&(le=ne.right||!ne.left&&ne||null),De==="left"&&(le=ne.left||null),le?O.createElement("div",{className:"".concat(pe,"-extra-content")},le):null};function Ha(de,we){var De,pe=O.useContext(ai),q=pe.prefixCls,le=pe.tabs,ne=de.className,ve=de.style,ye=de.id,ke=de.animated,_e=de.activeKey,Ie=de.rtl,Ze=de.extra,ft=de.editable,ht=de.locale,Ot=de.tabPosition,hn=de.tabBarGutter,wn=de.children,yn=de.onTabClick,Cn=de.onTabScroll,_n=Object(O.useRef)(),Tn=Object(O.useRef)(),Sn=Object(O.useRef)(),Hn=Object(O.useRef)(),Rn=zo(),gr=Object(Y.a)(Rn,2),kn=gr[0],sn=gr[1],nn=Ot==="top"||Ot==="bottom",Mn=Wa(0,function(qn,Nn){nn&&Cn&&Cn({direction:qn>Nn?"left":"right"})}),Kn=Object(Y.a)(Mn,2),Yt=Kn[0],Xn=Kn[1],yr=Wa(0,function(qn,Nn){!nn&&Cn&&Cn({direction:qn>Nn?"top":"bottom"})}),Jn=Object(Y.a)(yr,2),or=Jn[0],ir=Jn[1],Dr=Object(O.useState)(0),Wr=Object(Y.a)(Dr,2),xr=Wr[0],qr=Wr[1],Ei=Object(O.useState)(0),oi=Object(Y.a)(Ei,2),Hr=oi[0],dr=oi[1],sr=Object(O.useState)(0),Cr=Object(Y.a)(sr,2),br=Cr[0],xi=Cr[1],Ii=Object(O.useState)(0),Ni=Object(Y.a)(Ii,2),ar=Ni[0],Ai=Ni[1],Ui=Object(O.useState)(null),ur=Object(Y.a)(Ui,2),nr=ur[0],Kr=ur[1],Co=Object(O.useState)(null),Va=Object(Y.a)(Co,2),Bi=Va[0],na=Va[1],xa=Object(O.useState)(0),Xa=Object(Y.a)(xa,2),Ca=Xa[0],Xo=Xa[1],Yo=Object(O.useState)(0),So=Object(Y.a)(Yo,2),Ya=So[0],$a=So[1],ra=m(new Map),ia=Object(Y.a)(ra,2),$o=ia[0],Sa=ia[1],fa=l(le,$o,xr),aa="".concat(q,"-nav-operations-hidden"),oa=0,Ci=0;nn?Ie?(oa=0,Ci=Math.max(0,xr-nr)):(oa=Math.min(0,nr-xr),Ci=0):(oa=Math.min(0,Bi-Hr),Ci=0);function Vi(qn){return qn<oa?[oa,!1]:qn>Ci?[Ci,!1]:[qn,!0]}var Fi=Object(O.useRef)(),pa=Object(O.useState)(),Xi=Object(Y.a)(pa,2),Ta=Xi[0],Ja=Xi[1];function wa(){Ja(Date.now())}function Qa(){window.clearTimeout(Fi.current)}ha(_n,function(qn,Nn){var zr=!1;function li(sa,Li){sa(function(ga){var Wi=Vi(ga+Li),Gr=Object(Y.a)(Wi,2),Oa=Gr[0],qa=Gr[1];return zr=qa,Oa})}if(nn){if(nr>=xr)return zr;li(Xn,qn)}else{if(Bi>=Hr)return zr;li(ir,Nn)}return Qa(),wa(),zr}),Object(O.useEffect)(function(){return Qa(),Ta&&(Fi.current=window.setTimeout(function(){Ja(0)},100)),Qa},[Ta]);function ji(){var qn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_e,Nn=fa.get(qn);if(!Nn)return;if(nn){var zr=Yt;Ie?Nn.right<Yt?zr=Nn.right:Nn.right+Nn.width>Yt+nr&&(zr=Nn.right+Nn.width-nr):Nn.left<-Yt?zr=-Nn.left:Nn.left+Nn.width>-Yt+nr&&(zr=-(Nn.left+Nn.width-nr)),ir(0),Xn(Vi(zr)[0])}else{var li=or;Nn.top<-or?li=-Nn.top:Nn.top+Nn.height>-or+Bi&&(li=-(Nn.top+Nn.height-Bi)),Xn(0),ir(Vi(li)[0])}}var Yi=g(fa,{width:nr,height:Bi,left:Yt,top:or},{width:br,height:ar},{width:Ca,height:Ya},Object(H.a)(Object(H.a)({},de),{},{tabs:le})),To=Object(Y.a)(Yi,2),Jo=To[0],Qo=To[1],Zo=le.map(function(qn){var Nn=qn.key;return O.createElement(i,{id:ye,prefixCls:q,key:Nn,rtl:Ie,tab:qn,closable:qn.closable,editable:ft,active:Nn===_e,tabPosition:Ot,tabBarGutter:hn,renderWrapper:wn,removeAriaLabel:ht==null?void 0:ht.removeAriaLabel,ref:kn(Nn),onClick:function(li){yn(Nn,li)},onRemove:function(){sn(Nn)},onFocus:function(){ji(Nn),wa(),Ie||(_n.current.scrollLeft=0),_n.current.scrollTop=0}})}),Za=p(function(){var qn,Nn,zr,li,sa,Li,ga,Wi,Gr,Oa=((qn=_n.current)===null||qn===void 0?void 0:qn.offsetWidth)||0,qa=((Nn=_n.current)===null||Nn===void 0?void 0:Nn.offsetHeight)||0,eo=((zr=Hn.current)===null||zr===void 0?void 0:zr.offsetWidth)||0,ui=((li=Hn.current)===null||li===void 0?void 0:li.offsetHeight)||0,Zn=((sa=Sn.current)===null||sa===void 0?void 0:sa.offsetWidth)||0,Ti=((Li=Sn.current)===null||Li===void 0?void 0:Li.offsetHeight)||0;Kr(Oa),na(qa),Xo(eo),$a(ui);var Ri=(((ga=Tn.current)===null||ga===void 0?void 0:ga.offsetWidth)||0)-eo,ki=(((Wi=Tn.current)===null||Wi===void 0?void 0:Wi.offsetHeight)||0)-ui;qr(Ri),dr(ki);var to=(Gr=Sn.current)===null||Gr===void 0?void 0:Gr.className.includes(aa);xi(Ri-(to?0:Zn)),Ai(ki-(to?0:Ti)),Sa(function(){var Da=new Map;return le.forEach(function(Do){var Lo=Do.key,Ji=kn(Lo).current;Ji&&Da.set(Lo,{width:Ji.offsetWidth,height:Ji.offsetHeight,left:Ji.offsetLeft,top:Ji.offsetTop})}),Da})}),qo=le.slice(0,Jo),si=le.slice(Qo+1),Mr=[].concat(Object(R.a)(qo),Object(R.a)(si)),$r=Object(O.useState)(),Pr=Object(Y.a)($r,2),ma=Pr[0],es=Pr[1],Si=fa.get(_e),wo=Object(O.useRef)();function _o(){f.a.cancel(wo.current)}Object(O.useEffect)(function(){var qn={};return Si&&(nn?(Ie?qn.right=Si.right:qn.left=Si.left,qn.width=Si.width):(qn.top=Si.top,qn.height=Si.height)),_o(),wo.current=f()(function(){es(qn)}),_o},[Si,nn,Ie]),Object(O.useEffect)(function(){ji()},[_e,Si,fa,nn]),Object(O.useEffect)(function(){Za()},[Ie,hn,_e,le.map(function(qn){return qn.key}).join("_")]);var Ao=!!Mr.length,$i="".concat(q,"-nav-wrap"),_a,va,Oo,Aa;return nn?Ie?(va=Yt>0,_a=Yt+nr<xr):(_a=Yt<0,va=-Yt+nr<xr):(Oo=or<0,Aa=-or+Bi<Hr),O.createElement("div",{ref:we,role:"tablist",className:j()("".concat(q,"-nav"),ne),style:ve,onKeyDown:function(){wa()}},O.createElement(bo,{position:"left",extra:Ze,prefixCls:q}),O.createElement(_.a,{onResize:Za},O.createElement("div",{className:j()($i,(De={},Object(ie.a)(De,"".concat($i,"-ping-left"),_a),Object(ie.a)(De,"".concat($i,"-ping-right"),va),Object(ie.a)(De,"".concat($i,"-ping-top"),Oo),Object(ie.a)(De,"".concat($i,"-ping-bottom"),Aa),De)),ref:_n},O.createElement(_.a,{onResize:Za},O.createElement("div",{ref:Tn,className:"".concat(q,"-nav-list"),style:{transform:"translate(".concat(Yt,"px, ").concat(or,"px)"),transition:Ta?"none":void 0}},Zo,O.createElement($n,{ref:Hn,prefixCls:q,locale:ht,editable:ft,style:{visibility:Ao?"hidden":null}}),O.createElement("div",{className:j()("".concat(q,"-ink-bar"),Object(ie.a)({},"".concat(q,"-ink-bar-animated"),ke.inkBar)),style:ma}))))),O.createElement(yi,Object.assign({},de,{ref:Sn,prefixCls:q,tabs:Mr,className:!Ao&&aa})),O.createElement(bo,{position:"right",extra:Ze,prefixCls:q}))}var Ka=O.forwardRef(Ha);function Go(de){var we=de.id,De=de.activeKey,pe=de.animated,q=de.tabPosition,le=de.rtl,ne=de.destroyInactiveTabPane,ve=O.useContext(ai),ye=ve.prefixCls,ke=ve.tabs,_e=pe.tabPane,Ie=ke.findIndex(function(Ze){return Ze.key===De});return O.createElement("div",{className:j()("".concat(ye,"-content-holder"))},O.createElement("div",{className:j()("".concat(ye,"-content"),"".concat(ye,"-content-").concat(q),Object(ie.a)({},"".concat(ye,"-content-animated"),_e)),style:Ie&&_e?Object(ie.a)({},le?"marginRight":"marginLeft","-".concat(Ie,"00%")):null},ke.map(function(Ze){return O.cloneElement(Ze.node,{key:Ze.key,prefixCls:ye,tabKey:Ze.key,id:we,animated:_e,active:Ze.key===De,destroyInactiveTabPane:ne})})))}function Eo(de){var we=de.prefixCls,De=de.forceRender,pe=de.className,q=de.style,le=de.id,ne=de.active,ve=de.animated,ye=de.destroyInactiveTabPane,ke=de.tabKey,_e=de.children,Ie=O.useState(De),Ze=Object(Y.a)(Ie,2),ft=Ze[0],ht=Ze[1];O.useEffect(function(){ne?ht(!0):ye&&ht(!1)},[ne,ye]);var Ot={};return ne||(ve?(Ot.visibility="hidden",Ot.height=0,Ot.overflowY="hidden"):Ot.display="none"),O.createElement("div",{id:le&&"".concat(le,"-panel-").concat(ke),role:"tabpanel",tabIndex:ne?0:-1,"aria-labelledby":le&&"".concat(le,"-tab-").concat(ke),"aria-hidden":!ne,style:Object(H.a)(Object(H.a)({},Ot),q),className:j()("".concat(we,"-tabpane"),ne&&"".concat(we,"-tabpane-active"),pe)},(ne||ft||De)&&_e)}var za=0;function xo(de){return Object(N.a)(de).map(function(we){if(O.isValidElement(we)){var De=we.key!==void 0?String(we.key):void 0;return Object(H.a)(Object(H.a)({key:De},we.props),{},{node:we})}return null}).filter(function(we){return we})}function Vo(de,we){var De,pe=de.id,q=de.prefixCls,le=q===void 0?"rc-tabs":q,ne=de.className,ve=de.children,ye=de.direction,ke=de.activeKey,_e=de.defaultActiveKey,Ie=de.editable,Ze=de.animated,ft=de.tabPosition,ht=ft===void 0?"top":ft,Ot=de.tabBarGutter,hn=de.tabBarStyle,wn=de.tabBarExtraContent,yn=de.locale,Cn=de.moreIcon,_n=de.moreTransitionName,Tn=de.destroyInactiveTabPane,Sn=de.renderTabBar,Hn=de.onChange,Rn=de.onTabClick,gr=de.onTabScroll,kn=Object(M.a)(de,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),sn=xo(ve),nn=ye==="rtl",Mn;Ze===!1?Mn={inkBar:!1,tabPane:!1}:Mn=Object(H.a)({inkBar:!0,tabPane:!1},Ze!==!0?Ze:null);var Kn=Object(O.useState)(!1),Yt=Object(Y.a)(Kn,2),Xn=Yt[0],yr=Yt[1];Object(O.useEffect)(function(){yr(yo())},[]);var Jn=Object(P.a)(function(){var ar;return(ar=sn[0])===null||ar===void 0?void 0:ar.key},{value:ke,defaultValue:_e}),or=Object(Y.a)(Jn,2),ir=or[0],Dr=or[1],Wr=Object(O.useState)(function(){return sn.findIndex(function(ar){return ar.key===ir})}),xr=Object(Y.a)(Wr,2),qr=xr[0],Ei=xr[1];Object(O.useEffect)(function(){var ar=sn.findIndex(function(Ui){return Ui.key===ir});if(ar===-1){var Ai;ar=Math.max(0,Math.min(qr,sn.length-1)),Dr((Ai=sn[ar])===null||Ai===void 0?void 0:Ai.key)}Ei(ar)},[sn.map(function(ar){return ar.key}).join("_"),ir,qr]);var oi=Object(P.a)(null,{value:pe}),Hr=Object(Y.a)(oi,2),dr=Hr[0],sr=Hr[1],Cr=ht;Xn&&!["left","right"].includes(ht)&&(Cr="top"),Object(O.useEffect)(function(){pe||(sr("rc-tabs-".concat(za)),za+=1)},[]);function br(ar,Ai){Rn==null||Rn(ar,Ai),Dr(ar),Hn==null||Hn(ar)}var xi={id:dr,activeKey:ir,animated:Mn,tabPosition:Cr,rtl:nn,mobile:Xn},Ii,Ni=Object(H.a)(Object(H.a)({},xi),{},{editable:Ie,locale:yn,moreIcon:Cn,moreTransitionName:_n,tabBarGutter:Ot,onTabClick:br,onTabScroll:gr,extra:wn,style:hn,panes:ve});return Sn?Ii=Sn(Ni,Ka):Ii=O.createElement(Ka,Object.assign({},Ni)),O.createElement(ai.Provider,{value:{tabs:sn,prefixCls:le}},O.createElement("div",Object.assign({ref:we,id:pe,className:j()(le,"".concat(le,"-").concat(Cr),(De={},Object(ie.a)(De,"".concat(le,"-mobile"),Xn),Object(ie.a)(De,"".concat(le,"-editable"),Ie),Object(ie.a)(De,"".concat(le,"-rtl"),nn),De),ne)},kn),Ii,O.createElement(Go,Object.assign({destroyInactiveTabPane:Tn},xi,{animated:Mn}))))}var ta=O.forwardRef(Vo);ta.TabPane=Eo;var Di=ta,Ga=Me.b=Di},kSUc:function(Wt,Me,$){},kqOp:function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return R});var ie=$("0Owb"),Y=$("fWQN"),M=$("mtLc"),H=$("yKVA"),O=$("879j"),I=$("q1tI"),j=$.n(I),N=$("Ot1p"),P="\u2581",R=function(c){Object(H.a)(_,c);var f=Object(O.a)(_);function _(){var p;Object(Y.a)(this,_);for(var m=arguments.length,y=new Array(m),a=0;a<m;a++)y[a]=arguments[a];return p=f.call.apply(f,[this].concat(y)),p.getChCountBeforeCursor=function(i,o){for(var l=o.line,C=0,g=0;g<l;g++)C+=i.getLine(g).split(P).length-1;var v=i.getLine(l).substring(0,o.ch);return C+=v.split(P).length-1,C},p.onCMBeforeChange=function(i,o){var l=i.getRange(o.from,o.to),C=0;if(o.text.forEach(function(A){C+=A.split(P).length-1}),l&&l.indexOf(P)!=-1){var g=l.split(P).length-1,v=p.getChCountBeforeCursor(i,o.from);console.log("\u5220\u9664".concat(g,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(v,"\u4E2A\uFF0C\u65B0\u589E").concat(C,"\u4E2A")),p.props.deleteEmptyDisabled?o.cancel():p.props.onPlaceholderChange&&p.props.onPlaceholderChange(v,g,C)}else if(C){var L=p.getChCountBeforeCursor(i,o.from);console.log("\u65B0\u589E".concat(C,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(L,"\u4E2A")),p.props.onPlaceholderChange&&p.props.onPlaceholderChange(L,0,C)}},p}return Object(M.a)(_,[{key:"render",value:function(){return j.a.createElement(N.a,Object(ie.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),_}(I.Component)},lZu9:function(Wt,Me,$){(function(ie){ie($("VrN/"),$("1eCo"),$("8EBN"))})(function(ie){"use strict";ie.defineMode("markdown",function(Y,M){var H=ie.getMode(Y,"text/html"),O=H.name=="null";function I(V){if(ie.findModeByName){var W=ie.findModeByName(V);W&&(V=W.mime||W.mimes[0])}var te=ie.getMode(Y,V);return te.name=="null"?null:te}M.highlightFormatting===void 0&&(M.highlightFormatting=!1),M.maxBlockquoteDepth===void 0&&(M.maxBlockquoteDepth=0),M.taskLists===void 0&&(M.taskLists=!1),M.strikethrough===void 0&&(M.strikethrough=!1),M.emoji===void 0&&(M.emoji=!1),M.fencedCodeBlockHighlighting===void 0&&(M.fencedCodeBlockHighlighting=!0),M.fencedCodeBlockDefaultMode===void 0&&(M.fencedCodeBlockDefaultMode="text/plain"),M.xml===void 0&&(M.xml=!0),M.tokenTypeOverrides===void 0&&(M.tokenTypeOverrides={});var j={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var N in j)j.hasOwnProperty(N)&&M.tokenTypeOverrides[N]&&(j[N]=M.tokenTypeOverrides[N]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,f=M.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,p=/^[^#!\[\]*_\\<>` "'(~:]+/,m=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,i=" ";function o(V,W,te){return W.f=W.inline=te,te(V,W)}function l(V,W,te){return W.f=W.block=te,te(V,W)}function C(V){return!V||!/\S/.test(V.string)}function g(V){if(V.linkTitle=!1,V.linkHref=!1,V.linkText=!1,V.em=!1,V.strong=!1,V.strikethrough=!1,V.quote=0,V.indentedCode=!1,V.f==L){var W=O;if(!W){var te=ie.innerMode(H,V.htmlState);W=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}W&&(V.f=h,V.block=v,V.htmlState=null)}return V.trailingSpace=0,V.trailingSpaceNewLine=!1,V.prevLine=V.thisLine,V.thisLine={stream:null},null}function v(V,W){var te=V.column()===W.indentation,ue=C(W.prevLine.stream),ge=W.indentedCode,Oe=W.prevLine.hr,qe=W.list!==!1,Ke=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var Be=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,qe)){for(W.list=null;Be<W.listStack[W.listStack.length-1];)W.listStack.pop(),W.listStack.length?W.indentation=W.listStack[W.listStack.length-1]:W.list=!1;W.list!==!1&&(W.indentationDiff=Be-W.listStack[W.listStack.length-1])}var Xe=!ue&&!Oe&&!W.prevLine.header&&(!qe||!ge)&&!W.prevLine.fencedCodeEnd,Fe=(W.list===!1||Oe||ue)&&W.indentation<=Ke&&V.match(P),xe=null;if(W.indentationDiff>=4&&(ge||W.prevLine.fencedCodeEnd||W.prevLine.header||ue))return V.skipToEnd(),W.indentedCode=!0,j.code;if(V.eatSpace())return null;if(te&&W.indentation<=Ke&&(xe=V.match(f))&&xe[1].length<=6)return W.quote=0,W.header=xe[1].length,W.thisLine.header=!0,M.highlightFormatting&&(W.formatting="header"),W.f=W.inline,T(W);if(W.indentation<=Ke&&V.eat(">"))return W.quote=te?1:W.quote+1,M.highlightFormatting&&(W.formatting="quote"),V.eatSpace(),T(W);if(!Fe&&!W.setext&&te&&W.indentation<=Ke&&(xe=V.match(R))){var oe=xe[1]?"ol":"ul";return W.indentation=Be+V.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,M.taskLists&&V.match(c,!1)&&(W.taskList=!0),W.f=W.inline,M.highlightFormatting&&(W.formatting=["list","list-"+oe]),T(W)}else{if(te&&W.indentation<=Ke&&(xe=V.match(m,!0)))return W.quote=0,W.fencedEndRE=new RegExp(xe[1]+"+ *$"),W.localMode=M.fencedCodeBlockHighlighting&&I(xe[2]||M.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=ie.startState(W.localMode)),W.f=W.block=A,M.highlightFormatting&&(W.formatting="code-block"),W.code=-1,T(W);if(W.setext||(!Xe||!qe)&&!W.quote&&W.list===!1&&!W.code&&!Fe&&!y.test(V.string)&&(xe=V.lookAhead(1))&&(xe=xe.match(_)))return W.setext?(W.header=W.setext,W.setext=0,V.skipToEnd(),M.highlightFormatting&&(W.formatting="header")):(W.header=xe[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,T(W);if(Fe)return V.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,j.hr;if(V.peek()==="[")return o(V,W,b)}return o(V,W,W.inline)}function L(V,W){var te=H.token(V,W.htmlState);if(!O){var ue=ie.innerMode(H,W.htmlState);(ue.mode.name=="xml"&&ue.state.tagStart===null&&!ue.state.context&&ue.state.tokenize.isInText||W.md_inside&&V.current().indexOf(">")>-1)&&(W.f=h,W.block=v,W.htmlState=null)}return te}function A(V,W){var te=W.listStack[W.listStack.length-1]||0,ue=W.indentation<te,ge=te+3;if(W.fencedEndRE&&W.indentation<=ge&&(ue||V.match(W.fencedEndRE))){M.highlightFormatting&&(W.formatting="code-block");var Oe;return ue||(Oe=T(W)),W.localMode=W.localState=null,W.block=v,W.f=h,W.fencedEndRE=null,W.code=0,W.thisLine.fencedCodeEnd=!0,ue?l(V,W,W.block):Oe}else return W.localMode?W.localMode.token(V,W.localState):(V.skipToEnd(),j.code)}function T(V){var W=[];if(V.formatting){W.push(j.formatting),typeof V.formatting=="string"&&(V.formatting=[V.formatting]);for(var te=0;te<V.formatting.length;te++)W.push(j.formatting+"-"+V.formatting[te]),V.formatting[te]==="header"&&W.push(j.formatting+"-"+V.formatting[te]+"-"+V.header),V.formatting[te]==="quote"&&(!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=V.quote?W.push(j.formatting+"-"+V.formatting[te]+"-"+V.quote):W.push("error"))}if(V.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(V.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(V.linkHref?W.push(j.linkHref,"url"):(V.strong&&W.push(j.strong),V.em&&W.push(j.em),V.strikethrough&&W.push(j.strikethrough),V.emoji&&W.push(j.emoji),V.linkText&&W.push(j.linkText),V.code&&W.push(j.code),V.image&&W.push(j.image),V.imageAltText&&W.push(j.imageAltText,"link"),V.imageMarker&&W.push(j.imageMarker)),V.header&&W.push(j.header,j.header+"-"+V.header),V.quote&&(W.push(j.quote),!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=V.quote?W.push(j.quote+"-"+V.quote):W.push(j.quote+"-"+M.maxBlockquoteDepth)),V.list!==!1){var ue=(V.listStack.length-1)%3;ue?ue===1?W.push(j.list2):W.push(j.list3):W.push(j.list1)}return V.trailingSpaceNewLine?W.push("trailing-space-new-line"):V.trailingSpace&&W.push("trailing-space-"+(V.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function x(V,W){return V.match(p,!0)?T(W):void 0}function h(V,W){var te=W.text(V,W);if(typeof te!="undefined")return te;if(W.list)return W.list=null,T(W);if(W.taskList){var ue=V.match(c,!0)[1]===" ";return ue?W.taskOpen=!0:W.taskClosed=!0,M.highlightFormatting&&(W.formatting="task"),W.taskList=!1,T(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&V.match(/^#+$/,!0))return M.highlightFormatting&&(W.formatting="header"),T(W);var ge=V.next();if(W.linkTitle){W.linkTitle=!1;var Oe=ge;ge==="("&&(Oe=")"),Oe=(Oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var qe="^\\s*(?:[^"+Oe+"\\\\]+|\\\\\\\\|\\\\.)"+Oe;if(V.match(new RegExp(qe),!0))return j.linkHref}if(ge==="`"){var Ke=W.formatting;M.highlightFormatting&&(W.formatting="code"),V.eatWhile("`");var Be=V.current().length;if(W.code==0&&(!W.quote||Be==1))return W.code=Be,T(W);if(Be==W.code){var Xe=T(W);return W.code=0,Xe}else return W.formatting=Ke,T(W)}else if(W.code)return T(W);if(ge==="\\"&&(V.next(),M.highlightFormatting)){var Fe=T(W),xe=j.formatting+"-escape";return Fe?Fe+" "+xe:xe}if(ge==="!"&&V.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,M.highlightFormatting&&(W.formatting="image"),T(W);if(ge==="["&&W.imageMarker&&V.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,M.highlightFormatting&&(W.formatting="image"),T(W);if(ge==="]"&&W.imageAltText){M.highlightFormatting&&(W.formatting="image");var Fe=T(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=D,Fe}if(ge==="["&&!W.image)return W.linkText&&V.match(/^.*?\]/)||(W.linkText=!0,M.highlightFormatting&&(W.formatting="link")),T(W);if(ge==="]"&&W.linkText){M.highlightFormatting&&(W.formatting="link");var Fe=T(W);return W.linkText=!1,W.inline=W.f=V.match(/\(.*?\)| ?\[.*?\]/,!1)?D:h,Fe}if(ge==="<"&&V.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=u,M.highlightFormatting&&(W.formatting="link");var Fe=T(W);return Fe?Fe+=" ":Fe="",Fe+j.linkInline}if(ge==="<"&&V.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=u,M.highlightFormatting&&(W.formatting="link");var Fe=T(W);return Fe?Fe+=" ":Fe="",Fe+j.linkEmail}if(M.xml&&ge==="<"&&V.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=V.string.indexOf(">",V.pos);if(oe!=-1){var Re=V.string.substring(V.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Re)&&(W.md_inside=!0)}return V.backUp(1),W.htmlState=ie.startState(H),l(V,W,L)}if(M.xml&&ge==="<"&&V.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(ge==="*"||ge==="_"){for(var dt=1,at=V.pos==1?" ":V.string.charAt(V.pos-2);dt<3&&V.eat(ge);)dt++;var ut=V.peek()||" ",ce=!/\s/.test(ut)&&(!a.test(ut)||/\s/.test(at)||a.test(at)),he=!/\s/.test(at)&&(!a.test(at)||/\s/.test(ut)||a.test(ut)),Le=null,Ve=null;if(dt%2&&(!W.em&&ce&&(ge==="*"||!he||a.test(at))?Le=!0:W.em==ge&&he&&(ge==="*"||!ce||a.test(ut))&&(Le=!1)),dt>1&&(!W.strong&&ce&&(ge==="*"||!he||a.test(at))?Ve=!0:W.strong==ge&&he&&(ge==="*"||!ce||a.test(ut))&&(Ve=!1)),Ve!=null||Le!=null){M.highlightFormatting&&(W.formatting=Le==null?"strong":Ve==null?"em":"strong em"),Le===!0&&(W.em=ge),Ve===!0&&(W.strong=ge);var Xe=T(W);return Le===!1&&(W.em=!1),Ve===!1&&(W.strong=!1),Xe}}else if(ge===" "&&(V.eat("*")||V.eat("_"))){if(V.peek()===" ")return T(W);V.backUp(1)}if(M.strikethrough){if(ge==="~"&&V.eatWhile(ge)){if(W.strikethrough){M.highlightFormatting&&(W.formatting="strikethrough");var Xe=T(W);return W.strikethrough=!1,Xe}else if(V.match(/^[^\s]/,!1))return W.strikethrough=!0,M.highlightFormatting&&(W.formatting="strikethrough"),T(W)}else if(ge===" "&&V.match(/^~~/,!0)){if(V.peek()===" ")return T(W);V.backUp(2)}}if(M.emoji&&ge===":"&&V.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,M.highlightFormatting&&(W.formatting="emoji");var et=T(W);return W.emoji=!1,et}return ge===" "&&(V.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),T(W)}function u(V,W){var te=V.next();if(te===">"){W.f=W.inline=h,M.highlightFormatting&&(W.formatting="link");var ue=T(W);return ue?ue+=" ":ue="",ue+j.linkInline}return V.match(/^[^>]+/,!0),j.linkInline}function D(V,W){if(V.eatSpace())return null;var te=V.next();return te==="("||te==="["?(W.f=W.inline=w(te==="("?")":"]"),M.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,T(W)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function w(V){return function(W,te){var ue=W.next();if(ue===V){te.f=te.inline=h,M.highlightFormatting&&(te.formatting="link-string");var ge=T(te);return te.linkHref=!1,ge}return W.match(S[V]),te.linkHref=!0,T(te)}}function b(V,W){return V.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=K,V.next(),M.highlightFormatting&&(W.formatting="link"),W.linkText=!0,T(W)):o(V,W,h)}function K(V,W){if(V.match(/^\]:/,!0)){W.f=W.inline=X,M.highlightFormatting&&(W.formatting="link");var te=T(W);return W.linkText=!1,te}return V.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function X(V,W){return V.eatSpace()?null:(V.match(/^[^\s]+/,!0),V.peek()===void 0?W.linkTitle=!0:V.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=h,j.linkHref+" url")}var Q={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:h,text:x,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(V){return{f:V.f,prevLine:V.prevLine,thisLine:V.thisLine,block:V.block,htmlState:V.htmlState&&ie.copyState(H,V.htmlState),indentation:V.indentation,localMode:V.localMode,localState:V.localMode?ie.copyState(V.localMode,V.localState):null,inline:V.inline,text:V.text,formatting:!1,linkText:V.linkText,linkTitle:V.linkTitle,linkHref:V.linkHref,code:V.code,em:V.em,strong:V.strong,strikethrough:V.strikethrough,emoji:V.emoji,header:V.header,setext:V.setext,hr:V.hr,taskList:V.taskList,list:V.list,listStack:V.listStack.slice(0),quote:V.quote,indentedCode:V.indentedCode,trailingSpace:V.trailingSpace,trailingSpaceNewLine:V.trailingSpaceNewLine,md_inside:V.md_inside,fencedEndRE:V.fencedEndRE}},token:function(V,W){if(W.formatting=!1,V!=W.thisLine.stream){if(W.header=0,W.hr=!1,V.match(/^\s*$/,!0))return g(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:V},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=L)){var te=V.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(W.indentation=te,W.indentationDiff=null,te>0)return null}}return W.f(V,W)},innerMode:function(V){return V.block==L?{state:V.htmlState,mode:H}:V.localState?{state:V.localState,mode:V.localMode}:{state:V,mode:Q}},indent:function(V,W,te){return V.block==L&&H.indent?H.indent(V.htmlState,W,te):V.localState&&V.localMode.indent?V.localMode.indent(V.localState,W,te):ie.Pass},blankLine:g,getType:T,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),ie.defineMIME("text/markdown","markdown"),ie.defineMIME("text/x-markdown","markdown")})},nnTU:function(Wt,Me,$){"use strict";$.d(Me,"b",function(){return N}),$.d(Me,"a",function(){return P});var ie=$("pmY6"),Y=$("746U"),M=$("Cg/j"),H=$("MI8n"),O=$("24hK"),I=$("QDVR"),j=function(){for(var R=0,c=0,f=arguments.length;c<f;c++)R+=arguments[c].length;for(var _=Array(R),p=0,c=0;c<f;c++)for(var m=arguments[c],y=0,a=m.length;y<a;y++,p++)_[p]=m[y];return _},N=Object(M.c)("commandService"),P=new(function(){function R(){this._commands=new Map,this._onDidRegisterCommand=new H.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return R.prototype.registerCommand=function(c,f){var _=this;if(!c)throw new Error("invalid command");if(typeof c=="string"){if(!f)throw new Error("invalid command");return this.registerCommand({id:c,handler:f})}if(c.description){for(var p=[],m=0,y=c.description.args;m<y.length;m++){var a=y[m];p.push(a.constraint)}var i=c.handler;c.handler=function(v){for(var L=[],A=1;A<arguments.length;A++)L[A-1]=arguments[A];return Object(Y.m)(L,p),i.apply(void 0,j([v],L))}}var o=c.id,l=this._commands.get(o);l||(l=new O.a,this._commands.set(o,l));var C=l.unshift(c),g=Object(ie.h)(function(){C();var v=_._commands.get(o);(v==null?void 0:v.isEmpty())&&_._commands.delete(o)});return this._onDidRegisterCommand.fire(o),g},R.prototype.registerCommandAlias=function(c,f){return P.registerCommand(c,function(_){for(var p,m=[],y=1;y<arguments.length;y++)m[y-1]=arguments[y];return(p=_.get(N)).executeCommand.apply(p,j([f],m))})},R.prototype.getCommand=function(c){var f=this._commands.get(c);return!f||f.isEmpty()?void 0:f.iterator().next().value},R.prototype.getCommands=function(){for(var c=new Map,f=0,_=Object(I.d)(this._commands);f<_.length;f++){var p=_[f],m=this.getCommand(p);m&&c.set(p,m)}return c},R}())},osHv:function(Wt,Me,$){(function(ie){ie($("VrN/"))})(function(ie){"use strict";var Y=ie.Pos;function M(a,i){return a.line-i.line||a.ch-i.ch}var H="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",O=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+H+"]["+O+"]*)","g");function j(a,i,o,l){this.line=i,this.ch=o,this.cm=a,this.text=a.getLine(i),this.min=l?Math.max(l.from,a.firstLine()):a.firstLine(),this.max=l?Math.min(l.to-1,a.lastLine()):a.lastLine()}function N(a,i){var o=a.cm.getTokenTypeAt(Y(a.line,i));return o&&/\btag\b/.test(o)}function P(a){return a.line>=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function R(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function c(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(P(a))continue;return}if(!N(a,i+1)){a.ch=i+1;continue}var o=a.text.lastIndexOf("/",i),l=o>-1&&!/\S/.test(a.text.slice(o+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function f(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(R(a))continue;return}if(!N(a,i+1)){a.ch=i;continue}I.lastIndex=i,a.ch=i;var o=I.exec(a.text);if(o&&o.index==i)return o}}function _(a){for(;;){I.lastIndex=a.ch;var i=I.exec(a.text);if(!i){if(P(a))continue;return}if(!N(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function p(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(R(a))continue;return}if(!N(a,i+1)){a.ch=i;continue}var o=a.text.lastIndexOf("/",i),l=o>-1&&!/\S/.test(a.text.slice(o+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function m(a,i){for(var o=[];;){var l=_(a),C,g=a.line,v=a.ch-(l?l[0].length:0);if(!l||!(C=c(a)))return;if(C=="selfClose")continue;if(l[1]){for(var L=o.length-1;L>=0;--L)if(o[L]==l[2]){o.length=L;break}if(L<0&&(!i||i==l[2]))return{tag:l[2],from:Y(g,v),to:Y(a.line,a.ch)}}else o.push(l[2])}}function y(a,i){for(var o=[];;){var l=p(a);if(!l)return;if(l=="selfClose"){f(a);continue}var C=a.line,g=a.ch,v=f(a);if(!v)return;if(v[1])o.push(v[2]);else{for(var L=o.length-1;L>=0;--L)if(o[L]==v[2]){o.length=L;break}if(L<0&&(!i||i==v[2]))return{tag:v[2],from:Y(a.line,a.ch),to:Y(C,g)}}}}ie.registerHelper("fold","xml",function(a,i){for(var o=new j(a,i.line,0);;){var l=_(o);if(!l||o.line!=i.line)return;var C=c(o);if(!C)return;if(!l[1]&&C!="selfClose"){var g=Y(o.line,o.ch),v=m(o,l[2]);return v&&M(v.from,g)>0?{from:g,to:v.from}:null}}}),ie.findMatchingTag=function(a,i,o){var l=new j(a,i.line,i.ch,o);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var C=c(l),g=C&&Y(l.line,l.ch),v=C&&f(l);if(!C||!v||M(l,i)>0)return;var L={from:Y(l.line,l.ch),to:g,tag:v[2]};return C=="selfClose"?{open:L,close:null,at:"open"}:v[1]?{open:y(l,v[2]),close:L,at:"close"}:(l=new j(a,g.line,g.ch,o),{open:L,close:m(l,v[2]),at:"open"})},ie.findEnclosingTag=function(a,i,o,l){for(var C=new j(a,i.line,i.ch,o);;){var g=y(C,l);if(!g)break;var v=new j(a,i.line,i.ch,o),L=m(v,g.tag);if(L)return{open:g,close:L}}},ie.scanForClosingTag=function(a,i,o,l){var C=new j(a,i.line,i.ch,l?{from:0,to:l}:null);return m(C,o)}})},p5ED:function(Wt,Me,$){"use strict";var ie=$("+L6B"),Y=$("2/Rp"),M=$("5Dmo"),H=$("3S7+"),O=$("k1fw"),I=$("9og8"),j=$("tJVT"),N=$("WmNS"),P=$.n(N),R=$("q1tI"),c=$.n(R),f=$("vHTk"),_=$.n(f),p=$("yEEn"),m=$("ZW9T"),y=$("1vsH"),a=$("V0Rq"),i=$("m3rI");Me.a=function(o){var l,C,g,v,L,A,T=o.editOffice,x=T===void 0?"view":T,h=o.name,u=o.data,D=o.theme,S=o.type,w=o.filename,b=o.monacoEditor,K=o.className,X=o.style,Q=o.close,V=o.onClose,W=o.hasMask,te=o.disabledDownload,ue=o.onImgDimensions,ge=o.otherData,Oe=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),qe=Object(j.a)(Oe,2),Ke=qe[0],Be=qe[1],Xe=Object(R.useState)(""),Fe=Object(j.a)(Xe,2),xe=Fe[0],oe=Fe[1],Re=Object(R.useState)(),dt=Object(j.a)(Re,2),at=dt[0],ut=dt[1],ce=window.ENV==="build"?"/react/build":"",he=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,Le,Ve=1024*1024,et=10*Ve,tt=Object(R.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&S!=="txt"&&(u=i.a.API_SERVER+u),S==="office"&&(Le=Object(y.P)(u).filesize,Le>et&&(S="other")),w&&(b.filename=w),Object(R.useEffect)(function(){var Et,xt,ct=(Et=document.cookie)===null||Et===void 0||((xt=Et.replace(/\s/g,""))===null||xt===void 0)?void 0:xt.split(";");ct==null||ct.map(function(Ft){var wt=Ft.split("=");wt[0]==="_educoder_session"&&oe(wt[1])})},[]),Object(R.useEffect)(function(){S==="office"&&rt()},[S,u]);var rt=function(){var Et=Object(I.a)(P.a.mark(function xt(){var ct,Ft,wt;return P.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return console.log("data:",u),ct=u,u.startsWith("http")||(ct=location.origin+ct),Ft=new URL(ct).pathname.split("/").pop(),We.next=6,Object(a.U)({attachment_id:Ft});case 6:wt=We.sent,ut(wt);case 8:case"end":return We.stop()}},xt)}));return function(){return Et.apply(this,arguments)}}(),it=function(){if(u.startsWith("http")||u.startsWith("blob:")){Dt();return}Object(y.x)(w||"educoder",u,w)},Dt=function(){Object(y.v)(w||"educoder",decodeURIComponent(u))};return c.a.createElement("div",{style:Object(O.a)({},X||{}),className:"".concat(W&&_.a.bgBlack," ").concat(S?_.a.wrp:"hide")},Q&&c.a.createElement("div",{className:_.a.close,ref:tt},!!ue&&c.a.createElement(H.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return tt.current}},c.a.createElement("span",{onClick:function(){V(),ue()}},c.a.createElement("i",{className:"icon-yulanpizhu"}))),!te&&c.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return tt.current}},c.a.createElement("span",{onClick:Dt},c.a.createElement("i",{className:"icon-quxiaozhiding"}))),c.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return tt.current}},c.a.createElement("span",{className:"",onClick:V},c.a.createElement("i",{className:"icon-guanbi1"})))),c.a.createElement("div",{className:"".concat(_.a[K]," ").concat(K," ").concat(_.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&c.a.createElement(m.b,b)),S==="audio"&&c.a.createElement("audio",{src:"".concat(((C=u)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((g=u)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),S==="video"&&c.a.createElement(c.a.Fragment,null,((v=u)===null||v===void 0?void 0:v.indexOf("http"))>-1?c.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):c.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),S==="office"&&at&&c.a.createElement("iframe",{src:"".concat(ce,"/office.html?key=").concat(at.key,"&url=").concat(he+at.url,"&callbackUrl=").concat(he+at.callbackUrl,"&fileType=").concat(at.fileType,"&title=").concat(at.title,"&model=").concat(x,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!te)}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&c.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(ge.key,"&url=").concat(i.a.API_SERVER+ge.url,"&callbackUrl=").concat(i.a.API_SERVER+ge.callbackUrl,"&fileType=").concat(ge.fileType,"&title=").concat(ge.title,"&model=").concat(ge.model)}),S==="html"&&c.a.createElement("iframe",{src:u+"&disposition=inline"}),S==="pdf"&&c.a.createElement("embed",{className:_.a.embed,src:u}),S==="image"&&c.a.createElement("img",{src:"".concat(((L=u)===null||L===void 0?void 0:L.indexOf("http://"))>-1||((A=u)===null||A===void 0?void 0:A.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),S==="other"&&c.a.createElement("div",null,c.a.createElement(Y.a,{type:"primary",size:"large",onClick:it},c.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&c.a.createElement(Y.a,{type:"primary",size:"large",onClick:it},c.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Wt,Me,$){},pmY6:function(Wt,Me,$){"use strict";$.d(Me,"g",function(){return O}),$.d(Me,"f",function(){return I}),$.d(Me,"e",function(){return j}),$.d(Me,"h",function(){return N}),$.d(Me,"b",function(){return P}),$.d(Me,"a",function(){return R}),$.d(Me,"d",function(){return c}),$.d(Me,"c",function(){return f});var ie=!1,Y="__is_disposable_tracked__";function M(_){if(!ie)return;if(_&&_!==R.None)try{_[Y]=!0}catch(p){}}function H(_){if(!ie)return _;var p=new Error("Potentially leaked disposable").stack;return setTimeout(function(){_[Y]||console.log(p)},3e3),_}function O(_){return typeof _.dispose=="function"&&_.dispose.length===0}function I(_){return Array.isArray(_)?(_.forEach(function(p){p&&(M(p),p.dispose())}),[]):_?(M(_),_.dispose(),_):void 0}function j(){for(var _=[],p=0;p<arguments.length;p++)_[p]=arguments[p];return _.forEach(M),H({dispose:function(){return I(_)}})}function N(_){var p=H({dispose:function(){M(p),_()}});return p}var P=function(){function _(){this._toDispose=new Set,this._isDisposed=!1}return _.prototype.dispose=function(){if(this._isDisposed)return;M(this),this._isDisposed=!0,this.clear()},_.prototype.clear=function(){this._toDispose.forEach(function(p){return p.dispose()}),this._toDispose.clear()},_.prototype.add=function(p){if(!p)return p;if(p===this)throw new Error("Cannot register a disposable on itself!");return M(p),this._isDisposed?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(p),p},_}(),R=function(){function _(){this._store=new P,H(this)}return _.prototype.dispose=function(){M(this),this._store.dispose()},_.prototype._register=function(p){if(p===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(p)},_.None=Object.freeze({dispose:function(){}}),_}(),c=function(){function _(){this._isDisposed=!1,H(this)}return Object.defineProperty(_.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(p){if(this._isDisposed||p===this._value)return;this._value&&this._value.dispose(),p&&M(p),this._value=p},enumerable:!0,configurable:!0}),_.prototype.clear=function(){this.value=void 0},_.prototype.dispose=function(){this._isDisposed=!0,M(this),this._value&&this._value.dispose(),this._value=void 0},_}(),f=function(){function _(p){this.object=p}return _.prototype.dispose=function(){},_}()},"rAM+":function(Wt,Me,$){"use strict";$.d(Me,"a",function(){return Y});var ie=$("Qw5x");function Y(M,H){var O;if(typeof Symbol=="undefined"||M[Symbol.iterator]==null){if(Array.isArray(M)||(O=Object(ie.a)(M))||H&&M&&typeof M.length=="number"){O&&(M=O);var I=0,j=function(){};return{s:j,n:function(){return I>=M.length?{done:!0}:{done:!1,value:M[I++]}},e:function(f){throw f},f:j}}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 N=!0,P=!1,R;return{s:function(){O=M[Symbol.iterator]()},n:function(){var f=O.next();return N=f.done,f},e:function(f){P=!0,R=f},f:function(){try{!N&&O.return!=null&&O.return()}finally{if(P)throw R}}}}},rUJ1:function(Wt,Me){const $=/[&<>"']/,ie=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,M=/[<>"']|&(?!#?\w+;)/g,H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},O=A=>H[A];function I(A,T){if(T){if($.test(A))return A.replace(ie,O)}else if(Y.test(A))return A.replace(M,O);return A}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(A){return A.replace(j,(T,x)=>(x=x.toLowerCase(),x==="colon"?":":x.charAt(0)==="#"?x.charAt(1)==="x"?String.fromCharCode(parseInt(x.substring(2),16)):String.fromCharCode(+x.substring(1)):""))}const P=/(^|[^\[])\^/g;function R(A,T){A=A.source||A,T=T||"";const x={replace:(h,u)=>(u=u.source||u,u=u.replace(P,"$1"),A=A.replace(h,u),x),getRegex:()=>new RegExp(A,T)};return x}const c=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(A,T,x){if(A){let h;try{h=decodeURIComponent(N(x)).replace(c,"").toLowerCase()}catch(u){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}T&&!f.test(x)&&(x=i(T,x));try{x=encodeURI(x).replace(/%25/g,"%")}catch(h){return null}return x}const p={},m=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(A,T){p[" "+A]||(m.test(A)?p[" "+A]=A+"/":p[" "+A]=g(A,"/",!0)),A=p[" "+A];const x=A.indexOf(":")===-1;return T.substring(0,2)==="//"?x?T:A.replace(y,"$1")+T:T.charAt(0)==="/"?x?T:A.replace(a,"$1")+T:A+T}const o={exec:function(){}};function l(A){let T=1,x,h;for(;T<arguments.length;T++){x=arguments[T];for(h in x)Object.prototype.hasOwnProperty.call(x,h)&&(A[h]=x[h])}return A}function C(A,T){const x=A.replace(/\|/g,(D,S,w)=>{let b=!1,K=S;for(;--K>=0&&w[K]==="\\";)b=!b;return b?"|":" |"}),h=x.split(/ \|/);let u=0;if(h.length>T)h.splice(T);else for(;h.length<T;)h.push("");for(;u<h.length;u++)h[u]=h[u].trim().replace(/\\\|/g,"|");return h}function g(A,T,x){const h=A.length;if(h===0)return"";let u=0;for(;u<h;){const D=A.charAt(h-u-1);if(D===T&&!x)u++;else if(D!==T&&x)u++;else break}return A.substr(0,h-u)}function v(A,T){if(A.indexOf(T[1])===-1)return-1;const x=A.length;let h=0,u=0;for(;u<x;u++)if(A[u]==="\\")u++;else if(A[u]===T[0])h++;else if(A[u]===T[1]&&(h--,h<0))return u;return-1}function L(A){A&&A.sanitize&&!A.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")}Wt.exports={escape:I,unescape:N,edit:R,cleanUrl:_,resolveUrl:i,noopTest:o,merge:l,splitCells:C,rtrim:g,findClosingBracket:v,checkSanitizeDeprecation:L}},t23M:function(Wt,Me,$){"use strict";var ie=$("VTBJ"),Y=$("1OyB"),M=$("vuIU"),H=$("Ji7U"),O=$("LK+K"),I=$("q1tI"),j=$.n(I),N=$("m+aA"),P=$("Zm9Q"),R=$("Kwbf"),c=$("c+Xe"),f=$("bdgK"),_="rc-observer-key",p=function(m){Object(H.a)(a,m);var y=Object(O.a)(a);function a(){var i;return Object(Y.a)(this,a),i=y.apply(this,arguments),i.resizeObserver=null,i.childNode=null,i.currentElement=null,i.state={width:0,height:0,offsetHeight:0,offsetWidth:0},i.onResize=function(o){var l=i.props.onResize,C=o[0].target,g=C.getBoundingClientRect(),v=g.width,L=g.height,A=C.offsetWidth,T=C.offsetHeight,x=Math.floor(v),h=Math.floor(L);if(i.state.width!==x||i.state.height!==h||i.state.offsetWidth!==A||i.state.offsetHeight!==T){var u={width:x,height:h,offsetWidth:A,offsetHeight:T};i.setState(u),l&&Promise.resolve().then(function(){l(Object(ie.a)(Object(ie.a)({},u),{},{offsetWidth:A,offsetHeight:T}))})}},i.setChildNode=function(o){i.childNode=o},i}return Object(M.a)(a,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var l=Object(N.a)(this.childNode||this),C=l!==this.currentElement;C&&(this.destroyObserver(),this.currentElement=l),!this.resizeObserver&&l&&(this.resizeObserver=new f.default(this.onResize),this.resizeObserver.observe(l))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,l=Object(P.a)(o);if(l.length>1)Object(R.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(l.length===0)return Object(R.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var C=l[0];if(I.isValidElement(C)&&Object(c.c)(C)){var g=C.ref;l[0]=I.cloneElement(C,{ref:Object(c.a)(g,this.setChildNode)})}return l.length===1?l[0]:l.map(function(v,L){return!I.isValidElement(v)||"key"in v&&v.key!==null?v:I.cloneElement(v,{key:"".concat(_,"-").concat(L)})})}}]),a}(I.Component);p.displayName="ResizeObserver",Me.a=p},ulZh:function(Wt,Me,$){typeof window!="undefined"&&function(Y,M){Wt.exports=M()}(this,function(){return function(ie){var Y={};function M(H){if(Y[H])return Y[H].exports;var O=Y[H]={i:H,l:!1,exports:{}};return ie[H].call(O.exports,O,O.exports,M),O.l=!0,O.exports}return M.m=ie,M.c=Y,M.d=function(H,O,I){M.o(H,O)||Object.defineProperty(H,O,{enumerable:!0,get:I})},M.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},M.t=function(H,O){if(O&1&&(H=M(H)),O&8)return H;if(O&4&&typeof H=="object"&&H&&H.__esModule)return H;var I=Object.create(null);if(M.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:H}),O&2&&typeof H!="string")for(var j in H)M.d(I,j,function(N){return H[N]}.bind(null,j));return I},M.n=function(H){var O=H&&H.__esModule?function(){return H.default}:function(){return H};return M.d(O,"a",O),O},M.o=function(H,O){return Object.prototype.hasOwnProperty.call(H,O)},M.p="/dist/",M(M.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ie,Y,M){"use strict";var H=Object.prototype.hasOwnProperty,O="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(O=!1));function j(c,f,_){this.fn=c,this.context=f,this.once=_||!1}function N(c,f,_,p,m){if(typeof _!="function")throw new TypeError("The listener must be a function");var y=new j(_,p||c,m),a=O?O+f:f;return c._events[a]?c._events[a].fn?c._events[a]=[c._events[a],y]:c._events[a].push(y):(c._events[a]=y,c._eventsCount++),c}function P(c,f){--c._eventsCount===0?c._events=new I:delete c._events[f]}function R(){this._events=new I,this._eventsCount=0}R.prototype.eventNames=function(){var f=[],_,p;if(this._eventsCount===0)return f;for(p in _=this._events)H.call(_,p)&&f.push(O?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(_)):f},R.prototype.listeners=function(f){var _=O?O+f:f,p=this._events[_];if(!p)return[];if(p.fn)return[p.fn];for(var m=0,y=p.length,a=new Array(y);m<y;m++)a[m]=p[m].fn;return a},R.prototype.listenerCount=function(f){var _=O?O+f:f,p=this._events[_];return p?p.fn?1:p.length:0},R.prototype.emit=function(f,_,p,m,y,a){var i=O?O+f:f;if(!this._events[i])return!1;var o=this._events[i],l=arguments.length,C,g;if(o.fn){o.once&&this.removeListener(f,o.fn,void 0,!0);switch(l){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,_),!0;case 3:return o.fn.call(o.context,_,p),!0;case 4:return o.fn.call(o.context,_,p,m),!0;case 5:return o.fn.call(o.context,_,p,m,y),!0;case 6:return o.fn.call(o.context,_,p,m,y,a),!0}for(g=1,C=new Array(l-1);g<l;g++)C[g-1]=arguments[g];o.fn.apply(o.context,C)}else{var v=o.length,L;for(g=0;g<v;g++){o[g].once&&this.removeListener(f,o[g].fn,void 0,!0);switch(l){case 1:o[g].fn.call(o[g].context);break;case 2:o[g].fn.call(o[g].context,_);break;case 3:o[g].fn.call(o[g].context,_,p);break;case 4:o[g].fn.call(o[g].context,_,p,m);break;default:if(!C)for(L=1,C=new Array(l-1);L<l;L++)C[L-1]=arguments[L];o[g].fn.apply(o[g].context,C)}}}return!0},R.prototype.on=function(f,_,p){return N(this,f,_,p,!1)},R.prototype.once=function(f,_,p){return N(this,f,_,p,!0)},R.prototype.removeListener=function(f,_,p,m){var y=O?O+f:f;if(!this._events[y])return this;if(!_)return P(this,y),this;var a=this._events[y];if(a.fn)a.fn===_&&(!m||a.once)&&(!p||a.context===p)&&P(this,y);else{for(var i=0,o=[],l=a.length;i<l;i++)(a[i].fn!==_||m&&!a[i].once||p&&a[i].context!==p)&&o.push(a[i]);o.length?this._events[y]=o.length===1?o[0]:o:P(this,y)}return this},R.prototype.removeAllListeners=function(f){var _;return f?(_=O?O+f:f,this._events[_]&&P(this,_)):(this._events=new I,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=O,R.EventEmitter=R,ie.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ie,Y,M){(function(H){var O=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(R,c,f){if(f=f||{},R=R.trim(),c=c.trim(),!c){if(!f.alwaysNormalize)return R;var _=P.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");return _.path=P.normalizePath(_.path),P.buildURLFromParts(_)}var p=P.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=P.normalizePath(p.path),P.buildURLFromParts(p)):c;var m=P.parseURL(R);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var y=I.exec(m.path);m.netLoc=y[1],m.path=y[2]}m.netLoc&&!m.path&&(m.path="/");var a={scheme:m.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(a.netLoc=m.netLoc,p.path[0]!=="/"))if(!p.path)a.path=m.path,p.params||(a.params=m.params,p.query||(a.query=m.query));else{var i=m.path,o=i.substring(0,i.lastIndexOf("/")+1)+p.path;a.path=P.normalizePath(o)}return a.path===null&&(a.path=f.alwaysNormalize?P.normalizePath(p.path):p.path),P.buildURLFromParts(a)},parseURL:function(R){var c=O.exec(R);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(j,"");R.length!==(R=R.replace(N,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ie.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ie,Y,M){function H(f){var _={};function p(y){if(_[y])return _[y].exports;var a=_[y]={i:y,l:!1,exports:{}};return f[y].call(a.exports,a,a.exports,p),a.l=!0,a.exports}p.m=f,p.c=_,p.i=function(y){return y},p.d=function(y,a,i){p.o(y,a)||Object.defineProperty(y,a,{configurable:!1,enumerable:!0,get:i})},p.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},p.n=function(y){var a=y&&y.__esModule?function(){return y.default}:function(){return y};return p.d(a,"a",a),a},p.o=function(y,a){return Object.prototype.hasOwnProperty.call(y,a)},p.p="/",p.oe=function(y){throw console.error(y),y};var m=p(p.s=ENTRY_MODULE);return m.default||m}var O="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+O+").*?\\)";function j(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(f){return!isNaN(1*f)}function P(f,_,p){var m={};m[p]=[];var y=_.toString(),a=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return m;for(var i=a[1],o=new RegExp("(\\\\n|\\W)"+j(i)+I,"g"),l;l=o.exec(y);){if(l[3]==="dll-reference")continue;m[p].push(l[3])}for(o=new RegExp("\\("+j(i)+'\\("(dll-reference\\s('+O+'))"\\)\\)'+I,"g");l=o.exec(y);)f[l[2]]||(m[p].push(l[1]),f[l[2]]=M(l[1]).m),m[l[2]]=m[l[2]]||[],m[l[2]].push(l[4]);for(var C=Object.keys(m),g=0;g<C.length;g++)for(var v=0;v<m[C[g]].length;v++)N(m[C[g]][v])&&(m[C[g]][v]=1*m[C[g]][v]);return m}function R(f){var _=Object.keys(f);return _.reduce(function(p,m){return p||f[m].length>0},!1)}function c(f,_){for(var p={main:[_]},m={main:[]},y={main:{}};R(p);)for(var a=Object.keys(p),i=0;i<a.length;i++){var o=a[i],l=p[o],C=l.pop();if(y[o]=y[o]||{},y[o][C]||!f[o][C])continue;y[o][C]=!0,m[o]=m[o]||[],m[o].push(C);for(var g=P(f,f[o][C],o),v=Object.keys(g),L=0;L<v.length;L++)p[v[L]]=p[v[L]]||[],p[v[L]]=p[v[L]].concat(g[v[L]])}return m}ie.exports=function(f,_){_=_||{};var p={main:M.m},m=_.all?{main:Object.keys(p.main)}:c(p,f),y="";Object.keys(m).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;m[C][g];)g++;m[C].push(g),p[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+C+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+m[C].map(function(v){return""+JSON.stringify(v)+": "+p[C][v].toString()}).join(",")+`});
`}),y=y+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+m.main.map(function(C){return""+JSON.stringify(C)+": "+p.main[C].toString()}).join(",")+"}))(self);";var a=new window.Blob([y],{type:"text/javascript"});if(_.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,o=i.createObjectURL(a),l=new window.Worker(o);return l.objectURL=o,l}},"./src/config.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"hlsDefaultConfig",function(){return L}),M.d(Y,"mergeConfig",function(){return T}),M.d(Y,"enableStreamingMode",function(){return x});var H=M("./src/controller/abr-controller.ts"),O=M("./src/controller/audio-stream-controller.ts"),I=M("./src/controller/audio-track-controller.ts"),j=M("./src/controller/subtitle-stream-controller.ts"),N=M("./src/controller/subtitle-track-controller.ts"),P=M("./src/controller/buffer-controller.ts"),R=M("./src/controller/timeline-controller.ts"),c=M("./src/controller/cap-level-controller.ts"),f=M("./src/controller/fps-controller.ts"),_=M("./src/controller/eme-controller.ts"),p=M("./src/controller/cmcd-controller.ts"),m=M("./src/utils/xhr-loader.ts"),y=M("./src/utils/fetch-loader.ts"),a=M("./src/utils/cues.ts"),i=M("./src/utils/mediakeys-helper.ts"),o=M("./src/utils/logger.ts");function l(){return l=Object.assign||function(h){for(var u=1;u<arguments.length;u++){var D=arguments[u];for(var S in D)Object.prototype.hasOwnProperty.call(D,S)&&(h[S]=D[S])}return h},l.apply(this,arguments)}function C(h,u){var D=Object.keys(h);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(h);u&&(S=S.filter(function(w){return Object.getOwnPropertyDescriptor(h,w).enumerable})),D.push.apply(D,S)}return D}function g(h){for(var u=1;u<arguments.length;u++){var D=arguments[u]!=null?arguments[u]:{};u%2?C(Object(D),!0).forEach(function(S){v(h,S,D[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(D)):C(Object(D)).forEach(function(S){Object.defineProperty(h,S,Object.getOwnPropertyDescriptor(D,S))})}return h}function v(h,u,D){return u in h?Object.defineProperty(h,u,{value:D,enumerable:!0,configurable:!0,writable:!0}):h[u]=D,h}var L=g(g({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:m.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:P.default,capLevelController:c.default,fpsController:f.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:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},A()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:N.default,timelineController:R.TimelineController,audioStreamController:O.default,audioTrackController:I.default,emeController:_.default,cmcdController:p.default});function A(){return{cueHandler:a.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 T(h,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 l({},h,u)}function x(h){var u=h.loader;if(u!==y.default&&u!==m.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var D=Object(y.fetchSupported)();D&&(h.loader=y.default,h.progressive=!0,h.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/polyfills/number.ts"),O=M("./src/utils/ewma-bandwidth-estimator.ts"),I=M("./src/events.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/errors.ts"),P=M("./src/types/loader.ts"),R=M("./src/utils/logger.ts");function c(p,m){for(var y=0;y<m.length;y++){var a=m[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function f(p,m,y){return m&&c(p.prototype,m),y&&c(p,y),p}var _=function(){function p(y){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=y;var a=y.config;this.bwEstimator=new O.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on(I.Events.FRAG_LOADING,this.onFragLoading,this),a.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(I.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off(I.Events.FRAG_LOADING,this.onFragLoading,this),a.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(I.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},m.onFragLoading=function(a,i){var o=i.frag;if(o.type===P.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=o,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},m.onLevelLoaded=function(a,i){var o=this.hls.config;i.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},m._abandonRulesCheck=function(){var a=this.fragCurrent,i=this.partCurrent,o=this.hls,l=o.autoLevelEnabled,C=o.config,g=o.media;if(!a||!g)return;var v=i?i.stats:a.stats,L=i?i.duration:a.duration;if(v.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||g.paused||!g.playbackRate||!g.readyState)return;var A=performance.now()-v.loading.start,T=Math.abs(g.playbackRate);if(A<=500*L/T)return;var x=o.levels,h=o.minAutoLevel,u=x[a.level],D=v.total||Math.max(v.loaded,Math.round(L*u.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/A),w=(D-v.loaded)/S,b=g.currentTime,K=(j.BufferHelper.bufferInfo(g,b,C.maxBufferHole).end-b)/T;if(K>=2*L/T||w<=K)return;var X=Number.POSITIVE_INFINITY,Q;for(Q=a.level-1;Q>h;Q--){var V=x[Q].maxBitrate;if(X=L*V/(8*.8*S),X<K)break}if(X>=w)return;var W=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+`
Current BW estimate: `+(Object(H.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+w.toFixed(3)+` s
Estimated load time for the next fragment: `+X.toFixed(3)+` s
Time to underbuffer: `+K.toFixed(3)+" s"),o.nextLoadLevel=Q,this.bwEstimator.sample(A,v.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),o.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:v})},m.onFragLoaded=function(a,i){var o=i.frag,l=i.part;if(o.type===P.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(o.sn)){var C=l?l.stats:o.stats,g=l?l.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[o.level],L=(v.loaded?v.loaded.bytes:0)+C.loaded,A=(v.loaded?v.loaded.duration:0)+g;v.loaded={bytes:L,duration:A},v.realBitrate=Math.round(8*L/A)}if(o.bitrateTest){var T={stats:C,frag:o,part:l,id:o.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,T),o.bitrateTest=!1}}},m.onFragBuffered=function(a,i){var o=i.frag,l=i.part,C=l?l.stats:o.stats;if(C.aborted)return;if(o.type!==P.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},m.onError=function(a,i){switch(i.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},m.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},m.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,o=this.hls,l=o.maxAutoLevel,C=o.config,g=o.minAutoLevel,v=o.media,L=i?i.duration:a?a.duration:0,A=v?v.currentTime:0,T=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,x=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,h=(j.BufferHelper.bufferInfo(v,A,C.maxBufferHole).end-A)/T,u=this.findBestLevel(x,g,l,h,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(u>=0)return u;R.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var D=L?Math.min(L,C.maxStarvationDelay):C.maxStarvationDelay,S=C.abrBandWidthFactor,w=C.abrBandWidthUpFactor;if(!h){var b=this.bitrateTestDelay;if(b){var K=L?Math.min(L,C.maxLoadingDelay):C.maxLoadingDelay;D=K-b,R.logger.trace("bitrate test took "+Math.round(1e3*b)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*D)+" ms"),S=w=1}}return u=this.findBestLevel(x,g,l,h+D,S,w),Math.max(u,0)},m.findBestLevel=function(a,i,o,l,C,g){for(var v,L=this.fragCurrent,A=this.partCurrent,T=this.lastLoadedFragLevel,x=this.hls.levels,h=x[T],u=!!(h!=null&&(v=h.details)!==null&&v!==void 0&&v.live),D=h==null?void 0:h.codecSet,S=A?A.duration:L?L.duration:0,w=o;w>=i;w--){var b=x[w];if(!b||D&&b.codecSet!==D)continue;var K=b.details,X=(A?K==null?void 0:K.partTarget:K==null?void 0:K.averagetargetduration)||S,Q=void 0;w<=T?Q=C*a:Q=g*a;var V=x[w].maxBitrate,W=V*X/Q;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+w+"/"+Math.round(Q)+"/"+V+"/"+X+"/"+l+"/"+W),Q>V&&(!W||u&&!this.bitrateTestDelay||W<l))return w}return-1},f(p,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,i=this.bwEstimator;if(a!==-1&&(!i||!i.canEstimate()))return a;var o=this.getNextABRAutoLevel();return a!==-1&&(o=Math.min(a,o)),o},set:function(a){this._nextAutoLevel=a}}]),p}();Y.default=_},"./src/controller/audio-stream-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/polyfills/number.ts"),O=M("./src/controller/base-stream-controller.ts"),I=M("./src/events.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/controller/fragment-tracker.ts"),P=M("./src/types/level.ts"),R=M("./src/types/loader.ts"),c=M("./src/loader/fragment.ts"),f=M("./src/demux/chunk-cache.ts"),_=M("./src/demux/transmuxer-interface.ts"),p=M("./src/types/transmuxer.ts"),m=M("./src/controller/fragment-finders.ts"),y=M("./src/utils/discontinuities.ts"),a=M("./src/errors.ts"),i=M("./src/utils/logger.ts");function o(){return o=Object.assign||function(L){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var x in T)Object.prototype.hasOwnProperty.call(T,x)&&(L[x]=T[x])}return L},o.apply(this,arguments)}function l(L,A){L.prototype=Object.create(A.prototype),L.prototype.constructor=L,C(L,A)}function C(L,A){return C=Object.setPrototypeOf||function(x,h){return x.__proto__=h,x},C(L,A)}var g=100,v=function(L){l(A,L);function A(x,h){var u;return u=L.call(this,x,h,"[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 T=A.prototype;return T.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},T._registerListeners=function(){var h=this.hls;h.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(I.Events.ERROR,this.onError,this),h.on(I.Events.BUFFER_RESET,this.onBufferReset,this),h.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var h=this.hls;h.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(I.Events.ERROR,this.onError,this),h.off(I.Events.BUFFER_RESET,this.onBufferReset,this),h.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onInitPtsFound=function(h,u){var D=u.frag,S=u.id,w=u.initPTS;if(S==="main"){var b=D.cc;this.initPTS[D.cc]=w,this.log("InitPTS for cc: "+b+" found from main: "+w),this.videoTrackCC=b,this.state===O.State.WAITING_INIT_PTS&&this.tick()}},T.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=O.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,u>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=O.State.IDLE):(this.loadedmetadata=!1,this.state=O.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},T.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_TRACK:{var h,u=this.levels,D=this.trackId,S=u==null||((h=u[D])===null||h===void 0)?void 0:h.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=O.State.WAITING_INIT_PTS}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var w,b=performance.now(),K=this.retryDate;(!K||b>=K||(w=this.media)!==null&&w!==void 0&&w.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=O.State.IDLE);break}case O.State.WAITING_INIT_PTS:{var X=this.waitingData;if(X){var Q=X.frag,V=X.part,W=X.cache,te=X.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.FRAG_LOADING;var ue=W.flush(),ge={frag:Q,part:V,payload:ue,networkDetails:null};this._handleFragmentLoadProgress(ge),te&&L.prototype._handleFragmentLoadComplete.call(this,ge)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Oe=this.getLoadPosition(),qe=j.BufferHelper.bufferInfo(this.mediaBuffer,Oe,this.config.maxBufferHole),Ke=Object(m.fragmentWithinToleranceTest)(qe.end,this.config.maxFragLookUpTolerance,Q);Ke<0&&(i.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+qe.end+" is needed"),this.clearWaitingFragment())}}else this.state=O.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.IDLE)},T.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:h,D=u.buffered;!this.loadedmetadata&&D.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},T.doTickIdle=function(){var h,u,D=this.hls,S=this.levels,w=this.media,b=this.trackId,K=D.config;if(!S||!S[b])return;if(!w&&(this.startFragRequested||!K.startFragPrefetch))return;var X=S[b],Q=X.details;if(!Q||Q.live&&this.levelLastLoaded!==b||this.waitForCdnTuneIn(Q)){this.state=O.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(V===null)return;var W=V.len,te=this.getMaxBufferLength(),ue=this.audioSwitch;if(W>=te&&!ue)return;if(!ue&&this._streamEnded(V,Q)){D.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=O.State.ENDED;return}var ge=Q.fragments,Oe=ge[0].start,qe=V.end;if(ue){var Ke=this.getLoadPosition();qe=Ke,Q.PTSKnown&&Ke<Oe&&((V.end>Oe||V.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),w.currentTime=Oe+.05))}var Be=this.getNextFragment(qe,Q);if(!Be){this.bufferFlushed=!0;return}((h=Be.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((u=Be.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Be,Q):this.loadFragment(Be,Q,qe)},T.getMaxBufferLength=function(){var h=L.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return u===null?h:Math.max(h,u.len)},T.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(h,u){var D=u.audioTracks;this.resetTransmuxer(),this.levels=D.map(function(S){return new P.Level(S)})},T.onAudioTrackSwitching=function(h,u){var D=!!u.url;this.trackId=u.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),D?this.setInterval(g):this.resetTransmuxer(),D?(this.audioSwitch=!0,this.state=O.State.IDLE):this.state=O.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(h,u){this.mainDetails=u.details},T.onAudioTrackLoaded=function(h,u){var D,S=this.levels,w=u.details,b=u.id;if(!S){this.warn("Audio tracks were reset while loading level "+b);return}this.log("Track "+b+" loaded ["+w.startSN+","+w.endSN+"],duration:"+w.totalduration);var K=S[b],X=0;if(w.live||(D=K.details)!==null&&D!==void 0&&D.live){var Q=this.mainDetails;if(w.fragments[0]||(w.deltaUpdateFailed=!0),w.deltaUpdateFailed||!Q)return;!K.details&&w.hasProgramDateTime&&Q.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(w,Q),X=w.fragments[0].start):X=this.alignPlaylists(w,K.details)}K.details=w,this.levelLastLoaded=b,!this.startFragRequested&&(this.mainDetails||!w.live)&&this.setStartPosition(K.details,X),this.state===O.State.WAITING_TRACK&&!this.waitForCdnTuneIn(w)&&(this.state=O.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(h){var u,D=h.frag,S=h.part,w=h.payload,b=this.config,K=this.trackId,X=this.levels;if(!X){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+D.sn+" of level "+D.level+" will not be buffered");return}var Q=X[K];console.assert(Q,"Audio track is defined on fragment load progress");var V=Q.details;console.assert(V,"Audio track details are defined on fragment load progress");var W=b.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new _.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ue=this.initPTS[D.cc],ge=(u=D.initSegment)===null||u===void 0?void 0:u.data;if(ue!==void 0){var Oe=!1,qe=S?S.index:-1,Ke=qe!==-1,Be=new p.ChunkMetadata(D.level,D.sn,D.stats.chunkCount,w.byteLength,qe,Ke);te.push(w,ge,W,"",D,S,V.totalduration,Oe,Be,ue)}else{i.logger.log("Unknown video PTS for cc "+D.cc+", waiting for video PTS before demuxing audio frag "+D.sn+" of ["+V.startSN+" ,"+V.endSN+"],track "+K);var Xe=this.waitingData=this.waitingData||{frag:D,part:S,cache:new f.default,complete:!1},Fe=Xe.cache;Fe.push(new Uint8Array(w)),this.waitingVideoCC=this.videoTrackCC,this.state=O.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,h)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(h,u){var D=u.tracks.audio;D&&(this.mediaBuffer=D.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},T.onFragBuffered=function(h,u){var D=u.frag,S=u.part;if(D.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(D)){this.warn("Fragment "+D.sn+(S?" p: "+S.index:"")+" of level "+D.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}D.sn!=="initSegment"&&(this.fragPrevious=D,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(D,S)},T.onError=function(h,u){switch(u.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,u);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==O.State.ERROR&&this.state!==O.State.STOPPED&&(this.state=u.fatal?O.State.ERROR:O.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var D=!0,S=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);S&&S.len>.5&&(D=!this.reduceMaxBufferLength(S.len)),D&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(h,u){var D=u.type;D===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(h){var u,D="audio",S=this.hls,w=h.remuxResult,b=h.chunkMeta,K=this.getCurrentContext(b);if(!K){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var X=K.frag,Q=K.part,V=w.audio,W=w.text,te=w.id3,ue=w.initSegment;if(this.fragContextChanged(X))return;if(this.state=O.State.PARSING,this.audioSwitch&&V&&this.completeAudioSwitch(),ue!=null&&ue.tracks&&(this._bufferInitSegment(ue.tracks,X,b),S.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:X,id:D,tracks:ue.tracks})),V){var ge=V.startPTS,Oe=V.endPTS,qe=V.startDTS,Ke=V.endDTS;Q&&(Q.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:ge,endPTS:Oe,startDTS:qe,endDTS:Ke}),X.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,ge,Oe,qe,Ke),this.bufferFragmentData(V,X,Q,b)}if(te!=null&&(u=te.samples)!==null&&u!==void 0&&u.length){var Be=o({frag:X,id:D},te);S.trigger(I.Events.FRAG_PARSING_METADATA,Be)}if(W){var Xe=o({frag:X,id:D},W);S.trigger(I.Events.FRAG_PARSING_USERDATA,Xe)}},T._bufferInitSegment=function(h,u,D){if(this.state!==O.State.PARSING)return;h.video&&delete h.video;var S=h.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,h);var w=S.initSegment;if(w!=null&&w.byteLength){var b={type:"audio",frag:u,part:null,chunkMeta:D,parent:u.type,data:w};this.hls.trigger(I.Events.BUFFER_APPENDING,b)}this.tick()},T.loadFragment=function(h,u,D){var S=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||S===N.FragmentState.NOT_LOADED||S===N.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):u.live&&!Object(H.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=O.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,h,u,D)))},T.completeAudioSwitch=function(){var h=this.hls,u=this.media,D=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:D})},A}(O.default);Y.default=v},"./src/controller/audio-track-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts"),O=M("./src/errors.ts"),I=M("./src/controller/base-playlist-controller.ts"),j=M("./src/types/loader.ts");function N(_,p){for(var m=0;m<p.length;m++){var y=p[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(_,y.key,y)}}function P(_,p,m){return p&&N(_.prototype,p),m&&N(_,m),_}function R(_,p){_.prototype=Object.create(p.prototype),_.prototype.constructor=_,c(_,p)}function c(_,p){return c=Object.setPrototypeOf||function(y,a){return y.__proto__=a,y},c(_,p)}var f=function(_){R(p,_);function p(y){var a;return a=_.call(this,y,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(H.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(H.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},m.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},m.onManifestParsed=function(a,i){this.tracks=i.audioTracks||[]},m.onAudioTrackLoaded=function(a,i){var o=i.id,l=i.details,C=this.tracksInGroup[o];if(!C){this.warn("Invalid audio track id "+o);return}var g=C.details;C.details=i.details,this.log("audioTrack "+o+" loaded ["+l.startSN+"-"+l.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,i,g))},m.onLevelLoading=function(a,i){this.switchLevel(i.level)},m.onLevelSwitching=function(a,i){this.switchLevel(i.level)},m.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.audioGroupIds))return;var o=i.audioGroupIds[i.urlId];if(this.groupId!==o){this.groupId=o;var l=this.tracks.filter(function(g){return!o||g.groupId===o});this.selectDefaultTrack&&!l.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var C={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},m.onError=function(a,i){if(_.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===j.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},m.setAudioTrack=function(a){var i=this.tracksInGroup;if(a<0||a>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=i[this.trackId];this.log("Now switching to audio-track index "+a);var l=i[a],C=l.id,g=l.groupId,v=g===void 0?"":g,L=l.name,A=l.type,T=l.url;if(this.trackId=a,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:v,name:L,type:A,url:T}),l.details&&!l.details.live)return;var x=this.switchParams(l.url,o==null?void 0:o.details);this.loadPlaylist(x)},m.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,o=this.findTrackId(i)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},m.findTrackId=function(a){for(var i=this.tracksInGroup,o=0;o<i.length;o++){var l=i[o];if((!this.selectDefaultTrack||l.default)&&(!a||a===l.name))return l.id}return-1},m.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var o=i.id,l=i.groupId,C=i.url;if(a)try{C=a.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:C,id:o,groupId:l,deliveryDirectives:a||null})}},P(p,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),p}(I.default);Y.default=f},"./src/controller/base-playlist-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return P});var H=M("./src/polyfills/number.ts"),O=M("./src/types/level.ts"),I=M("./src/controller/level-helper.ts"),j=M("./src/utils/logger.ts"),N=M("./src/errors.ts"),P=function(){function R(f,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,_+":"),this.warn=j.logger.warn.bind(j.logger,_+":"),this.hls=f}var c=R.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(_,p){p.fatal&&p.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(_,p){var m=p==null?void 0:p.renditionReports;if(m)for(var y=0;y<m.length;y++){var a=m[y],i=""+a.URI;if(i===_.substr(-i.length)){var o=parseInt(a["LAST-MSN"]),l=parseInt(a["LAST-PART"]);if(p&&this.hls.config.lowLatencyMode){var C=Math.min(p.age-p.partTarget,p.targetduration);l!==void 0&&C>p.partTarget&&(l+=1)}if(Object(H.isFiniteNumber)(o))return new O.HlsUrlParameters(o,Object(H.isFiniteNumber)(l)?l:void 0,O.HlsSkip.No)}}},c.loadPlaylist=function(_){},c.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},c.playlistLoaded=function(_,p,m){var y=this,a=p.details,i=p.stats,o=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-o,a.live||m!=null&&m.live){if(a.reloaded(m),m&&this.log("live playlist "+_+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),m&&a.fragments.length>0&&Object(I.mergeDetails)(m,a),!this.canLoad||!a.live)return;var l,C=void 0,g=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var v=this.hls.config.lowLatencyMode,L=a.lastPartSn,A=a.endSN,T=a.lastPartIndex,x=T!==-1,h=L===A,u=v?0:T;x?(C=h?A+1:L,g=h?u:T+1):C=A+1;var D=a.age,S=D+a.ageHeader,w=Math.min(S-a.partTarget,a.targetduration*1.5);if(w>0){if(m&&w>m.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+m.tuneInGoal+" to: "+w+" with playlist age: "+a.age),w=0;else{var b=Math.floor(w/a.targetduration);if(C+=b,g!==void 0){var K=Math.round(w%a.targetduration/a.partTarget);g+=K}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+D.toFixed(2)+"s goal: "+w+" skip sn "+b+" to part "+g)}a.tuneInGoal=w}if(l=this.getDeliveryDirectives(a,p.deliveryDirectives,C,g),v||!h){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(a,p.deliveryDirectives,C,g);var X=Object(I.computeReloadInterval)(a,i);C!==void 0&&a.canBlockReload&&(X-=a.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(X)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(l)},X)}else this.clearTimer()},c.getDeliveryDirectives=function(_,p,m,y){var a=Object(O.getSkipValue)(_,m);return p!=null&&p.skip&&_.deltaUpdateFailed&&(m=p.msn,y=p.part,a=O.HlsSkip.No),new O.HlsUrlParameters(m,y,a)},c.retryLoadingOrFail=function(_){var p=this,m=this.hls.config,y=this.retryCount<m.levelLoadingMaxRetry;if(y){var a;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(a=_.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*m.levelLoadingRetryDelay,m.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return p.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return y},R}()},"./src/controller/base-stream-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"State",function(){return A}),M.d(Y,"default",function(){return T});var H=M("./src/polyfills/number.ts"),O=M("./src/task-loop.ts"),I=M("./src/controller/fragment-tracker.ts"),j=M("./src/utils/buffer-helper.ts"),N=M("./src/utils/logger.ts"),P=M("./src/events.ts"),R=M("./src/errors.ts"),c=M("./src/types/transmuxer.ts"),f=M("./src/utils/mp4-tools.ts"),_=M("./src/utils/discontinuities.ts"),p=M("./src/controller/fragment-finders.ts"),m=M("./src/controller/level-helper.ts"),y=M("./src/loader/fragment-loader.ts"),a=M("./src/crypt/decrypter.ts"),i=M("./src/utils/time-ranges.ts"),o=M("./src/types/loader.ts");function l(x,h){for(var u=0;u<h.length;u++){var D=h[u];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(x,D.key,D)}}function C(x,h,u){return h&&l(x.prototype,h),u&&l(x,u),x}function g(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function v(x,h){x.prototype=Object.create(h.prototype),x.prototype.constructor=x,L(x,h)}function L(x,h){return L=Object.setPrototypeOf||function(D,S){return D.__proto__=S,D},L(x,h)}var A={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"},T=function(x){v(h,x);function h(D,S,w){var b;return b=x.call(this)||this,b.hls=void 0,b.fragPrevious=null,b.fragCurrent=null,b.fragmentTracker=void 0,b.transmuxer=null,b._state=A.STOPPED,b.media=void 0,b.mediaBuffer=void 0,b.config=void 0,b.bitrateTest=!1,b.lastCurrentTime=0,b.nextLoadPosition=0,b.startPosition=0,b.loadedmetadata=!1,b.fragLoadError=0,b.retryDate=0,b.levels=null,b.fragmentLoader=void 0,b.levelLastLoaded=null,b.startFragRequested=!1,b.decrypter=void 0,b.initPTS=[],b.onvseeking=null,b.onvended=null,b.logPrefix="",b.log=void 0,b.warn=void 0,b.logPrefix=w,b.log=N.logger.log.bind(N.logger,w+":"),b.warn=N.logger.warn.bind(N.logger,w+":"),b.hls=D,b.fragmentLoader=new y.default(D.config),b.fragmentTracker=S,b.config=D.config,b.decrypter=new a.default(D,D.config),D.on(P.Events.KEY_LOADED,b.onKeyLoaded,g(b)),b}var u=h.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(S){},u.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=A.STOPPED},u._streamEnded=function(S,w){var b=this.fragCurrent,K=this.fragmentTracker;if(!w.live&&b&&b.sn===w.endSN&&!S.nextStart){var X=K.getState(b);return X===I.FragmentState.PARTIAL||X===I.FragmentState.OK}return!1},u.onMediaAttached=function(S,w){var b=this.media=this.mediaBuffer=w.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),b.addEventListener("seeking",this.onvseeking),b.addEventListener("ended",this.onvended);var K=this.config;this.levels&&K.autoStartLoad&&this.state===A.STOPPED&&this.startLoad(K.startPosition)},u.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.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 S=this.config,w=this.fragCurrent,b=this.media,K=this.mediaBuffer,X=this.state,Q=b?b.currentTime:0,V=j.BufferHelper.bufferInfo(K||b,Q,S.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(Q)?Q.toFixed(3):Q)+", state: "+X),X===A.ENDED)this.resetLoadingState();else if(w&&!V.len){var W=S.maxFragLookUpTolerance,te=w.start-W,ue=w.start+w.duration+W,ge=Q>ue;(Q<te||ge)&&(ge&&w.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),w.loader.abort()),this.resetLoadingState())}b&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!V.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(S,w){if(this.state!==A.KEY_LOADING||w.frag!==this.fragCurrent||!this.levels)return;this.state=A.IDLE;var b=this.levels[w.frag.level].details;b&&this.loadFragment(w.frag,b,w.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),x.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=A.STOPPED,this.hls.off(P.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,x.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(S,w){this.log("Loading key for "+S.sn+" of ["+w.startSN+"-"+w.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=A.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(P.Events.KEY_LOADING,{frag:S})},u.loadFragment=function(S,w,b){this._loadFragForPlayback(S,w,b)},u._loadFragForPlayback=function(S,w,b){var K=this,X=function(V){if(K.fragContextChanged(S)){K.warn("Fragment "+S.sn+(V.part?" p: "+V.part.index:"")+" of level "+S.level+" was dropped during download."),K.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,K._handleFragmentLoadProgress(V)};this._doFragLoad(S,w,b,X).then(function(Q){if(!Q)return;K.fragLoadError=0;var V=K.state;if(K.fragContextChanged(S)){(V===A.FRAG_LOADING||V===A.BACKTRACKING||!K.fragCurrent&&V===A.PARSING)&&(K.fragmentTracker.removeFragment(S),K.state=A.IDLE);return}if("payload"in Q&&(K.log("Loaded fragment "+S.sn+" of level "+S.level),K.hls.trigger(P.Events.FRAG_LOADED,Q),K.state===A.BACKTRACKING)){K.fragmentTracker.backtrack(S,Q),K.resetFragmentLoading(S);return}K._handleFragmentLoadComplete(Q)}).catch(function(Q){K.warn(Q),K.resetFragmentLoading(S)})},u.flushMainBuffer=function(S,w,b){if(b===void 0&&(b=null),!(S-w))return;var K={startOffset:S,endOffset:w,type:b};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,K)},u._loadInitSegment=function(S){var w=this;this._doFragLoad(S).then(function(b){if(!b||w.fragContextChanged(S)||!w.levels)throw new Error("init load aborted");return b}).then(function(b){var K=w.hls,X=b.payload,Q=S.decryptdata;if(X&&X.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var V=self.performance.now();return w.decrypter.webCryptoDecrypt(new Uint8Array(X),Q.key.buffer,Q.iv.buffer).then(function(W){var te=self.performance.now();return K.trigger(P.Events.FRAG_DECRYPTED,{frag:S,payload:W,stats:{tstart:V,tdecrypt:te}}),b.payload=W,b})}return b}).then(function(b){var K=w.fragCurrent,X=w.hls,Q=w.levels;if(!Q)throw new Error("init load aborted, missing levels");var V=Q[S.level].details;console.assert(V,"Level details are defined when init segment is loaded");var W=S.stats;w.state=A.IDLE,w.fragLoadError=0,S.data=new Uint8Array(b.payload),W.parsing.start=W.buffering.start=self.performance.now(),W.parsing.end=W.buffering.end=self.performance.now(),b.frag===K&&X.trigger(P.Events.FRAG_BUFFERED,{stats:W,frag:K,part:null,id:S.type}),w.tick()}).catch(function(b){w.warn(b),w.resetFragmentLoading(S)})},u.fragContextChanged=function(S){var w=this.fragCurrent;return!S||!w||S.level!==w.level||S.sn!==w.sn||S.urlId!==w.urlId},u.fragBufferedComplete=function(S,w){var b=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(w?" part: "+w.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+i.default.toString(j.BufferHelper.getBuffered(b))),this.state=A.IDLE,this.tick()},u._handleFragmentLoadComplete=function(S){var w=this.transmuxer;if(!w)return;var b=S.frag,K=S.part,X=S.partsLoaded,Q=!X||X.length===0||X.some(function(W){return!W}),V=new c.ChunkMetadata(b.level,b.sn,b.stats.chunkCount+1,0,K?K.index:-1,!Q);w.flush(V)},u._handleFragmentLoadProgress=function(S){},u._doFragLoad=function(S,w,b,K){var X=this;if(b===void 0&&(b=null),!this.levels)throw new Error("frag load aborted, missing levels");if(b=Math.max(S.start,b||0),this.config.lowLatencyMode&&w){var Q=w.partList;if(Q&&K){b>S.end&&w.fragmentHint&&(S=w.fragmentHint);var V=this.getNextPart(Q,S,b);if(V>-1){var W=Q[V];return this.log("Loading part sn: "+S.sn+" p: "+W.index+" cc: "+S.cc+" of playlist ["+w.startSN+"-"+w.endSN+"] parts [0-"+V+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(b.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=A.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,part:Q[V],targetBufferTime:b}),this.doFragPartsLoad(S,Q,V,K).catch(function(te){return X.handleFragLoadError(te)})}else if(!S.url||this.loadedEndOfParts(Q,b))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(w?"of ["+w.startSN+"-"+w.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(b.toFixed(3))),Object(H.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=A.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,targetBufferTime:b}),this.fragmentLoader.load(S,K).catch(function(te){return X.handleFragLoadError(te)})},u.doFragPartsLoad=function(S,w,b,K){var X=this;return new Promise(function(Q,V){var W=[],te=function ue(ge){var Oe=w[ge];X.fragmentLoader.loadPart(S,Oe,K).then(function(qe){W[Oe.index]=qe;var Ke=qe.part;X.hls.trigger(P.Events.FRAG_LOADED,qe);var Be=w[ge+1];if(Be&&Be.fragment===S)ue(ge+1);else return Q({frag:S,part:Ke,partsLoaded:W})}).catch(V)};te(b)})},u.handleFragLoadError=function(S){var w=S.data;return w&&w.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(w.frag,w.part):this.hls.trigger(P.Events.ERROR,w),null},u._handleTransmuxerFlush=function(S){var w=this.getCurrentContext(S);if(!w||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var b=w.frag,K=w.part,X=w.level,Q=self.performance.now();b.stats.parsing.end=Q,K&&(K.stats.parsing.end=Q),this.updateLevelTiming(b,K,X,S.partial)},u.getCurrentContext=function(S){var w=this.levels,b=S.level,K=S.sn,X=S.part;if(!w||!w[b])return this.warn("Levels object was unset while buffering fragment "+K+" of level "+b+". The current chunk will not be buffered."),null;var Q=w[b],V=X>-1?Object(m.getPartWith)(Q,K,X):null,W=V?V.fragment:Object(m.getFragmentWithSN)(Q,K,this.fragCurrent);return W?{frag:W,part:V,level:Q}:null},u.bufferFragmentData=function(S,w,b,K){if(!S||this.state!==A.PARSING)return;var X=S.data1,Q=S.data2,V=X;if(X&&Q&&(V=Object(f.appendUint8Array)(X,Q)),!V||!V.length)return;var W={type:S.type,frag:w,part:b,chunkMeta:K,parent:w.type,data:V};this.hls.trigger(P.Events.BUFFER_APPENDING,W),S.dropped&&S.independent&&!b&&this.flushBufferGap(w)},u.flushBufferGap=function(S){var w=this.media;if(!w)return;if(!j.BufferHelper.isBuffered(w,w.currentTime)){this.flushMainBuffer(0,S.start);return}var b=w.currentTime,K=j.BufferHelper.bufferInfo(w,b,0),X=S.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,X*.25),V=Math.max(Math.min(S.start-Q,K.end-Q),b+Q);S.start-V>Q&&this.flushMainBuffer(V,S.start)},u.getFwdBufferInfo=function(S,w){var b=this.config,K=this.getLoadPosition();if(!Object(H.isFiniteNumber)(K))return null;var X=j.BufferHelper.bufferInfo(S,K,b.maxBufferHole);if(X.len===0&&X.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(K,w);if(Q&&X.nextStart<Q.end)return j.BufferHelper.bufferInfo(S,K,Math.max(X.nextStart,b.maxBufferHole))}return X},u.getMaxBufferLength=function(S){var w=this.config,b;return S?b=Math.max(8*w.maxBufferSize/S,w.maxBufferLength):b=w.maxBufferLength,Math.min(b,w.maxMaxBufferLength)},u.reduceMaxBufferLength=function(S){var w=this.config,b=S||w.maxBufferLength;return w.maxMaxBufferLength>=b?(w.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+w.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(S,w){var b,K,X=w.fragments,Q=X.length;if(!Q)return null;var V=this.config,W=X[0].start,te;if(w.live){var ue=V.initialLiveManifestSize;if(Q<ue)return this.warn("Not enough fragments to start playback (have: "+Q+", need: "+ue+")"),null;!w.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(te=this.getInitialLiveFragment(w,X),this.startPosition=te?this.hls.liveSyncPosition||te.start:S)}else S<=W&&(te=X[0]);if(!te){var ge=V.lowLatencyMode?w.partEnd:w.fragmentEnd;te=this.getFragmentAtPosition(S,ge,w)}return(b=te)!==null&&b!==void 0&&b.initSegment&&!((K=te)!==null&&K!==void 0&&K.initSegment.data)&&!this.bitrateTest&&(te=te.initSegment),te},u.getNextPart=function(S,w,b){for(var K=-1,X=!1,Q=!0,V=0,W=S.length;V<W;V++){var te=S[V];if(Q=Q&&!te.independent,K>-1&&b<te.start)break;var ue=te.loaded;!ue&&(X||te.independent||Q)&&te.fragment===w&&(K=V),X=ue}return K},u.loadedEndOfParts=function(S,w){var b=S[S.length-1];return b&&w>b.start&&b.loaded},u.getInitialLiveFragment=function(S,w){var b=this.fragPrevious,K=null;if(b){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+b.programDateTime),K=Object(p.findFragmentByPDT)(w,b.endProgramDateTime,this.config.maxFragLookUpTolerance)),!K){var X=b.sn+1;if(X>=S.startSN&&X<=S.endSN){var Q=w[X-S.startSN];b.cc===Q.cc&&(K=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+K.sn))}K||(K=Object(p.findFragWithCC)(w,b.cc),K&&this.log("Live playlist, switching playlist, load frag with same CC: "+K.sn))}}else{var V=this.hls.liveSyncPosition;V!==null&&(K=this.getFragmentAtPosition(V,this.bitrateTest?S.fragmentEnd:S.edge,S))}return K},u.getFragmentAtPosition=function(S,w,b){var K=this.config,X=this.fragPrevious,Q=b.fragments,V=b.endSN,W=b.fragmentHint,te=K.maxFragLookUpTolerance,ue=!!(K.lowLatencyMode&&b.partList&&W);ue&&W&&!this.bitrateTest&&(Q=Q.concat(W),V=W.sn);var ge;if(S<w){var Oe=S>w-te?0:te;ge=Object(p.findFragmentByPTS)(X,Q,S,Oe)}else ge=Q[Q.length-1];if(ge){var qe=ge.sn-b.startSN,Ke=X&&ge.level===X.level,Be=Q[qe+1],Xe=this.fragmentTracker.getState(ge);if(Xe===I.FragmentState.BACKTRACKED){ge=null;for(var Fe=qe;Q[Fe]&&this.fragmentTracker.getState(Q[Fe])===I.FragmentState.BACKTRACKED;)X?ge=Q[Fe--]:ge=Q[--Fe];ge||(ge=Be)}else X&&ge.sn===X.sn&&!ue&&(Ke&&(ge.sn<V&&this.fragmentTracker.getState(Be)!==I.FragmentState.OK?(this.log("SN "+ge.sn+" just loaded, load next one: "+Be.sn),ge=Be):ge=null))}return ge},u.synchronizeToLiveEdge=function(S){var w=this.config,b=this.media;if(!b)return;var K=this.hls.liveSyncPosition,X=b.currentTime,Q=S.fragments[0].start,V=S.edge,W=X>=Q-w.maxFragLookUpTolerance&&X<=V;if(K!==null&&b.duration>K&&(X<K||!W)){var te=w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:w.liveMaxLatencyDurationCount*S.targetduration;(!W&&b.readyState<4||X<V-te)&&(this.loadedmetadata||(this.nextLoadPosition=K),b.readyState&&(this.warn("Playback: "+X.toFixed(3)+" is located too far from the end of live sliding playlist: "+V+", reset currentTime to : "+K.toFixed(3)),b.currentTime=K))}},u.alignPlaylists=function(S,w){var b=this.levels,K=this.levelLastLoaded,X=this.fragPrevious,Q=K!==null?b[K]:null,V=S.fragments.length;if(!V)return this.warn("No fragments in live playlist"),0;var W=S.fragments[0].start,te=!w,ue=S.alignedSliding&&Object(H.isFiniteNumber)(W);if(te||!ue&&!W){Object(_.alignStream)(X,Q,S);var ge=S.fragments[0].start;return this.log("Live playlist sliding: "+ge.toFixed(2)+" start-sn: "+(w?w.startSN:"na")+"->"+S.startSN+" prev-sn: "+(X?X.sn:"na")+" fragments: "+V),ge}return W},u.waitForCdnTuneIn=function(S){var w=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*w)},u.setStartPosition=function(S,w){var b=this.startPosition;if(b<w&&(b=-1),b===-1||this.lastCurrentTime===-1){var K=S.startTimeOffset;Object(H.isFiniteNumber)(K)?(b=w+K,K<0&&(b+=S.totalduration),b=Math.min(Math.max(w,b),w+S.totalduration),this.log("Start time offset "+K+" found in playlist, adjust startPosition to "+b),this.startPosition=b):S.live?b=this.hls.liveSyncPosition||w:this.startPosition=b=0,this.lastCurrentTime=b}this.nextLoadPosition=b},u.getLoadPosition=function(){var S=this.media,w=0;return this.loadedmetadata&&S?w=S.currentTime:this.nextLoadPosition&&(w=this.nextLoadPosition),w},u.handleFragLoadAborted=function(S,w){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(w?" part"+w.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},u.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=A.IDLE)},u.onFragmentOrKeyLoadError=function(S,w){if(w.fatal)return;var b=w.frag;if(!b||b.type!==S)return;var K=this.fragCurrent;console.assert(K&&b.sn===K.sn&&b.level===K.level&&b.urlId===K.urlId,"Frag load error must match current frag to retry");var X=this.config;if(this.fragLoadError+1<=X.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(b.level))return;var Q=Math.min(Math.pow(2,this.fragLoadError)*X.fragLoadingRetryDelay,X.fragLoadingMaxRetryTimeout);this.warn("Fragment "+b.sn+" of "+S+" "+b.level+" failed to load, retrying in "+Q+"ms"),this.retryDate=self.performance.now()+Q,this.fragLoadError++,this.state=A.FRAG_LOADING_WAITING_RETRY}else w.levelRetry?(S===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=A.IDLE):(N.logger.error(w.details+" reaches max retry, redispatch as fatal ..."),w.fatal=!0,this.hls.stopLoad(),this.state=A.ERROR)},u.afterBufferFlushed=function(S,w,b){if(!S)return;var K=j.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(w,K,b),this.state===A.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=A.IDLE},u.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var w=this.levels?this.levels[S].details:null;if(w!=null&&w.live)return this.startPosition=-1,this.setStartPosition(w,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(S,w,b,K){var X=this,Q=b.details;console.assert(!!Q,"level.details must be defined");var V=Object.keys(S.elementaryStreams).reduce(function(W,te){var ue=S.elementaryStreams[te];if(ue){var ge=ue.endPTS-ue.startPTS;if(ge<=0)return X.warn("Could not parse fragment "+S.sn+" "+te+" duration reliably ("+ge+") resetting transmuxer to fallback to playlist timing"),X.resetTransmuxer(),W||!1;var Oe=K?0:Object(m.updateFragPTSDTS)(Q,S,ue.startPTS,ue.endPTS,ue.startDTS,ue.endDTS);return X.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:Q,level:b,drift:Oe,type:te,frag:S,start:ue.startPTS,end:ue.endPTS}),!0}return W},!1);V?(this.state=A.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:S,part:w})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(h,[{key:"state",get:function(){return this._state},set:function(S){var w=this._state;w!==S&&(this._state=S,this.log(w+"->"+S))}}]),h}(O.default)},"./src/controller/buffer-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return p});var H=M("./src/polyfills/number.ts"),O=M("./src/events.ts"),I=M("./src/utils/logger.ts"),j=M("./src/errors.ts"),N=M("./src/utils/buffer-helper.ts"),P=M("./src/utils/mediasource-helper.ts"),R=M("./src/loader/fragment.ts"),c=M("./src/controller/buffer-operation-queue.ts"),f=Object(P.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,p=function(){function m(a){var i=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=i.hls,l=i.media,C=i.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),o.trigger(O.Events.MEDIA_ATTACHED,{media:l})),C&&C.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var y=m.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var i=this.hls;i.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(O.Events.BUFFER_RESET,this.onBufferReset,this),i.on(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(O.Events.BUFFER_EOS,this.onBufferEos,this),i.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(O.Events.FRAG_PARSED,this.onFragParsed,this),i.on(O.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var i=this.hls;i.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(O.Events.BUFFER_RESET,this.onBufferReset,this),i.off(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(O.Events.BUFFER_EOS,this.onBufferEos,this),i.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(O.Events.FRAG_PARSED,this.onFragParsed,this),i.off(O.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(i,o){var l=2;(o.audio&&!o.video||!o.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(i,o){var l=this.media=o.media;if(l&&f){var C=this.mediaSource=new f;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(C),this._objectUrl=l.src}},y.onMediaDetaching=function(){var i=this.media,o=this.mediaSource,l=this._objectUrl;if(o){if(I.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(C){I.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.load()):I.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(O.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(o){var l=i.sourceBuffer[o];try{l&&(i.removeBufferListeners(o),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[o]=void 0)}catch(C){I.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",C)}}),this._initSourceBuffer()},y.onBufferCodecs=function(i,o){var l=this,C=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(g){if(C){var v=l.tracks[g];if(v&&typeof v.buffer.changeType=="function"){var L=o[g],A=L.codec,T=L.levelCodec,x=L.container,h=(v.levelCodec||v.codec).replace(_,"$1"),u=(T||A).replace(_,"$1");if(h!==u){var D=x+";codecs="+(T||A);l.appendChangeType(g,D)}}}else l.pendingTracks[g]=o[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(i,o){var l=this,C=this.operationQueue,g={execute:function(){var L=l.sourceBuffer[i];L&&(I.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+o),L.changeType(o)),C.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(L){I.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",L)}};C.append(g,i)},y.onBufferAppending=function(i,o){var l=this,C=this.hls,g=this.operationQueue,v=this.tracks,L=o.data,A=o.type,T=o.frag,x=o.part,h=o.chunkMeta,u=h.buffering[A],D=self.performance.now();u.start=D;var S=T.stats.buffering,w=x?x.stats.buffering:null;S.start===0&&(S.start=D),w&&w.start===0&&(w.start=D);var b=v.audio,K=A==="audio"&&h.id===1&&(b==null?void 0:b.container)==="audio/mpeg",X={execute:function(){if(u.executeStart=self.performance.now(),K){var V=l.sourceBuffer[A];if(V){var W=T.start-V.timestampOffset;Math.abs(W)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+W+") sn: "+T.sn+")"),V.timestampOffset=T.start)}}l.appendExecutor(L,A)},onStart:function(){},onComplete:function(){var V=self.performance.now();u.executeEnd=u.end=V,S.first===0&&(S.first=V),w&&w.first===0&&(w.first=V);var W=l.sourceBuffer,te={};for(var ue in W)te[ue]=N.BufferHelper.getBuffered(W[ue]);l.appendError=0,l.hls.trigger(O.Events.BUFFER_APPENDED,{type:A,frag:T,part:x,chunkMeta:h,parent:T.type,timeRanges:te})},onError:function(V){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",V);var W={type:j.ErrorTypes.MEDIA_ERROR,parent:T.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?W.details=j.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,W.details=j.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>C.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),W.fatal=!0)),C.trigger(O.Events.ERROR,W)}};g.append(X,A)},y.onBufferFlushing=function(i,o){var l=this,C=this.operationQueue,g=function(L){return{execute:l.removeExecutor.bind(l,L,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(O.Events.BUFFER_FLUSHED,{type:L})},onError:function(T){I.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",T)}}};o.type?C.append(g(o.type),o.type):this.getSourceBufferTypes().forEach(function(v){C.append(g(v),v)})},y.onFragParsed=function(i,o){var l=this,C=o.frag,g=o.part,v=[],L=g?g.elementaryStreams:C.elementaryStreams;L[R.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(L[R.ElementaryStreamTypes.AUDIO]&&v.push("audio"),L[R.ElementaryStreamTypes.VIDEO]&&v.push("video"));var A=function(){var x=self.performance.now();C.stats.buffering.end=x,g&&(g.stats.buffering.end=x);var h=g?g.stats:C.stats;l.hls.trigger(O.Events.FRAG_BUFFERED,{frag:C,part:g,stats:h,id:C.type})};v.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(A,v)},y.onFragChanged=function(i,o){this.flushBackBuffer()},y.onBufferEos=function(i,o){var l=this,C=this.getSourceBufferTypes().reduce(function(g,v){var L=l.sourceBuffer[v];return(!o.type||o.type===v)&&(L&&!L.ended&&(L.ended=!0,I.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),g&&!!(!L||L.ended)},!0);C&&this.blockBuffers(function(){var g=l.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},y.onLevelUpdated=function(i,o){var l=o.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var i=this.hls,o=this.details,l=this.media,C=this.sourceBuffer;if(!l||o===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var v=o.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(H.isFiniteNumber)(v)||v<0)return;var L=l.currentTime,A=o.levelTargetDuration,T=Math.max(v,A),x=Math.floor(L/A)*A-T;g.forEach(function(h){var u=C[h];if(u){var D=N.BufferHelper.getBuffered(u);D.length>0&&x>D.start(0)&&(i.trigger(O.Events.BACK_BUFFER_REACHED,{bufferEnd:x}),o.live&&i.trigger(O.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:x}),i.trigger(O.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:x,type:h}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,o=this.hls,l=this.media,C=this.mediaSource,g=i.fragments[0].start+i.totalduration,v=l.duration,L=Object(H.isFiniteNumber)(C.duration)?C.duration:0;i.live&&o.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(i)):(g>L&&g>v||!Object(H.isFiniteNumber)(v))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},y.updateSeekableRange=function(i){var o=this.mediaSource,l=i.fragments,C=l.length;if(C&&i.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var g=Math.max(0,l[0].start),v=Math.max(g,g+i.totalduration);o.setLiveSeekableRange(g,v)}},y.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,o=this.operationQueue,l=this.pendingTracks,C=Object.keys(l).length;if(C&&!i||C===2){this.createSourceBuffers(l),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(O.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(v){o.executeNext(v)})}},y.createSourceBuffers=function(i){var o=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in i)if(!o[g]){var v=i[g];if(!v)throw Error("source buffer exists for track "+g+", however track does not");var L=v.levelCodec||v.codec,A=v.container+";codecs="+L;I.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var T=o[g]=l.addSourceBuffer(A),x=g;this.addBufferListener(x,"updatestart",this._onSBUpdateStart),this.addBufferListener(x,"updateend",this._onSBUpdateEnd),this.addBufferListener(x,"error",this._onSBUpdateError),this.tracks[g]={buffer:T,codec:L,container:v.container,levelCodec:v.levelCodec,id:v.id},C++}catch(h){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(O.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:A})}}C&&this.hls.trigger(O.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(i){var o=this.operationQueue,l=o.current(i);l.onStart()},y._onSBUpdateEnd=function(i){var o=this.operationQueue,l=o.current(i);l.onComplete(),o.shiftAndExecuteNext(i)},y._onSBUpdateError=function(i,o){I.logger.error("[buffer-controller]: "+i+" SourceBuffer error",o),this.hls.trigger(O.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(o)},y.removeExecutor=function(i,o,l){var C=this.media,g=this.mediaSource,v=this.operationQueue,L=this.sourceBuffer,A=L[i];if(!C||!g||!A){I.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(i);return}var T=Object(H.isFiniteNumber)(C.duration)?C.duration:Infinity,x=Object(H.isFiniteNumber)(g.duration)?g.duration:Infinity,h=Math.max(0,o),u=Math.min(l,T,x);u>h?(I.logger.log("[buffer-controller]: Removing ["+h+","+u+"] from the "+i+" SourceBuffer"),console.assert(!A.updating,i+" sourceBuffer must not be updating"),A.remove(h,u)):v.shiftAndExecuteNext(i)},y.appendExecutor=function(i,o){var l=this.operationQueue,C=this.sourceBuffer,g=C[o];if(!g){I.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(o);return}g.ended=!1,console.assert(!g.updating,o+" sourceBuffer must not be updating"),g.appendBuffer(i)},y.blockBuffers=function(i,o){var l=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var C=this.operationQueue,g=o.map(function(v){return C.appendBlocker(v)});Promise.all(g).then(function(){i(),o.forEach(function(v){var L=l.sourceBuffer[v];(!L||!L.updating)&&C.shiftAndExecuteNext(v)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(i,o,l){var C=this.sourceBuffer[i];if(!C)return;var g=l.bind(this,i);this.listeners[i].push({event:o,listener:g}),C.addEventListener(o,g)},y.removeBufferListeners=function(i){var o=this.sourceBuffer[i];if(!o)return;this.listeners[i].forEach(function(l){o.removeEventListener(l.event,l.listener)})},m}()},"./src/controller/buffer-operation-queue.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return O});var H=M("./src/utils/logger.ts"),O=function(){function I(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var j=I.prototype;return j.append=function(P,R){var c=this.queues[R];c.push(P),c.length===1&&this.buffers[R]&&this.executeNext(R)},j.insertAbort=function(P,R){var c=this.queues[R];c.unshift(P),this.executeNext(R)},j.appendBlocker=function(P){var R,c=new Promise(function(_){R=_}),f={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,P),c},j.executeNext=function(P){var R=this.buffers,c=this.queues,f=R[P],_=c[P];if(_.length){var p=_[0];try{p.execute()}catch(m){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),p.onError(m),(!f||!f.updating)&&(_.shift(),this.executeNext(P))}}},j.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},j.current=function(P){return this.queues[P][0]},I}()},"./src/controller/cap-level-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts");function O(N,P){for(var R=0;R<P.length;R++){var c=P[R];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(N,c.key,c)}}function I(N,P,R){return P&&O(N.prototype,P),R&&O(N,R),N}var j=function(){function N(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=N.prototype;return P.setStreamController=function(c){this.streamController=c},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var c=this.hls;c.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var c=this.hls;c.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(c,f){N.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},P.onMediaAttaching=function(c,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},P.onManifestParsed=function(c,f){var _=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,_.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onBufferCodecs=function(c,f){var _=this.hls;_.config.capLevelToPlayerSize&&f.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var f=this.hls;f.autoLevelCapping=this.getMaxLevel(c.length-1),f.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=f.autoLevelCapping}}},P.getMaxLevel=function(c){var f=this,_=this.hls.levels;if(!_.length)return-1;var p=_.filter(function(m,y){return N.isLevelAllowed(y,f.restrictedLevels)&&y<=c});return this.clientRect=null,N.getMaxLevelByMediaSize(p,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var c=this.media,f={width:0,height:0};if(c){var _=c.getBoundingClientRect();f.width=_.width,f.height=_.height,!f.width&&!f.height&&(f.width=_.right-_.left||c.width||0,f.height=_.bottom-_.top||c.height||0)}return this.clientRect=f,f},N.isLevelAllowed=function(c,f){return f===void 0&&(f=[]),f.indexOf(c)===-1},N.getMaxLevelByMediaSize=function(c,f,_){if(!c||!c.length)return-1;for(var p=function(o,l){return l?o.width!==l.width||o.height!==l.height:!0},m=c.length-1,y=0;y<c.length;y+=1){var a=c[y];if((a.width>=f||a.height>=_)&&p(a,c[y+1])){m=y;break}}return m},I(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(f){}return c}}]),N}();Y.default=j},"./src/controller/cmcd-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return p});var H=M("./src/events.ts"),O=M("./src/types/cmcd.ts"),I=M("./src/utils/buffer-helper.ts"),j=M("./src/utils/logger.ts");function N(m,y){for(var a=0;a<y.length;a++){var i=y[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,i.key,i)}}function P(m,y,a){return y&&N(m.prototype,y),a&&N(m,a),m}function R(m,y){var a=typeof Symbol!="undefined"&&m[Symbol.iterator]||m["@@iterator"];if(a)return(a=a.call(m)).next.bind(a);if(Array.isArray(m)||(a=c(m))||y&&m&&typeof m.length=="number"){a&&(m=a);var i=0;return function(){return i>=m.length?{done:!0}:{done:!1,value:m[i++]}}}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 c(m,y){if(!m)return;if(typeof m=="string")return f(m,y);var a=Object.prototype.toString.call(m).slice(8,-1);if(a==="Object"&&m.constructor&&(a=m.constructor.name),a==="Map"||a==="Set")return Array.from(m);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return f(m,y)}function f(m,y){(y==null||y>m.length)&&(y=m.length);for(var a=0,i=new Array(y);a<y;a++)i[a]=m[a];return i}function _(){return _=Object.assign||function(m){for(var y=1;y<arguments.length;y++){var a=arguments[y];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(m[i]=a[i])}return m},_.apply(this,arguments)}var p=function(){function m(a){var i=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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(C){try{i.apply(C,{ot:O.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(g){j.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,v=i.hls.levels[g.level],L=i.getObjectType(g),A={d:g.duration*1e3,ot:L};(L===O.CMCDObjectType.VIDEO||L===O.CMCDObjectType.AUDIO||L==O.CMCDObjectType.MUXED)&&(A.br=v.bitrate/1e3,A.tb=i.getTopBandwidth(L),A.bl=i.getBufferLength(L)),i.apply(C,A)}catch(T){j.logger.warn("Could not generate segment CMCD data.",T)}},this.hls=a;var o=this.config=a.config,l=o.cmcd;l!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||m.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var y=m.prototype;return y.registerListeners=function(){var i=this.hls;i.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var i=this.hls;i.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(i,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(i,o){var l,C;this.audioBuffer=(l=o.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(C=o.tracks.video)===null||C===void 0?void 0:C.buffer},y.createData=function(){var i;return{v:O.CMCDVersion,sf:O.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(i,o){o===void 0&&(o={}),_(o,this.createData());var l=o.ot===O.CMCDObjectType.INIT||o.ot===O.CMCDObjectType.VIDEO||o.ot===O.CMCDObjectType.MUXED;if(this.starved&&l&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var C=m.toHeaders(o);if(!Object.keys(C).length)return;i.headers||(i.headers={}),_(i.headers,C)}else{var g=m.toQuery(o);if(!g)return;i.url=m.appendQueryToUri(i.url,g)}},y.getObjectType=function(i){var o=i.type;return o==="subtitle"?O.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?O.CMCDObjectType.INIT:o==="audio"?O.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?O.CMCDObjectType.VIDEO:O.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(i){for(var o=0,l=i===O.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=R(l),g;!(g=C()).done;){var v=g.value;v.bitrate>o&&(o=v.bitrate)}return o>0?o:NaN},y.getBufferLength=function(i){var o=this.hls.media,l=i===O.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!o)return NaN;var C=I.BufferHelper.bufferInfo(l,o.currentTime,this.config.maxBufferHole);return C.len*1e3},y.createPlaylistLoader=function(){var i=this.config.pLoader,o=this.applyPlaylistData,l=i||this.config.loader;return function(){function C(v){this.loader=void 0,this.loader=new l(v)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,A,T){o(L),this.loader.load(L,A,T)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},y.createFragmentLoader=function(){var i=this.config.fLoader,o=this.applyFragmentData,l=i||this.config.loader;return function(){function C(v){this.loader=void 0,this.loader=new l(v)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,A,T){o(L),this.loader.load(L,A,T)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},m.uuid=function(){var i=URL.createObjectURL(new Blob),o=i.toString();return URL.revokeObjectURL(i),o.substr(o.lastIndexOf("/")+1)},m.serialize=function(i){for(var o=[],l=function(K){return!Number.isNaN(K)&&K!=null&&K!==""&&K!==!1},C=function(K){return Math.round(K)},g=function(K){return C(K/100)*100},v=function(K){return encodeURIComponent(K)},L={br:C,d:C,bl:g,dl:g,mtp:g,nor:v,rtp:g,tb:C},A=Object.keys(i||{}).sort(),T=R(A),x;!(x=T()).done;){var h=x.value,u=i[h];if(!l(u))continue;if(h==="v"&&u===1)continue;if(h=="pr"&&u===1)continue;var D=L[h];D&&(u=D(u));var S=typeof u,w=void 0;h==="ot"||h==="sf"||h==="st"?w=h+"="+u:S==="boolean"?w=h:S==="number"?w=h+"="+u:w=h+"="+JSON.stringify(u),o.push(w)}return o.join(",")},m.toHeaders=function(i){for(var o=Object.keys(i),l={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],v={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,A=o;L<A.length;L++){var T=A[L],x=v[T]!=null?v[T]:1;g[x][T]=i[T]}for(var h=0;h<g.length;h++){var u=m.serialize(g[h]);u&&(l["CMCD-"+C[h]]=u)}return l},m.toQuery=function(i){return"CMCD="+encodeURIComponent(m.serialize(i))},m.appendQueryToUri=function(i,o){if(!o)return i;var l=i.includes("?")?"&":"?";return""+i+l+o},m}()},"./src/controller/eme-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts"),O=M("./src/errors.ts"),I=M("./src/utils/logger.ts"),j=M("./src/utils/mediakeys-helper.ts");function N(p,m){for(var y=0;y<m.length;y++){var a=m[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,y){return m&&N(p.prototype,m),y&&N(p,y),p}var R=3,c=function(m,y,a){var i={audioCapabilities:[],videoCapabilities:[]};return m.forEach(function(o){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:a.audioRobustness||""})}),y.forEach(function(o){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:a.videoRobustness||""})}),[i]},f=function(m,y,a,i){switch(m){case j.KeySystems.WIDEVINE:return c(y,a,i);default:throw new Error("Unknown key-system: "+m)}},_=function(){function p(y){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=y,this._config=y.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 m=p.prototype;return m.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},m._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m.getLicenseServerUrl=function(a){switch(a){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},m._attemptKeySystemAccess=function(a,i,o){var l=this,C=f(a,i,o,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(a,C);this.mediaKeysPromise=g.then(function(v){return l._onMediaKeySystemAccessObtained(a,v)}),g.catch(function(v){I.logger.error('Failed to obtain key-system "'+a+'" access:',v)})},m._onMediaKeySystemAccessObtained=function(a,i){var o=this;I.logger.log('Access for key-system "'+a+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(l);var C=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(g){return l.mediaKeys=g,I.logger.log('Media-keys created for key-system "'+a+'"'),o._onMediaKeysCreated(),g});return C.catch(function(g){I.logger.error("Failed to create media-keys:",g)}),C},m._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),a._onNewMediaKeySession(i.mediaKeysSession))})},m._onNewMediaKeySession=function(a){var i=this;I.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(o){i._onKeySessionMessage(a,o.message)},!1)},m._onKeySessionMessage=function(a,i){I.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(o){I.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),a.update(o)})},m.onMediaEncrypted=function(a){var i=this;if(I.logger.log('Media is encrypted using "'+a.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(C){if(!i._media)return;i._attemptSetMediaKeys(C),i._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(o).catch(o)},m._attemptSetMediaKeys=function(a){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},m._generateRequestWithPreferredKeySession=function(a,i){var o=this,l=this._mediaKeysList[0];if(!l){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var C=l.mediaKeysSession;if(!C){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+a+'" init data type'),l.mediaKeysSessionInitialized=!0,C.generateRequest(a,i).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(g){I.logger.error("Error generating key-session request:",g),o.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},m._createLicenseXhr=function(a,i,o){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,a,i,o);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,l,a),C=void 0}catch(g){I.logger.error(g)}try{l.readyState||l.open("POST",a,!0),C&&C.call(this.hls,l,a)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return l},m._onLicenseRequestReadyStageChange=function(a,i,o,l){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var C=a.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,a,i)}catch(L){I.logger.error(L)}l(C)}else{if(I.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=R-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(o,l)}break}},m._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},m._requestLicense=function(a,i){I.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(o.mediaKeySystemDomain),C=this._createLicenseXhr(l,a,i);I.logger.log("Sending license request to URL: "+l);var g=this._generateLicenseRequestChallenge(o,a);C.send(g)}catch(v){I.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},m.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var o=i.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},m.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},m.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var o=i.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),l=i.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,o,l)},P(p,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),p}();Y.default=_},"./src/controller/fps-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts"),O=M("./src/utils/logger.ts"),I=function(){function j(P){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=P,this.registerListeners()}var N=j.prototype;return N.setStreamController=function(R){this.streamController=R},N.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(R,c){var f=this.hls.config;if(f.capLevelOnFPSDrop){var _=c.media instanceof self.HTMLVideoElement?c.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),f.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(R,c,f){var _=performance.now();if(c){if(this.lastTime){var p=_-this.lastTime,m=f-this.lastDroppedFrames,y=c-this.lastDecodedFrames,a=1e3*m/p,i=this.hls;if(i.trigger(H.Events.FPS_DROP,{currentDropped:m,currentDecoded:y,totalDroppedFrames:f}),a>0&&m>i.config.fpsDroppedMonitoringThreshold*y){var o=i.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=o)&&(o=o-1,i.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:i.currentLevel}),i.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=f,this.lastDecodedFrames=c}},N.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var c=R.getVideoPlaybackQuality();this.checkFPS(R,c.totalVideoFrames,c.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},j}();Y.default=I},"./src/controller/fragment-finders.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"findFragmentByPDT",function(){return I}),M.d(Y,"findFragmentByPTS",function(){return j}),M.d(Y,"fragmentWithinToleranceTest",function(){return N}),M.d(Y,"pdtWithinToleranceTest",function(){return P}),M.d(Y,"findFragWithCC",function(){return R});var H=M("./src/polyfills/number.ts"),O=M("./src/utils/binary-search.ts");function I(c,f,_){if(f===null||!Array.isArray(c)||!c.length||!Object(H.isFiniteNumber)(f))return null;var p=c[0].programDateTime;if(f<(p||0))return null;var m=c[c.length-1].endProgramDateTime;if(f>=(m||0))return null;_=_||0;for(var y=0;y<c.length;++y){var a=c[y];if(P(f,_,a))return a}return null}function j(c,f,_,p){_===void 0&&(_=0),p===void 0&&(p=0);var m=null;if(c?m=f[c.sn-f[0].sn+1]||null:_===0&&f[0].start===0&&(m=f[0]),m&&N(_,p,m)===0)return m;var y=O.default.search(f,N.bind(null,_,p));return y||m}function N(c,f,_){c===void 0&&(c=0),f===void 0&&(f=0);var p=Math.min(f,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-p<=c?1:_.start-p>c&&_.start?-1:0}function P(c,f,_){var p=Math.min(f,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,m=_.endProgramDateTime||0;return m-p>c}function R(c,f){return O.default.search(c,function(_){return _.cc<f?1:_.cc>f?-1:0})}},"./src/controller/fragment-tracker.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"FragmentState",function(){return I}),M.d(Y,"FragmentTracker",function(){return j});var H=M("./src/events.ts"),O=M("./src/types/loader.ts"),I;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(I||(I={}));var j=function(){function R(f){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=f,this._registerListeners()}var c=R.prototype;return c._registerListeners=function(){var _=this.hls;_.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var _=this.hls;_.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(_,p){if(p===O.PlaylistLevelType.MAIN){var m=this.activeFragment,y=this.activeParts;if(!m)return null;if(y)for(var a=y.length;a--;){var i=y[a],o=i?i.end:m.appendedPTS;if(i.start<=_&&o!==void 0&&_<=o)return a>9&&(this.activeParts=y.slice(a-9)),i}else if(m.start<=_&&m.appendedPTS!==void 0&&_<=m.appendedPTS)return m}return this.getBufferedFrag(_,p)},c.getBufferedFrag=function(_,p){for(var m=this.fragments,y=Object.keys(m),a=y.length;a--;){var i=m[y[a]];if((i==null?void 0:i.body.type)===p&&i.buffered){var o=i.body;if(o.start<=_&&_<=o.end)return o}}return null},c.detectEvictedFragments=function(_,p,m){var y=this;Object.keys(this.fragments).forEach(function(a){var i=y.fragments[a];if(!i)return;if(!i.buffered){i.body.type===m&&y.removeFragment(i.body);return}var o=i.range[_];if(!o)return;o.time.some(function(l){var C=!y.isTimeBuffered(l.startPTS,l.endPTS,p);return C&&y.removeFragment(i.body),C})})},c.detectPartialFragments=function(_){var p=this,m=this.timeRanges,y=_.frag,a=_.part;if(!m||y.sn==="initSegment")return;var i=P(y),o=this.fragments[i];if(!o)return;Object.keys(m).forEach(function(l){var C=y.elementaryStreams[l];if(!C)return;var g=m[l],v=a!==null||C.partial===!0;o.range[l]=p.getBufferedTimes(y,a,v,g)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},c.fragBuffered=function(_){var p=P(_),m=this.fragments[p];m&&(m.backtrack=m.loaded=null,m.buffered=!0)},c.getBufferedTimes=function(_,p,m,y){for(var a={time:[],partial:m},i=p?p.start:_.start,o=p?p.end:_.end,l=_.minEndPTS||o,C=_.maxStartPTS||i,g=0;g<y.length;g++){var v=y.start(g)-this.bufferPadding,L=y.end(g)+this.bufferPadding;if(C>=v&&l<=L){a.time.push({startPTS:Math.max(i,y.start(g)),endPTS:Math.min(o,y.end(g))});break}else if(i<L&&o>v)a.partial=!0,a.time.push({startPTS:Math.max(i,y.start(g)),endPTS:Math.min(o,y.end(g))});else if(o<=v)break}return a},c.getPartialFragment=function(_){var p=null,m,y,a,i=0,o=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(C){var g=l[C];if(!g)return;N(g)&&(y=g.body.start-o,a=g.body.end+o,_>=y&&_<=a&&(m=Math.min(_-y,a-_),i<=m&&(p=g.body,i=m)))}),p},c.getState=function(_){var p=P(_),m=this.fragments[p];return m?m.buffered?N(m)?I.PARTIAL:I.OK:m.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},c.backtrack=function(_,p){var m=P(_),y=this.fragments[m];if(!y||y.backtrack)return null;var a=y.backtrack=p||y.loaded;return y.loaded=null,a},c.getBacktrackData=function(_){var p=P(_),m=this.fragments[p];if(m){var y,a=m.backtrack;if(a!=null&&(y=a.payload)!==null&&y!==void 0&&y.byteLength)return a;this.removeFragment(_)}return null},c.isTimeBuffered=function(_,p,m){for(var y,a,i=0;i<m.length;i++){if(y=m.start(i)-this.bufferPadding,a=m.end(i)+this.bufferPadding,_>=y&&p<=a)return!0;if(p<=y)return!1}return!1},c.onFragLoaded=function(_,p){var m=p.frag,y=p.part;if(m.sn==="initSegment"||m.bitrateTest||y)return;var a=P(m);this.fragments[a]={body:m,loaded:p,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(_,p){var m=this,y=p.frag,a=p.part,i=p.timeRanges;if(y.type===O.PlaylistLevelType.MAIN)if(this.activeFragment=y,a){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var C=i[l];if(m.detectEvictedFragments(l,C),!a)for(var g=0;g<C.length;g++)y.appendedPTS=Math.max(C.end(g),y.appendedPTS||0)})},c.onFragBuffered=function(_,p){this.detectPartialFragments(p)},c.hasFragment=function(_){var p=P(_);return!!this.fragments[p]},c.removeFragmentsInRange=function(_,p,m){var y=this;Object.keys(this.fragments).forEach(function(a){var i=y.fragments[a];if(!i)return;if(i.buffered){var o=i.body;o.type===m&&o.start<p&&o.end>_&&y.removeFragment(o)}})},c.removeFragment=function(_){var p=P(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[p]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function N(R){var c,f;return R.buffered&&(((c=R.range.video)===null||c===void 0?void 0:c.partial)||((f=R.range.audio)===null||f===void 0?void 0:f.partial))}function P(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return N}),M.d(Y,"MAX_START_GAP_JUMP",function(){return P}),M.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),M.d(Y,"SKIP_BUFFER_RANGE_START",function(){return c}),M.d(Y,"default",function(){return f});var H=M("./src/utils/buffer-helper.ts"),O=M("./src/errors.ts"),I=M("./src/events.ts"),j=M("./src/utils/logger.ts"),N=250,P=2,R=.1,c=.05,f=function(){function _(m,y,a,i){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=m,this.media=y,this.fragmentTracker=a,this.hls=i}var p=_.prototype;return p.destroy=function(){this.hls=this.fragmentTracker=this.media=null},p.poll=function(y){var a=this.config,i=this.media,o=this.stalled,l=i.currentTime,C=i.seeking,g=this.seeking&&!C,v=!this.seeking&&C;if(this.seeking=C,l!==y){if(this.moved=!0,o!==null){if(this.stallReported){var L=self.performance.now()-o;j.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||g)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!H.BufferHelper.getBuffered(i).length)return;var A=H.BufferHelper.bufferInfo(i,l,0),T=A.len>0,x=A.nextStart||0;if(!T&&!x)return;if(C){var h=A.len>P,u=!x||x-l>P&&!this.fragmentTracker.getPartialFragment(l);if(h||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(x,A.start||0)-l,w=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,b=w==null||((D=w.details)===null||D===void 0)?void 0:D.live,K=b?w.details.targetduration*2:P;if(S>0&&S<=K){this._trySkipBufferHole(null);return}}var X=self.performance.now();if(o===null){this.stalled=X;return}var Q=X-o;!C&&Q>=N&&this._reportStall(A.len);var V=H.BufferHelper.bufferInfo(i,l,a.maxBufferHole);this._tryFixBufferStall(V,Q)},p._tryFixBufferStall=function(y,a){var i=this.config,o=this.fragmentTracker,l=this.media,C=l.currentTime,g=o.getPartialFragment(C);if(g){var v=this._trySkipBufferHole(g);if(v)return}y.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},p._reportStall=function(y){var a=this.hls,i=this.media,o=this.stallReported;o||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+y+")"),a.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},p._trySkipBufferHole=function(y){for(var a=this.config,i=this.hls,o=this.media,l=o.currentTime,C=0,g=H.BufferHelper.getBuffered(o),v=0;v<g.length;v++){var L=g.start(v);if(l+a.maxBufferHole>=C&&l<L){var A=Math.max(L+c,o.currentTime+R);return j.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+A),this.moved=!0,this.stalled=null,o.currentTime=A,y&&i.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+A,frag:y}),A}C=g.end(v)}return 0},p._tryNudgeBuffer=function(){var y=this.config,a=this.hls,i=this.media,o=i.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<y.nudgeMaxRetry){var C=o+l*y.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+o+" to "+C),i.currentTime=C,a.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+y.nudgeMaxRetry+" nudges"),a.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts"),O=M("./src/utils/texttrack-utils.ts"),I=M("./src/demux/id3.ts"),j=.25,N=function(){function P(c){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=c,this._registerListeners()}var R=P.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var f=this.hls;f.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var f=this.hls;f.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(f,_){this.media=_.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(O.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(f){if(!this.media)return;for(var _=0;_<f.length;_++){var p=f[_];if(p.kind==="metadata"&&p.label==="id3")return Object(O.sendAddTrackEvent)(p,this.media),p}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(f,_){if(!this.media)return;var p=_.frag,m=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<m.length;a++){var i=I.getID3Frames(m[a].data);if(i){var o=m[a].pts,l=a<m.length-1?m[a+1].pts:p.end,C=l-o;C<=0&&(l=o+j);for(var g=0;g<i.length;g++){var v=i[g];if(!I.isTimeStampFrame(v)){var L=new y(o,l,"");L.value=v,this.id3Track.addCue(L)}}}}},R.onBufferFlushing=function(f,_){var p=_.startOffset,m=_.endOffset,y=_.type;if(!y||y==="audio"){var a=this.id3Track;a&&Object(O.removeCuesInRange)(a,p,m)}},P}();Y.default=N},"./src/controller/latency-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return P});var H=M("./src/errors.ts"),O=M("./src/events.ts"),I=M("./src/utils/logger.ts");function j(R,c){for(var f=0;f<c.length;f++){var _=c[f];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function N(R,c,f){return c&&j(R.prototype,c),f&&j(R,f),R}var P=function(){function R(f){var _=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 _.timeupdate()},this.hls=f,this.config=f.config,this.registerListeners()}var c=R.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},c.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(O.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(O.Events.ERROR,this.onError)},c.onMediaAttached=function(_,p){this.media=p.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},c.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},c.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},c.onLevelUpdated=function(_,p){var m=p.details;this.levelDetails=m,m.advanced&&this.timeupdate(),!m.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},c.onError=function(_,p){if(p.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},c.timeupdate=function(){var _=this.media,p=this.levelDetails;if(!_||!p)return;this.currentTime=_.currentTime;var m=this.computeLatency();if(m===null)return;this._latency=m;var y=this.config,a=y.lowLatencyMode,i=y.maxLiveSyncPlaybackRate;if(!a||i===1)return;var o=this.targetLatency;if(o===null)return;var l=m-o,C=Math.min(this.maxLatency,o+p.targetduration),g=l<C;if(p.live&&g&&l>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,i)),L=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;_.playbackRate=Math.min(v,Math.max(1,L))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},c.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},c.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},N(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,p=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:p?_.liveMaxLatencyDurationCount*p.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var p=_.holdBack,m=_.partHoldBack,y=_.targetduration,a=this.config,i=a.liveSyncDuration,o=a.liveSyncDurationCount,l=a.lowLatencyMode,C=this.hls.userConfig,g=l&&m||p;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=i!==void 0?i:o*y);var v=y,L=1;return g+Math.min(this.stallCount*L,v)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),p=this.targetLatency,m=this.levelDetails;if(_===null||p===null||m===null)return null;var y=m.edge,a=_-p-this.edgeStalled,i=y-m.totalduration,o=y-(this.config.lowLatencyMode&&m.partTarget||m.targetduration);return Math.min(Math.max(i,a),o)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var p=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-p,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,p=this.levelDetails;if(!_||!p)return 0;var m=_.buffered.length;return m?_.buffered.end(m-1):p.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return a});var H=M("./src/types/level.ts"),O=M("./src/events.ts"),I=M("./src/errors.ts"),j=M("./src/utils/codecs.ts"),N=M("./src/controller/level-helper.ts"),P=M("./src/controller/base-playlist-controller.ts"),R=M("./src/types/loader.ts");function c(){return c=Object.assign||function(i){for(var o=1;o<arguments.length;o++){var l=arguments[o];for(var C in l)Object.prototype.hasOwnProperty.call(l,C)&&(i[C]=l[C])}return i},c.apply(this,arguments)}function f(i,o){for(var l=0;l<o.length;l++){var C=o[l];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(i,C.key,C)}}function _(i,o,l){return o&&f(i.prototype,o),l&&f(i,l),i}function p(i,o){i.prototype=Object.create(o.prototype),i.prototype.constructor=i,m(i,o)}function m(i,o){return m=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},m(i,o)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){p(o,i);function o(C){var g;return g=i.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var l=o.prototype;return l._registerListeners=function(){var g=this.hls;g.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(O.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var g=this.hls;g.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(O.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},l.startLoad=function(){var g=this._levels;g.forEach(function(v){v.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(g,v){var L=[],A=[],T=[],x,h={},u,D=!1,S=!1,w=!1;if(v.levels.forEach(function(Q){var V=Q.attrs;D=D||!!(Q.width&&Q.height),S=S||!!Q.videoCodec,w=w||!!Q.audioCodec,y&&Q.audioCodec&&Q.audioCodec.indexOf("mp4a.40.34")!==-1&&(Q.audioCodec=void 0);var W=Q.bitrate+"-"+Q.attrs.RESOLUTION+"-"+Q.attrs.CODECS;u=h[W],u?u.url.push(Q.url):(u=new H.Level(Q),h[W]=u,L.push(u)),V&&(V.AUDIO&&Object(N.addGroupId)(u,"audio",V.AUDIO),V.SUBTITLES&&Object(N.addGroupId)(u,"text",V.SUBTITLES))}),(D||S)&&w&&(L=L.filter(function(Q){var V=Q.videoCodec,W=Q.width,te=Q.height;return!!V||!!(W&&te)})),L=L.filter(function(Q){var V=Q.audioCodec,W=Q.videoCodec;return(!V||Object(j.isCodecSupportedInMp4)(V,"audio"))&&(!W||Object(j.isCodecSupportedInMp4)(W,"video"))}),v.audioTracks&&(A=v.audioTracks.filter(function(Q){return!Q.audioCodec||Object(j.isCodecSupportedInMp4)(Q.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(A)),v.subtitles&&(T=v.subtitles,Object(N.assignTrackIdsByGroup)(T)),L.length>0){x=L[0].bitrate,L.sort(function(Q,V){return Q.bitrate-V.bitrate}),this._levels=L;for(var b=0;b<L.length;b++)if(L[b].bitrate===x){this._firstLevel=b,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+x);break}var K=w&&!S,X={levels:L,audioTracks:A,subtitleTracks:T,firstLevel:this._firstLevel,stats:v.stats,audio:w,video:S,altAudio:!K&&A.some(function(Q){return!!Q.url})};this.hls.trigger(O.Events.MANIFEST_PARSED,X),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(O.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(g,v){if(i.prototype.onError.call(this,g,v),v.fatal)return;var L=v.context,A=this._levels[this.currentLevelIndex];if(L&&(L.type===R.PlaylistContextType.AUDIO_TRACK&&A.audioGroupIds&&L.groupId===A.audioGroupIds[A.urlId]||L.type===R.PlaylistContextType.SUBTITLE_TRACK&&A.textGroupIds&&L.groupId===A.textGroupIds[A.urlId])){this.redundantFailover(this.currentLevelIndex);return}var T=!1,x=!0,h;switch(v.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:case I.ErrorDetails.KEY_LOAD_ERROR:case I.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var u=this._levels[v.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=v.frag.level)):h=v.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(x=!1),h=L.level),T=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:h=v.level,T=!0;break}h!==void 0&&this.recoverLevel(v,h,T,x)},l.recoverLevel=function(g,v,L,A){var T=g.details,x=this._levels[v];if(x.loadError++,L){var h=this.retryLoadingOrFail(g);if(h)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var u=x.url.length;if(u>1&&x.loadError<u)g.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var D=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==D&&this._levels[D].loadError===0&&(this.warn(T+": switch to "+D),g.levelRetry=!0,this.hls.nextAutoLevel=D)}}},l.redundantFailover=function(g){var v=this._levels[g],L=v.url.length;if(L>1){var A=(v.urlId+1)%L;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(T){T.urlId=A}),this.level=g}},l.onFragLoaded=function(g,v){var L=v.frag;if(L!==void 0&&L.type===R.PlaylistLevelType.MAIN){var A=this._levels[L.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},l.onLevelLoaded=function(g,v){var L,A=v.level,T=v.details,x=this._levels[A];if(!x){var h;this.warn("Invalid level index "+A),(h=v.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(T.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(x.fragmentError===0&&(x.loadError=0,this.retryCount=0),this.playlistLoaded(A,v,x.details)):(L=v.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(T.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(g,v){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var A=-1,T=this.hls.audioTracks[v.id].groupId,x=0;x<L.audioGroupIds.length;x++)if(L.audioGroupIds[x]===T){A=x;break}A!==L.urlId&&(L.urlId=A,this.startLoad())}},l.loadPlaylist=function(g){var v=this.currentLevelIndex,L=this._levels[v];if(this.canLoad&&L&&L.url.length>0){var A=L.urlId,T=L.url[A];if(g)try{T=g.addDirectives(T)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Attempt loading level index "+v+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+A+" "+T),this.clearTimer(),this.hls.trigger(O.Events.LEVEL_LOADING,{url:T,level:v,id:A,deliveryDirectives:g||null})}},l.removeLevel=function(g,v){var L=function(x,h){return h!==v},A=this._levels.filter(function(T,x){return x!==g?!0:T.url.length>1&&v!==void 0?(T.url=T.url.filter(L),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(L)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(L)),T.urlId=0,!0):!1}).map(function(T,x){var h=T.details;return h!=null&&h.fragments&&h.fragments.forEach(function(u){u.level=x}),T});this._levels=A,this.hls.trigger(O.Events.LEVELS_UPDATED,{levels:A})},_(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var v,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===g&&(v=L[g])!==null&&v!==void 0&&v.details)return;if(g<0||g>=L.length){var A=g<0;if(this.hls.trigger(O.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:A,reason:"invalid level idx"}),A)return;g=Math.min(g,L.length-1)}this.clearTimer();var T=this.currentLevelIndex,x=L[T],h=L[g];this.log("switching to level "+g+" from "+T),this.currentLevelIndex=g;var u=c({},h,{level:g,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete u._urlId,this.hls.trigger(O.Events.LEVEL_SWITCHING,u);var D=h.details;if(!D||D.live){var S=this.switchParams(h.uri,x==null?void 0:x.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),o}(P.default)},"./src/controller/level-helper.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"addGroupId",function(){return I}),M.d(Y,"assignTrackIdsByGroup",function(){return j}),M.d(Y,"updatePTS",function(){return N}),M.d(Y,"updateFragPTSDTS",function(){return R}),M.d(Y,"mergeDetails",function(){return c}),M.d(Y,"mapPartIntersection",function(){return f}),M.d(Y,"mapFragmentIntersection",function(){return _}),M.d(Y,"adjustSliding",function(){return p}),M.d(Y,"addSliding",function(){return m}),M.d(Y,"computeReloadInterval",function(){return y}),M.d(Y,"getFragmentWithSN",function(){return a}),M.d(Y,"getPartWith",function(){return i});var H=M("./src/polyfills/number.ts"),O=M("./src/utils/logger.ts");function I(o,l,C){switch(l){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(C);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(C);break}}function j(o){var l={};o.forEach(function(C){var g=C.groupId||"";C.id=l[g]=l[g]||0,l[g]++})}function N(o,l,C){var g=o[l],v=o[C];P(g,v)}function P(o,l){var C=l.startPTS;if(Object(H.isFiniteNumber)(C)){var g=0,v;l.sn>o.sn?(g=C-o.start,v=o):(g=o.start-C,v=l),v.duration!==g&&(v.duration=g)}else if(l.sn>o.sn){var L=o.cc===l.cc;L&&o.minEndPTS?l.start=o.start+(o.minEndPTS-o.start):l.start=o.start+o.duration}else l.start=Math.max(o.start-l.duration,0)}function R(o,l,C,g,v,L){var A=g-C;A<=0&&(O.logger.warn("Fragment should have a positive duration",l),g=C+l.duration,L=v+l.duration);var T=C,x=g,h=l.startPTS,u=l.endPTS;if(Object(H.isFiniteNumber)(h)){var D=Math.abs(h-C);Object(H.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(D,l.deltaPTS):l.deltaPTS=D,T=Math.max(C,h),C=Math.min(C,h),v=Math.min(v,l.startDTS),x=Math.min(g,u),g=Math.max(g,u),L=Math.max(L,l.endDTS)}l.duration=g-C;var S=C-l.start;l.appendedPTS=g,l.start=l.startPTS=C,l.maxStartPTS=T,l.startDTS=v,l.endPTS=g,l.minEndPTS=x,l.endDTS=L;var w=l.sn;if(!o||w<o.startSN||w>o.endSN)return 0;var b,K=w-o.startSN,X=o.fragments;for(X[K]=l,b=K;b>0;b--)P(X[b],X[b-1]);for(b=K;b<X.length-1;b++)P(X[b],X[b+1]);return o.fragmentHint&&P(X[X.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,S}function c(o,l){for(var C=null,g=o.fragments,v=g.length-1;v>=0;v--){var L=g[v].initSegment;if(L){C=L;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var A=0,T;if(_(o,l,function(b,K){b.relurl&&(A=b.cc-K.cc),Object(H.isFiniteNumber)(b.startPTS)&&Object(H.isFiniteNumber)(b.endPTS)&&(K.start=K.startPTS=b.startPTS,K.startDTS=b.startDTS,K.appendedPTS=b.appendedPTS,K.maxStartPTS=b.maxStartPTS,K.endPTS=b.endPTS,K.endDTS=b.endDTS,K.minEndPTS=b.minEndPTS,K.duration=b.endPTS-b.startPTS,K.duration&&(T=K),l.PTSKnown=l.alignedSliding=!0),K.elementaryStreams=b.elementaryStreams,K.loader=b.loader,K.stats=b.stats,K.urlId=b.urlId,b.initSegment&&(K.initSegment=b.initSegment,C=b.initSegment)}),C){var x=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;x.forEach(function(b){var K;(!b.initSegment||b.initSegment.relurl===((K=C)===null||K===void 0?void 0:K.relurl))&&(b.initSegment=C)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(b){return!b}),l.deltaUpdateFailed)){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=l.skippedSegments;h--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(A){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var D=0;D<u.length;D++)u[D].cc+=A}l.skippedSegments&&(l.startCC=l.fragments[0].cc),f(o.partList,l.partList,function(b,K){K.elementaryStreams=b.elementaryStreams,K.stats=b.stats}),T?R(l,T,T.startPTS,T.endPTS,T.startDTS,T.endDTS):p(o,l),u.length&&(l.totalduration=l.edge-u[0].start),l.driftStartTime=o.driftStartTime,l.driftStart=o.driftStart;var S=l.advancedDateTime;if(l.advanced&&S){var w=l.edge;l.driftStart||(l.driftStartTime=S,l.driftStart=w),l.driftEndTime=S,l.driftEnd=w}else l.driftEndTime=o.driftEndTime,l.driftEnd=o.driftEnd,l.advancedDateTime=o.advancedDateTime}function f(o,l,C){if(o&&l)for(var g=0,v=0,L=o.length;v<=L;v++){var A=o[v],T=l[v+g];A&&T&&A.index===T.index&&A.fragment.sn===T.fragment.sn?C(A,T):g--}}function _(o,l,C){for(var g=l.skippedSegments,v=Math.max(o.startSN,l.startSN)-l.startSN,L=(o.fragmentHint?1:0)+(g?l.endSN:Math.min(o.endSN,l.endSN))-l.startSN,A=l.startSN-o.startSN,T=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,x=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,h=v;h<=L;h++){var u=x[A+h],D=T[h];g&&!D&&h<g&&(D=l.fragments[h]=u),u&&D&&C(u,D)}}function p(o,l){var C=l.startSN+l.skippedSegments-o.startSN,g=o.fragments;if(C<0||C>=g.length)return;m(l,g[C].start)}function m(o,l){if(l){for(var C=o.fragments,g=o.skippedSegments;g<C.length;g++)C[g].start+=l;o.fragmentHint&&(o.fragmentHint.start+=l)}}function y(o,l){var C=1e3*o.levelTargetDuration,g=C/2,v=o.age,L=v>0&&v<C*3,A=l.loading.end-l.loading.start,T,x=o.availabilityDelay;if(o.updated===!1)if(L){var h=333*o.misses;T=Math.max(Math.min(g,A*2),h),o.availabilityDelay=(o.availabilityDelay||0)+T}else T=g;else L?(x=Math.min(x||C/2,v),o.availabilityDelay=x,T=x+C-v):T=C-A;return Math.round(T)}function a(o,l,C){if(!o||!o.details)return null;var g=o.details,v=g.fragments[l-g.startSN];return v||(v=g.fragmentHint,v&&v.sn===l?v:l<g.startSN&&C&&C.sn===l?C:null)}function i(o,l,C){if(!o||!o.details)return null;var g=o.details.partList;if(g)for(var v=g.length;v--;){var L=g[v];if(L.index===C&&L.fragment.sn===l)return L}return null}},"./src/controller/stream-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return g});var H=M("./src/polyfills/number.ts"),O=M("./src/controller/base-stream-controller.ts"),I=M("./src/is-supported.ts"),j=M("./src/events.ts"),N=M("./src/utils/buffer-helper.ts"),P=M("./src/controller/fragment-tracker.ts"),R=M("./src/types/loader.ts"),c=M("./src/loader/fragment.ts"),f=M("./src/demux/transmuxer-interface.ts"),_=M("./src/types/transmuxer.ts"),p=M("./src/controller/gap-controller.ts"),m=M("./src/errors.ts"),y=M("./src/utils/logger.ts");function a(v,L){for(var A=0;A<L.length;A++){var T=L[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,T.key,T)}}function i(v,L,A){return L&&a(v.prototype,L),A&&a(v,A),v}function o(v,L){v.prototype=Object.create(L.prototype),v.prototype.constructor=v,l(v,L)}function l(v,L){return l=Object.setPrototypeOf||function(T,x){return T.__proto__=x,T},l(v,L)}var C=100,g=function(v){o(L,v);function L(T,x){var h;return h=v.call(this,T,x,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var A=L.prototype;return A._registerListeners=function(){var x=this.hls;x.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),x.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.on(j.Events.ERROR,this.onError,this),x.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),x.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A._unregisterListeners=function(){var x=this.hls;x.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.off(j.Events.ERROR,this.onError,this),x.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),x.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},A.startLoad=function(x){if(this.levels){var h=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var D=u.startLevel;D===-1&&(u.config.testBandwidth?(D=0,this.bitrateTest=!0):D=u.nextAutoLevel),this.level=u.nextLoadLevel=D,this.loadedmetadata=!1}h>0&&x===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),x=h),this.state=O.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=x,this.tick()}else this._forceStartLoad=!0,this.state=O.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_LEVEL:{var x,h=this.levels,u=this.level,D=h==null||((x=h[u])===null||x===void 0)?void 0:x.details;if(D&&(!D.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(D))break;this.state=O.State.IDLE;break}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var S,w=self.performance.now(),b=this.retryDate;(!b||w>=b||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=O.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var x,h,u=this.hls,D=this.levelLastLoaded,S=this.levels,w=this.media,b=u.config,K=u.nextLoadLevel;if(D===null||!w&&(this.startFragRequested||!b.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[K])return;var X=S[K];this.level=u.nextLoadLevel=K;var Q=X.details;if(!Q||this.state===O.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==K){this.state=O.State.WAITING_LEVEL;return}var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:w,R.PlaylistLevelType.MAIN);if(V===null)return;var W=V.len,te=this.getMaxBufferLength(X.maxBitrate);if(W>=te)return;if(this._streamEnded(V,Q)){var ue={};this.altAudio&&(ue.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,ue),this.state=O.State.ENDED;return}var ge=V.end,Oe=this.getNextFragment(ge,Q);if(this.couldBacktrack&&!this.fragPrevious&&Oe&&Oe.sn!=="initSegment"){var qe=Oe.sn-Q.startSN;qe>1&&(Oe=Q.fragments[qe-1],this.fragmentTracker.removeFragment(Oe))}if(Oe&&this.fragmentTracker.getState(Oe)===P.FragmentState.OK&&this.nextLoadPosition>ge){var Ke=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(w,Ke,R.PlaylistLevelType.MAIN),Oe=this.getNextFragment(this.nextLoadPosition,Q)}if(!Oe)return;Oe.initSegment&&!Oe.initSegment.data&&!this.bitrateTest&&(Oe=Oe.initSegment),((x=Oe.decryptdata)===null||x===void 0?void 0:x.keyFormat)==="identity"&&!((h=Oe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(Oe,Q):this.loadFragment(Oe,Q,ge)},A.loadFragment=function(x,h,u){var D,S=this.fragmentTracker.getState(x);if(this.fragCurrent=x,S===P.FragmentState.BACKTRACKED){var w=this.fragmentTracker.getBacktrackData(x);if(w){this._handleFragmentLoadProgress(w),this._handleFragmentLoadComplete(w);return}else S=P.FragmentState.NOT_LOADED}S===P.FragmentState.NOT_LOADED||S===P.FragmentState.PARTIAL?x.sn==="initSegment"?this._loadInitSegment(x):this.bitrateTest?(x.bitrateTest=!0,this.log("Fragment "+x.sn+" of level "+x.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(x)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,x,h,u)):S===P.FragmentState.APPENDING?this.reduceMaxBufferLength(x.duration)&&this.fragmentTracker.removeFragment(x):((D=this.media)===null||D===void 0?void 0:D.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(x){var h=this.fragmentTracker.getAppendedFrag(x,R.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},A.getBufferedFrag=function(x){return this.fragmentTracker.getBufferedFrag(x,R.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(x){return x?this.getBufferedFrag(x.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var x=this.levels,h=this.media;if(h!=null&&h.readyState){var u,D=this.getAppendedFrag(h.currentTime);if(D&&D.start>1&&this.flushMainBuffer(0,D.start-1),!h.paused&&x){var S=this.hls.nextLoadLevel,w=x[S],b=this.fragLastKbps;b&&this.fragCurrent?u=this.fragCurrent.duration*w.maxBitrate/(1e3*b)+1:u=0}else u=0;var K=this.getBufferedFrag(h.currentTime+u);if(K){var X=this.followingBufferedFrag(K);if(X){this.abortCurrentFrag();var Q=X.maxStartPTS?X.maxStartPTS:X.start,V=X.duration,W=Math.max(K.end,Q+Math.min(Math.max(V-this.config.maxFragLookUpTolerance,V*.5),V*.75));this.flushMainBuffer(W,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var x=this.fragCurrent;this.fragCurrent=null,x!=null&&x.loader&&x.loader.abort(),this.state===O.State.KEY_LOADING&&(this.state=O.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(x,h){v.prototype.flushMainBuffer.call(this,x,h,this.altAudio?"video":null)},A.onMediaAttached=function(x,h){v.prototype.onMediaAttached.call(this,x,h);var u=h.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 p.default(this.config,u,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var x=this.media;x&&(x.removeEventListener("playing",this.onvplaying),x.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var x=this.media,h=x?x.currentTime:null;Object(H.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(x,h){var u=!1,D=!1,S;h.levels.forEach(function(w){S=w.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(u=!0),S.indexOf("mp4a.40.5")!==-1&&(D=!0))}),this.audioCodecSwitch=u&&D&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},A.onLevelLoading=function(x,h){var u=this.levels;if(!u||this.state!==O.State.IDLE)return;var D=u[h.level];(!D.details||D.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(D.details))&&(this.state=O.State.WAITING_LEVEL)},A.onLevelLoaded=function(x,h){var u,D=this.levels,S=h.level,w=h.details,b=w.totalduration;if(!D){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+w.startSN+","+w.endSN+"], cc ["+w.startCC+", "+w.endCC+"] duration:"+b);var K=this.fragCurrent;K&&(this.state===O.State.FRAG_LOADING||this.state===O.State.FRAG_LOADING_WAITING_RETRY)&&(K.level!==h.level&&K.loader&&(this.state=O.State.IDLE,K.loader.abort()));var X=D[S],Q=0;if(w.live||(u=X.details)!==null&&u!==void 0&&u.live){if(w.fragments[0]||(w.deltaUpdateFailed=!0),w.deltaUpdateFailed)return;Q=this.alignPlaylists(w,X.details)}if(X.details=w,this.levelLastLoaded=S,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:w,level:S}),this.state===O.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(w))return;this.state=O.State.IDLE}this.startFragRequested?w.live&&this.synchronizeToLiveEdge(w):this.setStartPosition(w,Q),this.tick()},A._handleFragmentLoadProgress=function(x){var h,u=x.frag,D=x.part,S=x.payload,w=this.levels;if(!w){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var b=w[u.level],K=b.details;if(!K){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var X=b.videoCodec,Q=K.PTSKnown||!K.live,V=(h=u.initSegment)===null||h===void 0?void 0:h.data,W=this._getAudioCodec(b),te=this.transmuxer=this.transmuxer||new f.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ue=D?D.index:-1,ge=ue!==-1,Oe=new _.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,S.byteLength,ue,ge),qe=this.initPTS[u.cc];te.push(S,V,W,X,u,D,K.totalduration,Q,Oe,qe)},A.onAudioTrackSwitching=function(x,h){var u=this.altAudio,D=!!h.url,S=h.id;if(!D){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var w=this.fragCurrent;w!=null&&w.loader&&(this.log("Switching to main audio track, cancel main fragment load"),w.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var b=this.hls;u&&b.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),b.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:S})}},A.onAudioTrackSwitched=function(x,h){var u=h.id,D=!!this.hls.audioTracks[u].url;if(D){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=D,this.tick()},A.onBufferCreated=function(x,h){var u=h.tracks,D,S,w=!1;for(var b in u){var K=u[b];if(K.id==="main"){if(S=b,D=K,b==="video"){var X=u[b];X&&(this.videoBuffer=X.buffer)}}else w=!0}w&&D?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=D.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(x,h){var u=h.frag,D=h.part;if(u&&u.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(D?" p: "+D.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===O.State.PARSED&&(this.state=O.State.IDLE);return}var S=D?D.stats:u.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,D)},A.onError=function(x,h){switch(h.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,h);break;case m.ErrorDetails.LEVEL_LOAD_ERROR:case m.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==O.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=O.State.ERROR):!h.levelRetry&&this.state===O.State.WAITING_LEVEL&&(this.state=O.State.IDLE));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var u=!0,D=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);D&&D.len>.5&&(u=!this.reduceMaxBufferLength(D.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var x=this.media,h=this.gapController;if(!x||!h||!x.readyState)return;var u=N.BufferHelper.getBuffered(x);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=x.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=O.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(x,h){var u=h.type;if(u!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var D=(u===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(D,u,R.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(x,h){this.levels=h.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var x=this.media,h=x.currentTime,u=this.startPosition;if(u>=0&&h<u){if(x.seeking){y.logger.log("could not seek to "+u+", already seeking at "+h);return}var D=N.BufferHelper.getBuffered(x),S=D.length?D.start(0):0,w=S-u;w>0&&(w<this.config.maxBufferHole||w<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+w+" to match buffer start"),u+=w,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+h),x.currentTime=u}},A._getAudioCodec=function(x){var h=this.config.defaultAudioCodec||x.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},A._loadBitrateTestFrag=function(x){var h=this;this._doFragLoad(x).then(function(u){var D=h.hls;if(!u||D.nextLoadLevel||h.fragContextChanged(x))return;h.fragLoadError=0,h.state=O.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var S=x.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),D.trigger(j.Events.FRAG_LOADED,u)})},A._handleTransmuxComplete=function(x){var h,u="main",D=this.hls,S=x.remuxResult,w=x.chunkMeta,b=this.getCurrentContext(w);if(!b){this.warn("The loading context changed while buffering fragment "+w.sn+" of level "+w.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(w.level);return}var K=b.frag,X=b.part,Q=b.level,V=S.video,W=S.text,te=S.id3,ue=S.initSegment,ge=this.altAudio?void 0:S.audio;if(this.fragContextChanged(K))return;if(this.state=O.State.PARSING,ue){ue.tracks&&(this._bufferInitSegment(Q,ue.tracks,K,w),D.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:u,tracks:ue.tracks}));var Oe=ue.initPTS,qe=ue.timescale;Object(H.isFiniteNumber)(Oe)&&(this.initPTS[K.cc]=Oe,D.trigger(j.Events.INIT_PTS_FOUND,{frag:K,id:u,initPTS:Oe,timescale:qe}))}if(V&&S.independent!==!1){if(Q.details){var Ke=V.startPTS,Be=V.endPTS,Xe=V.startDTS,Fe=V.endDTS;if(X)X.elementaryStreams[V.type]={startPTS:Ke,endPTS:Be,startDTS:Xe,endDTS:Fe};else if(V.firstKeyFrame&&V.independent&&(this.couldBacktrack=!0),V.dropped&&V.independent){var xe=this.getLoadPosition()+this.config.maxBufferHole;if(xe<Ke){this.backtrack(K);return}K.setElementaryStreamInfo(V.type,K.start,Be,K.start,Fe,!0)}K.setElementaryStreamInfo(V.type,Ke,Be,Xe,Fe),this.bufferFragmentData(V,K,X,w)}}else if(S.independent===!1){this.backtrack(K);return}if(ge){var oe=ge.startPTS,Re=ge.endPTS,dt=ge.startDTS,at=ge.endDTS;X&&(X.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:Re,startDTS:dt,endDTS:at}),K.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,oe,Re,dt,at),this.bufferFragmentData(ge,K,X,w)}if(te!=null&&(h=te.samples)!==null&&h!==void 0&&h.length){var ut={frag:K,id:u,samples:te.samples};D.trigger(j.Events.FRAG_PARSING_METADATA,ut)}if(W){var ce={frag:K,id:u,samples:W.samples};D.trigger(j.Events.FRAG_PARSING_USERDATA,ce)}},A._bufferInitSegment=function(x,h,u,D){var S=this;if(this.state!==O.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var w=h.audio,b=h.video,K=h.audiovideo;if(w){var X=x.audioCodec,Q=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(X&&(X.indexOf("mp4a.40.5")!==-1?X="mp4a.40.2":X="mp4a.40.5"),w.metadata.channelCount!==1&&Q.indexOf("firefox")===-1&&(X="mp4a.40.5")),Q.indexOf("android")!==-1&&w.container!=="audio/mpeg"&&(X="mp4a.40.2",this.log("Android: force audio codec to "+X)),x.audioCodec&&x.audioCodec!==X&&this.log('Swapping manifest audio codec "'+x.audioCodec+'" for "'+X+'"'),w.levelCodec=X,w.id="main",this.log("Init audio buffer, container:"+w.container+", codecs[selected/level/parsed]=["+(X||"")+"/"+(x.audioCodec||"")+"/"+w.codec+"]")}b&&(b.levelCodec=x.videoCodec,b.id="main",this.log("Init video buffer, container:"+b.container+", codecs[level/parsed]=["+(x.videoCodec||"")+"/"+b.codec+"]")),K&&this.log("Init audiovideo buffer, container:"+K.container+", codecs[level/parsed]=["+(x.attrs.CODECS||"")+"/"+K.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(V){var W=h[V],te=W.initSegment;te!=null&&te.byteLength&&S.hls.trigger(j.Events.BUFFER_APPENDING,{type:V,data:te,frag:u,part:null,chunkMeta:D,parent:u.type})}),this.tick()},A.backtrack=function(x){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(x);var h=this.fragmentTracker.backtrack(x);this.fragPrevious=null,this.nextLoadPosition=x.start,h?this.resetFragmentLoading(x):this.state=O.State.BACKTRACKING},A.checkFragmentChanged=function(){var x=this.media,h=null;if(x&&x.readyState>1&&x.seeking===!1){var u=x.currentTime;if(N.BufferHelper.isBuffered(x,u)?h=this.getAppendedFrag(u):N.BufferHelper.isBuffered(x,u+.1)&&(h=this.getAppendedFrag(u+.1)),h){var D=this.fragPlaying,S=h.level;(!D||h.sn!==D.sn||D.level!==S||h.urlId!==D.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:h}),(!D||D.level!==S)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=h)}}},i(L,[{key:"nextLevel",get:function(){var x=this.nextBufferedFrag;return x?x.level:-1}},{key:"currentLevel",get:function(){var x=this.media;if(x){var h=this.getAppendedFrag(x.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var x=this.media;if(x){var h=this.getAppendedFrag(x.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(O.default)},"./src/controller/subtitle-stream-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"SubtitleStreamController",function(){return o});var H=M("./src/events.ts"),O=M("./src/utils/logger.ts"),I=M("./src/utils/buffer-helper.ts"),j=M("./src/controller/fragment-finders.ts"),N=M("./src/utils/discontinuities.ts"),P=M("./src/controller/level-helper.ts"),R=M("./src/controller/fragment-tracker.ts"),c=M("./src/controller/base-stream-controller.ts"),f=M("./src/types/loader.ts"),_=M("./src/types/level.ts");function p(l,C){for(var g=0;g<C.length;g++){var v=C[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(l,v.key,v)}}function m(l,C,g){return C&&p(l.prototype,C),g&&p(l,g),l}function y(l,C){l.prototype=Object.create(C.prototype),l.prototype.constructor=l,a(l,C)}function a(l,C){return a=Object.setPrototypeOf||function(v,L){return v.__proto__=L,v},a(l,C)}var i=500,o=function(l){y(C,l);function C(v,L){var A;return A=l.call(this,v,L,"[subtitle-stream-controller]")||this,A.levels=[],A.currentTrackId=-1,A.tracksBuffered=[],A.mainDetails=null,A._registerListeners(),A}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var L=this.hls;L.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(H.Events.ERROR,this.onError,this),L.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var L=this.hls;L.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(H.Events.ERROR,this.onError,this),L.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(i),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(L,A){this.mainDetails=A.details},g.onSubtitleFragProcessed=function(L,A){var T=A.frag,x=A.success;if(this.fragPrevious=T,this.state=c.State.IDLE,!x)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var u,D=T.start,S=0;S<h.length;S++)if(D>=h[S].start&&D<=h[S].end){u=h[S];break}var w=T.start+T.duration;u?u.end=w:(u={start:D,end:w},h.push(u)),this.fragmentTracker.fragBuffered(T)},g.onBufferFlushing=function(L,A){var T=A.startOffset,x=A.endOffset;if(T===0&&x!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,u=this.levels;if(!u.length||!u[h]||!u[h].details)return;var D=u[h].details,S=D.targetduration,w=x-S;if(w<=0)return;A.endOffsetSubtitles=Math.max(0,w),this.tracksBuffered.forEach(function(b){for(var K=0;K<b.length;){if(b[K].end<=w){b.shift();continue}else if(b[K].start<w)b[K].start=w;else break;K++}}),this.fragmentTracker.removeFragmentsInRange(T,w,f.PlaylistLevelType.SUBTITLE)}},g.onError=function(L,A){var T,x=A.frag;if(!x||x.type!==f.PlaylistLevelType.SUBTITLE)return;(T=this.fragCurrent)!==null&&T!==void 0&&T.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE},g.onSubtitleTracksUpdated=function(L,A){var T=this,x=A.subtitleTracks;this.tracksBuffered=[],this.levels=x.map(function(h){return new _.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){T.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(L,A){if(this.currentTrackId=A.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var T=this.levels[this.currentTrackId];T!=null&&T.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,T&&this.setInterval(i)},g.onSubtitleTrackLoaded=function(L,A){var T,x=A.details,h=A.id,u=this.currentTrackId,D=this.levels;if(!D.length)return;var S=D[u];if(h>=D.length||h!==u||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,x.live||(T=S.details)!==null&&T!==void 0&&T.live){var w=this.mainDetails;if(x.deltaUpdateFailed||!w)return;var b=w.fragments[0];if(!S.details)x.hasProgramDateTime&&w.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(x,w):b&&Object(P.addSliding)(x,b.start);else{var K=this.alignPlaylists(x,S.details);K===0&&b&&Object(P.addSliding)(x,b.start)}}if(S.details=x,this.levelLastLoaded=h,this.tick(),x.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE){var X=Object(j.findFragmentByPTS)(null,x.fragments,this.media.currentTime,0);X||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},g._handleFragmentLoadComplete=function(L){var A=L.frag,T=L.payload,x=A.decryptdata,h=this.hls;if(this.fragContextChanged(A))return;if(T&&T.byteLength>0&&x&&x.key&&x.iv&&x.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),x.key.buffer,x.iv.buffer).then(function(D){var S=performance.now();h.trigger(H.Events.FRAG_DECRYPTED,{frag:A,payload:D,stats:{tstart:u,tdecrypt:S}})})}},g.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var L,A=this.currentTrackId,T=this.levels;if(!T.length||!T[A]||!T[A].details)return;var x=T[A].details,h=x.targetduration,u=this.config,D=this.media,S=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,D.currentTime-h,u.maxBufferHole),w=S.end,b=S.len,K=this.getMaxBufferLength()+h;if(b>K)return;console.assert(x,"Subtitle track details are defined on idle subtitle stream controller tick");var X=x.fragments,Q=X.length,V=x.edge,W,te=this.fragPrevious;if(w<V){var ue=u.maxFragLookUpTolerance;te&&x.hasProgramDateTime&&(W=Object(j.findFragmentByPDT)(X,te.endProgramDateTime,ue)),W||(W=Object(j.findFragmentByPTS)(te,X,w,ue),!W&&te&&te.start<X[0].start&&(W=X[0]))}else W=X[Q-1];(L=W)!==null&&L!==void 0&&L.encrypted?(O.logger.log("Loading key for "+W.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:W})):W&&this.fragmentTracker.getState(W)===R.FragmentState.NOT_LOADED&&this.loadFragment(W,x,w)}},g.loadFragment=function(L,A,T){this.fragCurrent=L,l.prototype.loadFragment.call(this,L,A,T)},m(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(c.default)},"./src/controller/subtitle-track-controller.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/events.ts"),O=M("./src/utils/texttrack-utils.ts"),I=M("./src/controller/base-playlist-controller.ts"),j=M("./src/types/loader.ts");function N(p,m){for(var y=0;y<m.length;y++){var a=m[y];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function P(p,m,y){return m&&N(p.prototype,m),y&&N(p,y),p}function R(p,m){p.prototype=Object.create(m.prototype),p.prototype.constructor=p,c(p,m)}function c(p,m){return c=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},c(p,m)}var f=function(p){R(m,p);function m(a){var i;return i=p.call(this,a,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var y=m.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,p.prototype.destroy.call(this)},y.registerListeners=function(){var i=this.hls;i.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(H.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var i=this.hls;i.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(H.Events.ERROR,this.onError,this)},y.onMediaAttached=function(i,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)},y.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},y.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 i=_(this.media.textTracks);i.forEach(function(o){Object(O.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(i,o){this.tracks=o.subtitleTracks},y.onSubtitleTrackLoaded=function(i,o){var l=o.id,C=o.details,g=this.trackId,v=this.tracksInGroup[g];if(!v){this.warn("Invalid subtitle track id "+l);return}var L=v.details;v.details=o.details,this.log("subtitle track "+l+" loaded ["+C.startSN+"-"+C.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,L))},y.onLevelLoading=function(i,o){this.switchLevel(o.level)},y.onLevelSwitching=function(i,o){this.switchLevel(o.level)},y.switchLevel=function(i){var o=this.hls.levels[i];if(!(o!=null&&o.textGroupIds))return;var l=o.textGroupIds[o.urlId];if(this.groupId!==l){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(A){return!l||A.groupId===l});this.tracksInGroup=g;var v=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=l;var L={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,L),v!==-1&&this.setSubtitleTrack(v,C)}},y.findTrackId=function(i){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var C=o[l];if((!this.selectDefaultTrack||C.default)&&(!i||i===C.name))return C.id}return-1},y.onError=function(i,o){if(p.prototype.onError.call(this,i,o),o.fatal||!o.context)return;o.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},y.loadPlaylist=function(i){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,C=o.groupId,g=o.url;if(i)try{g=i.addDirectives(g)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:g,id:l,groupId:C,deliveryDirectives:i||null})}},y.toggleTrackModes=function(i){var o=this,l=this.media,C=this.subtitleDisplay,g=this.trackId;if(!l)return;var v=_(l.textTracks),L=v.filter(function(x){return x.groupId===o.groupId});if(i===-1)[].slice.call(v).forEach(function(x){x.mode="disabled"});else{var A=L[g];A&&(A.mode="disabled")}var T=L[i];T&&(T.mode=C?"showing":"hidden")},y.setSubtitleTrack=function(i,o){var l,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=C[i])!==null&&l!==void 0&&l.details)||i<-1||i>=C.length)return;this.clearTimer();var g=C[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,g){var v=g.id,L=g.groupId,A=L===void 0?"":L,T=g.name,x=g.type,h=g.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:A,name:T,type:x,url:h});var u=this.switchParams(g.url,o==null?void 0:o.details);this.loadPlaylist(u)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:i})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,o=_(this.media.textTracks),l=0;l<o.length;l++)if(o[l].mode==="hidden")i=l;else if(o[l].mode==="showing"){i=l;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},P(m,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,o)}}]),m}(I.default);function _(p){for(var m=[],y=0;y<p.length;y++){var a=p[y];a.kind==="subtitles"&&a.label&&m.push(p[y])}return m}Y.default=f},"./src/controller/timeline-controller.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"TimelineController",function(){return _});var H=M("./src/polyfills/number.ts"),O=M("./src/events.ts"),I=M("./src/utils/cea-608-parser.ts"),j=M("./src/utils/output-filter.ts"),N=M("./src/utils/webvtt-parser.ts"),P=M("./src/utils/texttrack-utils.ts"),R=M("./src/utils/imsc1-ttml-parser.ts"),c=M("./src/types/loader.ts"),f=M("./src/utils/logger.ts"),_=function(){function a(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=y(),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 l=new j.default(this,"textTrack1"),C=new j.default(this,"textTrack2"),g=new j.default(this,"textTrack3"),v=new j.default(this,"textTrack4");this.cea608Parser1=new I.default(1,l,C),this.cea608Parser2=new I.default(3,g,v)}o.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(O.Events.FRAG_LOADING,this.onFragLoading,this),o.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=a.prototype;return i.destroy=function(){var l=this.hls;l.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(O.Events.FRAG_LOADING,this.onFragLoading,this),l.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(l,C,g,v,L){for(var A=!1,T=L.length;T--;){var x=L[T],h=m(x[0],x[1],C,g);if(h>=0&&(x[0]=Math.min(x[0],C),x[1]=Math.max(x[1],g),A=!0,h/(g-C)>.5))return}if(A||L.push([C,g]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,C,g,v)}else{var D=this.Cues.newCue(null,C,g,v);this.hls.trigger(O.Events.CUES_PARSED,{type:"captions",cues:D,track:l})}},i.onInitPtsFound=function(l,C){var g=this,v=C.frag,L=C.id,A=C.initPTS,T=C.timescale,x=this.unparsedVttFrags;L==="main"&&(this.initPTS[v.cc]=A,this.timescale[v.cc]=T),x.length&&(this.unparsedVttFrags=[],x.forEach(function(h){g.onFragLoaded(O.Events.FRAG_LOADED,h)}))},i.getExistingTrack=function(l){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var v=C.textTracks[g];if(v[l])return v}return null},i.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},i.createNativeTrack=function(l){if(this.captionsTracks[l])return;var C=this.captionsProperties,g=this.captionsTracks,v=this.media,L=C[l],A=L.label,T=L.languageCode,x=this.getExistingTrack(l);if(x)g[l]=x,Object(P.clearCurrentCues)(g[l]),Object(P.sendAddTrackEvent)(g[l],v);else{var h=this.createTextTrack("captions",A,T);h&&(h[l]=!0,g[l]=h)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var C=this.captionsProperties[l];if(!C)return;var g=C.label,v={_id:l,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[l]=v,this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},i.createTextTrack=function(l,C,g){var v=this.media;return v?v.addTextTrack(l,C,g):void 0},i.onMediaAttaching=function(l,C){this.media=C.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(C){Object(P.clearCurrentCues)(l[C]),delete l[C]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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())},i._cleanTracks=function(){var l=this.media;if(!l)return;var C=l.textTracks;if(C)for(var g=0;g<C.length;g++)Object(P.clearCurrentCues)(C[g])},i.onSubtitleTracksUpdated=function(l,C){var g=this;this.textTracks=[];var v=C.subtitleTracks||[],L=v.some(function(h){return h.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var A=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var T=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,u){var D;if(u<T.length){for(var S=null,w=0;w<T.length;w++)if(p(T[w],h)){S=T[w];break}S&&(D=S)}D?Object(P.clearCurrentCues)(D):(D=g.createTextTrack("subtitles",h.name,h.lang),D&&(D.mode="disabled")),D&&(D.groupId=h.groupId,g.textTracks.push(D))})}else if(!A&&this.tracks&&this.tracks.length){var x=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:x})}}},i.onManifestLoaded=function(l,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(v){var L=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!L)return;var A="textTrack"+L[1],T=g.captionsProperties[A];if(!T)return;T.label=v.name,v.lang&&(T.languageCode=v.lang),T.media=v})},i.onFragLoading=function(l,C){var g=this.cea608Parser1,v=this.cea608Parser2,L=this.lastSn,A=this.lastPartIndex;if(!this.enabled||!(g&&v))return;if(C.frag.type===c.PlaylistLevelType.MAIN){var T,x,h=C.frag.sn,u=(T=C==null||((x=C.part)===null||x===void 0)?void 0:x.index)!=null?T:-1;h===L+1||h===L&&u===A+1||(g.reset(),v.reset()),this.lastSn=h,this.lastPartIndex=u}},i.onFragLoaded=function(l,C){var g=C.frag,v=C.payload,L=this.initPTS,A=this.unparsedVttFrags;if(g.type===c.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(H.isFiniteNumber)(L[g.cc])){A.push(C),L.length&&this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var T=g.decryptdata;if(T==null||T.key==null||T.method!=="AES-128"){var x=this.tracks[g.level],h=this.vttCCs;h[g.cc]||(h[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),x&&x.textCodec===R.IMSC1_CODEC?this._parseIMSC1(g,v):this._parseVTTs(g,v,h)}}else this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,C){var g=this,v=this.hls;Object(R.parseIMSC1)(C,this.initPTS[l.cc],this.timescale[l.cc],function(L){g._appendCues(L,l.level),v.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(L){f.logger.log("Failed to parse IMSC1: "+L),v.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:L})})},i._parseVTTs=function(l,C,g){var v=this,L=this.hls;Object(N.parseWebVTT)(C,this.initPTS[l.cc],this.timescale[l.cc],g,l.cc,l.start,function(A){v._appendCues(A,l.level),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(A){v._fallbackToIMSC1(l,C),f.logger.log("Failed to parse VTT cue: "+A),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:A})})},i._fallbackToIMSC1=function(l,C){var g=this,v=this.tracks[l.level];v.textCodec||Object(R.parseIMSC1)(C,this.initPTS[l.cc],this.timescale[l.cc],function(){v.textCodec=R.IMSC1_CODEC,g._parseIMSC1(l,C)},function(){v.textCodec="wvtt"})},i._appendCues=function(l,C){var g=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[C];if(v.mode==="disabled")return;l.forEach(function(T){return Object(P.addCueToTrack)(v,T)})}else{var L=this.tracks[C],A=L.default?"default":"subtitles"+C;g.trigger(O.Events.CUES_PARSED,{type:"subtitles",cues:l,track:A})}},i.onFragDecrypted=function(l,C){var g=C.frag;if(g.type===c.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(O.Events.FRAG_LOADED,C)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,C){var g=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(g&&v))return;for(var L=0;L<C.samples.length;L++){var A=C.samples[L].bytes;if(A){var T=this.extractCea608Data(A);g.addData(C.samples[L].pts,T[0]),v.addData(C.samples[L].pts,T[1])}}},i.onBufferFlushing=function(l,C){var g=C.startOffset,v=C.endOffset,L=C.endOffsetSubtitles,A=C.type,T=this.media;if(!T||T.currentTime<v)return;if(!A||A==="video"){var x=this.captionsTracks;Object.keys(x).forEach(function(u){return Object(P.removeCuesInRange)(x[u],g,v)})}if(this.config.renderTextTracksNatively&&(g===0&&L!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(u){return Object(P.removeCuesInRange)(h[u],g,L)})}},i.extractCea608Data=function(l){for(var C=l[0]&31,g=2,v=[[],[]],L=0;L<C;L++){var A=l[g++],T=127&l[g++],x=127&l[g++],h=(4&A)!==0,u=3&A;if(T===0&&x===0)continue;h&&((u===0||u===1)&&(v[u].push(T),v[u].push(x)))}return v},a}();function p(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function m(a,i,o,l){return Math.min(i,l)-Math.max(a,o)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return H});var H=function(){function O(j,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=N}var I=O.prototype;return I.decrypt=function(N,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,N)},O}()},"./src/crypt/aes-decryptor.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"removePadding",function(){return O}),M.d(Y,"default",function(){return I});var H=M("./src/utils/typed-array.ts");function O(j){var N=j.byteLength,P=N&&new DataView(j.buffer).getUint8(N-1);return P?Object(H.sliceUint8)(j,0,N-P):j}var I=function(){function j(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=j.prototype;return N.uint8ArrayToUint32Array_=function(R){for(var c=new DataView(R),f=new Uint32Array(4),_=0;_<4;_++)f[_]=c.getUint32(_*4);return f},N.initTable=function(){var R=this.sBox,c=this.invSBox,f=this.subMix,_=f[0],p=f[1],m=f[2],y=f[3],a=this.invSubMix,i=a[0],o=a[1],l=a[2],C=a[3],g=new Uint32Array(256),v=0,L=0,A=0;for(A=0;A<256;A++)A<128?g[A]=A<<1:g[A]=A<<1^283;for(A=0;A<256;A++){var T=L^L<<1^L<<2^L<<3^L<<4;T=T>>>8^T&255^99,R[v]=T,c[T]=v;var x=g[v],h=g[x],u=g[h],D=g[T]*257^T*16843008;_[v]=D<<24|D>>>8,p[v]=D<<16|D>>>16,m[v]=D<<8|D>>>24,y[v]=D,D=u*16843009^h*65537^x*257^v*16843008,i[T]=D<<24|D>>>8,o[T]=D<<16|D>>>16,l[T]=D<<8|D>>>24,C[T]=D,v?(v=x^g[g[g[u^x]]],L^=g[g[L]]):v=L=1}},N.expandKey=function(R){for(var c=this.uint8ArrayToUint32Array_(R),f=!0,_=0;_<c.length&&f;)f=c[_]===this.key[_],_++;if(f)return;this.key=c;var p=this.keySize=c.length;if(p!==4&&p!==6&&p!==8)throw new Error("Invalid aes key size="+p);var m=this.ksRows=(p+6+1)*4,y,a,i=this.keySchedule=new Uint32Array(m),o=this.invKeySchedule=new Uint32Array(m),l=this.sBox,C=this.rcon,g=this.invSubMix,v=g[0],L=g[1],A=g[2],T=g[3],x,h;for(y=0;y<m;y++){if(y<p){x=i[y]=c[y];continue}h=x,y%p===0?(h=h<<8|h>>>24,h=l[h>>>24]<<24|l[h>>>16&255]<<16|l[h>>>8&255]<<8|l[h&255],h^=C[y/p|0]<<24):p>6&&y%p===4&&(h=l[h>>>24]<<24|l[h>>>16&255]<<16|l[h>>>8&255]<<8|l[h&255]),i[y]=x=(i[y-p]^h)>>>0}for(a=0;a<m;a++)y=m-a,a&3?h=i[y]:h=i[y-4],a<4||y<=4?o[a]=h:o[a]=v[l[h>>>24]]^L[l[h>>>16&255]]^A[l[h>>>8&255]]^T[l[h&255]],o[a]=o[a]>>>0},N.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},N.decrypt=function(R,c,f){for(var _=this.keySize+6,p=this.invKeySchedule,m=this.invSBox,y=this.invSubMix,a=y[0],i=y[1],o=y[2],l=y[3],C=this.uint8ArrayToUint32Array_(f),g=C[0],v=C[1],L=C[2],A=C[3],T=new Int32Array(R),x=new Int32Array(T.length),h,u,D,S,w,b,K,X,Q,V,W,te,ue,ge,Oe=this.networkToHostOrderSwap;c<T.length;){for(Q=Oe(T[c]),V=Oe(T[c+1]),W=Oe(T[c+2]),te=Oe(T[c+3]),w=Q^p[0],b=te^p[1],K=W^p[2],X=V^p[3],ue=4,ge=1;ge<_;ge++)h=a[w>>>24]^i[b>>16&255]^o[K>>8&255]^l[X&255]^p[ue],u=a[b>>>24]^i[K>>16&255]^o[X>>8&255]^l[w&255]^p[ue+1],D=a[K>>>24]^i[X>>16&255]^o[w>>8&255]^l[b&255]^p[ue+2],S=a[X>>>24]^i[w>>16&255]^o[b>>8&255]^l[K&255]^p[ue+3],w=h,b=u,K=D,X=S,ue=ue+4;h=m[w>>>24]<<24^m[b>>16&255]<<16^m[K>>8&255]<<8^m[X&255]^p[ue],u=m[b>>>24]<<24^m[K>>16&255]<<16^m[X>>8&255]<<8^m[w&255]^p[ue+1],D=m[K>>>24]<<24^m[X>>16&255]<<16^m[w>>8&255]<<8^m[b&255]^p[ue+2],S=m[X>>>24]<<24^m[w>>16&255]<<16^m[b>>8&255]<<8^m[K&255]^p[ue+3],x[c]=Oe(h^g),x[c+1]=Oe(S^v),x[c+2]=Oe(D^L),x[c+3]=Oe(u^A),g=Q,v=V,L=W,A=te,c=c+4}return x.buffer},j}()},"./src/crypt/decrypter.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return c});var H=M("./src/crypt/aes-crypto.ts"),O=M("./src/crypt/fast-aes-key.ts"),I=M("./src/crypt/aes-decryptor.ts"),j=M("./src/utils/logger.ts"),N=M("./src/utils/mp4-tools.ts"),P=M("./src/utils/typed-array.ts"),R=16,c=function(){function f(p,m,y){var a=y===void 0?{}:y,i=a.removePKCS7Padding,o=i===void 0?!0:i;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=p,this.config=m,this.removePKCS7Padding=o,o)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=f.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var m=this.currentResult;if(!m){this.reset();return}var y=new Uint8Array(m);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(y):y},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(m,y,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(m),y,a);var o=this.flush();o&&i(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(m),y,a).then(i)},_.softwareDecrypt=function(m,y,a){var i=this.currentIV,o=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(m=Object(N.appendUint8Array)(l,m),this.remainderData=null);var C=this.getValidChunk(m);if(!C.length)return null;i&&(a=i);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new I.default),g.expandKey(y);var v=o;return this.currentResult=g.decrypt(C.buffer,0,a),this.currentIV=Object(P.sliceUint8)(C,-16).buffer,v||null},_.webCryptoDecrypt=function(m,y,a){var i=this,o=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new O.default(o,y)),this.fastAesKey.expandKey().then(function(l){if(!o)return Promise.reject(new Error("web crypto not initialized"));var C=new H.default(o,a);return C.decrypt(m.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,m,y,a)})},_.onWebCryptoError=function(m,y,a,i){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",m),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,a,i)},_.getValidChunk=function(m){var y=m,a=m.length-m.length%R;return a!==m.length&&(y=Object(P.sliceUint8)(m,0,a),this.remainderData=Object(P.sliceUint8)(m,a)),y},_.logOnce=function(m){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+m),this.logEnabled=!1},f}()},"./src/crypt/fast-aes-key.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return H});var H=function(){function O(j,N){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=N}var I=O.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},O}()},"./src/demux/aacdemuxer.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/demux/base-audio-demuxer.ts"),O=M("./src/demux/adts.ts"),I=M("./src/utils/logger.ts"),j=M("./src/demux/id3.ts");function N(c,f){c.prototype=Object.create(f.prototype),c.prototype.constructor=c,P(c,f)}function P(c,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(c,f)}var R=function(c){N(f,c);function f(p,m){var y;return y=c.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=p,y.config=m,y}var _=f.prototype;return _.resetInitSegment=function(m,y,a){c.prototype.resetInitSegment.call(this,m,y,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:m,duration:a,inputTimeScale:9e4,dropped:0}},f.probe=function(m){if(!m)return!1;for(var y=j.getID3Data(m,0)||[],a=y.length,i=m.length;a<i;a++)if(O.probe(m,a))return I.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(m,y){return O.canParse(m,y)},_.appendFrame=function(m,y,a){O.initTrackConfig(m,this.observer,y,a,m.manifestCodec);var i=O.appendFrame(m,y,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},f}(H.default);R.minProbeByteLength=9,Y.default=R},"./src/demux/adts.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"getAudioConfig",function(){return j}),M.d(Y,"isHeaderPattern",function(){return N}),M.d(Y,"getHeaderLength",function(){return P}),M.d(Y,"getFullFrameLength",function(){return R}),M.d(Y,"canGetFrameLength",function(){return c}),M.d(Y,"isHeader",function(){return f}),M.d(Y,"canParse",function(){return _}),M.d(Y,"probe",function(){return p}),M.d(Y,"initTrackConfig",function(){return m}),M.d(Y,"getFrameDuration",function(){return y}),M.d(Y,"parseFrameHeader",function(){return a}),M.d(Y,"appendFrame",function(){return i});var H=M("./src/utils/logger.ts"),O=M("./src/errors.ts"),I=M("./src/events.ts");function j(o,l,C,g){var v,L,A,T,x=navigator.userAgent.toLowerCase(),h=g,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((l[C+2]&192)>>>6)+1;var D=(l[C+2]&60)>>>2;if(D>u.length-1){o.trigger(I.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+D});return}return A=(l[C+2]&1)<<2,A|=(l[C+3]&192)>>>6,H.logger.log("manifest codec:"+g+", ADTS type:"+v+", samplingIndex:"+D),/firefox/i.test(x)?D>=6?(v=5,T=new Array(4),L=D-3):(v=2,T=new Array(2),L=D):x.indexOf("android")!==-1?(v=2,T=new Array(2),L=D):(v=5,T=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&D>=6?L=D-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(D>=6&&A===1||/vivaldi/i.test(x))||!g&&A===1)&&(v=2,T=new Array(2)),L=D)),T[0]=v<<3,T[0]|=(D&14)>>1,T[1]|=(D&1)<<7,T[1]|=A<<3,v===5&&(T[1]|=(L&14)>>1,T[2]=(L&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:u[D],channelCount:A,codec:"mp4a.40."+v,manifestCodec:h}}function N(o,l){return o[l]===255&&(o[l+1]&246)===240}function P(o,l){return o[l+1]&1?7:9}function R(o,l){return(o[l+3]&3)<<11|o[l+4]<<3|(o[l+5]&224)>>>5}function c(o,l){return l+5<o.length}function f(o,l){return l+1<o.length&&N(o,l)}function _(o,l){return c(o,l)&&N(o,l)&&R(o,l)<=o.length-l}function p(o,l){if(f(o,l)){var C=P(o,l);if(l+C>=o.length)return!1;var g=R(o,l);if(g<=C)return!1;var v=l+g;return v===o.length||f(o,v)}return!1}function m(o,l,C,g,v){if(!o.samplerate){var L=j(l,C,g,v);if(!L)return;o.config=L.config,o.samplerate=L.samplerate,o.channelCount=L.channelCount,o.codec=L.codec,o.manifestCodec=L.manifestCodec,H.logger.log("parsed codec:"+o.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function y(o){return 1024*9e4/o}function a(o,l,C,g,v){var L=P(o,l),A=R(o,l);if(A-=L,A>0){var T=C+g*v;return{headerLength:L,frameLength:A,stamp:T}}}function i(o,l,C,g,v){var L=y(o.samplerate),A=a(l,C,g,v,L);if(A){var T=A.frameLength,x=A.headerLength,h=A.stamp,u=x+T,D=Math.max(0,C+u-l.length),S;D?(S=new Uint8Array(u-x),S.set(l.subarray(C+x,l.length),0)):S=l.subarray(C+x,C+u);var w={unit:S,pts:h};return D||o.samples.push(w),{sample:w,length:u,missing:D}}}},"./src/demux/base-audio-demuxer.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"initPTSFn",function(){return R});var H=M("./src/polyfills/number.ts"),O=M("./src/demux/id3.ts"),I=M("./src/demux/dummy-demuxed-track.ts"),j=M("./src/utils/mp4-tools.ts"),N=M("./src/utils/typed-array.ts"),P=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var f=c.prototype;return f.resetInitSegment=function(p,m,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},f.resetTimeStamp=function(){},f.resetContiguity=function(){},f.canParse=function(p,m){return!1},f.appendFrame=function(p,m,y){},f.demux=function(p,m){this.cachedData&&(p=Object(j.appendUint8Array)(this.cachedData,p),this.cachedData=null);var y=O.getID3Data(p,0),a=y?y.length:0,i,o,l=this._audioTrack,C=this._id3Track,g=y?O.getTimeStamp(y):void 0,v=p.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(g,m)),y&&y.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),o=this.initPTS;a<v;){if(this.canParse(p,a)){var L=this.appendFrame(l,p,a);L?(this.frameIndex++,o=L.sample.pts,a+=L.length,i=a):a=v}else O.canParse(p,a)?(y=O.getID3Data(p,a),C.samples.push({pts:o,dts:o,data:y}),a+=y.length,i=a):a++;if(a===v&&i!==v){var A=Object(N.sliceUint8)(p,i);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,A):this.cachedData=A}}return{audioTrack:l,avcTrack:Object(I.dummyTrack)(),id3Track:C,textTrack:Object(I.dummyTrack)()}},f.demuxSampleAes=function(p,m,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},f.flush=function(p){var m=this.cachedData;return m&&(this.cachedData=null,this.demux(m,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},f.destroy=function(){},c}(),R=function(f,_){return Object(H.isFiniteNumber)(f)?f*90:_*9e4};Y.default=P},"./src/demux/chunk-cache.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return H});var H=function(){function I(){this.chunks=[],this.dataLength=0}var j=I.prototype;return j.push=function(P){this.chunks.push(P),this.dataLength+=P.length},j.flush=function(){var P=this.chunks,R=this.dataLength,c;if(P.length)P.length===1?c=P[0]:c=O(P,R);else return new Uint8Array(0);return this.reset(),c},j.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function O(I,j){for(var N=new Uint8Array(j),P=0,R=0;R<I.length;R++){var c=I[R];N.set(c,P),P+=c.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/utils/logger.ts"),O=function(){function I(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var j=I.prototype;return j.loadWord=function(){var P=this.data,R=this.bytesAvailable,c=P.byteLength-R,f=new Uint8Array(4),_=Math.min(4,R);if(_===0)throw new Error("no bytes available");f.set(P.subarray(c,c+_)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},j.skipBits=function(P){var R;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,R=P>>3,P-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},j.readBits=function(P){var R=Math.min(this.bitsAvailable,P),c=this.word>>>32-R;return P>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=P-R,R>0&&this.bitsAvailable?c<<R|this.readBits(R):c},j.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},j.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(P){for(var R=8,c=8,f,_=0;_<P;_++)c!==0&&(f=this.readEG(),c=(R+f+256)%256),R=c===0?R:c},j.readSPS=function(){var P=0,R=0,c=0,f=0,_,p,m,y=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),o=this.readBoolean.bind(this),l=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);y();var L=y();if(a(5),l(3),y(),g(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var A=i();if(A===3&&l(1),g(),g(),l(1),o())for(p=A!==3?8:12,m=0;m<p;m++)o()&&(m<6?v(16):v(64))}g();var T=i();if(T===0)i();else if(T===1)for(l(1),C(),C(),_=i(),m=0;m<_;m++)C();g(),l(1);var x=i(),h=i(),u=a(1);u===0&&l(1),l(1),o()&&(P=i(),R=i(),c=i(),f=i());var D=[1,1];if(o()&&o()){var S=y();switch(S){case 1:D=[1,1];break;case 2:D=[12,11];break;case 3:D=[10,11];break;case 4:D=[16,11];break;case 5:D=[40,33];break;case 6:D=[24,11];break;case 7:D=[20,11];break;case 8:D=[32,11];break;case 9:D=[80,33];break;case 10:D=[18,11];break;case 11:D=[15,11];break;case 12:D=[64,33];break;case 13:D=[160,99];break;case 14:D=[4,3];break;case 15:D=[3,2];break;case 16:D=[2,1];break;case 255:{D=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((x+1)*16-P*2-R*2),height:(2-u)*(h+1)*16-(u?2:4)*(c+f),pixelRatio:D}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();Y.default=O},"./src/demux/id3.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"isHeader",function(){return H}),M.d(Y,"isFooter",function(){return O}),M.d(Y,"getID3Data",function(){return I}),M.d(Y,"canParse",function(){return N}),M.d(Y,"getTimeStamp",function(){return P}),M.d(Y,"isTimeStampFrame",function(){return R}),M.d(Y,"getID3Frames",function(){return f}),M.d(Y,"decodeFrame",function(){return _}),M.d(Y,"utf8ArrayToStr",function(){return i}),M.d(Y,"testables",function(){return o});var H=function(v,L){return L+10<=v.length&&(v[L]===73&&v[L+1]===68&&v[L+2]===51&&(v[L+3]<255&&v[L+4]<255&&(v[L+6]<128&&v[L+7]<128&&v[L+8]<128&&v[L+9]<128)))},O=function(v,L){return L+10<=v.length&&(v[L]===51&&v[L+1]===68&&v[L+2]===73&&(v[L+3]<255&&v[L+4]<255&&(v[L+6]<128&&v[L+7]<128&&v[L+8]<128&&v[L+9]<128)))},I=function(v,L){for(var A=L,T=0;H(v,L);){T+=10;var x=j(v,L+6);T+=x,O(v,L+10)&&(T+=10),L+=T}return T>0?v.subarray(A,A+T):void 0},j=function(v,L){var A=0;return A=(v[L]&127)<<21,A|=(v[L+1]&127)<<14,A|=(v[L+2]&127)<<7,A|=v[L+3]&127,A},N=function(v,L){return H(v,L)&&j(v,L+6)+10<=v.length-L},P=function(v){for(var L=f(v),A=0;A<L.length;A++){var T=L[A];if(R(T))return a(T)}return},R=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},c=function(v){var L=String.fromCharCode(v[0],v[1],v[2],v[3]),A=j(v,4),T=10;return{type:L,size:A,data:v.subarray(T,T+A)}},f=function(v){for(var L=0,A=[];H(v,L);){var T=j(v,L+6);L+=10;for(var x=L+T;L+8<x;){var h=c(v.subarray(L)),u=_(h);u&&A.push(u),L+=h.size+10}O(v,L)&&(L+=10)}return A},_=function(v){return v.type==="PRIV"?p(v):v.type[0]==="W"?y(v):m(v)},p=function(v){if(v.size<2)return;var L=i(v.data,!0),A=new Uint8Array(v.data.subarray(L.length+1));return{key:v.type,info:L,data:A.buffer}},m=function(v){if(v.size<2)return;if(v.type==="TXXX"){var L=1,A=i(v.data.subarray(L),!0);L+=A.length+1;var T=i(v.data.subarray(L));return{key:v.type,info:A,data:T}}var x=i(v.data.subarray(1));return{key:v.type,data:x}},y=function(v){if(v.type==="WXXX"){if(v.size<2)return;var L=1,A=i(v.data.subarray(L),!0);L+=A.length+1;var T=i(v.data.subarray(L));return{key:v.type,info:A,data:T}}var x=i(v.data);return{key:v.type,data:x}},a=function(v){if(v.data.byteLength===8){var L=new Uint8Array(v.data),A=L[3]&1,T=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return T/=45,A&&(T+=4772185884e-2),Math.round(T)}return},i=function(v,L){L===void 0&&(L=!1);var A=C();if(A){var T=A.decode(v);if(L){var x=T.indexOf("\0");return x!==-1?T.substring(0,x):T}return T.replace(/\0/g,"")}for(var h=v.length,u,D,S,w="",b=0;b<h;){if(u=v[b++],u===0&&L)return w;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:w+=String.fromCharCode(u);break;case 12:case 13:D=v[b++],w+=String.fromCharCode((u&31)<<6|D&63);break;case 14:D=v[b++],S=v[b++],w+=String.fromCharCode((u&15)<<12|(D&63)<<6|(S&63)<<0);break;default:}}return w},o={decodeTextFrame:m},l;function C(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/demux/base-audio-demuxer.ts"),O=M("./src/demux/id3.ts"),I=M("./src/utils/logger.ts"),j=M("./src/demux/mpegaudio.ts");function N(c,f){c.prototype=Object.create(f.prototype),c.prototype.constructor=c,P(c,f)}function P(c,f){return P=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},P(c,f)}var R=function(c){N(f,c);function f(){return c.apply(this,arguments)||this}var _=f.prototype;return _.resetInitSegment=function(m,y,a){c.prototype.resetInitSegment.call(this,m,y,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:m,duration:a,inputTimeScale:9e4,dropped:0}},f.probe=function(m){if(!m)return!1;for(var y=O.getID3Data(m,0)||[],a=y.length,i=m.length;a<i;a++)if(j.probe(m,a))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(m,y){return j.canParse(m,y)},_.appendFrame=function(m,y,a){return this.initPTS===null?void 0:j.appendFrame(m,y,a,this.initPTS,this.frameIndex)},f}(H.default);R.minProbeByteLength=4,Y.default=R},"./src/demux/mp4demuxer.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/utils/mp4-tools.ts"),O=M("./src/demux/dummy-demuxed-track.ts"),I=function(){function j(P,R){this.remainderData=null,this.config=void 0,this.config=R}var N=j.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},j.probe=function(R){return Object(H.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},N.demux=function(R){var c=R,f=Object(O.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(H.appendUint8Array)(this.remainderData,R));var _=Object(H.segmentValidRange)(c);this.remainderData=_.remainder,f.samples=_.valid||new Uint8Array}else f.samples=c;return{audioTrack:Object(O.dummyTrack)(),avcTrack:f,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},N.flush=function(){var R=Object(O.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(O.dummyTrack)(),avcTrack:R,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},N.demuxSampleAes=function(R,c,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},j}();I.minProbeByteLength=1024,Y.default=I},"./src/demux/mpegaudio.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"appendFrame",function(){return P}),M.d(Y,"parseHeader",function(){return R}),M.d(Y,"isHeaderPattern",function(){return c}),M.d(Y,"isHeader",function(){return f}),M.d(Y,"canParse",function(){return _}),M.d(Y,"probe",function(){return p});var H=null,O=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function P(m,y,a,i,o){if(a+24>y.length)return;var l=R(y,a);if(l&&a+l.frameLength<=y.length){var C=l.samplesPerFrame*9e4/l.sampleRate,g=i+o*C,v={unit:y.subarray(a,a+l.frameLength),pts:g,dts:g};return m.config=[],m.channelCount=l.channelCount,m.samplerate=l.sampleRate,m.samples.push(v),{sample:v,length:l.frameLength,missing:0}}}function R(m,y){var a=m[y+1]>>3&3,i=m[y+1]>>1&3,o=m[y+2]>>4&15,l=m[y+2]>>2&3;if(a!==1&&o!==0&&o!==15&&l!==3){var C=m[y+2]>>1&1,g=m[y+3]>>6,v=a===3?3-i:i===3?3:4,L=O[v*14+o-1]*1e3,A=a===3?0:a===2?1:2,T=I[A*3+l],x=g===3?1:2,h=j[a][i],u=N[i],D=h*8*u,S=Math.floor(h*L/T+C)*u;if(H===null){var w=navigator.userAgent||"",b=w.match(/Chrome\/(\d+)/i);H=b?parseInt(b[1]):0}var K=!!H&&H<=87;return K&&i===2&&L>=224e3&&g===0&&(m[y+3]=m[y+3]|128),{sampleRate:T,channelCount:x,frameLength:S,samplesPerFrame:D}}}function c(m,y){return m[y]===255&&(m[y+1]&224)===224&&(m[y+1]&6)!==0}function f(m,y){return y+1<m.length&&c(m,y)}function _(m,y){var a=4;return c(m,y)&&a<=m.length-y}function p(m,y){if(y+1<m.length&&c(m,y)){var a=4,i=R(m,y),o=a;i!=null&&i.frameLength&&(o=i.frameLength);var l=y+o;return l===m.length||f(m,l)}return!1}},"./src/demux/sample-aes.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/crypt/decrypter.ts"),O=M("./src/demux/tsdemuxer.ts"),I=function(){function j(P,R,c){this.keyData=void 0,this.decrypter=void 0,this.keyData=c,this.decrypter=new H.default(P,R,{removePKCS7Padding:!1})}var N=j.prototype;return N.decryptBuffer=function(R,c){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,c)},N.decryptAacSample=function(R,c,f,_){var p=R[c].unit,m=p.subarray(16,p.length-p.length%16),y=m.buffer.slice(m.byteOffset,m.byteOffset+m.length),a=this;this.decryptBuffer(y,function(i){var o=new Uint8Array(i);p.set(o,16),_||a.decryptAacSamples(R,c+1,f)})},N.decryptAacSamples=function(R,c,f){for(;;c++){if(c>=R.length){f();return}if(R[c].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(R,c,f,_),!_)return}},N.getAvcEncryptedData=function(R){for(var c=Math.floor((R.length-48)/160)*16+16,f=new Int8Array(c),_=0,p=32;p<=R.length-16;p+=160,_+=16)f.set(R.subarray(p,p+16),_);return f},N.getAvcDecryptedUnit=function(R,c){for(var f=new Uint8Array(c),_=0,p=32;p<=R.length-16;p+=160,_+=16)R.set(f.subarray(_,_+16),p);return R},N.decryptAvcSample=function(R,c,f,_,p,m){var y=Object(O.discardEPB)(p.data),a=this.getAvcEncryptedData(y),i=this;this.decryptBuffer(a.buffer,function(o){p.data=i.getAvcDecryptedUnit(y,o),m||i.decryptAvcSamples(R,c,f+1,_)})},N.decryptAvcSamples=function(R,c,f,_){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,f=0){if(c>=R.length){_();return}for(var p=R[c].units;!(f>=p.length);f++){var m=p[f];if(m.data.length<=48||m.type!==1&&m.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(R,c,f,_,m,y),!y)return}}},j}();Y.default=I},"./src/demux/transmuxer-interface.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return p});var H=M("./node_modules/webworkify-webpack/index.js"),O=M.n(H),I=M("./src/events.ts"),j=M("./src/demux/transmuxer.ts"),N=M("./src/utils/logger.ts"),P=M("./src/errors.ts"),R=M("./src/utils/mediasource-helper.ts"),c=M("./node_modules/eventemitter3/index.js"),f=M.n(c),_=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},p=function(){function m(a,i,o,l){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=a,this.id=i,this.onTransmuxComplete=o,this.onFlush=l;var g=a.config,v=function(h,u){u=u||{},u.frag=C.frag,u.id=C.id,a.trigger(h,u)};this.observer=new c.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,v),this.observer.on(I.Events.ERROR,v);var L={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var T;try{T=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(x){a.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(x.message+" ("+x.filename+":"+x.lineno+")")})},T.postMessage({cmd:"init",typeSupported:L,vendor:A,id:i,config:JSON.stringify(g)})}catch(x){N.logger.warn("Error in worker:",x),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new j.default(this.observer,L,g,A,i),this.worker=null}}else this.transmuxer=new j.default(this.observer,L,g,A,i)}var y=m.prototype;return y.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},y.push=function(i,o,l,C,g,v,L,A,T,x){var h=this;T.transmuxing.start=self.performance.now();var u=this.transmuxer,D=this.worker,S=v?v.start:g.start,w=g.decryptdata,b=this.frag,K=!(b&&g.cc===b.cc),X=!(b&&T.level===b.level),Q=b?T.sn-b.sn:-1,V=this.part?T.part-this.part.index:1,W=!X&&(Q===1||Q===0&&V===1),te=self.performance.now();(X||Q||g.stats.parsing.start===0)&&(g.stats.parsing.start=te),v&&(V||!W)&&(v.stats.parsing.start=te);var ue=new j.TransmuxState(K,W,A,X,S);if(!W||K){N.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+`
discontinuity: `+K+`
trackSwitch: `+X+`
contiguous: `+W+`
accurateTimeOffset: `+A+`
timeOffset: `+S);var ge=new j.TransmuxConfig(l,C,o,L,x);this.configureTransmuxer(ge)}if(this.frag=g,this.part=v,D)D.postMessage({cmd:"demux",data:i,decryptdata:w,chunkMeta:T,state:ue},i instanceof ArrayBuffer?[i]:[]);else if(u){var Oe=u.push(i,w,T,ue);Object(j.isPromise)(Oe)?Oe.then(function(qe){h.handleTransmuxComplete(qe)}):this.handleTransmuxComplete(Oe)}},y.flush=function(i){var o=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:i});else if(l){var g=l.flush(i);Object(j.isPromise)(g)?g.then(function(v){o.handleFlushResult(v,i)}):this.handleFlushResult(g,i)}},y.handleFlushResult=function(i,o){var l=this;i.forEach(function(C){l.handleTransmuxComplete(C)}),this.onFlush(o)},y.onWorkerMessage=function(i){var o=i.data,l=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,l.trigger(o.event,o.data);break}}},y.configureTransmuxer=function(i){var o=this.worker,l=this.transmuxer;o?o.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},y.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},m}()},"./src/demux/transmuxer-worker.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return P});var H=M("./src/demux/transmuxer.ts"),O=M("./src/events.ts"),I=M("./src/utils/logger.ts"),j=M("./node_modules/eventemitter3/index.js"),N=M.n(j);function P(p){var m=new j.EventEmitter,y=function(i,o){p.postMessage({event:i,data:o})};m.on(O.Events.FRAG_DECRYPTED,y),m.on(O.Events.ERROR,y),p.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var o=JSON.parse(i.config);p.transmuxer=new H.default(m,i.typeSupported,o,i.vendor,i.id),Object(I.enableLogs)(o.debug),y("init",null);break}case"configure":{p.transmuxer.configure(i.config);break}case"demux":{var l=p.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(H.isPromise)(l)?l.then(function(v){R(p,v)}):R(p,l);break}case"flush":{var C=i.chunkMeta,g=p.transmuxer.flush(C);Object(H.isPromise)(g)?g.then(function(v){f(p,v,C)}):f(p,g,C);break}default:break}})}function R(p,m){if(_(m.remuxResult))return;var y=[],a=m.remuxResult,i=a.audio,o=a.video;i&&c(y,i),o&&c(y,o),p.postMessage({event:"transmuxComplete",data:m},y)}function c(p,m){m.data1&&p.push(m.data1.buffer),m.data2&&p.push(m.data2.buffer)}function f(p,m,y){m.forEach(function(a){R(p,a)}),p.postMessage({event:"flush",data:y})}function _(p){return!p.audio&&!p.video&&!p.text&&!p.id3&&!p.initSegment}},"./src/demux/transmuxer.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return o}),M.d(Y,"isPromise",function(){return g}),M.d(Y,"TransmuxConfig",function(){return v}),M.d(Y,"TransmuxState",function(){return L});var H=M("./src/events.ts"),O=M("./src/errors.ts"),I=M("./src/crypt/decrypter.ts"),j=M("./src/demux/aacdemuxer.ts"),N=M("./src/demux/mp4demuxer.ts"),P=M("./src/demux/tsdemuxer.ts"),R=M("./src/demux/mp3demuxer.ts"),c=M("./src/remux/mp4-remuxer.ts"),f=M("./src/remux/passthrough-remuxer.ts"),_=M("./src/demux/chunk-cache.ts"),p=M("./src/utils/mp4-tools.ts"),m=M("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(A){m.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var a=[{demux:P.default,remux:c.default},{demux:N.default,remux:f.default},{demux:j.default,remux:c.default},{demux:R.default,remux:c.default}],i=1024;a.forEach(function(A){var T=A.demux;i=Math.max(i,T.minProbeByteLength)});var o=function(){function A(x,h,u,D,S){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 _.default,this.observer=x,this.typeSupported=h,this.config=u,this.vendor=D,this.id=S}var T=A.prototype;return T.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},T.push=function(h,u,D,S){var w=this,b=D.transmuxing;b.executeStart=y();var K=new Uint8Array(h),X=this.cache,Q=this.config,V=this.currentTransmuxState,W=this.transmuxConfig;S&&(this.currentTransmuxState=S);var te=l(K,u);if(te&&te.method==="AES-128"){var ue=this.getDecrypter();if(Q.enableSoftwareAES){var ge=ue.softwareDecrypt(K,te.key.buffer,te.iv.buffer);if(!ge)return b.executeEnd=y(),C(D);K=new Uint8Array(ge)}else return this.decryptionPromise=ue.webCryptoDecrypt(K,te.key.buffer,te.iv.buffer).then(function(Le){var Ve=w.push(Le,null,D);return w.decryptionPromise=null,Ve}),this.decryptionPromise}var Oe=S||V,qe=Oe.contiguous,Ke=Oe.discontinuity,Be=Oe.trackSwitch,Xe=Oe.accurateTimeOffset,Fe=Oe.timeOffset,xe=W.audioCodec,oe=W.videoCodec,Re=W.defaultInitPts,dt=W.duration,at=W.initSegmentData;if((Ke||Be)&&this.resetInitSegment(at,xe,oe,dt),Ke&&this.resetInitialTimestamp(Re),qe||this.resetContiguity(),this.needsProbing(K,Ke,Be)){if(X.dataLength){var ut=X.flush();K=Object(p.appendUint8Array)(ut,K)}this.configureTransmuxer(K,W)}var ce=this.transmux(K,te,Fe,Xe,D),he=this.currentTransmuxState;return he.contiguous=!0,he.discontinuity=!1,he.trackSwitch=!1,b.executeEnd=y(),ce},T.flush=function(h){var u=this,D=h.transmuxing;D.executeStart=y();var S=this.decrypter,w=this.cache,b=this.currentTransmuxState,K=this.decryptionPromise;if(K)return K.then(function(){return u.flush(h)});var X=[],Q=b.timeOffset;if(S){var V=S.flush();V&&X.push(this.push(V,null,h))}var W=w.dataLength;w.reset();var te=this.demuxer,ue=this.remuxer;if(!te||!ue)return W>=i&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),D.executeEnd=y(),[C(h)];var ge=te.flush(Q);return g(ge)?ge.then(function(Oe){return u.flushRemux(X,Oe,h),X}):(this.flushRemux(X,ge,h),X)},T.flushRemux=function(h,u,D){var S=u.audioTrack,w=u.avcTrack,b=u.id3Track,K=u.textTrack,X=this.currentTransmuxState,Q=X.accurateTimeOffset,V=X.timeOffset;m.logger.log("[transmuxer.ts]: Flushed fragment "+D.sn+(D.part>-1?" p: "+D.part:"")+" of level "+D.level);var W=this.remuxer.remux(S,w,b,K,V,Q,!0,this.id);h.push({remuxResult:W,chunkMeta:D}),D.transmuxing.executeEnd=y()},T.resetInitialTimestamp=function(h){var u=this.demuxer,D=this.remuxer;if(!u||!D)return;u.resetTimeStamp(h),D.resetTimeStamp(h)},T.resetContiguity=function(){var h=this.demuxer,u=this.remuxer;if(!h||!u)return;h.resetContiguity(),u.resetNextTimestamp()},T.resetInitSegment=function(h,u,D,S){var w=this.demuxer,b=this.remuxer;if(!w||!b)return;w.resetInitSegment(u,D,S),b.resetInitSegment(h,u,D)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(h,u,D,S,w){var b;return u&&u.method==="SAMPLE-AES"?b=this.transmuxSampleAes(h,u,D,S,w):b=this.transmuxUnencrypted(h,D,S,w),b},T.transmuxUnencrypted=function(h,u,D,S){var w=this.demuxer.demux(h,u,!1,!this.config.progressive),b=w.audioTrack,K=w.avcTrack,X=w.id3Track,Q=w.textTrack,V=this.remuxer.remux(b,K,X,Q,u,D,!1,this.id);return{remuxResult:V,chunkMeta:S}},T.transmuxSampleAes=function(h,u,D,S,w){var b=this;return this.demuxer.demuxSampleAes(h,u,D).then(function(K){var X=b.remuxer.remux(K.audioTrack,K.avcTrack,K.id3Track,K.textTrack,D,S,!1,b.id);return{remuxResult:X,chunkMeta:w}})},T.configureTransmuxer=function(h,u){for(var D=this.config,S=this.observer,w=this.typeSupported,b=this.vendor,K=u.audioCodec,X=u.defaultInitPts,Q=u.duration,V=u.initSegmentData,W=u.videoCodec,te,ue=0,ge=a.length;ue<ge;ue++)if(a[ue].demux.probe(h)){te=a[ue];break}te||(m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:N.default,remux:f.default});var Oe=this.demuxer,qe=this.remuxer,Ke=te.remux,Be=te.demux;(!qe||!(qe instanceof Ke))&&(this.remuxer=new Ke(S,D,w,b)),(!Oe||!(Oe instanceof Be))&&(this.demuxer=new Be(S,D,w),this.probe=Be.probe),this.resetInitSegment(V,K,W,Q),this.resetInitialTimestamp(X)},T.needsProbing=function(h,u,D){return!this.demuxer||!this.remuxer||u||D},T.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new I.default(this.observer,this.config)),h},A}();function l(A,T){var x=null;return A.byteLength>0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(x=T),x}var C=function(T){return{remuxResult:{},chunkMeta:T}};function g(A){return"then"in A&&A.then instanceof Function}var v=function(T,x,h,u,D){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=x,this.initSegmentData=h,this.duration=u,this.defaultInitPts=D},L=function(T,x,h,u,D){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=x,this.accurateTimeOffset=h,this.trackSwitch=u,this.timeOffset=D}},"./src/demux/tsdemuxer.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"discardEPB",function(){return C});var H=M("./src/demux/adts.ts"),O=M("./src/demux/mpegaudio.ts"),I=M("./src/demux/exp-golomb.ts"),j=M("./src/demux/id3.ts"),N=M("./src/demux/sample-aes.ts"),P=M("./src/events.ts"),R=M("./src/utils/mp4-tools.ts"),c=M("./src/utils/logger.ts"),f=M("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},p=function(){function g(L,A,T){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=A,this.typeSupported=T}g.probe=function(A){var T=g.syncOffset(A);return T<0?!1:(T&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},g.syncOffset=function(A){for(var T=Math.min(1e3,A.length-3*188),x=0;x<T;){if(A[x]===71&&A[x+188]===71&&A[x+2*188]===71)return x;x++}return-1},g.createTrack=function(A,T){return{container:A==="video"||A==="audio"?"video/mp2t":void 0,type:A,id:_[A],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:A==="audio"?T:void 0}};var v=g.prototype;return v.resetInitSegment=function(A,T,x){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",x),this._audioTrack=g.createTrack("audio",x),this._id3Track=g.createTrack("id3",x),this._txtTrack=g.createTrack("text",x),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=A,this.videoCodec=T,this._duration=x},v.resetTimeStamp=function(){},v.resetContiguity=function(){var A=this._audioTrack,T=this._avcTrack,x=this._id3Track;A&&(A.pesData=null),T&&(T.pesData=null),x&&(x.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(A,T,x,h){x===void 0&&(x=!1),h===void 0&&(h=!1),x||(this.sampleAes=null);var u,D=this._avcTrack,S=this._audioTrack,w=this._id3Track,b=D.pid,K=D.pesData,X=S.pid,Q=w.pid,V=S.pesData,W=w.pesData,te=!1,ue=this.pmtParsed,ge=this._pmtId,Oe=A.length;if(this.remainderData&&(A=Object(R.appendUint8Array)(this.remainderData,A),Oe=A.length,this.remainderData=null),Oe<188&&!h)return this.remainderData=A,{audioTrack:S,avcTrack:D,id3Track:w,textTrack:this._txtTrack};var qe=Math.max(0,g.syncOffset(A));Oe-=(Oe+qe)%188,Oe<A.byteLength&&!h&&(this.remainderData=new Uint8Array(A.buffer,Oe,A.buffer.byteLength-Oe));for(var Ke=qe;Ke<Oe;Ke+=188)if(A[Ke]===71){var Be=!!(A[Ke+1]&64),Xe=((A[Ke+1]&31)<<8)+A[Ke+2],Fe=(A[Ke+3]&48)>>4,xe=void 0;if(Fe>1){if(xe=Ke+5+A[Ke+4],xe===Ke+188)continue}else xe=Ke+4;switch(Xe){case b:Be&&(K&&(u=i(K))&&this.parseAVCPES(u,!1),K={data:[],size:0}),K&&(K.data.push(A.subarray(xe,Ke+188)),K.size+=Ke+188-xe);break;case X:Be&&(V&&(u=i(V))&&(S.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),V={data:[],size:0}),V&&(V.data.push(A.subarray(xe,Ke+188)),V.size+=Ke+188-xe);break;case Q:Be&&(W&&(u=i(W))&&this.parseID3PES(u),W={data:[],size:0}),W&&(W.data.push(A.subarray(xe,Ke+188)),W.size+=Ke+188-xe);break;case 0:Be&&(xe+=A[xe]+1),ge=this._pmtId=y(A,xe);break;case ge:{Be&&(xe+=A[xe]+1);var oe=a(A,xe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,x);b=oe.avc,b>0&&(D.pid=b),X=oe.audio,X>0&&(S.pid=X,S.isAAC=oe.isAAC),Q=oe.id3,Q>0&&(w.pid=Q),te&&!ue&&(c.logger.log("reparse from beginning"),te=!1,Ke=qe-188),ue=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});D.pesData=K,S.pesData=V,w.pesData=W;var Re={audioTrack:S,avcTrack:D,id3Track:w,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(Re),Re},v.flush=function(){var A=this.remainderData;this.remainderData=null;var T;return A?T=this.demux(A,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},v.extractRemainingSamples=function(A){var T=A.audioTrack,x=A.avcTrack,h=A.id3Track,u=x.pesData,D=T.pesData,S=h.pesData,w;u&&(w=i(u))?(this.parseAVCPES(w,!0),x.pesData=null):x.pesData=u,D&&(w=i(D))?(T.isAAC?this.parseAACPES(w):this.parseMPEGPES(w),T.pesData=null):(D!=null&&D.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=D),S&&(w=i(S))?(this.parseID3PES(w),h.pesData=null):h.pesData=S},v.demuxSampleAes=function(A,T,x){var h=this.demux(A,x,!0,!this.config.progressive),u=this.sampleAes=new N.default(this.observer,this.config,T);return this.decrypt(h,u)},v.decrypt=function(A,T){return new Promise(function(x){var h=A.audioTrack,u=A.avcTrack;h.samples&&h.isAAC?T.decryptAacSamples(h.samples,0,function(){u.samples?T.decryptAvcSamples(u.samples,0,0,function(){x(A)}):x(A)}):u.samples&&T.decryptAvcSamples(u.samples,0,0,function(){x(A)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(A,T){var x=this,h=this._avcTrack,u=this.parseAVCNALu(A.data),D=!1,S=this.avcSample,w,b=!1;A.data=null,S&&u.length&&!h.audFound&&(o(S,h),S=this.avcSample=m(!1,A.pts,A.dts,"")),u.forEach(function(K){switch(K.type){case 1:{w=!0,S||(S=x.avcSample=m(!0,A.pts,A.dts,"")),D&&(S.debug+="NDR "),S.frame=!0;var X=K.data;if(b&&X.length>4){var Q=new I.default(X).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(S.key=!0)}break}case 5:w=!0,S||(S=x.avcSample=m(!0,A.pts,A.dts,"")),D&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{w=!0,D&&S&&(S.debug+="SEI ");var V=new I.default(C(K.data));V.readUByte();for(var W=0,te=0,ue=!1,ge=0;!ue&&V.bytesAvailable>1;){W=0;do ge=V.readUByte(),W+=ge;while(ge===255);te=0;do ge=V.readUByte(),te+=ge;while(ge===255);if(W===4&&V.bytesAvailable!==0){ue=!0;var Oe=V.readUByte();if(Oe===181){var qe=V.readUShort();if(qe===49){var Ke=V.readUInt();if(Ke===1195456820){var Be=V.readUByte();if(Be===3){for(var Xe=V.readUByte(),Fe=V.readUByte(),xe=31&Xe,oe=[Xe,Fe],Re=0;Re<xe;Re++)oe.push(V.readUByte()),oe.push(V.readUByte()),oe.push(V.readUByte());l(x._txtTrack.samples,{type:3,pts:A.pts,bytes:oe})}}}}}else if(W===5&&V.bytesAvailable!==0){if(ue=!0,te>16){for(var dt=[],at=0;at<16;at++)dt.push(V.readUByte().toString(16)),(at===3||at===5||at===7||at===9)&&dt.push("-");for(var ut=te-16,ce=new Uint8Array(ut),he=0;he<ut;he++)ce[he]=V.readUByte();l(x._txtTrack.samples,{pts:A.pts,payloadType:W,uuid:dt.join(""),userData:Object(j.utf8ArrayToStr)(ce),userDataBytes:ce})}}else if(te<V.bytesAvailable)for(var Le=0;Le<te;Le++)V.readUByte()}break}case 7:if(w=!0,b=!0,D&&S&&(S.debug+="SPS "),!h.sps){var Ve=new I.default(K.data),et=Ve.readSPS();h.width=et.width,h.height=et.height,h.pixelRatio=et.pixelRatio,h.sps=[K.data],h.duration=x._duration;for(var tt=K.data.subarray(1,4),rt="avc1.",it=0;it<3;it++){var Dt=tt[it].toString(16);Dt.length<2&&(Dt="0"+Dt),rt+=Dt}h.codec=rt}break;case 8:w=!0,D&&S&&(S.debug+="PPS "),h.pps||(h.pps=[K.data]);break;case 9:w=!1,h.audFound=!0,S&&o(S,h),S=x.avcSample=m(!1,A.pts,A.dts,D?"AUD ":"");break;case 12:w=!1;break;default:w=!1,S&&(S.debug+="unknown NAL "+K.type+" ");break}if(S&&w){var Et=S.units;Et.push(K)}}),T&&S&&(o(S,h),this.avcSample=null)},v.getLastNalUnit=function(){var A,T=this.avcSample,x;if(!T||T.units.length===0){var h=this._avcTrack.samples;T=h[h.length-1]}if((A=T)!==null&&A!==void 0&&A.units){var u=T.units;x=u[u.length-1]}return x},v.parseAVCNALu=function(A){var T=A.byteLength,x=this._avcTrack,h=x.naluState||0,u=h,D=[],S=0,w,b,K,X=-1,Q=0;for(h===-1&&(X=0,Q=A[0]&31,h=0,S=1);S<T;){if(w=A[S++],!h){h=w?0:1;continue}if(h===1){h=w?0:2;continue}if(!w)h=3;else if(w===1){if(X>=0){var V={data:A.subarray(X,S-h-1),type:Q};D.push(V)}else{var W=this.getLastNalUnit();if(W&&(u&&S<=4-u&&(W.state&&(W.data=W.data.subarray(0,W.data.byteLength-u))),b=S-h-1,b>0)){var te=new Uint8Array(W.data.byteLength+b);te.set(W.data,0),te.set(A.subarray(0,b),W.data.byteLength),W.data=te,W.state=0}}S<T?(K=A[S]&31,X=S,Q=K,h=0):h=-1}else h=0}if(X>=0&&h>=0){var ue={data:A.subarray(X,T),type:Q,state:h};D.push(ue)}if(D.length===0){var ge=this.getLastNalUnit();if(ge){var Oe=new Uint8Array(ge.data.byteLength+A.byteLength);Oe.set(ge.data,0),Oe.set(A,ge.data.byteLength),ge.data=Oe}}return x.naluState=h,D},v.parseAACPES=function(A){var T=0,x=this._audioTrack,h=this.aacOverFlow,u=A.data;if(h){this.aacOverFlow=null;var D=h.sample.unit.byteLength,S=Math.min(h.missing,D),w=D-S;h.sample.unit.set(u.subarray(0,S),w),x.samples.push(h.sample),T=h.missing}var b,K;for(b=T,K=u.length;b<K-1&&!H.isHeader(u,b);b++);if(b!==T){var X,Q;if(b<K-1?(X="AAC PES did not start with ADTS header,offset:"+b,Q=!1):(X="no ADTS header found in AAC PES",Q=!0),c.logger.warn("parsing error:"+X),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:Q,reason:X}),Q)return}H.initTrackConfig(x,this.observer,u,b,this.audioCodec);var V;if(A.pts!==void 0)V=A.pts;else if(h){var W=H.getFrameDuration(x.samplerate);V=h.sample.pts+W}else{c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;b<K;)if(H.isHeader(u,b)){if(b+5<K){var ue=H.appendFrame(x,u,b,V,te);if(ue)if(ue.missing)this.aacOverFlow=ue;else{b+=ue.length,te++;continue}}break}else b++},v.parseMPEGPES=function(A){var T=A.data,x=T.length,h=0,u=0,D=A.pts;if(D===void 0){c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<x;)if(O.isHeader(T,u)){var S=O.appendFrame(this._audioTrack,T,u,D,h);if(S)u+=S.length,h++;else break}else u++},v.parseID3PES=function(A){if(A.pts===void 0){c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(A)},g}();p.minProbeByteLength=188;function m(g,v,L,A){return{key:g,frame:!1,pts:v,dts:L,units:[],debug:A,length:0}}function y(g,v){return(g[v+10]&31)<<8|g[v+11]}function a(g,v,L,A){var T={audio:-1,avc:-1,id3:-1,isAAC:!0},x=(g[v+1]&15)<<8|g[v+2],h=v+3+x-4,u=(g[v+10]&15)<<8|g[v+11];for(v+=12+u;v<h;){var D=(g[v+1]&31)<<8|g[v+2];switch(g[v]){case 207:if(!A){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:T.audio===-1&&(T.audio=D);break;case 21:T.id3===-1&&(T.id3=D);break;case 219:if(!A){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:T.avc===-1&&(T.avc=D);break;case 3:case 4:L?T.audio===-1&&(T.audio=D,T.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((g[v+3]&15)<<8|g[v+4])+5}return T}function i(g){var v=0,L,A,T,x,h,u=g.data;if(!g||g.size===0)return null;for(;u[0].length<19&&u.length>1;){var D=new Uint8Array(u[0].length+u[1].length);D.set(u[0]),D.set(u[1],u[0].length),u[0]=D,u.splice(1,1)}L=u[0];var S=(L[0]<<16)+(L[1]<<8)+L[2];if(S===1){if(A=(L[4]<<8)+L[5],A&&A>g.size-6)return null;var w=L[7];w&192&&(x=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,w&64?(h=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,x-h>60*9e4&&(c.logger.warn(Math.round((x-h)/9e4)+"s delta between PTS and DTS, align them"),x=h)):h=x),T=L[8];var b=T+9;if(g.size<=b)return null;g.size-=b;for(var K=new Uint8Array(g.size),X=0,Q=u.length;X<Q;X++){L=u[X];var V=L.byteLength;if(b)if(b>V){b-=V;continue}else L=L.subarray(b),V-=b,b=0;K.set(L,v),v+=V}return A&&(A-=T+3),{data:K,pts:x,dts:h,len:A}}return null}function o(g,v){if(g.units.length&&g.frame){if(g.pts===void 0){var L=v.samples,A=L.length;if(A){var T=L[A-1];g.pts=T.pts,g.dts=T.dts}else{v.dropped++;return}}v.samples.push(g)}g.debug.length&&c.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function l(g,v){var L=g.length;if(L>0){if(v.pts>=g[L-1].pts)g.push(v);else for(var A=L-1;A>=0;A--)if(v.pts<g[A].pts){g.splice(A,0,v);break}}else g.push(v)}function C(g){for(var v=g.byteLength,L=[],A=1;A<v-2;)g[A]===0&&g[A+1]===0&&g[A+2]===3?(L.push(A+2),A+=2):A++;if(L.length===0)return g;var T=v-L.length,x=new Uint8Array(T),h=0;for(A=0;A<T;h++,A++)h===L[0]&&(h++,L.shift()),x[A]=g[h];return x}Y.default=p},"./src/errors.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"ErrorTypes",function(){return H}),M.d(Y,"ErrorDetails",function(){return O});var H;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(H||(H={}));var O;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(O||(O={}))},"./src/events.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"Events",function(){return H});var H;(function(O){O.MEDIA_ATTACHING="hlsMediaAttaching",O.MEDIA_ATTACHED="hlsMediaAttached",O.MEDIA_DETACHING="hlsMediaDetaching",O.MEDIA_DETACHED="hlsMediaDetached",O.BUFFER_RESET="hlsBufferReset",O.BUFFER_CODECS="hlsBufferCodecs",O.BUFFER_CREATED="hlsBufferCreated",O.BUFFER_APPENDING="hlsBufferAppending",O.BUFFER_APPENDED="hlsBufferAppended",O.BUFFER_EOS="hlsBufferEos",O.BUFFER_FLUSHING="hlsBufferFlushing",O.BUFFER_FLUSHED="hlsBufferFlushed",O.MANIFEST_LOADING="hlsManifestLoading",O.MANIFEST_LOADED="hlsManifestLoaded",O.MANIFEST_PARSED="hlsManifestParsed",O.LEVEL_SWITCHING="hlsLevelSwitching",O.LEVEL_SWITCHED="hlsLevelSwitched",O.LEVEL_LOADING="hlsLevelLoading",O.LEVEL_LOADED="hlsLevelLoaded",O.LEVEL_UPDATED="hlsLevelUpdated",O.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",O.LEVELS_UPDATED="hlsLevelsUpdated",O.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",O.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",O.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",O.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",O.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",O.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",O.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",O.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",O.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",O.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",O.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",O.CUES_PARSED="hlsCuesParsed",O.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",O.INIT_PTS_FOUND="hlsInitPtsFound",O.FRAG_LOADING="hlsFragLoading",O.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",O.FRAG_LOADED="hlsFragLoaded",O.FRAG_DECRYPTED="hlsFragDecrypted",O.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",O.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",O.FRAG_PARSING_METADATA="hlsFragParsingMetadata",O.FRAG_PARSED="hlsFragParsed",O.FRAG_BUFFERED="hlsFragBuffered",O.FRAG_CHANGED="hlsFragChanged",O.FPS_DROP="hlsFpsDrop",O.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",O.ERROR="hlsError",O.DESTROYING="hlsDestroying",O.KEY_LOADING="hlsKeyLoading",O.KEY_LOADED="hlsKeyLoaded",O.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",O.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return g});var H=M("./node_modules/url-toolkit/src/url-toolkit.js"),O=M.n(H),I=M("./src/loader/playlist-loader.ts"),j=M("./src/loader/key-loader.ts"),N=M("./src/controller/id3-track-controller.ts"),P=M("./src/controller/latency-controller.ts"),R=M("./src/controller/level-controller.ts"),c=M("./src/controller/fragment-tracker.ts"),f=M("./src/controller/stream-controller.ts"),_=M("./src/is-supported.ts"),p=M("./src/utils/logger.ts"),m=M("./src/config.ts"),y=M("./node_modules/eventemitter3/index.js"),a=M.n(y),i=M("./src/events.ts"),o=M("./src/errors.ts");function l(v,L){for(var A=0;A<L.length;A++){var T=L[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,T.key,T)}}function C(v,L,A){return L&&l(v.prototype,L),A&&l(v,A),v}var g=function(){v.isSupported=function(){return Object(_.isSupported)()};function v(A){A===void 0&&(A={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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 T=this.config=Object(m.mergeConfig)(v.DefaultConfig,A);this.userConfig=A,Object(p.enableLogs)(T.debug),this._autoLevelCapping=-1,T.progressive&&Object(m.enableStreamingMode)(T);var x=T.abrController,h=T.bufferController,u=T.capLevelController,D=T.fpsController,S=this.abrController=new x(this),w=this.bufferController=new h(this),b=this.capLevelController=new u(this),K=new D(this),X=new I.default(this),Q=new j.default(this),V=new N.default(this),W=this.levelController=new R.default(this),te=new c.FragmentTracker(this),ue=this.streamController=new f.default(this,te);b.setStreamController(ue),K.setStreamController(ue);var ge=[W,ue];this.networkControllers=ge;var Oe=[X,Q,S,w,b,K,V,te];this.audioTrackController=this.createController(T.audioTrackController,null,ge),this.createController(T.audioStreamController,te,ge),this.subtitleTrackController=this.createController(T.subtitleTrackController,null,ge),this.createController(T.subtitleStreamController,te,ge),this.createController(T.timelineController,null,Oe),this.emeController=this.createController(T.emeController,null,Oe),this.cmcdController=this.createController(T.cmcdController,null,Oe),this.latencyController=this.createController(P.default,null,Oe),this.coreComponents=Oe}var L=v.prototype;return L.createController=function(T,x,h){if(T){var u=x?new T(this,x):new T(this);return h&&h.push(u),u}return null},L.on=function(T,x,h){h===void 0&&(h=this),this._emitter.on(T,x,h)},L.once=function(T,x,h){h===void 0&&(h=this),this._emitter.once(T,x,h)},L.removeAllListeners=function(T){this._emitter.removeAllListeners(T)},L.off=function(T,x,h,u){h===void 0&&(h=this),this._emitter.off(T,x,h,u)},L.listeners=function(T){return this._emitter.listeners(T)},L.emit=function(T,x,h){return this._emitter.emit(T,x,h)},L.trigger=function(T,x){if(this.config.debug)return this.emit(T,T,x);try{return this.emit(T,T,x)}catch(h){p.logger.error("An internal error happened while handling event "+T+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:T,error:h})}return!1},L.listenerCount=function(T){return this._emitter.listenerCount(T)},L.destroy=function(){p.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(T){return T.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(T){return T.destroy()}),this.coreComponents.length=0},L.attachMedia=function(T){p.logger.log("attachMedia"),this._media=T,this.trigger(i.Events.MEDIA_ATTACHING,{media:T})},L.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(T){this.stopLoad();var x=this.media,h=this.url,u=this.url=H.buildAbsoluteURL(self.location.href,T,{alwaysNormalize:!0});p.logger.log("loadSource:"+u),x&&h&&h!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(x)),this.trigger(i.Events.MANIFEST_LOADING,{url:T})},L.startLoad=function(T){T===void 0&&(T=-1),p.logger.log("startLoad("+T+")"),this.networkControllers.forEach(function(x){x.startLoad(T)})},L.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(T){T.stopLoad()})},L.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){p.logger.log("recoverMediaError");var T=this._media;this.detachMedia(),T&&this.attachMedia(T)},L.removeLevel=function(T,x){x===void 0&&(x=0),this.levelController.removeLevel(T,x)},C(v,[{key:"levels",get:function(){var T=this.levelController.levels;return T||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(T){p.logger.log("set currentLevel:"+T),this.loadLevel=T,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(T){p.logger.log("set nextLevel:"+T),this.levelController.manualLevel=T,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(T){p.logger.log("set loadLevel:"+T),this.levelController.manualLevel=T}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(T){this.levelController.nextLoadLevel=T}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(T){p.logger.log("set firstLevel:"+T),this.levelController.firstLevel=T}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(T){p.logger.log("set startLevel:"+T),T!==-1&&(T=Math.max(T,this.minAutoLevel)),this.levelController.startLevel=T}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(T){var x=!!T;x!==this.config.capLevelToPlayerSize&&(x?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=x)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(T){this._autoLevelCapping!==T&&(p.logger.log("set autoLevelCapping:"+T),this._autoLevelCapping=T)}},{key:"bandwidthEstimate",get:function(){var T=this.abrController.bwEstimator;return T?T.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var T=this.levels,x=this.config.minAutoBitrate;if(!T)return 0;for(var h=T.length,u=0;u<h;u++)if(T[u].maxBitrate>x)return u;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,x=this.autoLevelCapping,h;return x===-1&&T&&T.length?h=T.length-1:h=x,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var x=this.audioTrackController;x&&(x.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var x=this.subtitleTrackController;x&&(x.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var x=this.subtitleTrackController;x&&(x.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 i.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:m.hlsDefaultConfig},set:function(T){v.defaultConfig=T}}]),v}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"isSupported",function(){return I}),M.d(Y,"changeTypeSupported",function(){return j});var H=M("./src/utils/mediasource-helper.ts");function O(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var N=Object(H.getMediaSource)();if(!N)return!1;var P=O(),R=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!R&&!!c}function j(){var N,P=O();return typeof(P==null||((N=P.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return p}),M.d(Y,"LoadError",function(){return y});var H=M("./src/polyfills/number.ts"),O=M("./src/errors.ts");function I(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,c(a,i)}function j(a){var i=typeof Map=="function"?new Map:void 0;return j=function(l){if(l===null||!R(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,C)}function C(){return N(l,arguments,f(this).constructor)}return C.prototype=Object.create(l.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),c(C,l)},j(a)}function N(a,i,o){return P()?N=Reflect.construct:N=function(C,g,v){var L=[null];L.push.apply(L,g);var A=Function.bind.apply(C,L),T=new A;return v&&c(T,v.prototype),T},N.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function R(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function c(a,i){return c=Object.setPrototypeOf||function(l,C){return l.__proto__=C,l},c(a,i)}function f(a){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},f(a)}var _=Math.pow(2,17),p=function(){function a(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,C){var g=this,v=l.url;if(!v)return Promise.reject(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var L=this.config,A=L.fLoader,T=L.loader;return new Promise(function(x,h){g.loader&&g.loader.destroy();var u=g.loader=l.loader=A?new A(L):new T(L),D=m(l),S={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};l.stats=u.stats,u.load(D,S,{onSuccess:function(b,K,X,Q){g.resetLoader(l,u),x({frag:l,part:null,payload:b.data,networkDetails:Q})},onError:function(b,K,X){g.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:b,networkDetails:X}))},onAbort:function(b,K,X){g.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:X}))},onTimeout:function(b,K,X){g.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:X}))},onProgress:function(b,K,X,Q){C&&C({frag:l,part:null,payload:X,networkDetails:Q})}})})},i.loadPart=function(l,C,g){var v=this;this.abort();var L=this.config,A=L.fLoader,T=L.loader;return new Promise(function(x,h){v.loader&&v.loader.destroy();var u=v.loader=l.loader=A?new A(L):new T(L),D=m(l,C),S={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};C.stats=u.stats,u.load(D,S,{onSuccess:function(b,K,X,Q){v.resetLoader(l,u),v.updateStatsFromPart(l,C);var V={frag:l,part:C,payload:b.data,networkDetails:Q};g(V),x(V)},onError:function(b,K,X){v.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:C,response:b,networkDetails:X}))},onAbort:function(b,K,X){l.stats.aborted=C.stats.aborted,v.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:C,networkDetails:X}))},onTimeout:function(b,K,X){v.resetLoader(l,u),h(new y({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:C,networkDetails:X}))}})})},i.updateStatsFromPart=function(l,C){var g=l.stats,v=C.stats,L=v.total;if(g.loaded+=v.loaded,L){var A=Math.round(l.duration/C.duration),T=Math.min(Math.round(g.loaded/L),A),x=A-T,h=x*Math.round(g.loaded/T);g.total=g.loaded+h}else g.total=Math.max(g.loaded,g.total);var u=g.loading,D=v.loading;u.start?u.first+=D.first-D.start:(u.start=D.start,u.first=D.first),u.end=D.end},i.resetLoader=function(l,C){l.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},a}();function m(a,i){i===void 0&&(i=null);var o=i||a,l={frag:a,part:i,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},C=o.byteRangeStartOffset,g=o.byteRangeEndOffset;return Object(H.isFiniteNumber)(C)&&Object(H.isFiniteNumber)(g)&&(l.rangeStart=C,l.rangeEnd=g),l}var y=function(a){I(i,a);function i(o){for(var l,C=arguments.length,g=new Array(C>1?C-1:0),v=1;v<C;v++)g[v-1]=arguments[v];return l=a.call.apply(a,[this].concat(g))||this,l.data=void 0,l.data=o,l}return i}(j(Error))},"./src/loader/fragment.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"ElementaryStreamTypes",function(){return p}),M.d(Y,"BaseSegment",function(){return m}),M.d(Y,"Fragment",function(){return y}),M.d(Y,"Part",function(){return a});var H=M("./src/polyfills/number.ts"),O=M("./node_modules/url-toolkit/src/url-toolkit.js"),I=M.n(O),j=M("./src/utils/logger.ts"),N=M("./src/loader/level-key.ts"),P=M("./src/loader/load-stats.ts");function R(i,o){i.prototype=Object.create(o.prototype),i.prototype.constructor=i,c(i,o)}function c(i,o){return c=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},c(i,o)}function f(i,o){for(var l=0;l<o.length;l++){var C=o[l];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(i,C.key,C)}}function _(i,o,l){return o&&f(i.prototype,o),l&&f(i,l),i}var p;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(p||(p={}));var m=function(){function i(l){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[p.AUDIO]=null,C[p.VIDEO]=null,C[p.AUDIOVIDEO]=null,C),this.baseurl=l}var o=i.prototype;return o.setByteRange=function(C,g){var v=C.split("@",2),L=[];v.length===1?L[0]=g?g.byteRangeEndOffset:0:L[0]=parseInt(v[1]),L[1]=parseInt(v[0])+L[0],this._byteRange=L},_(i,[{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(O.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),i}(),y=function(i){R(o,i);function o(C,g){var v;return v=i.call(this,g)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new P.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=C,v}var l=o.prototype;return l.createInitializationVector=function(g){for(var v=new Uint8Array(16),L=12;L<16;L++)v[L]=g>>8*(15-L)&255;return v},l.setDecryptDataFromLevelKey=function(g,v){var L=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(L=N.LevelKey.fromURI(g.uri),L.method=g.method,L.iv=this.createInitializationVector(v),L.keyFormat="identity"),L},l.setElementaryStreamInfo=function(g,v,L,A,T,x){x===void 0&&(x=!1);var h=this.elementaryStreams,u=h[g];if(!u){h[g]={startPTS:v,endPTS:L,startDTS:A,endDTS:T,partial:x};return}u.startPTS=Math.min(u.startPTS,v),u.endPTS=Math.max(u.endPTS,L),u.startDTS=Math.min(u.startDTS,A),u.endDTS=Math.max(u.endDTS,T)},l.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[p.AUDIO]=null,g[p.VIDEO]=null,g[p.AUDIOVIDEO]=null},_(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var g=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),o}(m),a=function(i){R(o,i);function o(l,C,g,v,L){var A;A=i.call(this,g)||this,A.fragOffset=0,A.duration=0,A.gap=!1,A.independent=!1,A.relurl=void 0,A.fragment=void 0,A.index=void 0,A.stats=new P.LoadStats,A.duration=l.decimalFloatingPoint("DURATION"),A.gap=l.bool("GAP"),A.independent=l.bool("INDEPENDENT"),A.relurl=l.enumeratedString("URI"),A.fragment=C,A.index=v;var T=l.enumeratedString("BYTERANGE");return T&&A.setByteRange(T,L),L&&(A.fragOffset=L.fragOffset+L.duration),A}return _(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),o}(m)},"./src/loader/key-loader.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return j});var H=M("./src/events.ts"),O=M("./src/errors.ts"),I=M("./src/utils/logger.ts"),j=function(){function N(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var P=N.prototype;return P._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var c in this.loaders){var f=this.loaders[c];f&&f.destroy()}this.loaders={}},P.onKeyLoading=function(c,f){var _=f.frag,p=_.type,m=this.loaders[p];if(!_.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=_.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(m&&(I.logger.warn("abort previous key loader for type:"+p),m.abort()),!y){I.logger.warn("key uri is falsy");return}var i=a.loader,o=_.loader=this.loaders[p]=new i(a);this.decrypturl=y,this.decryptkey=null;var l={url:y,frag:_,responseType:"arraybuffer"},C={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(l,C,g)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:_}))},P.loadsuccess=function(c,f,_){var p=_.frag;if(!p.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=p.decryptdata.key=new Uint8Array(c.data),p.loader=null,delete this.loaders[p.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:p})},P.loaderror=function(c,f){var _=f.frag,p=_.loader;p&&p.abort(),delete this.loaders[_.type],this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:c})},P.loadtimeout=function(c,f){var _=f.frag,p=_.loader;p&&p.abort(),delete this.loaders[_.type],this.hls.trigger(H.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},N}()},"./src/loader/level-details.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"LevelDetails",function(){return N});var H=M("./src/polyfills/number.ts");function O(P,R){for(var c=0;c<R.length;c++){var f=R[c];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function I(P,R,c){return R&&O(P.prototype,R),c&&O(P,c),P}var j=10,N=function(){function P(c){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=c}var R=P.prototype;return R.reloaded=function(f){if(!f){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-f.lastPartSn,p=this.lastPartIndex-f.lastPartIndex;this.updated=this.endSN!==f.endSN||!!p||!!_,this.advanced=this.endSN>f.endSN||_>0||_===0&&p>0,this.updated||this.advanced?this.misses=Math.floor(f.misses*.6):this.misses=f.misses+1,this.availabilityDelay=f.availabilityDelay},I(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var f=this.driftEndTime-this.driftStartTime;if(f>0){var _=this.driftEnd-this.driftStart;return _*1e3/f}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var f;return(f=this.fragments)!==null&&f!==void 0&&f.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 f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"LevelKey",function(){return N});var H=M("./node_modules/url-toolkit/src/url-toolkit.js"),O=M.n(H);function I(P,R){for(var c=0;c<R.length;c++){var f=R[c];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(P,f.key,f)}}function j(P,R,c){return R&&I(P.prototype,R),c&&I(P,c),P}var N=function(){P.fromURL=function(c,f){return new P(c,f)},P.fromURI=function(c){return new P(c)};function P(R,c){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,c?this._uri=Object(H.buildAbsoluteURL)(R,c,{alwaysNormalize:!0}):this._uri=R}return j(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"LoadStats",function(){return H});var H=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(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return o});var H=M("./src/polyfills/number.ts"),O=M("./node_modules/url-toolkit/src/url-toolkit.js"),I=M.n(O),j=M("./src/loader/fragment.ts"),N=M("./src/loader/level-details.ts"),P=M("./src/loader/level-key.ts"),R=M("./src/utils/attr-list.ts"),c=M("./src/utils/logger.ts"),f=M("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,p=/#EXT-X-MEDIA:(.*)/g,m=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=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("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(L){var A,T;return a.test((A=(T=O.parseURL(L))===null||T===void 0?void 0:T.path)!=null?A:"")}var o=function(){function L(){}return L.findGroup=function(T,x){for(var h=0;h<T.length;h++){var u=T[h];if(u.id===x)return u}},L.convertAVC1ToAVCOTI=function(T){var x=T.split(".");if(x.length>2){var h=x.shift()+".";return h+=parseInt(x.shift()).toString(16),h+=("000"+parseInt(x.shift()).toString(16)).substr(-4),h}return T},L.resolve=function(T,x){return O.buildAbsoluteURL(x,T,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(T,x){var h=[],u={},D=!1;_.lastIndex=0;for(var S;(S=_.exec(T))!=null;)if(S[1]){var w=new R.AttrList(S[1]),b={attrs:w,bitrate:w.decimalInteger("AVERAGE-BANDWIDTH")||w.decimalInteger("BANDWIDTH"),name:w.NAME,url:L.resolve(S[2],x)},K=w.decimalResolution("RESOLUTION");K&&(b.width=K.width,b.height=K.height),l((w.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),b),b.videoCodec&&b.videoCodec.indexOf("avc1")!==-1&&(b.videoCodec=L.convertAVC1ToAVCOTI(b.videoCodec)),h.push(b)}else if(S[3]){var X=new R.AttrList(S[3]);X["DATA-ID"]&&(D=!0,u[X["DATA-ID"]]=X)}return{levels:h,sessionData:D?u:null}},L.parseMasterPlaylistMedia=function(T,x,h,u){u===void 0&&(u=[]);var D,S=[],w=0;for(p.lastIndex=0;(D=p.exec(T))!==null;){var b=new R.AttrList(D[1]);if(b.TYPE===h){var K={attrs:b,bitrate:0,id:w++,groupId:b["GROUP-ID"],instreamId:b["INSTREAM-ID"],name:b.NAME||b.LANGUAGE||"",type:h,default:b.bool("DEFAULT"),autoselect:b.bool("AUTOSELECT"),forced:b.bool("FORCED"),lang:b.LANGUAGE,url:b.URI?L.resolve(b.URI,x):""};if(u.length){var X=L.findGroup(u,K.groupId)||u[0];C(K,X,"audioCodec"),C(K,X,"textCodec")}S.push(K)}}return S},L.parseLevelPlaylist=function(T,x,h,u,D){var S=new N.LevelDetails(x),w=S.fragments,b=null,K=0,X=0,Q=0,V=0,W=null,te=new j.Fragment(u,x),ue,ge,Oe,qe=-1,Ke=!1;for(m.lastIndex=0,S.m3u8=T;(ue=m.exec(T))!==null;){Ke&&(Ke=!1,te=new j.Fragment(u,x),te.start=Q,te.sn=K,te.cc=V,te.level=h,b&&(te.initSegment=b,te.rawProgramDateTime=b.rawProgramDateTime));var Be=ue[1];if(Be){te.duration=parseFloat(Be);var Xe=(" "+ue[2]).slice(1);te.title=Xe||null,te.tagList.push(Xe?["INF",Be,Xe]:["INF",Be])}else if(ue[3])Object(H.isFiniteNumber)(te.duration)&&(te.start=Q,Oe&&(te.levelkey=Oe),te.sn=K,te.level=h,te.cc=V,te.urlId=D,w.push(te),te.relurl=(" "+ue[3]).slice(1),v(te,W),W=te,Q+=te.duration,K++,X=0,Ke=!0);else if(ue[4]){var Fe=(" "+ue[4]).slice(1);W?te.setByteRange(Fe,W):te.setByteRange(Fe)}else if(ue[5])te.rawProgramDateTime=(" "+ue[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),qe===-1&&(qe=w.length);else{if(ue=ue[0].match(y),!ue){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(ge=1;ge<ue.length&&!(typeof ue[ge]!="undefined");ge++);var xe=(" "+ue[ge]).slice(1),oe=(" "+ue[ge+1]).slice(1),Re=ue[ge+2]?(" "+ue[ge+2]).slice(1):"";switch(xe){case"PLAYLIST-TYPE":S.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":K=S.startSN=parseInt(oe);break;case"SKIP":{var dt=new R.AttrList(oe),at=dt.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(at)){S.skippedSegments=at;for(var ut=at;ut--;)w.unshift(null);K+=at}var ce=dt.enumeratedString("RECENTLY-REMOVED-DATERANGES");ce&&(S.recentlyRemovedDateranges=ce.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(oe);break;case"VERSION":S.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(oe||Re)&&te.tagList.push(Re?[oe,Re]:[oe]);break;case"DIS":V++;case"GAP":te.tagList.push([xe]);break;case"BITRATE":te.tagList.push([xe,oe]);break;case"DISCONTINUITY-SEQ":V=parseInt(oe);break;case"KEY":{var he,Le=new R.AttrList(oe),Ve=Le.enumeratedString("METHOD"),et=Le.URI,tt=Le.hexadecimalInteger("IV"),rt=Le.enumeratedString("KEYFORMATVERSIONS"),it=Le.enumeratedString("KEYID"),Dt=(he=Le.enumeratedString("KEYFORMAT"))!=null?he:"identity",Et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Et.indexOf(Dt)>-1){c.logger.warn("Keyformat "+Dt+" is not supported from the manifest");continue}else if(Dt!=="identity")continue;Ve&&(Oe=P.LevelKey.fromURL(x,et),et&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ve)>=0&&(Oe.method=Ve,Oe.keyFormat=Dt,it&&(Oe.keyID=it),rt&&(Oe.keyFormatVersions=rt),Oe.iv=tt));break}case"START":{var xt=new R.AttrList(oe),ct=xt.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(ct)&&(S.startTimeOffset=ct);break}case"MAP":{var Ft=new R.AttrList(oe);te.relurl=Ft.URI,Ft.BYTERANGE&&te.setByteRange(Ft.BYTERANGE),te.level=h,te.sn="initSegment",Oe&&(te.levelkey=Oe),te.initSegment=null,b=te,Ke=!0;break}case"SERVER-CONTROL":{var wt=new R.AttrList(oe);S.canBlockReload=wt.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=wt.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&wt.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=wt.optionalFloat("PART-HOLD-BACK",0),S.holdBack=wt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Pt=new R.AttrList(oe);S.partTarget=Pt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var We=S.partList;We||(We=S.partList=[]);var gt=X>0?We[We.length-1]:void 0,Ut=X++,Qe=new j.Part(new R.AttrList(oe),te,x,Ut,gt);We.push(Qe),te.duration+=Qe.duration;break}case"PRELOAD-HINT":{var ot=new R.AttrList(oe);S.preloadHint=ot;break}case"RENDITION-REPORT":{var Ae=new R.AttrList(oe);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Ae);break}default:c.logger.warn("line parsed but not handled: "+ue);break}}}W&&!W.relurl?(w.pop(),Q-=W.duration,S.partList&&(S.fragmentHint=W)):S.partList&&(v(te,W),te.cc=V,S.fragmentHint=te);var be=w.length,Se=w[0],re=w[be-1];if(Q+=S.skippedSegments*S.targetduration,Q>0&&be&&re){S.averagetargetduration=Q/be;var ae=re.sn;S.endSN=ae!=="initSegment"?ae:0,Se&&(S.startCC=Se.cc,Se.initSegment||S.fragments.every(function(fe){return fe.relurl&&i(fe.relurl)})&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new j.Fragment(u,x),te.relurl=re.relurl,te.level=h,te.sn="initSegment",Se.initSegment=te,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(Q+=S.fragmentHint.duration),S.totalduration=Q,S.endCC=V,qe>0&&g(w,qe),S},L}();function l(L,A){["video","audio","text"].forEach(function(T){var x=L.filter(function(u){return Object(f.isCodecType)(u,T)});if(x.length){var h=x.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});A[T+"Codec"]=h.length>0?h[0]:x[0],L=L.filter(function(u){return x.indexOf(u)===-1})}}),A.unknownCodecs=L}function C(L,A,T){var x=A[T];x&&(L[T]=x)}function g(L,A){for(var T=L[A],x=A;x--;){var h=L[x];if(!h)return;h.programDateTime=T.programDateTime-h.duration*1e3,T=h}}function v(L,A){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):A!=null&&A.programDateTime&&(L.programDateTime=A.endProgramDateTime),Object(H.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/polyfills/number.ts"),O=M("./src/events.ts"),I=M("./src/errors.ts"),j=M("./src/utils/logger.ts"),N=M("./src/utils/mp4-tools.ts"),P=M("./src/loader/m3u8-parser.ts"),R=M("./src/types/loader.ts"),c=M("./src/utils/attr-list.ts");function f(m){var y=m.type;switch(y){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function _(m,y){var a=m.url;return(a===void 0||a.indexOf("data:")===0)&&(a=y.url),a}var p=function(){function m(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var y=m.prototype;return y.registerListeners=function(){var i=this.hls;i.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var i=this.hls;i.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(i){var o=this.hls.config,l=o.pLoader,C=o.loader,g=l||C,v=new g(o);return i.loader=v,this.loaders[i.type]=v,v},y.getInternalLoader=function(i){return this.loaders[i.type]},y.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},y.destroyInternalLoaders=function(){for(var i in this.loaders){var o=this.loaders[i];o&&o.destroy(),this.resetInternalLoader(i)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(i,o){var l=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},y.onLevelLoading=function(i,o){var l=o.id,C=o.level,g=o.url,v=o.deliveryDirectives;this.load({id:l,groupId:null,level:C,responseType:"text",type:R.PlaylistContextType.LEVEL,url:g,deliveryDirectives:v})},y.onAudioTrackLoading=function(i,o){var l=o.id,C=o.groupId,g=o.url,v=o.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:v})},y.onSubtitleTrackLoading=function(i,o){var l=o.id,C=o.groupId,g=o.url,v=o.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:v})},y.load=function(i){var o,l=this.hls.config,C=this.getInternalLoader(i);if(C){var g=C.context;if(g&&g.url===i.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),C.abort()}var v,L,A,T;switch(i.type){case R.PlaylistContextType.MANIFEST:v=l.manifestLoadingMaxRetry,L=l.manifestLoadingTimeOut,A=l.manifestLoadingRetryDelay,T=l.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:v=0,L=l.levelLoadingTimeOut;break;default:v=l.levelLoadingMaxRetry,L=l.levelLoadingTimeOut,A=l.levelLoadingRetryDelay,T=l.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(i),(o=i.deliveryDirectives)!==null&&o!==void 0&&o.part){var x;if(i.type===R.PlaylistContextType.LEVEL&&i.level!==null?x=this.hls.levels[i.level].details:i.type===R.PlaylistContextType.AUDIO_TRACK&&i.id!==null?x=this.hls.audioTracks[i.id].details:i.type===R.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(x=this.hls.subtitleTracks[i.id].details),x){var h=x.partTarget,u=x.targetduration;h&&u&&(L=Math.min(Math.max(h*3,u*.8)*1e3,L))}}var D={timeout:L,maxRetry:v,retryDelay:A,maxRetryDelay:T,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(i,D,S)},y.loadsuccess=function(i,o,l,C){if(C===void 0&&(C=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,o,l,C);return}this.resetInternalLoader(l.type);var g=i.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",C);return}o.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,o,l,C):this.handleMasterPlaylist(i,o,l,C)},y.loaderror=function(i,o,l){l===void 0&&(l=null),this.handleNetworkError(o,l,!1,i)},y.loadtimeout=function(i,o,l){l===void 0&&(l=null),this.handleNetworkError(o,l,!0)},y.handleMasterPlaylist=function(i,o,l,C){var g=this.hls,v=i.data,L=_(i,l),A=P.default.parseMasterPlaylist(v,L),T=A.levels,x=A.sessionData;if(!T.length){this.handleManifestParsingError(i,l,"no level found in manifest",C);return}var h=T.map(function(K){return{id:K.attrs.AUDIO,audioCodec:K.audioCodec}}),u=T.map(function(K){return{id:K.attrs.SUBTITLES,textCodec:K.textCodec}}),D=P.default.parseMasterPlaylistMedia(v,L,"AUDIO",h),S=P.default.parseMasterPlaylistMedia(v,L,"SUBTITLES",u),w=P.default.parseMasterPlaylistMedia(v,L,"CLOSED-CAPTIONS");if(D.length){var b=D.some(function(K){return!K.url});!b&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),D.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}g.trigger(O.Events.MANIFEST_LOADED,{levels:T,audioTracks:D,subtitles:S,captions:w,url:L,stats:o,networkDetails:C,sessionData:x})},y.handleTrackOrLevelPlaylist=function(i,o,l,C){var g=this.hls,v=l.id,L=l.level,A=l.type,T=_(i,l),x=Object(H.isFiniteNumber)(v)?v:0,h=Object(H.isFiniteNumber)(L)?L:x,u=f(l),D=P.default.parseLevelPlaylist(i.data,T,h,u,x);if(!D.fragments.length){g.trigger(O.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(A===R.PlaylistContextType.MANIFEST){var S={attrs:new c.AttrList({}),bitrate:0,details:D,name:"",url:T};g.trigger(O.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:T,stats:o,networkDetails:C,sessionData:null})}if(o.parsing.end=performance.now(),D.needSidxRanges){var w,b=(w=D.fragments[0].initSegment)===null||w===void 0?void 0:w.url;this.load({url:b,isSidxRequest:!0,type:A,level:L,levelDetails:D,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=D,this.handlePlaylistLoaded(i,o,l,C)},y.handleSidxRequest=function(i,o){var l=Object(N.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var C=l.references,g=o.levelDetails;C.forEach(function(v,L){var A=v.info,T=g.fragments[L];T.byteRange.length===0&&T.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),T.initSegment&&T.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(i,o,l,C){this.hls.trigger(O.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===R.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:o,networkDetails:C})},y.handleNetworkError=function(i,o,l,C){l===void 0&&(l=!1),j.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var g=I.ErrorDetails.UNKNOWN,v=!1,L=this.getInternalLoader(i);switch(i.type){case R.PlaylistContextType.MANIFEST:g=l?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case R.PlaylistContextType.LEVEL:g=l?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.AUDIO_TRACK:g=l?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:g=l?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}L&&this.resetInternalLoader(i.type);var A={type:I.ErrorTypes.NETWORK_ERROR,details:g,fatal:v,url:i.url,loader:L,context:i,networkDetails:o};C&&(A.response=C),this.hls.trigger(O.Events.ERROR,A)},y.handlePlaylistLoaded=function(i,o,l,C){var g=l.type,v=l.level,L=l.id,A=l.groupId,T=l.loader,x=l.levelDetails,h=l.deliveryDirectives;if(!(x!=null&&x.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",C);return}if(!T)return;x.live&&(T.getCacheAge&&(x.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(x.ageHeader))&&(x.ageHeader=0));switch(g){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(O.Events.LEVEL_LOADED,{details:x,level:v||0,id:L||0,stats:o,networkDetails:C,deliveryDirectives:h});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(O.Events.AUDIO_TRACK_LOADED,{details:x,id:L||0,groupId:A||"",stats:o,networkDetails:C,deliveryDirectives:h});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADED,{details:x,id:L||0,groupId:A||"",stats:o,networkDetails:C,deliveryDirectives:h});break}},m}();Y.default=p},"./src/polyfills/number.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"isFiniteNumber",function(){return H}),M.d(Y,"MAX_SAFE_INTEGER",function(){return O});var H=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},O=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ie,Y,M){"use strict";M.r(Y);var H=function(){function O(){}return O.getSilentFrame=function(j,N){switch(j){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(N===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(N===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},O}();Y.default=H},"./src/remux/mp4-generator.ts":function(ie,Y,M){"use strict";M.r(Y);var H=Math.pow(2,32)-1,O=function(){function I(){}return I.init=function(){I.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in I.types)I.types.hasOwnProperty(N)&&(I.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var P=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]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);I.HDLR_TYPES={video:P,audio:R};var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),f=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=f,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),p=new Uint8Array([97,118,99,49]),m=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,_,m,_,p),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,c))},I.box=function(N){for(var P=8,R=arguments.length,c=new Array(R>1?R-1:0),f=1;f<R;f++)c[f-1]=arguments[f];for(var _=c.length,p=_;_--;)P+=c[_].byteLength;var m=new Uint8Array(P);for(m[0]=P>>24&255,m[1]=P>>16&255,m[2]=P>>8&255,m[3]=P&255,m.set(N,4),_=0,P=8;_<p;_++)m.set(c[_],P),P+=c[_].byteLength;return m},I.hdlr=function(N){return I.box(I.types.hdlr,I.HDLR_TYPES[N])},I.mdat=function(N){return I.box(I.types.mdat,N)},I.mdhd=function(N,P){P*=N;var R=Math.floor(P/(H+1)),c=Math.floor(P%(H+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,R>>24,R>>16&255,R>>8&255,R&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},I.mdia=function(N){return I.box(I.types.mdia,I.mdhd(N.timescale,N.duration),I.hdlr(N.type),I.minf(N))},I.mfhd=function(N){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},I.minf=function(N){return N.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(N)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(N))},I.moof=function(N,P,R){return I.box(I.types.moof,I.mfhd(N),I.traf(R,P))},I.moov=function(N){for(var P=N.length,R=[];P--;)R[P]=I.trak(N[P]);return I.box.apply(null,[I.types.moov,I.mvhd(N[0].timescale,N[0].duration)].concat(R).concat(I.mvex(N)))},I.mvex=function(N){for(var P=N.length,R=[];P--;)R[P]=I.trex(N[P]);return I.box.apply(null,[I.types.mvex].concat(R))},I.mvhd=function(N,P){P*=N;var R=Math.floor(P/(H+1)),c=Math.floor(P%(H+1)),f=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,R>>24,R>>16&255,R>>8&255,R&255,c>>24,c>>16&255,c>>8&255,c&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return I.box(I.types.mvhd,f)},I.sdtp=function(N){var P=N.samples||[],R=new Uint8Array(4+P.length),c,f;for(c=0;c<P.length;c++)f=P[c].flags,R[c+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return I.box(I.types.sdtp,R)},I.stbl=function(N){return I.box(I.types.stbl,I.stsd(N),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(N){var P=[],R=[],c,f,_;for(c=0;c<N.sps.length;c++)f=N.sps[c],_=f.byteLength,P.push(_>>>8&255),P.push(_&255),P=P.concat(Array.prototype.slice.call(f));for(c=0;c<N.pps.length;c++)f=N.pps[c],_=f.byteLength,R.push(_>>>8&255),R.push(_&255),R=R.concat(Array.prototype.slice.call(f));var p=I.box(I.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|N.sps.length].concat(P).concat([N.pps.length]).concat(R))),m=N.width,y=N.height,a=N.pixelRatio[0],i=N.pixelRatio[1];return I.box(I.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,m>>8&255,m&255,y>>8&255,y&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]),p,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},I.esds=function(N){var P=N.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(N.config).concat([6,1,2]))},I.mp4a=function(N){var P=N.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),I.box(I.types.esds,I.esds(N)))},I.mp3=function(N){var P=N.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},I.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(N)):I.box(I.types.stsd,I.STSD,I.mp4a(N)):I.box(I.types.stsd,I.STSD,I.avc1(N))},I.tkhd=function(N){var P=N.id,R=N.duration*N.timescale,c=N.width,f=N.height,_=Math.floor(R/(H+1)),p=Math.floor(R%(H+1));return I.box(I.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,p>>24,p>>16&255,p>>8&255,p&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,c>>8&255,c&255,0,0,f>>8&255,f&255,0,0]))},I.traf=function(N,P){var R=I.sdtp(N),c=N.id,f=Math.floor(P/(H+1)),_=Math.floor(P%(H+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,_>>24,_>>16&255,_>>8&255,_&255])),I.trun(N,R.length+16+20+8+16+8+8),R)},I.trak=function(N){return N.duration=N.duration||4294967295,I.box(I.types.trak,I.tkhd(N),I.mdia(N))},I.trex=function(N){var P=N.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(N,P){var R=N.samples||[],c=R.length,f=12+16*c,_=new Uint8Array(f),p,m,y,a,i,o;for(P+=8+f,_.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),p=0;p<c;p++)m=R[p],y=m.duration,a=m.size,i=m.flags,o=m.cts,_.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*p);return I.box(I.types.trun,_)},I.initSegment=function(N){I.types||I.init();var P=I.moov(N),R=new Uint8Array(I.FTYP.byteLength+P.byteLength);return R.set(I.FTYP),R.set(P,I.FTYP.byteLength),R},I}();O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0,Y.default=O},"./src/remux/mp4-remuxer.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return o}),M.d(Y,"normalizePts",function(){return l});var H=M("./src/polyfills/number.ts"),O=M("./src/remux/aac-helper.ts"),I=M("./src/remux/mp4-generator.ts"),j=M("./src/events.ts"),N=M("./src/errors.ts"),P=M("./src/utils/logger.ts"),R=M("./src/types/loader.ts"),c=M("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(L){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var x in T)Object.prototype.hasOwnProperty.call(T,x)&&(L[x]=T[x])}return L},f.apply(this,arguments)}var _=10*1e3,p=1024,m=1152,y=null,a=null,i=!1,o=function(){function L(T,x,h,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=T,this.config=x,this.typeSupported=h,this.ISGenerated=!1,y===null){var D=navigator.userAgent||"",S=D.match(/Chrome\/(\d+)/i);y=S?parseInt(S[1]):0}if(a===null){var w=navigator.userAgent.match(/Safari\/(\d+)/i);a=w?parseInt(w[1]):0}i=!!y&&y<75||!!a&&a<600}var A=L.prototype;return A.destroy=function(){},A.resetTimeStamp=function(x){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=x},A.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},A.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},A.getVideoStartPts=function(x){var h=!1,u=x.reduce(function(D,S){var w=S.pts-D;return w<-4294967296?(h=!0,l(D,S.pts)):w>0?D:S.pts},x[0].pts);return h&&P.logger.debug("PTS rollover detected"),u},A.remux=function(x,h,u,D,S,w,b,K){var X,Q,V,W,te,ue,ge=S,Oe=S,qe=x.pid>-1,Ke=h.pid>-1,Be=h.samples.length,Xe=x.samples.length>0,Fe=Be>1,xe=(!qe||Xe)&&(!Ke||Fe)||this.ISGenerated||b;if(xe){this.ISGenerated||(V=this.generateIS(x,h,S));var oe=this.isVideoContiguous,Re=-1;if(Fe&&(Re=C(h.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(ue=!0,Re>0){P.logger.warn("[mp4-remuxer]: Dropped "+Re+" out of "+Be+" video samples due to a missing keyframe");var dt=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(Re),h.dropped+=Re,Oe+=(h.samples[0].pts-dt)/(h.timescale||9e4)}else Re===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Be+" video samples"),ue=!1);if(this.ISGenerated){if(Xe&&Fe){var at=this.getVideoStartPts(h.samples),ut=l(x.samples[0].pts,at)-at,ce=ut/h.inputTimeScale;ge+=Math.max(0,ce),Oe+=Math.max(0,-ce)}if(Xe){if(x.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),V=this.generateIS(x,h,S)),Q=this.remuxAudio(x,ge,this.isAudioContiguous,w,Ke||Fe||K===R.PlaylistLevelType.AUDIO?Oe:void 0),Fe){var he=Q?Q.endPTS-Q.startPTS:0;h.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),V=this.generateIS(x,h,S)),X=this.remuxVideo(h,Oe,oe,he)}}else Fe&&(X=this.remuxVideo(h,Oe,oe,0));X&&(X.firstKeyFrame=Re,X.independent=Re!==-1)}}return this.ISGenerated&&(u.samples.length&&(te=this.remuxID3(u,S)),D.samples.length&&(W=this.remuxText(D,S))),{audio:Q,video:X,initSegment:V,independent:ue,text:W,id3:te}},A.generateIS=function(x,h,u){var D=x.samples,S=h.samples,w=this.typeSupported,b={},K=!Object(H.isFiniteNumber)(this._initPTS),X="audio/mp4",Q,V,W;if(K&&(Q=V=Infinity),x.config&&D.length&&(x.timescale=x.samplerate,x.isAAC||(w.mpeg?(X="audio/mpeg",x.codec=""):w.mp3&&(x.codec="mp3")),b.audio={id:"audio",container:X,codec:x.codec,initSegment:!x.isAAC&&w.mpeg?new Uint8Array(0):I.default.initSegment([x]),metadata:{channelCount:x.channelCount}},K&&(W=x.inputTimeScale,Q=V=D[0].pts-Math.round(W*u))),h.sps&&h.pps&&S.length&&(h.timescale=h.inputTimeScale,b.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:I.default.initSegment([h]),metadata:{width:h.width,height:h.height}},K)){W=h.inputTimeScale;var te=this.getVideoStartPts(S),ue=Math.round(W*u);V=Math.min(V,l(S[0].dts,te)-ue),Q=Math.min(Q,te-ue)}if(Object.keys(b).length)return this.ISGenerated=!0,K&&(this._initPTS=Q,this._initDTS=V),{tracks:b,initPTS:Q,timescale:W}},A.remuxVideo=function(x,h,u,D){var S=x.inputTimeScale,w=x.samples,b=[],K=w.length,X=this._initPTS,Q=this.nextAvcDts,V=8,W,te,ue,ge=Number.POSITIVE_INFINITY,Oe=Number.NEGATIVE_INFINITY,qe=0,Ke=!1;if(!u||Q===null){var Be=h*S,Xe=w[0].pts-l(w[0].dts,w[0].pts);Q=Be-Xe}for(var Fe=0;Fe<K;Fe++){var xe=w[Fe];if(xe.pts=l(xe.pts-X,Q),xe.dts=l(xe.dts-X,Q),xe.dts>xe.pts){var oe=9e4*.2;qe=Math.max(Math.min(qe,xe.pts-xe.dts),-1*oe)}xe.dts<w[Fe>0?Fe-1:Fe].dts&&(Ke=!0)}Ke&&w.sort(function($t,_t){var $e=$t.dts-_t.dts,bn=$t.pts-_t.pts;return $e||bn}),te=w[0].dts,ue=w[w.length-1].dts;var Re=Math.round((ue-te)/(K-1));if(qe<0){if(qe<Re*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-Re,!0)+" ms");for(var dt=qe,at=0;at<K;at++)w[at].dts=dt=Math.max(dt,w[at].pts-Re),w[at].pts=Math.max(dt,w[at].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(qe,!0)+" ms to overcome this issue");for(var ut=0;ut<K;ut++)w[ut].dts=w[ut].dts+qe}te=w[0].dts}if(u){var ce=te-Q,he=ce>Re,Le=ce<-1;if(he||Le){he?P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(ce,!0)+" ms ("+ce+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-ce,!0)+" ms ("+ce+"dts) overlapping between fragments detected"),te=Q;var Ve=w[0].pts-ce;w[0].dts=te,w[0].pts=Ve,P.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(Ve,!0)+"/"+Object(c.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(ce,!0)+" ms")}}i&&(te=Math.max(0,te));for(var et=0,tt=0,rt=0;rt<K;rt++){for(var it=w[rt],Dt=it.units,Et=Dt.length,xt=0,ct=0;ct<Et;ct++)xt+=Dt[ct].data.length;tt+=xt,et+=Et,it.length=xt,it.dts=Math.max(it.dts,te),it.pts=Math.max(it.pts,it.dts,0),ge=Math.min(it.pts,ge),Oe=Math.max(it.pts,Oe)}ue=w[K-1].dts;var Ft=tt+4*et+8,wt;try{wt=new Uint8Array(Ft)}catch($t){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ft,reason:"fail allocating video mdat "+Ft});return}var Pt=new DataView(wt.buffer);Pt.setUint32(0,Ft),wt.set(I.default.types.mdat,4);for(var We=0;We<K;We++){for(var gt=w[We],Ut=gt.units,Qe=0,ot=0,Ae=Ut.length;ot<Ae;ot++){var be=Ut[ot],Se=be.data,re=be.data.byteLength;Pt.setUint32(V,re),V+=4,wt.set(Se,V),V+=re,Qe+=4+re}if(We<K-1)W=w[We+1].dts-gt.dts;else{var ae=this.config,fe=gt.dts-w[We>0?We-1:We].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ee=Math.floor(ae.maxBufferHole*S),je=(D?ge+D*S:this.nextAudioPts)-gt.pts;je>Ee?(W=je-fe,W<0&&(W=fe),P.logger.log("[mp4-remuxer]: It is approximately "+je/90+" ms to the next segment; using duration "+W/90+" ms for the last video frame.")):W=fe}else W=fe}var Te=Math.round(gt.pts-gt.dts);b.push(new g(gt.key,W,Qe,Te))}if(b.length&&y&&y<70){var Ne=b[0].flags;Ne.dependsOn=2,Ne.isNonSync=0}console.assert(W!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=ue+W,this.isVideoContiguous=!0;var st=I.default.moof(x.sequenceNumber++,te,f({},x,{samples:b})),pt="video",St={data1:st,data2:wt,startPTS:ge/S,endPTS:(Oe+W)/S,startDTS:te/S,endDTS:Q/S,type:pt,hasAudio:!1,hasVideo:!0,nb:b.length,dropped:x.dropped};return x.samples=[],x.dropped=0,console.assert(wt.length,"MDAT length must not be zero"),St},A.remuxAudio=function(x,h,u,D,S){var w=x.inputTimeScale,b=x.samplerate?x.samplerate:w,K=w/b,X=x.isAAC?p:m,Q=X*K,V=this._initPTS,W=!x.isAAC&&this.typeSupported.mpeg,te=[],ue=x.samples,ge=W?0:8,Oe=this.nextAudioPts||-1,qe=h*w;if(this.isAudioContiguous=u=u||ue.length&&Oe>0&&(D&&Math.abs(qe-Oe)<9e3||Math.abs(l(ue[0].pts-V,qe)-Oe)<20*Q),ue.forEach(function(Se){Se.pts=l(Se.pts-V,qe)}),!u||Oe<0){if(ue=ue.filter(function(Se){return Se.pts>=0}),!ue.length)return;S===0?Oe=0:D?Oe=Math.max(0,qe):Oe=ue[0].pts}if(x.isAAC)for(var Ke=S!==void 0,Be=this.config.maxAudioFramesDrift,Xe=0,Fe=Oe;Xe<ue.length;Xe++){var xe=ue[Xe],oe=xe.pts,Re=oe-Fe,dt=Math.abs(1e3*Re/w);if(Re<=-Be*Q&&Ke)Xe===0&&(P.logger.warn("Audio frame @ "+(oe/w).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Re/w)+" ms."),this.nextAudioPts=Oe=Fe=oe);else if(Re>=Be*Q&&dt<_&&Ke){var at=Math.round(Re/Q);Fe=oe-at*Q,Fe<0&&(at--,Fe+=Q),Xe===0&&(this.nextAudioPts=Oe=Fe),P.logger.warn("[mp4-remuxer]: Injecting "+at+" audio frame @ "+(Fe/w).toFixed(3)+"s due to "+Math.round(1e3*Re/w)+" ms gap.");for(var ut=0;ut<at;ut++){var ce=Math.max(Fe,0),he=O.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);he||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),he=xe.unit.subarray()),ue.splice(Xe,0,{unit:he,pts:ce}),Fe+=Q,Xe++}}xe.pts=Fe,Fe+=Q}for(var Le=null,Ve=null,et,tt=0,rt=ue.length;rt--;)tt+=ue[rt].unit.byteLength;for(var it=0,Dt=ue.length;it<Dt;it++){var Et=ue[it],xt=Et.unit,ct=Et.pts;if(Ve!==null){var Ft=te[it-1];Ft.duration=Math.round((ct-Ve)/K)}else if(u&&x.isAAC&&(ct=Oe),Le=ct,tt>0){tt+=ge;try{et=new Uint8Array(tt)}catch(Se){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:tt,reason:"fail allocating audio mdat "+tt});return}if(!W){var wt=new DataView(et.buffer);wt.setUint32(0,tt),et.set(I.default.types.mdat,4)}}else return;et.set(xt,ge);var Pt=xt.byteLength;ge+=Pt,te.push(new g(!0,X,Pt,0)),Ve=ct}var We=te.length;if(!We)return;var gt=te[te.length-1];this.nextAudioPts=Oe=Ve+K*gt.duration;var Ut=W?new Uint8Array(0):I.default.moof(x.sequenceNumber++,Le/K,f({},x,{samples:te}));x.samples=[];var Qe=Le/w,ot=Oe/w,Ae="audio",be={data1:Ut,data2:et,startPTS:Qe,endPTS:ot,startDTS:Qe,endDTS:ot,type:Ae,hasAudio:!0,hasVideo:!1,nb:We};return this.isAudioContiguous=!0,console.assert(et.length,"MDAT length must not be zero"),be},A.remuxEmptyAudio=function(x,h,u,D){var S=x.inputTimeScale,w=x.samplerate?x.samplerate:S,b=S/w,K=this.nextAudioPts,X=(K!==null?K:D.startDTS*S)+this._initDTS,Q=D.endDTS*S+this._initDTS,V=b*p,W=Math.ceil((Q-X)/V),te=O.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ue=[],ge=0;ge<W;ge++){var Oe=X+ge*V;ue.push({unit:te,pts:Oe,dts:Oe})}return x.samples=ue,this.remuxAudio(x,h,u,!1)},A.remuxID3=function(x,h){var u=x.samples.length;if(!u)return;for(var D=x.inputTimeScale,S=this._initPTS,w=this._initDTS,b=0;b<u;b++){var K=x.samples[b];K.pts=l(K.pts-S,h*D)/D,K.dts=l(K.dts-w,h*D)/D}var X=x.samples;return x.samples=[],{samples:X}},A.remuxText=function(x,h){var u=x.samples.length;if(!u)return;for(var D=x.inputTimeScale,S=this._initPTS,w=0;w<u;w++){var b=x.samples[w];b.pts=l(b.pts-S,h*D)/D}x.samples.sort(function(X,Q){return X.pts-Q.pts});var K=x.samples;return x.samples=[],{samples:K}},L}();function l(L,A){var T;if(A===null)return L;for(A<L?T=-8589934592:T=8589934592;Math.abs(L-A)>4294967296;)L+=T;return L}function C(L){for(var A=0;A<L.length;A++)if(L[A].key)return A;return-1}var g=function(A,T,x,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=T,this.size=x,this.cts=h,this.flags=new v(A)},v=function(A){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=A?2:1,this.isNonSync=A?0:1}},"./src/remux/passthrough-remuxer.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/polyfills/number.ts"),O=M("./src/utils/mp4-tools.ts"),I=M("./src/loader/fragment.ts"),j=M("./src/utils/logger.ts"),N=function(){function c(){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 f=c.prototype;return f.destroy=function(){},f.resetTimeStamp=function(p){this.initPTS=p,this.lastEndDTS=null},f.resetNextTimestamp=function(){this.lastEndDTS=null},f.resetInitSegment=function(p,m,y){this.audioCodec=m,this.videoCodec=y,this.generateInitSegment(p),this.emitInitSegment=!0},f.generateInitSegment=function(p){var m=this.audioCodec,y=this.videoCodec;if(!p||!p.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(O.parseInitSegment)(p);m||(m=R(a.audio,I.ElementaryStreamTypes.AUDIO)),y||(y=R(a.video,I.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:m+","+y,initSegment:p,id:"main"}:a.audio?i.audio={container:"audio/mp4",codec:m,initSegment:p,id:"audio"}:a.video?i.video={container:"video/mp4",codec:y,initSegment:p,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},f.remux=function(p,m,y,a,i){var o=this.initPTS,l=this.lastEndDTS,C={audio:void 0,video:void 0,text:a,id3:y,initSegment:void 0};Object(H.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var g=m.samples;if(!g||!g.length)return C;var v={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(g),L=this.initData),!L||!L.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(o)||(this.initPTS=v.initPTS=o=P(L,g,l));var A=Object(O.getDuration)(g,L),T=l,x=A+T;Object(O.offsetStartDTS)(L,g,o),A>0?this.lastEndDTS=x:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!L.audio,u=!!L.video,D="";h&&(D+="audio"),u&&(D+="video");var S={data1:g,startPTS:T,startDTS:T,endPTS:x,endDTS:x,type:D,hasAudio:h,hasVideo:u,nb:1,dropped:0};return C.audio=S.type==="audio"?S:void 0,C.video=S.type!=="audio"?S:void 0,C.text=a,C.id3=y,C.initSegment=v,C},c}(),P=function(f,_,p){return Object(O.getStartDTS)(f,_)-p};function R(c,f){var _=c==null?void 0:c.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||f===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=N},"./src/task-loop.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return H});var H=function(){function O(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=O.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},O}()},"./src/types/cmcd.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"CMCDVersion",function(){return H}),M.d(Y,"CMCDObjectType",function(){return O}),M.d(Y,"CMCDStreamingFormat",function(){return I}),M.d(Y,"CMCDStreamType",function(){return j});var H=1,O;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(O||(O={}));var I;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(I||(I={}));var j;(function(N){N.VOD="v",N.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"HlsSkip",function(){return I}),M.d(Y,"getSkipValue",function(){return j}),M.d(Y,"HlsUrlParameters",function(){return N}),M.d(Y,"Level",function(){return P});function H(R,c){for(var f=0;f<c.length;f++){var _=c[f];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function O(R,c,f){return c&&H(R.prototype,c),f&&H(R,f),R}var I;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(I||(I={}));function j(R,c){var f=R.canSkipUntil,_=R.canSkipDateRanges,p=R.endSN,m=c!==void 0?c-p:0;return f&&m<f?_?I.v2:I.Yes:I.No}var N=function(){function R(f,_,p){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=f,this.part=_,this.skip=p}var c=R.prototype;return c.addDirectives=function(_){var p=new self.URL(_);return this.msn!==void 0&&p.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&p.searchParams.set("_HLS_part",this.part.toString()),this.skip&&p.searchParams.set("_HLS_skip",this.skip),p.toString()},R}(),P=function(){function R(c){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=[c.url],this.attrs=c.attrs,this.bitrate=c.bitrate,c.details&&(this.details=c.details),this.id=c.id||0,this.name=c.name,this.width=c.width||0,this.height=c.height||0,this.audioCodec=c.audioCodec,this.videoCodec=c.videoCodec,this.unknownCodecs=c.unknownCodecs,this.codecSet=[c.videoCodec,c.audioCodec].filter(function(f){return f}).join(",").replace(/\.[^.,]+/g,"")}return O(R,[{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(f){var _=f%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),R}()},"./src/types/loader.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"PlaylistContextType",function(){return H}),M.d(Y,"PlaylistLevelType",function(){return O});var H;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var O;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(O||(O={}))},"./src/types/transmuxer.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"ChunkMetadata",function(){return H});var H=function(j,N,P,R,c,f){R===void 0&&(R=0),c===void 0&&(c=-1),f===void 0&&(f=!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=O(),this.buffering={audio:O(),video:O(),audiovideo:O()},this.level=j,this.sn=N,this.id=P,this.size=R,this.part=c,this.partial=f};function O(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"AttrList",function(){return I});var H=/^(\d+)x(\d+)$/,O=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function j(P){typeof P=="string"&&(P=j.parseAttrList(P));for(var R in P)P.hasOwnProperty(R)&&(this[R]=P[R])}var N=j.prototype;return N.decimalInteger=function(R){var c=parseInt(this[R],10);return c>Number.MAX_SAFE_INTEGER?Infinity:c},N.hexadecimalInteger=function(R){if(this[R]){var c=(this[R]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var f=new Uint8Array(c.length/2),_=0;_<c.length/2;_++)f[_]=parseInt(c.slice(_*2,_*2+2),16);return f}else return null},N.hexadecimalIntegerAsNumber=function(R){var c=parseInt(this[R],16);return c>Number.MAX_SAFE_INTEGER?Infinity:c},N.decimalFloatingPoint=function(R){return parseFloat(this[R])},N.optionalFloat=function(R,c){var f=this[R];return f?parseFloat(f):c},N.enumeratedString=function(R){return this[R]},N.bool=function(R){return this[R]==="YES"},N.decimalResolution=function(R){var c=H.exec(this[R]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},j.parseAttrList=function(R){var c,f={},_='"';for(O.lastIndex=0;(c=O.exec(R))!==null;){var p=c[2];p.indexOf(_)===0&&p.lastIndexOf(_)===p.length-1&&(p=p.slice(1,-1)),f[c[1]]=p}return f},j}()},"./src/utils/binary-search.ts":function(ie,Y,M){"use strict";M.r(Y);var H={search:function(I,j){for(var N=0,P=I.length-1,R=null,c=null;N<=P;){R=(N+P)/2|0,c=I[R];var f=j(c);if(f>0)N=R+1;else if(f<0)P=R-1;else return c}return null}};Y.default=H},"./src/utils/buffer-helper.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"BufferHelper",function(){return I});var H=M("./src/utils/logger.ts"),O={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function j(){}return j.isBuffered=function(P,R){try{if(P){for(var c=j.getBuffered(P),f=0;f<c.length;f++)if(R>=c.start(f)&&R<=c.end(f))return!0}}catch(_){}return!1},j.bufferInfo=function(P,R,c){try{if(P){var f=j.getBuffered(P),_=[],p;for(p=0;p<f.length;p++)_.push({start:f.start(p),end:f.end(p)});return this.bufferedInfo(_,R,c)}}catch(m){}return{len:0,start:R,end:R,nextStart:void 0}},j.bufferedInfo=function(P,R,c){R=Math.max(0,R),P.sort(function(v,L){var A=v.start-L.start;return A||L.end-v.end});var f=[];if(c)for(var _=0;_<P.length;_++){var p=f.length;if(p){var m=f[p-1].end;P[_].start-m<c?P[_].end>m&&(f[p-1].end=P[_].end):f.push(P[_])}else f.push(P[_])}else f=P;for(var y=0,a,i=R,o=R,l=0;l<f.length;l++){var C=f[l].start,g=f[l].end;if(R+c>=C&&R<g)i=C,o=g,y=o-R;else if(R+c<C){a=C;break}}return{len:y,start:i||0,end:o||0,nextStart:a}},j.getBuffered=function(P){try{return P.buffered}catch(R){return H.logger.log("failed to get media.buffered",R),O}},j}()},"./src/utils/cea-608-parser.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"Row",function(){return o}),M.d(Y,"CaptionScreen",function(){return l});var H=M("./src/utils/logger.ts"),O={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},I=function(x){var h=x;return O.hasOwnProperty(x)&&(h=O[x]),String.fromCharCode(h)},j=15,N=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p;(function(T){T[T.ERROR=0]="ERROR",T[T.TEXT=1]="TEXT",T[T.WARNING=2]="WARNING",T[T.INFO=2]="INFO",T[T.DEBUG=3]="DEBUG",T[T.DATA=3]="DATA"})(p||(p={}));var m=function(){function T(){this.time=null,this.verboseLevel=p.ERROR}var x=T.prototype;return x.log=function(u,D){this.verboseLevel>=u&&H.logger.log(this.time+" ["+u+"] "+D)},T}(),y=function(x){for(var h=[],u=0;u<x.length;u++)h.push(x[u].toString(16));return h},a=function(){function T(h,u,D,S,w){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=u||!1,this.italics=D||!1,this.background=S||"black",this.flash=w||!1}var x=T.prototype;return x.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},x.setStyles=function(u){for(var D=["foreground","underline","italics","background","flash"],S=0;S<D.length;S++){var w=D[S];u.hasOwnProperty(w)&&(this[w]=u[w])}},x.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},x.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},x.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},x.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},T}(),i=function(){function T(h,u,D,S,w,b){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new a(u,D,S,w,b)}var x=T.prototype;return x.reset=function(){this.uchar=" ",this.penState.reset()},x.setChar=function(u,D){this.uchar=u,this.penState.copy(D)},x.setPenState=function(u){this.penState.copy(u)},x.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},x.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},x.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},T}(),o=function(){function T(h){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<N;u++)this.chars.push(new i);this.logger=h,this.pos=0,this.currPenState=new a}var x=T.prototype;return x.equals=function(u){for(var D=!0,S=0;S<N;S++)if(!this.chars[S].equals(u.chars[S])){D=!1;break}return D},x.copy=function(u){for(var D=0;D<N;D++)this.chars[D].copy(u.chars[D])},x.isEmpty=function(){for(var u=!0,D=0;D<N;D++)if(!this.chars[D].isEmpty()){u=!1;break}return u},x.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(p.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(p.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},x.moveCursor=function(u){var D=this.pos+u;if(u>1)for(var S=this.pos+1;S<D+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(D)},x.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},x.insertChar=function(u){u>=144&&this.backSpace();var D=I(u);if(this.pos>=N){this.logger.log(p.ERROR,"Cannot insert "+u.toString(16)+" ("+D+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(D,this.currPenState),this.moveCursor(1)},x.clearFromPos=function(u){var D;for(D=u;D<N;D++)this.chars[D].reset()},x.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},x.clearToEndOfRow=function(){this.clearFromPos(this.pos)},x.getTextString=function(){for(var u=[],D=!0,S=0;S<N;S++){var w=this.chars[S].uchar;w!==" "&&(D=!1),u.push(w)}return D?"":u.join("")},x.setPenStyles=function(u){this.currPenState.setStyles(u);var D=this.chars[this.pos];D.setPenState(this.currPenState)},T}(),l=function(){function T(h){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<j;u++)this.rows.push(new o(h));this.logger=h,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var x=T.prototype;return x.reset=function(){for(var u=0;u<j;u++)this.rows[u].clear();this.currRow=j-1},x.equals=function(u){for(var D=!0,S=0;S<j;S++)if(!this.rows[S].equals(u.rows[S])){D=!1;break}return D},x.copy=function(u){for(var D=0;D<j;D++)this.rows[D].copy(u.rows[D])},x.isEmpty=function(){for(var u=!0,D=0;D<j;D++)if(!this.rows[D].isEmpty()){u=!1;break}return u},x.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},x.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},x.insertChar=function(u){var D=this.rows[this.currRow];D.insertChar(u)},x.setPen=function(u){var D=this.rows[this.currRow];D.setPenStyles(u)},x.moveCursor=function(u){var D=this.rows[this.currRow];D.moveCursor(u)},x.setCursor=function(u){this.logger.log(p.INFO,"setCursor: "+u);var D=this.rows[this.currRow];D.setCursor(u)},x.setPAC=function(u){this.logger.log(p.INFO,"pacData = "+JSON.stringify(u));var D=u.row-1;if(this.nrRollUpRows&&D<this.nrRollUpRows-1&&(D=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==D){for(var S=0;S<j;S++)this.rows[S].clear();var w=this.currRow+1-this.nrRollUpRows,b=this.lastOutputScreen;if(b){var K=b.rows[w].cueStartTime,X=this.logger.time;if(K&&X!==null&&K<X)for(var Q=0;Q<this.nrRollUpRows;Q++)this.rows[D-this.nrRollUpRows+Q+1].copy(b.rows[w+Q])}}this.currRow=D;var V=this.rows[this.currRow];if(u.indent!==null){var W=u.indent,te=Math.max(W-1,0);V.setCursor(u.indent),u.color=V.chars[te].penState.foreground}var ue={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ue)},x.setBkgData=function(u){this.logger.log(p.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},x.setRollUpRows=function(u){this.nrRollUpRows=u},x.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(p.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(p.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,D=this.rows.splice(u,1)[0];D.clear(),this.rows.splice(this.currRow,0,D),this.logger.log(p.INFO,"Rolling up")},x.getDisplayText=function(u){u=u||!1;for(var D=[],S="",w=-1,b=0;b<j;b++){var K=this.rows[b].getTextString();K&&(w=b+1,u?D.push("Row "+w+": '"+K+"'"):D.push(K.trim()))}return D.length>0&&(u?S="["+D.join(" | ")+"]":S=D.join(`
`)),S},x.getTextAndFormat=function(){return this.rows},T}(),C=function(){function T(h,u,D){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=h,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(D),this.nonDisplayedMemory=new l(D),this.lastOutputScreen=new l(D),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=D}var x=T.prototype;return x.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},x.getHandler=function(){return this.outputFilter},x.setHandler=function(u){this.outputFilter=u},x.setPAC=function(u){this.writeScreen.setPAC(u)},x.setBkgData=function(u){this.writeScreen.setBkgData(u)},x.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(p.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},x.insertChars=function(u){for(var D=0;D<u.length;D++)this.writeScreen.insertChar(u[D]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(p.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(p.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},x.ccRCL=function(){this.logger.log(p.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},x.ccBS=function(){if(this.logger.log(p.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},x.ccAOF=function(){},x.ccAON=function(){},x.ccDER=function(){this.logger.log(p.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},x.ccRU=function(u){this.logger.log(p.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},x.ccFON=function(){this.logger.log(p.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},x.ccRDC=function(){this.logger.log(p.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},x.ccTR=function(){this.logger.log(p.INFO,"TR"),this.setMode("MODE_TEXT")},x.ccRTD=function(){this.logger.log(p.INFO,"RTD"),this.setMode("MODE_TEXT")},x.ccEDM=function(){this.logger.log(p.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},x.ccCR=function(){this.logger.log(p.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},x.ccENM=function(){this.logger.log(p.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},x.ccEOC=function(){if(this.logger.log(p.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(p.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},x.ccTO=function(u){this.logger.log(p.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},x.ccMIDROW=function(u){var D={flash:!1};if(D.underline=u%2===1,D.italics=u>=46,D.italics)D.foreground="white";else{var S=Math.floor(u/2)-16,w=["white","green","blue","cyan","red","yellow","magenta"];D.foreground=w[S]}this.logger.log(p.INFO,"MIDROW: "+JSON.stringify(D)),this.writeScreen.setPen(D)},x.outputDataUpdate=function(u){u===void 0&&(u=!1);var D=this.logger.time;if(D===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=D:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,D,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:D),this.lastOutputScreen.copy(this.displayedMemory))},x.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},T}(),g=function(){function T(h,u,D){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new m;this.channels=[null,new C(h,u,S),new C(h+1,D,S)],this.cmdHistory=A(),this.logger=S}var x=T.prototype;return x.getHandler=function(u){return this.channels[u].getHandler()},x.setHandler=function(u,D){this.channels[u].setHandler(D)},x.addData=function(u,D){var S,w,b,K=!1;this.logger.time=u;for(var X=0;X<D.length;X+=2){if(w=D[X]&127,b=D[X+1]&127,w===0&&b===0)continue;if(this.logger.log(p.DATA,"["+y([D[X],D[X+1]])+"] -> ("+y([w,b])+")"),S=this.parseCmd(w,b),S||(S=this.parseMidrow(w,b)),S||(S=this.parsePAC(w,b)),S||(S=this.parseBackgroundAttributes(w,b)),!S&&(K=this.parseChars(w,b),K)){var Q=this.currentChannel;if(Q&&Q>0){var V=this.channels[Q];V.insertChars(K)}else this.logger.log(p.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!K&&this.logger.log(p.WARNING,"Couldn't parse cleaned data "+y([w,b])+" orig: "+y([D[X],D[X+1]]))}},x.parseCmd=function(u,D){var S=this.cmdHistory,w=(u===20||u===28||u===21||u===29)&&D>=32&&D<=47,b=(u===23||u===31)&&D>=33&&D<=35;if(!(w||b))return!1;if(L(u,D,S))return v(null,null,S),this.logger.log(p.DEBUG,"Repeated command ("+y([u,D])+") is dropped"),!0;var K=u===20||u===21||u===23?1:2,X=this.channels[K];return u===20||u===21||u===28||u===29?D===32?X.ccRCL():D===33?X.ccBS():D===34?X.ccAOF():D===35?X.ccAON():D===36?X.ccDER():D===37?X.ccRU(2):D===38?X.ccRU(3):D===39?X.ccRU(4):D===40?X.ccFON():D===41?X.ccRDC():D===42?X.ccTR():D===43?X.ccRTD():D===44?X.ccEDM():D===45?X.ccCR():D===46?X.ccENM():D===47&&X.ccEOC():X.ccTO(D-32),v(u,D,S),this.currentChannel=K,!0},x.parseMidrow=function(u,D){var S=0;if((u===17||u===25)&&D>=32&&D<=47){if(u===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(p.ERROR,"Mismatch channel in midrow parsing"),!1;var w=this.channels[S];return w?(w.ccMIDROW(D),this.logger.log(p.DEBUG,"MIDROW ("+y([u,D])+")"),!0):!1}return!1},x.parsePAC=function(u,D){var S,w=this.cmdHistory,b=(u>=17&&u<=23||u>=25&&u<=31)&&D>=64&&D<=127,K=(u===16||u===24)&&D>=64&&D<=95;if(!(b||K))return!1;if(L(u,D,w))return v(null,null,w),!0;var X=u<=23?1:2;D>=64&&D<=95?S=X===1?P[u]:c[u]:S=X===1?R[u]:f[u];var Q=this.channels[X];return Q?(Q.setPAC(this.interpretPAC(S,D)),v(u,D,w),this.currentChannel=X,!0):!1},x.interpretPAC=function(u,D){var S,w={color:null,italics:!1,indent:null,underline:!1,row:u};return D>95?S=D-96:S=D-64,w.underline=(S&1)===1,S<=13?w.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(w.italics=!0,w.color="white"):w.indent=Math.floor((S-16)/2)*4,w},x.parseChars=function(u,D){var S,w=null,b=null;if(u>=25?(S=2,b=u-8):(S=1,b=u),b>=17&&b<=19){var K;b===17?K=D+80:b===18?K=D+112:K=D+144,this.logger.log(p.INFO,"Special char '"+I(K)+"' in channel "+S),w=[K]}else u>=32&&u<=127&&(w=D===0?[u]:[u,D]);if(w){var X=y(w);this.logger.log(p.DEBUG,"Char codes = "+X.join(",")),v(u,D,this.cmdHistory)}return w},x.parseBackgroundAttributes=function(u,D){var S=(u===16||u===24)&&D>=32&&D<=47,w=(u===23||u===31)&&D>=45&&D<=47;if(!(S||w))return!1;var b,K={};u===16||u===24?(b=Math.floor((D-32)/2),K.background=_[b],D%2===1&&(K.background=K.background+"_semi")):D===45?K.background="transparent":(K.foreground="black",D===47&&(K.underline=!0));var X=u<=23?1:2,Q=this.channels[X];return Q.setBkgData(K),v(u,D,this.cmdHistory),!0},x.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var D=this.channels[u];D&&D.reset()}this.cmdHistory=A()},x.cueSplitAtTime=function(u){for(var D=0;D<this.channels.length;D++){var S=this.channels[D];S&&S.cueSplitAtTime(u)}},T}();function v(T,x,h){h.a=T,h.b=x}function L(T,x,h){return h.a===T&&h.b===x}function A(){return{a:null,b:null}}Y.default=g},"./src/utils/codecs.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"isCodecType",function(){return O}),M.d(Y,"isCodecSupportedInMp4",function(){return I});var H={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 O(j,N){var P=H[N];return!!P&&P[j.slice(0,4)]===!0}function I(j,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/utils/vttparser.ts"),O=M("./src/utils/webvtt-parser.ts"),I=M("./src/utils/texttrack-utils.ts"),j=/\s/,N={newCue:function(R,c,f,_){for(var p=[],m,y,a,i,o,l=self.VTTCue||self.TextTrackCue,C=0;C<_.rows.length;C++)if(m=_.rows[C],a=!0,i=0,o="",!m.isEmpty()){for(var g=0;g<m.chars.length;g++)j.test(m.chars[g].uchar)&&a?i++:(o+=m.chars[g].uchar,a=!1);m.cueStartTime=c,c===f&&(f+=1e-4),i>=16?i--:i++;var v=Object(H.fixLineBreaks)(o.trim()),L=Object(O.generateCueId)(c,f,v);(!R||!R.cues||!R.cues.getCueById(L))&&(y=new l(c,f,v),y.id=L,y.line=C+1,y.align="left",y.position=10+Math.min(80,Math.floor(i*8/32)*10),p.push(y))}return R&&p.length&&(p.sort(function(A,T){return A.line==="auto"||T.line==="auto"?0:A.line>8&&T.line>8?T.line-A.line:A.line-T.line}),p.forEach(function(A){return Object(I.addCueToTrack)(R,A)})),p}};Y.default=N},"./src/utils/discontinuities.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"findFirstFragWithCC",function(){return j}),M.d(Y,"shouldAlignOnDiscontinuities",function(){return N}),M.d(Y,"findDiscontinuousReferenceFrag",function(){return P}),M.d(Y,"adjustSlidingStart",function(){return c}),M.d(Y,"alignStream",function(){return f}),M.d(Y,"alignPDT",function(){return p}),M.d(Y,"alignFragmentByPDTDelta",function(){return m}),M.d(Y,"alignMediaPlaylistByPDT",function(){return y});var H=M("./src/polyfills/number.ts"),O=M("./src/utils/logger.ts"),I=M("./src/controller/level-helper.ts");function j(a,i){for(var o=null,l=0,C=a.length;l<C;l++){var g=a[l];if(g&&g.cc===i){o=g;break}}return o}function N(a,i,o){return!!(i.details&&(o.endCC>o.startCC||a&&a.cc<o.startCC))}function P(a,i){var o=a.fragments,l=i.fragments;if(!l.length||!o.length){O.logger.log("No fragments to align");return}var C=j(o,l[0].cc);if(!C||C&&!C.startPTS){O.logger.log("No frag in previous level to align on");return}return C}function R(a,i){if(a){var o=a.start+i;a.start=a.startPTS=o,a.endPTS=o+a.duration}}function c(a,i){for(var o=i.fragments,l=0,C=o.length;l<C;l++)R(o[l],a);i.fragmentHint&&R(i.fragmentHint,a),i.alignedSliding=!0}function f(a,i,o){if(!i)return;_(a,o,i),!o.alignedSliding&&i.details&&p(o,i.details),!o.alignedSliding&&i.details&&!o.skippedSegments&&Object(I.adjustSliding)(i.details,o)}function _(a,i,o){if(N(a,o,i)){var l=P(o.details,i);l&&Object(H.isFiniteNumber)(l.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),c(l.start,i))}}function p(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var o=i.fragments[0].programDateTime,l=a.fragments[0].programDateTime,C=(l-o)/1e3+i.fragments[0].start;C&&Object(H.isFiniteNumber)(C)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(l-o)+"ms, sliding:"+C.toFixed(3)+" "+a.url+" "),c(C,a))}function m(a,i){var o=a.programDateTime;if(!o)return;var l=(o-i)/1e3;a.start=a.startPTS=l,a.endPTS=l+a.duration}function y(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var o=i.fragments[0].programDateTime,l=i.fragments[0].start,C=o-l*1e3;a.fragments.forEach(function(g){m(g,C)}),a.fragmentHint&&m(a.fragmentHint,C),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/utils/ewma.ts"),O=function(){function I(N,P,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(N),this.fast_=new H.default(P)}var j=I.prototype;return j.update=function(P,R){var c=this.slow_,f=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new H.default(P,c.getEstimate(),c.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new H.default(R,f.getEstimate(),f.getTotalWeight()))},j.sample=function(P,R){P=Math.max(P,this.minDelayMs_);var c=8*R,f=P/1e3,_=c/f;this.fast_.sample(f,_),this.slow_.sample(f,_)},j.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},I}();Y.default=O},"./src/utils/ewma.ts":function(ie,Y,M){"use strict";M.r(Y);var H=function(){function O(j,N,P){N===void 0&&(N=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=N,this.totalWeight_=P}var I=O.prototype;return I.sample=function(N,P){var R=Math.pow(this.alpha_,N);this.estimate_=P*(1-R)+R*this.estimate_,this.totalWeight_+=N},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},O}();Y.default=H},"./src/utils/fetch-loader.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"fetchSupported",function(){return m});var H=M("./src/polyfills/number.ts"),O=M("./src/loader/load-stats.ts"),I=M("./src/demux/chunk-cache.ts");function j(l,C){l.prototype=Object.create(C.prototype),l.prototype.constructor=l,f(l,C)}function N(l){var C=typeof Map=="function"?new Map:void 0;return N=function(v){if(v===null||!c(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(v))return C.get(v);C.set(v,L)}function L(){return P(v,arguments,_(this).constructor)}return L.prototype=Object.create(v.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),f(L,v)},N(l)}function P(l,C,g){return R()?P=Reflect.construct:P=function(L,A,T){var x=[null];x.push.apply(x,A);var h=Function.bind.apply(L,x),u=new h;return T&&f(u,T.prototype),u},P.apply(null,arguments)}function R(){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 c(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function f(l,C){return f=Object.setPrototypeOf||function(v,L){return v.__proto__=L,v},f(l,C)}function _(l){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},_(l)}function p(){return p=Object.assign||function(l){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(l[v]=g[v])}return l},p.apply(this,arguments)}function m(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var y=function(){function l(g){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=g.fetchSetup||i,this.controller=new self.AbortController,this.stats=new O.LoadStats}var C=l.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(v,L,A){var T=this,x=this.stats;if(x.loading.start)throw new Error("Loader can only be used once.");x.loading.start=self.performance.now();var h=a(v,this.controller.signal),u=A.onProgress,D=v.responseType==="arraybuffer",S=D?"byteLength":"length";this.context=v,this.config=L,this.callbacks=A,this.request=this.fetchSetup(v,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){T.abortInternal(),A.onTimeout(x,v,T.response)},L.timeout),self.fetch(this.request).then(function(w){if(T.response=T.loader=w,!w.ok){var b=w.status,K=w.statusText;throw new o(K||"fetch, bad network response",b,w)}return x.loading.first=Math.max(self.performance.now(),x.loading.start),x.total=parseInt(w.headers.get("Content-Length")||"0"),u&&Object(H.isFiniteNumber)(L.highWaterMark)?T.loadProgressively(w,x,v,L.highWaterMark,u):D?w.arrayBuffer():w.text()}).then(function(w){var b=T.response;self.clearTimeout(T.requestTimeout),x.loading.end=Math.max(self.performance.now(),x.loading.first),x.loaded=x.total=w[S];var K={url:b.url,data:w};u&&!Object(H.isFiniteNumber)(L.highWaterMark)&&u(x,v,w,b),A.onSuccess(K,x,v,b)}).catch(function(w){if(self.clearTimeout(T.requestTimeout),x.aborted)return;var b=w.code||0;A.onError({code:b,text:w.message},v,w.details)})},C.getCacheAge=function(){var v=null;if(this.response){var L=this.response.headers.get("age");v=L?parseFloat(L):null}return v},C.loadProgressively=function(v,L,A,T,x){T===void 0&&(T=0);var h=new I.default,u=v.body.getReader(),D=function S(){return u.read().then(function(w){if(w.done)return h.dataLength&&x(L,A,h.flush(),v),Promise.resolve(new ArrayBuffer(0));var b=w.value,K=b.length;return L.loaded+=K,K<T||h.dataLength?(h.push(b),h.dataLength>=T&&x(L,A,h.flush(),v)):x(L,A,b,v),S()}).catch(function(){return Promise.reject()})};return D()},l}();function a(l,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(p({},l.headers))};return l.rangeEnd&&g.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),g}function i(l,C){return new self.Request(l.url,C)}var o=function(l){j(C,l);function C(g,v,L){var A;return A=l.call(this,g)||this,A.code=void 0,A.details=void 0,A.code=v,A.details=L,A}return C}(N(Error));Y.default=y},"./src/utils/imsc1-ttml-parser.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"IMSC1_CODEC",function(){return c}),M.d(Y,"parseIMSC1",function(){return m});var H=M("./src/utils/mp4-tools.ts"),O=M("./src/utils/vttparser.ts"),I=M("./src/utils/vttcue.ts"),j=M("./src/demux/id3.ts"),N=M("./src/utils/timescale-conversion.ts"),P=M("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(T){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var u in h)Object.prototype.hasOwnProperty.call(h,u)&&(T[u]=h[u])}return T},R.apply(this,arguments)}var c="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,p={left:"start",center:"center",right:"end",start:"start",end:"end"};function m(T,x,h,u,D){var S=Object(H.findBox)(new Uint8Array(T),["mdat"]);if(S.length===0){D(new Error("Could not parse IMSC1 mdat"));return}var w=S[0],b=Object(j.utf8ArrayToStr)(new Uint8Array(T,w.start,w.end-w.start)),K=Object(N.toTimescaleFromScale)(x,1,h);try{u(y(b,K))}catch(X){D(X)}}function y(T,x){var h=new DOMParser,u=h.parseFromString(T,"text/xml"),D=u.getElementsByTagName("tt")[0];if(!D)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},w=Object.keys(S).reduce(function(V,W){return V[W]=D.getAttribute("ttp:"+W)||S[W],V},{}),b=D.getAttribute("xml:space")!=="preserve",K=i(a(D,"styling","style")),X=i(a(D,"layout","region")),Q=a(D,"body","[begin]");return[].map.call(Q,function(V){var W=o(V,b);if(!W||!V.hasAttribute("begin"))return null;var te=v(V.getAttribute("begin"),w),ue=v(V.getAttribute("dur"),w),ge=v(V.getAttribute("end"),w);if(te===null)throw g(V);if(ge===null){if(ue===null)throw g(V);ge=te+ue}var Oe=new I.default(te-x,ge-x,W);Oe.id=Object(P.generateCueId)(Oe.startTime,Oe.endTime,Oe.text);var qe=X[V.getAttribute("region")],Ke=K[V.getAttribute("style")];Oe.position=10,Oe.size=80;var Be=l(qe,Ke),Xe=Be.textAlign;if(Xe){var Fe=p[Xe];Fe&&(Oe.lineAlign=Fe),Oe.align=Xe}return R(Oe,Be),Oe}).filter(function(V){return V!==null})}function a(T,x,h){var u=T.getElementsByTagName(x)[0];return u?[].slice.call(u.querySelectorAll(h)):[]}function i(T){return T.reduce(function(x,h){var u=h.getAttribute("xml:id");return u&&(x[u]=h),x},{})}function o(T,x){return[].slice.call(T.childNodes).reduce(function(h,u,D){var S;return u.nodeName==="br"&&D?h+`
`:(S=u.childNodes)!==null&&S!==void 0&&S.length?o(u,x):x?h+u.textContent.trim().replace(/\s+/g," "):h+u.textContent},"")}function l(T,x){var h="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(D,S){var w=C(x,h,S)||C(T,h,S);return w&&(D[S]=w),D},{})}function C(T,x,h){return T.hasAttributeNS(x,h)?T.getAttributeNS(x,h):null}function g(T){return new Error("Could not parse ttml timestamp "+T)}function v(T,x){if(!T)return null;var h=Object(O.parseTimeStamp)(T);return h===null&&(f.test(T)?h=L(T,x):_.test(T)&&(h=A(T,x))),h}function L(T,x){var h=f.exec(T),u=(h[4]|0)+(h[5]|0)/x.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+u/x.frameRate}function A(T,x){var h=_.exec(T),u=Number(h[1]),D=h[2];switch(D){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/x.frameRate;case"t":return u/x.tickRate}return u}},"./src/utils/logger.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"enableLogs",function(){return P}),M.d(Y,"logger",function(){return R});var H=function(){},O={trace:H,debug:H,log:H,warn:H,info:H,error:H},I=O;function j(c){var f=self.console[c];return f?f.bind(self.console,"["+c+"] >"):H}function N(c){for(var f=arguments.length,_=new Array(f>1?f-1:0),p=1;p<f;p++)_[p-1]=arguments[p];_.forEach(function(m){I[m]=c[m]?c[m].bind(c):j(m)})}function P(c){if(self.console&&c===!0||typeof c=="object"){N(c,"debug","log","info","warn","error");try{I.log()}catch(f){I=O}}else I=O}var R=I},"./src/utils/mediakeys-helper.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"KeySystems",function(){return H}),M.d(Y,"requestMediaKeySystemAccess",function(){return O});var H;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(H||(H={}));var O=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"bin2str",function(){return N}),M.d(Y,"readUint16",function(){return P}),M.d(Y,"readUint32",function(){return R}),M.d(Y,"writeUint32",function(){return c}),M.d(Y,"findBox",function(){return f}),M.d(Y,"parseSegmentIndex",function(){return _}),M.d(Y,"parseInitSegment",function(){return p}),M.d(Y,"getStartDTS",function(){return m}),M.d(Y,"getDuration",function(){return y}),M.d(Y,"computeRawDurationFromSamples",function(){return a}),M.d(Y,"offsetStartDTS",function(){return i}),M.d(Y,"segmentValidRange",function(){return o}),M.d(Y,"appendUint8Array",function(){return l});var H=M("./src/utils/typed-array.ts"),O=M("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,j=[].push;function N(C){return String.fromCharCode.apply(null,C)}function P(C,g){"data"in C&&(g+=C.start,C=C.data);var v=C[g]<<8|C[g+1];return v<0?65536+v:v}function R(C,g){"data"in C&&(g+=C.start,C=C.data);var v=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return v<0?4294967296+v:v}function c(C,g,v){"data"in C&&(g+=C.start,C=C.data),C[g]=v>>24,C[g+1]=v>>16&255,C[g+2]=v>>8&255,C[g+3]=v&255}function f(C,g){var v=[];if(!g.length)return v;var L,A,T;"data"in C?(L=C.data,A=C.start,T=C.end):(L=C,A=0,T=L.byteLength);for(var x=A;x<T;){var h=R(L,x),u=N(L.subarray(x+4,x+8)),D=h>1?x+h:T;if(u===g[0])if(g.length===1)v.push({data:L,start:x+8,end:D});else{var S=f({data:L,start:x+8,end:D},g.slice(1));S.length&&j.apply(v,S)}x=D}return v}function _(C){var g=f(C,["moov"]),v=g[0],L=v?v.end:null,A=f(C,["sidx"]);if(!A||!A[0])return null;var T=[],x=A[0],h=x.data[0],u=h===0?8:16,D=R(x,u);u+=4;var S=0,w=0;h===0?u+=8:u+=16,u+=2;var b=x.end+w,K=P(x,u);u+=2;for(var X=0;X<K;X++){var Q=u,V=R(x,Q);Q+=4;var W=V&2147483647,te=(V&2147483648)>>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ue=R(x,Q);Q+=4,T.push({referenceSize:W,subsegmentDuration:ue,info:{duration:ue/D,start:b,end:b+W-1}}),b+=W,Q+=4,u=Q}return{earliestPresentationTime:S,timescale:D,version:h,referencesCount:K,references:T,moovEndOffset:L}}function p(C){for(var g=[],v=f(C,["moov","trak"]),L=0;L<v.length;L++){var A=v[L],T=f(A,["tkhd"])[0];if(T){var x=T.data[T.start],h=x===0?12:20,u=R(T,h),D=f(A,["mdia","mdhd"])[0];if(D){x=D.data[D.start],h=x===0?12:20;var S=R(D,h),w=f(A,["mdia","hdlr"])[0];if(w){var b=N(w.data.subarray(w.start+8,w.start+12)),K={soun:O.ElementaryStreamTypes.AUDIO,vide:O.ElementaryStreamTypes.VIDEO}[b];if(K){var X=f(A,["mdia","minf","stbl","stsd"])[0],Q=void 0;X&&(Q=N(X.data.subarray(X.start+12,X.start+16))),g[u]={timescale:S,type:K},g[K]={timescale:S,id:u,codec:Q}}}}}}var V=f(C,["moov","mvex","trex"]);return V.forEach(function(W){var te=R(W,4),ue=g[te];ue&&(ue.default={duration:R(W,12),flags:R(W,20)})}),g}function m(C,g){return f(g,["moof","traf"]).reduce(function(v,L){var A=f(L,["tfdt"])[0],T=A.data[A.start],x=f(L,["tfhd"]).reduce(function(h,u){var D=R(u,4),S=C[D];if(S){var w=R(A,4);T===1&&(w*=Math.pow(2,32),w+=R(A,8));var b=S.timescale||9e4,K=w/b;if(isFinite(K)&&(h===null||K<h))return K}return h},null);return x!==null&&isFinite(x)&&(v===null||x<v)?x:v},null)||0}function y(C,g){for(var v=0,L=0,A=0,T=f(C,["moof","traf"]),x=0;x<T.length;x++){var h=T[x],u=f(h,["tfhd"])[0],D=R(u,4),S=g[D];if(!S)continue;var w=S.default,b=R(u,0)|(w==null?void 0:w.flags),K=w==null?void 0:w.duration;b&8&&(b&2?K=R(u,12):K=R(u,8));for(var X=S.timescale||9e4,Q=f(h,["trun"]),V=0;V<Q.length;V++){if(K){var W=R(Q[V],4);v=K*W}else v=a(Q[V]);S.type===O.ElementaryStreamTypes.VIDEO?L+=v/X:S.type===O.ElementaryStreamTypes.AUDIO&&(A+=v/X)}}if(L===0&&A===0){var te=_(C);if(te!=null&&te.references)return te.references.reduce(function(ue,ge){return ue+ge.info.duration||0},0)}return L||A}function a(C){var g=R(C,0),v=8;g&1&&(v+=4),g&4&&(v+=4);for(var L=0,A=R(C,4),T=0;T<A;T++){if(g&256){var x=R(C,v);L+=x,v+=4}g&512&&(v+=4),g&1024&&(v+=4),g&2048&&(v+=4)}return L}function i(C,g,v){f(g,["moof","traf"]).forEach(function(L){f(L,["tfhd"]).forEach(function(A){var T=R(A,4),x=C[T];if(!x)return;var h=x.timescale||9e4;f(L,["tfdt"]).forEach(function(u){var D=u.data[u.start],S=R(u,4);if(D===0)c(u,4,S-v*h);else{S*=Math.pow(2,32),S+=R(u,8),S-=v*h,S=Math.max(S,0);var w=Math.floor(S/(I+1)),b=Math.floor(S%(I+1));c(u,4,w),c(u,8,b)}})})})}function o(C){var g={valid:null,remainder:null},v=f(C,["moof"]);if(v){if(v.length<2)return g.remainder=C,g}else return g;var L=v[v.length-1];return g.valid=Object(H.sliceUint8)(C,0,L.start-8),g.remainder=Object(H.sliceUint8)(C,L.start-8),g}function l(C,g){var v=new Uint8Array(C.length+g.length);return v.set(C),v.set(g,C.length),v}},"./src/utils/output-filter.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"default",function(){return H});var H=function(){function O(j,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=N}var I=O.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(N,P,R){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=P,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},O}()},"./src/utils/texttrack-utils.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"sendAddTrackEvent",function(){return O}),M.d(Y,"addCueToTrack",function(){return I}),M.d(Y,"clearCurrentCues",function(){return j}),M.d(Y,"removeCuesInRange",function(){return N}),M.d(Y,"getCuesInRange",function(){return R});var H=M("./src/utils/logger.ts");function O(c,f){var _;try{_=new Event("addtrack")}catch(p){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=c,f.dispatchEvent(_)}function I(c,f){var _=c.mode;if(_==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(f.id))try{if(c.addCue(f),!c.cues.getCueById(f.id))throw new Error("addCue is failed for: "+f)}catch(m){H.logger.debug("[texttrack-utils]: "+m);var p=new self.TextTrackCue(f.startTime,f.endTime,f.text);p.id=f.id,c.addCue(p)}_==="disabled"&&(c.mode=_)}function j(c){var f=c.mode;if(f==="disabled"&&(c.mode="hidden"),c.cues)for(var _=c.cues.length;_--;)c.removeCue(c.cues[_]);f==="disabled"&&(c.mode=f)}function N(c,f,_){var p=c.mode;if(p==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var m=R(c.cues,f,_),y=0;y<m.length;y++)c.removeCue(m[y]);p==="disabled"&&(c.mode=p)}function P(c,f){if(f<c[0].startTime)return 0;var _=c.length-1;if(f>c[_].endTime)return-1;for(var p=0,m=_;p<=m;){var y=Math.floor((m+p)/2);if(f<c[y].startTime)m=y-1;else if(f>c[y].startTime&&p<_)p=y+1;else return y}return c[p].startTime-f<f-c[m].startTime?p:m}function R(c,f,_){var p=[],m=P(c,f);if(m>-1)for(var y=m,a=c.length;y<a;y++){var i=c[y];if(i.startTime>=f&&i.endTime<=_)p.push(i);else if(i.startTime>_)return p}return p}},"./src/utils/time-ranges.ts":function(ie,Y,M){"use strict";M.r(Y);var H={toString:function(I){for(var j="",N=I.length,P=0;P<N;P++)j+="["+I.start(P).toFixed(3)+","+I.end(P).toFixed(3)+"]";return j}};Y.default=H},"./src/utils/timescale-conversion.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"toTimescaleFromBase",function(){return O}),M.d(Y,"toTimescaleFromScale",function(){return I}),M.d(Y,"toMsFromMpegTsClock",function(){return j}),M.d(Y,"toMpegTsClockFromTimescale",function(){return N});var H=9e4;function O(P,R,c,f){c===void 0&&(c=1),f===void 0&&(f=!1);var _=P*R*c;return f?Math.round(_):_}function I(P,R,c,f){return c===void 0&&(c=1),f===void 0&&(f=!1),O(P,R,1/c,f)}function j(P,R){return R===void 0&&(R=!1),O(P,1e3,1/H,R)}function N(P,R){return R===void 0&&(R=1),O(P,H,1/R)}},"./src/utils/typed-array.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"sliceUint8",function(){return H});function H(O,I,j){return Uint8Array.prototype.slice?O.slice(I,j):new Uint8Array(Array.prototype.slice.call(O,I,j))}},"./src/utils/vttcue.ts":function(ie,Y,M){"use strict";M.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],O=["start","middle","end","left","right"];function I(c,f){if(typeof f!="string")return!1;if(!Array.isArray(c))return!1;var _=f.toLowerCase();return~c.indexOf(_)?_:!1}function j(c){return I(H,c)}function N(c){return I(O,c)}function P(c){for(var f=arguments.length,_=new Array(f>1?f-1:0),p=1;p<f;p++)_[p-1]=arguments[p];for(var m=1;m<arguments.length;m++){var y=arguments[m];for(var a in y)c[a]=y[a]}return c}function R(c,f,_){var p=this,m={enumerable:!0};p.hasBeenReset=!1;var y="",a=!1,i=c,o=f,l=_,C=null,g="",v=!0,L="auto",A="start",T=50,x="middle",h=50,u="middle";Object.defineProperty(p,"id",P({},m,{get:function(){return y},set:function(S){y=""+S}})),Object.defineProperty(p,"pauseOnExit",P({},m,{get:function(){return a},set:function(S){a=!!S}})),Object.defineProperty(p,"startTime",P({},m,{get:function(){return i},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"endTime",P({},m,{get:function(){return o},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");o=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"text",P({},m,{get:function(){return l},set:function(S){l=""+S,this.hasBeenReset=!0}})),Object.defineProperty(p,"region",P({},m,{get:function(){return C},set:function(S){C=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"vertical",P({},m,{get:function(){return g},set:function(S){var w=j(S);if(w===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=w,this.hasBeenReset=!0}})),Object.defineProperty(p,"snapToLines",P({},m,{get:function(){return v},set:function(S){v=!!S,this.hasBeenReset=!0}})),Object.defineProperty(p,"line",P({},m,{get:function(){return L},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"lineAlign",P({},m,{get:function(){return A},set:function(S){var w=N(S);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");A=w,this.hasBeenReset=!0}})),Object.defineProperty(p,"position",P({},m,{get:function(){return T},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");T=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"positionAlign",P({},m,{get:function(){return x},set:function(S){var w=N(S);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");x=w,this.hasBeenReset=!0}})),Object.defineProperty(p,"size",P({},m,{get:function(){return h},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");h=S,this.hasBeenReset=!0}})),Object.defineProperty(p,"align",P({},m,{get:function(){return u},set:function(S){var w=N(S);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");u=w,this.hasBeenReset=!0}})),p.displayState=void 0}return R.prototype.getCueAsHTML=function(){var c=self.WebVTT;return c.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"parseTimeStamp",function(){return I}),M.d(Y,"fixLineBreaks",function(){return f}),M.d(Y,"VTTParser",function(){return _});var H=M("./src/utils/vttcue.ts"),O=function(){function p(){}var m=p.prototype;return m.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},p}();function I(p){function m(a,i,o,l){return(a|0)*3600+(i|0)*60+(o|0)+parseFloat(l||0)}var y=p.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?m(y[2],y[3],0,y[4]):m(y[1],y[2],y[3],y[4]):null}var j=function(){function p(){this.values=Object.create(null)}var m=p.prototype;return m.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},m.get=function(a,i,o){return o?this.has(a)?this.values[a]:i[o]:this.has(a)?this.values[a]:i},m.has=function(a){return a in this.values},m.alt=function(a,i,o){for(var l=0;l<o.length;++l)if(i===o[l]){this.set(a,i);break}},m.integer=function(a,i){/^-?\d+$/.test(i)&&this.set(a,parseInt(i,10))},m.percent=function(a,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var o=parseFloat(i);if(o>=0&&o<=100)return this.set(a,o),!0}return!1},p}();function N(p,m,y,a){var i=a?p.split(a):[p];for(var o in i){if(typeof i[o]!="string")continue;var l=i[o].split(y);if(l.length!==2)continue;var C=l[0],g=l[1];m(C,g)}}var P=new H.default(0,0,""),R=P.align==="middle"?"middle":"center";function c(p,m,y){var a=p;function i(){var C=I(p);if(C===null)throw new Error("Malformed timestamp: "+a);return p=p.replace(/^[^\sa-zA-Z-]+/,""),C}function o(C,g){var v=new j;N(C,function(T,x){var h;switch(T){case"region":for(var u=y.length-1;u>=0;u--)if(y[u].id===x){v.set(T,y[u].region);break}break;case"vertical":v.alt(T,x,["rl","lr"]);break;case"line":h=x.split(","),v.integer(T,h[0]),v.percent(T,h[0])&&v.set("snapToLines",!1),v.alt(T,h[0],["auto"]),h.length===2&&v.alt("lineAlign",h[1],["start",R,"end"]);break;case"position":h=x.split(","),v.percent(T,h[0]),h.length===2&&v.alt("positionAlign",h[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":v.percent(T,x);break;case"align":v.alt(T,x,["start",R,"end","left","right"]);break}},/:/,/\s/),g.region=v.get("region",null),g.vertical=v.get("vertical","");var L=v.get("line","auto");L==="auto"&&P.line===-1&&(L=-1),g.line=L,g.lineAlign=v.get("lineAlign","start"),g.snapToLines=v.get("snapToLines",!0),g.size=v.get("size",100),g.align=v.get("align",R);var A=v.get("position","auto");A==="auto"&&P.position===50&&(A=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=A}function l(){p=p.replace(/^\s+/,"")}if(l(),m.startTime=i(),l(),p.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);p=p.substr(3),l(),m.endTime=i(),l(),o(p,m)}function f(p){return p.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function p(){this.state="INITIAL",this.buffer="",this.decoder=new O,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var m=p.prototype;return m.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function o(){var A=i.buffer,T=0;for(A=f(A);T<A.length&&A[T]!=="\r"&&A[T]!==`
`;)++T;var x=A.substr(0,T);return A[T]==="\r"&&++T,A[T]===`
`&&++T,i.buffer=A.substr(T),x}function l(A){N(A,function(T,x){},/:/)}try{var C="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;C=o();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var v=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;v?v=!1:C=o();switch(i.state){case"HEADER":/:/.test(C)?l(C):C||(i.state="ID");continue;case"NOTE":C||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){i.state="NOTE";break}if(!C)continue;if(i.cue=new H.default(0,0,""),i.state="CUE",C.indexOf("-->")===-1){i.cue.id=C;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{c(C,i.cue,i.regionList)}catch(A){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var L=C.indexOf("-->")!==-1;if(!C||L&&(v=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
`),i.cue.text+=C}continue;case"BADCUE":C||(i.state="ID")}}}catch(A){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},m.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},p}()},"./src/utils/webvtt-parser.ts":function(ie,Y,M){"use strict";M.r(Y),M.d(Y,"generateCueId",function(){return _}),M.d(Y,"parseWebVTT",function(){return m});var H=M("./src/polyfills/number.ts"),O=M("./src/utils/vttparser.ts"),I=M("./src/demux/id3.ts"),j=M("./src/utils/timescale-conversion.ts"),N=M("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,R=function(a,i,o){return o===void 0&&(o=0),a.substr(o,i.length)===i},c=function(a){var i=parseInt(a.substr(-3)),o=parseInt(a.substr(-6,2)),l=parseInt(a.substr(-9,2)),C=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(i)||!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*o,i+=60*1e3*l,i+=60*60*1e3*C,i},f=function(a){for(var i=5381,o=a.length;o;)i=i*33^a.charCodeAt(--o);return(i>>>0).toString()};function _(y,a,i){return f(y.toString())+f(a.toString())+f(i)}var p=function(a,i,o){var l=a[i],C=a[l.prevCC];if(!C||!C.new&&l.new){a.ccOffset=a.presentationOffset=l.start,l.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;a.ccOffset+=l.start-C.start,l.new=!1,l=C,C=a[l.prevCC]}a.presentationOffset=o};function m(y,a,i,o,l,C,g,v){var L=new O.VTTParser,A=Object(I.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(P,`
`).split(`
`),T=[],x=Object(j.toMpegTsClockFromTimescale)(a,i),h="00:00.000",u=0,D=0,S,w=!0,b=!1;L.oncue=function(K){var X=o[l],Q=o.ccOffset,V=(u-x)/9e4;if(X!=null&&X.new&&(D!==void 0?Q=o.ccOffset=X.start:p(o,l,V)),V&&(Q=V-o.presentationOffset),b){var W=K.endTime-K.startTime,te=Object(N.normalizePts)((K.startTime+Q-D)*9e4,C*9e4)/9e4;K.startTime=te,K.endTime=te+W}var ue=K.text.trim();K.text=decodeURIComponent(encodeURIComponent(ue)),K.id||(K.id=_(K.startTime,K.endTime,ue)),K.endTime>0&&T.push(K)},L.onparsingerror=function(K){S=K},L.onflush=function(){if(S){v(S);return}g(T)},A.forEach(function(K){if(w)if(R(K,"X-TIMESTAMP-MAP=")){w=!1,b=!0,K.substr(16).split(",").forEach(function(X){R(X,"LOCAL:")?h=X.substr(6):R(X,"MPEGTS:")&&(u=parseInt(X.substr(7)))});try{D=c(h)/1e3}catch(X){b=!1,S=X}return}else K===""&&(w=!1);L.parse(K+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(ie,Y,M){"use strict";M.r(Y);var H=M("./src/utils/logger.ts"),O=M("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,j=function(){function N(R){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=R?R.xhrSetup:null,this.stats=new O.LoadStats,this.retryDelay=0}var P=N.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},P.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(c,f,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=f,this.callbacks=_,this.retryDelay=f.retryDelay,this.loadInternal()},P.loadInternal=function(){var c=this.config,f=this.context;if(!c)return;var _=this.loader=new self.XMLHttpRequest,p=this.stats;p.loading.first=0,p.loaded=0;var m=this.xhrSetup;try{if(m)try{m(_,f.url)}catch(i){_.open("GET",f.url,!0),m(_,f.url)}_.readyState||_.open("GET",f.url,!0);var y=this.context.headers;if(y)for(var a in y)_.setRequestHeader(a,y[a])}catch(i){this.callbacks.onError({code:_.status,text:i.message},f,_);return}f.rangeEnd&&_.setRequestHeader("Range","bytes="+f.rangeStart+"-"+(f.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=f.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),_.send()},P.readystatechange=function(){var c=this.context,f=this.loader,_=this.stats;if(!c||!f)return;var p=f.readyState,m=this.config;if(_.aborted)return;if(p>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),p===4){f.onreadystatechange=null,f.onprogress=null;var y=f.status;if(y>=200&&y<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var a,i;if(c.responseType==="arraybuffer"?(a=f.response,i=a.byteLength):(a=f.responseText,i=a.length),_.loaded=_.total=i,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(_,c,a,f),!this.callbacks)return;var l={url:f.responseURL,data:a};this.callbacks.onSuccess(l,_,c,f)}else _.retry>=m.maxRetry||y>=400&&y<499?(H.logger.error(y+" while loading "+c.url),this.callbacks.onError({code:y,text:f.statusText},c,f)):(H.logger.warn(y+" while loading "+c.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,m.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout)},P.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(c){var f=this.stats;f.loaded=c.loaded,c.lengthComputable&&(f.total=c.total)},P.getCacheAge=function(){var c=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");c=f?parseFloat(f):null}return c},N}();Y.default=j}}).default})},vHTk:function(Wt,Me,$){Wt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},xvzu:function(Wt,Me,$){Wt.exports={flex_box_center:"flex_box_center___11Yx1",flex_space_between:"flex_space_between___3B8wg",flex_box_vertical_center:"flex_box_vertical_center___1cm8r",flex_box_center_end:"flex_box_center_end___2h7Wz",flex_box_column:"flex_box_column___1vJbd",wrap:"wrap___30mNN",modal:"modal___39YWi",titleWrap:"titleWrap___25lJO",required:"required___2_KP9",title:"title___dFjtB",colorGray:"colorGray___3RoHj",choiceWrap:"choiceWrap___14CFD",answer:"answer___10oFr",activeAnswer:"activeAnswer___S76uT",deleteIcon:"deleteIcon___kKaJg",addIcon:"addIcon___3w3u_",editorWrap:"editorWrap___3DrnO",htmlWrap:"htmlWrap___1tGnP",radio:"radio___24YhJ",color333:"color333___1O71o",color999:"color999___xHfER",questionType:"questionType___22Z7J",questionChoices:"questionChoices____Unas"}}}]);