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__Paths__New.5b20ec99.asyn...

367 lines
1.0 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[205,6,7,20],{"+NIl":function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){"use strict";he.defineMode("stex",function(Y,O){"use strict";function Z(A,x){A.cmdState.push(x)}function U(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function I(A){var x=A.cmdState.pop();x&&x.closeBracket()}function K(A){for(var x=A.cmdState,y=x.length-1;y>=0;y--){var h=x[y];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function B(A,x,y){return function(){this.name=A,this.bracketNo=0,this.style=x,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 M={};M.importmodule=B("importmodule","tag",["string","builtin"]),M.documentclass=B("documentclass","tag",["","atom"]),M.usepackage=B("usepackage","tag",["atom"]),M.begin=B("begin","tag",["atom"]),M.end=B("end","tag",["atom"]),M.label=B("label","tag",["atom"]),M.ref=B("ref","tag",["atom"]),M.eqref=B("eqref","tag",["atom"]),M.cite=B("cite","tag",["atom"]),M.bibitem=B("bibitem","tag",["atom"]),M.Bibitem=B("Bibitem","tag",["atom"]),M.RBibitem=B("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(A,x){A.f=x}function E(A,x){var y;if(A.match(/^\\[a-zA-Z@]+/)){var h=A.current().slice(1);return y=M.hasOwnProperty(h)?M[h]:M.DEFAULT,y=new y,Z(x,y),R(x,_),y.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return R(x,function(l,d){return L(l,d,"\\]")}),"keyword";if(A.match("\\("))return R(x,function(l,d){return L(l,d,"\\)")}),"keyword";if(A.match("$$"))return R(x,function(l,d){return L(l,d,"$$")}),"keyword";if(A.match("$"))return R(x,function(l,d){return L(l,d,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=U(x),y)y.closeBracket(o),R(x,_);else return"error";return"bracket"}else return o=="{"||o=="["?(y=M.DEFAULT,y=new y,Z(x,y),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),y=K(x),y.name=="begin"&&(y.argument=A.current()),y.styleIdentifier())}function L(A,x,y){if(A.eatSpace())return null;if(y&&A.match(y))return R(x,E),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=A.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(A.skipToEnd(),"comment"):"error"}function _(A,x){var y=A.peek(),h;return y=="{"||y=="["?(h=U(x),h.openBracket(y),A.eat(y),R(x,E),"bracket"):/[ \t\r]/.test(y)?(A.eat(y),null):(R(x,E),I(x),E(A,x))}return{startState:function(){var A=O.inMathMode?function(x,y){return L(x,y)}:E;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,x){return x.f(A,x)},blankLine:function(A){A.f=E,A.cmdState.length=0},lineComment:"%"}}),he.defineMIME("text/x-stex","stex"),he.defineMIME("text/x-latex","stex")})},"19Vz":function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){he.defineOption("placeholder","",function(B,M,R){var E=R&&R!=he.Init;if(M&&!E)B.on("blur",U),B.on("change",I),B.on("swapDoc",I),he.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Z(B)}),I(B);else if(!M&&E){B.off("blur",U),B.off("change",I),B.off("swapDoc",I),he.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),Y(B);var L=B.getWrapperElement();L.className=L.className.replace(" CodeMirror-empty","")}M&&!B.hasFocus()&&U(B)});function Y(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function O(B){Y(B);var M=B.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=B.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var R=B.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),M.appendChild(R),B.display.lineSpace.insertBefore(M,B.display.lineSpace.firstChild)}function Z(B){setTimeout(function(){var M=!1,R=B.getInputField();R.nodeName=="TEXTAREA"?M=!R.value:B.lineCount()==1&&(M=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),M?O(B):Y(B)},20)}function U(B){K(B)&&O(B)}function I(B){var M=B.getWrapperElement(),R=K(B);M.className=M.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(B):Y(B)}function K(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){"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},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};he.defineMode("xml",function(Z,U){var I=Z.indentUnit,K={},B=U.htmlMode?Y:O;for(var M in B)K[M]=B[M];for(var M in U)K[M]=U[M];var R,E;function L(a,T){function v(j){return T.tokenize=j,j(a,T)}var C=a.next();if(C=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(x("atom","]]>")):null:a.match("--")?v(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),T.tokenize=x("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",T.tokenize=_,"tag bracket");if(C=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}L.isInText=!0;function _(a,T){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return T.tokenize=L,R=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return R="equals",null;if(v=="<"){T.tokenize=L,T.state=d,T.tagName=T.tagStart=null;var C=T.tokenize(a,T);return C?C+" tag error":"tag error"}else return/[\'\"]/.test(v)?(T.tokenize=A(v),T.stringStartCol=a.column(),T.tokenize(a,T)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var T=function(v,C){for(;!v.eol();)if(v.next()==a){C.tokenize=_;break}return"string"};return T.isInAttribute=!0,T}function x(a,T){return function(v,C){for(;!v.eol();){if(v.match(T)){C.tokenize=L;break}v.next()}return a}}function y(a){return function(T,v){for(var C;(C=T.next())!=null;){if(C=="<")return v.tokenize=y(a+1),v.tokenize(T,v);if(C==">")if(a==1){v.tokenize=L;break}else return v.tokenize=y(a-1),v.tokenize(T,v)}return"meta"}}function h(a,T,v){this.prev=a.context,this.tagName=T,this.indent=a.indented,this.startOfLine=v,(K.doNotIndent.hasOwnProperty(T)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,T){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!K.contextGrabbers.hasOwnProperty(v)||!K.contextGrabbers[v].hasOwnProperty(T))return;o(a)}}function d(a,T,v){return a=="openTag"?(v.tagStart=T.column(),S):a=="closeTag"?g:d}function S(a,T,v){return a=="word"?(v.tagName=T.current(),E="tag",b):K.allowMissingTagName&&a=="endTag"?(E="tag bracket",b(a,T,v)):(E="error",S)}function g(a,T,v){if(a=="word"){var C=T.current();return v.context&&v.context.tagName!=C&&K.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==C||K.matchClosing===!1?(E="tag",p):(E="tag error",w)}else return K.allowMissingTagName&&a=="endTag"?(E="tag bracket",p(a,T,v)):(E="error",w)}function p(a,T,v){return a!="endTag"?(E="error",p):(o(v),d)}function w(a,T,v){return E="error",p(a,T,v)}function b(a,T,v){if(a=="word")return E="attribute",u;if(a=="endTag"||a=="selfcloseTag"){var C=v.tagName,D=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(C)?l(v,C):(l(v,C),v.context=new h(v,C,D==v.indented)),d}return E="error",b}function u(a,T,v){return a=="equals"?f:(K.allowMissing||(E="error"),b(a,T,v))}function f(a,T,v){return a=="string"?s:a=="word"&&K.allowUnquoted?(E="string",b):(E="error",b(a,T,v))}function s(a,T,v){return a=="string"?s:b(a,T,v)}return{startState:function(a){var T={tokenize:L,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(T.baseIndent=a),T},token:function(a,T){if(!T.tagName&&a.sol()&&(T.indented=a.indentation()),a.eatSpace())return null;R=null;var v=T.tokenize(a,T);return(v||R)&&v!="comment"&&(E=null,T.state=T.state(R||v,a,T),E&&(v=E=="error"?v+" error":E)),v},indent:function(a,T,v){var C=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(C&&C.noIndent)return he.Pass;if(a.tokenize!=_&&a.tokenize!=L)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return K.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var D=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(D&&D[1])for(;C;)if(C.tagName==D[2]){C=C.prev;break}else if(K.implicitlyClosed.hasOwnProperty(C.tagName))C=C.prev;else break;else if(D)for(;C;){var j=K.contextGrabbers[C.tagName];if(j&&j.hasOwnProperty(D[2]))C=C.prev;else break}for(;C&&C.prev&&!C.startOfLine;)C=C.prev;return C?C.indent+I:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var T=[],v=a.context;v;v=v.prev)v.tagName&&T.push(v.tagName);return T.reverse()}}}),he.defineMIME("text/xml","xml"),he.defineMIME("application/xml","xml"),he.mimeModes.hasOwnProperty("text/html")||he.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(Et,tt,ie){"use strict";var he=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 O(){if(!he)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return he(Y)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(_){return typeof _=="string"&&Z.test(_)}for(var I=U,K=[],B=0;B<256;++B)K.push((B+256).toString(16).substr(1));function M(_){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(K[_[A+0]]+K[_[A+1]]+K[_[A+2]]+K[_[A+3]]+"-"+K[_[A+4]]+K[_[A+5]]+"-"+K[_[A+6]]+K[_[A+7]]+"-"+K[_[A+8]]+K[_[A+9]]+"-"+K[_[A+10]]+K[_[A+11]]+K[_[A+12]]+K[_[A+13]]+K[_[A+14]]+K[_[A+15]]).toLowerCase();if(!I(x))throw TypeError("Stringified UUID is invalid");return x}var R=M;function E(_,A,x){_=_||{};var y=_.random||(_.rng||O)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,A){x=x||0;for(var h=0;h<16;++h)A[x+h]=y[h];return A}return R(y)}var L=tt.a=E},"7ahc":function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return S});var he=ie("k1fw"),Y=ie("0Owb"),O=ie("+L6B"),Z=ie("2/Rp"),U=ie("y8nQ"),I=ie("Vl3Y"),K=ie("tJVT"),B=ie("OaEy"),M=ie("2fM7"),R=ie("q1tI"),E=ie.n(R),L=ie("VrN/"),_=ie.n(L),A=ie("p77/"),x=ie.n(A),y=ie("c5Ni"),h=ie.n(y),o=M.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};tt.b=function(g){var p=g.callback,w=g.onCancel,b=Object(R.useState)("python"),u=Object(K.a)(b,2),f=u[0],s=u[1];function a(v){s(d[v][1])}function T(v){p(v)}return E.a.createElement(I.a,Object(Y.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(M.a,{onChange:a},Object.keys(d).map(function(v){return E.a.createElement(o,{key:v,value:v},d[v][0])}))),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(S,{mode:f})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(Z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(g){var p=g.value,w=g.onChange,b=g.mode,u=g.options,f=u===void 0?{}:u,s=Object(R.useRef)(),a=Object(R.useState)(),T=Object(K.a)(a,2),v=T[0],C=T[1];return Object(R.useEffect)(function(){if(v){function D(j){var z=j.getValue();w&&w(z)}return v.on("change",D),function(){v.off("change",D)}}},[v,w]),Object(R.useEffect)(function(){v&&v.setOption("mode",b)},[v,b]),Object(R.useEffect)(function(){v&&((p!==v.getValue()||p==="")&&setTimeout(function(){v.setValue(p||" ")},300))},[v,p]),Object(R.useEffect)(function(){if(s.current&&!v){var D=_.a.fromTextArea(s.current,Object(he.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));C(D)}},[s.current,v]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:s}))}},"7ixt":function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return O});var he={adjustX:1,adjustY:1},Y=[0,0],O={left:{points:["cr","cl"],overflow:he,offset:[-4,0],targetOffset:Y},right:{points:["cl","cr"],overflow:he,offset:[4,0],targetOffset:Y},top:{points:["bc","tc"],overflow:he,offset:[0,-4],targetOffset:Y},bottom:{points:["tc","bc"],overflow:he,offset:[0,4],targetOffset:Y},topLeft:{points:["bl","tl"],overflow:he,offset:[0,-4],targetOffset:Y},leftTop:{points:["tr","tl"],overflow:he,offset:[-4,0],targetOffset:Y},topRight:{points:["br","tr"],overflow:he,offset:[0,-4],targetOffset:Y},rightTop:{points:["tl","tr"],overflow:he,offset:[4,0],targetOffset:Y},bottomRight:{points:["tr","br"],overflow:he,offset:[0,4],targetOffset:Y},rightBottom:{points:["bl","br"],overflow:he,offset:[4,0],targetOffset:Y},bottomLeft:{points:["tl","bl"],overflow:he,offset:[0,4],targetOffset:Y},leftBottom:{points:["br","bl"],overflow:he,offset:[-4,0],targetOffset:Y}},Z=O},"815F":function(Et,tt,ie){"use strict";ie.d(tt,"e",function(){return K}),ie.d(tt,"c",function(){return M}),ie.d(tt,"d",function(){return R}),ie.d(tt,"a",function(){return L}),ie.d(tt,"f",function(){return _}),ie.d(tt,"b",function(){return A});var he=ie("KQm4"),Y=ie("VTBJ"),O=ie("Ff2n"),Z=ie("Zm9Q"),U=ie("Kwbf"),I=ie("OZM5");function K(x,y){return x!=null?x:y}function B(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=new Map;function h(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(o||[]).forEach(function(d){var S=d.key,g=d.children;Object(U.a)(S!=null,"Tree node must have a certain key: [".concat(l).concat(S,"]"));var p=String(S);Object(U.a)(!y.has(p)||S===null||S===void 0,"Same 'key' exist in the Tree: ".concat(p)),y.set(p,!0),h(g,"".concat(l).concat(p," > "))})}h(x)}function M(x){function y(h){var o=Object(Z.a)(h);return o.map(function(l){if(!Object(I.i)(l))return Object(U.a)(!l,"Tree/TreeNode can only accept TreeNode as children."),null;var d=l.key,S=l.props,g=S.children,p=Object(O.a)(S,["children"]),w=Object(Y.a)({key:d},p),b=y(g);return b.length&&(w.children=b),w}).filter(function(l){return l})}return y(x)}function R(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(y===!0?[]:y),o=[];function l(d){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return d.map(function(g,p){var w=Object(I.h)(S?S.pos:"0",p),b=K(g.key,w),u=Object(Y.a)(Object(Y.a)({},g),{},{parent:S,pos:w,children:null,data:g,isStart:[].concat(Object(he.a)(S?S.isStart:[]),[p===0]),isEnd:[].concat(Object(he.a)(S?S.isEnd:[]),[p===d.length-1])});return o.push(u),y===!0||h.has(b)?u.children=l(g.children||[],u):u.children=[],u})}return l(x),o}function E(x,y,h){var o;h?typeof h=="string"?o=function(S){return S[h]}:typeof h=="function"&&(o=function(S){return h(S)}):o=function(S,g){return K(S.key,g)};function l(d,S,g){var p=d?d.children:x,w=d?Object(I.h)(g.pos,S):"0";if(d){var b=o(d,w),u={node:d,index:S,pos:w,key:b,parentPos:g.node?g.pos:null,level:g.level+1};y(u)}p&&p.forEach(function(f,s){l(f,s,{node:d,pos:w,level:g?g.level+1:-1})})}l(null)}function L(x){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=y.initWrapper,o=y.processEntity,l=y.onProcessFinished,d=arguments.length>2?arguments[2]:void 0,S={},g={},p={posEntities:S,keyEntities:g};return h&&(p=h(p)||p),E(x,function(w){var b=w.node,u=w.index,f=w.pos,s=w.key,a=w.parentPos,T=w.level,v={node:b,index:u,key:s,pos:f,level:T},C=K(s,f);S[f]=v,g[C]=v,v.parent=S[a],v.parent&&(v.parent.children=v.parent.children||[],v.parent.children.push(v)),o&&o(v,p)},d),l&&l(p),p}function _(x,y){var h=y.expandedKeys,o=y.selectedKeys,l=y.loadedKeys,d=y.loadingKeys,S=y.checkedKeys,g=y.halfCheckedKeys,p=y.dragOverNodeKey,w=y.dropPosition,b=y.keyEntities,u=b[x],f={eventKey:x,expanded:h.indexOf(x)!==-1,selected:o.indexOf(x)!==-1,loaded:l.indexOf(x)!==-1,loading:d.indexOf(x)!==-1,checked:S.indexOf(x)!==-1,halfChecked:g.indexOf(x)!==-1,pos:String(u?u.pos:""),dragOver:p===x&&w===0,dragOverGapTop:p===x&&w===-1,dragOverGapBottom:p===x&&w===1};return f}function A(x){var y=x.data,h=x.expanded,o=x.selected,l=x.checked,d=x.loaded,S=x.loading,g=x.halfChecked,p=x.dragOver,w=x.dragOverGapTop,b=x.dragOverGapBottom,u=x.pos,f=x.active,s=Object(Y.a)(Object(Y.a)({},y),{},{expanded:h,selected:o,checked:l,loaded:d,loading:S,halfChecked:g,dragOver:p,dragOverGapTop:w,dragOverGapBottom:b,pos:u,active:f});return"props"in s||Object.defineProperty(s,"props",{get:function(){return Object(U.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),x}}),s}},"8EBN":function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){"use strict";he.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<he.modeInfo.length;Y++){var O=he.modeInfo[Y];O.mimes&&(O.mime=O.mimes[0])}he.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var U=0;U<he.modeInfo.length;U++){var I=he.modeInfo[U];if(I.mime==Z)return I;if(I.mimes){for(var K=0;K<I.mimes.length;K++)if(I.mimes[K]==Z)return I}}if(/\+xml$/.test(Z))return he.findModeByMIME("application/xml");if(/\+json$/.test(Z))return he.findModeByMIME("application/json")},he.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var U=0;U<he.modeInfo.length;U++){var I=he.modeInfo[U];if(I.ext){for(var K=0;K<I.ext.length;K++)if(I.ext[K]==Z)return I}}},he.findModeByFileName=function(Z){for(var U=0;U<he.modeInfo.length;U++){var I=he.modeInfo[U];if(I.file&&I.file.test(Z))return I}var K=Z.lastIndexOf("."),B=K>-1&&Z.substring(K+1,Z.length);if(B)return he.findModeByExtension(B)},he.findModeByName=function(Z){Z=Z.toLowerCase();for(var U=0;U<he.modeInfo.length;U++){var I=he.modeInfo[U];if(I.name.toLowerCase()==Z)return I;if(I.alias){for(var K=0;K<I.alias.length;K++)if(I.alias[K].toLowerCase()==Z)return I}}}})},"8Jsi":function(Et,tt,ie){"use strict";ie.d(tt,"d",function(){return a}),ie.d(tt,"a",function(){return oe}),ie.d(tt,"b",function(){return ke}),ie.d(tt,"c",function(){return fe});var he=ie("1OyB"),Y=ie("vuIU"),O=ie("Ji7U"),Z=ie("LK+K"),U=ie("KQm4"),I=ie("U8pU"),K=ie("ODXe"),B=ie("VTBJ"),M=ie("q1tI"),R=ie("qNPg"),E=ie("2Qr1"),L=ie("815F"),_=ie("NvD2"),A=ie("wPlo"),x=ie("6cGi"),y=ie("Kwbf"),h=ie("4IlW"),o=ie("YrtM"),l=ie("fAei"),d=M.createContext(null);function S(Oe,Fe){if(!Oe)return!0;var je=Oe.data,Ge=je.disabled,Ve=je.disableCheckbox;switch(Fe){case"select":return Ge;case"checkbox":return Ge||Ve}return!1}function g(Oe,Fe){var je=M.useCallback(function(Ve){var ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,Qe=Oe.get(Ve);return!Re&&S(Qe,ze)?null:Qe},[Oe]),Ge=M.useCallback(function(Ve){var ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,Qe=Fe.get(Ve);return!Re&&S(Qe,ze)?null:Qe},[Fe]);return[je,Ge]}function p(Oe){return M.useMemo(function(){var Fe=new Map,je=new Map;return Oe.forEach(function(Ge){Fe.set(Ge.key,Ge),je.set(Ge.data.value,Ge)}),[Fe,je]},[Oe])}var w={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},b=function(Fe,je){var Ge=Fe.prefixCls,Ve=Fe.height,ze=Fe.itemHeight,Re=Fe.virtual,Qe=Fe.options,Ye=Fe.flattenOptions,Pe=Fe.multiple,We=Fe.searchValue,Se=Fe.onSelect,ye=Fe.onToggleOpen,xe=Fe.open,le=Fe.notFoundContent,ue=Fe.onMouseEnter,me=M.useContext(d),Ee=me.checkable,we=me.checkedKeys,Ie=me.halfCheckedKeys,$e=me.treeExpandedKeys,at=me.treeDefaultExpandAll,ht=me.treeDefaultExpandedKeys,ut=me.onTreeExpand,xt=me.treeIcon,Ct=me.showTreeIcon,st=me.switcherIcon,Mt=me.treeLine,Lt=me.treeNodeFilterProp,kt=me.loadData,Dt=me.treeLoadedKeys,Tt=me.treeMotion,Ut=me.onTreeLoad,Qt=M.useRef(),yt=Object(o.a)(function(){return Qe},[xe,Qe],function(lt,Xe){return Xe[0]&&lt[1]!==Xe[1]}),pr=p(Ye),Bt=Object(K.a)(pr,2),tr=Bt[0],ur=Bt[1],nr=g(tr,ur),vr=Object(K.a)(nr,2),Nt=vr[0],ft=vr[1],sr=M.useMemo(function(){return we.map(function(lt){var Xe=ft(lt);return Xe?Xe.key:null})},[we]),Tr=M.useMemo(function(){return Ee?{checked:sr,halfChecked:Ie}:null},[sr,Ie,Ee]);M.useEffect(function(){if(xe&&!Pe&&sr.length){var lt;(lt=Qt.current)===null||lt===void 0||lt.scrollTo({key:sr[0]})}},[xe]);var gr=String(We).toLowerCase(),Pt=function(Xe){return gr?String(Xe[Lt]).toLowerCase().includes(gr):!1},yr=M.useState(ht),dr=Object(K.a)(yr,2),qr=dr[0],qe=dr[1],wt=M.useState(null),zr=Object(K.a)(wt,2),Ir=zr[0],Zr=zr[1],Wr=M.useMemo(function(){return $e?Object(U.a)($e):We?Ir:qr},[qr,Ir,gr,$e]);M.useEffect(function(){We&&Zr(Ye.map(function(lt){return lt.key}))},[We]);var G=function(Xe){qe(Xe),Zr(Xe),ut&&ut(Xe)},c=function(Xe){Xe.preventDefault()},m=function(Xe,pt){var mt=pt.node.key,It=Nt(mt,Ee?"checkbox":"select");It!==null&&Se(It.data.value,{selected:!we.includes(It.data.value)}),Pe||ye(!1)},F=M.useState(null),q=Object(K.a)(F,2),H=q[0],Ce=q[1],Ze=Nt(H);if(M.useImperativeHandle(je,function(){return{onKeyDown:function(Xe){var pt,mt=Xe.which;switch(mt){case h.a.UP:case h.a.DOWN:case h.a.LEFT:case h.a.RIGHT:(pt=Qt.current)===null||pt===void 0||pt.onKeyDown(Xe);break;case h.a.ENTER:{Ze!==null&&m(null,{node:{key:H},selected:!we.includes(Ze.data.value)});break}case h.a.ESC:ye(!1)}},onKeyUp:function(){}}}),yt.length===0)return M.createElement("div",{role:"listbox",className:"".concat(Ge,"-empty"),onMouseDown:c},le);var nt={};return Dt&&(nt.loadedKeys=Dt),Wr&&(nt.expandedKeys=Wr),M.createElement("div",{onMouseDown:c,onMouseEnter:ue},Ze&&xe&&M.createElement("span",{style:w,"aria-live":"assertive"},Ze.data.value),M.createElement(l.b,Object.assign({ref:Qt,focusable:!1,prefixCls:"".concat(Ge,"-tree"),treeData:yt,height:Ve,itemHeight:ze,virtual:Re,multiple:Pe,icon:xt,showIcon:Ct,switcherIcon:st,showLine:Mt,loadData:We?null:kt,motion:Tt,checkable:Ee,checkStrictly:!0,checkedKeys:Tr,selectedKeys:Ee?[]:sr,defaultExpandAll:at},nt,{onActiveChange:Ce,onSelect:m,onCheck:m,onExpand:G,onLoad:Ut,filterTreeNode:Pt})))},u=M.forwardRef(b);u.displayName="OptionList";var f=u,s=function(){return null},a=s,T=ie("Ff2n"),v=ie("Zm9Q");function C(Oe){return Object(v.a)(Oe).map(function(Fe){if(!M.isValidElement(Fe)||!Fe.type)return null;var je=Fe.key,Ge=Fe.props,Ve=Ge.children,ze=Ge.value,Re=Object(T.a)(Ge,["children","value"]),Qe=Object(B.a)({key:je,value:ze},Re),Ye=C(Ve);return Ye.length&&(Qe.children=Ye),Qe}).filter(function(Fe){return Fe})}function D(Oe){if(!Oe)return Oe;var Fe=Object(B.a)({},Oe);return"props"in Fe||Object.defineProperty(Fe,"props",{get:function(){return Object(y.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),Fe}}),Fe}function j(Oe,Fe,je,Ge,Ve){var ze=null,Re=null;function Qe(){function Ye(Pe){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Pe.map(function(ye,xe){var le="".concat(We,"-").concat(xe),ue=je.includes(ye.value),me=Ye(ye.children||[],le,ue),Ee=M.createElement(a,Object.assign({},ye),me.map(function(Ie){return Ie.node}));if(Fe===ye.value&&(ze=Ee),ue){var we={pos:le,node:Ee,children:me};return Se||Re.push(we),we}return null}).filter(function(ye){return ye})}Re||(Re=[],Ye(Ge),Re.sort(function(Pe,We){var Se=Pe.node.props.value,ye=We.node.props.value,xe=je.indexOf(Se),le=je.indexOf(ye);return xe-le}))}Object.defineProperty(Oe,"triggerNode",{get:function(){return Object(y.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Qe(),ze}}),Object.defineProperty(Oe,"allCheckedNodes",{get:function(){return Object(y.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Qe(),Ve?Re:Re.map(function(Pe){var We=Pe.node;return We})}})}function z(Oe){return Array.isArray(Oe)?Oe:Oe!==void 0?[Oe]:[]}function V(Oe,Fe){var je=new Map;return Fe.forEach(function(Ge){var Ve=Ge.data;je.set(Ve.value,Ve)}),Oe.map(function(Ge){return D(je.get(Ge))})}function P(Oe,Fe){var je=V([Oe],Fe)[0];return je?je.disabled:!1}function N(Oe){return Oe.disabled||Oe.disableCheckbox||Oe.checkable===!1}function $(Oe){for(var Fe=Oe.parent,je=0,Ge=Fe;Ge;)Ge=Ge.parent,je+=1;return je}function re(Oe){function Fe(Ge){return(Ge||[]).map(function(Ve){var ze=Ve.value,Re=Ve.key,Qe=Ve.children,Ye=Object(B.a)(Object(B.a)({},Ve),{},{key:"key"in Ve?Re:ze});return Qe&&(Ye.children=Fe(Qe)),Ye})}var je=Object(L.d)(Fe(Oe),!0);return je.map(function(Ge){return{key:Ge.data.key,data:Ge.data,level:$(Ge)}})}function pe(Oe){return function(Fe,je){var Ge=je[Oe];return String(Ge).toLowerCase().includes(String(Fe).toLowerCase())}}function ve(Oe,Fe,je){var Ge=je.optionFilterProp,Ve=je.filterOption;if(Ve===!1)return Fe;var ze;typeof Ve=="function"?ze=Ve:ze=pe(Ge);function Re(Qe){var Ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Qe.map(function(Pe){var We=Pe.children,Se=Ye||ze(Oe,D(Pe)),ye=Re(We||[],Se);return Se||ye.length?Object(B.a)(Object(B.a)({},Pe),{},{children:ye}):null}).filter(function(Pe){return Pe})}return Re(Fe)}function Ae(Oe,Fe,je,Ge){var Ve=new Map;return z(Fe).forEach(function(ze){ze&&Object(I.a)(ze)==="object"&&"value"in ze&&Ve.set(ze.value,ze)}),Oe.map(function(ze){var Re={value:ze},Qe=je(ze,"select",!0),Ye=Qe?Ge(Qe.data):ze;if(Ve.has(ze)){var Pe=Ve.get(ze);Re.label="label"in Pe?Pe.label:Ye,"halfChecked"in Pe&&(Re.halfChecked=Pe.halfChecked)}else Re.label=Ye;return Re})}function Le(Oe,Fe){var je=new Set(Oe);return je.add(Fe),Array.from(je)}function ce(Oe,Fe){var je=new Set(Oe);return je.delete(Fe),Array.from(je)}function ae(Oe){var Fe=Oe.searchPlaceholder,je=Oe.treeCheckStrictly,Ge=Oe.treeCheckable,Ve=Oe.labelInValue,ze=Oe.value,Re=Oe.multiple;Object(y.a)(!Fe,"`searchPlaceholder` has been removed."),je&&Ve===!1&&Object(y.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Ve||je)&&Object(y.a)(z(ze).every(function(Qe){return Qe&&Object(I.a)(Qe)==="object"&&"value"in Qe}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),je||Re||Ge?Object(y.a)(!ze||Array.isArray(ze),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(y.a)(!Array.isArray(ze),"`value` should not be array when `TreeSelect` is single mode.")}var de=ae,ne=10;function se(Oe,Fe){var je=Fe.id,Ge=Fe.pId,Ve=Fe.rootPId,ze={},Re=[],Qe=Oe.map(function(Ye){var Pe=Object(B.a)({},Ye),We=Pe[je];return ze[We]=Pe,Pe.key=Pe.key||We,Pe});return Qe.forEach(function(Ye){var Pe=Ye[Ge],We=ze[Pe];We&&(We.children=We.children||[],We.children.push(Ye)),(Pe===Ve||!We&&Ve===null)&&Re.push(Ye)}),Re}function J(Oe,Fe){var je=0,Ge=new Set;function Ve(ze){return(ze||[]).map(function(Re){var Qe=Re.key,Ye=Re.value,Pe=Re.children,We=Object(T.a)(Re,["key","value","children"]),Se="value"in Re?Ye:Qe,ye=Object(B.a)(Object(B.a)({},We),{},{key:Qe!=null?Qe:Se,value:Se,title:Fe(Re)});return"children"in Re&&(ye.children=Ve(Pe)),ye})}return Ve(Oe)}function ee(Oe,Fe,je){var Ge=je.getLabelProp,Ve=je.simpleMode,ze=M.useRef({});return Oe?(ze.current.formatTreeData=ze.current.treeData===Oe?ze.current.formatTreeData:J(Ve?se(Oe,Object(B.a)({id:"id",pId:"pId",rootPId:null},Ve!==!0?Ve:{})):Oe,Ge),ze.current.treeData=Oe):ze.current.formatTreeData=ze.current.children===Fe?ze.current.formatTreeData:J(C(Fe),Ge),ze.current.formatTreeData}var oe="SHOW_ALL",fe="SHOW_PARENT",ke="SHOW_CHILD";function ge(Oe,Fe,je){var Ge=new Set(Oe);return Fe===ke?Oe.filter(function(Ve){var ze=je[Ve];return!(ze&&ze.children&&ze.children.every(function(Re){var Qe=Re.node;return N(Qe)||Ge.has(Qe.key)}))}):Fe===fe?Oe.filter(function(Ve){var ze=je[Ve],Re=ze?ze.parent:null;return!(Re&&!N(Re.node)&&Ge.has(Re.node.key))}):Oe}function De(Oe,Fe){var je=Fe.value,Ge=Fe.getEntityByValue,Ve=Fe.getEntityByKey,ze=Fe.treeConduction,Re=Fe.showCheckedStrategy,Qe=Fe.conductKeyEntities,Ye=Fe.getLabelProp;return M.useMemo(function(){var Pe=Oe;if(ze){var We=ge(Oe.map(function(Se){var ye=Ge(Se);return ye?ye.key:Se}),Re,Qe);Pe=We.map(function(Se){var ye=Ve(Se);return ye?ye.data.value:Se})}return Ae(Pe,je,Ge,Ye)},[Oe,je,ze,Re,Ge])}var Me=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],Ue=Object(R.a)({prefixCls:"rc-tree-select",components:{optionList:f},convertChildrenToData:function(){return null},flattenOptions:re,getLabeledValue:E.e,filterOptions:ve,isValueDisabled:P,findValueOption:V,omitDOMProps:function(Fe){var je=Object(B.a)({},Fe);return Me.forEach(function(Ge){delete je[Ge]}),je}});Ue.displayName="Select";var Ke=M.forwardRef(function(Oe,Fe){var je=Oe.multiple,Ge=Oe.treeCheckable,Ve=Oe.treeCheckStrictly,ze=Oe.showCheckedStrategy,Re=ze===void 0?"SHOW_CHILD":ze,Qe=Oe.labelInValue,Ye=Oe.loadData,Pe=Oe.treeLoadedKeys,We=Oe.treeNodeFilterProp,Se=We===void 0?"value":We,ye=Oe.treeNodeLabelProp,xe=Oe.treeDataSimpleMode,le=Oe.treeData,ue=Oe.treeExpandedKeys,me=Oe.treeDefaultExpandedKeys,Ee=Oe.treeDefaultExpandAll,we=Oe.children,Ie=Oe.treeIcon,$e=Oe.showTreeIcon,at=Oe.switcherIcon,ht=Oe.treeLine,ut=Oe.treeMotion,xt=Oe.filterTreeNode,Ct=Oe.dropdownPopupAlign,st=Oe.onChange,Mt=Oe.onTreeExpand,Lt=Oe.onTreeLoad,kt=Oe.onDropdownVisibleChange,Dt=Oe.onSelect,Tt=Oe.onDeselect,Ut=Ge||Ve,Qt=je||Ut,yt=Ge&&!Ve,pr=Ve||Qe,Bt=M.useRef(null);M.useImperativeHandle(Fe,function(){return{focus:Bt.current.focus,blur:Bt.current.blur}});var tr=function(mt){return le&&mt.label||mt.title},ur=function(mt){return ye?mt[ye]:tr(mt)},nr=ee(le,we,{getLabelProp:tr,simpleMode:xe}),vr=Object(M.useMemo)(function(){return re(nr)},[nr]),Nt=p(vr),ft=Object(K.a)(Nt,2),sr=ft[0],Tr=ft[1],gr=g(sr,Tr),Pt=Object(K.a)(gr,2),yr=Pt[0],dr=Pt[1],qr=Object(M.useMemo)(function(){return yt?Object(L.a)(nr):{keyEntities:null}},[nr,Ge,Ve]),qe=qr.keyEntities,wt=Object(x.a)(Oe.defaultValue,{value:Oe.value}),zr=Object(K.a)(wt,2),Ir=zr[0],Zr=zr[1],Wr=function(mt){var It=[],lr=[];return mt.forEach(function($t){dr($t)?lr.push($t):It.push($t)}),{missingRawValues:It,existRawValues:lr}},G=Object(M.useMemo)(function(){var pt=[],mt=[];if(z(Ir).forEach(function(Xt){if(Xt&&Object(I.a)(Xt)==="object"&&"value"in Xt)if(Xt.halfChecked&&Ve){var wr=dr(Xt.value);pt.push(wr?wr.key:Xt.value)}else mt.push(Xt.value);else mt.push(Xt)}),yt){var It=Wr(mt),lr=It.missingRawValues,$t=It.existRawValues,rr=$t.map(function(Xt){return dr(Xt).key}),xr=Object(_.a)(rr,!0,qe),Nr=xr.checkedKeys,ir=xr.halfCheckedKeys;return[[].concat(Object(U.a)(lr),Object(U.a)(Nr.map(function(Xt){return yr(Xt).data.value}))),ir]}return[mt,pt]},[Ir,Qt,pr,Ge,Ve]),c=Object(K.a)(G,2),m=c[0],F=c[1],q=De(m,{treeConduction:yt,value:Ir,showCheckedStrategy:Re,conductKeyEntities:qe,getEntityByValue:dr,getEntityByKey:yr,getLabelProp:ur}),H=function(mt,It,lr){if(Zr(Qt?mt:mt[0]),st){var $t=mt;if(yt&&Re!=="SHOW_ALL"){var rr=mt.map(function(Ar){var _r=dr(Ar);return _r?_r.key:Ar}),xr=ge(rr,Re,qe);$t=xr.map(function(Ar){var _r=yr(Ar);return _r?_r.data.value:Ar})}var Nr=It||{triggerValue:void 0,selected:void 0},ir=Nr.triggerValue,Xt=Nr.selected,wr=pr?Ae($t,Ir,dr,ur):$t;if(Ve){var Hr=F.map(function(Ar){var _r=yr(Ar);return _r?_r.data.value:Ar}).filter(function(Ar){return!$t.includes(Ar)});wr=[].concat(Object(U.a)(wr),Object(U.a)(Ae(Hr,Ir,dr,ur)))}var ar={preValue:q,triggerValue:ir},yn=!0;(Ve||lr==="selection"&&!Xt)&&(yn=!1),j(ar,ir,mt,nr,yn),Ut?ar.checked=Xt:ar.selected=Xt,st(Qt?wr:wr[0],pr?null:$t.map(function(Ar){var _r=dr(Ar);return _r?ur(_r.data):null}),ar)}},Ce=function(mt,It,lr){var $t=mt;if(!Qt)H([mt],{selected:!0,triggerValue:mt},lr);else{var rr=Le(m,mt);if(yt){var xr=Wr(rr),Nr=xr.missingRawValues,ir=xr.existRawValues,Xt=ir.map(function(ar){return dr(ar).key}),wr=Object(_.a)(Xt,!0,qe),Hr=wr.checkedKeys;rr=[].concat(Object(U.a)(Nr),Object(U.a)(Hr.map(function(ar){return yr(ar).data.value})))}H(rr,{selected:!0,triggerValue:mt},lr)}Dt&&Dt($t,It)},Ze=function(mt,It,lr){var $t=mt,rr=ce(m,mt);if(yt){var xr=Wr(rr),Nr=xr.missingRawValues,ir=xr.existRawValues,Xt=ir.map(function(ar){return dr(ar).key}),wr=Object(_.a)(Xt,{checked:!1,halfCheckedKeys:F},qe),Hr=wr.checkedKeys;rr=[].concat(Object(U.a)(Nr),Object(U.a)(Hr.map(function(ar){return yr(ar).data.value})))}H(rr,{selected:!1,triggerValue:mt},lr),Tt&&Tt($t,It)},nt=function(){H([],null,"clear")},lt=M.useCallback(function(pt){if(kt){var mt={};Object.defineProperty(mt,"documentClickClose",{get:function(){return Object(y.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),kt(pt,mt)}},[kt]),Xe={optionLabelProp:null,optionFilterProp:Se,dropdownAlign:Ct,internalProps:{mark:A.a,onClear:nt,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:Ce,onRawDeselect:Ze}};return"filterTreeNode"in Oe&&(Xe.filterOption=xt),M.createElement(d.Provider,{value:{checkable:Ut,loadData:Ye,treeLoadedKeys:Pe,onTreeLoad:Lt,checkedKeys:m,halfCheckedKeys:F,treeDefaultExpandAll:Ee,treeExpandedKeys:ue,treeDefaultExpandedKeys:me,onTreeExpand:Mt,treeIcon:Ie,treeMotion:ut,showTreeIcon:$e,switcherIcon:at,treeLine:ht,treeNodeFilterProp:Se}},M.createElement(Ue,Object.assign({ref:Bt,mode:Qt?"multiple":null},Oe,Xe,{value:q,labelInValue:!0,options:nr,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:lt})))}),He=function(Oe){Object(O.a)(je,Oe);var Fe=Object(Z.a)(je);function je(){var Ge;return Object(he.a)(this,je),Ge=Fe.apply(this,arguments),Ge.selectRef=M.createRef(),Ge.focus=function(){Ge.selectRef.current.focus()},Ge.blur=function(){Ge.selectRef.current.blur()},Ge}return Object(Y.a)(je,[{key:"render",value:function(){return M.createElement(Ke,Object.assign({ref:this.selectRef},this.props))}}]),je}(M.Component);He.TreeNode=a,He.SHOW_ALL=oe,He.SHOW_PARENT=fe,He.SHOW_CHILD=ke;var Be=He,rt=tt.e=Be},"8hTe":function(Et,tt,ie){Et.exports={button:"button___1wy9m"}},"8pgt":function(Et,tt,ie){Et.exports={flexRow:"flexRow___2kcn2",flexColumn:"flexColumn___2bS_0",formWrap:"formWrap___3t-wi",example:"example___2J2YZ",footerWrap:"footerWrap___3u6gg"}},"9Bee":function(Et,tt,ie){"use strict";var he=ie("DYRE"),Y=ie("zeV3"),O=ie("+L6B"),Z=ie("2/Rp"),U=ie("k1fw"),I=ie("9og8"),K=ie("tJVT"),B=ie("WmNS"),M=ie.n(B),R=ie("q1tI"),E=ie.n(R),L=ie("vg9a"),_=ie("DlQD"),A=ie.n(_),x=ie("rUJ1");function y(G,c){var m=G.match(/^(\s+)(?:```)/);if(m===null)return c;var F=m[1];return c.split(`
`).map(function(q){var H=q.match(/^\s+/);if(H===null)return q;var Ce=Object(K.a)(H,1),Ze=Ce[0];return Ze.length>=F.length?q.slice(F.length):q}).join(`
`)}var h=[],o=["<ul>"],l=new A.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){h.length=0,o=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(G,c,m,F){if(c>=G.length||G[c].level<=m)return c;var q=G[c];F.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),c++;var H=[];return c=p(G,c,q.level,H),H.length>0&&(F.push("<ul>"),H.forEach(function(Ce){F.push(Ce)}),F.push("</ul>")),F.push("</li>"),c=p(G,c,m,F),c}function w(){return p(h,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(c){var m=d.exec(c);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(c){var m=this.rules.block.fences.exec(c);if(m){var F=m[0],q=y(F,m[3]||""),H=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(H)>=0){var Ce=s(),Ze=q;q=Ce,a[Ce]={type:"block",expression:Ze}}return{type:"code",raw:F,lang:H,text:q}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,s=function(){return"__special_katext_id_".concat(f++,"__")},a={};function T(){return a}function v(){f=0,a={}}function C(G){return G=G.replace(u,function(c,m){var F=s();return a[F]={type:"inline",expression:m},F}),G}var D=l.listitem;l.listitem=function(G){return D(C(G))};var j=l.paragraph;l.paragraph=function(G){return j(C(G))};var z=l.tablecell;l.tablecell=function(G,c){return z(C(G),c)},l.code=function(G,c,m){var F=(c||"").match(/\S*/)[0];return F?["latex","katex","math"].indexOf(F)>=0?"<p class='editormd-tex'>".concat(G,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(m?G:Object(x.escape)(G,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(m?G:Object(x.escape)(G,!0))+"</code></pre>"},l.heading=function(G,c,m){var F=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:F,level:c,text:G}),"<h"+c+' id="'+F+'">'+G+"</h"+c+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:b,renderer:l});var V=A.a,P=ie("SJMd"),N=ie("ulZh"),$=ie.n(N),re=ie("m3rI"),pe=ie("Oy/b"),ve=ie("p5ED"),Ae=ie("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 Le=function(G,c){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,F){m.__proto__=F}||function(m,F){for(var q in F)Object.prototype.hasOwnProperty.call(F,q)&&(m[q]=F[q])})(G,c)};function ce(G,c){function m(){this.constructor=G}Le(G,c),G.prototype=c===null?Object.create(c):(m.prototype=c.prototype,new m)}function ae(G,c,m,F){return new(m||(m=Promise))(function(q,H){function Ce(lt){try{nt(F.next(lt))}catch(Xe){H(Xe)}}function Ze(lt){try{nt(F.throw(lt))}catch(Xe){H(Xe)}}function nt(lt){var Xe;lt.done?q(lt.value):(Xe=lt.value,Xe instanceof m?Xe:new m(function(pt){pt(Xe)})).then(Ce,Ze)}nt((F=F.apply(G,c||[])).next())})}function de(G,c){var m,F,q,H,Ce={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return H={next:Ze(0),throw:Ze(1),return:Ze(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ze(nt){return function(lt){return function(Xe){if(m)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(m=1,F&&(q=2&Xe[0]?F.return:Xe[0]?F.throw||((q=F.return)&&q.call(F),0):F.next)&&!(q=q.call(F,Xe[1])).done)return q;switch(F=0,q&&(Xe=[2&Xe[0],q.value]),Xe[0]){case 0:case 1:q=Xe;break;case 4:return Ce.label++,{value:Xe[1],done:!1};case 5:Ce.label++,F=Xe[1],Xe=[0];continue;case 7:Xe=Ce.ops.pop(),Ce.trys.pop();continue;default:if(!(q=Ce.trys,(q=q.length>0&&q[q.length-1])||Xe[0]!==6&&Xe[0]!==2)){Ce=0;continue}if(Xe[0]===3&&(!q||Xe[1]>q[0]&&Xe[1]<q[3])){Ce.label=Xe[1];break}if(Xe[0]===6&&Ce.label<q[1]){Ce.label=q[1],q=Xe;break}if(q&&Ce.label<q[2]){Ce.label=q[2],Ce.ops.push(Xe);break}q[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Xe=c.call(G,Ce)}catch(pt){Xe=[6,pt],F=0}finally{m=q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([nt,lt])}}}function ne(){for(var G=0,c=0,m=arguments.length;c<m;c++)G+=arguments[c].length;var F=Array(G),q=0;for(c=0;c<m;c++)for(var H=arguments[c],Ce=0,Ze=H.length;Ce<Ze;Ce++,q++)F[q]=H[Ce];return F}var se=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(c,m){for(var F=0,q=m;F<q.length;F++){var H=q[F],Ce=H[0],Ze=H[1];c.setAttribute(Ce,Ze)}},G.createRect=function(c,m,F){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",m.toString()),F&&G.setAttributes(q,F),q},G.createLine=function(c,m,F,q,H){var Ce=document.createElementNS("http://www.w3.org/2000/svg","line");return Ce.setAttribute("x1",c.toString()),Ce.setAttribute("y1",m.toString()),Ce.setAttribute("x2",F.toString()),Ce.setAttribute("y2",q.toString()),H&&G.setAttributes(Ce,H),Ce},G.createPolygon=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",c),m&&G.setAttributes(F,m),F},G.createCircle=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(c/2).toString()),F.setAttribute("cy",(c/2).toString()),F.setAttribute("r",c.toString()),m&&G.setAttributes(F,m),F},G.createEllipse=function(c,m,F){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(m/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(m/2).toString()),F&&G.setAttributes(q,F),q},G.createGroup=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&G.setAttributes(m,c),m},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(c,m,F,q,H,Ce,Ze){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(nt,[["id",c],["orient",m],["markerWidth",F.toString()],["markerHeight",q.toString()],["refX",H.toString()],["refY",Ce.toString()]]),nt.appendChild(Ze),nt},G.createText=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),c&&G.setAttributes(m,c),m},G.createTSpan=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=c,m&&G.setAttributes(F,m),F},G.createImage=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&G.setAttributes(m,c),m},G.createPoint=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=c,F.y=m,F},G.createPath=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",c),m&&G.setAttributes(F,m),F},G}(),J=function(){function G(){}return G.addKey=function(c){G.key=c},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),ee=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(c,m,F){var q=this;return new Promise(function(H){var Ce=F!==void 0?F:document.createElement("canvas");c===null&&(q.markersOnly=!0,q.naturalSize=!1);var Ze=document.createElementNS("http://www.w3.org/2000/svg","svg");Ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ze.setAttribute("width",m.width.baseVal.valueAsString),Ze.setAttribute("height",m.height.baseVal.valueAsString),Ze.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),Ze.innerHTML=m.innerHTML,q.naturalSize===!0?(Ze.width.baseVal.value=c.naturalWidth,Ze.height.baseVal.value=c.naturalHeight):q.width!==void 0&&q.height!==void 0&&(Ze.width.baseVal.value=q.width,Ze.height.baseVal.value=q.height),Ce.width=Ze.width.baseVal.value,Ce.height=Ze.height.baseVal.value;var nt=Ze.outerHTML,lt=Ce.getContext("2d");q.markersOnly!==!0&&lt.drawImage(c,0,0,Ce.width,Ce.height);var Xe=window.URL,pt=new Image(Ce.width,Ce.height);pt.setAttribute("crossOrigin","anonymous");var mt=new Blob([nt],{type:"image/svg+xml"}),It=Xe.createObjectURL(mt);pt.onload=function(){lt.drawImage(pt,0,0),Xe.revokeObjectURL(It);var lr=Ce.toDataURL(q.imageType,q.imageQuality);H(lr)},pt.src=It})},G}(),oe=function(){},fe=function(){function G(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},G.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new ke("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ge("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ge("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),ke=function(G,c){this.selector=G,this.style=c},ge=function(G,c){this.localName=G,this.style=c},De=function(){function G(c,m,F,q,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=m,this.markerItems=F,this.uiStyleSettings=q,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return G.prototype.show=function(c){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,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(H){var Ce=document.createElement("div");Ce.className=""+m.toolbarButtonStyleClass.name,Ce.setAttribute("data-type-name",H.typeName),Ce.innerHTML=H.icon,Ce.addEventListener("click",function(){m.markerToolbarButtonClicked(Ce,H)}),m.buttons.push(Ce),m.markerButtons.push(Ce)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},G.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m<this.markerButtons.length;m++)m<c||m===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},G.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")},G.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(m){m.className=m.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(c,m,F){var q=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=m,H.setAttribute("data-action",F),H.addEventListener("click",function(){q.actionToolbarButtonClicked(H,F)}),F){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(H),this.buttons.push(H)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ge("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 ge("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ge("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ge("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 ge("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ge("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},G.prototype.markerToolbarButtonClicked=function(c,m){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(c,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},G.prototype.setActiveMarkerButton=function(c){var m=this.markerButtons.find(function(F){return F.getAttribute("data-type-name")===c});m&&this.setActiveButton(m)},G.prototype.setCurrentMarker=function(c){var m=this;this.currentMarker=c,this.buttons.filter(function(F){return/delete|notes/.test(F.getAttribute("data-action"))}).forEach(function(F){m.currentMarker===void 0?(F.style.fillOpacity="0.4",F.style.pointerEvents="none"):(F.style.fillOpacity="1",F.style.pointerEvents="all")})},G}(),Me=function(){function G(c,m,F,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=m,this.uiStyleSettings=F,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new ge("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 ge("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ge("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ge("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ge("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 ge("toolbox-panel-row_colors",`
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ge("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
padding: `+m+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},G.prototype.show=function(c){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(c){var m,F,q=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m: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(H){var Ce;H.uiStyleSettings=q.uiStyleSettings;var Ze=document.createElement("div");Ze.className=q.toolboxButtonStyleClass.name+" "+((Ce=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ce!==void 0?Ce:q.toolboxButtonStyleColorsClass.name),Ze.innerHTML=H.icon,Ze.title=H.title,Ze.addEventListener("click",function(){q.panelButtonClick(H)}),q.panelButtons.push(Ze),q.buttonRow.appendChild(Ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(c){var m=this,F=-1;if(c!==this.activePanel){F=this.panels.indexOf(c),this.panelRow.innerHTML="";var q=c.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,Ce){var Ze,nt;H.className=m.toolboxButtonStyleClass.name+" "+(Ce===F?""+((Ze=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:m.toolboxActiveButtonStyleColorsClass.name):""+((nt=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:m.toolboxButtonStyleColorsClass.name))})},G}(),Ue=function(G,c){this.title=G,this.icon=c},Ke=function(G){function c(m,F,q,H){var Ce=G.call(this,m,H||'<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 Ce.colors=[],Ce.addTransparent=!1,Ce.colorBoxes=[],Ce.colors=F,Ce.currentColor=q,Ce.setCurrentColor=Ce.setCurrentColor.bind(Ce),Ce.getColorBox=Ce.getColorBox.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var m=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.whiteSpace="nowrap",this.colors.forEach(function(q){var H=m.getColorBox(q);F.appendChild(H),m.colorBoxes.push(H)}),F},c.prototype.getColorBox=function(m){var F=this,q=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-q,Ce=document.createElement("div");Ce.style.display="inline-block",Ce.style.boxSizing="content-box",Ce.style.width=H-2+"px",Ce.style.height=H-2+"px",Ce.style.padding="1px",Ce.style.marginRight="2px",Ce.style.marginBottom="2px",Ce.style.borderWidth="2px",Ce.style.borderStyle="solid",Ce.style.borderRadius=(H+2)/2+"px",Ce.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Ce.addEventListener("click",function(){F.setCurrentColor(m,Ce)});var Ze=document.createElement("div");return Ze.style.display="inline-block",Ze.style.width=H-2+"px",Ze.style.height=H-2+"px",Ze.style.backgroundColor=m,Ze.style.borderRadius=H/2+"px",m==="transparent"&&(Ze.style.fill=this.uiStyleSettings.toolboxAccentColor,Ze.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>`),Ce.appendChild(Ze),Ce},c.prototype.setCurrentColor=function(m,F){var q=this;this.currentColor=m,this.colorBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},c}(Ue),He=function(){function G(c,m,F){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=m,this.globalSettings=F,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(c){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(c,m){},G.prototype.dblClick=function(c,m){},G.prototype.manipulate=function(c){},G.prototype.pointerUp=function(c){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},G.prototype.scale=function(c,m){},G.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},G.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},G.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},G.typeName="MarkerBase",G}(),Be=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},G}(),rt=function(){function G(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},G}(),Oe=function(){function G(){}return G.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},G.toSVGMatrix=function(c,m){return c.a=m.a,c.b=m.b,c.c=m.c,c.d=m.d,c.e=m.e,c.f=m.f,c},G}(),Fe=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(se.createTransform()),H.setupControlBox(),H}return ce(c,G),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var F=se.createTransform();this._visual.transform.baseVal.appendItem(F)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(m){return!!G.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(m);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(F),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Ce=this.container.transform.baseVal.getItem(0);Ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(m){var F=this.state;G.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",F==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},c.prototype.manipulate=function(m){var F=this.unrotatePoint(m);this.state==="creating"?this.resize(m):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(m)},c.prototype.resize=function(m){var F=this.manipulationStartLeft,q=this.manipulationStartWidth,H=this.manipulationStartTop,Ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:F=this.manipulationStartLeft+m.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-F;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+m.y-this.manipulationStartY,Ce=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Ce=this.manipulationStartHeight+m.y-this.manipulationStartY}q>=0?(this.left=F,this.width=q):(this.left=F+q,this.width=-q),Ce>=0?(this.top=H,this.height=Ce):(this.top=H+Ce,this.height=-Ce),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var F=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*F,this.applyRotation()}},c.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},c.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var F=this.container.getCTM(),q=se.createPoint(m.x,m.y);return{x:(q=q.matrixTransform(F)).x,y:q.y}},c.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var F=this.container.getCTM();F=F.inverse();var q=se.createPoint(m.x,m.y);return{x:(q=q.matrixTransform(F)).x,y:q.y}},c.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var m=se.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.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 Be,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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()},c.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()},c.prototype.createGrip=function(){var m=new rt;return m.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(m.visual),m},c.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,F=-m/2,q=F,H=(this.width+this.CB_DISTANCE)/2-m/2,Ce=(this.height+this.CB_DISTANCE)/2-m/2,Ze=this.height+this.CB_DISTANCE-m/2,nt=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,F,q),this.positionGrip(this.controlGrips.topCenter.visual,H,q),this.positionGrip(this.controlGrips.topRight.visual,nt,q),this.positionGrip(this.controlGrips.centerLeft.visual,F,Ce),this.positionGrip(this.controlGrips.centerRight.visual,nt,Ce),this.positionGrip(this.controlGrips.bottomLeft.visual,F,Ze),this.positionGrip(this.controlGrips.bottomCenter.visual,H,Ze),this.positionGrip(this.controlGrips.bottomRight.visual,nt,Ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,q-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(m,F,q){var H=m.transform.baseVal.getItem(0);H.setTranslate(F,q),m.transform.baseVal.replaceItem(H,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Oe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Oe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m);var F=m;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(Oe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,F.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Oe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,F.containerTransformMatrix))},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F);var q=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:q.x*m,y:q.y*F});this.left=H.x,this.top=H.y,this.width=this.width*m,this.height=this.height*F,this.adjustControlBox()},c}(He),je=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.visual)},c.prototype.createVisual=function(){this.visual=se.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)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},c.prototype.manipulate=function(m){G.prototype.manipulate.call(this,m)},c.prototype.resize=function(m){G.prototype.resize.call(this,m),this.setSize()},c.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(m){G.prototype.pointerUp.call(this,m),this.setSize()},c.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},c.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this))},c.prototype.restoreState=function(m){var F=m;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),G.prototype.restoreState.call(this,m),this.setSize()},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.setSize()},c.title="Rectangle marker",c}(Fe),Ge=function(G){function c(m,F,q,H){var Ce=G.call(this,m,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Ce.widths=[],Ce.widthBoxes=[],Ce.widths=F,Ce.currentWidth=q,Ce.setCurrentWidth=Ce.setCurrentWidth.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var m=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.widths.forEach(function(q){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=q===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){m.setCurrentWidth(q,H)}),F.appendChild(H);var Ce=document.createElement("div");Ce.innerText=q.toString(),Ce.style.marginRight="5px",H.appendChild(Ce);var Ze=document.createElement("div");Ze.style.minHeight="20px",Ze.style.flexGrow="2",Ze.style.display="flex",Ze.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=q+"px solid "+m.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",Ze.appendChild(nt),H.appendChild(Ze),m.widthBoxes.push(H)}),F},c.prototype.setCurrentWidth=function(m,F){var q=this;this.currentWidth=m,this.widthBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(Ue),Ve=function(G){function c(m,F,q,H){var Ce=G.call(this,m,H||'<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 Ce.styles=[],Ce.styleBoxes=[],Ce.styles=F,Ce.currentStyle=q,Ce.setCurrentStyle=Ce.setCurrentStyle.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var m=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.styles.forEach(function(q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/m.styles.length-5+"%",H.style.borderColor=q===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){m.setCurrentStyle(q,H)}),F.appendChild(H);var Ce=document.createElement("div");Ce.style.minHeight="20px",Ce.style.flexGrow="2",Ce.style.overflow="hidden";var Ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
</svg>`;Ce.innerHTML=Ze,H.appendChild(Ce),m.styleBoxes.push(H)}),F},c.prototype.setCurrentStyle=function(m,F){var q=this;this.currentStyle=m,this.styleBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(Ue),ze=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new Ge("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ve("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=G.prototype.getState.call(this);return m.typeName=c.typeName,m},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(je),Re=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},Qe=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return ce(c,G),c.prototype.ownsTarget=function(m){return!!G.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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")},c.prototype.pointerUp=function(m){var F=this.state;G.prototype.pointerUp.call(this,m),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(m),this._state="select",F==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},c.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var m=new rt;return m.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(m.visual),m},c.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},c.prototype.positionGrip=function(m,F,q){var H=m.transform.baseVal.getItem(0);H.setTranslate(F,q),m.transform.baseVal.replaceItem(H,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m);var F=m;this.x1=F.x1,this.y1=F.y1,this.x2=F.x2,this.y2=F.y2},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.x1=this.x1*m,this.y1=this.y1*F,this.x2=this.x2*m,this.y2=this.y2*F,this.adjustVisual(),this.adjustControlBox()},c}(He),Ye=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new Ge("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ve("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},c.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},c.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m);var F=m;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',c}(Qe),Pe=function(G){function c(m,F,q,H){var Ce=G.call(this,m,H||'<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 Ce.fonts=[],Ce.fontBoxes=[],Ce.fonts=F,Ce.currentFont=q,Ce.setCurrentFont=Ce.setCurrentFont.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var m=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.flexGrow="2",this.fonts.forEach(function(q){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/m.fonts.length-5+"%",H.style.borderColor=q===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){m.setCurrentFont(q,H)}),F.appendChild(H);var Ce=document.createElement("div");Ce.style.display="flex",Ce.style.minHeight="20px",Ce.style.flexGrow="2",Ce.style.fontFamily=q,Ce.style.overflow="hidden";var Ze=document.createElement("div");Ze.style.whiteSpace="nowrap",Ze.style.overflow="hidden",Ze.style.textOverflow="ellipsis",Ze.innerHTML="The quick brown fox jumps over the lazy dog",Ce.appendChild(Ze),H.appendChild(Ce),m.fontBoxes.push(H)}),F},c.prototype.setCurrentFont=function(m,F){var q=this;this.currentFont=m,this.fontBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(Ue),We=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=q.defaultColor,H.fontFamily=q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new Ke("Color",q.defaultColorSet,q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Pe("Font",q.defaultFontFamilies,q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return ce(c,G),c.prototype.ownsTarget=function(m){if(G.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var F=!1;return this.textElement.childNodes.forEach(function(q){q===m&&(F=!0)}),F},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},c.prototype.renderText=function(){var m=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){m.textElement.appendChild(se.createTSpan(F.trim()===""?" ":F.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var m=this.textElement.getBBox(),F=1;if(m.width>0&&m.height>0){var q=(1*this.width-this.width*this.padding*2/100)/m.width,H=(1*this.height-this.height*this.padding*2/100)/m.height;F=Math.min(q,H)}return F},c.prototype.getTextPosition=function(m){var F=this.textElement.getBBox(),q=0,H=0;return F.width>0&&F.height>0&&(q=(this.width-F.width*m)/2,H=this.height/2-F.height*m/2),{x:q,y:H}},c.prototype.sizeText=function(){var m=this.textElement.getBBox(),F=this.getTextScale(),q=this.getTextPosition(F);q.y-=m.y*F,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+F+", "+F+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(F,F))},c.prototype.manipulate=function(m){G.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(m){G.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(m){var F=this.state;F==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,m),this.setSize(),(F==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var m=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(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&F>.9;)F-=.1,m.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 q=F.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(q)),F.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),F=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),H={x:q.width*m,y:q.height*m};F.x-=H.x/2,F.y-=H.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*m,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},c.prototype.dblClick=function(m,F){G.prototype.dblClick.call(this,m,F),this.showTextEditor()},c.prototype.setColor=function(m){this.textElement&&se.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},c.prototype.setFont=function(m){this.textElement&&se.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){var F=m;this.color=F.color,this.fontFamily=F.fontFamily,this.padding=F.padding,this.text=F.text,this.createVisual(),G.prototype.restoreState.call(this,m),this.setSize()},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.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>',c}(Fe),Se=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=q.defaultColor,H.lineWidth=q.defaultStrokeWidth,H.pixelRatio=q.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new Ke("Color",q.defaultColorSet,q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new Ge("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var m=se.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(m,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(m.x,m.y),this.drawing=!0):G.prototype.pointerDown.call(this,m,F)},c.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,m)},c.prototype.resize=function(m){G.prototype.resize.call(this,m),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,m)},c.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)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),G.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),F=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=F[0],H=F[1],Ce=F[2],Ze=F[3],nt=!1,lt=0;lt<this.canvasElement.height;lt++)for(var Xe=0;Xe<this.canvasElement.width;Xe++)m.data[lt*this.canvasElement.width*4+4*Xe+3]>0&&(nt=!0,lt<H&&(H=lt),Xe<q&&(q=Xe),lt>Ze&&(Ze=lt),Xe>Ce&&(Ce=Xe));if(nt){this.left=q/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(Ce-q)/this.pixelRatio,this.height=(Ze-H)/this.pixelRatio;var pt=document.createElement("canvas");pt.width=Ce-q,pt.height=Ze-H,pt.getContext("2d").putImageData(this.canvasContext.getImageData(q,H,Ce-q,Ze-H),0,0),this.drawingImgUrl=pt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},c.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){this.createVisual(),G.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.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>',c}(Fe),ye=function(G){function c(m,F,q){var H=G.call(this,m,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=F,H.setCurrentType=H.setCurrentType.bind(H),H}return ce(c,G),c.prototype.getUi=function(){var m=this,F=document.createElement("div");F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2";for(var q=function(Ze){var nt="both";switch(Ze){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var lt=document.createElement("div");if(lt.style.display="flex",lt.style.flexGrow="2",lt.style.alignItems="center",lt.style.justifyContent="space-between",lt.style.padding="5px",lt.style.borderWidth="2px",lt.style.borderStyle="solid",lt.style.borderColor=nt===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){m.setCurrentType(nt,lt)}),F.appendChild(lt),nt==="both"||nt==="start"){var Xe=document.createElement("div");Xe.style.display="flex",Xe.style.alignItems="center",Xe.style.minHeight="20px",Xe.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Xe.style.marginLeft="5px",lt.appendChild(Xe)}var pt=document.createElement("div");pt.style.display="flex",pt.style.alignItems="center",pt.style.minHeight="20px",pt.style.flexGrow="2";var mt=document.createElement("hr");if(mt.style.minWidth="20px",mt.style.border="0px",mt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),mt.style.flexGrow="2",pt.appendChild(mt),lt.appendChild(pt),nt==="both"||nt==="end"){var It=document.createElement("div");It.style.display="flex",It.style.alignItems="center",It.style.minHeight="20px",It.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,It.style.marginRight="5px",lt.appendChild(It)}H.typeBoxes.push(lt)},H=this,Ce=0;Ce<4;Ce++)q(Ce);return F},c.prototype.setCurrentType=function(m,F){var q=this;this.currentType=m,this.typeBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(Ue),xe=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ye("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},c.prototype.getArrowPoints=function(m,F){var q=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return m-q/2+","+(F+H/2)+" "+m+","+(F-H/2)+" "+(m+q/2)+","+(F+H/2)},c.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(G.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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=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(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(F,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},c.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m);var F=m;this.arrowType=F.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',c}(Ye),le=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.fillColor=q.defaultFillColor,H.strokeWidth=0,H.fillPanel=new Ke("Color",q.defaultColorSet,q.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=G.prototype.getState.call(this);return m.typeName=c.typeName,m},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(je),ue=function(G){function c(m,F,q,H){var Ce=G.call(this,m,H||'<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 Ce.opacities=[],Ce.opacityBoxes=[],Ce.opacities=F,Ce.currentOpacity=q,Ce.setCurrentOpacity=Ce.setCurrentOpacity.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var m=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(q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=q===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){m.setCurrentOpacity(q,H)}),F.appendChild(H);var Ce=document.createElement("div");Ce.innerText=100*q+"%",H.appendChild(Ce),m.opacityBoxes.push(H)}),F},c.prototype.setCurrentOpacity=function(m,F){var q=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(Ue),me=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=q.defaultHighlightColor,H.strokeWidth=0,H.opacity=q.defaultHighlightOpacity,H.fillPanel=new Ke("Color",q.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return ce(c,G),c.prototype.setOpacity=function(m){this.opacity=m,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=G.prototype.getState.call(this);return m.typeName=c.typeName,m},c.typeName="HighlightMarker",c.title="Highlight marker",c.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>',c}(le),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>',we=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=q.defaultStrokeColor,H.bgColor=q.defaultFillColor,H.fontFamily=q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new Ke("Text color",q.defaultColorSet,H.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>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new Ke("Fill color",q.defaultColorSet,H.bgColor,Ee),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Pe("Font",q.defaultFontFamilies,q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new rt,H.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return ce(c,G),c.prototype.ownsTarget=function(m){return G.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},c.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(m,F){this.state==="new"&&G.prototype.pointerDown.call(this,m,F),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(F)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,m,F)},c.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,m);else{var F=this.state==="creating";G.prototype.pointerUp.call(this,m),this.setTipPoints(F),this.positionTip()}},c.prototype.manipulate=function(m){if(this.tipMoving){var F=this.unrotatePoint(m);this.tipPosition={x:F.x-this.manipulationStartLeft,y:F.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,m)},c.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",m]]),se.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},c.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},c.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var F=Math.min(this.height/2,15),q=this.height/5;m&&(this.tipPosition={x:F+q/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:0},this.tipBase2Position={x:F+q,y:0}):(this.tipBase1Position={x:0,y:F},this.tipBase2Position={x:0,y:F+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-q,y:0},this.tipBase2Position={x:this.width-F,y:0}):(this.tipBase1Position={x:this.width,y:F},this.tipBase2Position={x:this.width,y:F+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-q,y:this.height},this.tipBase2Position={x:this.width-F,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-F-q},this.tipBase2Position={x:this.width,y:this.height-F}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:this.height},this.tipBase2Position={x:F+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-F},this.tipBase2Position={x:0,y:this.height-F-q})},c.prototype.resize=function(m){G.prototype.resize.call(this,m),this.positionTip()},c.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.positionTip(),G.prototype.select.call(this)},c.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){var F=m;this.bgColor=F.bgColor,this.tipPosition=F.tipPosition,G.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*F},this.positionTip()},c.typeName="CalloutMarker",c.title="Callout marker",c.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>',c}(We),Ie=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.fillColor=q.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new Ke("Line color",ne(q.defaultColorSet,["transparent"]),q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new Ke("Fill color",ne(q.defaultColorSet,["transparent"]),H.fillColor,Ee),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new Ge("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ve("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.visual)},c.prototype.createVisual=function(){this.visual=se.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)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},c.prototype.manipulate=function(m){G.prototype.manipulate.call(this,m)},c.prototype.resize=function(m){G.prototype.resize.call(this,m),this.setSize()},c.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(m){G.prototype.pointerUp.call(this,m),this.setSize()},c.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},c.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},c.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(m){this.opacity=m,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){var F=m;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),G.prototype.restoreState.call(this,m),this.setSize()},c.prototype.scale=function(m,F){G.prototype.scale.call(this,m,F),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.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>',c}(Fe),$e=function(G){function c(m,F,q){return G.call(this,m,F,q)||this}return ce(c,G),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},c.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.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 m=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(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(F,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=G.prototype.getState.call(this);return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.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>',c}(Ye),at=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.strokePanel.colors=q.defaultColorSet,H.fillColor="transparent",H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=G.prototype.getState.call(this);return m.typeName=c.typeName,m},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.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>',c}(Ie),ht=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},G.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),ut=function(G){function c(m,F,q){var H=G.call(this,m,F,q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new Ge("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ve("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),c.prototype.ownsTarget=function(m){return!(!G.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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)},c.prototype.pointerDown=function(m,F){G.prototype.pointerDown.call(this,m,F),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(F)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,G.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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()))},c.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),G.prototype.manipulate.call(this,m)},c.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),G.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},c.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},c.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},c.prototype.scale=function(m,F){this.curveX=this.curveX*m,this.curveY=this.curveY*F,G.prototype.scale.call(this,m,F)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return m.typeName=c.typeName,m},c.prototype.restoreState=function(m){G.prototype.restoreState.call(this,m);var F=m;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.curveX=F.curveX,this.curveY=F.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.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>',c}(Qe),xt=function(){function G(c,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=m}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),Ct=function(G){function c(m,F,q){var H=G.call(this,m,!1)||this;return H.dataUrl=F,H.state=q,H}return ce(c,G),c}(xt),st=function(G){function c(m,F,q){q===void 0&&(q=!1);var H=G.call(this,m,q)||this;return H.marker=F,H}return ce(c,G),c}(xt),Mt=function(){function G(){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 G.prototype.addEventListener=function(c,m){this[c].push(m)},G.prototype.removeEventListener=function(c,m){var F=this[c].indexOf(m);F>-1&&this[c].splice(F,1)},G}(),Lt=function(){function G(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new ht,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 Mt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new fe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.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(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[ze,Se,xe,We,at,Ie,me,we,$e,le,Ye,ut]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ze,Se,xe,We,Ie,me,we]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ze,Se,xe,We,me]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var m=this;this._availableMarkerTypes.splice(0),c.forEach(function(F){if(typeof F=="string"){var q=m.ALL_MARKER_TYPES.find(function(H){return H.typeName===F});q!==void 0&&m._availableMarkerTypes.push(q)}else m._availableMarkerTypes.push(F)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),J.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&oe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=oe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new xt(c))})},G.prototype.render=function(){return ae(this,void 0,void 0,function(){var c;return de(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(c=new ee).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},G.prototype.close=function(c){var m=this;if(c===void 0&&(c=!1),this.isOpen){var F=!1;c||this.eventListeners.beforeclose.forEach(function(q){var H=new xt(m,!0);q(H),H.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(q){return q(new xt(m))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var c,m=[],F=0;F<arguments.length;F++)m[F]=arguments[F];(c=this._availableMarkerTypes).push.apply(c,m)},G.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(m){c(m.dataUrl,m.state)})},G.prototype.removeRenderEventListener=function(c){},G.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},G.prototype.removeCloseEventListener=function(c){},G.prototype.setupResizeObserver=function(){var c=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return c.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,F=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(m,F)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(c,m){this._isResizing=!0;var F=c/this.imageWidth,q=m/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(m),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,q),this._isResizing=!1},G.prototype.scaleMarkers=function(c,m){var F,q=this;this._currentMarker&&this._currentMarker instanceof We?this._currentMarker.scale(c,m):(F=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==q._currentMarker&&H.scale(c,m)}),F!==void 0&&this.setCurrentMarker(F)},G.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"},G.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=c.left-m.left,this.top=c.top-m.top},G.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)},G.prototype.addDefs=function(){for(var c,m=[],F=0;F<arguments.length;F++)m[F]=arguments[F];this.defs=se.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,m)},G.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},G.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)},G.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},G.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},G.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)},G.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},G.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)},G.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 c=document.createElement("a");c.href="https://markerjs.com/",c.target="_blank",c.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>',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},G.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")},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"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 De(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 Me(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},G.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},G.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())},G.prototype.toolbarButtonClicked=function(c,m){if(c==="marker"&&m!==void 0)this.createNewMarker(m);else if(c==="action")switch(m){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()}},G.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var H=new st(c,c._currentMarker,!0);q(H),H.defaultPrevented&&(m=!0)}),!m){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(q){return q(new st(c,F))})}}},G.prototype.clear=function(){var c=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Ce){var Ze=new st(c,void 0,!0);Ce(Ze),Ze.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var F=function(Ce){var Ze=q.markers[Ce];q.setCurrentMarker(q.markers[Ce]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(nt){return nt(new st(c,Ze))})},q=this,H=this.markers.length-1;H>=0;H--)F(H);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.prototype.showNotesEditor=function(){var c;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=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},G.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)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),F=this.undoRedoManager.getLastUndoStep();if(!F||F.width===m.width&&F.height===m.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new xt(c))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(H){return H(new xt(c))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var c=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new xt(c))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var c=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new xt(c))}))},G.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},G.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},G.prototype.startRenderAndClose=function(){return ae(this,void 0,void 0,function(){var c,m,F=this;return de(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return c=q.sent(),m=this.getState(),this.eventListeners.render.forEach(function(H){return H(new Ct(F,c,m))}),this.close(!0),[2]}})})},G.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(F){return m.markers.push(F.getState())}),m},G.prototype.restoreState=function(c){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(F){var q=m._availableMarkerTypes.find(function(Ce){return Ce.typeName===F.typeName});if(q!==void 0){var H=m.addNewMarker(q);H.restoreState(F),m.markers.push(H)}}),c.width&&c.height&&(c.width!==this.imageWidth||c.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/c.width,this.imageHeight/c.height),this.eventListeners.restorestate.forEach(function(F){return F(new xt(m))})},G.prototype.addNewMarker=function(c){var m=se.createGroup();return this.markerImage.appendChild(m),new c(m,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(c){var m,F=this;(m=typeof c=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),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(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new st(F,F._currentMarker))}))},G.prototype.markerCreated=function(c){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(F){return F(new st(m,m._currentMarker))})},G.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},G.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},G.prototype.markerStateChanged=function(c){var m=this;this.eventListeners.markerchange.forEach(function(F){return F(new st(m,c))})},G.prototype.setCurrentMarker=function(c){var m=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(F){return F(new st(m,m._currentMarker))})),this._currentMarker=c,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 st(m,m._currentMarker))}))},G.prototype.onPointerDown=function(c){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||c.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(F){return F.ownsTarget(c.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:c.clientX,y:c.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY))},G.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(F){return F.ownsTarget(c.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},G.prototype.onPointerMove=function(c){this.touchPoints!==1&&c.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||c.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(c.clientX,c.clientY)):this.zoomLevel>1&&this.panTo({x:c.clientX,y:c.clientY}))},G.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(c,m){var F=this.markerImage.getBoundingClientRect();return{x:(c-F.left)/this.zoomLevel,y:(m-F.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"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()},G.prototype.addLicenseKey=function(c){J.addKey(c)},G.prototype.addEventListener=function(c,m){this.eventListeners.addEventListener(c,m)},G.prototype.removeEventListener=function(c,m){this.eventListeners.removeEventListener(c,m)},G.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new xt(c))}))},G.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new xt(c))}))},G.instanceCounter=0,G}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var kt=function(G,c){return(kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,F){m.__proto__=F}||function(m,F){for(var q in F)Object.prototype.hasOwnProperty.call(F,q)&&(m[q]=F[q])})(G,c)};function Dt(G,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function m(){this.constructor=G}kt(G,c),G.prototype=c===null?Object.create(c):(m.prototype=c.prototype,new m)}function Tt(G,c,m,F){return new(m||(m=Promise))(function(q,H){function Ce(lt){try{nt(F.next(lt))}catch(Xe){H(Xe)}}function Ze(lt){try{nt(F.throw(lt))}catch(Xe){H(Xe)}}function nt(lt){var Xe;lt.done?q(lt.value):(Xe=lt.value,Xe instanceof m?Xe:new m(function(pt){pt(Xe)})).then(Ce,Ze)}nt((F=F.apply(G,c||[])).next())})}function Ut(G,c){var m,F,q,H,Ce={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return H={next:Ze(0),throw:Ze(1),return:Ze(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ze(nt){return function(lt){return function(Xe){if(m)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(m=1,F&&(q=2&Xe[0]?F.return:Xe[0]?F.throw||((q=F.return)&&q.call(F),0):F.next)&&!(q=q.call(F,Xe[1])).done)return q;switch(F=0,q&&(Xe=[2&Xe[0],q.value]),Xe[0]){case 0:case 1:q=Xe;break;case 4:return Ce.label++,{value:Xe[1],done:!1};case 5:Ce.label++,F=Xe[1],Xe=[0];continue;case 7:Xe=Ce.ops.pop(),Ce.trys.pop();continue;default:if(!(q=Ce.trys,(q=q.length>0&&q[q.length-1])||Xe[0]!==6&&Xe[0]!==2)){Ce=0;continue}if(Xe[0]===3&&(!q||Xe[1]>q[0]&&Xe[1]<q[3])){Ce.label=Xe[1];break}if(Xe[0]===6&&Ce.label<q[1]){Ce.label=q[1],q=Xe;break}if(q&&Ce.label<q[2]){Ce.label=q[2],Ce.ops.push(Xe);break}q[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Xe=c.call(G,Ce)}catch(pt){Xe=[6,pt],F=0}finally{m=q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([nt,lt])}}}var Qt=function(){function G(){}return G.addKey=function(c){G.key=c},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),yt=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(c,m){for(var F=0,q=m;F<q.length;F++){var H=q[F],Ce=H[0],Ze=H[1];c.setAttribute(Ce,Ze)}},G.createRect=function(c,m,F){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",m.toString()),F&&G.setAttributes(q,F),q},G.createLine=function(c,m,F,q,H){var Ce=document.createElementNS("http://www.w3.org/2000/svg","line");return Ce.setAttribute("x1",c.toString()),Ce.setAttribute("y1",m.toString()),Ce.setAttribute("x2",F.toString()),Ce.setAttribute("y2",q.toString()),H&&G.setAttributes(Ce,H),Ce},G.createPolygon=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",c),m&&G.setAttributes(F,m),F},G.createCircle=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(c/2).toString()),F.setAttribute("cy",(c/2).toString()),F.setAttribute("r",c.toString()),m&&G.setAttributes(F,m),F},G.createEllipse=function(c,m,F){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(m/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(m/2).toString()),F&&G.setAttributes(q,F),q},G.createGroup=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&G.setAttributes(m,c),m},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(c,m,F,q,H,Ce,Ze){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(nt,[["id",c],["orient",m],["markerWidth",F.toString()],["markerHeight",q.toString()],["refX",H.toString()],["refY",Ce.toString()]]),nt.appendChild(Ze),nt},G.createText=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),c&&G.setAttributes(m,c),m},G.createTSpan=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=c,m&&G.setAttributes(F,m),F},G.createImage=function(c){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&G.setAttributes(m,c),m},G.createPoint=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=c,F.y=m,F},G.createPath=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",c),m&&G.setAttributes(F,m),F},G.createElement=function(c,m){var F=document.createElementNS("http://www.w3.org/2000/svg",c);return m&&G.setAttributes(F,m),F},G.getHollowRectanglePath=function(c,m,F,q,H,Ce,Ze,nt){return"M"+c+","+m+"V"+(m+q)+"H"+(c+F)+"V"+m+"H"+H+"V"+Ce+"H"+(H+Ze)+"V"+(Ce+nt)+"H"+H+"V"+m+"Z"},G}(),pr=function(){function G(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},G.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new Bt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Bt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Bt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new tr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new tr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),Bt=function(G,c){this.selector=G,this.style=c},tr=function(G,c){this.localName=G,this.style=c},ur=function(){function G(){this.blocks=[],this.display=""}return G.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},G.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},G.prototype.getUI=function(){var c=document.createElement("div");return c.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,c.style.display=this.display,this.blocks.forEach(function(m){return c.appendChild(m.getUI())}),c},G}(),nr=function(){function G(){}return G.prototype.getUI=function(){var c=document.createElement("div");if(c.className=this.className,this.minWidth!==void 0&&(c.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":c.style.justifyContent="flex-start";break;case"center":c.style.justifyContent="center";break;case"end":c.style.justifyContent="flex-end"}return c.style.whiteSpace="nowrap",c},G}(),vr=function(G){function c(){var m=G!==null&&G.apply(this,arguments)||this;return m.buttons=[],m}return Dt(c,G),c.prototype.addButton=function(m){m.className=this.buttonClassName,m.colorsClassName=this.buttonColorsClassName,m.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(m)},c.prototype.getUI=function(){var m=G.prototype.getUI.call(this);return this.buttons.forEach(function(F){return m.appendChild(F.getUI())}),m},c}(nr),Nt=function(){function G(c,m){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=m,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(G.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){var c=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 c.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},G.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,"")))},G.prototype.hide=function(){this._isHidden=!0},G}(),ft=function(G){function c(){var m=G!==null&&G.apply(this,arguments)||this;return m.elements=[],m}return Dt(c,G),c.prototype.addElement=function(m){this.elements.push(m)},c.prototype.getUI=function(){var m=G.prototype.getUI.call(this);return this.elements.forEach(function(F){return m.appendChild(F)}),m},c}(nr),sr=function(){function G(c,m){this.horizontal=c,this.vertical=m}return Object.defineProperty(G.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),G.prototype.getVerticalLength=function(c){return c/this.ratio},G.prototype.getHorizontalLength=function(c){return c*this.ratio},G}(),Tr=function(){function G(){}return G.getIcon=function(c,m){if(c>0&&m>0){var F=new sr(c,m),q=F.ratio>=1?20:F.getHorizontalLength(20),H=F.ratio<1?20:F.getVerticalLength(20),Ce=document.createElementNS("http://www.w3.org/2000/svg","svg");Ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Ce);var Ze=yt.createDefs();Ce.appendChild(Ze);var nt=yt.createElement("clipPath",[["id","text-bg-clip"]]);Ze.appendChild(nt);var lt=yt.createPath(yt.getHollowRectanglePath((24-q)/2,(24-H)/2,q,H,(24-q)/2+2,(24-H)/2+2,q-4,H-4));Ce.appendChild(lt);var Xe=yt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Xe.appendChild(yt.createTSpan(c+":"+m)),Ce.appendChild(Xe);var pt=Xe.getBBox();yt.setAttributes(Xe,[["x",((24-pt.width)/2).toString()],["y",((24-pt.height)/2-pt.y).toString()]]);var mt=yt.createPath(yt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(pt.width))/2,(24-Math.ceil(pt.height))/2,Math.ceil(pt.width),Math.ceil(pt.height)));return nt.appendChild(mt),yt.setAttributes(lt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Ce),Ce.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>'},G}(),gr=function(G){function c(m,F,q){var H=G.call(this,m,F)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=q,H}return Dt(c,G),c.prototype.setupDropdown=function(){var m=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=m.className,F.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(F.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(Nt),Pt=function(){function G(c,m){this.GRIP_SIZE=10,this.color=c,this.fillColor=m,this.visual=yt.createGroup(),this.visual.appendChild(yt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(yt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},G.prototype.setCenter=function(c,m){this.visual.childNodes.forEach(function(F){return yt.setAttributes(F,[["cx",c.toString()],["cy",m.toString()]])})},G}(),yr=function(){function G(c,m,F,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=m,this.margin=F,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(G.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&yt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var c=this;this.cropShadeElement=yt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=yt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;m<this.numberOfGridLines;m++)this.horizontalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(F){return c.gridContainer.appendChild(F)}),this.verticalGridLines.forEach(function(F){return c.gridContainer.appendChild(F)}),this.cropRectElement=yt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},G.prototype.setCropRectangle=function(c){this.cropRect=c;var m=Object.assign({},this.cropRect);this.zoomFactor!==1&&(m.width=this.cropRect.width*this.zoomFactor,m.height=this.cropRect.height*this.zoomFactor,m.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-m.width/2,m.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),yt.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var F=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,Ce){var Ze=m.y+F*(Ce+1);yt.setAttributes(H,[["x1",""+m.x],["y1",""+Ze],["x2",""+(m.x+m.width)],["y2",""+Ze]])});var q=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,Ce){var Ze=m.x+q*(Ce+1);yt.setAttributes(H,[["x1",""+Ze],["y1",""+m.y],["x2",""+Ze],["y2",""+(m.y+m.height)]])}),yt.setAttributes(this.cropShadeElement,[["d",yt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.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)},G.prototype.clientToLocalCoordinates=function(c,m){var F=this.container.getBoundingClientRect();return{x:c-F.left+this.margin,y:m-F.top+this.margin}},G.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},G.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(m)}c.preventDefault()},G.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},G.prototype.move=function(c){var m=c.x-this.previousPoint.x,F=c.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,F=-F/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),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=c},G.prototype.resize=function(c){var m=Object.assign({},this.cropRect),F=c.x-this.previousPoint.x,q=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+F<this.margin&&(F=this.margin-m.x),m.x+=F,m.width=this.cropRect.x+this.cropRect.width-m.x;break;case this.bottomRightGrip:case this.topRightGrip:m.width+F>this.canvasWidth*this.zoomFactor&&(F=this.canvasWidth*this.zoomFactor-m.width),m.width+=F}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(F),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=q,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=q}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=c,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,F=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);F/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=F:this.cropRect.height=q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=c-this.cropRect.width/2,this.cropRect.y=m-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)}},G.prototype.getRescaledRect=function(c,m,F,q,H,Ce){var Ze=F/c,nt=q/m;return{x:(H.x-Ce)*Ze+Ce,y:(H.y-Ce)*nt+Ce,width:H.width*Ze,height:H.height*nt}},G.prototype.scaleCanvas=function(c,m){var F=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,m,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=m,this.onCropChange&&this.onCropChange(F),this.setCropRectangle(F)},G}(),dr=function(){function G(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,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(G.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.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},G.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},G.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},G.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();yt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},G.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},G.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,F=1;F<=this.width/5+10;F++){var q=F%5==0?this.height/3:this.height/6;m+="h4v"+-q+"h1v"+q}m+="v1H0Z",this.scaleShape=yt.createPath(m);var H=yt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),c.appendChild(this.scaleShape),this.angleLabelElement=yt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=yt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Ce=yt.createTSpan("");return Ce.innerHTML="&deg;",this.angleLabelElement.appendChild(Ce),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},G}(),qr=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(c,m,F,q,H,Ce,Ze){var nt=this;return new Promise(function(lt){var Xe=document.createElement("canvas");Xe.width=c.width.baseVal.value-2*q,Xe.height=c.height.baseVal.value-2*q;var pt=1,mt=1;nt.naturalSize===!0?(pt=m.naturalWidth/(c.width.baseVal.value-2*q)/Ce,mt=m.naturalHeight/(c.height.baseVal.value-2*q)/Ze,Xe.width=m.naturalWidth/Ce,Xe.height=m.naturalHeight/Ze):nt.width!==void 0&&nt.height!==void 0&&(pt=nt.width/F.width,mt=nt.height/F.height,Xe.width*=pt,Xe.height*=mt);var It=Xe.getContext("2d");It.translate(Xe.width/2,Xe.height/2),It.rotate(H*Math.PI/180),It.scale(Ce,Ze),It.translate(-Xe.width/2,-Xe.height/2),It.drawImage(m,0,0,Xe.width,Xe.height);var lr=document.createElement("canvas");lr.width=F.width*pt,lr.height=F.height*mt,lr.getContext("2d").putImageData(It.getImageData((F.x-q)*pt,(F.y-q)*mt,F.width*pt,F.height*mt),0,0),lt(lr.toDataURL(nt.imageType,nt.imageQuality))})},G}(),qe=function(){function G(c){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=G.instanceCounter++,this.styles=new pr(this.instanceNo),this.target=c,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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),G.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},G.prototype.show=function(){this.showUI(),this.open()},G.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},G.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},G.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},G.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},G.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.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))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,F=m+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(m,F)}},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.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",yt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},G.prototype.resize=function(c,m){this.imageWidth=Math.round(c),this.imageHeight=Math.round(m),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()},G.prototype.setEditingTarget=function(){var c=document.createElement("canvas");c.width=this.target.naturalWidth,c.height=this.target.naturalHeight,c.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var m=c.toDataURL();yt.setAttributes(this.editingTarget,[["href",m]]),this.setEditingTargetSize()},G.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=c.left-m.left-this.CANVAS_MARGIN,this.top=c.top-m.top-this.CANVAS_MARGIN},G.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=yt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=yt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=yt.createGroup(),this.editingTargetRotationScaleContainer=yt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=yt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var m=yt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(m),this.editingTargetContainer=yt.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)},G.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},G.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=yt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new yr(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()},G.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,m=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=c+"px "+m+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-m+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},G.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)},G.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},G.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 c=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,m=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new ur,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 m=new vr;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var F=[];this.aspectRatios.forEach(function(mt){var It=new Nt(Tr.getIcon(mt.horizontal,mt.vertical),mt.horizontal===0&&mt.vertical===0?"FREE":mt.horizontal+":"+mt.vertical);It.onClick=function(){return c.ratioButtonClicked(mt)},F.push(It)}),this.aspectRatioButton=new gr(Tr.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,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Nt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){c.isGridVisible=!c.isGridVisible,q.isActive=c.isGridVisible},m.addButton(q);var H=new Nt('<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(H.isActive=this.zoomToCropEnabled,H.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,H.isActive=c.zoomToCropEnabled},m.addButton(H),!Qt.isLicensed){var Ce=new ft;this.topToolbar.addElementBlock(Ce);var Ze=document.createElement("div");Ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.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>',Ze.appendChild(nt),Ce.addElement(Ze)}var lt=new vr;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var Xe=new Nt('<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");Xe.onClick=this.startRenderAndClose,lt.addButton(Xe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Xe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var pt=new Nt('<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");pt.onClick=this.close,lt.addButton(pt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(pt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new ur,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 m=new vr;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var F=new Nt('<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,m.addButton(F);var q=new Nt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");q.onClick=this.rotateRightButtonClicked,m.addButton(q);var H=new ft;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new dr("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(lt){c.rotateBy(lt),c.straightener.angle=c.rotationAngle},H.addElement(this.straightener.getUI());var Ce=new vr;Ce.minWidth=2*this.toolbarHeight+"px",Ce.contentAlign="end",this.bottomToolbar.addButtonBlock(Ce);var Ze=new Nt('<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");Ze.onClick=this.flipHorizontallyButtonClicked,Ce.addButton(Ze);var nt=new Nt('<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");nt.onClick=this.flipVerticallyButtonClicked,Ce.addButton(nt)},G.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new sr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(c){if(c){var m=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(c,m){var F=this.cropImage.getBoundingClientRect();return{x:c-F.left,y:m-F.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"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()},G.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},G.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},G.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},G.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},G.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,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=c},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var c,m;return Ut(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return c=F.sent(),m=this.getState(),this.renderEventListeners.forEach(function(q){return q(c,m)}),this.close(!0),[2]}})})},G.prototype.render=function(){return Tt(this,void 0,void 0,function(){var c;return Ut(this,function(m){switch(m.label){case 0:return(c=new qr).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),yt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.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 m.sent(),[4,c.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,m.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new tr("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 tr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new tr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new tr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*c)+`px;
height: `+(this.toolbarHeight-2*c)+`px;
padding: `+c+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new tr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new tr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Bt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Bt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new tr("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 tr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new tr("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 tr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*c)+`px;
padding: `+c+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new tr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},G.instanceCounter=0,G}(),wt=ie("8hTe"),zr=ie.n(wt),Ir=/<pre[^>]*>/g;function Zr(G){var c=document.createElement("div");return c.innerHTML=G,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var Wr=tt.a=function(G){var c=G.value,m=c===void 0?"":c,F=G.edit,q=F===void 0?!1:F,H=G.className,Ce=G.showTextOnly,Ze=G.showLines,nt=G.replaces,lt=G.zoomImg,Xe=G.hasMask,pt=G.style,mt=pt===void 0?{}:pt,It=G.stylesPrev,lr=It===void 0?{}:It,$t=String(m),rr=Object(R.useRef)(),xr=Object(R.useRef)(),Nr=Object(R.useState)(""),ir=Object(K.a)(Nr,2),Xt=ir[0],wr=ir[1],Hr=Object(R.useState)("office"),ar=Object(K.a)(Hr,2),yn=ar[0],Ar=ar[1],_r=function(){var Ht=new qe(xr.current);Ht.displayMode="popup",Ht.addRenderEventListener(function(){var br=Object(I.a)(M.a.mark(function Ft(cr){var zt;return M.a.wrap(function(mr){for(;;)switch(mr.prev=mr.next){case 0:return rr.current.style.display="none",mr.next=3,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:cr}});case 3:zt=mr.sent,zt!=null&&zt.id&&nt(xr.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return mr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Ht.show()},Rn=function(){var Ht=new Lt(xr.current);Ht.settings.displayMode="popup",Ht.addEventListener("render",function(){var br=Object(I.a)(M.a.mark(function Ft(cr){var zt;return M.a.wrap(function(mr){for(;;)switch(mr.prev=mr.next){case 0:if(rr.current.style.display="none",!xr.current){mr.next=6;break}return mr.next=4,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:cr.dataUrl}});case 4:zt=mr.sent,zt!=null&&zt.id&&nt(xr.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return mr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Ht.show(),window.markerArea=Ht},jt=Object(R.useMemo)(function(){rr.current&&(rr.current.style.zIndex=-1);try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ht=/\"\/api\/attachments\/|\"\/attachments\/download\//g,br=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;$t=$t.replace(Zt,"("+re.a.API_SERVER+"/api/attachments/").replace(Ht,'"'+re.a.API_SERVER+"/api/attachments/").replace(br,'"'+re.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(Vr){}var Ft=V($t),cr=T();if($t.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",w()),S()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(Vr,mr){var Lr=cr[mr],ln=Lr.type,pn=Lr.expression;return Object(pe.renderToString)(Zr(pn)||"",{displayMode:ln==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),v(),Ce){var zt=document.createElement("div");return zt.innerHTML=Ft,zt.innerText}return setTimeout(function(){return Cr()},500),Ft},[$t]),vt=Object(R.useRef)();g.WebkitLineClamp=Ze,Ze&&(mt=Object(U.a)(Object(U.a)({},mt),g));function ot(Zt){var Ht=Zt.target;if(Ht.tagName.toUpperCase()==="IMG"){if(lt){var br=Ht.getAttribute("src");wr(br),Ar("image")}}else if(Ht.tagName.toUpperCase()==="A"){var Ft=Ht.getAttribute("href");if(Ft.indexOf("office")>-1)Zt.preventDefault(),wr(Ft),Ar("office");else if(Ft.indexOf("application/pdf")>-1)Zt.preventDefault(),wr(Ft),Ar("pdf");else if(Ft.indexOf("text/html")>-1)Zt.preventDefault(),wr(Ft),Ar("html");else if(Ft.startsWith("#")){Zt.preventDefault();var cr=document.getElementById(Ft.replace("#",""));cr&&cr.scrollIntoView(!0)}}}var Cr=function(){var Ht,br=(Ht=vt.current)===null||Ht===void 0?void 0:Ht.querySelectorAll("video");br==null||br.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var cr=new $.a;cr.loadSource(Ft.src),cr.attachMedia(Ft)}}})};Object(R.useEffect)(function(){if(vt.current&&jt&&(jt.match(Ir)&&window.PR.prettyPrint()),vt.current)return vt.current.addEventListener("click",ot),function(){vt.current.removeEventListener("click",ot),v(),S()}},[jt,vt.current,ot]);var Yt=function(Ht){if(!q)return;Ht.target.nodeName==="IMG"?(rr.current.style.zIndex=1,rr.current.style.display="flex",rr.current.style.width=Ht.target.clientWidth+"px",rr.current.style.height=Ht.target.clientHeight+"px",rr.current.style.top=Ht.target.offsetTop+"px",rr.current.style.left=Ht.target.offsetLeft+"px",xr.current.src=Ht.target.getAttribute("src")):rr.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:vt,style:Object(U.a)({},mt),className:"".concat(H||""," markdown-body ").concat(zr.a.mdBody),onMouseOver:Yt,dangerouslySetInnerHTML:{__html:jt}}),E.a.createElement("div",{ref:rr,className:zr.a.button},E.a.createElement(Y.a,null,E.a.createElement(Z.a,{onClick:function(){return _r()}},"\u88C1\u526A"),E.a.createElement(Z.a,{onClick:function(){return Rn()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(ve.a,{close:!0,data:Xt,type:Xt!=null&&Xt.length?yn:"",style:Object(U.a)({},lr),onClose:function(){return wr("")}}))}},"9VGf":function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return O});var he=ie("q1tI"),Y=ie.n(he);function O(Z,U){var I=Object(he.useRef)();Object(he.useEffect)(function(){I.current=Z}),Object(he.useEffect)(function(){function K(){I.current()}if(U!==null){var B=setInterval(K,U);return function(){return clearInterval(B)}}},[U])}},Bd2K:function(Et,tt,ie){(function(he){he(ie("VrN/"),ie("osHv"))})(function(he){he.defineOption("autoCloseTags",!1,function(M,R,E){if(E!=he.Init&&E&&M.removeKeyMap("autoCloseTags"),!R)return;var L={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(L["'/'"]=function(_){return I(_)}),(typeof R!="object"||R.whenOpening!==!1)&&(L["'>'"]=function(_){return Z(_)}),M.addKeyMap(L)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["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 Z(M){if(M.getOption("disableInput"))return he.Pass;for(var R=M.listSelections(),E=[],L=M.getOption("autoCloseTags"),_=0;_<R.length;_++){if(!R[_].empty())return he.Pass;var A=R[_].head,x=M.getTokenAt(A),y=he.innerMode(M.getMode(),x.state),h=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return he.Pass;var d=y.mode.configuration=="html",S=typeof L=="object"&&L.dontCloseTags||d&&Y,g=typeof L=="object"&&L.indentTags||d&&O;x.end>A.ch&&(l=l.slice(0,l.length-x.end+A.ch));var p=l.toLowerCase();if(!l||x.type=="string"&&(x.end!=A.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==A.ch-x.start-1||S&&K(S,p)>-1||B(M,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(h)||[],l,A,!0))return he.Pass;var w=typeof L=="object"&&L.emptyTags;if(w&&K(w,l)>-1){E[_]={text:"/>",newPos:he.Pos(A.line,A.ch+2)};continue}var b=g&&K(g,p)>-1;E[_]={indent:b,text:">"+(b?`
`:"")+"</"+l+">",newPos:b?he.Pos(A.line+1,0):he.Pos(A.line,A.ch+1)}}for(var u=typeof L=="object"&&L.dontIndentOnAutoClose,_=R.length-1;_>=0;_--){var f=E[_];M.replaceRange(f.text,R[_].head,R[_].anchor,"+insert");var s=M.listSelections().slice(0);s[_]={head:f.newPos,anchor:f.newPos},M.setSelections(s),!u&&f.indent&&(M.indentLine(f.newPos.line,null,!0),M.indentLine(f.newPos.line+1,null,!0))}}function U(M,R){for(var E=M.listSelections(),L=[],_=R?"/":"</",A=M.getOption("autoCloseTags"),x=typeof A=="object"&&A.dontIndentOnSlash,y=0;y<E.length;y++){if(!E[y].empty())return he.Pass;var h=E[y].head,o=M.getTokenAt(h),l=he.innerMode(M.getMode(),o.state),d=l.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return he.Pass;var S,g=l.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(g&&l.mode.name=="javascript")S=_+"script";else if(g&&l.mode.name=="css")S=_+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!p||p.length&&B(M,p,p[p.length-1],h))return he.Pass;S=_+p[p.length-1]}M.getLine(h.line).charAt(o.end)!=">"&&(S+=">"),L[y]=S}if(M.replaceSelections(L),E=M.listSelections(),!x)for(var y=0;y<E.length;y++)(y==E.length-1||E[y].head.line<E[y+1].head.line)&&M.indentLine(E[y].head.line)}function I(M){return M.getOption("disableInput")?he.Pass:U(M,!0)}he.commands.closeTag=function(M){return U(M)};function K(M,R){if(M.indexOf)return M.indexOf(R);for(var E=0,L=M.length;E<L;++E)if(M[E]==R)return E;return-1}function B(M,R,E,L,_){if(!he.scanForClosingTag)return!1;var A=Math.min(M.lastLine()+1,L.line+500),x=he.scanForClosingTag(M,L,null,A);if(!x||x.tag!=E)return!1;for(var y=_?1:0,h=R.length-1;h>=0&&R[h]==E;h--)++y;L=x.to;for(var h=1;h<y;h++){var o=he.scanForClosingTag(M,L,null,A);if(!o||o.tag!=E)return!1;L=o.to}return!0}})},BjJ7:function(Et,tt,ie){"use strict";ie.d(tt,"d",function(){return Y}),ie.d(tt,"c",function(){return O}),ie.d(tt,"e",function(){return Z}),ie.d(tt,"b",function(){return U}),ie.d(tt,"a",function(){return K});var he=ie("m3rI");function Y(B){var M=!0;if(B.length>0){for(var R=0;R<B.length;R++)if(B[R].compile_success==0||!B[R].compile_success){M=!1;break}}else M=!1;return M}function O(B){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],E=0;E<B.length;E++){var L=B[E],_=M?"".concat(M,"/").concat(L.name):"".concat(L.name);R.push({title:L.name,isLeaf:!(L.type==="tree"),key:_})}return R}function Z(B,M,R){for(var E=0;E<B.length;E++){var L=B[E];if(L.key===M){L.children=R;break}L.children&&Z(L.children,M,R)}return B}function U(B,M,R){var E;return function(){var L=this,_=arguments,A=function(){E=null,R||B.apply(L,_)},x=R&&!E;clearTimeout(E),E=setTimeout(A,M),x&&B.apply(L,_)}}var I=!0,K=he.a.API_SERVER},"C+DQ":function(Et,tt,ie){},DlQD:function(Et,tt,ie){(function(he,Y){Et.exports=Y()})(this,function(){"use strict";function he(Se,ye){for(var xe=0;xe<ye.length;xe++){var le=ye[xe];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(Se,le.key,le)}}function Y(Se,ye,xe){return ye&&he(Se.prototype,ye),xe&&he(Se,xe),Se}function O(Se,ye){if(!Se)return;if(typeof Se=="string")return Z(Se,ye);var xe=Object.prototype.toString.call(Se).slice(8,-1);if(xe==="Object"&&Se.constructor&&(xe=Se.constructor.name),xe==="Map"||xe==="Set")return Array.from(Se);if(xe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(xe))return Z(Se,ye)}function Z(Se,ye){(ye==null||ye>Se.length)&&(ye=Se.length);for(var xe=0,le=new Array(ye);xe<ye;xe++)le[xe]=Se[xe];return le}function U(Se,ye){var xe;if(typeof Symbol=="undefined"||Se[Symbol.iterator]==null){if(Array.isArray(Se)||(xe=O(Se))||ye&&Se&&typeof Se.length=="number"){xe&&(Se=xe);var le=0;return function(){return le>=Se.length?{done:!0}:{done:!1,value:Se[le++]}}}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 xe=Se[Symbol.iterator](),xe.next.bind(xe)}function I(Se,ye){return ye={exports:{}},Se(ye,ye.exports),ye.exports}var K=I(function(Se){function ye(){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 xe(le){Se.exports.defaults=le}Se.exports={defaults:ye(),getDefaults:ye,changeDefaults:xe}}),B=K.defaults,M=K.getDefaults,R=K.changeDefaults,E=/[&<>"']/,L=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=function(ye){return x[ye]};function h(Se,ye){if(ye){if(E.test(Se))return Se.replace(L,y)}else if(_.test(Se))return Se.replace(A,y);return Se}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(Se){return Se.replace(o,function(ye,xe){return xe=xe.toLowerCase(),xe==="colon"?":":xe.charAt(0)==="#"?xe.charAt(1)==="x"?String.fromCharCode(parseInt(xe.substring(2),16)):String.fromCharCode(+xe.substring(1)):""})}var d=/(^|[^\[])\^/g;function S(Se,ye){Se=Se.source||Se,ye=ye||"";var xe={replace:function(ue,me){return me=me.source||me,me=me.replace(d,"$1"),Se=Se.replace(ue,me),xe},getRegex:function(){return new RegExp(Se,ye)}};return xe}var g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(Se,ye,xe){if(Se){var le;try{le=decodeURIComponent(l(xe)).replace(g,"").toLowerCase()}catch(ue){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}ye&&!p.test(xe)&&(xe=a(ye,xe));try{xe=encodeURI(xe).replace(/%25/g,"%")}catch(ue){return null}return xe}var b={},u=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Se,ye){b[" "+Se]||(u.test(Se)?b[" "+Se]=Se+"/":b[" "+Se]=D(Se,"/",!0)),Se=b[" "+Se];var xe=Se.indexOf(":")===-1;return ye.substring(0,2)==="//"?xe?ye:Se.replace(f,"$1")+ye:ye.charAt(0)==="/"?xe?ye:Se.replace(s,"$1")+ye:Se+ye}var T={exec:function(){}};function v(Se){for(var ye=1,xe,le;ye<arguments.length;ye++){xe=arguments[ye];for(le in xe)Object.prototype.hasOwnProperty.call(xe,le)&&(Se[le]=xe[le])}return Se}function C(Se,ye){var xe=Se.replace(/\|/g,function(me,Ee,we){for(var Ie=!1,$e=Ee;--$e>=0&&we[$e]==="\\";)Ie=!Ie;return Ie?"|":" |"}),le=xe.split(/ \|/),ue=0;if(le.length>ye)le.splice(ye);else for(;le.length<ye;)le.push("");for(;ue<le.length;ue++)le[ue]=le[ue].trim().replace(/\\\|/g,"|");return le}function D(Se,ye,xe){var le=Se.length;if(le===0)return"";for(var ue=0;ue<le;){var me=Se.charAt(le-ue-1);if(me===ye&&!xe)ue++;else if(me!==ye&&xe)ue++;else break}return Se.substr(0,le-ue)}function j(Se,ye){if(Se.indexOf(ye[1])===-1)return-1;for(var xe=Se.length,le=0,ue=0;ue<xe;ue++)if(Se[ue]==="\\")ue++;else if(Se[ue]===ye[0])le++;else if(Se[ue]===ye[1]&&(le--,le<0))return ue;return-1}function z(Se){Se&&Se.sanitize&&!Se.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 V={escape:h,unescape:l,edit:S,cleanUrl:w,resolveUrl:a,noopTest:T,merge:v,splitCells:C,rtrim:D,findClosingBracket:j,checkSanitizeDeprecation:z},P=K.defaults,N=V.rtrim,$=V.splitCells,re=V.escape,pe=V.findClosingBracket;function ve(Se,ye,xe){var le=ye.href,ue=ye.title?re(ye.title):null,me=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:xe,href:le,title:ue,text:me}:{type:"image",raw:xe,href:le,title:ue,text:re(me)}}function Ae(Se,ye){var xe=Se.match(/^(\s+)(?:```)/);if(xe===null)return ye;var le=xe[1];return ye.split(`
`).map(function(ue){var me=ue.match(/^\s+/);if(me===null)return ue;var Ee=me[0];return Ee.length>=le.length?ue.slice(le.length):ue}).join(`
`)}var Le=function(){function Se(xe){this.options=xe||P}var ye=Se.prototype;return ye.space=function(le){var ue=this.rules.block.newline.exec(le);if(ue)return ue[0].length>1?{type:"space",raw:ue[0]}:{raw:`
`}},ye.code=function(le,ue){var me=this.rules.block.code.exec(le);if(me){var Ee=ue[ue.length-1];if(Ee&&Ee.type==="paragraph")return{raw:me[0],text:me[0].trimRight()};var we=me[0].replace(/^ {4}/gm,"");return{type:"code",raw:me[0],codeBlockStyle:"indented",text:this.options.pedantic?we:N(we,`
`)}}},ye.fences=function(le){var ue=this.rules.block.fences.exec(le);if(ue){var me=ue[0],Ee=Ae(me,ue[3]||"");return{type:"code",raw:me,lang:ue[2]?ue[2].trim():ue[2],text:Ee}}},ye.heading=function(le){var ue=this.rules.block.heading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[1].length,text:ue[2]}},ye.nptable=function(le){var ue=this.rules.block.nptable.exec(le);if(ue){var me={type:"table",header:$(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
`):[],raw:ue[0]};if(me.header.length===me.align.length){var Ee=me.align.length,we;for(we=0;we<Ee;we++)/^ *-+: *$/.test(me.align[we])?me.align[we]="right":/^ *:-+: *$/.test(me.align[we])?me.align[we]="center":/^ *:-+ *$/.test(me.align[we])?me.align[we]="left":me.align[we]=null;for(Ee=me.cells.length,we=0;we<Ee;we++)me.cells[we]=$(me.cells[we],me.header.length);return me}}},ye.hr=function(le){var ue=this.rules.block.hr.exec(le);if(ue)return{type:"hr",raw:ue[0]}},ye.blockquote=function(le){var ue=this.rules.block.blockquote.exec(le);if(ue){var me=ue[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ue[0],text:me}}},ye.list=function(le){var ue=this.rules.block.list.exec(le);if(ue){for(var me=ue[0],Ee=ue[2],we=Ee.length>1,Ie=Ee[Ee.length-1]===")",$e={type:"list",raw:me,ordered:we,start:we?+Ee.slice(0,-1):"",loose:!1,items:[]},at=ue[0].match(this.rules.block.item),ht=!1,ut,xt,Ct,st,Mt,Lt,kt,Dt=at.length,Tt=0;Tt<Dt;Tt++)ut=at[Tt],me=ut,xt=ut.length,ut=ut.replace(/^ *([*+-]|\d+[.)]) */,""),~ut.indexOf(`
`)&&(xt-=ut.length,ut=this.options.pedantic?ut.replace(/^ {1,4}/gm,""):ut.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),Tt!==Dt-1&&(Ct=this.rules.block.bullet.exec(at[Tt+1])[0],(we?Ct.length===1||!Ie&&Ct[Ct.length-1]===")":Ct.length>1||this.options.smartLists&&Ct!==Ee)&&(st=at.slice(Tt+1).join(`
`),$e.raw=$e.raw.substring(0,$e.raw.length-st.length),Tt=Dt-1)),Mt=ht||/\n\n(?!\s*$)/.test(ut),Tt!==Dt-1&&(ht=ut.charAt(ut.length-1)===`
`,Mt||(Mt=ht)),Mt&&($e.loose=!0),Lt=/^\[[ xX]\] /.test(ut),kt=void 0,Lt&&(kt=ut[1]!==" ",ut=ut.replace(/^\[[ xX]\] +/,"")),$e.items.push({type:"list_item",raw:me,task:Lt,checked:kt,loose:Mt,text:ut});return $e}},ye.html=function(le){var ue=this.rules.block.html.exec(le);if(ue)return{type:this.options.sanitize?"paragraph":"html",raw:ue[0],pre:!this.options.sanitizer&&(ue[1]==="pre"||ue[1]==="script"||ue[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):re(ue[0]):ue[0]}},ye.def=function(le){var ue=this.rules.block.def.exec(le);if(ue){ue[3]&&(ue[3]=ue[3].substring(1,ue[3].length-1));var me=ue[1].toLowerCase().replace(/\s+/g," ");return{tag:me,raw:ue[0],href:ue[2],title:ue[3]}}},ye.table=function(le){var ue=this.rules.block.table.exec(le);if(ue){var me={type:"table",header:$(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
`):[]};if(me.header.length===me.align.length){me.raw=ue[0];var Ee=me.align.length,we;for(we=0;we<Ee;we++)/^ *-+: *$/.test(me.align[we])?me.align[we]="right":/^ *:-+: *$/.test(me.align[we])?me.align[we]="center":/^ *:-+ *$/.test(me.align[we])?me.align[we]="left":me.align[we]=null;for(Ee=me.cells.length,we=0;we<Ee;we++)me.cells[we]=$(me.cells[we].replace(/^ *\| *| *\| *$/g,""),me.header.length);return me}}},ye.lheading=function(le){var ue=this.rules.block.lheading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[2].charAt(0)==="="?1:2,text:ue[1]}},ye.paragraph=function(le){var ue=this.rules.block.paragraph.exec(le);if(ue)return{type:"paragraph",raw:ue[0],text:ue[1].charAt(ue[1].length-1)===`
`?ue[1].slice(0,-1):ue[1]}},ye.text=function(le,ue){var me=this.rules.block.text.exec(le);if(me){var Ee=ue[ue.length-1];return Ee&&Ee.type==="text"?{raw:me[0],text:me[0]}:{type:"text",raw:me[0],text:me[0]}}},ye.escape=function(le){var ue=this.rules.inline.escape.exec(le);if(ue)return{type:"escape",raw:ue[0],text:re(ue[1])}},ye.tag=function(le,ue,me){var Ee=this.rules.inline.tag.exec(le);if(Ee)return!ue&&/^<a /i.test(Ee[0])?ue=!0:ue&&/^<\/a>/i.test(Ee[0])&&(ue=!1),!me&&/^<(pre|code|kbd|script)(\s|>)/i.test(Ee[0])?me=!0:me&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Ee[0])&&(me=!1),{type:this.options.sanitize?"text":"html",raw:Ee[0],inLink:ue,inRawBlock:me,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):re(Ee[0]):Ee[0]}},ye.link=function(le){var ue=this.rules.inline.link.exec(le);if(ue){var me=pe(ue[2],"()");if(me>-1){var Ee=ue[0].indexOf("!")===0?5:4,we=Ee+ue[1].length+me;ue[2]=ue[2].substring(0,me),ue[0]=ue[0].substring(0,we).trim(),ue[3]=""}var Ie=ue[2],$e="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ie);at?(Ie=at[1],$e=at[3]):$e=""}else $e=ue[3]?ue[3].slice(1,-1):"";Ie=Ie.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ve(ue,{href:Ie&&Ie.replace(this.rules.inline._escapes,"$1"),title:$e&&$e.replace(this.rules.inline._escapes,"$1")},ue[0]);return ht}},ye.reflink=function(le,ue){var me;if((me=this.rules.inline.reflink.exec(le))||(me=this.rules.inline.nolink.exec(le))){var Ee=(me[2]||me[1]).replace(/\s+/g," ");if(Ee=ue[Ee.toLowerCase()],!Ee||!Ee.href){var we=me[0].charAt(0);return{type:"text",raw:we,text:we}}var Ie=ve(me,Ee,me[0]);return Ie}},ye.strong=function(le,ue,me){me===void 0&&(me="");var Ee=this.rules.inline.strong.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){ue=ue.slice(-1*le.length);var we=Ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var Ie;(Ee=we.exec(ue))!=null;)if(Ie=this.rules.inline.strong.middle.exec(ue.slice(0,Ee.index+3)),Ie)return{type:"strong",raw:le.slice(0,Ie[0].length),text:le.slice(2,Ie[0].length-2)}}},ye.em=function(le,ue,me){me===void 0&&(me="");var Ee=this.rules.inline.em.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){ue=ue.slice(-1*le.length);var we=Ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var Ie;(Ee=we.exec(ue))!=null;)if(Ie=this.rules.inline.em.middle.exec(ue.slice(0,Ee.index+2)),Ie)return{type:"em",raw:le.slice(0,Ie[0].length),text:le.slice(1,Ie[0].length-1)}}},ye.codespan=function(le){var ue=this.rules.inline.code.exec(le);if(ue){var me=ue[2].replace(/\n/g," "),Ee=/[^ ]/.test(me),we=me.startsWith(" ")&&me.endsWith(" ");return Ee&&we&&(me=me.substring(1,me.length-1)),me=re(me,!0),{type:"codespan",raw:ue[0],text:me}}},ye.br=function(le){var ue=this.rules.inline.br.exec(le);if(ue)return{type:"br",raw:ue[0]}},ye.del=function(le){var ue=this.rules.inline.del.exec(le);if(ue)return{type:"del",raw:ue[0],text:ue[1]}},ye.autolink=function(le,ue){var me=this.rules.inline.autolink.exec(le);if(me){var Ee,we;return me[2]==="@"?(Ee=re(this.options.mangle?ue(me[1]):me[1]),we="mailto:"+Ee):(Ee=re(me[1]),we=Ee),{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.url=function(le,ue){var me;if(me=this.rules.inline.url.exec(le)){var Ee,we;if(me[2]==="@")Ee=re(this.options.mangle?ue(me[0]):me[0]),we="mailto:"+Ee;else{var Ie;do Ie=me[0],me[0]=this.rules.inline._backpedal.exec(me[0])[0];while(Ie!==me[0]);Ee=re(me[0]),me[1]==="www."?we="http://"+Ee:we=Ee}return{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.inlineText=function(le,ue,me){var Ee=this.rules.inline.text.exec(le);if(Ee){var we;return ue?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):re(Ee[0]):Ee[0]:we=re(this.options.smartypants?me(Ee[0]):Ee[0]),{type:"text",raw:Ee[0],text:we}}},Se}(),ce=V.noopTest,ae=V.edit,de=V.merge,ne={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:ce,table:ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=ae(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=ae(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=ae(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=ae(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=ae(ne._paragraph).replace("hr",ne.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",ne._tag).getRegex(),ne.blockquote=ae(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=de({},ne),ne.gfm=de({},ne.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*|$)"}),ne.gfm.nptable=ae(ne.gfm.nptable).replace("hr",ne.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",ne._tag).getRegex(),ne.gfm.table=ae(ne.gfm.table).replace("hr",ne.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",ne._tag).getRegex(),ne.pedantic=de({},ne.normal,{html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._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:ce,paragraph:ae(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ce,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:ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=ae(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=ae(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=ae(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=ae(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=ae(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=ae(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=ae(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=ae(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=ae(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=ae(se._blockSkip,"g").getRegex(),se.overlapSkip=ae(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=ae(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=ae(se.tag).replace("comment",ne._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=ae(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=ae(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=ae(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=de({},se),se.pedantic=de({},se.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:ae(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=de({},se.normal,{escape:ae(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=ae(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=de({},se.gfm,{br:ae(se.br).replace("{2,}","*").getRegex(),text:ae(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ne,inline:se},ee=K.defaults,oe=J.block,fe=J.inline;function ke(Se){return Se.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 ge(Se){var ye="",xe,le,ue=Se.length;for(xe=0;xe<ue;xe++)le=Se.charCodeAt(xe),Math.random()>.5&&(le="x"+le.toString(16)),ye+="&#"+le+";";return ye}var De=function(){function Se(xe){this.tokens=[],this.tokens.links=Object.create(null),this.options=xe||ee,this.options.tokenizer=this.options.tokenizer||new Le,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:oe.normal,inline:fe.normal};this.options.pedantic?(le.block=oe.pedantic,le.inline=fe.pedantic):this.options.gfm&&(le.block=oe.gfm,this.options.breaks?le.inline=fe.breaks:le.inline=fe.gfm),this.tokenizer.rules=le}Se.lex=function(le,ue){var me=new Se(ue);return me.lex(le)};var ye=Se.prototype;return ye.lex=function(le){return le=le.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(le,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(le,ue,me){ue===void 0&&(ue=[]),me===void 0&&(me=!0),le=le.replace(/^ +$/gm,"");for(var Ee,we,Ie,$e;le;){if(Ee=this.tokenizer.space(le)){le=le.substring(Ee.raw.length),Ee.type&&ue.push(Ee);continue}if(Ee=this.tokenizer.code(le,ue)){le=le.substring(Ee.raw.length),Ee.type?ue.push(Ee):($e=ue[ue.length-1],$e.raw+=`
`+Ee.raw,$e.text+=`
`+Ee.text);continue}if(Ee=this.tokenizer.fences(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.heading(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.nptable(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.hr(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.blockquote(le)){le=le.substring(Ee.raw.length),Ee.tokens=this.blockTokens(Ee.text,[],me),ue.push(Ee);continue}if(Ee=this.tokenizer.list(le)){for(le=le.substring(Ee.raw.length),Ie=Ee.items.length,we=0;we<Ie;we++)Ee.items[we].tokens=this.blockTokens(Ee.items[we].text,[],!1);ue.push(Ee);continue}if(Ee=this.tokenizer.html(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(me&&(Ee=this.tokenizer.def(le))){le=le.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(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.lheading(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(me&&(Ee=this.tokenizer.paragraph(le))){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.text(le,ue)){le=le.substring(Ee.raw.length),Ee.type?ue.push(Ee):($e=ue[ue.length-1],$e.raw+=`
`+Ee.raw,$e.text+=`
`+Ee.text);continue}if(le){var at="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return ue},ye.inline=function(le){var ue,me,Ee,we,Ie,$e,at=le.length;for(ue=0;ue<at;ue++){$e=le[ue];switch($e.type){case"paragraph":case"text":case"heading":{$e.tokens=[],this.inlineTokens($e.text,$e.tokens);break}case"table":{for($e.tokens={header:[],cells:[]},we=$e.header.length,me=0;me<we;me++)$e.tokens.header[me]=[],this.inlineTokens($e.header[me],$e.tokens.header[me]);for(we=$e.cells.length,me=0;me<we;me++)for(Ie=$e.cells[me],$e.tokens.cells[me]=[],Ee=0;Ee<Ie.length;Ee++)$e.tokens.cells[me][Ee]=[],this.inlineTokens(Ie[Ee],$e.tokens.cells[me][Ee]);break}case"blockquote":{this.inline($e.tokens);break}case"list":{for(we=$e.items.length,me=0;me<we;me++)this.inline($e.items[me].tokens);break}}}return le},ye.inlineTokens=function(le,ue,me,Ee,we){ue===void 0&&(ue=[]),me===void 0&&(me=!1),Ee===void 0&&(Ee=!1),we===void 0&&(we="");var Ie,$e=le,at;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec($e))!=null;)ht.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&($e=$e.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+$e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec($e))!=null;)$e=$e.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+$e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(Ie=this.tokenizer.escape(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.tag(le,me,Ee)){le=le.substring(Ie.raw.length),me=Ie.inLink,Ee=Ie.inRawBlock,ue.push(Ie);continue}if(Ie=this.tokenizer.link(le)){le=le.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,Ee)),ue.push(Ie);continue}if(Ie=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,Ee)),ue.push(Ie);continue}if(Ie=this.tokenizer.strong(le,$e,we)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.em(le,$e,we)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.codespan(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.br(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.del(le)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.autolink(le,ge)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(!me&&(Ie=this.tokenizer.url(le,ge))){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.inlineText(le,Ee,ke)){le=le.substring(Ie.raw.length),we=Ie.raw.slice(-1),ue.push(Ie);continue}if(le){var ut="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return ue},Y(Se,null,[{key:"rules",get:function(){return{block:oe,inline:fe}}}]),Se}(),Me=K.defaults,Ue=V.cleanUrl,Ke=V.escape,He=function(){function Se(xe){this.options=xe||Me}var ye=Se.prototype;return ye.code=function(le,ue,me){var Ee=(ue||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(le,Ee);we!=null&&we!==le&&(me=!0,le=we)}return Ee?'<pre><code class="'+this.options.langPrefix+Ke(Ee,!0)+'">'+(me?le:Ke(le,!0))+`</code></pre>
`:"<pre><code>"+(me?le:Ke(le,!0))+`</code></pre>
`},ye.blockquote=function(le){return`<blockquote>
`+le+`</blockquote>
`},ye.html=function(le){return le},ye.heading=function(le,ue,me,Ee){return this.options.headerIds?"<h"+ue+' id="'+this.options.headerPrefix+Ee.slug(me)+'">'+le+"</h"+ue+`>
`:"<h"+ue+">"+le+"</h"+ue+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(le,ue,me){var Ee=ue?"ol":"ul",we=ue&&me!==1?' start="'+me+'"':"";return"<"+Ee+we+`>
`+le+"</"+Ee+`>
`},ye.listitem=function(le){return"<li>"+le+`</li>
`},ye.checkbox=function(le){return"<input "+(le?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(le){return"<p>"+le+`</p>
`},ye.table=function(le,ue){return ue&&(ue="<tbody>"+ue+"</tbody>"),`<table>
<thead>
`+le+`</thead>
`+ue+`</table>
`},ye.tablerow=function(le){return`<tr>
`+le+`</tr>
`},ye.tablecell=function(le,ue){var me=ue.header?"th":"td",Ee=ue.align?"<"+me+' align="'+ue.align+'">':"<"+me+">";return Ee+le+"</"+me+`>
`},ye.strong=function(le){return"<strong>"+le+"</strong>"},ye.em=function(le){return"<em>"+le+"</em>"},ye.codespan=function(le){return"<code>"+le+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(le){return"<del>"+le+"</del>"},ye.link=function(le,ue,me){if(le=Ue(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<a href="'+Ke(le)+'"';return ue&&(Ee+=' title="'+ue+'"'),Ee+=">"+me+"</a>",Ee},ye.image=function(le,ue,me){if(le=Ue(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<img src="'+le+'" alt="'+me+'"';return ue&&(Ee+=' title="'+ue+'"'),Ee+=this.options.xhtml?"/>":">",Ee},ye.text=function(le){return le},Se}(),Be=function(){function Se(){}var ye=Se.prototype;return ye.strong=function(le){return le},ye.em=function(le){return le},ye.codespan=function(le){return le},ye.del=function(le){return le},ye.html=function(le){return le},ye.text=function(le){return le},ye.link=function(le,ue,me){return""+me},ye.image=function(le,ue,me){return""+me},ye.br=function(){return""},Se}(),rt=function(){function Se(){this.seen={}}var ye=Se.prototype;return ye.slug=function(le){var ue=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ue)){var me=ue;do this.seen[me]++,ue=me+"-"+this.seen[me];while(this.seen.hasOwnProperty(ue))}return this.seen[ue]=0,ue},Se}(),Oe=K.defaults,Fe=V.unescape,je=function(){function Se(xe){this.options=xe||Oe,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new rt}Se.parse=function(le,ue){var me=new Se(ue);return me.parse(le)};var ye=Se.prototype;return ye.parse=function(le,ue){ue===void 0&&(ue=!0);var me="",Ee,we,Ie,$e,at,ht,ut,xt,Ct,st,Mt,Lt,kt,Dt,Tt,Ut,Qt,yt,pr=le.length;for(Ee=0;Ee<pr;Ee++){st=le[Ee];switch(st.type){case"space":continue;case"hr":{me+=this.renderer.hr();continue}case"heading":{me+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Fe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{me+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(xt="",ut="",$e=st.header.length,we=0;we<$e;we++)ut+=this.renderer.tablecell(this.parseInline(st.tokens.header[we]),{header:!0,align:st.align[we]});for(xt+=this.renderer.tablerow(ut),Ct="",$e=st.cells.length,we=0;we<$e;we++){for(ht=st.tokens.cells[we],ut="",at=ht.length,Ie=0;Ie<at;Ie++)ut+=this.renderer.tablecell(this.parseInline(ht[Ie]),{header:!1,align:st.align[Ie]});Ct+=this.renderer.tablerow(ut)}me+=this.renderer.table(xt,Ct);continue}case"blockquote":{Ct=this.parse(st.tokens),me+=this.renderer.blockquote(Ct);continue}case"list":{for(Mt=st.ordered,Lt=st.start,kt=st.loose,$e=st.items.length,Ct="",we=0;we<$e;we++)Tt=st.items[we],Ut=Tt.checked,Qt=Tt.task,Dt="",Tt.task&&(yt=this.renderer.checkbox(Ut),kt?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=yt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=yt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:yt}):Dt+=yt),Dt+=this.parse(Tt.tokens,kt),Ct+=this.renderer.listitem(Dt,Qt,Ut);me+=this.renderer.list(Ct,Mt,Lt);continue}case"html":{me+=this.renderer.html(st.text);continue}case"paragraph":{me+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(Ct=st.tokens?this.parseInline(st.tokens):st.text;Ee+1<pr&&le[Ee+1].type==="text";)st=le[++Ee],Ct+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);me+=ue?this.renderer.paragraph(Ct):Ct;continue}default:{var Bt='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(Bt);return}else throw new Error(Bt)}}}return me},ye.parseInline=function(le,ue){ue=ue||this.renderer;var me="",Ee,we,Ie=le.length;for(Ee=0;Ee<Ie;Ee++){we=le[Ee];switch(we.type){case"escape":{me+=ue.text(we.text);break}case"html":{me+=ue.html(we.text);break}case"link":{me+=ue.link(we.href,we.title,this.parseInline(we.tokens,ue));break}case"image":{me+=ue.image(we.href,we.title,we.text);break}case"strong":{me+=ue.strong(this.parseInline(we.tokens,ue));break}case"em":{me+=ue.em(this.parseInline(we.tokens,ue));break}case"codespan":{me+=ue.codespan(we.text);break}case"br":{me+=ue.br();break}case"del":{me+=ue.del(this.parseInline(we.tokens,ue));break}case"text":{me+=ue.text(we.text);break}default:{var $e='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error($e);return}else throw new Error($e)}}}return me},Se}(),Ge=V.merge,Ve=V.checkSanitizeDeprecation,ze=V.escape,Re=K.getDefaults,Qe=K.changeDefaults,Ye=K.defaults;function Pe(Se,ye,xe){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof ye=="function"&&(xe=ye,ye=null),ye=Ge({},Pe.defaults,ye||{}),Ve(ye),xe){var le=ye.highlight,ue;try{ue=De.lex(Se,ye)}catch(Ie){return xe(Ie)}var me=function($e){var at;if(!$e)try{at=je.parse(ue,ye)}catch(ht){$e=ht}return ye.highlight=le,$e?xe($e):xe(null,at)};if(!le||le.length<3)return me();if(delete ye.highlight,!ue.length)return me();var Ee=0;Pe.walkTokens(ue,function(Ie){Ie.type==="code"&&(Ee++,setTimeout(function(){le(Ie.text,Ie.lang,function($e,at){if($e)return me($e);at!=null&&at!==Ie.text&&(Ie.text=at,Ie.escaped=!0),Ee--,Ee===0&&me()})},0))}),Ee===0&&me();return}try{var we=De.lex(Se,ye);return ye.walkTokens&&Pe.walkTokens(we,ye.walkTokens),je.parse(we,ye)}catch(Ie){if(Ie.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+ze(Ie.message+"",!0)+"</pre>";throw Ie}}Pe.options=Pe.setOptions=function(Se){return Ge(Pe.defaults,Se),Qe(Pe.defaults),Pe},Pe.getDefaults=Re,Pe.defaults=Ye,Pe.use=function(Se){var ye=Ge({},Se);if(Se.renderer&&function(){var le=Pe.defaults.renderer||new He,ue=function(we){var Ie=le[we];le[we]=function(){for(var $e=arguments.length,at=new Array($e),ht=0;ht<$e;ht++)at[ht]=arguments[ht];var ut=Se.renderer[we].apply(le,at);return ut===!1&&(ut=Ie.apply(le,at)),ut}};for(var me in Se.renderer)ue(me);ye.renderer=le}(),Se.tokenizer&&function(){var le=Pe.defaults.tokenizer||new Le,ue=function(we){var Ie=le[we];le[we]=function(){for(var $e=arguments.length,at=new Array($e),ht=0;ht<$e;ht++)at[ht]=arguments[ht];var ut=Se.tokenizer[we].apply(le,at);return ut===!1&&(ut=Ie.apply(le,at)),ut}};for(var me in Se.tokenizer)ue(me);ye.tokenizer=le}(),Se.walkTokens){var xe=Pe.defaults.walkTokens;ye.walkTokens=function(le){Se.walkTokens(le),xe&&xe(le)}}Pe.setOptions(ye)},Pe.walkTokens=function(Se,ye){for(var xe=U(Se),le;!(le=xe()).done;){var ue=le.value;ye(ue);switch(ue.type){case"table":{for(var me=U(ue.tokens.header),Ee;!(Ee=me()).done;){var we=Ee.value;Pe.walkTokens(we,ye)}for(var Ie=U(ue.tokens.cells),$e;!($e=Ie()).done;)for(var at=$e.value,ht=U(at),ut;!(ut=ht()).done;){var xt=ut.value;Pe.walkTokens(xt,ye)}break}case"list":{Pe.walkTokens(ue.items,ye);break}default:ue.tokens&&Pe.walkTokens(ue.tokens,ye)}}},Pe.Parser=je,Pe.parser=je.parse,Pe.Renderer=He,Pe.TextRenderer=Be,Pe.Lexer=De,Pe.lexer=De.lex,Pe.Tokenizer=Le,Pe.Slugger=rt,Pe.parse=Pe;var We=Pe;return We})},ELLl:function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=he.Pos;he.defineOption("autoCloseBrackets",!1,function(x,y,h){h&&h!=he.Init&&(x.removeKeyMap(U),x.state.closeBrackets=null),y&&(I(Z(y,"pairs")),x.state.closeBrackets=y,x.addKeyMap(U))});function Z(x,y){return y=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[y]!=null?x[y]:Y[y]}var U={Backspace:M,Enter:R};function I(x){for(var y=0;y<x.length;y++){var h=x.charAt(y),o="'"+h+"'";U[o]||(U[o]=K(h))}}I(Y.pairs+"`");function K(x){return function(y){return L(y,x)}}function B(x){var y=x.state.closeBrackets;if(!y||y.override)return y;var h=x.getModeAt(x.getCursor());return h.closeBrackets||y}function M(x){var y=B(x);if(!y||x.getOption("disableInput"))return he.Pass;for(var h=Z(y,"pairs"),o=x.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=_(x,o[l].head);if(!d||h.indexOf(d)%2!=0)return he.Pass}for(var l=o.length-1;l>=0;l--){var S=o[l].head;x.replaceRange("",O(S.line,S.ch-1),O(S.line,S.ch+1),"+delete")}}function R(x){var y=B(x),h=y&&Z(y,"explode");if(!h||x.getOption("disableInput"))return he.Pass;for(var o=x.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=_(x,o[l].head);if(!d||h.indexOf(d)%2!=0)return he.Pass}x.operation(function(){var S=x.lineSeparator()||`
`;x.replaceSelection(S+S,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var g=0;g<o.length;g++){var p=o[g].head.line;x.indentLine(p,null,!0),x.indentLine(p+1,null,!0)}})}function E(x){var y=he.cmpPos(x.anchor,x.head)>0;return{anchor:new O(x.anchor.line,x.anchor.ch+(y?-1:1)),head:new O(x.head.line,x.head.ch+(y?1:-1))}}function L(x,y){var h=B(x);if(!h||x.getOption("disableInput"))return he.Pass;var o=Z(h,"pairs"),l=o.indexOf(y);if(l==-1)return he.Pass;for(var d=Z(h,"closeBefore"),S=Z(h,"triples"),g=o.charAt(l+1)==y,p=x.listSelections(),w=l%2==0,b,u=0;u<p.length;u++){var f=p[u],s=f.head,a,T=x.getRange(s,O(s.line,s.ch+1));if(w&&!f.empty())a="surround";else if((g||!w)&&T==y)g&&A(x,s)?a="both":S.indexOf(y)>=0&&x.getRange(s,O(s.line,s.ch+3))==y+y+y?a="skipThree":a="skip";else if(g&&s.ch>1&&S.indexOf(y)>=0&&x.getRange(O(s.line,s.ch-2),s)==y+y){if(s.ch>2&&/\bstring/.test(x.getTokenTypeAt(O(s.line,s.ch-2))))return he.Pass;a="addFour"}else if(g){var v=s.ch==0?" ":x.getRange(O(s.line,s.ch-1),s);if(!he.isWordChar(T)&&v!=y&&!he.isWordChar(v))a="both";else return he.Pass}else if(w&&(T.length===0||/\s/.test(T)||d.indexOf(T)>-1))a="both";else return he.Pass;if(!b)b=a;else if(b!=a)return he.Pass}var C=l%2?o.charAt(l-1):y,D=l%2?y:o.charAt(l+1);x.operation(function(){if(b=="skip")x.execCommand("goCharRight");else if(b=="skipThree")for(var j=0;j<3;j++)x.execCommand("goCharRight");else if(b=="surround"){for(var z=x.getSelections(),j=0;j<z.length;j++)z[j]=C+z[j]+D;x.replaceSelections(z,"around"),z=x.listSelections().slice();for(var j=0;j<z.length;j++)z[j]=E(z[j]);x.setSelections(z)}else b=="both"?(x.replaceSelection(C+D,null),x.triggerElectric(C+D),x.execCommand("goCharLeft")):b=="addFour"&&(x.replaceSelection(C+C+C+C,"before"),x.execCommand("goCharRight"))})}function _(x,y){var h=x.getRange(O(y.line,y.ch-1),O(y.line,y.ch+1));return h.length==2?h:null}function A(x,y){var h=x.getTokenAt(O(y.line,y.ch+1));return/\bstring/.test(h.type)&&h.start==y.ch&&(y.ch==0||!/\bstring/.test(x.getTokenTypeAt(y)))}})},GfqC:function(Et,tt,ie){"use strict";var he=ie("q1tI"),Y=ie.n(he),O=ie("TSYQ"),Z=ie.n(O);function U(V,P){var N="cannot "+V.method+" "+V.action+" "+P.status+"'",$=new Error(N);return $.status=P.status,$.method=V.method,$.url=V.action,$}function I(V){var P=V.responseText||V.response;if(!P)return P;try{return JSON.parse(P)}catch(N){return P}}function K(V){var P=new XMLHttpRequest;V.onProgress&&P.upload&&(P.upload.onprogress=function(pe){pe.total>0&&(pe.percent=pe.loaded/pe.total*100),V.onProgress(pe)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(re){var pe=V.data[re];if(Array.isArray(pe)){pe.forEach(function(ve){N.append(re+"[]",ve)});return}N.append(re,V.data[re])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),P.onerror=function(pe){V.onError(pe)},P.onload=function(){return P.status<200||P.status>=300?V.onError(U(V,P),I(P)):V.onSuccess(I(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(re){$[re]!==null&&P.setRequestHeader(re,$[re])}),P.send(N),{abort:function(){P.abort()}}}var B=+new Date,M=0;function R(){return"rc-upload-"+B+"-"+ ++M}function E(V,P){return V.indexOf(P,V.length-P.length)!==-1}var L=function(V,P){if(V&&P){var N=Array.isArray(P)?P:P.split(","),$=V.name||"",re=V.type||"",pe=re.replace(/\/.*$/,"");return N.some(function(ve){var Ae=ve.trim();return Ae.charAt(0)==="."?E($.toLowerCase(),Ae.toLowerCase()):/\/\*$/.test(Ae)?pe===Ae.replace(/\/.*$/,""):re===Ae})}return!0};function _(V,P){var N=V.createReader(),$=[];function re(){N.readEntries(function(pe){var ve=Array.prototype.slice.apply(pe);$=$.concat(ve);var Ae=!ve.length;Ae?P($):re()})}re()}var A=function(P,N,$){var re=function pe(ve,Ae){Ae=Ae||"",ve.isFile?ve.file(function(Le){$(Le)&&(ve.fullPath&&!Le.webkitRelativePath&&(Object.defineProperties(Le,{webkitRelativePath:{writable:!0}}),Le.webkitRelativePath=ve.fullPath.replace(/^\//,""),Object.defineProperties(Le,{webkitRelativePath:{writable:!1}})),N([Le]))}):ve.isDirectory&&_(ve,function(Le){Le.forEach(function(ce){pe(ce,""+Ae+ve.name+"/")})})};P.forEach(function(pe){re(pe.webkitGetAsEntry())})},x=A,y=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var N=arguments[P];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(V[$]=N[$])}return V},h=function(){function V(P,N){var $=[],re=!0,pe=!1,ve=void 0;try{for(var Ae=P[Symbol.iterator](),Le;!(re=(Le=Ae.next()).done)&&!($.push(Le.value),N&&$.length===N);re=!0);}catch(ce){pe=!0,ve=ce}finally{try{!re&&Ae.return&&Ae.return()}finally{if(pe)throw ve}}return $}return function(P,N){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return V(P,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(P,N){for(var $=0;$<N.length;$++){var re=N[$];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(P,re.key,re)}}return function(P,N,$){return N&&V(P.prototype,N),$&&V(P,$),P}}();function l(V,P,N){return P in V?Object.defineProperty(V,P,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[P]=N,V}function d(V,P){var N={};for(var $ in V){if(P.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;N[$]=V[$]}return N}function S(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function g(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function p(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}var w=function(P){return Object.keys(P).reduce(function(N,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(N[$]=P[$]),N},{})},b=function(V){p(P,V);function P(){var N,$,re,pe;S(this,P);for(var ve=arguments.length,Ae=Array(ve),Le=0;Le<ve;Le++)Ae[Le]=arguments[Le];return pe=($=(re=g(this,(N=P.__proto__||Object.getPrototypeOf(P)).call.apply(N,[this].concat(Ae))),re),re.state={uid:R()},re.reqs={},re.onChange=function(ce){var ae=ce.target.files;re.uploadFiles(ae),re.reset()},re.onClick=function(ce){var ae=re.fileInput;if(!ae)return;var de=re.props,ne=de.children,se=de.onClick;ne&&ne.type==="button"&&(ae.parentNode.focus(),ae.parentNode.querySelector("button").blur()),ae.click(),se&&se(ce)},re.onKeyDown=function(ce){ce.key==="Enter"&&re.onClick()},re.onFileDrop=function(ce){var ae=re.props.multiple;if(ce.preventDefault(),ce.type==="dragover")return;if(re.props.directory)x(Array.prototype.slice.call(ce.dataTransfer.items),re.uploadFiles,function(ne){return L(ne,re.props.accept)});else{var de=Array.prototype.slice.call(ce.dataTransfer.files).filter(function(ne){return L(ne,re.props.accept)});ae===!1&&(de=de.slice(0,1)),re.uploadFiles(de)}},re.uploadFiles=function(ce){var ae=Array.prototype.slice.call(ce);ae.map(function(de){return de.uid=R(),de}).forEach(function(de){re.upload(de,ae)})},re.saveFileInput=function(ce){re.fileInput=ce},$),g(re,pe)}return o(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,re){var pe=this,ve=this.props;if(!ve.beforeUpload)return setTimeout(function(){return pe.post($)},0);var Ae=ve.beforeUpload($,re);Ae&&Ae.then?Ae.then(function(Le){var ce=Object.prototype.toString.call(Le);return ce==="[object File]"||ce==="[object Blob]"?pe.post(Le):pe.post($)}).catch(function(Le){console.log(Le)}):Ae!==!1&&setTimeout(function(){return pe.post($)},0);return}},{key:"post",value:function($){var re=this;if(!this._isMounted)return;var pe=this.props,ve=pe.onStart,Ae=pe.onProgress,Le=pe.transformFile,ce=Le===void 0?function(ae){return ae}:Le;new Promise(function(ae){var de=pe.action;return typeof de=="function"&&(de=de($)),ae(de)}).then(function(ae){var de=$.uid,ne=pe.customRequest||K,se=Promise.resolve(ce($)).then(function(J){var ee=pe.data;return typeof ee=="function"&&(ee=ee(J)),Promise.all([J,ee])}).catch(function(J){console.error(J)});se.then(function(J){var ee=h(J,2),oe=ee[0],fe=ee[1],ke={action:ae,filename:pe.name,data:fe,file:oe,headers:pe.headers,withCredentials:pe.withCredentials,method:pe.method||"post",onProgress:Ae?function(ge){Ae(ge,$)}:null,onSuccess:function(De,Me){delete re.reqs[de],pe.onSuccess(De,$,Me)},onError:function(De,Me){delete re.reqs[de],pe.onError(De,Me,$)}};ve($),re.reqs[de]=ne(ke)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function($){var re=this.reqs;if($){var pe=$;$&&$.uid&&(pe=$.uid),re[pe]&&re[pe].abort&&re[pe].abort(),delete re[pe]}else Object.keys(re).forEach(function(ve){re[ve]&&re[ve].abort&&re[ve].abort(),delete re[ve]})}},{key:"render",value:function(){var $,re=this.props,pe=re.component,ve=re.prefixCls,Ae=re.className,Le=re.disabled,ce=re.id,ae=re.style,de=re.multiple,ne=re.accept,se=re.children,J=re.directory,ee=re.openFileDialogOnClick,oe=re.onMouseEnter,fe=re.onMouseLeave,ke=d(re,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ge=Z()(($={},l($,ve,!0),l($,ve+"-disabled",Le),l($,Ae,Ae),$)),De=Le?{}:{onClick:ee?this.onClick:function(){},onKeyDown:ee?this.onKeyDown:function(){},onMouseEnter:oe,onMouseLeave:fe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Y.a.createElement(pe,y({},De,{className:ge,role:"button",style:ae}),Y.a.createElement("input",y({},w(ke),{id:ce,type:"file",ref:this.saveFileInput,onClick:function(Ue){return Ue.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:de,onChange:this.onChange})),se)}}]),P}(he.Component),u=b,f=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var N=arguments[P];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(V[$]=N[$])}return V},s=function(){function V(P,N){for(var $=0;$<N.length;$++){var re=N[$];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(P,re.key,re)}}return function(P,N,$){return N&&V(P.prototype,N),$&&V(P,$),P}}();function a(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function T(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function v(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}function C(){}var D=function(V){v(P,V);function P(){var N,$,re,pe;a(this,P);for(var ve=arguments.length,Ae=Array(ve),Le=0;Le<ve;Le++)Ae[Le]=arguments[Le];return pe=($=(re=T(this,(N=P.__proto__||Object.getPrototypeOf(P)).call.apply(N,[this].concat(Ae))),re),re.saveUploader=function(ce){re.uploader=ce},$),T(re,pe)}return s(P,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Y.a.createElement(u,f({},this.props,{ref:this.saveUploader}))}}]),P}(he.Component);D.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:C,onError:C,onSuccess:C,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=D,z=tt.a=j},Gytx:function(Et,tt){Et.exports=function(he,Y,O,Z){var U=O?O.call(Z,he,Y):void 0;if(U!==void 0)return!!U;if(he===Y)return!0;if(typeof he!="object"||!he||typeof Y!="object"||!Y)return!1;var I=Object.keys(he),K=Object.keys(Y);if(I.length!==K.length)return!1;for(var B=Object.prototype.hasOwnProperty.bind(Y),M=0;M<I.length;M++){var R=I[M];if(!B(R))return!1;var E=he[R],L=Y[R];if(U=O?O.call(Z,E,L,R):void 0,U===!1||U===void 0&&E!==L)return!1}return!0}},HmJG:function(Et,tt,ie){},LdHM:function(Et,tt,ie){"use strict";ie.d(tt,"b",function(){return d}),ie.d(tt,"a",function(){return g});var he=ie("1OyB"),Y=ie("vuIU"),O=ie("Ji7U"),Z=ie("LK+K"),U=ie("q1tI"),I=ie("rePB"),K=ie("Ff2n"),B=ie("ODXe"),M=ie("4IlW"),R=ie("bX4T"),E=ie("YrtM"),L=ie("TSYQ"),_=ie.n(L),A=ie("+nKL"),x=ie("8OUc"),y=function($,re){var pe=$.prefixCls,ve=$.id,Ae=$.flattenOptions,Le=$.childrenAsData,ce=$.values,ae=$.searchValue,de=$.multiple,ne=$.defaultActiveFirstOption,se=$.height,J=$.itemHeight,ee=$.notFoundContent,oe=$.open,fe=$.menuItemSelectedIcon,ke=$.virtual,ge=$.onSelect,De=$.onToggleOpen,Me=$.onActiveValue,Ue=$.onScroll,Ke=$.onMouseEnter,He="".concat(pe,"-item"),Be=Object(E.a)(function(){return Ae},[oe,Ae],function(We,Se){return Se[0]&&We[1]!==Se[1]}),rt=U.useRef(null),Oe=function(Se){Se.preventDefault()},Fe=function(Se){rt.current&&rt.current.scrollTo({index:Se})},je=function(Se){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,xe=Be.length,le=0;le<xe;le+=1){var ue=(Se+le*ye+xe)%xe,me=Be[ue],Ee=me.group,we=me.data;if(!Ee&&!we.disabled)return ue}return-1},Ge=U.useState(function(){return je(0)}),Ve=Object(B.a)(Ge,2),ze=Ve[0],Re=Ve[1],Qe=function(Se){Re(Se);var ye=Be[Se];if(!ye){Me(null,-1);return}Me(ye.data.value,Se)};U.useEffect(function(){Qe(ne!==!1?je(0):-1)},[Be.length,ae]),U.useEffect(function(){var We=setTimeout(function(){if(!de&&oe&&ce.size===1){var Se=Array.from(ce)[0],ye=Be.findIndex(function(xe){var le=xe.data;return le.value===Se});Qe(ye),Fe(ye)}});return function(){return clearTimeout(We)}},[oe]);var Ye=function(Se){Se!==void 0&&ge(Se,{selected:!ce.has(Se)}),de||De(!1)};if(U.useImperativeHandle(re,function(){return{onKeyDown:function(Se){var ye=Se.which;switch(ye){case M.a.UP:case M.a.DOWN:{var xe=0;if(ye===M.a.UP?xe=-1:ye===M.a.DOWN&&(xe=1),xe!==0){var le=je(ze+xe,xe);Fe(le),Qe(le)}break}case M.a.ENTER:{var ue=Be[ze];ue&&!ue.data.disabled?Ye(ue.data.value):Ye(void 0),oe&&Se.preventDefault();break}case M.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(Se){Fe(Se)}}}),Be.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(He,"-empty"),onMouseDown:Oe},ee);function Pe(We){var Se=Be[We];if(!Se)return null;var ye=Se.data||{},xe=ye.value,le=ye.label,ue=ye.children,me=Object(R.a)(ye,!0),Ee=Le?ue:le;return Se?U.createElement("div",Object.assign({"aria-label":typeof Ee=="string"?Ee:null},me,{key:We,role:"option",id:"".concat(ve,"_list_").concat(We),"aria-selected":ce.has(xe)}),xe):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Pe(ze-1),Pe(ze),Pe(ze+1)),U.createElement(A.a,{itemKey:"key",ref:rt,data:Be,height:se,itemHeight:J,fullHeight:!1,onMouseDown:Oe,onScroll:Ue,virtual:ke,onMouseEnter:Ke},function(We,Se){var ye,xe=We.group,le=We.groupOption,ue=We.data,me=ue.label,Ee=ue.key;if(xe)return U.createElement("div",{className:_()(He,"".concat(He,"-group"))},me!==void 0?me:Ee);var we=ue.disabled,Ie=ue.value,$e=ue.title,at=ue.children,ht=ue.style,ut=ue.className,xt=Object(K.a)(ue,["disabled","value","title","children","style","className"]),Ct=ce.has(Ie),st="".concat(He,"-option"),Mt=_()(He,st,ut,(ye={},Object(I.a)(ye,"".concat(st,"-grouped"),le),Object(I.a)(ye,"".concat(st,"-active"),ze===Se&&!we),Object(I.a)(ye,"".concat(st,"-disabled"),we),Object(I.a)(ye,"".concat(st,"-selected"),Ct),ye)),Lt=Le?at:me,kt=!fe||typeof fe=="function"||Ct;return U.createElement("div",Object.assign({},xt,{"aria-selected":Ct,className:Mt,title:$e,onMouseMove:function(){if(ze===Se||we)return;Qe(Se)},onClick:function(){we||Ye(Ie)},style:ht}),U.createElement("div",{className:"".concat(st,"-content")},Lt||Ie),U.isValidElement(fe)||Ct,kt&&U.createElement(x.a,{className:"".concat(He,"-option-state"),customizeIcon:fe,customizeIconProps:{isSelected:Ct}},Ct?"\u2713":null))}))},h=U.forwardRef(y);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var d=l,S=function(){return null};S.isSelectOptGroup=!0;var g=S,p=ie("VTBJ"),w=ie("Zm9Q");function b(N){var $=N.key,re=N.props,pe=re.children,ve=re.value,Ae=Object(K.a)(re,["children","value"]);return Object(p.a)({key:$,value:ve!==void 0?ve:$,children:pe},Ae)}function u(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(N).map(function(re,pe){if(!U.isValidElement(re)||!re.type)return null;var ve=re.type.isSelectOptGroup,Ae=re.key,Le=re.props,ce=Le.children,ae=Object(K.a)(Le,["children"]);return $||!ve?b(re):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?pe:Ae,"__"),label:Ae},ae),{},{options:u(ce)})}).filter(function(re){return re})}var f=ie("2Qr1"),s=ie("qNPg"),a=ie("U8pU"),T=ie("Kwbf"),v=ie("WKfj");function C(N){var $=N.mode,re=N.options,pe=N.children,ve=N.backfill,Ae=N.allowClear,Le=N.placeholder,ce=N.getInputElement,ae=N.showSearch,de=N.onSearch,ne=N.defaultOpen,se=N.autoFocus,J=N.labelInValue,ee=N.value,oe=N.inputValue,fe=N.optionLabelProp,ke=$==="multiple"||$==="tags",ge=ae!==void 0?ae:ke||$==="combobox",De=re||u(pe);if(Object(T.a)($!=="tags"||De.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Me=De.some(function(He){return He.options?He.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(T.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)($!=="combobox"||!fe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)($==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(T.a)($==="combobox"||!ce,"`getInputElement` only work with `combobox` mode."),Object(T.b)($!=="combobox"||!ce||!Ae||!Le,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),de&&!ge&&$!=="combobox"&&$!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!ne||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ee!=null){var Ue=Object(v.d)(ee);Object(T.a)(!J||Ue.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!ke||Array.isArray(ee),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var Ke=null;Object(w.a)(pe).some(function(He){if(!U.isValidElement(He)||!He.type)return!1;var Be=He.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var rt=Object(w.a)(He.props.children).every(function(Oe){return!U.isValidElement(Oe)||!He.type||Oe.type.isSelectOption?!0:(Ke=Oe.type,!1)});return!rt}return Ke=Be,!0}),Ke&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ke.displayName||Ke.name||Ke,"`.")),Object(T.a)(oe===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=C,j=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:u,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:D,fillOptionsWithMissingValue:f.a}),z=function(N){Object(O.a)(re,N);var $=Object(Z.a)(re);function re(){var pe;return Object(he.a)(this,re),pe=$.apply(this,arguments),pe.selectRef=U.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object(Y.a)(re,[{key:"render",value:function(){return U.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),re}(U.Component);z.Option=d,z.OptGroup=g;var V=z,P=tt.c=V},M8RZ:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return M});var he=ie("fWQN"),Y=ie("mtLc"),O=ie("yKVA"),Z=ie("879j"),U=ie("q1tI"),I=ie.n(U),K=ie("i8i4"),B=ie.n(K),M=function(R){Object(O.a)(L,R);var E=Object(Z.a)(L);function L(_){var A;Object(he.a)(this,L),A=E.call(this,_);var x=window.document;return A.node=x.createElement("div"),x.body.appendChild(A.node),A}return Object(Y.a)(L,[{key:"render",value:function(){var A=this.props.children;return Object(K.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),L}(I.a.Component)},NvD2:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return I});var he=ie("Kwbf");function Y(K,B){var M=new Set;return K.forEach(function(R){B.has(R)||M.add(R)}),M}function O(K){var B=K||{},M=B.disabled,R=B.disableCheckbox,E=B.checkable;return!!(M||R)||E===!1}function Z(K,B,M,R){for(var E=new Set(K),L=new Set,_=0;_<=M;_+=1){var A=B.get(_)||new Set;A.forEach(function(o){var l=o.key,d=o.node,S=o.children,g=S===void 0?[]:S;E.has(l)&&!R(d)&&g.filter(function(p){return!R(p.node)}).forEach(function(p){E.add(p.key)})})}for(var x=new Set,y=M;y>=0;y-=1){var h=B.get(y)||new Set;h.forEach(function(o){var l=o.parent,d=o.node;if(R(d)||!o.parent||x.has(o.parent.key))return;if(R(o.parent.node)){x.add(l.key);return}var S=!0,g=!1;(l.children||[]).filter(function(p){return!R(p.node)}).forEach(function(p){var w=p.key,b=E.has(w);S&&!b&&(S=!1),!g&&(b||L.has(w))&&(g=!0)}),S&&E.add(l.key),g&&L.add(l.key),x.add(l.key)})}return{checkedKeys:Array.from(E),halfCheckedKeys:Array.from(Y(L,E))}}function U(K,B,M,R,E){for(var L=new Set(K),_=new Set(B),A=0;A<=R;A+=1){var x=M.get(A)||new Set;x.forEach(function(l){var d=l.key,S=l.node,g=l.children,p=g===void 0?[]:g;!L.has(d)&&!_.has(d)&&!E(S)&&p.filter(function(w){return!E(w.node)}).forEach(function(w){L.delete(w.key)})})}_=new Set;for(var y=new Set,h=R;h>=0;h-=1){var o=M.get(h)||new Set;o.forEach(function(l){var d=l.parent,S=l.node;if(E(S)||!l.parent||y.has(l.parent.key))return;if(E(l.parent.node)){y.add(d.key);return}var g=!0,p=!1;(d.children||[]).filter(function(w){return!E(w.node)}).forEach(function(w){var b=w.key,u=L.has(b);g&&!u&&(g=!1),!p&&(u||_.has(b))&&(p=!0)}),g||L.delete(d.key),p&&_.add(d.key),y.add(d.key)})}return{checkedKeys:Array.from(L),halfCheckedKeys:Array.from(Y(_,L))}}function I(K,B,M,R){var E=[],L;R?L=R:L=O;var _=new Set(K.filter(function(h){var o=!!M[h];return o||E.push(h),o})),A=new Map,x=0;Object.keys(M).forEach(function(h){var o=M[h],l=o.level,d=A.get(l);d||(d=new Set,A.set(l,d)),d.add(o),x=Math.max(x,l)}),Object(he.a)(!E.length,"Tree missing follow keys: ".concat(E.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var y;return B===!0?y=Z(_,A,x,L):y=U(_,B.halfCheckedKeys,A,x,L),y}},OLES:function(Et,tt,ie){"use strict";var he=ie("U8pU"),Y=ie("VTBJ"),O=ie("Ff2n"),Z=ie("q1tI"),U=ie("uciX"),I=ie("7ixt"),K=function(_){var A=_.overlay,x=_.prefixCls,y=_.id,h=_.overlayInnerStyle;return Z.createElement("div",{className:"".concat(x,"-inner"),id:y,role:"tooltip",style:h},typeof A=="function"?A():A)},B=K,M=function(_,A){var x=_.overlayClassName,y=_.trigger,h=y===void 0?["hover"]:y,o=_.mouseEnterDelay,l=o===void 0?0:o,d=_.mouseLeaveDelay,S=d===void 0?.1:d,g=_.overlayStyle,p=_.prefixCls,w=p===void 0?"rc-tooltip":p,b=_.children,u=_.onVisibleChange,f=_.afterVisibleChange,s=_.transitionName,a=_.animation,T=_.placement,v=T===void 0?"right":T,C=_.align,D=C===void 0?{}:C,j=_.destroyTooltipOnHide,z=j===void 0?!1:j,V=_.defaultVisible,P=_.getTooltipContainer,N=_.overlayInnerStyle,$=Object(O.a)(_,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),re=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(A,function(){return re.current});var pe=Object(Y.a)({},$);"visible"in _&&(pe.popupVisible=_.visible);var ve=function(){var de=_.arrowContent,ne=de===void 0?null:de,se=_.overlay,J=_.id;return[Z.createElement("div",{className:"".concat(w,"-arrow"),key:"arrow"},ne),Z.createElement(B,{key:"content",prefixCls:w,id:J,overlay:se,overlayInnerStyle:N})]},Ae=!1,Le=!1;if(typeof z=="boolean")Ae=z;else if(z&&Object(he.a)(z)==="object"){var ce=z.keepParent;Ae=ce===!0,Le=ce===!1}return Z.createElement(U.a,Object.assign({popupClassName:x,prefixCls:w,popup:ve,action:h,builtinPlacements:I.a,popupPlacement:v,ref:re,popupAlign:D,getPopupContainer:P,onPopupVisibleChange:u,afterPopupVisibleChange:f,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Ae,autoDestroy:Le,mouseLeaveDelay:S,popupStyle:g,mouseEnterDelay:l},pe),b)},R=Object(Z.forwardRef)(M),E=tt.a=R},OZM5:function(Et,tt,ie){"use strict";ie.d(tt,"b",function(){return R}),ie.d(tt,"a",function(){return E}),ie.d(tt,"k",function(){return L}),ie.d(tt,"h",function(){return _}),ie.d(tt,"i",function(){return A}),ie.d(tt,"g",function(){return x}),ie.d(tt,"c",function(){return y}),ie.d(tt,"d",function(){return h}),ie.d(tt,"j",function(){return d}),ie.d(tt,"e",function(){return S}),ie.d(tt,"f",function(){return g});var he=ie("KQm4"),Y=ie("U8pU"),O=ie("Ff2n"),Z=ie("q1tI"),U=ie.n(Z),I=ie("Kwbf"),K=ie("WaYH"),B=.25,M=2;function R(p,w){var b=p.slice(),u=b.indexOf(w);return u>=0&&b.splice(u,1),b}function E(p,w){var b=p.slice();return b.indexOf(w)===-1&&b.push(w),b}function L(p){return p.split("-")}function _(p,w){return"".concat(p,"-").concat(w)}function A(p){return p&&p.type&&p.type.isTreeNode}function x(p,w){var b=[p],u=w[p];function f(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(a){var T=a.key,v=a.children;b.push(T),f(v)})}return f(u.children),b}function y(p,w){var b=p.clientY,u=w.selectHandle.getBoundingClientRect(),f=u.top,s=u.bottom,a=u.height,T=Math.max(a*B,M);return b<=f+T?-1:b>=s-T?1:0}function h(p,w){if(!p)return;var b=w.multiple;return b?p.slice():p.length?[p[0]]:p}var o=function(w){return w};function l(p,w){if(!p)return[];var b=w||{},u=b.processProps,f=u===void 0?o:u,s=Array.isArray(p)?p:[p];return s.map(function(a){var T=a.children,v=Object(O.a)(a,["children"]),C=l(T,w);return U.a.createElement(K.a,Object.assign({},f(v)),C)})}function d(p){if(!p)return null;var w;if(Array.isArray(p))w={checkedKeys:p,halfCheckedKeys:void 0};else if(Object(Y.a)(p)==="object")w={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(I.a)(!1,"`checkedKeys` is not an array or an object"),null;return w}function S(p,w){var b=new Set;function u(f){if(b.has(f))return;var s=w[f];if(!s)return;b.add(f);var a=s.parent,T=s.node;if(T.disabled)return;a&&u(a.key)}return(p||[]).forEach(function(f){u(f)}),Object(he.a)(b)}function g(p){var w={};return Object.keys(p).forEach(function(b){(b.startsWith("data-")||b.startsWith("aria-"))&&(w[b]=p[b])}),w}},Ot1p:function(Et,tt,ie){"use strict";var he=ie("2qtc"),Y=ie("kLXV"),O=ie("rAM+"),Z=ie("miYZ"),U=ie("tsqr"),I=ie("9og8"),K=ie("tJVT"),B=ie("jrin"),M=ie("WmNS"),R=ie.n(M),E=ie("q1tI"),L=ie.n(E),_=ie("VrN/"),A=ie.n(_),x=ie("bdgK"),y=ie("p77/"),h=ie("Bd2K"),o=ie("ELLl"),l=ie("19Vz"),d=ie("lZu9"),S=ie("+NIl"),g=ie("kSUc"),p=ie("9Bee"),w=function(we){var Ie=we.value,$e=Ie===void 0?"":Ie,at=we.className,ht=we.showTextOnly,ut=we.showLines,xt=we.style,Ct=xt===void 0?{}:xt,st=Object(E.useMemo)(function(){return""},[$e]);return L.a.createElement(L.a.Fragment,null,L.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},b=ie("0Owb"),u=ie("dejd"),f=ie("C+DQ"),s=ie("1vsH"),a=ie("m3rI"),T=[{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 v(we){var Ie=we.onActionCallback,$e=we.title,at=we.icon,ht=we.actionName,ut=we.className,xt=ut===void 0?"":ut,Ct=we.children;function st(){Ie(ht)}return L.a.createElement("a",{title:$e,className:xt,onClick:st},L.a.createElement("i",{className:"md-iconfont ".concat(at)}),Ct)}var C=function(we){var Ie=we.watch,$e=we.showNullButton,at=we.onActionCallback,ht=we.fullScreen,ut=we.insertTemp,xt=we.hidetoolBar,Ct=we.uuid,st=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.F)("_educoder_session"),"&key=").concat(Ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Mt=[].concat(T,[{title:"".concat(Ie?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ie?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return L.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&Mt.map(function(Lt,kt){return L.a.createElement("li",{key:kt},Lt.actionName?L.a.createElement(v,Object(b.a)({},Lt,{onActionCallback:at})):L.a.createElement("span",{className:"v-line"}))}),$e?L.a.createElement("li",null,L.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:at},L.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ut&&L.a.createElement("li",null,L.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ut),onActionCallback:at},L.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),L.a.createElement("li",{className:"btn-full-screen"},L.a.createElement(v,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:at})))},D=ie("M8RZ"),j=ie("+L6B"),z=ie("2/Rp"),V=ie("y8nQ"),P=ie("Vl3Y"),N=ie("5NDa"),$=ie("5rEg"),re={labelCol:{span:4},wrapperCol:{span:20}},pe=function(we){var Ie=we.callback,$e=we.onCancel;function at(ht){Ie(ht)}return L.a.createElement(P.a,Object(b.a)({},re,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:at}),L.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},L.a.createElement($.a,null)),L.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},L.a.createElement($.a,null)),L.a.createElement("div",{className:"flex-container flex-end"},L.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(z.a,{type:"ghost",onClick:$e},"\u53D6\u6D88")))},ve=ie("7ahc"),Ae=ie("HmJG"),Le=ie("BjJ7"),ce=P.a.useForm,ae={width:280,marginRight:10},de={labelCol:{span:5},wrapperCol:{span:19}},ne=function(we){var Ie=we.callback,$e=we.onCancel,at=ce(),ht=Object(K.a)(at,1),ut=ht[0];function xt(Mt){Ie(Mt)}function Ct(Mt,Lt){if(Mt.status===-1){U.b.error(Mt.message);return}ut.setFieldsValue({src:"/api/attachments/".concat(Mt.id),type:Lt.type})}function st(Mt){var Lt=Mt.target.files[0];J(Lt,Ct)}return L.a.createElement(P.a,Object(b.a)({form:ut},de,{className:"upload-image-panel",onFinish:xt}),L.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},L.a.createElement("div",{className:"flex-container"},L.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},L.a.createElement($.a,{style:ae})),L.a.createElement(se,{onFileChange:st}))),L.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},L.a.createElement($.a,{style:{width:264}})),L.a.createElement(P.a.Item,{style:{textAlign:"right"}},L.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(z.a,{type:"ghost",onClick:$e},"\u53D6\u6D88")))};function se(we){var Ie=we.onFileChange;return L.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",L.a.createElement("input",{type:"file",onChange:Ie}))}function J(we,Ie){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var $e=new FormData;$e.append("editormd-image-file",we),$e.append("file_param_name","editormd-image-file"),$e.append("byxhr","true");var at=new window.XMLHttpRequest;at.withCredentials=!0,at.addEventListener("load",function(ht){Ie(JSON.parse(ht.target.responseText),we)},!1),at.addEventListener("error",function(ht){console.error(ht)},!1),at.open("POST","".concat(Le.a,"/api/attachments.json")),at.send($e)}var ee=ie("giR+"),oe=ie("fyUT"),fe=ie("7Kak"),ke=ie("9yH6"),ge=ke.a.Group,De={margin:"0 8px"},Me=function(we){var Ie=we.callback,$e=we.onCancel;function at(ht){Ie(ht)}return L.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:at},L.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},L.a.createElement("span",{style:De},"\u5355\u5143\u683C\u6570\uFF1A"),L.a.createElement("span",{style:De},"\u884C\u6570"),L.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},L.a.createElement(oe.a,null)),L.a.createElement("span",{style:De},"\u5217\u6570"),L.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},L.a.createElement(oe.a,null))),L.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},L.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),L.a.createElement(P.a.Item,{name:"align"},L.a.createElement(ge,null,L.a.createElement(ke.a,{value:"default"},L.a.createElement("i",{className:"fa fa-align-justify"})),L.a.createElement(ke.a,{value:"left"},L.a.createElement("i",{className:"fa fa-align-left"})),L.a.createElement(ke.a,{value:"center"},L.a.createElement("i",{className:"fa fa-align-center"})),L.a.createElement(ke.a,{value:"right"},L.a.createElement("i",{className:"fa fa-align-right"}))))),L.a.createElement("div",{className:"flex-container flex-end"},L.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(z.a,{type:"ghost",onClick:$e},"\u53D6\u6D88")))},Ue=ie("ErOA"),Ke=ie("7Cbv"),He="link",Be="upload-image",rt="code-block",Oe="add-table",Fe="------------",je={default:Fe,left:":".concat(Fe),center:":".concat(Fe,":"),right:"".concat(Fe,":")},Ge=ie("9VGf"),Ve,ze;function Re(){}var Qe=0,Ye=1e4,Pe="\u2581",We=`
**\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 Se(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,xe=ye?"Cmd":"Ctrl",le=["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"],ue=(Ve={},Object(B.a)(Ve,xe+"-B","bold"),Object(B.a)(Ve,xe+"-I","italic"),Ve),me=(ze={},Object(B.a)(ze,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(ze,rt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(ze,Be,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(ze,Oe,"\u6DFB\u52A0\u8868\u683C"),ze),Ee=tt.a=function(we){var Ie=we.defaultValue,$e=Ie===void 0?"":Ie,at=we.onChange,ht=we.width,ut=ht===void 0?"100%":ht,xt=we.height,Ct=xt===void 0?400:xt,st=we.miniToolbar,Mt=st===void 0?!1:st,Lt=we.isFocus,kt=Lt===void 0?!1:Lt,Dt=we.watch,Tt=we.insertTemp,Ut=we.mode,Qt=Ut===void 0?"markdown":Ut,yt=we.id,pr=yt===void 0?"markdown-editor-id":yt,Bt=we.showResizeBar,tr=Bt===void 0?!1:Bt,ur=we.noStorage,nr=ur===void 0?!1:ur,vr=we.showNullButton,Nt=vr===void 0?!1:vr,ft=we.hidetoolBar,sr=ft===void 0?!1:ft,Tr=we.fullScreen,gr=Tr===void 0?!1:Tr,Pt=we.onBlur,yr=we.onCMBeforeChange,dr=we.onFullScreen,qr=we.className,qe=qr===void 0?"":qr,wt=we.disablePaste,zr=wt===void 0?!1:wt,Ir=we.placeholder,Zr=Ir===void 0?"":Ir,Wr=we.values,G=Wr===void 0?"":Wr,c=Object(E.useState)(null),m=Object(K.a)(c,2),F=m[0],q=m[1],H=Object(E.useState)($e),Ce=Object(K.a)(H,2),Ze=Ce[0],nt=Ce[1],lt=Object(E.useState)(Dt),Xe=Object(K.a)(lt,2),pt=Xe[0],mt=Xe[1],It=Object(E.useState)(gr),lr=Object(K.a)(It,2),$t=lr[0],rr=lr[1],xr=Object(E.useState)(""),Nr=Object(K.a)(xr,2),ir=Nr[0],Xt=Nr[1],wr=Object(E.useState)(0),Hr=Object(K.a)(wr,2),ar=Hr[0],yn=Hr[1],Ar=Object(E.useState)(Ct),_r=Object(K.a)(Ar,2),Rn=_r[0],jt=_r[1],vt=Object(E.useState)(!1),ot=Object(K.a)(vt,2),Cr=ot[0],Yt=ot[1],Zt=Object(E.useRef)(Object(Ke.a)()),Ht=Object(E.useRef)(!1),br=Object(E.useRef)(),Ft=Object(E.useRef)(),cr=Object(E.useRef)(),zt=Object(E.useRef)(),Vr=Object(E.useRef)(),mr=function(){var St=Object(I.a)(R.a.mark(function _t(){var Ot,Kt;return R.a.wrap(function(hr){for(;;)switch(hr.prev=hr.next){case 0:return hr.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Zt.current}});case 2:Kt=hr.sent,Kt!=null&&(Ot=Kt.attachments)!==null&&Ot!==void 0&&Ot.length&&(console.log("cm:",F,Ft),Kt.attachments.map(function(Vt){Vt.content_type.indexOf("image")>-1?F.replaceSelection("![,](/api/attachments/".concat(Vt.id,"?type=").concat(Vt.content_type,")")):Vt.content_type.indexOf("video")>-1?F.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Vt.content_type.indexOf("pdf")>-1?F.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Vt.id,"?type=").concat(Vt.content_type,'&disposition=inline" target="_blank">').concat(Vt.name,"</a>")):F.replaceSelection("[".concat(Vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Vt.id,"?type=").concat(Vt.content_type,")"))}));case 4:case"end":return hr.stop()}},_t)}));return function(){return St.apply(this,arguments)}}();Object(E.useEffect)(function(){nt(G),F==null||F.setValue(G)},[G]),Object(E.useEffect)(function(){dr==null||dr($t)},[$t]),Object(E.useEffect)(function(){if(Ft.current){var St=A.a.fromTextArea(Ft.current,{mode:Qt,lineNumbers:!Mt,lineWrapping:!0,value:$e,autoCloseTags:!0,autoCloseBrackets:!0});kt&&St.focus();function _t(Ot,Kt){if(zr){Kt.preventDefault();return}var Jt=Kt.clipboardData;if(Jt){var hr=Jt.types.toString(),Vt=Jt.items;if(hr==="Files"||Jt.types.indexOf("Files")>-1){if(Kt.preventDefault(),Qt=="stex")return;try{var Pr,en=Vt[1];((Pr=Vt[0])===null||Pr===void 0?void 0:Pr.kind)==="file"&&(en=Vt[0]);var Gt=en.getAsFile(),Ln=Gt.name.split(".").pop();J(Gt,function(qt){if(qt.id){var tn,Xr,bn;(Gt==null||((tn=Gt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?St.replaceSelection("![,](/api/attachments/".concat(qt.id,"?type=").concat(qt.content_type,")")):(Gt==null||((Xr=Gt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?St.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'"></video>')):(Gt==null||((bn=Gt.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):le.includes(Ln)?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):St.replaceSelection("[".concat(Gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,")"))}else(qt==null?void 0:qt.status)===401&&(document.location.href="/user/login")})}catch(qt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return St.on("paste",_t),St.on("dragleave",function(Ot,Kt){cr.current.classList.remove("mouse-hover-md")}),St.on("dragover",function(Ot,Kt){cr.current.classList.add("mouse-hover-md")}),St.on("drop",function(Ot,Kt){cr.current.classList.add("mouse-hover-md");var Jt;if(Jt=Kt.dataTransfer.files,Jt.length>0){Kt.preventDefault(),Kt.stopPropagation();for(var hr=function(en){var Gt=Jt[en],Ln=Gt.name.split(".").pop();J(Gt,function(qt){if(qt.id){var tn,Xr,bn;(Gt==null||((tn=Gt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?St.replaceSelection("![,](/api/attachments/".concat(qt.id,"?type=").concat(qt.content_type,")")):(Gt==null||((Xr=Gt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?St.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'"></video>')):(Gt==null||((bn=Gt.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):le.includes(Ln)?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):St.replaceSelection("[".concat(Gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,")"))}else(qt==null?void 0:qt.status)===401&&(document.location.href="/user/login")})},Vt=0;Vt<Jt.length;Vt++)hr(Vt)}}),q(St),function(){St.off("paste",_t)}}},[]);var Lr=Object(E.useCallback)(function(){if(cr.current)try{}catch(St){console.log(St,"---- to set md editor body height")}},[Rn,cr,$t]);Object(E.useEffect)(function(){function St(){var Ot=new x.default(function(Kt){var Jt=Object(O.a)(Kt),hr;try{for(Jt.s();!(hr=Jt.n()).done;){var Vt=hr.value;(Vt.target.offsetHeight>0||Vt.target.offsetWidth>0)&&(Lr(),F.setSize("100%","100%"),F.refresh())}}catch(Pr){Jt.e(Pr)}finally{Jt.f()}});return Ot.observe(Ft.current.parentElement),Ot}if(F){var _t=St();return function(){_t.unobserve(Ft.current.parentElement)}}},[F,Lr]),Object(E.useEffect)(function(){if(F){for(var St=[],_t=function(){var Vt=Kt[Ot];Jt=Object(K.a)(Vt,2);var Pr=Jt[0],en=Jt[1],Gt=Object(B.a)({},Pr,function(){ln(en)});St.push(Gt),F.addKeyMap(Gt)},Ot=0,Kt=Object.entries(ue);Ot<Kt.length;Ot++){var Jt;_t()}return br.current=setInterval(function(){Ht.current&&mr()},4e3),function(){clearInterval(br.current);var hr=Object(O.a)(St),Vt;try{for(hr.s();!(Vt=hr.n()).done;){var Pr=Vt.value;F.removeKeyMap(Pr)}}catch(en){hr.e(en)}finally{hr.f()}}}},[F]),Object(E.useEffect)(function(){gr!==$t&&rr(gr)},[gr]),Object(Ge.a)(function(){if(!nr&&ar>0){var St=new Date().getTime(),_t=window.sessionStorage.getItem(pr);St>=ar+Ye&&(!_t||_t!==Ze)&&(window.sessionStorage.setItem(pr,Ze),Yt(!0))}},Ye),Object(E.useEffect)(function(){mt(Dt)},[F,Dt]),Object(E.useEffect)(function(){F&&(kt&&F.focus())},[F,kt]),Object(E.useEffect)(function(){if(pt&&F){var St=F.getScrollerElement();function _t(Ot){var Kt=Ot.target;if(Vr.current){var Jt=Kt.scrollTop/Kt.scrollHeight;Vr.current.scrollTop=Vr.current.scrollHeight*Jt}}return St.addEventListener("scroll",_t),function(){St.removeEventListener("scroll",_t)}}},[F,pt]),Object(E.useEffect)(function(){if(F&&yr){function St(_t,Ot){yr(_t,Ot)}return F.on("beforeChange",St),function(){F.off("beforeChange",St)}}},[F,yr]),Object(E.useEffect)(function(){if(F&&Pt){function St(){Pt(F.getValue())}return F.on("blur",St),function(){F.off("blur",St)}}},[F,Pt]),Object(E.useEffect)(function(){if(F){function St(_t){var Ot=_t.getValue();nt(Ot),yn(new Date().getTime()),_t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),at&&at(Ot)}return F.on("change",St),function(){F.off("change",St)}}},[F,at]),Object(E.useEffect)(function(){F&&($e==null?(F.setValue(""),nt("")):$e!==F.getValue()&&(F.setValue($e),nt($e),F.setCursor(F.lineCount(),0)))},[F,$e]);var ln=Object(E.useCallback)(function(St){var _t=F.getCursor(),Ot=F.getSelection(),Kt=Ot.split(`
`);switch(St){case"bold":return F.replaceSelection("**"+Ot+"**"),Ot===""&&F.setCursor(_t.line,_t.ch+2),F.focus();case"italic":return F.replaceSelection("*"+Ot+"*"),Ot===""&&F.setCursor(_t.line,_t.ch+1),F.focus();case"code":return F.replaceSelection("`"+Ot+"`"),Ot===""&&F.setCursor(_t.line,_t.ch+1),F.focus();case"inline-latex":return F.replaceSelection("`$$"+Ot+"$$`"),Ot===""&&F.setCursor(_t.line,_t.ch+3),F.focus();case"latex":return F.replaceSelection("```latex\n"+Ot+"\n```"),F.setCursor(_t.line+1,Ot.length+1),F.focus();case"line-break":return F.replaceSelection(`<br/>
`),F.focus();case"list-ul":return Ot===""?F.replaceSelection("- "+Ot):F.replaceSelection(Kt.map(function(Jt){return Jt===""?"":"- ".concat(Jt)}).join(`
`)),F.focus();case"list-ol":return Ot===""?F.replaceSelection("1. "+Ot):F.replaceSelection(Kt.map(function(Jt,hr){return Jt===""?"":"".concat(hr+1,". ").concat(Jt)}).join(`
`)),F.focus();case"add-null-ch":return Ot===""&&F.setCursor(_t.line,_t.ch+1),F.replaceSelection(Pe),F.focus();case"inster-template-1":return Ot===""&&F.setCursor(_t.line,_t.ch),F.replaceSelection(We),F.focus();case"eraser":return F.setValue(""),F.focus();case"trigger-watch":return mt(!pt),F.focus();case"trigger-full-screen":return rr(!$t),F.focus();case He:Xt(He);return;case rt:Xt(rt);return;case Be:Xt(Be);return;case Oe:Xt(Oe);return;default:throw new Error}},[F,pt,$t]),pn=Object(E.useCallback)(function(St){Xt("");switch(ir){case He:var _t=St.title,Ot=St.link;return F.replaceSelection("[".concat(_t,"](").concat(Ot,")")),F.focus();case rt:var Kt=St.language,Jt=St.content;return F.replaceSelection(["```"+Kt,Jt,"```"].join(`
`)),F.focus();case Be:var hr=St.src,Vt=St.alt;return Vt?F.replaceSelection("![ ".concat(Vt," ]( ").concat(hr,' "').concat(Vt,'" )')):F.replaceSelection("![,](".concat(hr,")")),F.focus();case Oe:for(var Pr=St.row,en=St.col,Gt=St.align,Ln=`
`,qt=0;qt<Pr;qt++){for(var tn=[],Xr=[],bn=0;bn<en;bn++)qt===1&&Xr.push(je[Gt]),tn.push(" ");qt===1&&(Ln+="| ".concat(Xr.join(" | "),` |
`)),Ln+="| ".concat(tn.join(en===1?"":" | "),` |
`)}return F.replaceSelection(Ln+`
`),F.focus();default:throw new Error}},[F,ir]),un=Object(E.useMemo)(function(){switch(ir){case He:return L.a.createElement(pe,{callback:pn,onCancel:dn});case rt:return L.a.createElement(ve.b,{callback:pn,onCancel:dn});case Be:return L.a.createElement(ne,{callback:pn,onCancel:dn});case Oe:return L.a.createElement(Me,{callback:pn,onCancel:dn});default:return null}},[ir]);function dn(){Xt("")}Object(E.useEffect)(function(){if(zt.current){var St=zt.current,_t=!1,Ot=0;function Kt(Vt){_t=!0,Ot=Vt.pageY}function Jt(){_t=!1}function hr(Vt){if(_t){var Pr=Vt.pageY-Ot;Pr<0&&(Pr=0),Pr>300&&(Pr=300);var en=Ct+Pr+"px";jt(en)}}return St.addEventListener("mousedown",Kt),document.addEventListener("mousemove",hr),document.addEventListener("mouseup",Jt),function(){St.removeEventListener("mousedown",Kt),document.removeEventListener("mousemove",hr),document.removeEventListener("mouseup",Jt)}}},[F,zt]),Object(E.useEffect)(function(){jt(Ct)},[Ct]);var En=Se(ut),mn=Se(Rn),cn={width:En,height:mn},pi=Object(E.useMemo)(function(){if(ar){var St=new Date(ar),_t=St.getHours(),Ot=St.getMinutes(),Kt=St.getSeconds();return _t=_t<10?"0"+_t:_t,Ot=Ot<10?"0"+Ot:Ot,Kt=Kt<10?"0"+Kt:Kt,"".concat(_t,":").concat(Ot,":").concat(Kt)}return 0},[ar]);function ji(){window.sessionStorage.removeItem(pr),Yt(!1),yn(0)}function jn(){Yt(!1),yn(0),F.setValue(window.sessionStorage.getItem(pr))}function ua(St,_t){var Ot=F.getValue();Ot=Ot.replace(St,_t),nt(Ot),F==null||F.setValue(Ot)}return L.a.createElement(E.Fragment,null,L.a.createElement("div",{className:"markdown-editor-wrapper",ref:cr},L.a.createElement("div",{className:"markdown-editor-container ".concat(qe," ").concat(pt?"on-preview":""," ").concat(Mt?"mini":""," ").concat($t?"full-screen":""),style:cn},L.a.createElement(C,{insertTemp:Tt,watch:pt,fullScreen:$t,showNullButton:Nt,onActionCallback:ln,hidetoolBar:sr,uuid:Zt.current,setOpenPhones:function(){Ht.current=!0}}),L.a.createElement("div",{className:"markdown-editor-body"},L.a.createElement("div",{className:"codemirror-container"},L.a.createElement("textarea",{ref:Ft,placeholder:Zr})),pt?L.a.createElement("div",{ref:Vr,className:"preview-container"},Qt==="stex"&&L.a.createElement(w,{value:Ze}),Qt!=="stex"&&L.a.createElement(p.a,{edit:!0,value:Ze,replaces:ua})):null))),tr?L.a.createElement("a",{ref:zt,className:"editor-resize"}):null,L.a.createElement(D.a,null,me[ir]?L.a.createElement(Y.a,{centered:!0,title:me[ir],visible:!0,onCancel:dn,footer:null,className:"markdown-popup-form"},un):null))}},RxwV:function(Et,tt,ie){"use strict";var he=ie("q1tI"),Y=ie("uciX"),O=ie("2W6z"),Z=ie.n(O),U=ie("4IlW"),I=ie("uK0f"),K=ie.n(I);function B(ae,de){if(ae===de)return!0;if(!ae||!de)return!1;var ne=ae.length;if(de.length!==ne)return!1;for(var se=0;se<ne;se++)if(ae[se]!==de[se])return!1;return!0}function M(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?M=function(ne){return typeof ne}:M=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},M(ae)}function R(ae,de){if(!(ae instanceof de))throw new TypeError("Cannot call a class as a function")}function E(ae,de){for(var ne=0;ne<de.length;ne++){var se=de[ne];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function L(ae,de,ne){return de&&E(ae.prototype,de),ne&&E(ae,ne),ae}function _(ae,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(de&&de.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),de&&A(ae,de)}function A(ae,de){return A=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},A(ae,de)}function x(ae){var de=o();return function(){var ne=l(ae),se;if(de){var J=l(this).constructor;se=Reflect.construct(ne,arguments,J)}else se=ne.apply(this,arguments);return y(this,se)}}function y(ae,de){return de&&(M(de)==="object"||typeof de=="function")?de:h(ae)}function h(ae){if(ae===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae}function o(){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(ae){return!1}}function l(ae){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},l(ae)}var d=function(){var ae=function(de){_(se,de);var ne=x(se);function se(){var J;return R(this,se),J=ne.apply(this,arguments),J.menuItems={},J.saveMenuItem=function(ee){return function(oe){J.menuItems[ee]=oe}},J}return L(se,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(ee){!ee.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(ee){var oe=this.props,fe=oe.fieldNames,ke=oe.defaultFieldNames;return fe[ee]||ke[ee]}},{key:"getOption",value:function(ee,oe){var fe=this.props,ke=fe.prefixCls,ge=fe.expandTrigger,De=fe.expandIcon,Me=fe.loadingIcon,Ue=this.props.onSelect.bind(this,ee,oe),Ke=this.props.onItemDoubleClick.bind(this,ee,oe),He={onClick:Ue,onDoubleClick:Ke},Be="".concat(ke,"-menu-item"),rt=null,Oe=ee[this.getFieldName("children")]&&ee[this.getFieldName("children")].length>0;(Oe||ee.isLeaf===!1)&&(Be+=" ".concat(ke,"-menu-item-expand"),ee.loading||(rt=he.createElement("span",{className:"".concat(ke,"-menu-item-expand-icon")},De))),ge==="hover"&&(Oe||ee.isLeaf===!1)&&(He={onMouseEnter:this.delayOnSelect.bind(this,Ue),onMouseLeave:this.delayOnSelect.bind(this),onClick:Ue}),this.isActiveOption(ee,oe)&&(Be+=" ".concat(ke,"-menu-item-active"),He.ref=this.saveMenuItem(oe)),ee.disabled&&(Be+=" ".concat(ke,"-menu-item-disabled"));var Fe=null;ee.loading&&(Be+=" ".concat(ke,"-menu-item-loading"),Fe=Me||null);var je="";return"title"in ee?je=ee.title:typeof ee[this.getFieldName("label")]=="string"&&(je=ee[this.getFieldName("label")]),he.createElement("li",Object.assign({key:ee[this.getFieldName("value")],className:Be,title:je},He,{role:"menuitem",onMouseDown:function(Ve){return Ve.preventDefault()}}),ee[this.getFieldName("label")],rt,Fe)}},{key:"getActiveOptions",value:function(ee){var oe=this,fe=this.props.options,ke=ee||this.props.activeValue;return K()(fe,function(ge,De){return ge[oe.getFieldName("value")]===ke[De]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ee=this,oe=this.props.options,fe=this.getActiveOptions().map(function(ke){return ke[ee.getFieldName("children")]}).filter(function(ke){return!!ke});return fe.unshift(oe),fe}},{key:"delayOnSelect",value:function(ee){for(var oe=this,fe=arguments.length,ke=new Array(fe>1?fe-1:0),ge=1;ge<fe;ge++)ke[ge-1]=arguments[ge];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof ee=="function"&&(this.delayTimer=window.setTimeout(function(){ee(ke),oe.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var ee=this.getShowOptions().length,oe=0;oe<ee;oe++){var fe=this.menuItems[oe];fe&&fe.parentElement&&(fe.parentElement.scrollTop=fe.offsetTop)}}},{key:"isActiveOption",value:function(ee,oe){var fe=this.props.activeValue,ke=fe===void 0?[]:fe;return ke[oe]===ee[this.getFieldName("value")]}},{key:"render",value:function(){var ee=this,oe=this.props,fe=oe.prefixCls,ke=oe.dropdownMenuColumnStyle;return he.createElement("div",null,this.getShowOptions().map(function(ge,De){return he.createElement("ul",{className:"".concat(fe,"-menu"),key:De,style:ke},ge.map(function(Me){return ee.getOption(Me,De)}))}))}}]),se}(he.Component);return ae.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ae}(),S=d,g={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},p=g;function w(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(ne){return typeof ne}:w=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},w(ae)}function b(ae,de){if(ae==null)return{};var ne=u(ae,de),se,J;if(Object.getOwnPropertySymbols){var ee=Object.getOwnPropertySymbols(ae);for(J=0;J<ee.length;J++){if(se=ee[J],de.indexOf(se)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ae,se))continue;ne[se]=ae[se]}}return ne}function u(ae,de){if(ae==null)return{};var ne={},se=Object.keys(ae),J,ee;for(ee=0;ee<se.length;ee++){if(J=se[ee],de.indexOf(J)>=0)continue;ne[J]=ae[J]}return ne}function f(ae){return v(ae)||T(ae)||a(ae)||s()}function s(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(ae,de){if(!ae)return;if(typeof ae=="string")return C(ae,de);var ne=Object.prototype.toString.call(ae).slice(8,-1);if(ne==="Object"&&ae.constructor&&(ne=ae.constructor.name),ne==="Map"||ne==="Set")return Array.from(ae);if(ne==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ne))return C(ae,de)}function T(ae){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ae))return Array.from(ae)}function v(ae){if(Array.isArray(ae))return C(ae)}function C(ae,de){(de==null||de>ae.length)&&(de=ae.length);for(var ne=0,se=new Array(de);ne<de;ne++)se[ne]=ae[ne];return se}function D(ae,de){if(!(ae instanceof de))throw new TypeError("Cannot call a class as a function")}function j(ae,de){for(var ne=0;ne<de.length;ne++){var se=de[ne];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function z(ae,de,ne){return de&&j(ae.prototype,de),ne&&j(ae,ne),ae}function V(ae,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(de&&de.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),de&&P(ae,de)}function P(ae,de){return P=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},P(ae,de)}function N(ae){var de=pe();return function(){var ne=ve(ae),se;if(de){var J=ve(this).constructor;se=Reflect.construct(ne,arguments,J)}else se=ne.apply(this,arguments);return $(this,se)}}function $(ae,de){return de&&(w(de)==="object"||typeof de=="function")?de:re(ae)}function re(ae){if(ae===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae}function pe(){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(ae){return!1}}function ve(ae){return ve=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},ve(ae)}var Ae=function(){var ae=function(de){V(se,de);var ne=N(se);function se(J){var ee;D(this,se),ee=ne.call(this,J),ee.setPopupVisible=function(fe){var ke=ee.state.value;"popupVisible"in ee.props||ee.setState({popupVisible:fe}),fe&&!ee.state.popupVisible&&ee.setState({activeValue:ke}),ee.props.onPopupVisibleChange(fe)},ee.handleChange=function(fe,ke,ge){var De=ke.visible;(ge.type!=="keydown"||ge.keyCode===U.a.ENTER)&&(ee.props.onChange(fe.map(function(Me){return Me[ee.getFieldName("value")]}),fe),ee.setPopupVisible(De))},ee.handlePopupVisibleChange=function(fe){ee.setPopupVisible(fe)},ee.handleMenuSelect=function(fe,ke,ge){var De=ee.trigger.getRootDomNode();De&&De.focus&&De.focus();var Me=ee.props,Ue=Me.changeOnSelect,Ke=Me.loadData,He=Me.expandTrigger;if(!fe||fe.disabled)return;var Be=ee.state.activeValue;Be=Be.slice(0,ke+1),Be[ke]=fe[ee.getFieldName("value")];var rt=ee.getActiveOptions(Be);if(fe.isLeaf===!1&&!fe[ee.getFieldName("children")]&&Ke){Ue&&ee.handleChange(rt,{visible:!0},ge),ee.setState({activeValue:Be}),Ke(rt);return}var Oe={};!fe[ee.getFieldName("children")]||!fe[ee.getFieldName("children")].length?(ee.handleChange(rt,{visible:!1},ge),Oe.value=Be):Ue&&(ge.type==="click"||ge.type==="keydown")&&(He==="hover"?ee.handleChange(rt,{visible:!1},ge):ee.handleChange(rt,{visible:!0},ge),Oe.value=Be),Oe.activeValue=Be,("value"in ee.props||ge.type==="keydown"&&ge.keyCode!==U.a.ENTER)&&delete Oe.value,ee.setState(Oe)},ee.handleItemDoubleClick=function(){var fe=ee.props.changeOnSelect;fe&&ee.setPopupVisible(!1)},ee.handleKeyDown=function(fe){var ke=ee.props.children;if(ke&&ke.props.onKeyDown){ke.props.onKeyDown(fe);return}var ge=f(ee.state.activeValue),De=ge.length-1<0?0:ge.length-1,Me=ee.getCurrentLevelOptions(),Ue=Me.map(function(rt){return rt[ee.getFieldName("value")]}).indexOf(ge[De]);if(fe.keyCode!==U.a.DOWN&&fe.keyCode!==U.a.UP&&fe.keyCode!==U.a.LEFT&&fe.keyCode!==U.a.RIGHT&&fe.keyCode!==U.a.ENTER&&fe.keyCode!==U.a.SPACE&&fe.keyCode!==U.a.BACKSPACE&&fe.keyCode!==U.a.ESC&&fe.keyCode!==U.a.TAB)return;if(!ee.state.popupVisible&&fe.keyCode!==U.a.BACKSPACE&&fe.keyCode!==U.a.LEFT&&fe.keyCode!==U.a.RIGHT&&fe.keyCode!==U.a.ESC&&fe.keyCode!==U.a.TAB){ee.setPopupVisible(!0);return}if(fe.keyCode===U.a.DOWN||fe.keyCode===U.a.UP){fe.preventDefault();var Ke=Ue;Ke!==-1?fe.keyCode===U.a.DOWN?(Ke+=1,Ke=Ke>=Me.length?0:Ke):(Ke-=1,Ke=Ke<0?Me.length-1:Ke):Ke=0,ge[De]=Me[Ke][ee.getFieldName("value")]}else if(fe.keyCode===U.a.LEFT||fe.keyCode===U.a.BACKSPACE)fe.preventDefault(),ge.splice(ge.length-1,1);else if(fe.keyCode===U.a.RIGHT)fe.preventDefault(),Me[Ue]&&Me[Ue][ee.getFieldName("children")]&&ge.push(Me[Ue][ee.getFieldName("children")][0][ee.getFieldName("value")]);else if(fe.keyCode===U.a.ESC||fe.keyCode===U.a.TAB){ee.setPopupVisible(!1);return}(!ge||ge.length===0)&&ee.setPopupVisible(!1);var He=ee.getActiveOptions(ge),Be=He[He.length-1];ee.handleMenuSelect(Be,He.length-1,fe),ee.props.onKeyDown&&ee.props.onKeyDown(fe)},ee.saveTrigger=function(fe){ee.trigger=fe};var oe=[];return"value"in J?oe=J.value||[]:"defaultValue"in J&&(oe=J.defaultValue||[]),Z()(!("filedNames"in J),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),ee.state={popupVisible:J.popupVisible,activeValue:oe,value:oe,prevProps:J},ee.defaultFieldNames={label:"label",value:"value",children:"children"},ee}return z(se,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ee){var oe=this.defaultFieldNames,fe=this.props,ke=fe.fieldNames,ge=fe.filedNames;return"filedNames"in this.props?ge[ee]||oe[ee]:ke[ee]||oe[ee]}},{key:"getFieldNames",value:function(){var ee=this.props,oe=ee.fieldNames,fe=ee.filedNames;return"filedNames"in this.props?fe:oe}},{key:"getCurrentLevelOptions",value:function(){var ee=this,oe=this.props.options,fe=oe===void 0?[]:oe,ke=this.state.activeValue,ge=ke===void 0?[]:ke,De=K()(fe,function(Me,Ue){return Me[ee.getFieldName("value")]===ge[Ue]},{childrenKeyName:this.getFieldName("children")});return De[De.length-2]?De[De.length-2][this.getFieldName("children")]:f(fe).filter(function(Me){return!Me.disabled})}},{key:"getActiveOptions",value:function(ee){var oe=this;return K()(this.props.options||[],function(fe,ke){return fe[oe.getFieldName("value")]===ee[ke]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ee=this.props,oe=ee.prefixCls,fe=ee.transitionName,ke=ee.popupClassName,ge=ee.options,De=ge===void 0?[]:ge,Me=ee.disabled,Ue=ee.builtinPlacements,Ke=ee.popupPlacement,He=ee.children,Be=ee.dropdownRender,rt=b(ee,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Oe=he.createElement("div",null),Fe="";De&&De.length>0?Oe=he.createElement(S,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):Fe=" ".concat(oe,"-menus-empty");var je=Oe;return Be&&(je=Be(Oe)),he.createElement(Y.a,Object.assign({ref:this.saveTrigger},rt,{popupPlacement:Ke,builtinPlacements:Ue,popupTransitionName:fe,action:Me?[]:["click"],popupVisible:Me?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(oe,"-menus"),popupClassName:ke+Fe,popup:je}),he.cloneElement(He,{onKeyDown:this.handleKeyDown,tabIndex:Me?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ee,oe){var fe=oe.prevProps,ke=fe===void 0?{}:fe,ge={prevProps:ee};return"value"in ee&&!B(ke.value,ee.value)&&(ge.value=ee.value||[],"loadData"in ee||(ge.activeValue=ee.value||[])),"popupVisible"in ee&&(ge.popupVisible=ee.popupVisible),ge}}]),se}(he.Component);return ae.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:p,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ae}(),Le=Ae,ce=tt.a=Le},SJMd:function(Et,tt){/**
* @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,he,Y,O=!1,Z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var I,K;(function(){var B=window,M=["break,continue,do,else,for,if,return,while"],R=[M,"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"],E=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],L=[E,"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"],_=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[E,"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"],x="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=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"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"],l=[M,"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"],d=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[L,A,_,y,h,o,l,d],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",w="kwd",b="com",u="typ",f="lit",s="pun",a="pln",T="tag",v="dec",C="src",D="atn",j="atv",z="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(ge){for(var De=0,Me=!1,Ue=!1,Ke=0,He=ge.length;Ke<He;++Ke){var Be=ge[Ke];if(Be.ignoreCase)Ue=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,Ue=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function Oe(ze){var Re=ze.charCodeAt(0);if(Re!==92)return Re;var Qe=ze.charAt(1);return Re=rt[Qe],Re||("0"<=Qe&&Qe<="7"?parseInt(ze.substring(1),8):Qe==="u"||Qe==="x"?parseInt(ze.substring(2),16):ze.charCodeAt(1))}function Fe(ze){if(ze<32)return(ze<16?"\\x0":"\\x")+ze.toString(16);var Re=String.fromCharCode(ze);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function je(ze){var Re=ze.substring(1,ze.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")),Qe=[],Ye=Re[0]==="^",Pe=["["];Ye&&Pe.push("^");for(var We=Ye?1:0,Se=Re.length;We<Se;++We){var ye=Re[We];if(/\\[bdsw]/i.test(ye))Pe.push(ye);else{var xe=Oe(ye),le;We+2<Se&&Re[We+1]==="-"?(le=Oe(Re[We+2]),We+=2):le=xe,Qe.push([xe,le]),le<65||xe>122||(le<65||xe>90||Qe.push([Math.max(65,xe)|32,Math.min(le,90)|32]),le<97||xe>122||Qe.push([Math.max(97,xe)&~32,Math.min(le,122)&~32]))}}Qe.sort(function(we,Ie){return we[0]-Ie[0]||Ie[1]-we[1]});for(var ue=[],me=[],We=0;We<Qe.length;++We){var Ee=Qe[We];Ee[0]<=me[1]+1?me[1]=Math.max(me[1],Ee[1]):ue.push(me=Ee)}for(var We=0;We<ue.length;++We){var Ee=ue[We];Pe.push(Fe(Ee[0])),Ee[1]>Ee[0]&&(Ee[1]+1>Ee[0]&&Pe.push("-"),Pe.push(Fe(Ee[1])))}return Pe.push("]"),Pe.join("")}function Ge(ze){for(var Re=ze.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")),Qe=Re.length,Ye=[],Pe=0,We=0;Pe<Qe;++Pe){var Se=Re[Pe];if(Se==="(")++We;else if(Se.charAt(0)==="\\"){var ye=+Se.substring(1);ye&&(ye<=We?Ye[ye]=-1:Re[Pe]=Fe(ye))}}for(var Pe=1;Pe<Ye.length;++Pe)Ye[Pe]===-1&&(Ye[Pe]=++De);for(var Pe=0,We=0;Pe<Qe;++Pe){var Se=Re[Pe];if(Se==="(")++We,Ye[We]||(Re[Pe]="(?:");else if(Se.charAt(0)==="\\"){var ye=+Se.substring(1);ye&&ye<=We&&(Re[Pe]="\\"+Ye[ye])}}for(var Pe=0;Pe<Qe;++Pe)Re[Pe]==="^"&&Re[Pe+1]!=="^"&&(Re[Pe]="");if(ze.ignoreCase&&Me)for(var Pe=0;Pe<Qe;++Pe){var Se=Re[Pe],xe=Se.charAt(0);Se.length>=2&&xe==="["?Re[Pe]=je(Se):xe!=="\\"&&(Re[Pe]=Se.replace(/[a-zA-Z]/g,function(me){var Ee=me.charCodeAt(0);return"["+String.fromCharCode(Ee&~32,Ee|32)+"]"}))}return Re.join("")}for(var Ve=[],Ke=0,He=ge.length;Ke<He;++Ke){var Be=ge[Ke];if(Be.global||Be.multiline)throw new Error(""+Be);Ve.push("(?:"+Ge(Be)+")")}return new RegExp(Ve.join("|"),Ue?"gi":"g")}function N(ge,De){var Me=/(?:^|\s)nocode(?:\s|$)/,Ue=[],Ke=0,He=[],Be=0;function rt(Oe){var Fe=Oe.nodeType;if(Fe==1){if(Me.test(Oe.className))return;for(var je=Oe.firstChild;je;je=je.nextSibling)rt(je);var Ge=Oe.nodeName.toLowerCase();(Ge==="br"||Ge==="li")&&(Ue[Be]=`
`,He[Be<<1]=Ke++,He[Be++<<1|1]=Oe)}else if(Fe==3||Fe==4){var Ve=Oe.nodeValue;Ve.length&&(De?Ve=Ve.replace(/\r\n?/g,`
`):Ve=Ve.replace(/[ \t\r\n]+/g," "),Ue[Be]=Ve,He[Be<<1]=Ke,Ke+=Ve.length,He[Be++<<1|1]=Oe)}}return rt(ge),{sourceCode:Ue.join("").replace(/\n$/,""),spans:He}}function $(ge,De,Me,Ue,Ke){if(!Me)return;var He={sourceNode:ge,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:De,decorations:null};Ue(He),Ke.push.apply(Ke,He.decorations)}var re=/\S/;function pe(ge){for(var De=void 0,Me=ge.firstChild;Me;Me=Me.nextSibling){var Ue=Me.nodeType;De=Ue===1?De?ge:Me:Ue===3&&re.test(Me.nodeValue)?ge:De}return De===ge?void 0:De}function ve(ge,De){var Me={},Ue;(function(){for(var Be=ge.concat(De),rt=[],Oe={},Fe=0,je=Be.length;Fe<je;++Fe){var Ge=Be[Fe],Ve=Ge[3];if(Ve)for(var ze=Ve.length;--ze>=0;)Me[Ve.charAt(ze)]=Ge;var Re=Ge[1],Qe=""+Re;Oe.hasOwnProperty(Qe)||(rt.push(Re),Oe[Qe]=null)}rt.push(/[\0-\uffff]/),Ue=P(rt)})();var Ke=De.length,He=function(Be){for(var rt=Be.sourceCode,Oe=Be.basePos,Fe=Be.sourceNode,je=[Oe,a],Ge=0,Ve=rt.match(Ue)||[],ze={},Re=0,Qe=Ve.length;Re<Qe;++Re){var Ye=Ve[Re],Pe=ze[Ye],We=void 0,Se;if(typeof Pe=="string")Se=!1;else{var ye=Me[Ye.charAt(0)];if(ye)We=Ye.match(ye[1]),Pe=ye[0];else{for(var xe=0;xe<Ke;++xe)if(ye=De[xe],We=Ye.match(ye[1]),We){Pe=ye[0];break}We||(Pe=a)}Se=Pe.length>=5&&Pe.substring(0,5)==="lang-",Se&&!(We&&typeof We[1]=="string")&&(Se=!1,Pe=C),Se||(ze[Ye]=Pe)}var le=Ge;if(Ge+=Ye.length,!Se)je.push(Oe+le,Pe);else{var ue=We[1],me=Ye.indexOf(ue),Ee=me+ue.length;We[2]&&(Ee=Ye.length-We[2].length,me=Ee-ue.length);var we=Pe.substring(5);$(Fe,Oe+le,Ye.substring(0,me),He,je),$(Fe,Oe+le+me,ue,se(we,ue),je),$(Fe,Oe+le+Ee,Ye.substring(Ee),He,je)}}Be.decorations=je};return He}function Ae(ge){var De=[],Me=[];ge.tripleQuotedStrings?De.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ge.multiLineStrings?De.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ge.verbatimStrings&&Me.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ue=ge.hashComments;Ue&&(ge.cStyleComments?(Ue>1?De.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([b,/^#[^\r\n]*/,null,"#"])),ge.cStyleComments&&(Me.push([b,/^\/\/[^\r\n]*/,null]),Me.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=ge.regexLiterals;if(Ke){var He=Ke>1?"":`
\r`,Be=He?".":"[\\S\\s]",rt="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+V+"("+rt+")")])}var Oe=ge.types;Oe&&Me.push([u,Oe]);var Fe=(""+ge.keywords).replace(/^ | $/g,"");Fe.length&&Me.push([w,new RegExp("^(?:"+Fe.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([a,/^\s+/,null,` \r
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return ge.regexLiterals&&(je+="(?!s*/)"),Me.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[u,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(je),null]),ve(De,Me)}var Le=Ae({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ce(ge,De,Me){for(var Ue=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,He=ge.ownerDocument,Be=He.createElement("li");ge.firstChild;)Be.appendChild(ge.firstChild);var rt=[Be];function Oe(Re){var Qe=Re.nodeType;if(Qe==1&&!Ue.test(Re.className))if(Re.nodeName==="br")Fe(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var Ye=Re.firstChild;Ye;Ye=Ye.nextSibling)Oe(Ye);else if((Qe==3||Qe==4)&&Me){var Pe=Re.nodeValue,We=Pe.match(Ke);if(We){var Se=Pe.substring(0,We.index);Re.nodeValue=Se;var ye=Pe.substring(We.index+We[0].length);if(ye){var xe=Re.parentNode;xe.insertBefore(He.createTextNode(ye),Re.nextSibling)}Fe(Re),Se||Re.parentNode.removeChild(Re)}}}function Fe(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function Qe(We,Se){var ye=Se?We.cloneNode(!1):We,xe=We.parentNode;if(xe){var le=Qe(xe,1),ue=We.nextSibling;le.appendChild(ye);for(var me=ue;me;me=ue)ue=me.nextSibling,le.appendChild(me)}return ye}for(var Ye=Qe(Re.nextSibling,0),Pe;(Pe=Ye.parentNode)&&Pe.nodeType===1;)Ye=Pe;rt.push(Ye)}for(var je=0;je<rt.length;++je)Oe(rt[je]);De===(De|0)&&rt[0].setAttribute("value",De);var Ge=He.createElement("ol");Ge.className="linenums";for(var Ve=Math.max(0,De-1|0)||0,je=0,ze=rt.length;je<ze;++je)Be=rt[je],Be.className="L"+(je+Ve)%10,Be.firstChild||Be.appendChild(He.createTextNode("\xA0")),Ge.appendChild(Be);ge.appendChild(Ge)}function ae(ge){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Me=/\n/g,Ue=ge.sourceCode,Ke=Ue.length,He=0,Be=ge.spans,rt=Be.length,Oe=0,Fe=ge.decorations,je=Fe.length,Ge=0;Fe[je]=Ke;var Ve,ze;for(ze=Ve=0;ze<je;)Fe[ze]!==Fe[ze+2]?(Fe[Ve++]=Fe[ze++],Fe[Ve++]=Fe[ze++]):ze+=2;for(je=Ve,ze=Ve=0;ze<je;){for(var Re=Fe[ze],Qe=Fe[ze+1],Ye=ze+2;Ye+2<=je&&Fe[Ye+1]===Qe;)Ye+=2;Fe[Ve++]=Re,Fe[Ve++]=Qe,ze=Ye}je=Fe.length=Ve;var Pe=ge.sourceNode,We="";Pe&&(We=Pe.style.display,Pe.style.display="none");try{for(var Se=null;Oe<rt;){var ye=Be[Oe],xe=Be[Oe+2]||Ke,le=Fe[Ge+2]||Ke,Ye=Math.min(xe,le),ue=Be[Oe+1],me;if(ue.nodeType!==1&&(me=Ue.substring(He,Ye))){De&&(me=me.replace(Me,"\r")),ue.nodeValue=me;var Ee=ue.ownerDocument,we=Ee.createElement("span");we.className=Fe[Ge+1];var Ie=ue.parentNode;Ie.replaceChild(we,ue),we.appendChild(ue),He<xe&&(Be[Oe+1]=ue=Ee.createTextNode(Ue.substring(Ye,xe)),Ie.insertBefore(ue,we.nextSibling))}He=Ye,He>=xe&&(Oe+=2),He>=le&&(Ge+=2)}}finally{Pe&&(Pe.style.display=We)}}var de={};function ne(ge,De){for(var Me=De.length;--Me>=0;){var Ue=De[Me];de.hasOwnProperty(Ue)?B.console&&console.warn("cannot override language handler %s",Ue):de[Ue]=ge}}function se(ge,De){return ge&&de.hasOwnProperty(ge)||(ge=/^\s*</.test(De)?"default-markup":"default-code"),de[ge]}ne(Le,["default-code"]),ne(ve([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ne(ve([[a,/^[\s]+/,null,` \r
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ne(ve([],[[j,/^[\s\S]+/]]),["uq.val"]),ne(Ae({keywords:L,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ne(Ae({keywords:"null,true,false"}),["json"]),ne(Ae({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ne(Ae({keywords:_,cStyleComments:!0}),["java"]),ne(Ae({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(Ae({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(Ae({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(Ae({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(Ae({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(Ae({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ve([],[[p,/^[\s\S]+/]]),["regex"]);function J(ge){var De=ge.langExtension;try{var Me=N(ge.sourceNode,ge.pre),Ue=Me.sourceCode;ge.sourceCode=Ue,ge.spans=Me.spans,ge.basePos=0,se(De,Ue)(ge),ae(ge)}catch(Ke){B.console&&console.log(Ke&&Ke.stack||Ke)}}function ee(ge,De,Me){var Ue=Me||!1,Ke=De||null,He=document.createElement("div");He.innerHTML="<pre>"+ge+"</pre>",He=He.firstChild,Ue&&ce(He,Ue,!0);var Be={langExtension:Ke,numberLines:Ue,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Be),He.innerHTML}function oe(ge,De){var Me=De||document.body,Ue=Me.ownerDocument||document;function Ke(ye){return Me.getElementsByTagName(ye)}for(var He=[Ke("pre"),Ke("code"),Ke("xmp")],Be=[],rt=0;rt<He.length;++rt)for(var Oe=0,Fe=He[rt].length;Oe<Fe;++Oe)Be.push(He[rt][Oe]);He=null;var je=Date;je.now||(je={now:function(){return+new Date}});var Ge=0,Ve=/\blang(?:uage)?-([\w.]+)(?!\S)/,ze=/\bprettyprint\b/,Re=/\bprettyprinted\b/,Qe=/pre|xmp/i,Ye=/^code$/i,Pe=/^(?:pre|code|xmp)$/i,We={};function Se(){for(var ye=B.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;Ge<Be.length&&je.now()<ye;Ge++){for(var xe=Be[Ge],le=We,ue=xe;ue=ue.previousSibling;){var me=ue.nodeType,Ee=(me===7||me===8)&&ue.nodeValue;if(Ee?!/^\??prettify\b/.test(Ee):me!==3||/\S/.test(ue.nodeValue))break;if(Ee){le={},Ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,Tt,Ut){le[Tt]=Ut});break}}var we=xe.className;if((le!==We||ze.test(we))&&!Re.test(we)){for(var Ie=!1,$e=xe.parentNode;$e;$e=$e.parentNode){var at=$e.tagName;if(Pe.test(at)&&$e.className&&ze.test($e.className)){Ie=!0;break}}if(!Ie){xe.className+=" prettyprinted";var ht=le.lang;if(!ht){ht=we.match(Ve);var ut;!ht&&(ut=pe(xe))&&Ye.test(ut.tagName)&&(ht=ut.className.match(Ve)),ht&&(ht=ht[1])}var xt;if(Qe.test(xe.tagName))xt=1;else{var Ct=xe.currentStyle,st=Ue.defaultView,Mt=Ct?Ct.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(xe,null).getPropertyValue("white-space"):0;xt=Mt&&Mt.substring(0,3)==="pre"}var Lt=le.linenums;(Lt=Lt==="true"||+Lt)||(Lt=we.match(/\blinenums\b(?::(\d+))?/),Lt=Lt?Lt[1]&&Lt[1].length?+Lt[1]:!0:!1),Lt&&ce(xe,Lt,xt);var kt={langExtension:ht,sourceNode:xe,numberLines:Lt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};J(kt)}}}Ge<Be.length?B.setTimeout(Se,250):typeof ge=="function"&&ge()}Se()}var fe=B.PR={createSimpleLexer:ve,registerLangHandler:ne,sourceDecorator:Ae,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:j,PR_COMMENT:b,PR_DECLARATION:v,PR_KEYWORD:w,PR_LITERAL:f,PR_NOCODE:z,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:C,PR_STRING:p,PR_TAG:T,PR_TYPE:u,prettyPrintOne:O?B.prettyPrintOne=ee:I=ee,prettyPrint:K=O?B.prettyPrint=oe:K=oe},ke=B.define;typeof ke=="function"&&ke.amd&&ke("google-code-prettify",[],function(){return fe})})()},"VrN/":function(Et,tt,ie){(function(he,Y){Et.exports=Y()})(this,function(){"use strict";var he=navigator.userAgent,Y=navigator.platform,O=/gecko\/\d/i.test(he),Z=/MSIE \d/.test(he),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),I=/Edge\/(\d+)/.exec(he),K=Z||U||I,B=K&&(Z?document.documentMode||6:+(I||U)[1]),M=!I&&/WebKit\//.test(he),R=M&&/Qt\/\d+\.\d+/.test(he),E=!I&&/Chrome\//.test(he),L=/Opera\//.test(he),_=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(he),x=/PhantomJS/.test(he),y=!I&&/AppleWebKit/.test(he)&&/Mobile\/\w+/.test(he),h=/Android/.test(he),o=y||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(he),l=y||/Mac/.test(Y),d=/\bCrOS\b/.test(he),S=/win/i.test(Y),g=L&&he.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(L=!1,M=!0);var p=l&&(R||L&&(g==null||g<12.11)),w=O||K&&B>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var u=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)i.appendChild(t[k]);return i}function T(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var v;document.createRange?v=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:v=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function C(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 D(){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 j(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function z(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var V=function(e){e.select()};y?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(V=function(e){try{e.select()}catch(t){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=r||0,W=i||0;;){var X=e.indexOf(" ",k);if(X<0||X>=t)return W+(t-k);W+=X-k,W+=n-W%n,k=X+1}}var re=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};re.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},re.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function pe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ve=50,Ae={toString:function(){return"CodeMirror.Pass"}},Le={scroll:!1},ce={origin:"*mouse"},ae={origin:"+move"};function de(e,t,n){for(var r=0,i=0;;){var k=e.indexOf(" ",r);k==-1&&(k=e.length);var W=k-r;if(k==e.length||i+W>=t)return r+Math.min(W,t-i);if(i+=k-r,i+=n-i%n,r=k+1,i>=t)return r}}var ne=[""];function se(e){for(;ne.length<=e;)ne.push(J(ne)+" ");return ne[e]}function J(e){return e[e.length-1]}function ee(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function oe(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function fe(){}function ke(e,t){var n;return Object.create?n=Object.create(e):(fe.prototype=e,n=new fe),t&&N(t,n),n}var ge=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ge.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function He(e){return e.charCodeAt(0)>=768&&Ke.test(e)}function Be(e,t,n){for(;(n<0?t>0:t<e.length)&&He(e.charAt(t));)t+=n;return t}function rt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,k=r<0?Math.ceil(i):Math.floor(i);if(k==t)return e(k)?t:n;e(k)?n=k:t=k+r}}function Oe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,k=0;k<e.length;++k){var W=e[k];(W.from<n&&W.to>t||t==n&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,n),W.level==1?"rtl":"ltr",k),i=!0)}i||r(t,n,"ltr")}var Fe=null;function je(e,t,n){var r;Fe=null;for(var i=0;i<e.length;++i){var k=e[i];if(k.from<t&&k.to>t)return i;k.to==t&&(k.from!=k.to&&n=="before"?r=i:Fe=i),k.from==t&&(k.from!=k.to&&n!="before"?r=i:Fe=i)}return r!=null?r:Fe}var Ge=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,k=/[LRr]/,W=/[Lb1n]/,X=/[1n]/;function Q(te,be,Te){this.level=te,this.from=be,this.to=Te}return function(te,be){var Te=be=="ltr"?"L":"R";if(te.length==0||be=="ltr"&&!r.test(te))return!1;for(var Ne=te.length,_e=[],Je=0;Je<Ne;++Je)_e.push(n(te.charCodeAt(Je)));for(var et=0,it=Te;et<Ne;++et){var dt=_e[et];dt=="m"?_e[et]=it:it=dt}for(var gt=0,ct=Te;gt<Ne;++gt){var bt=_e[gt];bt=="1"&&ct=="r"?_e[gt]="n":k.test(bt)&&(ct=bt,bt=="r"&&(_e[gt]="R"))}for(var Rt=1,At=_e[0];Rt<Ne-1;++Rt){var Wt=_e[Rt];Wt=="+"&&At=="1"&&_e[Rt+1]=="1"?_e[Rt]="1":Wt==","&&At==_e[Rt+1]&&(At=="1"||At=="n")&&(_e[Rt]=At),At=Wt}for(var fr=0;fr<Ne;++fr){var Br=_e[fr];if(Br==",")_e[fr]="N";else if(Br=="%"){var Sr=void 0;for(Sr=fr+1;Sr<Ne&&_e[Sr]=="%";++Sr);for(var fn=fr&&_e[fr-1]=="!"||Sr<Ne&&_e[Sr]=="1"?"1":"N",an=fr;an<Sr;++an)_e[an]=fn;fr=Sr-1}}for(var Or=0,on=Te;Or<Ne;++Or){var Gr=_e[Or];on=="L"&&Gr=="1"?_e[Or]="L":k.test(Gr)&&(on=Gr)}for(var Mr=0;Mr<Ne;++Mr)if(i.test(_e[Mr])){var Rr=void 0;for(Rr=Mr+1;Rr<Ne&&i.test(_e[Rr]);++Rr);for(var kr=(Mr?_e[Mr-1]:Te)=="L",sn=(Rr<Ne?_e[Rr]:Te)=="L",hi=kr==sn?kr?"L":"R":Te,Bn=Mr;Bn<Rr;++Bn)_e[Bn]=hi;Mr=Rr-1}for(var $r=[],An,jr=0;jr<Ne;)if(W.test(_e[jr])){var Va=jr;for(++jr;jr<Ne&&W.test(_e[jr]);++jr);$r.push(new Q(0,Va,jr))}else{var On=jr,$n=$r.length,Zn=be=="rtl"?1:0;for(++jr;jr<Ne&&_e[jr]!="L";++jr);for(var Qr=On;Qr<jr;)if(X.test(_e[Qr])){On<Qr&&($r.splice($n,0,new Q(1,On,Qr)),$n+=Zn);var fi=Qr;for(++Qr;Qr<jr&&X.test(_e[Qr]);++Qr);$r.splice($n,0,new Q(2,fi,Qr)),$n+=Zn,On=Qr}else++Qr;On<jr&&$r.splice($n,0,new Q(1,On,jr))}return be=="ltr"&&($r[0].level==1&&(An=te.match(/^\s+/))&&($r[0].from=An[0].length,$r.unshift(new Q(0,0,An[0].length))),J($r).level==1&&(An=te.match(/\s+$/))&&(J($r).to-=An[0].length,$r.push(new Q(0,Ne-An[0].length,Ne)))),be=="rtl"?$r.reverse():$r}}();function Ve(e,t){var n=e.order;return n==null&&(n=e.order=Ge(e.text,t)),n}var ze=[],Re=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ze).concat(n)}};function Qe(e,t){return e._handlers&&e._handlers[t]||ze}function Ye(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var k=pe(i,n);k>-1&&(r[t]=i.slice(0,k).concat(i.slice(k+1)))}}}function Pe(e,t){var n=Qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function We(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Pe(e,n||t.type,e,t),me(t)||t.codemirrorIgnore}function Se(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)pe(n,t[r])==-1&&n.push(t[r])}function ye(e,t){return Qe(e,t).length>0}function xe(e){e.prototype.on=function(t,n){Re(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ue(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function me(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Ee(e){le(e),ue(e)}function we(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var $e=function(){if(K&&B<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),at;function ht(e){if(at==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&B<8))}var n=at?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ut;function xt(e){if(ut!=null)return ut;var t=s(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:ut=r.right-n.right<3}var Ct=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var k=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),W=k.indexOf("\r");W!=-1?(n.push(k.slice(0,W)),t+=W+1):(n.push(k),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Mt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Lt=null;function kt(e){if(Lt!=null)return Lt;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Lt=Math.abs(n.left-r.left)>1}var Dt={},Tt={};function Ut(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function Qt(e,t){Tt[e]=t}function yt(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=yt(t);var n=Dt[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(Bt.hasOwnProperty(t.name)){var i=Bt[t.name];for(var k in i){if(!i.hasOwnProperty(k))continue;r.hasOwnProperty(k)&&(r["_"+k]=r[k]),r[k]=i[k]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var Bt={};function tr(e,t){var n=Bt.hasOwnProperty(e)?Bt[e]:Bt[e]={};N(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function nr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function vr(e,t,n){return e.startState?e.startState(t,n):!0}var Nt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Nt.prototype.eol=function(){return this.pos>=this.string.length},Nt.prototype.sol=function(){return this.pos==this.lineStart},Nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Nt.prototype.skipToEnd=function(){this.pos=this.string.length},Nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Nt.prototype.backUp=function(e){this.pos-=e},Nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(W){return n?W.toLowerCase():W},i=this.string.substr(this.pos,e.length);if(r(i)==r(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)}},Nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(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 n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],k=i.chunkSize();if(t<k){n=i;break}t-=k}return n.lines[t]}function sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(k){var W=k.text;i==n.line&&(W=W.slice(0,n.ch)),i==t.line&&(W=W.slice(t.ch)),r.push(W),++i}),r}function Tr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function gr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Pt(e){if(e.parent==null)return null;for(var t=e.parent,n=pe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function yr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],k=i.height;if(t<k){e=i;continue e}t-=k,n+=i.chunkSize()}return n}while(!e.lines);for(var W=0;W<e.lines.length;++W){var X=e.lines[W],Q=X.height;if(t<Q)break;t-=Q}return n+W}function dr(e,t){return t>=e.first&&t<e.first+e.size}function qr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function qe(e,t,n){if(n===void 0&&(n=null),!(this instanceof qe))return new qe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function wt(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&wt(e,t)==0}function Ir(e){return qe(e.line,e.ch)}function Zr(e,t){return wt(e,t)<0?t:e}function Wr(e,t){return wt(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function c(e,t){if(t.line<e.first)return qe(e.first,0);var n=e.first+e.size-1;return t.line>n?qe(n,ft(e,n).text.length):m(t,ft(e,t.line).text.length)}function m(e,t){var n=e.ch;return n==null||n>t?qe(e.line,t):n<0?qe(e.line,0):e}function F(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=c(e,t[r]);return n}var q=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,n){return t instanceof q?new H(e,ur(e.mode,t.state),n,t.lookAhead):new H(e,ur(e.mode,t),n)},H.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function Ce(e,t,n,r){var i=[e.state.modeGen],k={};$t(e,t.text,e.doc.mode,n,function(te,be){return i.push(te,be)},k,r);for(var W=n.state,X=function(te){n.baseTokens=i;var be=e.state.overlays[te],Te=1,Ne=0;n.state=!0,$t(e,t.text,be.mode,n,function(_e,Je){for(var et=Te;Ne<_e;){var it=i[Te];it>_e&&i.splice(Te,1,_e,i[Te+1],it),Te+=2,Ne=Math.min(_e,it)}if(!Je)return;if(be.opaque)i.splice(et,Te-et,_e,"overlay "+Je),Te=et+2;else for(;et<Te;et+=2){var dt=i[et+1];i[et+1]=(dt?dt+" ":"")+"overlay "+Je}},k),n.state=W,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)X(Q);return{styles:i,classes:k.bgClass||k.textClass?k:null}}function Ze(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nt(e,Pt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),k=Ce(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new H(r,!0,t);var k=rr(e,t,n),W=k>r.first&&ft(r,k-1).stateAfter,X=W?H.fromSaved(r,W,k):new H(r,vr(r.mode),k);return r.iter(k,t,function(Q){lt(e,Q.text,X);var te=X.line;Q.stateAfter=te==t-1||te%5==0||te>=i.viewFrom&&te<i.viewTo?X.save():null,X.nextLine()}),n&&(r.modeFrontier=X.line),X}function lt(e,t,n,r){var i=e.doc.mode,k=new Nt(t,e.options.tabSize,n);for(k.start=k.pos=r||0,t==""&&Xe(i,n.state);!k.eol();)pt(i,k,n.state),k.start=k.pos}function Xe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=nr(e,n).mode);var k=e.token(t,n);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var mt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function It(e,t,n,r){var i=e.doc,k=i.mode,W;t=c(i,t);var X=ft(i,t.line),Q=nt(e,t.line,n),te=new Nt(X.text,e.options.tabSize,Q),be;for(r&&(be=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,W=pt(k,te,Q.state),r&&be.push(new mt(te,W,ur(i.mode,Q.state)));return r?be:new mt(te,W,Q.state)}function lr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function $t(e,t,n,r,i,k,W){var X=n.flattenSpans;X==null&&(X=e.options.flattenSpans);var Q=0,te=null,be=new Nt(t,e.options.tabSize,r),Te,Ne=e.options.addModeClass&&[null];for(t==""&&lr(Xe(n,r.state),k);!be.eol();){if(be.pos>e.options.maxHighlightLength?(X=!1,W&&lt(e,t,r,be.pos),be.pos=t.length,Te=null):Te=lr(pt(n,be,r.state,Ne),k),Ne){var _e=Ne[0].name;_e&&(Te="m-"+(Te?_e+" "+Te:_e))}if(!X||te!=Te){for(;Q<be.start;)Q=Math.min(be.start,Q+5e3),i(Q,te);te=Te}be.start=be.pos}for(;Q<be.pos;){var Je=Math.min(be.pos,Q+5e3);i(Je,te),Q=Je}}function rr(e,t,n){for(var r,i,k=e.doc,W=n?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>W;--X){if(X<=k.first)return k.first;var Q=ft(k,X-1),te=Q.stateAfter;if(te&&(!n||X+(te instanceof q?te.lookAhead:0)<=k.modeFrontier))return X;var be=$(Q.text,null,e.options.tabSize);(i==null||r>be)&&(i=X-1,r=be)}return i}function xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=ft(e,r).stateAfter;if(i&&(!(i instanceof q)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Nr=!1,ir=!1;function Xt(){Nr=!0}function wr(){ir=!0}function Hr(e,t,n){this.marker=e,this.from=t,this.to=n}function ar(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function yn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ar(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function _r(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var k=e[i],W=k.marker,X=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);if(X||k.from==t&&W.type=="bookmark"&&(!n||!k.marker.insertLeft)){var Q=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);(r||(r=[])).push(new Hr(W,k.from,Q?null:k.to))}}return r}function Rn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var k=e[i],W=k.marker,X=k.to==null||(W.inclusiveRight?k.to>=t:k.to>t);if(X||k.from==t&&W.type=="bookmark"&&(!n||k.marker.insertLeft)){var Q=k.from==null||(W.inclusiveLeft?k.from<=t:k.from<t);(r||(r=[])).push(new Hr(W,Q?null:k.from-t,k.to==null?null:k.to-t))}}return r}function jt(e,t){if(t.full)return null;var n=dr(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=dr(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,k=t.to.ch,W=wt(t.from,t.to)==0,X=_r(n,i,W),Q=Rn(r,k,W),te=t.text.length==1,be=J(t.text).length+(te?i:0);if(X)for(var Te=0;Te<X.length;++Te){var Ne=X[Te];if(Ne.to==null){var _e=ar(Q,Ne.marker);_e?te&&(Ne.to=_e.to==null?null:_e.to+be):Ne.to=i}}if(Q)for(var Je=0;Je<Q.length;++Je){var et=Q[Je];if(et.to!=null&&(et.to+=be),et.from==null){var it=ar(X,et.marker);it||(et.from=be,te&&(X||(X=[])).push(et))}else et.from+=be,te&&(X||(X=[])).push(et)}X&&(X=vt(X)),Q&&Q!=X&&(Q=vt(Q));var dt=[X];if(!te){var gt=t.text.length-2,ct;if(gt>0&&X)for(var bt=0;bt<X.length;++bt)X[bt].to==null&&(ct||(ct=[])).push(new Hr(X[bt].marker,null,null));for(var Rt=0;Rt<gt;++Rt)dt.push(ct);dt.push(Q)}return dt}function vt(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ot(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(_e){if(_e.markedSpans)for(var Je=0;Je<_e.markedSpans.length;++Je){var et=_e.markedSpans[Je].marker;et.readOnly&&(!r||pe(r,et)==-1)&&(r||(r=[])).push(et)}}),!r)return null;for(var i=[{from:t,to:n}],k=0;k<r.length;++k)for(var W=r[k],X=W.find(0),Q=0;Q<i.length;++Q){var te=i[Q];if(wt(te.to,X.from)<0||wt(te.from,X.to)>0)continue;var be=[Q,1],Te=wt(te.from,X.from),Ne=wt(te.to,X.to);(Te<0||!W.inclusiveLeft&&!Te)&&be.push({from:te.from,to:X.from}),(Ne>0||!W.inclusiveRight&&!Ne)&&be.push({from:X.to,to:te.to}),i.splice.apply(i,be),Q+=be.length-3}return i}function Cr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Yt(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Ht(e){return e.inclusiveRight?1:0}function br(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),k=wt(r.from,i.from)||Zt(e)-Zt(t);if(k)return-k;var W=wt(r.to,i.to)||Ht(e)-Ht(t);return W||t.id-e.id}function Ft(e,t){var n=ir&&e.markedSpans,r;if(n)for(var i=void 0,k=0;k<n.length;++k)i=n[k],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||br(r,i.marker)<0)&&(r=i.marker);return r}function cr(e){return Ft(e,!0)}function zt(e){return Ft(e,!1)}function Vr(e,t){var n=ir&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var k=n[i];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!r||br(r,k.marker)<0)&&(r=k.marker)}return r}function mr(e,t,n,r,i){var k=ft(e,t),W=ir&&k.markedSpans;if(W)for(var X=0;X<W.length;++X){var Q=W[X];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),be=wt(te.from,n)||Zt(Q.marker)-Zt(i),Te=wt(te.to,r)||Ht(Q.marker)-Ht(i);if(be>=0&&Te<=0||be<=0&&Te>=0)continue;if(be<=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?wt(te.to,n)>=0:wt(te.to,n)>0)||be>=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?wt(te.from,r)<=0:wt(te.from,r)<0))return!0}}function Lr(e){for(var t;t=cr(e);)e=t.find(-1,!0).line;return e}function ln(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function pn(e){for(var t,n;t=zt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function un(e,t){var n=ft(e,t),r=Lr(n);return n==r?t:Pt(r)}function dn(e,t){if(t>e.lastLine())return t;var n=ft(e,t),r;if(!En(e,n))return t;for(;r=zt(n);)n=r.find(1,!0).line;return Pt(n)+1}function En(e,t){var n=ir&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&mn(e,t,r))return!0}}function mn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return mn(e,r.line,ar(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,k=0;k<t.markedSpans.length;++k)if(i=t.markedSpans[k],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&mn(e,t,i))return!0}function cn(e){e=Lr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var k=n.parent;k;n=k,k=n.parent)for(var W=0;W<k.children.length;++W){var X=k.children[W];if(X==n)break;t+=X.height}return t}function pi(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=cr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=zt(r);){var k=n.find(0,!0);t-=r.text.length-k.from.ch,r=k.to.line,t+=r.text.length-k.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=ft(n,n.first),t.maxLineLength=pi(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=pi(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var jn=function(e,t,n){this.text=e,Yt(this,t),this.height=n?n(this):1};jn.prototype.lineNo=function(){return Pt(this)},xe(jn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Cr(e),Yt(e,n);var i=r?r(e):1;i!=e.height&&gr(e,i)}function St(e){e.parent=null,Cr(e)}var _t={},Ot={};function Kt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ot:_t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Jt(e,t){var n=T("span",null,null,M?"padding-right: .1px":null),r={pre:T("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var k=i?t.rest[i-1]:t.line,W=void 0;r.pos=0,r.addToken=Vt,xt(e.display.measure)&&(W=Ve(k,e.doc.direction))&&(r.addToken=en(r.addToken,W)),r.map=[];var X=t!=e.display.externalMeasured&&Pt(k);Ln(k,r,Ze(e,k,X)),k.styleClasses&&(k.styleClasses.bgClass&&(r.bgClass=z(k.styleClasses.bgClass,r.bgClass||"")),k.styleClasses.textClass&&(r.textClass=z(k.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(M){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=z(r.pre.className,r.textClass||"")),r}function hr(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Vt(e,t,n,r,i,k,W){if(!t)return;var X=e.splitSpaces?Pr(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,be;if(!Q.test(t))e.col+=t.length,be=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,be),K&&B<9&&(te=!0),e.pos+=t.length;else{be=document.createDocumentFragment();for(var Te=0;;){Q.lastIndex=Te;var Ne=Q.exec(t),_e=Ne?Ne.index-Te:t.length-Te;if(_e){var Je=document.createTextNode(X.slice(Te,Te+_e));K&&B<9?be.appendChild(a("span",[Je])):be.appendChild(Je),e.map.push(e.pos,e.pos+_e,Je),e.col+=_e,e.pos+=_e}if(!Ne)break;Te+=_e+1;var et=void 0;if(Ne[0]==" "){var it=e.cm.options.tabSize,dt=it-e.col%it;et=be.appendChild(a("span",se(dt),"cm-tab")),et.setAttribute("role","presentation"),et.setAttribute("cm-text"," "),e.col+=dt}else Ne[0]=="\r"||Ne[0]==`
`?(et=be.appendChild(a("span",Ne[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),et.setAttribute("cm-text",Ne[0]),e.col+=1):(et=e.cm.options.specialCharPlaceholder(Ne[0]),et.setAttribute("cm-text",Ne[0]),K&&B<9?be.appendChild(a("span",[et])):be.appendChild(et),e.col+=1);e.map.push(e.pos,e.pos+1,et),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,n||r||i||te||k||W){var gt=n||"";r&&(gt+=r),i&&(gt+=i);var ct=a("span",[be],gt,k);if(W)for(var bt in W)W.hasOwnProperty(bt)&&bt!="style"&&bt!="class"&&ct.setAttribute(bt,W[bt]);return e.content.appendChild(ct)}e.content.appendChild(be)}function Pr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var k=e.charAt(i);k==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(k="\xA0"),r+=k,n=k==" "}return r}function en(e,t){return function(n,r,i,k,W,X,Q){i=i?i+" cm-force-border":"cm-force-border";for(var te=n.pos,be=te+r.length;;){for(var Te=void 0,Ne=0;Ne<t.length&&!(Te=t[Ne],Te.to>te&&Te.from<=te);Ne++);if(Te.to>=be)return e(n,r,i,k,W,X,Q);e(n,r.slice(0,Te.to-te),i,k,null,X,Q),k=null,r=r.slice(Te.to-te),te=Te.to}}}function Gt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ln(e,t,n){var r=e.markedSpans,i=e.text,k=0;if(!r){for(var W=1;W<n.length;W+=2)t.addToken(t,i.slice(k,k=n[W]),Kt(n[W+1],t.cm.options));return}for(var X=i.length,Q=0,te=1,be="",Te,Ne,_e=0,Je,et,it,dt,gt;;){if(_e==Q){Je=et=it=Ne="",gt=null,dt=null,_e=Infinity;for(var ct=[],bt=void 0,Rt=0;Rt<r.length;++Rt){var At=r[Rt],Wt=At.marker;if(Wt.type=="bookmark"&&At.from==Q&&Wt.widgetNode)ct.push(Wt);else if(At.from<=Q&&(At.to==null||At.to>Q||Wt.collapsed&&At.to==Q&&At.from==Q)){if(At.to!=null&&At.to!=Q&&_e>At.to&&(_e=At.to,et=""),Wt.className&&(Je+=" "+Wt.className),Wt.css&&(Ne=(Ne?Ne+";":"")+Wt.css),Wt.startStyle&&At.from==Q&&(it+=" "+Wt.startStyle),Wt.endStyle&&At.to==_e&&(bt||(bt=[])).push(Wt.endStyle,At.to),Wt.title&&((gt||(gt={})).title=Wt.title),Wt.attributes)for(var fr in Wt.attributes)(gt||(gt={}))[fr]=Wt.attributes[fr];Wt.collapsed&&(!dt||br(dt.marker,Wt)<0)&&(dt=At)}else At.from>Q&&_e>At.from&&(_e=At.from)}if(bt)for(var Br=0;Br<bt.length;Br+=2)bt[Br+1]==_e&&(et+=" "+bt[Br]);if(!dt||dt.from==Q)for(var Sr=0;Sr<ct.length;++Sr)Gt(t,0,ct[Sr]);if(dt&&(dt.from||0)==Q){if(Gt(t,(dt.to==null?X+1:dt.to)-Q,dt.marker,dt.from==null),dt.to==null)return;dt.to==Q&&(dt=!1)}}if(Q>=X)break;for(var fn=Math.min(X,_e);;){if(be){var an=Q+be.length;if(!dt){var Or=an>fn?be.slice(0,fn-Q):be;t.addToken(t,Or,Te?Te+Je:Je,it,Q+Or.length==_e?et:"",Ne,gt)}if(an>=fn){be=be.slice(fn-Q),Q=fn;break}Q=an,it=""}be=i.slice(k,k=n[te++]),Te=Kt(n[te++],t.cm.options)}}}function qt(e,t,n){this.line=t,this.rest=pn(t),this.size=this.rest?Pt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=En(e,t)}function tn(e,t,n){for(var r=[],i,k=t;k<n;k=i){var W=new qt(e.doc,ft(e.doc,k),k);i=k+W.size,r.push(W)}return r}var Xr=null;function bn(e){Xr?Xr.ops.push(e):e.ownsGroup=Xr={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Xr=null,t(n)}}var mi=null;function Kr(e,t){var n=Qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Xr?i=Xr.delayedCallbacks:mi?i=mi:(i=mi=[],setTimeout(_s,0));for(var k=function(X){i.push(function(){return n[X].apply(null,r)})},W=0;W<n.length;++W)k(W)}function _s(){var e=mi;mi=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var k=t.changes[i];k=="text"?Ms(e,t):k=="gutter"?Za(e,t,n,r):k=="class"?da(e,t):k=="widget"&&Is(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=gi(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Jt(e,t)}function Ms(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ps(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Za(e,t,n,r){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 i=gi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var W=gi(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),W.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",qr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,be=k.hasOwnProperty(te)&&k[te];be&&X.appendChild(a("div",[be],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,k=void 0;i;i=k)k=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Ns(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Za(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Qa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,n,!1)}function Qa(e,t,n,r,i){if(!t.widgets)return;for(var k=gi(n),W=0,X=t.widgets;W<X.length;++W){var Q=X[W],te=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Fs(Q,te,n,r),e.display.input.setUneditable(te),i&&Q.above?k.insertBefore(te,n.gutter||n.text):k.appendChild(te),Kr(Q,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function vi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!C(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kn(e,t){for(var n=we(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Wi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Tn(e){return ve-e.display.nativeBarWidth}function Wn(e){return e.display.scroller.clientWidth-Tn(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Tn(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&Wn(e);if(!t.measure.heights||r&&t.measure.width!=i){var k=t.measure.heights=[];if(r){t.measure.width=i;for(var W=t.text.firstChild.getClientRects(),X=0;X<W.length-1;X++){var Q=W[X],te=W[X+1];Math.abs(Q.bottom-te.bottom)>2&&k.push((Q.bottom+te.top)/2-n.top)}}k.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Pt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Lr(t);var n=Pt(t),r=e.display.externalMeasured=new qt(e.doc,t,n);r.lineN=n;var i=r.built=Jt(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return wn(e,Jn(e,t),n,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Gn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Jn(e,t){var n=Pt(t),r=fa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function wn(e,t,n,r,i){t.before&&(n=-1);var k=n+(r||""),W;return t.cache.hasOwnProperty(k)?W=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,n,r),W.bogus||(t.cache[k]=W)),{left:W.left,right:W.right,top:i?W.rtop:W.top,bottom:i?W.rbottom:W.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,k,W,X,Q,te=0;te<e.length;te+=3)if(X=e[te],Q=e[te+1],t<X?(i=0,k=1,W="left"):t<Q?(i=t-X,k=i+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(k=Q-X,i=k-1,t>=Q&&(W="right")),i!=null){if(r=e[te+2],X==Q&&n==(r.insertLeft?"left":"right")&&(W=n),n=="left"&&i==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],W="left";if(n=="right"&&i==Q-X)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],W="right";break}return{node:r,start:i,end:k,collapse:W,coverStart:X,coverEnd:Q}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),k=i.node,W=i.start,X=i.end,Q=i.collapse,te;if(k.nodeType==3){for(var be=0;be<4;be++){for(;W&&He(t.line.text.charAt(i.coverStart+W));)--W;for(;i.coverStart+X<i.coverEnd&&He(t.line.text.charAt(i.coverStart+X));)++X;if(K&&B<9&&W==0&&X==i.coverEnd-i.coverStart?te=k.parentNode.getBoundingClientRect():te=js(v(k,W,X).getClientRects(),r),te.left||te.right||W==0)break;X=W,W=W-1,Q="right"}K&&B<11&&(te=Hs(e.display.measure,te))}else{W>0&&(Q=r="right");var Te;e.options.lineWrapping&&(Te=k.getClientRects()).length>1?te=Te[r=="right"?Te.length-1:0]:te=k.getBoundingClientRect()}if(K&&B<9&&!W&&(!te||!te.left&&!te.right)){var Ne=k.parentNode.getClientRects()[0];Ne?te={left:Ne.left,right:Ne.left+qn(e.display),top:Ne.top,bottom:Ne.bottom}:te=ro}for(var _e=te.top-t.rect.top,Je=te.bottom-t.rect.top,et=(_e+Je)/2,it=t.view.measure.heights,dt=0;dt<it.length-1&&!(et<it[dt]);dt++);var gt=dt?it[dt-1]:0,ct=it[dt],bt={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:gt,bottom:ct};return!te.left&&!te.right&&(bt.bogus=!0),e.options.singleCursorHeightPerLine||(bt.rtop=_e,bt.rbottom=Je),bt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!kt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(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 ao(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function yi(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return E&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return E&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=vi(e.widgets[n]));return t}function Hi(e,t,n,r,i){if(!i){var k=pa(t);n.top+=k,n.bottom+=k}if(r=="line")return n;r||(r="local");var W=cn(t);if(r=="local"?W+=Wi(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();W+=X.top+(r=="window"?0:so());var Q=X.left+(r=="window"?0:oo());n.left+=Q,n.right+=Q}return n.top+=W,n.bottom+=W,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var k=e.display.sizer.getBoundingClientRect();r+=k.left,i+=k.top}var W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:i-W.top}}function ma(e,t,n,r,i){return r||(r=ft(e.doc,t.line)),Hi(e,r,to(e,r,t.ch,i),n)}function xn(e,t,n,r,i,k){r=r||ft(e.doc,t.line),i||(i=Jn(e,r));function W(Je,et){var it=wn(e,i,Je,et?"right":"left",k);return et?it.left=it.right:it.right=it.left,Hi(e,r,it,n)}var X=Ve(r,e.doc.direction),Q=t.ch,te=t.sticky;if(Q>=r.text.length?(Q=r.text.length,te="before"):Q<=0&&(Q=0,te="after"),!X)return W(te=="before"?Q-1:Q,te=="before");function be(Je,et,it){var dt=X[et],gt=dt.level==1;return W(it?Je-1:Je,gt!=it)}var Te=je(X,Q,te),Ne=Fe,_e=be(Q,Te,te=="before");return Ne!=null&&(_e.other=be(Q,Ne,te!="before")),_e}function uo(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=qn(e.display)*t.ch);var r=ft(e.doc,t.line),i=cn(r)+Wi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var k=qe(e,t,n);return k.xRel=i,r&&(k.outside=r),k}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=yr(r,n),k=r.first+r.size-1;if(i>k)return ga(r.first+r.size-1,ft(r,k).text.length,null,1,1);t<0&&(t=0);for(var W=ft(r,i);;){var X=Ks(e,W,i,t,n),Q=Vr(W,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var te=Q.find(1);if(te.line==i)return te;W=ft(r,i=te.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,k=rt(function(W){return wn(e,n,W-1).bottom<=r},i,0);return i=rt(function(W){return wn(e,n,W).top>r},k,i),{begin:k,end:i}}function ho(e,t,n,r){n||(n=Jn(e,t));var i=Hi(e,t,wn(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=cn(t);var k=Jn(e,t),W=pa(t),X=0,Q=t.text.length,te=!0,be=Ve(t,e.doc.direction);if(be){var Te=(e.options.lineWrapping?zs:Gs)(e,t,n,k,be,r,i);te=Te.level!=1,X=te?Te.from:Te.to-1,Q=te?Te.to:Te.from-1}var Ne=null,_e=null,Je=rt(function(Rt){var At=wn(e,k,Rt);return At.top+=W,At.bottom+=W,ya(At,r,i,!1)?(At.top<=i&&At.left<=r&&(Ne=Rt,_e=At),!0):!1},X,Q),et,it,dt=!1;if(_e){var gt=r-_e.left<_e.right-r,ct=gt==te;Je=Ne+(ct?0:1),it=ct?"after":"before",et=gt?_e.left:_e.right}else{!te&&(Je==Q||Je==X)&&Je++,it=Je==0?"after":Je==t.text.length?"before":wn(e,k,Je-(te?1:0)).bottom+W<=i==te?"after":"before";var bt=xn(e,qe(n,Je,it),"line",t,k);et=bt.left,dt=i<bt.top?-1:i>=bt.bottom?1:0}return Je=Be(t.text,Je,1),ga(n,Je,it,dt,r-et)}function Gs(e,t,n,r,i,k,W){var X=rt(function(Te){var Ne=i[Te],_e=Ne.level!=1;return ya(xn(e,qe(n,_e?Ne.to:Ne.from,_e?"before":"after"),"line",t,r),k,W,!0)},0,i.length-1),Q=i[X];if(X>0){var te=Q.level!=1,be=xn(e,qe(n,te?Q.from:Q.to,te?"after":"before"),"line",t,r);ya(be,k,W,!0)&&be.top>W&&(Q=i[X-1])}return Q}function zs(e,t,n,r,i,k,W){var X=co(e,t,r,W),Q=X.begin,te=X.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var be=null,Te=null,Ne=0;Ne<i.length;Ne++){var _e=i[Ne];if(_e.from>=te||_e.to<=Q)continue;var Je=_e.level!=1,et=wn(e,r,Je?Math.min(te,_e.to)-1:Math.max(Q,_e.from)).right,it=et<k?k-et+1e9:et-k;(!be||Te>it)&&(be=_e,Te=it)}return be||(be=i[i.length-1]),be.from<Q&&(be={from:Q,to:be.to,level:be.level}),be.to>te&&(be={from:be.from,to:te,level:be.level}),be}var Hn;function Qn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Hn==null){Hn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(a("br"));Hn.appendChild(document.createTextNode("x"))}s(e.measure,Hn);var n=Hn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,k=t.gutters.firstChild,W=0;k;k=k.nextSibling,++W){var X=e.display.gutterSpecs[W].className;n[X]=k.offsetLeft+k.clientLeft+i,r[X]=k.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Qn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/qn(e.display)-3);return function(i){if(En(e.doc,i))return 0;var k=0;if(i.widgets)for(var W=0;W<i.widgets.length;W++)i.widgets[W].height&&(k+=i.widgets[W].height);return n?k+(Math.ceil(i.text.length/r)||1)*t:k+t}}function xa(e){var t=e.doc,n=fo(e);t.iter(function(r){var i=n(r);i!=r.height&&gr(r,i)})}function Kn(e,t,n,r){var i=e.display;if(!n&&we(t).getAttribute("cm-not-content")=="true")return null;var k,W,X=i.lineSpace.getBoundingClientRect();try{k=t.clientX-X.left,W=t.clientY-X.top}catch(Te){return null}var Q=va(e,k,W),te;if(r&&Q.xRel>0&&(te=ft(e.doc,Q.line).text).length==Q.ch){var be=$(te,te.length,e.options.tabSize)-te.length;Q=qe(Q.line,Math.max(0,Math.round((k-qa(e.display).left)/qn(e.display))-be))}return Q}function Gn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function rn(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)ir&&un(e.doc,t)<i.viewTo&&Pn(e);else if(n<=i.viewFrom)ir&&dn(e.doc,n+r)>i.viewFrom?Pn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Pn(e);else if(t<=i.viewFrom){var k=Ki(e,n,n+r,1);k?(i.view=i.view.slice(k.index),i.viewFrom=k.lineN,i.viewTo+=r):Pn(e)}else if(n>=i.viewTo){var W=Ki(e,t,t,-1);W?(i.view=i.view.slice(0,W.index),i.viewTo=W.lineN):Pn(e)}else{var X=Ki(e,t,t,-1),Q=Ki(e,n,n+r,1);X&&Q?(i.view=i.view.slice(0,X.index).concat(tn(e,X.lineN,Q.lineN)).concat(i.view.slice(Q.index)),i.viewTo+=r):Pn(e)}var te=i.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(i.externalMeasured=null))}function _n(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var k=r.view[Gn(e,t)];if(k.node==null)return;var W=k.changes||(k.changes=[]);pe(W,n)==-1&&W.push(n)}function Pn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,n,r){var i=Gn(e,t),k,W=e.display.view;if(!ir||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var X=e.display.viewFrom,Q=0;Q<i;Q++)X+=W[Q].size;if(X!=t){if(r>0){if(i==W.length-1)return null;k=X+W[i].size-t,i++}else k=X-t;t+=k,n+=k}for(;un(e.doc,n)!=n;){if(i==(r<0?0:W.length-1))return null;n+=r*W[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=tn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=tn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Gn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(tn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Gn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function bi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),k=r.selection=document.createDocumentFragment(),W=0;W<n.sel.ranges.length;W++){if(!t&&W==n.sel.primIndex)continue;var X=n.sel.ranges[W];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Q=X.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,X.head,i),Q||Xs(e,X,k)}return r}function go(e,t,n){var r=xn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var k=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=r.other.left+"px",k.style.top=r.other.top+"px",k.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,k=document.createDocumentFragment(),W=qa(e.display),X=W.left,Q=Math.max(r.sizerWidth,Wn(e)-r.sizer.offsetLeft)-W.right,te=i.direction=="ltr";function be(ct,bt,Rt,At){bt<0&&(bt=0),bt=Math.round(bt),At=Math.round(At),k.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ct+`px;
top: `+bt+"px; width: "+(Rt==null?Q-ct:Rt)+`px;
height: `+(At-bt)+"px"))}function Te(ct,bt,Rt){var At=ft(i,ct),Wt=At.text.length,fr,Br;function Sr(Or,on){return ma(e,qe(ct,Or),"div",At,on)}function fn(Or,on,Gr){var Mr=ho(e,At,null,Or),Rr=on=="ltr"==(Gr=="after")?"left":"right",kr=Gr=="after"?Mr.begin:Mr.end-(/\s/.test(At.text.charAt(Mr.end-1))?2:1);return Sr(kr,Rr)[Rr]}var an=Ve(At,i.direction);return Oe(an,bt||0,Rt==null?Wt:Rt,function(Or,on,Gr,Mr){var Rr=Gr=="ltr",kr=Sr(Or,Rr?"left":"right"),sn=Sr(on-1,Rr?"right":"left"),hi=bt==null&&Or==0,Bn=Rt==null&&on==Wt,$r=Mr==0,An=!an||Mr==an.length-1;if(sn.top-kr.top<=3){var jr=(te?hi:Bn)&&$r,Va=(te?Bn:hi)&&An,On=jr?X:(Rr?kr:sn).left,$n=Va?Q:(Rr?sn:kr).right;be(On,kr.top,$n-On,kr.bottom)}else{var Zn,Qr,fi,Xa;Rr?(Zn=te&&hi&&$r?X:kr.left,Qr=te?Q:fn(Or,Gr,"before"),fi=te?X:fn(on,Gr,"after"),Xa=te&&Bn&&An?Q:sn.right):(Zn=te?fn(Or,Gr,"before"):X,Qr=!te&&hi&&$r?Q:kr.right,fi=!te&&Bn&&An?X:sn.left,Xa=te?fn(on,Gr,"after"):Q),be(Zn,kr.top,Qr-Zn,kr.bottom),kr.bottom<sn.top&&be(X,kr.bottom,null,sn.top),be(fi,sn.top,Xa-fi,sn.bottom)}(!fr||Gi(kr,fr)<0)&&(fr=kr),Gi(sn,fr)<0&&(fr=sn),(!Br||Gi(kr,Br)<0)&&(Br=kr),Gi(sn,Br)<0&&(Br=sn)}),{start:fr,end:Br}}var Ne=t.from(),_e=t.to();if(Ne.line==_e.line)Te(Ne.line,Ne.ch,_e.ch);else{var Je=ft(i,Ne.line),et=ft(i,_e.line),it=Lr(Je)==Lr(et),dt=Te(Ne.line,Ne.ch,it?Je.text.length+1:null).end,gt=Te(_e.line,it?0:null,_e.ch).start;it&&(dt.top<gt.top-2?(be(dt.right,dt.top,null,dt.bottom),be(X,gt.top,gt.left,gt.bottom)):be(dt.right,dt.top,gt.left-dt.right,dt.bottom)),dt.bottom<gt.top&&be(X,dt.bottom,null,gt.top)}n.appendChild(k)}function Ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||ei(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ei(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Pe(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function ei(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Pe(e,"blur",e,t),e.state.focused=!1,u(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function zi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],k=e.options.lineWrapping,W=void 0,X=0;if(i.hidden)continue;if(K&&B<8){var Q=i.node.offsetTop+i.node.offsetHeight;W=Q-n,n=Q}else{var te=i.node.getBoundingClientRect();W=te.bottom-te.top,!k&&i.text.firstChild&&(X=i.text.firstChild.getBoundingClientRect().right-te.left-1)}var be=i.line.height-W;if((be>.005||be<-.005)&&(gr(i.line,W),bo(i.line),i.rest))for(var Te=0;Te<i.rest.length;Te++)bo(i.rest[Te]);if(X>e.display.sizerWidth){var Ne=Math.ceil(X/qn(e.display));Ne>e.display.maxLineLength&&(e.display.maxLineLength=Ne,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Vi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Wi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,k=yr(t,r),W=yr(t,i);if(n&&n.ensure){var X=n.ensure.from.line,Q=n.ensure.to.line;X<k?(k=X,W=yr(t,cn(ft(t,X))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=W&&(k=yr(t,cn(ft(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:k,to:Math.max(W,k+1)}}function Ys(e,t){if(We(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var k=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Wi(e.display))+`px;
height: `+(t.bottom-t.top+Tn(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(i),e.display.lineSpace.removeChild(k)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?qe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?qe(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var W=!1,X=xn(e,t),Q=!n||n==t?X:xn(e,n);i={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-r,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+r};var te=Ta(e,i),be=e.doc.scrollTop,Te=e.doc.scrollLeft;if(te.scrollTop!=null&&(xi(e,te.scrollTop),Math.abs(e.doc.scrollTop-be)>1&&(W=!0)),te.scrollLeft!=null&&(zn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Te)>1&&(W=!0)),!W)break}return i}function Zs(e,t){var n=Ta(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&zn(e,n.scrollLeft)}function Ta(e,t){var n=e.display,r=Qn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,k=ha(e),W={};t.bottom-t.top>k&&(t.bottom=t.top+k);var X=e.doc.height+ca(n),Q=t.top<r,te=t.bottom>X-r;if(t.top<i)W.scrollTop=Q?0:t.top;else if(t.bottom>i+k){var be=Math.min(t.top,(te?X:t.bottom)-k);be!=i&&(W.scrollTop=be)}var Te=e.options.fixedGutter?0:n.gutters.offsetWidth,Ne=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-Te,_e=Wn(e)-n.gutters.offsetWidth,Je=t.right-t.left>_e;return Je&&(t.right=t.left+_e),t.left<10?W.scrollLeft=0:t.left<Ne?W.scrollLeft=Math.max(0,t.left+Te-(Je?0:10)):t.right>_e+Ne-3&&(W.scrollLeft=t.right+(Je?0:10)-_e),W}function wa(e,t){if(t==null)return;Xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ti(e){Xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ei(e,t,n){(t!=null||n!=null)&&Xi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Xi(e),e.curOp.scrollToPos=t}function Xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=Ta(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ei(e,i.scrollLeft,i.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||La(e,{top:t}),xo(e,t,!0),O&&La(e),Ti(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function zn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ci(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Tn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Vn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Re(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Re(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Vn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(n?r: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&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Vn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Vn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Vn.prototype.zeroWidthHack=function(){var e=l&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new re,this.disableVert=new re},Vn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),k=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Vn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Si=function(){};Si.prototype.update=function(){return{bottom:0,right:0}},Si.prototype.setScrollLeft=function(){},Si.prototype.setScrollTop=function(){},Si.prototype.clear=function(){};function ri(e,t){t||(t=Ci(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&zi(e),Co(e,Ci(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:Vn,null:Si};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&u(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Re(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?zn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Xn(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:++Qs},bn(e.curOp)}function Yn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var k=0;k<t.length;k++)nl(t[k]);for(var W=0;W<t.length;W++)il(t[W])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&zi(t),e.barMeasure=Ci(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Tn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Wn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&zn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ri(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&zn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,c(r,e.scrollToPos.from),c(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var k=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(k)for(var X=0;X<k.length;++X)k[X].lines.length||Pe(k[X],"hide");if(W)for(var Q=0;Q<W.length;++Q)W[Q].lines.length&&Pe(W[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function hn(e,t){if(e.curOp)return t();Xn(e);try{return t()}finally{Yn(e)}}function Fr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xn(e);try{return t.apply(e,arguments)}finally{Yn(e)}}}function Jr(e){return function(){if(this.curOp)return e.apply(this,arguments);Xn(this);try{return e.apply(this,arguments)}finally{Yn(this)}}}function Ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Xn(t);try{return e.apply(this,arguments)}finally{Yn(t)}}}function Ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(r.line>=e.display.viewFrom){var W=k.styles,X=k.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,Q=Ce(e,k,r,!0);X&&(r.state=X),k.styles=Q.styles;var te=k.styleClasses,be=Q.classes;be?k.styleClasses=be:te&&(k.styleClasses=null);for(var Te=!W||W.length!=k.styles.length||te!=be&&(!te||!be||te.bgClass!=be.bgClass||te.textClass!=be.textClass),Ne=0;!Te&&Ne<W.length;++Ne)Te=W[Ne]!=k.styles[Ne];Te&&i.push(r.line),k.stateAfter=r.save(),r.nextLine()}else k.text.length<=e.options.maxHighlightLength&&lt(e,k.text,r),k.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Ti(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&hn(e,function(){for(var k=0;k<i.length;k++)_n(e,i[k],"text")})}var Yi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Vi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Wn(e),this.force=n,this.dims=ba(e),this.events=[]};Yi.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},Yi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Pe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Tn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Tn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!C(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&C(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&C(document.body,e.anchorNode)&&C(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Pn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Lo(e)&&(Pn(e),t.dims=ba(e));var i=r.first+r.size,k=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<k&&k-n.viewFrom<20&&(k=Math.max(r.first,n.viewFrom)),n.viewTo>W&&n.viewTo-W<20&&(W=Math.min(i,n.viewTo)),ir&&(k=un(e.doc,k),W=dn(e.doc,W));var X=k!=n.viewFrom||W!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,k,W),n.viewOffset=cn(ft(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=po(e);if(!X&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,X&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ti(e,400)),n.updateLineNumbers=null,!0}function wo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Wn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-ha(e),n.top)}),t.visible=Vi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vi(e.display,e.doc,n));if(!Aa(e,t))break;zi(e);var i=Ci(e);bi(e),ri(e,i),Da(e,i),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 La(e,t){var n=new Yi(e,t);if(Aa(e,n)){zi(e),wo(e,n);var r=Ci(e);bi(e),ri(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,k=r.lineDiv,W=k.firstChild;function X(Je){var et=Je.nextSibling;return M&&l&&e.display.currentWheelTarget==Je?Je.style.display="none":Je.parentNode.removeChild(Je),et}for(var Q=r.view,te=r.viewFrom,be=0;be<Q.length;be++){var Te=Q[be];if(!Te.hidden)if(!Te.node||Te.node.parentNode!=k){var Ne=Ns(e,Te,te,n);k.insertBefore(Ne,W)}else{for(;W!=Te.node;)W=X(W);var _e=i&&t!=null&&t<=te&&Te.lineNumber;Te.changes&&(pe(Te.changes,"gutter")>-1&&(_e=!1),Ya(e,Te,te,n)),_e&&(f(Te.lineNumber),Te.lineNumber.appendChild(document.createTextNode(qr(e.options,te)))),W=Te.node.nextSibling}te+=Te.size}for(;W;)W=X(W)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+Tn(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,k=r+"px",W=0;W<n.length;W++)if(!n[W].hidden){e.options.fixedGutter&&(n[W].gutter&&(n[W].gutter.style.left=k),n[W].gutterBackground&&(n[W].gutterBackground.style.left=k));var X=n[W].alignable;if(X)for(var Q=0;Q<X.length;Q++)X[Q].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=qr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=i.firstChild.offsetWidth,W=i.offsetWidth-k;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(k,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var k=e[i],W=null;if(typeof k!="string"&&(W=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:k,style:W})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ko(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],k=i.className,W=i.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+k));W&&(X.style.cssText=W),k=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ka(e)}function wi(e){ko(e.display),rn(e),Ao(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=T("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=T("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var k=T("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[k],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ve+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),K&&B<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!M&&!(O&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),ko(i),n.init(i)}var $i=0,gn=null;K?gn=-.53:O?gn=15:E?gn=-.7:_&&(gn=-1/3);function Do(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Do(e);return t.x*=gn,t.y*=gn,t}function Oo(e,t){var n=Do(t),r=n.x,i=n.y,k=e.display,W=k.scroller,X=W.scrollWidth>W.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&X||i&&Q))return;if(i&&l&&M){e:for(var te=t.target,be=k.view;te!=W;te=te.parentNode)for(var Te=0;Te<be.length;Te++)if(be[Te].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!O&&!L&&gn!=null){i&&Q&&xi(e,Math.max(0,W.scrollTop+i*gn)),zn(e,Math.max(0,W.scrollLeft+r*gn)),(!i||i&&Q)&&le(t),k.wheelStartX=null;return}if(i&&gn!=null){var Ne=i*gn,_e=e.doc.scrollTop,Je=_e+k.wrapper.clientHeight;Ne<0?_e=Math.max(0,_e+Ne-50):Je=Math.min(e.doc.height,Je+Ne+50),La(e,{top:_e,bottom:Je})}$i<20&&(k.wheelStartX==null?(k.wheelStartX=W.scrollLeft,k.wheelStartY=W.scrollTop,k.wheelDX=r,k.wheelDY=i,setTimeout(function(){if(k.wheelStartX==null)return;var et=W.scrollLeft-k.wheelStartX,it=W.scrollTop-k.wheelStartY,dt=it&&k.wheelDY&&it/k.wheelDY||et&&k.wheelDX&&et/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!dt)return;gn=(gn*$i+dt)/($i+1),++$i},200)):(k.wheelDX+=r,k.wheelDY+=i))}var vn=function(e,t){this.ranges=e,this.primIndex=t};vn.prototype.primary=function(){return this.ranges[this.primIndex]},vn.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 n=this.ranges[t],r=e.ranges[t];if(!zr(n.anchor,r.anchor)||!zr(n.head,r.head))return!1}return!0},vn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new er(Ir(this.ranges[t].anchor),Ir(this.ranges[t].head));return new vn(e,this.primIndex)},vn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(wt(t,r.from())>=0&&wt(e,r.to())<=0)return n}return-1};var er=function(e,t){this.anchor=e,this.head=t};er.prototype.from=function(){return Wr(this.anchor,this.head)},er.prototype.to=function(){return Zr(this.anchor,this.head)},er.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Cn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Ne,_e){return wt(Ne.from(),_e.from())}),n=pe(t,i);for(var k=1;k<t.length;k++){var W=t[k],X=t[k-1],Q=wt(X.to(),W.from());if(r&&!W.empty()?Q>0:Q>=0){var te=Wr(X.from(),W.from()),be=Zr(X.to(),W.to()),Te=X.empty()?W.from()==W.head:X.from()==X.head;k<=n&&--n,t.splice(--k,2,new er(Te?be:te,Te?te:be))}}return new vn(t,n)}function Mn(e,t){return new vn([new er(e,t||e)],0)}function In(e){return e.text?qe(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(wt(e,t.from)<0)return e;if(wt(e,t.to)<=0)return In(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=In(t).ch-t.to.ch),qe(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new er(Ro(i.anchor,t),Ro(i.head,t)))}return Cn(e.cm,n,e.sel.primIndex)}function _o(e,t,n){return e.line==t.line?qe(n.line,e.ch-t.ch+n.ch):qe(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],i=qe(e.first,0),k=i,W=0;W<t.length;W++){var X=t[W],Q=_o(X.from,i,k),te=_o(In(X),i,k);if(i=X.to,k=te,n=="around"){var be=e.sel.ranges[W],Te=wt(be.head,be.anchor)<0;r[W]=new er(Te?te:Q,Te?Q:te)}else r[W]=new er(Q,Q)}return new vn(r,e.sel.primIndex)}function _a(e){e.doc.mode=pr(e.options,e.doc.modeOption),Ai(e)}function Ai(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,Ti(e,100),e.state.modeGen++,e.curOp&&rn(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(gt){return n?n[gt]:null}function k(gt,ct,bt){ua(gt,ct,bt,r),Kr(gt,"change",gt,t)}function W(gt,ct){for(var bt=[],Rt=gt;Rt<ct;++Rt)bt.push(new jn(te[Rt],i(Rt),r));return bt}var X=t.from,Q=t.to,te=t.text,be=ft(e,X.line),Te=ft(e,Q.line),Ne=J(te),_e=i(te.length-1),Je=Q.line-X.line;if(t.full)e.insert(0,W(0,te.length)),e.remove(te.length,e.size-te.length);else if(Po(e,t)){var et=W(0,te.length-1);k(Te,Te.text,_e),Je&&e.remove(X.line,Je),et.length&&e.insert(X.line,et)}else if(be==Te)if(te.length==1)k(be,be.text.slice(0,X.ch)+Ne+be.text.slice(Q.ch),_e);else{var it=W(1,te.length-1);it.push(new jn(Ne+be.text.slice(Q.ch),_e,r)),k(be,be.text.slice(0,X.ch)+te[0],i(0)),e.insert(X.line+1,it)}else if(te.length==1)k(be,be.text.slice(0,X.ch)+te[0]+Te.text.slice(Q.ch),i(0)),e.remove(X.line+1,Je);else{k(be,be.text.slice(0,X.ch)+te[0],i(0)),k(Te,Ne+Te.text.slice(Q.ch),_e);var dt=W(1,te.length-1);Je>1&&e.remove(X.line+1,Je-1),e.insert(X.line+1,dt)}Kr(e,"change",e,t)}function Nn(e,t,n){function r(i,k,W){if(i.linked)for(var X=0;X<i.linked.length;++X){var Q=i.linked[X];if(Q.doc==k)continue;var te=W&&Q.sharedHist;if(n&&!te)continue;t(Q.doc,te),r(Q.doc,i,te)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),_a(e),Io(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,rn(e)}function Io(e){(e.doc.direction=="rtl"?j:u)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){hn(e,function(){Io(e),rn(e)})}function Zi(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 Ma(e,t){var n={from:Ir(t.from),to:In(t),text:sr(e,t.from,t.to)};return Uo(e,n,t.from.line,t.to.line+1),Nn(e,function(r){return Uo(r,n,t.from.line,t.to.line+1)},!0),n}function No(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Fo(e,t,n,r){var i=e.history;i.undone.length=0;var k=+new Date,W,X;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(i,i.lastOp==r)))X=J(W.changes),wt(t.from,t.to)==0&&wt(t.from,X.to)==0?X.to=In(t):W.changes.push(Ma(e,t));else{var Q=J(i.done);for((!Q||!Q.ranges)&&Ji(e.sel,i.done),W={changes:[Ma(e,t)],generation:i.generation},i.done.push(W);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=k,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,X||Pe(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,k=r&&r.origin;n==i.lastSelOp||k&&i.lastSelOrigin==k&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==k||ml(e,k,J(i.done),t))?i.done[i.done.length-1]=t:Ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=k,i.lastSelOp=n,r&&r.clearRedo!==!1&&No(i.undone)}function Ji(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Uo(e,t,n,r){var i=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((i||(i=t["spans_"+e.id]={}))[k]=W.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=jt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var k=n[i],W=r[i];if(k&&W){e:for(var X=0;X<W.length;++X){for(var Q=W[X],te=0;te<k.length;++te)if(k[te].marker==Q.marker)continue e;k.push(Q)}}else W&&(n[i]=W)}return n}function ni(e,t,n){for(var r=[],i=0;i<e.length;++i){var k=e[i];if(k.ranges){r.push(n?vn.prototype.deepCopy.call(k):k);continue}var W=k.changes,X=[];r.push({changes:X});for(var Q=0;Q<W.length;++Q){var te=W[Q],be=void 0;if(X.push({from:te.from,to:te.to,text:te.text}),t)for(var Te in te)(be=Te.match(/^spans_(\d+)$/))&&(pe(t,Number(be[1]))>-1&&(J(X)[Te]=te[Te],delete te[Te]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var k=wt(t,i)<0;k!=wt(n,i)<0?(i=t,t=n):k!=wt(t,n)<0&&(t=n)}return new er(i,t)}else return new er(n||t,t)}function Qi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Yr(e,new vn([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)r[k]=Ia(e.sel.ranges[k],t[k],null,i);var W=Cn(e.cm,r,e.sel.primIndex);Yr(e,W,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Yr(e,Cn(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Yr(e,Mn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var k=0;k<i.length;k++)this.ranges[k]=new er(c(e,i[k].anchor),c(e,i[k].head))},origin:n&&n.origin};return Pe(e,"beforeSelectionChange",e,r),e.cm&&Pe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Cn(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,qi(e,t,n)):Yr(e,t,n)}function Yr(e,t,n){qi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qi(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(wt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&ti(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),Kr(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,k=0;k<t.ranges.length;k++){var W=t.ranges[k],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Q=ea(e,W.anchor,X&&X.anchor,n,r),te=ea(e,W.head,X&&X.head,n,r);(i||Q!=W.anchor||te!=W.head)&&(i||(i=t.ranges.slice(0,k)),i[k]=new er(Q,te))}return i?Cn(e.cm,i,t.primIndex):t}function ii(e,t,n,r,i){var k=ft(e,t.line);if(k.markedSpans)for(var W=0;W<k.markedSpans.length;++W){var X=k.markedSpans[W],Q=X.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,be="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((X.from==null||(te?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(be?X.to>=t.ch:X.to>t.ch))){if(i&&(Pe(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(k.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(n){var Te=Q.find(r<0?1:-1),Ne=void 0;if((r<0?be:te)&&(Te=Vo(e,Te,-r,Te&&Te.line==t.line?k:null)),Te&&Te.line==t.line&&(Ne=wt(Te,n))&&(r<0?Ne<0:Ne>0))return ii(e,Te,t,r,i)}var _e=Q.find(r<0?-1:1);return(r<0?te:be)&&(_e=Vo(e,_e,r,_e.line==t.line?k:null)),_e?ii(e,_e,t,r,i):null}}return t}function ea(e,t,n,r,i){var k=r||1,W=ii(e,t,n,k,i)||!i&&ii(e,t,n,k,!0)||ii(e,t,n,-k,i)||!i&&ii(e,t,n,-k,!0);return W||(e.cantEdit=!0,qe(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?c(e,qe(t.line-1)):null:n>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?qe(t.line+1,0):null:new qe(t.line,t.ch+n)}function Xo(e){e.setSelection(qe(e.firstLine(),0),qe(e.lastLine()),Le)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,k,W,X){i&&(r.from=c(e,i)),k&&(r.to=c(e,k)),W&&(r.text=W),X!==void 0&&(r.origin=X)}),Pe(e,"beforeChange",e,r),e.cm&&Pe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ai(e,t,n){if(e.cm){if(!e.cm.curOp)return Fr(e.cm,ai)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Nr&&!n&&ot(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&wt(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),Li(e,t,n,jt(e,t));var r=[];Nn(e,function(i,k){!k&&pe(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),Li(i,t,null,jt(i,t))})}function ta(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,k,W=e.sel,X=t=="undo"?i.done:i.undone,Q=t=="undo"?i.undone:i.done,te=0;te<X.length&&!(k=X[te],n?k.ranges&&!k.equals(e.sel):!k.ranges);te++);if(te==X.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(k=X.pop(),k.ranges){if(Ji(k,Q),n&&!k.equals(e.sel)){Yr(e,k,{clearRedo:!1});return}W=k}else if(r){X.push(k);return}else break;var be=[];Ji(W,Q),Q.push({changes:be,generation:i.generation}),i.generation=k.generation||++i.maxGeneration;for(var Te=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Ne=function(et){var it=k.changes[et];if(it.origin=t,Te&&!Yo(e,it,!1))return X.length=0,{};be.push(Ma(e,it));var dt=et?Ra(e,it):J(X);Li(e,it,dt,Bo(e,it)),!et&&e.cm&&e.cm.scrollIntoView({from:it.from,to:In(it)});var gt=[];Nn(e,function(ct,bt){!bt&&pe(gt,ct.history)==-1&&(qo(ct.history,it),gt.push(ct.history)),Li(ct,it,null,Bo(ct,it))})},_e=k.changes.length-1;_e>=0;--_e){var Je=Ne(_e);if(Je)return Je.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new vn(ee(e.sel.ranges,function(i){return new er(qe(i.anchor.line+t,i.anchor.ch),qe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){rn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)_n(e.cm,r,"gutter")}}function Li(e,t,n,r){if(e.cm&&!e.cm.curOp)return Fr(e.cm,Li)(e,t,n,r);if(t.to.line<e.first){Zo(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 i=t.text.length-1-(e.first-t.from.line);Zo(e,i),t={from:qe(e.first,0),to:qe(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:qe(k,ft(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=sr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),qi(e,n,Le),e.cantEdit&&ea(e,qe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,k=t.from,W=t.to,X=!1,Q=k.line;e.options.lineWrapping||(Q=Pt(Lr(ft(r,k.line))),r.iter(Q,W.line+1,function(_e){if(_e==i.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Se(e),Pa(r,t,n,fo(e)),e.options.lineWrapping||(r.iter(Q,k.line+t.text.length,function(_e){var Je=pi(_e);Je>i.maxLineLength&&(i.maxLine=_e,i.maxLineLength=Je,i.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),xr(r,k.line),Ti(e,400);var te=t.text.length-(W.line-k.line)-1;t.full?rn(e):k.line==W.line&&t.text.length==1&&!Po(e.doc,t)?_n(e,k.line,"text"):rn(e,k.line,W.line+1,te);var be=ye(e,"changes"),Te=ye(e,"change");if(Te||be){var Ne={from:k,to:W,text:t.text,removed:t.removed,origin:t.origin};Te&&Kr(e,"change",e,Ne),be&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ne)}e.display.selForContextMenu=null}function oi(e,t,n,r,i){var k;r||(r=n),wt(r,n)<0&&(k=[r,n],n=k[0],r=k[1]),typeof t=="string"&&(t=e.splitLines(t)),ai(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,n,r){for(var i=0;i<e.length;++i){var k=e[i],W=!0;if(k.ranges){k.copied||(k=e[i]=k.deepCopy(),k.copied=!0);for(var X=0;X<k.ranges.length;X++)Jo(k.ranges[X].anchor,t,n,r),Jo(k.ranges[X].head,t,n,r);continue}for(var Q=0;Q<k.changes.length;++Q){var te=k.changes[Q];if(n<te.from.line)te.from=qe(te.from.line+r,te.from.ch),te.to=qe(te.to.line+r,te.to.ch);else if(t<=te.to.line){W=!1;break}}W||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Qo(e.done,n,r,i),Qo(e.undone,n,r,i)}function ki(e,t,n,r){var i=t,k=t;return typeof t=="number"?k=ft(e,G(e,t)):i=Pt(t),i==null?null:(r(k,i)&&e.cm&&_n(e.cm,i,n),k)}function Di(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,St(i),Kr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Oi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Oi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var k=Math.min(t,i-e),W=r.height;if(r.removeInner(e,k),this.height-=W-r.height,i==k&&(this.children.splice(n--,1),r.parent=null),(t-=k)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var X=[];this.collapse(X),this.children=[new Di(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],k=i.chunkSize();if(e<=k){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var W=i.lines.length%25+25,X=W;X<i.lines.length;){var Q=new Di(i.lines.slice(X,X+=25));i.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}i.lines=i.lines.slice(0,W),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),n=new Oi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=pe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Oi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],k=i.chunkSize();if(e<k){var W=Math.min(t,k-e);if(i.iterN(e,W,n))return!0;if((t-=W)==0)break;e=0}else e-=k}}};var Ri=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Ri.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Pt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var k=vi(this);gr(n,Math.max(0,n.height-k)),e&&(hn(e,function(){es(e,n,-k),_n(e,r,"widget")}),Kr(e,"lineWidgetCleared",e,this,r))},Ri.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=vi(this)-t;if(!i)return;En(this.doc,r)||gr(r,r.height+i),n&&hn(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Kr(n,"lineWidgetChanged",n,e,Pt(r))})},xe(Ri);function es(e,t,n){cn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,n)}function xl(e,t,n,r){var i=new Ri(e,n,r),k=e.cm;return k&&i.noHScroll&&(k.display.alignWidgets=!0),ki(e,t,"widget",function(W){var X=W.widgets||(W.widgets=[]);if(i.insertAt==null?X.push(i):X.splice(Math.min(X.length-1,Math.max(0,i.insertAt)),0,i),i.line=W,k&&!En(e,W)){var Q=cn(W)<e.scrollTop;gr(W,W.height+vi(i)),Q&&wa(k,i.height),k.curOp.forceUpdate=!0}return!0}),k&&Kr(k,"lineWidgetAdded",k,i,typeof t=="number"?t:Pt(t)),i}var ts=0,Fn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Fn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Xn(e),ye(this,"clear")){var n=this.find();n&&Kr(this,"clear",n.from,n.to)}for(var r=null,i=null,k=0;k<this.lines.length;++k){var W=this.lines[k],X=ar(W.markedSpans,this);e&&!this.collapsed?_n(e,Pt(W),"text"):e&&(X.to!=null&&(i=Pt(W)),X.from!=null&&(r=Pt(W))),W.markedSpans=yn(W.markedSpans,X),X.from==null&&this.collapsed&&!En(this.doc,W)&&e&&gr(W,Qn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=Lr(this.lines[Q]),be=pi(te);be>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=be,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rn(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Kr(e,"markerCleared",e,this,r,i),t&&Yn(e),this.parent&&this.parent.clear()},Fn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var k=this.lines[i],W=ar(k.markedSpans,this);if(W.from!=null&&(n=qe(t?k:Pt(k),W.from),e==-1))return n;if(W.to!=null&&(r=qe(t?k:Pt(k),W.to),e==1))return r}return n&&{from:n,to:r}},Fn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;hn(r,function(){var i=t.line,k=Pt(t.line),W=fa(r,k);if(W&&(io(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!En(n.doc,i)&&n.height!=null){var X=n.height;n.height=null;var Q=vi(n)-X;Q&&gr(i,i.height+Q)}Kr(r,"markerChanged",r,e)})},Fn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||pe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Fn.prototype.detachLine=function(e){if(this.lines.splice(pe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(Fn);function si(e,t,n,r,i){if(r&&r.shared)return Cl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Fr(e.cm,si)(e,t,n,r,i);var k=new Fn(e,i),W=wt(t,n);if(r&&N(r,k,!1),W>0||W==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=T("span",[k.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(mr(e,t.line,t,n,k)||t.line!=n.line&&mr(e,n.line,t,n,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");wr()}k.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,te;if(e.iter(X,n.line+1,function(Te){Q&&k.collapsed&&!Q.options.lineWrapping&&Lr(Te)==Q.display.maxLine&&(te=!0),k.collapsed&&X!=t.line&&gr(Te,0),Ar(Te,new Hr(k,X==t.line?t.ch:null,X==n.line?n.ch:null)),++X}),k.collapsed&&e.iter(t.line,n.line+1,function(Te){En(e,Te)&&gr(Te,0)}),k.clearOnEnter&&Re(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Xt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++ts,k.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),k.collapsed)rn(Q,t.line,n.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var be=t.line;be<=n.line;be++)_n(Q,be,"text");k.atomic&&Go(Q.doc),Kr(Q,"markerAdded",Q,k)}return k}var _i=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};_i.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Kr(this,"clear")},_i.prototype.find=function(e,t){return this.primary.find(e,t)},xe(_i);function Cl(e,t,n,r,i){r=N(r),r.shared=!1;var k=[si(e,t,n,r,i)],W=k[0],X=r.widgetNode;return Nn(e,function(Q){X&&(r.widgetNode=X.cloneNode(!0)),k.push(si(Q,c(Q,t),c(Q,n),r,i));for(var te=0;te<Q.linked.length;++te)if(Q.linked[te].isParent)return;W=J(k)}),new _i(k,W)}function rs(e){return e.findMarks(qe(e.first,0),e.clipPos(qe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),k=e.clipPos(i.from),W=e.clipPos(i.to);if(wt(k,W)){var X=si(e,k,W,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],k=[i.primary.doc];Nn(i.primary.doc,function(Q){return k.push(Q)});for(var W=0;W<i.markers.length;W++){var X=i.markers[W];pe(k,X.doc)==-1&&(X.parent=null,i.markers.splice(W--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,nn=function(e,t,n,r,i){if(!(this instanceof nn))return new nn(e,t,n,r,i);n==null&&(n=0),Oi.call(this,[new Di([new jn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var k=qe(n,0);this.sel=Mn(k),this.history=new Zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:k,to:k,text:e}),Yr(this,Mn(k),Le)};nn.prototype=ke(Oi.prototype,{constructor:nn,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Tr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ur(function(e){var t=qe(this.first,0),n=this.first+this.size-1;ai(this,{from:t,to:qe(n,ft(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ei(this.cm,0,0),Yr(this,Mn(t),Le)}),replaceRange:function(e,t,n,r){t=c(this,t),n=n?c(this,n):t,oi(this,e,t,n,r)},getRange:function(e,t,n){var r=sr(this,c(this,e),c(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(dr(this,e))return ft(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),Lr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return c(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ur(function(e,t,n){Wo(this,c(this,typeof e=="number"?qe(e,t||0):e),null,n)}),setSelection:Ur(function(e,t,n){Wo(this,c(this,e),c(this,t||e),n)}),extendSelection:Ur(function(e,t,n){Qi(this,c(this,e),t&&c(this,t),n)}),extendSelections:Ur(function(e,t){jo(this,F(this,e),t)}),extendSelectionsBy:Ur(function(e,t){var n=ee(this.sel.ranges,e);jo(this,F(this,n),t)}),setSelections:Ur(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new er(c(this,e[i].anchor),c(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Yr(this,Cn(this.cm,r,t),n)}),addSelection:Ur(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new er(c(this,e),c(this,t||e))),Yr(this,Cn(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=sr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=sr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Ur(function(e,t,n){for(var r=[],i=this.sel,k=0;k<i.ranges.length;k++){var W=i.ranges[k];r[k]={from:W.from(),to:W.to(),text:this.splitLines(e[k]),origin:n}}for(var X=t&&t!="end"&&hl(this,r,t),Q=r.length-1;Q>=0;Q--)ai(this,r[Q]);X?Ho(this,X):this.cm&&ti(this.cm)}),undo:Ur(function(){ta(this,"undo")}),redo:Ur(function(){ta(this,"redo")}),undoSelection:Ur(function(){ta(this,"undo",!0)}),redoSelection:Ur(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Zi(this.history.maxGeneration),Nn(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:ni(this.history.done),undone:ni(this.history.undone)}},setHistory:function(e){var t=this.history=new Zi(this.history.maxGeneration);t.done=ni(e.done.slice(0),null,!0),t.undone=ni(e.undone.slice(0),null,!0)},setGutterMarker:Ur(function(e,t,n){return ki(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ue(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ur(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&ki(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ue(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!dr(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=Pt(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:Ur(function(e,t,n){return ki(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Ur(function(e,t,n){return ki(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=r[i];if(k)if(n==null)r[i]=null;else{var W=k.match(b(n));if(!W)return!1;var X=W.index+W[0].length;r[i]=k.slice(0,W.index)+(!W.index||X==k.length?"":" ")+k.slice(X)||null}else return!1;return!0})}),addLineWidget:Ur(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return si(this,c(this,e),c(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=c(this,e),si(this,e,e,n,"bookmark")},findMarksAt:function(e){e=c(this,e);var t=[],n=ft(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=c(this,e),t=c(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(k){var W=k.markedSpans;if(W)for(var X=0;X<W.length;X++){var Q=W[X];!(Q.to!=null&&i==e.line&&e.ch>=Q.to||Q.from==null&&i!=e.line||Q.from!=null&&i==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var k=i.text.length+r;if(k>e)return t=e,!0;e-=k,++n}),c(this,qe(n,t))},indexFromPos:function(e){e=c(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new nn(Tr(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,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new nn(Tr(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Er&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Nn(e,function(i){return r.push(i.id)},!0),e.history=new Zi(null),e.history.done=ni(this.history.done,r),e.history.undone=ni(this.history.undone,r)}},iterLinkedDocs:function(e){Nn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ct(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Ur(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)})}),nn.prototype.eachLine=nn.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),We(t,e)||kn(t.display,e))return;le(e),K&&(ns=+new Date);var n=Kn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,k=Array(i),W=0,X=function(){++W==i&&Fr(t,function(){n=c(t.doc,n);var _e={from:n,to:n,text:t.doc.splitLines(k.filter(function(Je){return Je!=null}).join(t.doc.lineSeparator())),origin:"paste"};ai(t.doc,_e),Ho(t.doc,Mn(c(t.doc,n),c(t.doc,In(_e))))})()},Q=function(_e,Je){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,_e.type)==-1){X();return}var et=new FileReader;et.onerror=function(){return X()},et.onload=function(){var it=et.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(it)){X();return}k[Je]=it,X()},et.readAsText(_e)},te=0;te<r.length;te++)Q(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var be=e.dataTransfer.getData("Text");if(be){var Te;if(t.state.draggingText&&!t.state.draggingText.copy&&(Te=t.listSelections()),qi(t.doc,Mn(n,n)),Te)for(var Ne=0;Ne<Te.length;++Ne)oi(t.doc,"",Te[Ne].anchor,Te[Ne].head,"drag");t.replaceSelection(be,"around","paste"),t.display.input.focus()}}catch(_e){}}}function Ll(e,t){if(K&&(!e.state.draggingText||+new Date-ns<100)){Ee(t);return}if(We(e,t)||kn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",L&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),L&&n.parentNode.removeChild(n)}}function kl(e,t){var n=Kn(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var k=0;k<n.length;k++)e(n[k])})}var os=!1;function Dl(){if(os)return;Ol(),os=!0}function Ol(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Re(window,"blur",function(){return as(ei)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Un={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"},Pi=0;Pi<10;Pi++)Un[Pi+48]=Un[Pi+96]=String(Pi);for(var ra=65;ra<=90;ra++)Un[ra]=String.fromCharCode(ra);for(var Mi=1;Mi<=12;Mi++)Un[Mi+111]=Un[Mi+63235]="F"+Mi;var Dn={};Dn.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"},Dn.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"},Dn.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"},Dn.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"]},Dn.default=l?Dn.macDefault:Dn.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,k,W=0;W<t.length-1;W++){var X=t[W];if(/^(cmd|meta|m)$/i.test(X))k=!0;else if(/^a(lt)?$/i.test(X))n=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))i=!0;else throw new Error("Unrecognized modifier name: "+X)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ee(n.split(" "),_l),k=0;k<i.length;k++){var W=void 0,X=void 0;k==i.length-1?(X=i.join(" "),W=r):(X=i.slice(0,k+1).join(" "),W="...");var Q=t[X];if(!Q)t[X]=W;else if(Q!=W)throw new Error("Inconsistent bindings for "+X)}delete e[n]}for(var te in t)e[te]=t[te];return e}function li(e,t,n,r){t=na(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return li(e,t.fallthrough,n,r);for(var k=0;k<t.fallthrough.length;k++){var W=li(e,t.fallthrough[k],n,r);if(W)return W}}}function ss(e){var t=typeof e=="string"?e:Un[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(L&&e.keyCode==34&&e.char)return!1;var n=Un[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function na(e){return typeof e=="string"?Dn[e]:e}function ui(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var k=t(n[i]);r.length&&wt(k.from,J(r).to)<=0;){var W=r.pop();if(wt(W.from,k.from)<0){k.from=W.from;break}}r.push(k)}hn(e,function(){for(var X=r.length-1;X>=0;X--)oi(e.doc,"",r[X].from,r[X].to,"+delete");ti(e)})}function Fa(e,t,n){var r=Be(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new qe(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var k=Ve(n,t.doc.direction);if(k){var W=i<0?J(k):k[0],X=i<0==(W.level==1),Q=X?"after":"before",te;if(W.level>0||t.doc.direction=="rtl"){var be=Jn(t,n);te=i<0?n.text.length-1:0;var Te=wn(t,be,te).top;te=rt(function(Ne){return wn(t,be,Ne).top==Te},i<0==(W.level==1)?W.from:W.to-1,te),Q=="before"&&(te=Fa(n,te,1))}else te=i<0?W.to:W.from;return new qe(r,te,Q)}}return new qe(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Ve(t,e.doc.direction);if(!i)return Ua(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var k=je(i,n.ch,n.sticky),W=i[k];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>n.ch:W.from<n.ch))return Ua(t,n,r);var X=function(dt,gt){return Fa(t,dt instanceof qe?dt.ch:dt,gt)},Q,te=function(dt){return e.options.lineWrapping?(Q=Q||Jn(e,t),ho(e,t,Q,dt)):{begin:0,end:t.text.length}},be=te(n.sticky=="before"?X(n,-1):n.ch);if(e.doc.direction=="rtl"||W.level==1){var Te=W.level==1==r<0,Ne=X(n,Te?1:-1);if(Ne!=null&&(Te?Ne<=W.to&&Ne<=be.end:Ne>=W.from&&Ne>=be.begin)){var _e=Te?"before":"after";return new qe(n.line,Ne,_e)}}var Je=function(dt,gt,ct){for(var bt=function(fr,Br){return Br?new qe(n.line,X(fr,1),"before"):new qe(n.line,fr,"after")};dt>=0&&dt<i.length;dt+=gt){var Rt=i[dt],At=gt>0==(Rt.level!=1),Wt=At?ct.begin:X(ct.end,-1);if(Rt.from<=Wt&&Wt<Rt.to)return bt(Wt,At);if(Wt=At?Rt.from:X(Rt.to,-1),ct.begin<=Wt&&Wt<ct.end)return bt(Wt,At)}},et=Je(k+r,r,be);if(et)return et;var it=r>0?be.end:X(be.begin,-1);return it!=null&&!(r>0&&it==t.text.length)&&(et=Je(r>0?0:i.length-1,r,te(it)),et)?et:null}var Ii={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Le)},killLine:function(e){return ui(e,function(t){if(t.empty()){var n=ft(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:qe(t.head.line+1,0)}:{from:t.head,to:qe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ui(e,function(t){return{from:qe(t.from().line,0),to:c(e.doc,qe(t.to().line+1,0))}})},delLineLeft:function(e){return ui(e,function(t){return{from:qe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ui(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ui(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},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(qe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(qe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(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 n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ae)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},ae)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},ae)},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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var k=n[i].from(),W=$(e.getLine(k.line),k.ch,r);t.push(se(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return hn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,k=ft(e.doc,i.line).text;if(k){if(i.ch==k.length&&(i=new qe(i.line,i.ch-1)),i.ch>0)i=new qe(i.line,i.ch+1),e.replaceRange(k.charAt(i.ch-1)+k.charAt(i.ch-2),qe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var W=ft(e.doc,i.line-1).text;W&&(i=new qe(i.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),qe(i.line-1,W.length-1),i,"+transpose"))}}n.push(new er(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return hn(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);ti(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=ft(e.doc,t),r=Lr(n);return r!=n&&(t=Pt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=ft(e.doc,t),r=ln(n);return r!=n&&(t=Pt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=ft(e.doc,n.line),i=Ve(r,e.doc.direction);if(!i||i[0].level==0){var k=Math.max(n.ch,r.text.search(/\S/)),W=t.line==n.line&&t.ch<=k&&t.ch;return qe(n.line,W?0:k,n.sticky)}return n}function ia(e,t,n){if(typeof t=="string"&&(t=Ii[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ae}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=li(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&li(t,e.options.extraKeys,n,e)||li(t,e.options.keyMap,n,e)}var Fl=new re;function Ni(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),hs(e,i+" "+t,n,r))return!0}return hs(e,t,n,r)}function hs(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Kr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(le(n),Ca(e)),!!i}function fs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ni(e,"Shift-"+n,t,function(r){return ia(e,r,!0)})||Ni(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ia(e,r)}):Ni(e,n,t,function(r){return ia(e,r)}):!1}function Ul(e,t,n){return Ni(e,"'"+n+"'",t,function(r){return ia(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),We(t,e))return;K&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=fs(t,e);L&&(ja=r?n:null,!r&&n==88&&!Mt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;j(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(u(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}Re(document,"keyup",n),Re(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),We(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kn(t.display,e)||We(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(L&&n==ja){ja=null,le(e);return}if(L&&(!e.which||e.which<10)&&fs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&wt(t,this.pos)==0&&n==this.button};var Fi,Ui;function Wl(e,t){var n=+new Date;return Ui&&Ui.compare(n,e,t)?(Fi=Ui=null,"triple"):Fi&&Fi.compare(n,e,t)?(Ui=new Wa(n,e,t),Fi=null,"double"):(Fi=new Wa(n,e,t),Ui=null,"single")}function vs(e){var t=this,n=t.display;if(We(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kn(n,e)){M||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Kn(t,e),i=Ie(e),k=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,k,e))return;i==1?r?Gl(t,r,k,e):we(e)==n.scroller&&le(e):i==2?(r&&Qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var k="Click";return r=="double"?k="Double"+k:r=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Ni(e,ls(k,i),i,function(W){if(typeof W=="string"&&(W=Ii[W]),!W)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=W(e,n)!=Ae}finally{e.state.suppressEdits=!1}return X})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var k=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){K?setTimeout(P(vo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),k=e.doc.sel,W;e.options.dragDrop&&$e&&!e.isReadOnly()&&n=="single"&&(W=k.contains(t))>-1&&(wt((W=k.ranges[W]).from(),t)<0||t.xRel>0)&&(wt(W.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,k=!1,W=Fr(e,function(te){M&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",W),Ye(i.wrapper.ownerDocument,"mousemove",X),Ye(i.scroller,"dragstart",Q),Ye(i.scroller,"drop",W),k||(le(te),r.addNew||Qi(e.doc,n,null,null,r.extend),M&&!_||K&&B==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),X=function(te){k=k||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return k=!0};M&&(i.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Re(i.wrapper.ownerDocument,"mouseup",W),Re(i.wrapper.ownerDocument,"mousemove",X),Re(i.scroller,"dragstart",Q),Re(i.scroller,"drop",W),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new er(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new er(qe(t.line,0),c(e.doc,qe(t.line+1,0)));var r=n(e,t);return new er(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,k=e.doc;le(t);var W,X,Q=k.sel,te=Q.ranges;if(r.addNew&&!r.extend?(X=k.sel.contains(n),X>-1?W=te[X]:W=new er(n,n)):(W=k.sel.primary(),X=k.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new er(n,n)),n=Kn(e,t,!0,!0),X=-1;else{var be=ys(e,n,r.unit);r.extend?W=Ia(W,be.anchor,be.head,r.extend):W=be}r.addNew?X==-1?(X=te.length,Yr(k,Cn(e,te.concat([W]),X),{scroll:!1,origin:"*mouse"})):te.length>1&&te[X].empty()&&r.unit=="char"&&!r.extend?(Yr(k,Cn(e,te.slice(0,X).concat(te.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=k.sel):Na(k,X,W,ce):(X=0,Yr(k,new vn([W],0),ce),Q=k.sel);var Te=n;function Ne(ct){if(wt(Te,ct)==0)return;if(Te=ct,r.unit=="rectangle"){for(var bt=[],Rt=e.options.tabSize,At=$(ft(k,n.line).text,n.ch,Rt),Wt=$(ft(k,ct.line).text,ct.ch,Rt),fr=Math.min(At,Wt),Br=Math.max(At,Wt),Sr=Math.min(n.line,ct.line),fn=Math.min(e.lastLine(),Math.max(n.line,ct.line));Sr<=fn;Sr++){var an=ft(k,Sr).text,Or=de(an,fr,Rt);fr==Br?bt.push(new er(qe(Sr,Or),qe(Sr,Or))):an.length>Or&&bt.push(new er(qe(Sr,Or),qe(Sr,de(an,Br,Rt))))}bt.length||bt.push(new er(n,n)),Yr(k,Cn(e,Q.ranges.slice(0,X).concat(bt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ct)}else{var on=W,Gr=ys(e,ct,r.unit),Mr=on.anchor,Rr;wt(Gr.anchor,Mr)>0?(Rr=Gr.head,Mr=Wr(on.from(),Gr.anchor)):(Rr=Gr.anchor,Mr=Zr(on.to(),Gr.head));var kr=Q.ranges.slice(0);kr[X]=Xl(e,new er(c(k,Mr),Rr)),Yr(k,Cn(e,kr,X),ce)}}var _e=i.wrapper.getBoundingClientRect(),Je=0;function et(ct){var bt=++Je,Rt=Kn(e,ct,!0,r.unit=="rectangle");if(!Rt)return;if(wt(Rt,Te)!=0){e.curOp.focus=D(),Ne(Rt);var At=Vi(i,k);(Rt.line>=At.to||Rt.line<At.from)&&setTimeout(Fr(e,function(){Je==bt&&et(ct)}),150)}else{var Wt=ct.clientY<_e.top?-20:ct.clientY>_e.bottom?20:0;Wt&&setTimeout(Fr(e,function(){if(Je!=bt)return;i.scroller.scrollTop+=Wt,et(ct)}),50)}}function it(ct){e.state.selectingText=!1,Je=Infinity,ct&&(le(ct),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",dt),Ye(i.wrapper.ownerDocument,"mouseup",gt),k.history.lastSelOrigin=null}var dt=Fr(e,function(ct){ct.buttons===0||!Ie(ct)?it(ct):et(ct)}),gt=Fr(e,it);e.state.selectingText=gt,Re(i.wrapper.ownerDocument,"mousemove",dt),Re(i.wrapper.ownerDocument,"mouseup",gt)}function Xl(e,t){var n=t.anchor,r=t.head,i=ft(e.doc,n.line);if(wt(n,r)==0&&n.sticky==r.sticky)return t;var k=Ve(i);if(!k)return t;var W=je(k,n.ch,n.sticky),X=k[W];if(X.from!=n.ch&&X.to!=n.ch)return t;var Q=W+(X.from==n.ch==(X.level!=1)?0:1);if(Q==0||Q==k.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var be=je(k,r.ch,r.sticky),Te=be-W||(r.ch-n.ch)*(X.level==1?-1:1);be==Q-1||be==Q?te=Te<0:te=Te>0}var Ne=k[Q+(te?-1:0)],_e=te==(Ne.level==1),Je=_e?Ne.from:Ne.to,et=_e?"after":"before";return n.ch==Je&&n.sticky==et?t:new er(new qe(n.line,Je,et),r)}function bs(e,t,n,r){var i,k;if(t.touches)i=t.touches[0].clientX,k=t.touches[0].clientY;else try{i=t.clientX,k=t.clientY}catch(Ne){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&le(t);var W=e.display,X=W.lineDiv.getBoundingClientRect();if(k>X.bottom||!ye(e,n))return me(t);k-=X.top-W.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=W.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=i){var be=yr(e.doc,k),Te=e.display.gutterSpecs[Q];return Pe(e,n,e,be,Te.className,t),me(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(kn(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yi(e)}var di={toString:function(){return"CodeMirror.Init"}},Cs={},aa={};function $l(e){var t=e.optionHandlers;function n(r,i,k,W){e.defaults[r]=i,k&&(t[r]=W?function(X,Q,te){te!=di&&k(X,Q,te)}:k)}e.defineOption=n,e.Init=di,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ai(r),yi(r),rn(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var k=[],W=r.doc.first;r.doc.iter(function(Q){for(var te=0;;){var be=Q.text.indexOf(i,te);if(be==-1)break;te=be+i.length,k.push(qe(W,be))}W++});for(var X=k.length-1;X>=0;X--)oi(r.doc,i,k[X],qe(k[X].line,k[X].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,k){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),k!=di&&r.refresh()}),n("specialCharPlaceholder",hr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),wi(r)},!0),n("keyMap","default",function(r,i,k){var W=na(i),X=k!=di&&na(k);X&&X.detach&&X.detach(r,W),W.attach&&W.attach(r,X||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),wi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ri(r)},!0),n("scrollbarStyle","native",function(r){To(r),ri(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),wi(r)},!0),n("firstLineNumber",1,wi,!0),n("lineNumberFormatter",function(r){return r},wi,!0),n("showCursorWhenSelecting",!1,bi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(ei(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Zl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,bi,!0),n("singleCursorHeightPerLine",!0,bi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ai,!0),n("addModeClass",!1,Ai,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Ai,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Zl(e,t,n){var r=n&&n!=di;if(!t!=!r){var i=e.display.dragFunctions,k=t?Re:Ye;k(e.display.scroller,"dragstart",i.start),k(e.display.scroller,"dragenter",i.enter),k(e.display.scroller,"dragover",i.over),k(e.display.scroller,"dragleave",i.leave),k(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(u(e.display.wrapper,"CodeMirror-wrap"),ji(e)),xa(e),rn(e),yi(e),setTimeout(function(){return ri(e)},100)}function Er(e,t){var n=this;if(!(this instanceof Er))return new Er(e,t);this.options=t=t?N(t):{},N(Cs,t,!1);var r=t.value;typeof r=="string"?r=new nn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Er.inputStyles[t.inputStyle](this),k=this.display=new dl(e,r,i,t);k.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(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 re,keySeq:null,specialChars:null},t.autofocus&&!o&&k.input.focus(),K&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),Xn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):ei(this);for(var W in aa)aa.hasOwnProperty(W)&&aa[W](this,t[W],di);Lo(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ka.length;++X)Ka[X](this);Yn(this),M&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Er.defaults=Cs,Er.optionHandlers=aa;function Ql(e){var t=e.display;Re(t.scroller,"mousedown",Fr(e,vs)),K&&B<11?Re(t.scroller,"dblclick",Fr(e,function(Q){if(We(e,Q))return;var te=Kn(e,Q);if(!te||Ha(e,Q)||kn(e.display,Q))return;le(Q);var be=e.findWordAt(te);Qi(e.doc,be.anchor,be.head)})):Re(t.scroller,"dblclick",function(Q){return We(e,Q)||le(Q)}),Re(t.scroller,"contextmenu",function(Q){return Es(e,Q)}),Re(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Es(e,Q)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function k(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function W(Q,te){if(te.left==null)return!0;var be=te.left-Q.left,Te=te.top-Q.top;return be*be+Te*Te>20*20}Re(t.scroller,"touchstart",function(Q){if(!We(e,Q)&&!k(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Re(t.scroller,"touchend",function(Q){var te=t.activeTouch;if(te&&!kn(t,Q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var be=e.coordsChar(t.activeTouch,"page"),Te;!te.prev||W(te,te.prev)?Te=new er(be,be):!te.prev.prev||W(te,te.prev.prev)?Te=e.findWordAt(be):Te=new er(qe(be.line,0),c(e.doc,qe(be.line+1,0))),e.setSelection(Te.anchor,Te.head),e.focus(),le(Q)}i()}),Re(t.scroller,"touchcancel",i),Re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),zn(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(Q){return Oo(e,Q)}),Re(t.scroller,"DOMMouseScroll",function(Q){return Oo(e,Q)}),Re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){We(e,Q)||Ee(Q)},over:function(Q){We(e,Q)||(kl(e,Q),Ee(Q))},start:function(Q){return Ll(e,Q)},drop:Fr(e,Al),leave:function(Q){We(e,Q)||is(e)}};var X=t.input.getField();Re(X,"keyup",function(Q){return ms.call(e,Q)}),Re(X,"keydown",Fr(e,ps)),Re(X,"keypress",Fr(e,gs)),Re(X,"focus",function(Q){return Sa(e,Q)}),Re(X,"blur",function(Q){return ei(e,Q)})}var Ka=[];Er.defineInitHook=function(e){return Ka.push(e)};function Bi(e,t,n,r){var i=e.doc,k;n==null&&(n="add"),n=="smart"&&(i.mode.indent?k=nt(e,t).state:n="prev");var W=e.options.tabSize,X=ft(i,t),Q=$(X.text,null,W);X.stateAfter&&(X.stateAfter=null);var te=X.text.match(/^\s*/)[0],be;if(!r&&!/\S/.test(X.text))be=0,n="not";else if(n=="smart"&&(be=i.mode.indent(k,X.text.slice(te.length),X.text),be==Ae||be>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?be=$(ft(i,t-1).text,null,W):be=0:n=="add"?be=Q+e.options.indentUnit:n=="subtract"?be=Q-e.options.indentUnit:typeof n=="number"&&(be=Q+n),be=Math.max(0,be);var Te="",Ne=0;if(e.options.indentWithTabs)for(var _e=Math.floor(be/W);_e;--_e)Ne+=W,Te+=" ";if(Ne<be&&(Te+=se(be-Ne)),Te!=te)return oi(i,Te,qe(t,0),qe(t,te.length),"+input"),X.stateAfter=null,!0;for(var Je=0;Je<i.sel.ranges.length;Je++){var et=i.sel.ranges[Je];if(et.head.line==t&&et.head.ch<te.length){var it=qe(t,te.length);Na(i,Je,new er(it,it));break}}}var Sn=null;function oa(e){Sn=e}function Ga(e,t,n,r,i){var k=e.doc;e.display.shift=!1,r||(r=k.sel);var W=+new Date-200,X=i=="paste"||e.state.pasteIncoming>W,Q=Ct(t),te=null;if(X&&r.ranges.length>1)if(Sn&&Sn.text.join(`
`)==t){if(r.ranges.length%Sn.text.length==0){te=[];for(var be=0;be<Sn.text.length;be++)te.push(k.splitLines(Sn.text[be]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=ee(Q,function(dt){return[dt]}));for(var Te=e.curOp.updateInput,Ne=r.ranges.length-1;Ne>=0;Ne--){var _e=r.ranges[Ne],Je=_e.from(),et=_e.to();_e.empty()&&(n&&n>0?Je=qe(Je.line,Je.ch-n):e.state.overwrite&&!X?et=qe(et.line,Math.min(ft(k,et.line).text.length,et.ch+J(Q).length)):X&&Sn&&Sn.lineWise&&Sn.text.join(`
`)==Q.join(`
`)&&(Je=et=qe(Je.line,0)));var it={from:Je,to:et,text:te?te[Ne%te.length]:Q,origin:i||(X?"paste":e.state.cutIncoming>W?"cut":"+input")};ai(e.doc,it),Kr(e,"inputRead",e,it)}t&&!X&&Ts(e,t),ti(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Te),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&hn(t,function(){return Ga(t,n,0,null,"paste")}),!0}function Ts(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var k=e.getModeAt(i.head),W=!1;if(k.electricChars){for(var X=0;X<k.electricChars.length;X++)if(t.indexOf(k.electricChars.charAt(X))>-1){W=Bi(e,i.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(ft(e.doc,i.head.line).text.slice(0,i.head.ch))&&(W=Bi(e,i.head.line,"smart")));W&&Kr(e,"electricInput",e,i.head.line)}}function ws(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,k={anchor:qe(i,0),head:qe(i+1,0)};n.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),As(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var k=this.options,W=k[r];if(k[r]==i&&r!="mode")return;k[r]=i,t.hasOwnProperty(r)&&Fr(this,t[r])(this,i,W),Pe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,k=0;k<i.length;++k)if(i[k]==r||i[k].name==r)return i.splice(k,1),!0},addOverlay:Jr(function(r,i){var k=r.token?r:e.getMode(this.options,r);if(k.startState)throw new Error("Overlays may not be stateful.");oe(this.state.overlays,{mode:k,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(W){return W.priority}),this.state.modeGen++,rn(this)}),removeOverlay:Jr(function(r){for(var i=this.state.overlays,k=0;k<i.length;++k){var W=i[k].modeSpec;if(W==r||typeof r=="string"&&W.name==r){i.splice(k,1),this.state.modeGen++,rn(this);return}}}),indentLine:Jr(function(r,i,k){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),dr(this.doc,r)&&Bi(this,r,i,k)}),indentSelection:Jr(function(r){for(var i=this.doc.sel.ranges,k=-1,W=0;W<i.length;W++){var X=i[W];if(X.empty())X.head.line>k&&(Bi(this,X.head.line,r,!0),k=X.head.line,W==this.doc.sel.primIndex&&ti(this));else{var Q=X.from(),te=X.to(),be=Math.max(k,Q.line);k=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Te=be;Te<k;++Te)Bi(this,Te,r);var Ne=this.doc.sel.ranges;Q.ch==0&&i.length==Ne.length&&Ne[W].from().ch>0&&Na(this.doc,W,new er(Q,Ne[W].to()),Le)}}}),getTokenAt:function(r,i){return It(this,r,i)},getLineTokens:function(r,i){return It(this,qe(r),i,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var i=Ze(this,ft(this.doc,r.line)),k=0,W=(i.length-1)/2,X=r.ch,Q;if(X==0)Q=i[2];else for(;;){var te=k+W>>1;if((te?i[te*2-1]:0)>=X)W=te;else if(i[te*2+1]<X)k=te+1;else{Q=i[te*2+2];break}}var be=Q?Q.indexOf("overlay "):-1;return be<0?Q:be==0?null:Q.slice(0,be-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var k=[];if(!n.hasOwnProperty(i))return k;var W=n[i],X=this.getModeAt(r);if(typeof X[i]=="string")W[X[i]]&&k.push(W[X[i]]);else if(X[i])for(var Q=0;Q<X[i].length;Q++){var te=W[X[i][Q]];te&&k.push(te)}else X.helperType&&W[X.helperType]?k.push(W[X.helperType]):W[X.name]&&k.push(W[X.name]);for(var be=0;be<W._global.length;be++){var Te=W._global[be];Te.pred(X,this)&&pe(k,Te.val)==-1&&k.push(Te.val)}return k},getStateAfter:function(r,i){var k=this.doc;return r=G(k,r==null?k.first+k.size-1:r),nt(this,r+1,i).state},cursorCoords:function(r,i){var k,W=this.doc.sel.primary();return r==null?k=W.head:typeof r=="object"?k=c(this.doc,r):k=r?W.from():W.to(),xn(this,k,i||"page")},charCoords:function(r,i){return ma(this,c(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,yr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,k){var W=!1,X;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,W=!0),X=ft(this.doc,r)}else X=r;return Hi(this,X,{top:0,left:0},i||"page",k||W).top+(W?this.doc.height-cn(X):0)},defaultTextHeight:function(){return Qn(this.display)},defaultCharWidth:function(){return qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,k,W,X){var Q=this.display;r=xn(this,c(this.doc,r));var te=r.bottom,be=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),Q.sizer.appendChild(i),W=="over")te=r.top;else if(W=="above"||W=="near"){var Te=Math.max(Q.wrapper.clientHeight,this.doc.height),Ne=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(W=="above"||r.bottom+i.offsetHeight>Te)&&r.top>i.offsetHeight?te=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=Te&&(te=r.bottom),be+i.offsetWidth>Ne&&(be=Ne-i.offsetWidth)}i.style.top=te+"px",i.style.left=i.style.right="",X=="right"?(be=Q.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(X=="left"?be=0:X=="middle"&&(be=(Q.sizer.clientWidth-i.offsetWidth)/2),i.style.left=be+"px"),k&&Zs(this,{left:be,top:te,right:be+i.offsetWidth,bottom:te+i.offsetHeight})},triggerOnKeyDown:Jr(ps),triggerOnKeyPress:Jr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Jr(vs),execCommand:function(r){if(Ii.hasOwnProperty(r))return Ii[r].call(null,this)},triggerElectric:Jr(function(r){Ts(this,r)}),findPosH:function(r,i,k,W){var X=1;i<0&&(X=-1,i=-i);for(var Q=c(this.doc,r),te=0;te<i&&!(Q=za(this.doc,Q,X,k,W),Q.hitSide);++te);return Q},moveH:Jr(function(r,i){var k=this;this.extendSelectionsBy(function(W){return k.display.shift||k.doc.extend||W.empty()?za(k.doc,W.head,r,i,k.options.rtlMoveVisually):r<0?W.from():W.to()},ae)}),deleteH:Jr(function(r,i){var k=this.doc.sel,W=this.doc;k.somethingSelected()?W.replaceSelection("",null,"+delete"):ui(this,function(X){var Q=za(W,X.head,r,i,!1);return r<0?{from:Q,to:X.head}:{from:X.head,to:Q}})}),findPosV:function(r,i,k,W){var X=1,Q=W;i<0&&(X=-1,i=-i);for(var te=c(this.doc,r),be=0;be<i;++be){var Te=xn(this,te,"div");if(Q==null?Q=Te.left:Te.left=Q,te=ks(this,Te,X,k),te.hitSide)break}return te},moveV:Jr(function(r,i){var k=this,W=this.doc,X=[],Q=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(be){if(Q)return r<0?be.from():be.to();var Te=xn(k,be.head,"div");be.goalColumn!=null&&(Te.left=be.goalColumn),X.push(Te.left);var Ne=ks(k,Te,r,i);return i=="page"&&be==W.sel.primary()&&wa(k,ma(k,Ne,"div").top-Te.top),Ne},ae),X.length)for(var te=0;te<W.sel.ranges.length;te++)W.sel.ranges[te].goalColumn=X[te]}),findWordAt:function(r){var i=this.doc,k=ft(i,r.line).text,W=r.ch,X=r.ch;if(k){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||X==k.length)&&W?--W:++X;for(var te=k.charAt(W),be=Me(te,Q)?function(Te){return Me(Te,Q)}:/\s/.test(te)?function(Te){return/\s/.test(Te)}:function(Te){return!/\s/.test(Te)&&!Me(Te)};W>0&&be(k.charAt(W-1));)--W;for(;X<k.length&&be(k.charAt(X));)++X}return new er(qe(r.line,W),qe(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):u(this.display.cursorDiv,"CodeMirror-overwrite"),Pe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jr(function(r,i){Ei(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Tn(this)-this.display.barHeight,width:r.scrollWidth-Tn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:Wn(this)}},scrollIntoView:Jr(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:qe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jr(function(r,i){var k=this,W=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=W(r)),i!=null&&(this.display.wrapper.style.height=W(i)),this.options.lineWrapping&&ao(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){_n(k,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Pe(this,"refresh",this)}),operation:function(r){return hn(this,r)},startOperation:function(){return Xn(this)},endOperation:function(){return Yn(this)},refresh:Jr(function(){var r=this.display.cachedTextHeight;rn(this),this.curOp.forceUpdate=!0,yi(this),Ei(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Qn(this.display))>.5||this.options.lineWrapping)&&xa(this),Pe(this,"refresh",this)}),swapDoc:Jr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yi(this),this.display.input.reset(),Ei(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Kr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},xe(e),e.registerHelper=function(r,i,k){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=k},e.registerGlobalHelper=function(r,i,k,W){e.registerHelper(r,i,W),n[r]._global.push({pred:k,val:W})}}function za(e,t,n,r,i){var k=t,W=n,X=ft(e,t.line),Q=i&&e.direction=="rtl"?-n:n;function te(){var gt=t.line+Q;return gt<e.first||gt>=e.first+e.size?!1:(t=new qe(gt,t.ch,t.sticky),X=ft(e,gt))}function be(gt){var ct;if(r=="codepoint"){var bt=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(bt)?ct=null:ct=new qe(t.line,Math.max(0,Math.min(X.text.length,t.ch+n*(bt>=55296&&bt<56320?2:1))),-n)}else i?ct=Ml(e.cm,X,t,n):ct=Ua(X,t,n);if(ct==null)if(!gt&&te())t=Ba(i,e.cm,X,t.line,Q);else return!1;else t=ct;return!0}if(r=="char"||r=="codepoint")be();else if(r=="column")be(!0);else if(r=="word"||r=="group")for(var Te=null,Ne=r=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Je=!0;!(n<0&&!be(!Je));Je=!1){var et=X.text.charAt(t.ch)||`
`,it=Me(et,_e)?"w":Ne&&et==`
`?"n":!Ne||/\s/.test(et)?null:"p";if(Ne&&!Je&&!it&&(it="s"),Te&&Te!=it){n<0&&(n=1,be(),t.sticky="after");break}if(it&&(Te=it),n>0&&!be(!Je))break}var dt=ea(e,t,k,W,!0);return zr(k,dt)&&(dt.hitSide=!0),dt}function ks(e,t,n,r){var i=e.doc,k=t.left,W;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*Qn(e.display),3);W=(n>0?t.bottom:t.top)+n*Q}else r=="line"&&(W=n>0?t.bottom+3:t.top-3);for(var te;!(te=va(e,k,W),!te.outside);){if(n<0?W<=0:W>=i.height){te.hitSide=!0;break}W+=n*5}return te}var or=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new re,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};or.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function k(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Re(i,"paste",function(X){if(!k(X)||We(r,X)||Ss(X,r))return;B<=11&&setTimeout(Fr(r,function(){return t.updateFromDOM()}),20)}),Re(i,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Re(i,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Re(i,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Re(i,"touchstart",function(){return n.forceCompositionEnd()}),Re(i,"input",function(){t.composing||t.readFromDOMSoon()});function W(X){if(!k(X)||We(r,X))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);oa({lineWise:!0,text:Q.text}),X.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Le),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var te=Sn.text.join(`
`);if(X.clipboardData.setData("Text",te),X.clipboardData.getData("Text")==te){X.preventDefault();return}}var be=Ls(),Te=be.firstChild;r.display.lineSpace.insertBefore(be,r.display.lineSpace.firstChild),Te.value=Sn.text.join(`
`);var Ne=document.activeElement;V(Te),setTimeout(function(){r.display.lineSpace.removeChild(be),Ne.focus(),Ne==i&&n.showPrimarySelection()},50)}Re(i,"copy",W),Re(i,"cut",W)},or.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},or.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},or.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},or.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},or.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var k=sa(t,e.anchorNode,e.anchorOffset),W=sa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&W&&!W.bad&&wt(Wr(k,W),r)==0&&wt(Zr(k,W),i)==0)return;var X=t.display.view,Q=r.line>=t.display.viewFrom&&Ds(t,r)||{node:X[0].measure.map[2],offset:0},te=i.line<t.display.viewTo&&Ds(t,i);if(!te){var be=X[X.length-1].measure,Te=be.maps?be.maps[be.maps.length-1]:be.map;te={node:Te[Te.length-1],offset:Te[Te.length-2]-Te[Te.length-3]}}if(!Q||!te){e.removeAllRanges();return}var Ne=e.rangeCount&&e.getRangeAt(0),_e;try{_e=v(Q.node,Q.offset,te.offset,te.node)}catch(Je){}_e&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),Ne&&e.anchorNode==null?e.addRange(Ne):O&&this.startGracePeriod()),this.rememberSelection()},or.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)},or.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},or.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},or.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return C(this.div,t)},or.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},or.prototype.blur=function(){this.div.blur()},or.prototype.getField=function(){return this.div},or.prototype.supportsTouch=function(){return!0},or.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():hn(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)},or.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},or.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&E&&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 n=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);n&&r&&hn(t,function(){Yr(t.doc,Mn(n,r),Le),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},or.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=qe(r.line-1,ft(e.doc,r.line-1).length)),i.ch==ft(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=qe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var k,W,X;r.line==t.viewFrom||(k=Gn(e,r.line))==0?(W=Pt(t.view[0].line),X=t.view[0].node):(W=Pt(t.view[k].line),X=t.view[k-1].node.nextSibling);var Q=Gn(e,i.line),te,be;if(Q==t.view.length-1?(te=t.viewTo-1,be=t.lineDiv.lastChild):(te=Pt(t.view[Q+1].line)-1,be=t.view[Q+1].node.previousSibling),!X)return!1;for(var Te=e.doc.splitLines(tu(e,X,be,W,te)),Ne=sr(e.doc,qe(W,0),qe(te,ft(e.doc,te).text.length));Te.length>1&&Ne.length>1;)if(J(Te)==J(Ne))Te.pop(),Ne.pop(),te--;else if(Te[0]==Ne[0])Te.shift(),Ne.shift(),W++;else break;for(var _e=0,Je=0,et=Te[0],it=Ne[0],dt=Math.min(et.length,it.length);_e<dt&&et.charCodeAt(_e)==it.charCodeAt(_e);)++_e;for(var gt=J(Te),ct=J(Ne),bt=Math.min(gt.length-(Te.length==1?_e:0),ct.length-(Ne.length==1?_e:0));Je<bt&&gt.charCodeAt(gt.length-Je-1)==ct.charCodeAt(ct.length-Je-1);)++Je;if(Te.length==1&&Ne.length==1&&W==r.line)for(;_e&&_e>r.ch&&gt.charCodeAt(gt.length-Je-1)==ct.charCodeAt(ct.length-Je-1);)_e--,Je++;Te[Te.length-1]=gt.slice(0,gt.length-Je).replace(/^\u200b+/,""),Te[0]=Te[0].slice(_e).replace(/\u200b+$/,"");var Rt=qe(W,_e),At=qe(te,Ne.length?J(Ne).length-Je:0);if(Te.length>1||Te[0]||wt(Rt,At))return oi(e.doc,Te,Rt,At,"+input"),!0},or.prototype.ensurePolled=function(){this.forceCompositionEnd()},or.prototype.reset=function(){this.forceCompositionEnd()},or.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},or.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)},or.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&hn(this.cm,function(){return rn(e.cm)})},or.prototype.setUneditable=function(e){e.contentEditable="false"},or.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Fr(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},or.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},or.prototype.onContextMenu=function(){},or.prototype.resetPosition=function(){},or.prototype.needsContentAttribute=!0;function Ds(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var r=ft(e.doc,t.line),i=eo(n,r,t.line),k=Ve(r,e.doc.direction),W="left";if(k){var X=je(k,t.ch);W=X%2?"right":"left"}var Q=no(i.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ci(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var k="",W=!1,X=e.doc.lineSeparator(),Q=!1;function te(_e){return function(Je){return Je.id==_e}}function be(){W&&(k+=X,Q&&(k+=X),W=Q=!1)}function Te(_e){_e&&(be(),k+=_e)}function Ne(_e){if(_e.nodeType==1){var Je=_e.getAttribute("cm-text");if(Je){Te(Je);return}var et=_e.getAttribute("cm-marker"),it;if(et){var dt=e.findMarks(qe(r,0),qe(i+1,0),te(+et));dt.length&&(it=dt[0].find(0))&&Te(sr(e.doc,it.from,it.to).join(X));return}if(_e.getAttribute("contenteditable")=="false")return;var gt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;gt&&be();for(var ct=0;ct<_e.childNodes.length;ct++)Ne(_e.childNodes[ct]);/^(pre|p)$/i.test(_e.nodeName)&&(Q=!0),gt&&(W=!0)}else _e.nodeType==3&&Te(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ne(t),t==n);)t=t.nextSibling,Q=!1;return k}function sa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return ci(e.clipPos(qe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var k=e.display.view[i];if(k.node==r)return ru(k,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!C(r,t))return ci(qe(Pt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var k=e.rest?J(e.rest):e.line;return ci(qe(Pt(k),k.text.length),i)}var W=t.nodeType==3?t:null,X=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,n&&(n=W.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var Q=e.measure,te=Q.maps;function be(it,dt,gt){for(var ct=-1;ct<(te?te.length:0);ct++)for(var bt=ct<0?Q.map:te[ct],Rt=0;Rt<bt.length;Rt+=3){var At=bt[Rt+2];if(At==it||At==dt){var Wt=Pt(ct<0?e.line:e.rest[ct]),fr=bt[Rt]+gt;return(gt<0||At!=it)&&(fr=bt[Rt+(gt?1:0)]),qe(Wt,fr)}}}var Te=be(W,X,n);if(Te)return ci(Te,i);for(var Ne=X.nextSibling,_e=W?W.nodeValue.length-n:0;Ne;Ne=Ne.nextSibling){if(Te=be(Ne,Ne.firstChild,0),Te)return ci(qe(Te.line,Te.ch-_e),i);_e+=Ne.textContent.length}for(var Je=X.previousSibling,et=n;Je;Je=Je.previousSibling){if(Te=be(Je,Je.firstChild,-1),Te)return ci(qe(Te.line,Te.ch+et),i);et+=Je.textContent.length}}var Dr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new re,this.hasSelection=!1,this.composing=null};Dr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(i.style.width="0px"),Re(i,"input",function(){K&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Re(i,"paste",function(W){if(We(r,W)||Ss(W,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function k(W){if(We(r,W))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ws(r);oa({lineWise:!0,text:X.text}),W.type=="cut"?r.setSelections(X.ranges,null,Le):(n.prevInput="",i.value=X.text.join(`
`),V(i))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(i,"cut",k),Re(i,"copy",k),Re(e.scroller,"paste",function(W){if(kn(e,W)||We(r,W))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var X=new Event("paste");X.clipboardData=W.clipboardData,i.dispatchEvent(X)}),Re(e.lineSpace,"selectstart",function(W){kn(e,W)||le(W)}),Re(i,"compositionstart",function(){var W=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:W,range:r.markText(W,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Re(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Dr.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Dr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Dr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=xn(e,n.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+W.top-k.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+W.left-k.left))}return r},Dr.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Dr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&V(this.textarea),K&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",K&&B>=9&&(this.hasSelection=null))},Dr.prototype.getField=function(){return this.textarea},Dr.prototype.supportsTouch=function(){return!1},Dr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Dr.prototype.blur=function(){this.textarea.blur()},Dr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Dr.prototype.receivedFocus=function(){this.slowPoll()},Dr.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()})},Dr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Dr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(K&&B>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=i.charCodeAt(0);if(k==8203&&!r&&(r="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,X=Math.min(r.length,i.length);W<X&&r.charCodeAt(W)==i.charCodeAt(W);)++W;return hn(t,function(){Ga(t,i.slice(W),r.length-W,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Dr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Dr.prototype.onKeyPress=function(){K&&B>=9&&(this.hasSelection=null),this.fastPoll()},Dr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Kn(n,e),W=r.scroller.scrollTop;if(!k||L)return;var X=n.options.resetSelectionOnContextMenu;X&&n.doc.sel.contains(k)==-1&&Fr(n,Yr)(n.doc,Mn(k),Le);var Q=i.style.cssText,te=t.wrapper.style.cssText,be=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-be.top-5)+"px; left: "+(e.clientX-be.left-5)+`px;
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Te;M&&(Te=window.scrollY),r.input.focus(),M&&window.scrollTo(null,Te),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=_e,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Ne(){if(i.selectionStart!=null){var et=n.somethingSelected(),it="\u200B"+(et?i.value:"");i.value="\u21DA",i.value=it,t.prevInput=et?"":"\u200B",i.selectionStart=1,i.selectionEnd=it.length,r.selForContextMenu=n.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,i.style.cssText=Q,K&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),i.selectionStart!=null){(!K||K&&B<9)&&Ne();var et=0,it=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Fr(n,Xo)(n):et++<10?r.detectingSelectAll=setTimeout(it,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(it,200)}}if(K&&B>=9&&Ne(),w){Ee(e);var Je=function(){Ye(window,"mouseup",Je),setTimeout(_e,20)};Re(window,"mouseup",Je)}else setTimeout(_e,50)},Dr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Dr.prototype.setUneditable=function(){},Dr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(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 n=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=X.getValue()}var i;if(e.form&&(Re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var k=e.form;i=k.submit;try{var W=k.submit=function(){r(),k.submit=i,k.submit(),k.submit=W}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var X=Er(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function iu(e){e.off=Ye,e.on=Re,e.wheelEventPixels=cl,e.Doc=nn,e.splitLines=Ct,e.countColumn=$,e.findColumn=de,e.isWordChar=De,e.Pass=Ae,e.signal=Pe,e.Line=jn,e.changeEnd=In,e.scrollbarModel=So,e.Pos=qe,e.cmpPos=wt,e.modes=Dt,e.mimeModes=Tt,e.resolveMode=yt,e.getMode=pr,e.modeExtensions=Bt,e.extendMode=tr,e.copyState=ur,e.startState=vr,e.innerMode=nr,e.commands=Ii,e.keyMap=Dn,e.keyName=us,e.isModifierKey=ss,e.lookupKey=li,e.normalizeKeyMap=Pl,e.StringStream=Nt,e.SharedTextMarker=_i,e.TextMarker=Fn,e.LineWidget=Ri,e.e_preventDefault=le,e.e_stopPropagation=ue,e.e_stop=Ee,e.addClass=j,e.contains=C,e.rmClass=u,e.keyNames=Un}$l(Er),ql(Er);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in nn.prototype)nn.prototype.hasOwnProperty(la)&&pe(au,la)<0&&(Er.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(nn.prototype[la]));return xe(nn),Er.inputStyles={textarea:Dr,contenteditable:or},Er.defineMode=function(e){!Er.defaults.mode&&e!="null"&&(Er.defaults.mode=e),Ut.apply(this,arguments)},Er.defineMIME=Qt,Er.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Er.defineMIME("text/plain","null"),Er.defineExtension=function(e,t){Er.prototype[e]=t},Er.defineDocExtension=function(e,t){nn.prototype[e]=t},Er.fromTextArea=nu,iu(Er),Er.version="5.58.2",Er})},WaYH:function(Et,tt,ie){"use strict";var he=ie("rePB"),Y=ie("Ff2n"),O=ie("VTBJ"),Z=ie("1OyB"),U=ie("vuIU"),I=ie("JX7q"),K=ie("Ji7U"),B=ie("LK+K"),M=ie("q1tI"),R=ie("TSYQ"),E=ie.n(R),L=ie("sboe"),_=ie("OZM5"),A=function(w){var b=w.prefixCls,u=w.level,f=w.isStart,s=w.isEnd;if(!u)return null;for(var a="".concat(b,"-indent-unit"),T=[],v=0;v<u;v+=1){var C;T.push(M.createElement("span",{key:v,className:E()(a,(C={},Object(he.a)(C,"".concat(a,"-start"),f[v+1]),Object(he.a)(C,"".concat(a,"-end"),s[v+1]),Object(he.a)(C,"".concat(a,"-end-first-level"),!v&&s[0]),C))}))}return M.createElement("span",{"aria-hidden":"true",className:"".concat(b,"-indent")},T)},x=A,y=ie("815F"),h="open",o="close",l="---",d=function(p){Object(K.a)(b,p);var w=Object(B.a)(b);function b(){var u;return Object(Z.a)(this,b),u=w.apply(this,arguments),u.state={dragNodeHighlight:!1},u.onSelectorClick=function(f){var s=u.props.context.onNodeClick;s(f,Object(y.b)(u.props)),u.isSelectable()?u.onSelect(f):u.onCheck(f)},u.onSelectorDoubleClick=function(f){var s=u.props.context.onNodeDoubleClick;s(f,Object(y.b)(u.props))},u.onSelect=function(f){if(u.isDisabled())return;var s=u.props.context.onNodeSelect;f.preventDefault(),s(f,Object(y.b)(u.props))},u.onCheck=function(f){if(u.isDisabled())return;var s=u.props,a=s.disableCheckbox,T=s.checked,v=u.props.context.onNodeCheck;if(!u.isCheckable()||a)return;f.preventDefault();var C=!T;v(f,Object(y.b)(u.props),C)},u.onMouseEnter=function(f){var s=u.props.context.onNodeMouseEnter;s(f,Object(y.b)(u.props))},u.onMouseLeave=function(f){var s=u.props.context.onNodeMouseLeave;s(f,Object(y.b)(u.props))},u.onContextMenu=function(f){var s=u.props.context.onNodeContextMenu;s(f,Object(y.b)(u.props))},u.onDragStart=function(f){var s=u.props.context.onNodeDragStart;f.stopPropagation(),u.setState({dragNodeHighlight:!0}),s(f,Object(I.a)(u));try{f.dataTransfer.setData("text/plain","")}catch(a){}},u.onDragEnter=function(f){var s=u.props.context.onNodeDragEnter;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragOver=function(f){var s=u.props.context.onNodeDragOver;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragLeave=function(f){var s=u.props.context.onNodeDragLeave;f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragEnd=function(f){var s=u.props.context.onNodeDragEnd;f.stopPropagation(),u.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(u))},u.onDrop=function(f){var s=u.props.context.onNodeDrop;f.preventDefault(),f.stopPropagation(),u.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(u))},u.onExpand=function(f){var s=u.props.context.onNodeExpand;s(f,Object(y.b)(u.props))},u.setSelectHandle=function(f){u.selectHandle=f},u.getNodeState=function(){var f=u.props.expanded;return u.isLeaf()?null:f?h:o},u.hasChildren=function(){var f=u.props.eventKey,s=u.props.context.keyEntities,a=s[f]||{},T=a.children;return!!(T||[]).length},u.isLeaf=function(){var f=u.props,s=f.isLeaf,a=f.loaded,T=u.props.context.loadData,v=u.hasChildren();return s===!1?!1:s||!T&&!v||T&&a&&!v},u.isDisabled=function(){var f=u.props.disabled,s=u.props.context.disabled;return!!(s||f)},u.isCheckable=function(){var f=u.props.checkable,s=u.props.context.checkable;return!s||f===!1?!1:s},u.syncLoadData=function(f){var s=f.expanded,a=f.loading,T=f.loaded,v=u.props.context,C=v.loadData,D=v.onNodeLoad;if(a)return;C&&s&&!u.isLeaf()&&(!u.hasChildren()&&!T&&D(Object(y.b)(u.props)))},u.renderSwitcher=function(){var f=u.props,s=f.expanded,a=f.switcherIcon,T=u.props.context,v=T.prefixCls,C=T.switcherIcon,D=a||C;if(u.isLeaf())return M.createElement("span",{className:E()("".concat(v,"-switcher"),"".concat(v,"-switcher-noop"))},typeof D=="function"?D(Object(O.a)(Object(O.a)({},u.props),{},{isLeaf:!0})):D);var j=E()("".concat(v,"-switcher"),"".concat(v,"-switcher_").concat(s?h:o));return M.createElement("span",{onClick:u.onExpand,className:j},typeof D=="function"?D(Object(O.a)(Object(O.a)({},u.props),{},{isLeaf:!1})):D)},u.renderCheckbox=function(){var f=u.props,s=f.checked,a=f.halfChecked,T=f.disableCheckbox,v=u.props.context.prefixCls,C=u.isDisabled(),D=u.isCheckable();if(!D)return null;var j=typeof D!="boolean"?D:null;return M.createElement("span",{className:E()("".concat(v,"-checkbox"),s&&"".concat(v,"-checkbox-checked"),!s&&a&&"".concat(v,"-checkbox-indeterminate"),(C||T)&&"".concat(v,"-checkbox-disabled")),onClick:u.onCheck},j)},u.renderIcon=function(){var f=u.props.loading,s=u.props.context.prefixCls;return M.createElement("span",{className:E()("".concat(s,"-iconEle"),"".concat(s,"-icon__").concat(u.getNodeState()||"docu"),f&&"".concat(s,"-icon_loading"))})},u.renderSelector=function(){var f=u.state.dragNodeHighlight,s=u.props,a=s.title,T=s.selected,v=s.icon,C=s.loading,D=s.data,j=u.props.context,z=j.prefixCls,V=j.showIcon,P=j.icon,N=j.draggable,$=j.loadData,re=j.titleRender,pe=u.isDisabled(),ve="".concat(z,"-node-content-wrapper"),Ae;if(V){var Le=v||P;Ae=Le?M.createElement("span",{className:E()("".concat(z,"-iconEle"),"".concat(z,"-icon__customize"))},typeof Le=="function"?Le(u.props):Le):u.renderIcon()}else $&&C&&(Ae=u.renderIcon());var ce;typeof a=="function"?ce=a(D):re?ce=re(D):ce=a;var ae=M.createElement("span",{className:"".concat(z,"-title")},ce);return M.createElement("span",{ref:u.setSelectHandle,title:typeof a=="string"?a:"",className:E()("".concat(ve),"".concat(ve,"-").concat(u.getNodeState()||"normal"),!pe&&(T||f)&&"".concat(z,"-node-selected"),!pe&&N&&"draggable"),draggable:!pe&&N||void 0,"aria-grabbed":!pe&&N||void 0,onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,onContextMenu:u.onContextMenu,onClick:u.onSelectorClick,onDoubleClick:u.onSelectorDoubleClick,onDragStart:N?u.onDragStart:void 0},Ae,ae)},u}return Object(U.a)(b,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var f=this.props.selectable,s=this.props.context.selectable;return typeof f=="boolean"?f:s}},{key:"render",value:function(){var f,s=this.props,a=s.eventKey,T=s.className,v=s.style,C=s.dragOver,D=s.dragOverGapTop,j=s.dragOverGapBottom,z=s.isLeaf,V=s.isStart,P=s.isEnd,N=s.expanded,$=s.selected,re=s.checked,pe=s.halfChecked,ve=s.loading,Ae=s.domRef,Le=s.active,ce=s.onMouseMove,ae=Object(Y.a)(s,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),de=this.props.context,ne=de.prefixCls,se=de.filterTreeNode,J=de.draggable,ee=de.keyEntities,oe=this.isDisabled(),fe=Object(_.f)(ae),ke=ee[a]||{},ge=ke.level,De=P[P.length-1];return M.createElement("div",Object.assign({ref:Ae,className:E()(T,"".concat(ne,"-treenode"),(f={},Object(he.a)(f,"".concat(ne,"-treenode-disabled"),oe),Object(he.a)(f,"".concat(ne,"-treenode-switcher-").concat(N?"open":"close"),!z),Object(he.a)(f,"".concat(ne,"-treenode-checkbox-checked"),re),Object(he.a)(f,"".concat(ne,"-treenode-checkbox-indeterminate"),pe),Object(he.a)(f,"".concat(ne,"-treenode-selected"),$),Object(he.a)(f,"".concat(ne,"-treenode-loading"),ve),Object(he.a)(f,"".concat(ne,"-treenode-active"),Le),Object(he.a)(f,"".concat(ne,"-treenode-leaf-last"),De),Object(he.a)(f,"drag-over",!oe&&C),Object(he.a)(f,"drag-over-gap-top",!oe&&D),Object(he.a)(f,"drag-over-gap-bottom",!oe&&j),Object(he.a)(f,"filter-node",se&&se(Object(y.b)(this.props))),f)),style:v,onDragEnter:J?this.onDragEnter:void 0,onDragOver:J?this.onDragOver:void 0,onDragLeave:J?this.onDragLeave:void 0,onDrop:J?this.onDrop:void 0,onDragEnd:J?this.onDragEnd:void 0,onMouseMove:ce},fe),M.createElement(x,{prefixCls:ne,level:ge,isStart:V,isEnd:P}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),b}(M.Component),S=function(w){return M.createElement(L.a.Consumer,null,function(b){return M.createElement(d,Object.assign({},w,{context:b}))})};S.displayName="TreeNode",S.defaultProps={title:l},S.isTreeNode=1;var g=tt.a=S},X8EC:function(Et,tt,ie){"use strict";ie.r(tt);var he=ie("+L6B"),Y=ie("2/Rp"),O=ie("DZo9"),Z=ie("8z0m"),U=ie("oBTY"),I=ie("sRBo"),K=ie("kaz8"),B=ie("7Kak"),M=ie("9yH6"),R=ie("BoS7"),E=ie("Sdc0"),L=ie("14J3"),_=ie("BMrR"),A=ie("jCWc"),x=ie("kPKH"),y=ie("O3gP"),h=ie("lrIw"),o=ie("k1fw"),l=ie("miYZ"),d=ie("tsqr"),S=ie("9og8"),g=ie("y8nQ"),p=ie("Vl3Y"),w=ie("tJVT"),b=ie("PpiC"),u=ie("nRaC"),f=ie("5RzL"),s=ie("5NDa"),a=ie("5rEg"),T=ie("WmNS"),v=ie.n(T),C=ie("q1tI"),D=ie.n(C),j=ie("9kvl"),z=ie("Ot1p"),V=ie("hxT0"),P=ie.n(V),N=ie("1vsH"),$=ie("m3rI"),re=ie("ErOA"),pe=ie("jrin"),ve=ie("R9oj"),Ae=ie("ECub"),Le=ie("YNHc"),ce=ie.n(Le),ae=ie("4i/N"),de=ie("UESt"),ne=Object(C.createRef)(),se=function(Ye){var Pe=Ye.dataSource,We=Ye.placeholder,Se=Ye.defaultValue,ye=Ye.onChange,xe=Object(C.useState)(!1),le=Object(w.a)(xe,2),ue=le[0],me=le[1],Ee=Object(C.useState)({data:[],objData:{},ids:[]}),we=Object(w.a)(Ee,2),Ie=we[0],$e=we[1],at=Object(C.useState)({}),ht=Object(w.a)(at,2),ut=ht[0],xt=ht[1];Object(C.useEffect)(function(){window.addEventListener("click",function(){me(!1),xt({})})},[]),Object(C.useEffect)(function(){if(Se){var kt={},Dt=[];Se.forEach(function(Tt){var Ut=Tt.sub_discipline,Qt=Object(b.a)(Tt,["sub_discipline"]);Ut&&(kt[Ut.id]=Object(o.a)(Object(o.a)({},Qt),{},{sub_disciplines:[Ut]}),Dt.push(Ut.id))}),$e({ids:Dt,data:Object.values(kt),objData:kt}),ye(Dt)}},[Se]);var Ct=function(){return D.a.createElement("div",{className:ce.a.emptyWrap},D.a.createElement(Ae.a,{image:Ae.a.PRESENTED_IMAGE_SIMPLE}))},st=function(Dt){if(Ie.ids.includes(Dt.id))return!1;var Tt=ut.sub_disciplines,Ut=Object(b.a)(ut,["sub_disciplines"]),Qt=Object(o.a)(Object(o.a)({},Ie.objData),{},Object(pe.a)({},Dt.id,Object(o.a)(Object(o.a)({},Ut),{},{sub_disciplines:[Dt]})));$e({ids:[].concat(Object(U.a)(Ie.ids),[Dt.id]),data:Object.values(Qt),objData:Qt}),ye([].concat(Object(U.a)(Ie.ids),[Dt.id]))},Mt=function(Dt){var Tt=Ie.objData;delete Tt[Dt];var Ut=Ie.ids.filter(function(Qt){return Qt!==Dt});$e({data:Object.values(Tt),objData:Tt,ids:Ut}),ye(Ut)},Lt=45;return ne&&ne.current&&ne.current.clientHeight>45&&(Lt=ne.current.clientHeight+5),D.a.createElement("div",{className:ce.a.cascaderContainer,onClick:function(Dt){Dt.stopPropagation()}},D.a.createElement("div",{ref:ne,className:ce.a.valueWrap,onClick:function(){return me(!ue)}},Ie.data.length===0&&D.a.createElement("span",{className:ce.a.placeholder},We||"\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B"),Ie.data.map(function(kt){return D.a.createElement("div",{className:ce.a.valueItem,key:kt.id},D.a.createElement("span",null,kt.name),D.a.createElement("span",null,"/"),D.a.createElement("span",null,kt.sub_disciplines[0].name),D.a.createElement("span",{onClick:function(Tt){Tt.stopPropagation(),Tt.preventDefault(),Mt(kt.sub_disciplines[0].id)}},D.a.createElement(ae.a,null)))})),ue&&D.a.createElement("div",{className:ce.a.modalWrap,style:{top:Lt}},D.a.createElement("div",{className:ce.a.left},Pe.length===0&&Ct(),Pe.length>0&&Pe.map(function(kt){return D.a.createElement("div",{key:kt.id,onClick:function(){return xt(kt)}},D.a.createElement("span",null,kt.name),D.a.createElement("span",null,D.a.createElement(de.a,null)))})),ut.sub_disciplines&&D.a.createElement("div",{className:ce.a.right},ut.sub_disciplines.length===0&&Ct(),ut.sub_disciplines.length>0&&ut.sub_disciplines.map(function(kt){var Dt=Ie.ids.includes(kt.id);return D.a.createElement("div",{key:kt.id,className:Dt?ce.a.disabled:"",onClick:function(){return st(kt)}},kt.name)}))))},J=se,ee=ie("2qtc"),oe=ie("kLXV"),fe=ie("6UJt"),ke=ie("DFOY"),ge=ie("wd/R"),De=ie.n(ge),Me=ie("jO45"),Ue=ie("jN4g"),Ke=ie("gJ3r"),He=ie("8pgt"),Be=ie.n(He),rt=function(Ye,Pe){return Pe.some(function(We){return We.label.toLowerCase().indexOf(Ye.toLowerCase())>-1})},Oe=a.a.TextArea,Fe=function(Ye){var Pe=Ye.newCourse,We=Ye.globalSetting,Se=Ye.loading,ye=Ye.dispatch,xe=Ye.schoolName,le=Ye.onSuccess,ue=le===void 0?function(){}:le,me=Object(b.a)(Ye,["newCourse","globalSetting","loading","dispatch","schoolName","onSuccess"]),Ee=p.a.useForm(),we=Object(w.a)(Ee,1),Ie=we[0];Object(C.useEffect)(function(){Ie.setFieldsValue({name:xe})},[xe]);var $e=function(){var at=Object(S.a)(v.a.mark(function ht(ut){var xt,Ct,st,Mt,Lt,kt,Dt;return v.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return xt=ut||{},Ct=xt.name,st=xt.city,Mt=st===void 0?[]:st,Lt=xt.address,kt=xt.remarks,Ut.next=3,ye({type:"newCourse/appplySchool",payload:{name:Ct,province:Mt[0],city:Mt[1],address:Lt,remarks:kt}});case 3:Dt=Ut.sent,ye({type:"newCourse/setActionTabs",payload:{}}),Dt&&(d.b.success("\u65B0\u589E\u53D1\u5E03\u5355\u4F4D\u6210\u529F\uFF01"),ue(Ct));case 6:case"end":return Ut.stop()}},ht)}));return function(ut){return at.apply(this,arguments)}}();return D.a.createElement(oe.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Pe.actionTabs.key==="NewCourse-AppplySchool",title:"\u7533\u8BF7\u53D1\u5E03\u5355\u4F4D",width:"600px",footer:null},D.a.createElement(p.a,{className:Be.a.formWrap,form:Ie,labelCol:{span:4},wrapperCol:{span:20},onFinish:$e},D.a.createElement(p.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D\uFF1A",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B66\u6821\u6216\u5DE5\u4F5C\u5355\u4F4D"}]},D.a.createElement(a.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"})),D.a.createElement("div",{className:"".concat(Be.a.flexRow," ").concat(Be.a.example)},D.a.createElement("div",null,"\u793A\u4F8B\uFF1A"),D.a.createElement("div",{className:Be.a.flexColumn},D.a.createElement("div",null,D.a.createElement(Me.a,{style:{color:"rgb(82, 196, 26)"}}),D.a.createElement("span",{className:"font14 ml5"},"\u6B63\u786E\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784")),D.a.createElement("div",null,D.a.createElement(Ue.a,{style:{color:"red"}}),D.a.createElement("span",{className:"font14 ml5"},"\u9519\u8BEF\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784",De()().format("YYYY"),"\u6625")))),D.a.createElement(p.a.Item,{label:"\u5730\u533A\uFF1A",name:"city"},D.a.createElement(ke.a,{allowClear:!0,size:"large",options:Ke.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730",showSearch:{matchInputWidth:!0,filter:rt}})),D.a.createElement(p.a.Item,{label:"\u8BE6\u7EC6\u5730\u5740\uFF1A",name:"address"},D.a.createElement(a.a,{placeholder:"\u8BF7\u586B\u5199\u5B8C\u6574\u7684\u5730\u5740\u4FE1\u606F"})),D.a.createElement(p.a.Item,{label:"\u8BF4\u660E\uFF1A",name:"remarks"},D.a.createElement(Oe,{placeholder:"\u518D\u6B21\u8BF4\u660E\u7279\u522B\u60C5\u51B5\uFF08\u9009\u586B\uFF09"})),D.a.createElement("div",{className:Be.a.footerWrap},D.a.createElement(p.a.Item,null,D.a.createElement(Y.a,{className:"mr5",size:"large",onClick:function(){ye({type:"newCourse/setActionTabs",payload:{}})}},"\u53D6\u6D88"),D.a.createElement(Y.a,{size:"large",type:"primary",htmlType:"submit",loading:Se["newCourse/appplySchool"]},"\u4FDD\u5B58")))))},je=Object(j.a)(function(Qe){var Ye=Qe.newCourse,Pe=Qe.loading,We=Qe.globalSetting;return{newCourse:Ye,globalSetting:We,loading:Pe.effects}})(Fe),Ge=a.a.TextArea,Ve=f.a.TreeNode,ze=function(Ye){var Pe,We,Se=Ye.user,ye=Ye.newCourse,xe=Ye.globalSetting,le=Ye.loading,ue=Ye.dispatch,me=Object(b.a)(Ye,["user","newCourse","globalSetting","loading","dispatch"]),Ee=p.a.useForm(),we=Object(w.a)(Ee,1),Ie=we[0],$e=Object(C.useState)({}),at=Object(w.a)($e,2),ht=at[0],ut=at[1],xt=Object(C.useState)(),Ct=Object(w.a)(xt,2),st=Ct[0],Mt=Ct[1],Lt=Object(C.useRef)(),kt=Object(C.useState)(!0),Dt=Object(w.a)(kt,2),Tt=Dt[0],Ut=Dt[1],Qt=Object(C.useState)(!1),yt=Object(w.a)(Qt,2),pr=yt[0],Bt=yt[1],tr=Object(C.useState)(),ur=Object(w.a)(tr,2),nr=ur[0],vr=ur[1],Nt=Object(C.useState)(!0),ft=Object(w.a)(Nt,2),sr=ft[0],Tr=ft[1],gr=Object(C.useState)(!1),Pt=Object(w.a)(gr,2),yr=Pt[0],dr=Pt[1],qr=Object(C.useState)(!1),qe=Object(w.a)(qr,2),wt=qe[0],zr=qe[1],Ir=Object(C.useState)(-1),Zr=Object(w.a)(Ir,2),Wr=Zr[0],G=Zr[1],c=Object(C.useState)(!0),m=Object(w.a)(c,2),F=m[0],q=m[1],H=Object(C.useState)([]),Ce=Object(w.a)(H,2),Ze=Ce[0],nt=Ce[1],lt=Object(C.useState)([]),Xe=Object(w.a)(lt,2),pt=Xe[0],mt=Xe[1],It=Object(C.useState)([]),lr=Object(w.a)(It,2),$t=lr[0],rr=lr[1],xr=Object(C.useState)([]),Nr=Object(w.a)(xr,2),ir=Nr[0],Xt=Nr[1];Object(C.useEffect)(function(){var jt,vt;wr(),Hr(),Ie.setFieldsValue({school_id:Se.userInfo.user_school}),Lt.current=(jt=me.match.params)===null||jt===void 0?void 0:jt.pathId,Mt(!!Lt.current),Object(N.X)(xe==null||((vt=xe.setting)===null||vt===void 0)?void 0:vt.name),Ie.setFieldsValue({learning_notes_title:"\u8BFE\u7A0B\u987B\u77E5"}),Lt.current&&yn()},[]);var wr=function(){var jt=Object(S.a)(v.a.mark(function vt(){var ot;return v.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Object(re.a)("/api/disciplines.json",{method:"get",params:{source:"subject"}});case 2:ot=Yt.sent,rr(ot.disciplines);case 4:case"end":return Yt.stop()}},vt)}));return function(){return jt.apply(this,arguments)}}(),Hr=function(){var jt=Object(S.a)(v.a.mark(function vt(){var ot;return v.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return q(!0),Yt.next=3,ue({type:"newCourse/getSchoolOption"});case 3:ot=Yt.sent,q(!1),nt(ot==null?void 0:ot.schools),mt(ot==null?void 0:ot.schools);case 7:case"end":return Yt.stop()}},vt)}));return function(){return jt.apply(this,arguments)}}(),ar=function(){var vt,ot;if(me!=null&&(vt=me.location)!==null&&vt!==void 0&&(ot=vt.query)!==null&&ot!==void 0&&ot.username){var Cr,Yt;j.d.push("/users/".concat(me==null||((Cr=me.location)===null||Cr===void 0||((Yt=Cr.query)===null||Yt===void 0))?void 0:Yt.username,"/paths"));return}j.d.push(st?"/paths/".concat(Lt.current):"/paths")},yn=function(){var jt=Object(S.a)(v.a.mark(function vt(){var ot,Cr,Yt,Zt,Ht,br,Ft,cr,zt,Vr,mr,Lr,ln;return v.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:return un.next=2,ue({type:"newCourse/getEditCourseData",payload:{id:Lt.current}});case 2:ot=un.sent,ot&&(Ft={name:ot.name,name_en:ot.name_en,intro:ot.description,content:ot==null||((Cr=ot.toast)===null||Cr===void 0)?void 0:Cr.content,notice:ot.learning_notes,school_id:ot==null?void 0:ot.school,learning_notes_title:ot.learning_notes_title||"\u8BFE\u7A0B\u987B\u77E5"},ot.disciplines&&ot.disciplines.length>0&&Xt(ot.disciplines),Ie.setFieldsValue(Ft),zr(ot==null||((Yt=ot.toast)===null||Yt===void 0)?void 0:Yt.is_open),G(ot==null||((Zt=ot.toast)===null||Zt===void 0)?void 0:Zt.open_num),Ut(ot==null?void 0:ot.cust_seq),Bt(ot==null?void 0:ot.show_spoc),dr(ot==null?void 0:ot.show_history),Tr(ot==null?void 0:ot.show_tag),(ot==null||((Ht=ot.attachments)===null||Ht===void 0)?void 0:Ht.length)>0&&vr([{uid:ot==null||((cr=ot.attachments)===null||cr===void 0||((zt=cr[0])===null||zt===void 0))?void 0:zt.id,name:ot==null||((Vr=ot.attachments)===null||Vr===void 0||((mr=Vr[0])===null||mr===void 0))?void 0:mr.title,response:{id:ot==null||((Lr=ot.attachments)===null||Lr===void 0||((ln=Lr[0])===null||ln===void 0))?void 0:ln.id}}]),ut({name:ot.name,intro:ot.description,notice:ot.learning_notes,content:ot==null||((br=ot.toast)===null||br===void 0)?void 0:br.content}));case 4:case"end":return un.stop()}},vt)}));return function(){return jt.apply(this,arguments)}}(),Ar=function(){var jt=Object(S.a)(v.a.mark(function vt(ot){var Cr,Yt,Zt,Ht,br,Ft,cr,zt,Vr,mr,Lr,ln,pn,un,dn;return v.a.wrap(function(mn){for(;;)switch(mn.prev=mn.next){case 0:if(Zt=ot||{},Ht=Zt.name,br=Zt.intro,Ft=Zt.notice,cr=Zt.name_en,zt=Zt.learning_notes_title,Vr=Zt.sub_discipline_ids,mr=Zt.school_id,Lr=st?"newCourse/editCourse":"newCourse/submitCourse",ln=!1,pn=null,Ze.map(function(cn){mr===cn.name&&(ln=!0,pn=cn.id)}),ln){mn.next=7;break}return mn.abrupt("return",d.b.error("\u672A\u627E\u5230\u5305\u542B'".concat(mr,"'\u7684\u53D1\u5E03\u5355\u4F4D")));case 7:return un={id:Lt.current,name:Ht,name_en:cr,description:br,learning_notes:Ft,cust_seq:Tt,show_spoc:pr,school_id:pn,show_tag:sr,show_history:yr,learning_notes_title:zt,attachment_ids:[nr==null||((Cr=nr[0])===null||Cr===void 0||((Yt=Cr.response)===null||Yt===void 0))?void 0:Yt.id],sub_discipline_ids:Vr,subject_toast_attributes:{is_open:wt,open_num:Wr,content:ot.content}},mn.next=10,ue({type:Lr,payload:Object(o.a)({},un)});case 10:dn=mn.sent,(dn==null?void 0:dn.subject_id)&&j.d.push("/paths/".concat(dn.subject_id));case 12:case"end":return mn.stop()}},vt)}));return function(ot){return jt.apply(this,arguments)}}(),_r=function(){ue({type:"newCourse/setActionTabs",payload:{key:"NewCourse-AppplySchool"}})},Rn=function(vt){Hr(),ut(Object(o.a)({},Ie.getFieldsValue()))};return D.a.createElement("div",{className:P.a.wrap},D.a.createElement("div",{className:P.a.bg},D.a.createElement("div",{className:P.a.crumbs},D.a.createElement("span",null,"\u5B9E\u8DF5\u8BFE\u7A0B"),D.a.createElement("i",{className:"iconfont icon-zhankai1"}),D.a.createElement("b",null,st?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u8DF5\u8BFE\u7A0B")),D.a.createElement("div",{className:P.a.titleWrap},D.a.createElement("span",null,st?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u8DF5\u8BFE\u7A0B"),D.a.createElement("b",{onClick:ar},"\u8FD4\u56DE")),D.a.createElement(p.a,{form:Ie,className:P.a.formWrap,scrollToFirstError:!0,layout:"vertical",colon:!1,onValuesChange:function(){var vt=Ie.getFieldsValue();"school_id"in vt&&mt(Ze.filter(function(ot){return ot.name.includes(vt.school_id)})),ut(Object(o.a)({},vt))},onFinish:Ar},D.a.createElement("div",{className:P.a.fieldWrap},D.a.createElement(p.a.Item,{extra:D.a.createElement("div",{className:"tr c-grey-333 font12 mt3"},"".concat(((Pe=ht.name)===null||Pe===void 0?void 0:Pe.length)||0,"/60")),name:"name",label:"\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0"}]},D.a.createElement(Ge,{maxLength:60,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),D.a.createElement(p.a.Item,{name:"name_en",label:"\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0",rules:[{message:"\u8BF7\u8F93\u5165\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0"}]},D.a.createElement(a.a,{maxLength:200,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A",addonAfter:"".concat(((We=ht.name_en)===null||We===void 0?void 0:We.length)||0,"/200")})),D.a.createElement(p.a.Item,{name:"sub_discipline_ids",label:"\u65B9\u5411&\u8BFE\u7A0B"},D.a.createElement(J,{defaultValue:ir,dataSource:$t,onChange:function(vt){return Ie.setFieldsValue({sub_discipline_ids:vt})}})),D.a.createElement(p.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D",name:"school_id",wrapperCol:{span:24},extra:!F&&ht.school_id&&!(Ze!=null&&Ze.find(function(jt){return jt.name===ht.school_id}))&&D.a.createElement("div",{className:P.a.schoolHintWrap},D.a.createElement("span",{className:P.a.colorCDCDCD},"\u672A\u627E\u5230\u5305\u542B\u201C",ht.school_id,"\u201D\u7684\u53D1\u5E03\u5355\u4F4D\uFF0C"),D.a.createElement("span",{className:"".concat(P.a.color0152d9),onClick:_r},"\u7533\u8BF7\u65B0\u589E")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"}]},D.a.createElement(h.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D",showSearch:!0,size:"large",options:pt==null?void 0:pt.map(function(jt){return{value:jt.name}})}))),D.a.createElement("div",{className:P.a.mdWrap},D.a.createElement(p.a.Item,{name:"intro",label:"\u7B80\u4ECB",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u7B80\u4ECB"},{max:8e3,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u7B80\u4ECB\u6700\u5927\u9650\u52368000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{watch:!0,defaultValue:ht.intro}))),D.a.createElement("div",{className:P.a.mdWrap},D.a.createElement(_.a,{align:"top",className:"mb10 mt10"},D.a.createElement(x.a,null,D.a.createElement("span",{className:"c-red mr10"},"*")),D.a.createElement(x.a,{flex:"1"},D.a.createElement(p.a.Item,{name:"learning_notes_title",label:"",style:{marginBottom:0},rules:[{required:!0,message:"\u8BF7\u8F93\u8BFE\u7A0B\u987B\u77E5\u6807\u9898"},{max:15,message:"\u8BF7\u8F93\u8BFE\u7A0B\u987B\u77E5\u6807\u9898\u6700\u5927\u9650\u523615\u4E2A\u5B57\u7B26"}]},D.a.createElement(a.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165"})))),D.a.createElement(p.a.Item,{name:"notice",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5"},{max:1e4,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{insertTemp:"1",watch:!0,defaultValue:ht.notice}))),D.a.createElement("div",{className:P.a.mdWrap},D.a.createElement("div",{style:{display:"flex",alignItems:"center"}},D.a.createElement(E.a,{checked:wt,style:{marginRight:11,minWidth:32},onChange:function(vt){zr(vt)}}),D.a.createElement("span",{className:P.a.spanText},"\u8BFE\u7A0B\u63D0\u793A",D.a.createElement("span",null,"\uFF08\u8FDB\u5165\u8BFE\u7A0B\u8BE6\u60C5\u9875\uFF0C\u63D0\u793A\u5185\u5BB9\u4EE5\u5F39\u7A97\u7684\u5F62\u5F0F\u8FDB\u884C\u5C55\u793A\uFF09"))),wt&&D.a.createElement(p.a.Item,{style:{marginTop:10},name:"content",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A"},{max:1e4,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{insertTemp:"1",watch:!0,defaultValue:ht.content})),wt&&D.a.createElement("div",{style:{marginTop:20,borderBottom:"1px solid #DBDCE0",paddingBottom:7}},D.a.createElement("label",{style:{color:"#000",marginRight:10}},"\u63D0\u793A\u6B21\u6570"),D.a.createElement(M.a.Group,{value:Wr,onChange:function(vt){G(vt.target.value)}},D.a.createElement(M.a,{className:"c-black",value:-1},"\u6BCF\u6B21"),D.a.createElement(M.a,{className:"ml20 c-black",value:1},"\u4E00\u6B21")))),D.a.createElement("div",{className:P.a.mdWrap,style:{marginTop:25}},D.a.createElement(K.a,{checked:Tt,onChange:function(vt){Ut(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:P.a.spanText},"\u5C55\u793A\u9ED8\u8BA4\u7AE0\u8282\u5E8F\u53F7",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u5219\u6309\u5E8F\u5C55\u793A\u6240\u7AE0\u8282\u5E8F\u53F7\uFF0C\u4E0D\u9009\u4E2D\u5219\u9690\u85CF\u9ED8\u8BA4\u6392\u5E8F\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:pr,onChange:function(vt){return Bt(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:P.a.spanText},"\u81EA\u9009\u5E76\u5C55\u793ASPOC\u8BFE\u5802",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u5219\u7ED9\u51FASPOC\u8BFE\u5802\u5C55\u793A\u533A\u57DF\uFF0C\u8BFE\u7A0B\u521B\u5EFA\u8005/\u5408\u4F5C\u8005\u53EF\u4EE5\u81EA\u4E3B\u6DFB\u52A0\u9700\u8981\u5C55\u793A\u7684\u8BFE\u5802\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:sr,onChange:function(vt){return Tr(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:P.a.spanText},"\u5C55\u793A\u6280\u672F\u6807\u7B7E\u6A21\u5757",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5C55\u793A\u8BFE\u7A0B\u7684\u6280\u80FD\u6807\u7B7E\uFF0C\u4E0D\u9009\u4E2D\u5219\u4E0D\u5C55\u793A\u8BE5\u6A21\u5757\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:yr,onChange:function(vt){return dr(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:P.a.spanText},"\u5C55\u793A\u5386\u53F2\u8BFE\u5802\u6A21\u5757",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5C55\u793A\u8BFE\u7A0B\u7684\u5386\u53F2\u8BFE\u5802\uFF0C\u4E0D\u9009\u4E2D\u5219\u4E0D\u5C55\u793A\u8BE5\u6A21\u5757\uFF09"))),D.a.createElement("br",null),D.a.createElement("div",{className:"mt10"},D.a.createElement("div",{className:"c-black mb10"},"\u81EA\u5B9A\u4E49\u9876\u90E8\u80CC\u666F\u56FE"),D.a.createElement(Z.a,{action:$.a.API_SERVER+"/api/attachments.json",withCredentials:!0,fileList:nr,onChange:function(vt){var ot,Cr=(vt==null?void 0:vt.file.size)/1024/1024<2;if(!((ot=vt.fileList)!==null&&ot!==void 0&&ot.length))return!1;if(!Cr)vr(Object(U.a)(nr));else{var Yt;vr(vt==null||((Yt=vt.fileList)===null||Yt===void 0)?void 0:Yt.slice(-1))}},beforeUpload:function(vt){var ot=vt.type==="image/jpeg"||vt.type==="image/png";if(!ot)return d.b.error("\u53EA\u80FD\u4E0A\u4F20jpg \u6216\u8005png\u56FE\u7247"),!1;var Cr=vt.size/1024/1024<2;return Cr?ot&&Cr:(d.b.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u5927\u4E8E2m"),!1)},onRemove:function(vt){vr([])}},D.a.createElement("div",{className:P.a.aBtn},"\u4E0A\u4F20\u56FE\u7247"),D.a.createElement("span",{style:{color:"#5F6367",pointerEvents:"none"}},"\uFF08\u672C\u9879\u975E\u5FC5\u9700\u3002\u5982\u4E0D\u4E0A\u4F20\uFF0C\u5219\u4F7F\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u56FE\u7247\uFF1B\u5982\u4E0A\u4F20\uFF0C\u8BF7\u9009\u62E9jpg\u3001png\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC72M\uFF0C\u5EFA\u8BAE\u5C3A\u5BF81920*240\u50CF\u7D20\uFF09")))),D.a.createElement("div",{className:P.a.backgroundFa},D.a.createElement("div",{className:P.a.bBtn,onClick:ar},"\u53D6\u6D88"),D.a.createElement(Y.a,{className:P.a.cBtn,onClick:function(){return Ie.submit()},loading:le["newCourse/editCourse"]||le["newCourse/submitCourse"]},"\u63D0\u4EA4 "))),D.a.createElement(je,{schoolName:ht.school_id,onSuccess:Rn})))},Re=tt.default=Object(j.a)(function(Qe){var Ye=Qe.user,Pe=Qe.newCourse,We=Qe.loading,Se=Qe.globalSetting;return{user:Ye,newCourse:Pe,globalSetting:Se,loading:We.effects}})(ze)},XIdC:function(Et,tt,ie){"use strict";var he=ie("rePB"),Y=ie("ODXe"),O=ie("Ff2n"),Z=ie("q1tI"),U=ie.n(Z),I=ie("TSYQ"),K=ie.n(I),B=ie("6cGi"),M=ie("4IlW"),R=Z.forwardRef(function(E,L){var _,A=E.prefixCls,x=A===void 0?"rc-switch":A,y=E.className,h=E.checked,o=E.defaultChecked,l=E.disabled,d=E.loadingIcon,S=E.checkedChildren,g=E.unCheckedChildren,p=E.onClick,w=E.onChange,b=E.onKeyDown,u=Object(O.a)(E,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),f=Object(B.a)(!1,{value:h,defaultValue:o}),s=Object(Y.a)(f,2),a=s[0],T=s[1];function v(z,V){var P=a;return l||(P=z,T(P),w==null||w(P,V)),P}function C(z){z.which===M.a.LEFT?v(!1,z):z.which===M.a.RIGHT&&v(!0,z),b==null||b(z)}function D(z){var V=v(!a,z);p==null||p(V,z)}var j=K()(x,y,(_={},Object(he.a)(_,"".concat(x,"-checked"),a),Object(he.a)(_,"".concat(x,"-disabled"),l),_));return Z.createElement("button",Object.assign({},u,{type:"button",role:"switch","aria-checked":a,disabled:l,className:j,ref:L,onKeyDown:C,onClick:D}),d,Z.createElement("span",{className:"".concat(x,"-inner")},a?S:g))});R.displayName="Switch",tt.a=R},Y1PL:function(Et,tt,ie){"use strict";ie.r(tt),ie.d(tt,"ResizableTextArea",function(){return pe});var he=ie("wx14"),Y=ie("1OyB"),O=ie("vuIU"),Z=ie("Ji7U"),U=ie("LK+K"),I=ie("q1tI"),K=ie("VTBJ"),B=ie("rePB"),M=ie("Zm9Q"),R=ie("Kwbf"),E=ie("c+Xe"),L=ie("m+aA"),_=ie("bdgK"),A=new Map;function x(Le){Le.forEach(function(ce){var ae,de=ce.target;(ae=A.get(de))===null||ae===void 0||ae.forEach(function(ne){return ne(de)})})}var y=new _.default(x),h=null,o=null;function l(Le,ce){A.has(Le)||(A.set(Le,new Set),y.observe(Le)),A.get(Le).add(ce)}function d(Le,ce){A.has(Le)&&(A.get(Le).delete(ce),A.get(Le).size||(y.unobserve(Le),A.delete(Le)))}var S=function(Le){Object(Z.a)(ae,Le);var ce=Object(U.a)(ae);function ae(){return Object(Y.a)(this,ae),ce.apply(this,arguments)}return Object(O.a)(ae,[{key:"render",value:function(){return this.props.children}}]),ae}(I.Component),g=I.createContext(null);function p(Le){var ce=Le.children,ae=Le.onBatchResize,de=I.useRef(0),ne=I.useRef([]),se=I.useContext(g),J=I.useCallback(function(ee,oe,fe){de.current+=1;var ke=de.current;ne.current.push({size:ee,element:oe,data:fe}),Promise.resolve().then(function(){ke===de.current&&(ae==null||ae(ne.current),ne.current=[])}),se==null||se(ee,oe,fe)},[ae,se]);return I.createElement(g.Provider,{value:J},ce)}function w(Le){var ce=Le.children,ae=Le.disabled,de=I.useRef(null),ne=I.useRef(null),se=I.useContext(g),J=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ee=I.isValidElement(ce)&&Object(E.c)(ce),oe=ee?ce.ref:null,fe=I.useMemo(function(){return Object(E.a)(oe,de)},[oe,de]),ke=I.useRef(Le);ke.current=Le;var ge=I.useCallback(function(De){var Me=ke.current,Ue=Me.onResize,Ke=Me.data,He=De.getBoundingClientRect(),Be=He.width,rt=He.height,Oe=De.offsetWidth,Fe=De.offsetHeight,je=Math.floor(Be),Ge=Math.floor(rt);if(J.current.width!==je||J.current.height!==Ge||J.current.offsetWidth!==Oe||J.current.offsetHeight!==Fe){var Ve={width:je,height:Ge,offsetWidth:Oe,offsetHeight:Fe};J.current=Ve;var ze=Oe===Math.round(Be)?Be:Oe,Re=Fe===Math.round(rt)?rt:Fe,Qe=Object(K.a)(Object(K.a)({},Ve),{},{offsetWidth:ze,offsetHeight:Re});se==null||se(Qe,De,Ke),Ue&&Promise.resolve().then(function(){Ue(Qe,De)})}},[]);return I.useEffect(function(){var De=Object(L.a)(de.current)||Object(L.a)(ne.current);return De&&!ae&&l(De,ge),function(){return d(De,ge)}},[de.current,ae]),I.createElement(S,{ref:ne},ee?I.cloneElement(ce,{ref:fe}):ce)}var b="rc-observer-key";function u(Le){var ce=Le.children,ae=Object(M.a)(ce);return ae.map(function(de,ne){var se=(de==null?void 0:de.key)||"".concat(b,"-").concat(ne);return I.createElement(w,Object(he.a)({},Le,{key:se}),de)})}u.Collection=p;var f=u,s=ie("bT9E"),a=ie("TSYQ"),T=ie.n(a),v=`
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
`,C=["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"],D={},j;function z(Le){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=Le.getAttribute("id")||Le.getAttribute("data-reactid")||Le.getAttribute("name");if(ce&&D[ae])return D[ae];var de=window.getComputedStyle(Le),ne=de.getPropertyValue("box-sizing")||de.getPropertyValue("-moz-box-sizing")||de.getPropertyValue("-webkit-box-sizing"),se=parseFloat(de.getPropertyValue("padding-bottom"))+parseFloat(de.getPropertyValue("padding-top")),J=parseFloat(de.getPropertyValue("border-bottom-width"))+parseFloat(de.getPropertyValue("border-top-width")),ee=C.map(function(fe){return"".concat(fe,":").concat(de.getPropertyValue(fe))}).join(";"),oe={sizingStyle:ee,paddingSize:se,borderSize:J,boxSizing:ne};return ce&&ae&&(D[ae]=oe),oe}function V(Le){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),Le.getAttribute("wrap")?j.setAttribute("wrap",Le.getAttribute("wrap")):j.removeAttribute("wrap");var ne=z(Le,ce),se=ne.paddingSize,J=ne.borderSize,ee=ne.boxSizing,oe=ne.sizingStyle;j.setAttribute("style","".concat(oe,";").concat(v)),j.value=Le.value||Le.placeholder||"";var fe=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,ge=j.scrollHeight,De;if(ee==="border-box"?ge+=J:ee==="content-box"&&(ge-=se),ae!==null||de!==null){j.value=" ";var Me=j.scrollHeight-se;ae!==null&&(fe=Me*ae,ee==="border-box"&&(fe=fe+se+J),ge=Math.max(fe,ge)),de!==null&&(ke=Me*de,ee==="border-box"&&(ke=ke+se+J),De=ge>ke?"":"hidden",ge=Math.min(ke,ge))}return{height:ge,minHeight:fe,maxHeight:ke,overflowY:De,resize:"none"}}var P=ie("Gytx"),N=ie.n(P),$;(function(Le){Le[Le.NONE=0]="NONE",Le[Le.RESIZING=1]="RESIZING",Le[Le.RESIZED=2]="RESIZED"})($||($={}));var re=function(Le){Object(Z.a)(ae,Le);var ce=Object(U.a)(ae);function ae(de){var ne;return Object(Y.a)(this,ae),ne=ce.call(this,de),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(se){ne.textArea=se},ne.handleResize=function(se){var J=ne.state.resizeStatus,ee=ne.props,oe=ee.autoSize,fe=ee.onResize;if(J!==$.NONE)return;typeof fe=="function"&&fe(se),oe&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var se=ne.props.autoSize;if(!se||!ne.textArea)return;var J=se.minRows,ee=se.maxRows,oe=V(ne.textArea,!1,J,ee);ne.setState({textareaStyles:oe,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:$.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:$.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var se=ne.props,J=se.prefixCls,ee=J===void 0?"rc-textarea":J,oe=se.autoSize,fe=se.onResize,ke=se.className,ge=se.disabled,De=ne.state,Me=De.textareaStyles,Ue=De.resizeStatus,Ke=Object(s.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=T()(ee,ke,Object(B.a)({},"".concat(ee,"-disabled"),ge));"value"in Ke&&(Ke.value=Ke.value||"");var Be=Object(K.a)(Object(K.a)(Object(K.a)({},ne.props.style),Me),Ue===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(f,{onResize:ne.handleResize,disabled:!(oe||fe)},I.createElement("textarea",Object(he.a)({},Ke,{className:He,style:Be,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:$.NONE},ne}return Object(O.a)(ae,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!N()(ne.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 ne=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,se)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ae}(I.Component),pe=re,ve=function(Le){Object(Z.a)(ae,Le);var ce=Object(U.a)(ae);function ae(de){var ne;Object(Y.a)(this,ae),ne=ce.call(this,de),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function(J){ne.resizableTextArea=J},ne.handleChange=function(J){var ee=ne.props.onChange;ne.setValue(J.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ee&&ee(J)},ne.handleKeyDown=function(J){var ee=ne.props,oe=ee.onPressEnter,fe=ee.onKeyDown;J.keyCode===13&&oe&&oe(J),fe&&fe(J)};var se=typeof de.value=="undefined"||de.value===null?de.defaultValue:de.value;return ne.state={value:se},ne}return Object(O.a)(ae,[{key:"setValue",value:function(ne,se){"value"in this.props||this.setState({value:ne},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(pe,Object(he.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),ae}(I.Component),Ae=tt.default=ve},YNHc:function(Et,tt,ie){Et.exports={cascaderContainer:"cascaderContainer___3XtEo",valueWrap:"valueWrap___3ID8a",valueItem:"valueItem___yKIZs",placeholder:"placeholder___MxiA7",modalWrap:"modalWrap___1ge9B",left:"left___10iyZ",right:"right___KVnmg",disabled:"disabled___2c8qt",emptyWrap:"emptyWrap___dYSJ0"}},ZpRC:function(Et,tt,ie){"use strict";function he(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function Y(E,L){return(!L||E!=="hidden")&&E!=="visible"&&E!=="clip"}function O(E,L){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var _=getComputedStyle(E,null);return Y(_.overflowY,L)||Y(_.overflowX,L)||function(A){var x=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(h){return null}}(A);return!!x&&(x.clientHeight<A.scrollHeight||x.clientWidth<A.scrollWidth)}(E)}return!1}function Z(E,L,_,A,x,y,h,o){return y<E&&h>L||y>E&&h<L?0:y<=E&&o<=_||h>=L&&o>=_?y-E-A:h>L&&o<_||y<E&&o>_?h-L+x:0}var U=function(E,L){var _=window,A=L.scrollMode,x=L.block,y=L.inline,h=L.boundary,o=L.skipOverflowHiddenElements,l=typeof h=="function"?h:function(Me){return Me!==h};if(!he(E))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,S=[],g=E;he(g)&&l(g);){if((g=g.parentElement)===d){S.push(g);break}g!=null&&g===document.body&&O(g)&&!O(document.documentElement)||g!=null&&O(g,o)&&S.push(g)}for(var p=_.visualViewport?_.visualViewport.width:innerWidth,w=_.visualViewport?_.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,u=window.scrollY||pageYOffset,f=E.getBoundingClientRect(),s=f.height,a=f.width,T=f.top,v=f.right,C=f.bottom,D=f.left,j=x==="start"||x==="nearest"?T:x==="end"?C:T+s/2,z=y==="center"?D+a/2:y==="end"?v:D,V=[],P=0;P<S.length;P++){var N=S[P],$=N.getBoundingClientRect(),re=$.height,pe=$.width,ve=$.top,Ae=$.right,Le=$.bottom,ce=$.left;if(A==="if-needed"&&T>=0&&D>=0&&C<=w&&v<=p&&T>=ve&&C<=Le&&D>=ce&&v<=Ae)return V;var ae=getComputedStyle(N),de=parseInt(ae.borderLeftWidth,10),ne=parseInt(ae.borderTopWidth,10),se=parseInt(ae.borderRightWidth,10),J=parseInt(ae.borderBottomWidth,10),ee=0,oe=0,fe="offsetWidth"in N?N.offsetWidth-N.clientWidth-de-se:0,ke="offsetHeight"in N?N.offsetHeight-N.clientHeight-ne-J:0;if(d===N)ee=x==="start"?j:x==="end"?j-w:x==="nearest"?Z(u,u+w,w,ne,J,u+j,u+j+s,s):j-w/2,oe=y==="start"?z:y==="center"?z-p/2:y==="end"?z-p:Z(b,b+p,p,de,se,b+z,b+z+a,a),ee=Math.max(0,ee+u),oe=Math.max(0,oe+b);else{ee=x==="start"?j-ve-ne:x==="end"?j-Le+J+ke:x==="nearest"?Z(ve,Le,re,ne,J+ke,j,j+s,s):j-(ve+re/2)+ke/2,oe=y==="start"?z-ce-de:y==="center"?z-(ce+pe/2)+fe/2:y==="end"?z-Ae+se+fe:Z(ce,Ae,pe,de,se+fe,z,z+a,a);var ge=N.scrollLeft,De=N.scrollTop;j+=De-(ee=Math.max(0,Math.min(De+ee,N.scrollHeight-re+ke))),z+=ge-(oe=Math.max(0,Math.min(ge+oe,N.scrollWidth-pe+fe)))}V.push({el:N,top:ee,left:oe})}return V};function I(E){return E===Object(E)&&Object.keys(E).length!==0}function K(E,L){L===void 0&&(L="auto");var _="scrollBehavior"in document.body.style;E.forEach(function(A){var x=A.el,y=A.top,h=A.left;x.scroll&&_?x.scroll({top:y,left:h,behavior:L}):(x.scrollTop=y,x.scrollLeft=h)})}function B(E){return E===!1?{block:"end",inline:"nearest"}:I(E)?E:{block:"start",inline:"nearest"}}function M(E,L){var _=!E.ownerDocument.documentElement.contains(E);if(I(L)&&typeof L.behavior=="function")return L.behavior(_?[]:U(E,L));if(_)return;var A=B(L);return K(U(E,A),A.behavior)}var R=tt.a=M},Zss7:function(Et,tt,ie){var he;(function(Y){var O=/^\s+/,Z=/\s+$/,U=0,I=Y.round,K=Y.min,B=Y.max,M=Y.random;function R(J,ee){if(J=J||"",ee=ee||{},J instanceof R)return J;if(!(this instanceof R))return new R(J,ee);var oe=E(J);this._originalInput=J,this._r=oe.r,this._g=oe.g,this._b=oe.b,this._a=oe.a,this._roundA=I(100*this._a)/100,this._format=ee.format||oe.format,this._gradientType=ee.gradientType,this._r<1&&(this._r=I(this._r)),this._g<1&&(this._g=I(this._g)),this._b<1&&(this._b=I(this._b)),this._ok=oe.ok,this._tc_id=U++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ee,oe,fe,ke,ge,De;return ee=J.r/255,oe=J.g/255,fe=J.b/255,ee<=.03928?ke=ee/12.92:ke=Y.pow((ee+.055)/1.055,2.4),oe<=.03928?ge=oe/12.92:ge=Y.pow((oe+.055)/1.055,2.4),fe<=.03928?De=fe/12.92:De=Y.pow((fe+.055)/1.055,2.4),.2126*ke+.7152*ge+.0722*De},setAlpha:function(J){return this._a=V(J),this._roundA=I(100*this._a)/100,this},toHsv:function(){var J=x(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=x(this._r,this._g,this._b),ee=I(J.h*360),oe=I(J.s*100),fe=I(J.v*100);return this._a==1?"hsv("+ee+", "+oe+"%, "+fe+"%)":"hsva("+ee+", "+oe+"%, "+fe+"%, "+this._roundA+")"},toHsl:function(){var J=_(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=_(this._r,this._g,this._b),ee=I(J.h*360),oe=I(J.s*100),fe=I(J.l*100);return this._a==1?"hsl("+ee+", "+oe+"%, "+fe+"%)":"hsla("+ee+", "+oe+"%, "+fe+"%, "+this._roundA+")"},toHex:function(J){return h(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:I(this._r),g:I(this._g),b:I(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+I(this._r)+", "+I(this._g)+", "+I(this._b)+")":"rgba("+I(this._r)+", "+I(this._g)+", "+I(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:I(P(this._r,255)*100)+"%",g:I(P(this._g,255)*100)+"%",b:I(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+I(P(this._r,255)*100)+"%, "+I(P(this._g,255)*100)+"%, "+I(P(this._b,255)*100)+"%)":"rgba("+I(P(this._r,255)*100)+"%, "+I(P(this._g,255)*100)+"%, "+I(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:j[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ee="#"+l(this._r,this._g,this._b,this._a),oe=ee,fe=this._gradientType?"GradientType = 1, ":"";if(J){var ke=R(J);oe="#"+l(ke._r,ke._g,ke._b,ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+fe+"startColorstr="+ee+",endColorstr="+oe+")"},toString:function(J){var ee=!!J;J=J||this._format;var oe=!1,fe=this._a<1&&this._a>=0,ke=!ee&&fe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return ke?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(oe=this.toRgbString()),J==="prgb"&&(oe=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(oe=this.toHexString()),J==="hex3"&&(oe=this.toHexString(!0)),J==="hex4"&&(oe=this.toHex8String(!0)),J==="hex8"&&(oe=this.toHex8String()),J==="name"&&(oe=this.toName()),J==="hsl"&&(oe=this.toHslString()),J==="hsv"&&(oe=this.toHsvString()),oe||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(J,ee){var oe=J.apply(null,[this].concat([].slice.call(ee)));return this._r=oe._r,this._g=oe._g,this._b=oe._b,this.setAlpha(oe._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(u,arguments)},_applyCombination:function(J,ee){return J.apply(null,[this].concat([].slice.call(ee)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(C,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(s,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(J,ee){if(typeof J=="object"){var oe={};for(var fe in J)J.hasOwnProperty(fe)&&(fe==="a"?oe[fe]=J[fe]:oe[fe]=Ae(J[fe]));J=oe}return R(J,ee)};function E(J){var ee={r:0,g:0,b:0},oe=1,fe=null,ke=null,ge=null,De=!1,Me=!1;return typeof J=="string"&&(J=ne(J)),typeof J=="object"&&(de(J.r)&&de(J.g)&&de(J.b)?(ee=L(J.r,J.g,J.b),De=!0,Me=String(J.r).substr(-1)==="%"?"prgb":"rgb"):de(J.h)&&de(J.s)&&de(J.v)?(fe=Ae(J.s),ke=Ae(J.v),ee=y(J.h,fe,ke),De=!0,Me="hsv"):de(J.h)&&de(J.s)&&de(J.l)&&(fe=Ae(J.s),ge=Ae(J.l),ee=A(J.h,fe,ge),De=!0,Me="hsl"),J.hasOwnProperty("a")&&(oe=J.a)),oe=V(oe),{ok:De,format:J.format||Me,r:K(255,B(ee.r,0)),g:K(255,B(ee.g,0)),b:K(255,B(ee.b,0)),a:oe}}function L(J,ee,oe){return{r:P(J,255)*255,g:P(ee,255)*255,b:P(oe,255)*255}}function _(J,ee,oe){J=P(J,255),ee=P(ee,255),oe=P(oe,255);var fe=B(J,ee,oe),ke=K(J,ee,oe),ge,De,Me=(fe+ke)/2;if(fe==ke)ge=De=0;else{var Ue=fe-ke;De=Me>.5?Ue/(2-fe-ke):Ue/(fe+ke);switch(fe){case J:ge=(ee-oe)/Ue+(ee<oe?6:0);break;case ee:ge=(oe-J)/Ue+2;break;case oe:ge=(J-ee)/Ue+4;break}ge/=6}return{h:ge,s:De,l:Me}}function A(J,ee,oe){var fe,ke,ge;J=P(J,360),ee=P(ee,100),oe=P(oe,100);function De(Ke,He,Be){return Be<0&&(Be+=1),Be>1&&(Be-=1),Be<1/6?Ke+(He-Ke)*6*Be:Be<1/2?He:Be<2/3?Ke+(He-Ke)*(2/3-Be)*6:Ke}if(ee===0)fe=ke=ge=oe;else{var Me=oe<.5?oe*(1+ee):oe+ee-oe*ee,Ue=2*oe-Me;fe=De(Ue,Me,J+1/3),ke=De(Ue,Me,J),ge=De(Ue,Me,J-1/3)}return{r:fe*255,g:ke*255,b:ge*255}}function x(J,ee,oe){J=P(J,255),ee=P(ee,255),oe=P(oe,255);var fe=B(J,ee,oe),ke=K(J,ee,oe),ge,De,Me=fe,Ue=fe-ke;if(De=fe===0?0:Ue/fe,fe==ke)ge=0;else{switch(fe){case J:ge=(ee-oe)/Ue+(ee<oe?6:0);break;case ee:ge=(oe-J)/Ue+2;break;case oe:ge=(J-ee)/Ue+4;break}ge/=6}return{h:ge,s:De,v:Me}}function y(J,ee,oe){J=P(J,360)*6,ee=P(ee,100),oe=P(oe,100);var fe=Y.floor(J),ke=J-fe,ge=oe*(1-ee),De=oe*(1-ke*ee),Me=oe*(1-(1-ke)*ee),Ue=fe%6,Ke=[oe,De,ge,ge,Me,oe][Ue],He=[Me,oe,oe,De,ge,ge][Ue],Be=[ge,ge,Me,oe,oe,De][Ue];return{r:Ke*255,g:He*255,b:Be*255}}function h(J,ee,oe,fe){var ke=[ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(oe).toString(16))];return fe&&ke[0].charAt(0)==ke[0].charAt(1)&&ke[1].charAt(0)==ke[1].charAt(1)&&ke[2].charAt(0)==ke[2].charAt(1)?ke[0].charAt(0)+ke[1].charAt(0)+ke[2].charAt(0):ke.join("")}function o(J,ee,oe,fe,ke){var ge=[ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(oe).toString(16)),ve(Le(fe))];return ke&&ge[0].charAt(0)==ge[0].charAt(1)&&ge[1].charAt(0)==ge[1].charAt(1)&&ge[2].charAt(0)==ge[2].charAt(1)&&ge[3].charAt(0)==ge[3].charAt(1)?ge[0].charAt(0)+ge[1].charAt(0)+ge[2].charAt(0)+ge[3].charAt(0):ge.join("")}function l(J,ee,oe,fe){var ke=[ve(Le(fe)),ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(oe).toString(16))];return ke.join("")}R.equals=function(J,ee){return!J||!ee?!1:R(J).toRgbString()==R(ee).toRgbString()},R.random=function(){return R.fromRatio({r:M(),g:M(),b:M()})};function d(J,ee){ee=ee===0?0:ee||10;var oe=R(J).toHsl();return oe.s-=ee/100,oe.s=N(oe.s),R(oe)}function S(J,ee){ee=ee===0?0:ee||10;var oe=R(J).toHsl();return oe.s+=ee/100,oe.s=N(oe.s),R(oe)}function g(J){return R(J).desaturate(100)}function p(J,ee){ee=ee===0?0:ee||10;var oe=R(J).toHsl();return oe.l+=ee/100,oe.l=N(oe.l),R(oe)}function w(J,ee){ee=ee===0?0:ee||10;var oe=R(J).toRgb();return oe.r=B(0,K(255,oe.r-I(255*-(ee/100)))),oe.g=B(0,K(255,oe.g-I(255*-(ee/100)))),oe.b=B(0,K(255,oe.b-I(255*-(ee/100)))),R(oe)}function b(J,ee){ee=ee===0?0:ee||10;var oe=R(J).toHsl();return oe.l-=ee/100,oe.l=N(oe.l),R(oe)}function u(J,ee){var oe=R(J).toHsl(),fe=(oe.h+ee)%360;return oe.h=fe<0?360+fe:fe,R(oe)}function f(J){var ee=R(J).toHsl();return ee.h=(ee.h+180)%360,R(ee)}function s(J){var ee=R(J).toHsl(),oe=ee.h;return[R(J),R({h:(oe+120)%360,s:ee.s,l:ee.l}),R({h:(oe+240)%360,s:ee.s,l:ee.l})]}function a(J){var ee=R(J).toHsl(),oe=ee.h;return[R(J),R({h:(oe+90)%360,s:ee.s,l:ee.l}),R({h:(oe+180)%360,s:ee.s,l:ee.l}),R({h:(oe+270)%360,s:ee.s,l:ee.l})]}function T(J){var ee=R(J).toHsl(),oe=ee.h;return[R(J),R({h:(oe+72)%360,s:ee.s,l:ee.l}),R({h:(oe+216)%360,s:ee.s,l:ee.l})]}function v(J,ee,oe){ee=ee||6,oe=oe||30;var fe=R(J).toHsl(),ke=360/oe,ge=[R(J)];for(fe.h=(fe.h-(ke*ee>>1)+720)%360;--ee;)fe.h=(fe.h+ke)%360,ge.push(R(fe));return ge}function C(J,ee){ee=ee||6;for(var oe=R(J).toHsv(),fe=oe.h,ke=oe.s,ge=oe.v,De=[],Me=1/ee;ee--;)De.push(R({h:fe,s:ke,v:ge})),ge=(ge+Me)%1;return De}R.mix=function(J,ee,oe){oe=oe===0?0:oe||50;var fe=R(J).toRgb(),ke=R(ee).toRgb(),ge=oe/100,De={r:(ke.r-fe.r)*ge+fe.r,g:(ke.g-fe.g)*ge+fe.g,b:(ke.b-fe.b)*ge+fe.b,a:(ke.a-fe.a)*ge+fe.a};return R(De)},R.readability=function(J,ee){var oe=R(J),fe=R(ee);return(Y.max(oe.getLuminance(),fe.getLuminance())+.05)/(Y.min(oe.getLuminance(),fe.getLuminance())+.05)},R.isReadable=function(J,ee,oe){var fe=R.readability(J,ee),ke,ge;ge=!1,ke=se(oe);switch(ke.level+ke.size){case"AAsmall":case"AAAlarge":ge=fe>=4.5;break;case"AAlarge":ge=fe>=3;break;case"AAAsmall":ge=fe>=7;break}return ge},R.mostReadable=function(J,ee,oe){var fe=null,ke=0,ge,De,Me,Ue;oe=oe||{},De=oe.includeFallbackColors,Me=oe.level,Ue=oe.size;for(var Ke=0;Ke<ee.length;Ke++)ge=R.readability(J,ee[Ke]),ge>ke&&(ke=ge,fe=R(ee[Ke]));return R.isReadable(J,fe,{level:Me,size:Ue})||!De?fe:(oe.includeFallbackColors=!1,R.mostReadable(J,["#fff","#000"],oe))};var D=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},j=R.hexNames=z(D);function z(J){var ee={};for(var oe in J)J.hasOwnProperty(oe)&&(ee[J[oe]]=oe);return ee}function V(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function P(J,ee){re(J)&&(J="100%");var oe=pe(J);return J=K(ee,B(0,parseFloat(J))),oe&&(J=parseInt(J*ee,10)/100),Y.abs(J-ee)<1e-6?1:J%ee/parseFloat(ee)}function N(J){return K(1,B(0,J))}function $(J){return parseInt(J,16)}function re(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function pe(J){return typeof J=="string"&&J.indexOf("%")!=-1}function ve(J){return J.length==1?"0"+J:""+J}function Ae(J){return J<=1&&(J=J*100+"%"),J}function Le(J){return Y.round(parseFloat(J)*255).toString(16)}function ce(J){return $(J)/255}var ae=function(){var J="[-\\+]?\\d+%?",ee="[-\\+]?\\d*\\.\\d+%?",oe="(?:"+ee+")|(?:"+J+")",fe="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?",ke="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?";return{CSS_UNIT:new RegExp(oe),rgb:new RegExp("rgb"+fe),rgba:new RegExp("rgba"+ke),hsl:new RegExp("hsl"+fe),hsla:new RegExp("hsla"+ke),hsv:new RegExp("hsv"+fe),hsva:new RegExp("hsva"+ke),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function de(J){return!!ae.CSS_UNIT.exec(J)}function ne(J){J=J.replace(O,"").replace(Z,"").toLowerCase();var ee=!1;if(D[J])J=D[J],ee=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var oe;return(oe=ae.rgb.exec(J))?{r:oe[1],g:oe[2],b:oe[3]}:(oe=ae.rgba.exec(J))?{r:oe[1],g:oe[2],b:oe[3],a:oe[4]}:(oe=ae.hsl.exec(J))?{h:oe[1],s:oe[2],l:oe[3]}:(oe=ae.hsla.exec(J))?{h:oe[1],s:oe[2],l:oe[3],a:oe[4]}:(oe=ae.hsv.exec(J))?{h:oe[1],s:oe[2],v:oe[3]}:(oe=ae.hsva.exec(J))?{h:oe[1],s:oe[2],v:oe[3],a:oe[4]}:(oe=ae.hex8.exec(J))?{r:$(oe[1]),g:$(oe[2]),b:$(oe[3]),a:ce(oe[4]),format:ee?"name":"hex8"}:(oe=ae.hex6.exec(J))?{r:$(oe[1]),g:$(oe[2]),b:$(oe[3]),format:ee?"name":"hex"}:(oe=ae.hex4.exec(J))?{r:$(oe[1]+""+oe[1]),g:$(oe[2]+""+oe[2]),b:$(oe[3]+""+oe[3]),a:ce(oe[4]+""+oe[4]),format:ee?"name":"hex8"}:(oe=ae.hex3.exec(J))?{r:$(oe[1]+""+oe[1]),g:$(oe[2]+""+oe[2]),b:$(oe[3]+""+oe[3]),format:ee?"name":"hex"}:!1}function se(J){var ee,oe;return J=J||{level:"AA",size:"small"},ee=(J.level||"AA").toUpperCase(),oe=(J.size||"small").toLowerCase(),ee!=="AA"&&ee!=="AAA"&&(ee="AA"),oe!=="small"&&oe!=="large"&&(oe="small"),{level:ee,size:oe}}Et.exports?Et.exports=R:!(he=function(){return R}.call(tt,ie,tt,Et),he!==void 0&&(Et.exports=he))})(Math)},bT9E:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return Y});var he=ie("VTBJ");function Y(O,Z){var U=Object(he.a)({},O);return Array.isArray(Z)&&Z.forEach(function(I){delete U[I]}),U}},c5Ni:function(Et,tt,ie){},dejd:function(Et,tt,ie){},dmUQ:function(Et,tt,ie){"use strict";var he=ie("Ff2n"),Y=ie("rePB"),O=ie("1OyB"),Z=ie("vuIU"),U=ie("Ji7U"),I=ie("md7G"),K=ie("foSv"),B=ie("q1tI"),M=ie.n(B),R=ie("TSYQ"),E=ie.n(R),L=ie("4IlW");function _(s,a){var T=Object.keys(s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);a&&(v=v.filter(function(C){return Object.getOwnPropertyDescriptor(s,C).enumerable})),T.push.apply(T,v)}return T}function A(s){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?_(Object(T),!0).forEach(function(v){Object(Y.a)(s,v,T[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(T)):_(Object(T)).forEach(function(v){Object.defineProperty(s,v,Object.getOwnPropertyDescriptor(T,v))})}return s}function x(s){var a=y();return function(){var v=Object(K.a)(s),C;if(a){var D=Object(K.a)(this).constructor;C=Reflect.construct(v,arguments,D)}else C=v.apply(this,arguments);return Object(I.a)(this,C)}}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(s){return!1}}function h(){}function o(s){s.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,S=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},w=function(a,T){return T===a||typeof T=="number"&&typeof a=="number"&&isNaN(T)&&isNaN(a)},b=function(s){Object(U.a)(T,s);var a=x(T);function T(v){var C;Object(O.a)(this,T),C=a.call(this,v),C.onKeyDown=function(z){var V=C.props,P=V.onKeyDown,N=V.onPressEnter;if(z.keyCode===L.a.UP){var $=C.getRatio(z);C.up(z,$,null),C.stop()}else if(z.keyCode===L.a.DOWN){var re=C.getRatio(z);C.down(z,re,null),C.stop()}else z.keyCode===L.a.ENTER&&N&&N(z);if(C.recordCursorPosition(),C.lastKeyCode=z.keyCode,P){for(var pe=arguments.length,ve=new Array(pe>1?pe-1:0),Ae=1;Ae<pe;Ae++)ve[Ae-1]=arguments[Ae];P.apply(void 0,[z].concat(ve))}},C.onKeyUp=function(z){var V=C.props.onKeyUp;if(C.stop(),C.recordCursorPosition(),V){for(var P=arguments.length,N=new Array(P>1?P-1:0),$=1;$<P;$++)N[$-1]=arguments[$];V.apply(void 0,[z].concat(N))}},C.onChange=function(z){var V=C.props.onChange;C.state.focused&&(C.inputting=!0),C.rawInput=C.props.parser(C.getValueFromEvent(z)),C.setState({inputValue:C.rawInput}),V(C.toNumber(C.rawInput))},C.onMouseUp=function(){var z=C.props.onMouseUp;C.recordCursorPosition(),z&&z.apply(void 0,arguments)},C.onFocus=function(){var z;C.setState({focused:!0}),(z=C.props).onFocus.apply(z,arguments)},C.onBlur=function(){var z=C.props.onBlur;C.inputting=!1,C.setState({focused:!1});var V=C.getCurrentValidValue(C.state.inputValue),P=C.setValue(V,h);if(z){var N=C.input.value,$=C.getInputDisplayValue({focus:!1,value:P});C.input.value=$&&Number($),z.apply(void 0,arguments),C.input.value=N}},C.getRatio=function(z){var V=1;return z.metaKey||z.ctrlKey?V=.1:z.shiftKey&&(V=10),V},C.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},C.getPrecision=function(z){if(p(C.props.precision))return C.props.precision;var V=String(z);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var P=0;return V.indexOf(".")>=0&&(P=V.length-V.indexOf(".")-1),P},C.getInputDisplayValue=function(z){var V=z||C.state,P=V.focused,N=V.inputValue,$=V.value,re;P?re=N:re=C.toPrecisionAsStep($),re==null&&(re="");var pe=C.formatWrapper(re);return p(C.props.decimalSeparator)&&(pe=pe.toString().replace(".",C.props.decimalSeparator)),pe},C.recordCursorPosition=function(){try{C.cursorStart=C.input.selectionStart,C.cursorEnd=C.input.selectionEnd,C.currentValue=C.input.value,C.cursorBefore=C.input.value.substring(0,C.cursorStart),C.cursorAfter=C.input.value.substring(C.cursorEnd)}catch(z){}},C.restoreByAfter=function(z){if(z===void 0)return!1;var V=C.input.value,P=V.lastIndexOf(z);if(P===-1)return!1;var N=C.cursorBefore.length;return C.lastKeyCode===L.a.DELETE&&C.cursorBefore.charAt(N-1)===z[0]?(C.fixCaret(N,N),!0):P+z.length===V.length?(C.fixCaret(P,P),!0):!1},C.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(V,P){var N=z.substring(P);return C.restoreByAfter(N)})},C.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},C.stop=function(){C.autoStepTimer&&clearTimeout(C.autoStepTimer)},C.down=function(z,V,P){C.pressingUpOrDown=!0,C.step("down",z,V,P)},C.up=function(z,V,P){C.pressingUpOrDown=!0,C.step("up",z,V,P)},C.saveInput=function(z){C.input=z};var D=v.value;D===void 0&&(D=v.defaultValue),C.state={focused:v.autoFocus};var j=C.getValidValue(C.toNumber(D));return C.state=A(A({},C.state),{},{inputValue:C.toPrecisionAsStep(j),value:j}),C}return Object(Z.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(C){var D=this.props,j=D.value,z=D.onChange,V=D.max,P=D.min,N=this.state.focused;if(C){if(!w(C.value,j)||!w(C.max,V)||!w(C.min,P)){var $=N?j:this.getValidValue(j),re;this.pressingUpOrDown?re=$:this.inputting?re=this.rawInput:re=this.toPrecisionAsStep($),this.setState({value:$,inputValue:re})}var pe="value"in this.props?j:this.state.value;"max"in this.props&&C.max!==V&&typeof pe=="number"&&pe>V&&z&&z(V),"min"in this.props&&C.min!==P&&typeof pe=="number"&&pe<P&&z&&z(P)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ve=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===L.a.BACKSPACE?ve=this.cursorStart-1:this.lastKeyCode===L.a.DELETE&&(ve=this.cursorStart):ve=this.input.value.length,this.fixCaret(ve,ve)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case L.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case L.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ae){}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(C){var D=C;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(C){var D=C.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(C){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(C);return isNaN(z)?C:(z<D&&(z=D),z>j&&(z=j),z)}},{key:"setValue",value:function(C,D){var j=this.props.precision,z=this.isNotCompleteNumber(parseFloat(C))?null:parseFloat(C),V=this.state.value,P=V===void 0?null:V,N=this.state.inputValue,$=N===void 0?null:N,re=typeof z=="number"?z.toFixed(j):"".concat(z),pe=z!==P||re!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},D)):this.setState({value:z,inputValue:this.toPrecisionAsStep(C)},D),pe&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(C){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,z=j.precision,V=j.step;if(p(z))return z;var P=this.getPrecision(D),N=this.getPrecision(V),$=this.getPrecision(C);return C?Math.max($,P+N):P+N}},{key:"getPrecisionFactor",value:function(C){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(C,D);return Math.pow(10,j)}},{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(C){return this.props.formatter?this.props.formatter(C):C}},{key:"toPrecisionAsStep",value:function(C){if(this.isNotCompleteNumber(C)||C==="")return C;var D=Math.abs(this.getMaxPrecision(C));return isNaN(D)?C.toString():Number(C).toFixed(D)}},{key:"toNumber",value:function(C){var D=this.props.precision,j=this.state.focused,z=C&&C.length>16&&j;return this.isNotCompleteNumber(C)||z?C:p(D)?Math.round(C*Math.pow(10,D))/Math.pow(10,D):Number(C)}},{key:"upStep",value:function(C,D){var j=this.props.step,z=this.getPrecisionFactor(C,D),V=Math.abs(this.getMaxPrecision(C,D)),P=((z*C+z*j*D)/z).toFixed(V);return this.toNumber(P)}},{key:"downStep",value:function(C,D){var j=this.props.step,z=this.getPrecisionFactor(C,D),V=Math.abs(this.getMaxPrecision(C,D)),P=((z*C-z*j*D)/z).toFixed(V);return this.toNumber(P)}},{key:"step",value:function(C,D){var j=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var P=this.props;if(P.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var $=this["".concat(C,"Step")](N,z),re=$>P.max||$<P.min;if($>P.max?$=P.max:$<P.min&&($=P.min),this.setValue($,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),re)return;this.autoStepTimer=setTimeout(function(){j[C](D,z,!0)},V?d:S)}},{key:"fixCaret",value:function(C,D){if(C===void 0||D===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,z=this.input.selectionEnd;(C!==j||D!==z)&&this.input.setSelectionRange(C,D)}catch(V){}}},{key:"render",value:function(){var C,D=this.props,j=D.prefixCls,z=D.disabled,V=D.readOnly,P=D.useTouch,N=D.autoComplete,$=D.upHandler,re=D.downHandler,pe=D.className,ve=D.max,Ae=D.min,Le=D.style,ce=D.title,ae=D.onMouseEnter,de=D.onMouseLeave,ne=D.onMouseOver,se=D.onMouseOut,J=D.required,ee=D.onClick,oe=D.tabIndex,fe=D.type,ke=D.placeholder,ge=D.id,De=D.inputMode,Me=D.pattern,Ue=D.step,Ke=D.maxLength,He=D.autoFocus,Be=D.name,rt=D.onPaste,Oe=D.onInput,Fe=Object(he.a)(D,["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"]),je=this.state,Ge=je.value,Ve=je.focused,ze=E()(j,(C={},Object(Y.a)(C,pe,!!pe),Object(Y.a)(C,"".concat(j,"-disabled"),z),Object(Y.a)(C,"".concat(j,"-focused"),Ve),C)),Re={};Object.keys(Fe).forEach(function(Ee){(Ee.substr(0,5)==="data-"||Ee.substr(0,5)==="aria-"||Ee==="role")&&(Re[Ee]=Fe[Ee])});var Qe=!V&&!z,Ye=this.getInputDisplayValue(null),Pe=(Ge||Ge===0)&&(isNaN(Ge)||Number(Ge)>=ve),We=(Ge||Ge===0)&&(isNaN(Ge)||Number(Ge)<=Ae),Se=Pe||z||V,ye=We||z||V,xe=E()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(Y.a)({},"".concat(j,"-handler-up-disabled"),Se)),le=E()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(Y.a)({},"".concat(j,"-handler-down-disabled"),ye)),ue=P?{onTouchStart:Se?h:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},me=P?{onTouchStart:ye?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:ze,style:Le,title:ce,onMouseEnter:ae,onMouseLeave:de,onMouseOver:ne,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(j,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:xe}),$||M.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),M.a.createElement("span",Object.assign({unselectable:"on"},me,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:le}),re||M.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),M.a.createElement("div",{className:"".concat(j,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ae,"aria-valuemax":ve,"aria-valuenow":Ge,required:J,type:fe,placeholder:ke,onPaste:rt,onClick:ee,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:oe,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Qe?this.onKeyDown:h,onKeyUp:Qe?this.onKeyUp:h,autoFocus:He,maxLength:Ke,readOnly:V,disabled:z,max:ve,min:Ae,step:Ue,name:Be,title:ce,id:ge,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:Me,inputMode:De,onInput:Oe},Re))))}}]),T}(M.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var u=b,f=tt.a=u},fAei:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return d.a});var he=ie("rePB"),Y=ie("VTBJ"),O=ie("KQm4"),Z=ie("1OyB"),U=ie("vuIU"),I=ie("Ji7U"),K=ie("LK+K"),B=ie("q1tI"),M=ie("4IlW"),R=ie("Kwbf"),E=ie("TSYQ"),L=ie.n(E),_=ie("sboe"),A=ie("OZM5"),x=ie("815F"),y=ie("ODXe"),h=ie("Ff2n"),o=ie("+nKL"),l=ie("8XRh"),d=ie("WaYH"),S=function(Ae,Le){var ce=Ae.className,ae=Ae.style,de=Ae.motion,ne=Ae.motionNodes,se=Ae.motionType,J=Ae.onMotionStart,ee=Ae.onMotionEnd,oe=Ae.active,fe=Ae.treeNodeRequiredProps,ke=Object(h.a)(Ae,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),ge=B.useState(!0),De=Object(y.a)(ge,2),Me=De[0],Ue=De[1],Ke=B.useContext(_.a),He=Ke.prefixCls,Be=B.useRef(!1),rt=function(){Be.current||ee(),Be.current=!0};return Object(B.useEffect)(function(){ne&&se==="hide"&&Me&&Ue(!1)},[ne]),Object(B.useEffect)(function(){return ne&&J(),function(){ne&&rt()}},[]),ne?B.createElement(l.default,Object.assign({ref:Le,visible:Me},de,{motionAppear:se==="show",onAppearEnd:rt,onLeaveEnd:rt}),function(Oe,Fe){var je=Oe.className,Ge=Oe.style;return B.createElement("div",{ref:Fe,className:L()("".concat(He,"-treenode-motion"),je),style:Ge},ne.map(function(Ve){var ze=Ve.data,Re=ze.key,Qe=Object(h.a)(ze,["key"]),Ye=Ve.isStart,Pe=Ve.isEnd;delete Qe.children;var We=Object(x.f)(Re,fe);return B.createElement(d.a,Object.assign({},Qe,We,{active:oe,data:Ve.data,key:Re,isStart:Ye,isEnd:Pe}))}))}):B.createElement(d.a,Object.assign({domRef:Le,className:ce,style:ae},ke,{active:oe}))};S.displayName="MotionTreeNode";var g=B.forwardRef(S),p=g;function w(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Le=ve.length,ce=Ae.length;if(Math.abs(Le-ce)!==1)return{add:!1,key:null};function ae(de,ne){var se=new Map;de.forEach(function(ee){se.set(ee,!0)});var J=ne.filter(function(ee){return!se.has(ee)});return J.length===1?J[0]:null}return Le<ce?{add:!0,key:ae(ve,Ae)}:{add:!1,key:ae(Ae,ve)}}function b(ve,Ae,Le){var ce=ve.findIndex(function(se){var J=se.data;return J.key===Le}),ae=ve[ce+1],de=Ae.findIndex(function(se){var J=se.data;return J.key===Le});if(ae){var ne=Ae.findIndex(function(se){var J=se.data;return J.key===ae.data.key});return Ae.slice(de+1,ne)}return Ae.slice(de+1)}var u={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},f=function(){},s="RC_TREE_MOTION_".concat(Math.random()),a={key:s},T={key:s,level:0,index:0,pos:"0",node:a},v={parent:null,children:[],pos:T.pos,data:a,isStart:[],isEnd:[]};function C(ve,Ae,Le,ce){return Ae===!1||!Le?ve:ve.slice(0,Math.ceil(Le/ce)+1)}function D(ve){var Ae=ve.data.key,Le=ve.pos;return Object(x.e)(Ae,Le)}function j(ve){for(var Ae=String(ve.data.key),Le=ve;Le.parent;)Le=Le.parent,Ae="".concat(Le.data.key," > ").concat(Ae);return Ae}var z=function(Ae,Le){var ce=Ae.prefixCls,ae=Ae.data,de=Ae.selectable,ne=Ae.checkable,se=Ae.expandedKeys,J=Ae.selectedKeys,ee=Ae.checkedKeys,oe=Ae.loadedKeys,fe=Ae.loadingKeys,ke=Ae.halfCheckedKeys,ge=Ae.keyEntities,De=Ae.disabled,Me=Ae.dragging,Ue=Ae.dragOverNodeKey,Ke=Ae.dropPosition,He=Ae.motion,Be=Ae.height,rt=Ae.itemHeight,Oe=Ae.virtual,Fe=Ae.focusable,je=Ae.activeItem,Ge=Ae.focused,Ve=Ae.tabIndex,ze=Ae.onKeyDown,Re=Ae.onFocus,Qe=Ae.onBlur,Ye=Ae.onActiveChange,Pe=Ae.onListChangeStart,We=Ae.onListChangeEnd,Se=Object(h.a)(Ae,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),ye=B.useRef(null);B.useImperativeHandle(Le,function(){return{scrollTo:function(tr){ye.current.scrollTo(tr)}}});var xe=B.useState(se),le=Object(y.a)(xe,2),ue=le[0],me=le[1],Ee=B.useState(ae),we=Object(y.a)(Ee,2),Ie=we[0],$e=we[1],at=B.useState(ae),ht=Object(y.a)(at,2),ut=ht[0],xt=ht[1],Ct=B.useState([]),st=Object(y.a)(Ct,2),Mt=st[0],Lt=st[1],kt=B.useState(null),Dt=Object(y.a)(kt,2),Tt=Dt[0],Ut=Dt[1];function Qt(){$e(ae),xt(ae),Lt([]),Ut(null),We()}B.useEffect(function(){me(se);var Bt=w(ue,se);if(Bt.key!==null)if(Bt.add){var tr=Ie.findIndex(function(sr){var Tr=sr.data.key;return Tr===Bt.key}),ur=C(b(Ie,ae,Bt.key),Oe,Be,rt),nr=Ie.slice();nr.splice(tr+1,0,v),xt(nr),Lt(ur),Ut("show")}else{var vr=ae.findIndex(function(sr){var Tr=sr.data.key;return Tr===Bt.key}),Nt=C(b(ae,Ie,Bt.key),Oe,Be,rt),ft=ae.slice();ft.splice(vr+1,0,v),xt(ft),Lt(Nt),Ut("hide")}else Ie!==ae&&($e(ae),xt(ae))},[se,ae]),B.useEffect(function(){Me||Qt()},[Me]);var yt=He?ut:ae,pr={expandedKeys:se,selectedKeys:J,loadedKeys:oe,loadingKeys:fe,checkedKeys:ee,halfCheckedKeys:ke,dragOverNodeKey:Ue,dropPosition:Ke,keyEntities:ge};return B.createElement(B.Fragment,null,Ge&&je&&B.createElement("span",{style:u,"aria-live":"assertive"},j(je)),B.createElement("div",{role:"tree"},B.createElement("input",{style:u,disabled:Fe===!1||De,tabIndex:Fe!==!1?Ve:null,onKeyDown:ze,onFocus:Re,onBlur:Qe,value:"",onChange:f})),B.createElement(o.a,Object.assign({},Se,{data:yt,itemKey:D,height:Be,fullHeight:!1,virtual:Oe,itemHeight:rt,prefixCls:"".concat(ce,"-list"),ref:ye}),function(Bt){var tr=Bt.pos,ur=Bt.data,nr=ur.key,vr=Object(h.a)(ur,["key"]),Nt=Bt.isStart,ft=Bt.isEnd,sr=Object(x.e)(nr,tr);delete vr.children;var Tr=Object(x.f)(sr,pr);return B.createElement(p,Object.assign({},vr,Tr,{active:je&&nr===je.data.key,pos:tr,data:Bt.data,isStart:Nt,isEnd:ft,motion:He,motionNodes:nr===s?Mt:null,motionType:Tt,onMotionStart:Pe,onMotionEnd:Qt,treeNodeRequiredProps:pr,onMouseMove:function(){Ye(null)}}))}))},V=B.forwardRef(z);V.displayName="NodeList";var P=V,N=ie("NvD2"),$=function(ve){Object(I.a)(Le,ve);var Ae=Object(K.a)(Le);function Le(){var ce;return Object(Z.a)(this,Le),ce=Ae.apply(this,arguments),ce.destroyed=!1,ce.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},ce.listRef=B.createRef(),ce.onNodeDragStart=function(ae,de){var ne=ce.state,se=ne.expandedKeys,J=ne.keyEntities,ee=ce.props.onDragStart,oe=de.props.eventKey;ce.dragNode=de;var fe=Object(A.b)(se,oe);ce.setState({dragging:!0,dragNodesKeys:Object(A.g)(oe,J)}),ce.setExpandedKeys(fe),ee&&ee({event:ae,node:Object(x.b)(de.props)})},ce.onNodeDragEnter=function(ae,de){var ne=ce.state,se=ne.expandedKeys,J=ne.keyEntities,ee=ne.dragNodesKeys,oe=ce.props.onDragEnter,fe=de.props,ke=fe.pos,ge=fe.eventKey;if(!ce.dragNode||ee.indexOf(ge)!==-1)return;var De=Object(A.c)(ae,de);if(ce.dragNode.props.eventKey===ge&&De===0){ce.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){ce.setState({dragOverNodeKey:ge,dropPosition:De}),ce.delayedDragEnterLogic||(ce.delayedDragEnterLogic={}),Object.keys(ce.delayedDragEnterLogic).forEach(function(Me){clearTimeout(ce.delayedDragEnterLogic[Me])}),ce.delayedDragEnterLogic[ke]=window.setTimeout(function(){if(!ce.state.dragging)return;var Me=Object(O.a)(se),Ue=J[ge];Ue&&(Ue.children||[]).length&&(Me=Object(A.a)(se,ge)),"expandedKeys"in ce.props||ce.setExpandedKeys(Me),oe&&oe({event:ae,node:Object(x.b)(de.props),expandedKeys:Me})},400)},0)},ce.onNodeDragOver=function(ae,de){var ne=ce.state.dragNodesKeys,se=ce.props.onDragOver,J=de.props.eventKey;if(ne.indexOf(J)!==-1)return;if(ce.dragNode&&J===ce.state.dragOverNodeKey){var ee=Object(A.c)(ae,de);if(ee===ce.state.dropPosition)return;ce.setState({dropPosition:ee})}se&&se({event:ae,node:Object(x.b)(de.props)})},ce.onNodeDragLeave=function(ae,de){var ne=ce.props.onDragLeave;ce.setState({dragOverNodeKey:""}),ne&&ne({event:ae,node:Object(x.b)(de.props)})},ce.onNodeDragEnd=function(ae,de){var ne=ce.props.onDragEnd;ce.setState({dragOverNodeKey:""}),ce.cleanDragState(),ne&&ne({event:ae,node:Object(x.b)(de.props)}),ce.dragNode=null},ce.onNodeDrop=function(ae,de){var ne=ce.state,se=ne.dragNodesKeys,J=se===void 0?[]:se,ee=ne.dropPosition,oe=ce.props.onDrop,fe=de.props,ke=fe.eventKey,ge=fe.pos;if(ce.setState({dragOverNodeKey:""}),ce.cleanDragState(),J.indexOf(ke)!==-1){Object(R.a)(!1,"Can not drop to dragNode(include it's children node)");return}var De=Object(A.k)(ge),Me={event:ae,node:Object(x.b)(de.props),dragNode:ce.dragNode?Object(x.b)(ce.dragNode.props):null,dragNodesKeys:J.slice(),dropPosition:ee+Number(De[De.length-1]),dropToGap:!1};ee!==0&&(Me.dropToGap=!0),oe&&oe(Me),ce.dragNode=null},ce.cleanDragState=function(){var ae=ce.state.dragging;ae&&ce.setState({dragging:!1})},ce.onNodeClick=function(ae,de){var ne=ce.props.onClick;ne&&ne(ae,de)},ce.onNodeDoubleClick=function(ae,de){var ne=ce.props.onDoubleClick;ne&&ne(ae,de)},ce.onNodeSelect=function(ae,de){var ne=ce.state.selectedKeys,se=ce.state.keyEntities,J=ce.props,ee=J.onSelect,oe=J.multiple,fe=de.selected,ke=de.key,ge=!fe;ge?oe?ne=Object(A.a)(ne,ke):ne=[ke]:ne=Object(A.b)(ne,ke);var De=ne.map(function(Me){var Ue=se[Me];return Ue?Ue.node:null}).filter(function(Me){return Me});ce.setUncontrolledState({selectedKeys:ne}),ee&&ee(ne,{event:"select",selected:ge,node:de,selectedNodes:De,nativeEvent:ae.nativeEvent})},ce.onNodeCheck=function(ae,de,ne){var se=ce.state,J=se.keyEntities,ee=se.checkedKeys,oe=se.halfCheckedKeys,fe=ce.props,ke=fe.checkStrictly,ge=fe.onCheck,De=de.key,Me,Ue={event:"check",node:de,checked:ne,nativeEvent:ae.nativeEvent};if(ke){var Ke=ne?Object(A.a)(ee,De):Object(A.b)(ee,De),He=Object(A.b)(oe,De);Me={checked:Ke,halfChecked:He},Ue.checkedNodes=Ke.map(function(Ge){return J[Ge]}).filter(function(Ge){return Ge}).map(function(Ge){return Ge.node}),ce.setUncontrolledState({checkedKeys:Ke})}else{var Be=Object(N.a)([].concat(Object(O.a)(ee),[De]),!0,J),rt=Be.checkedKeys,Oe=Be.halfCheckedKeys;if(!ne){var Fe=new Set(rt);Fe.delete(De);var je=Object(N.a)(Array.from(Fe),{checked:!1,halfCheckedKeys:Oe},J);rt=je.checkedKeys,Oe=je.halfCheckedKeys}Me=rt,Ue.checkedNodes=[],Ue.checkedNodesPositions=[],Ue.halfCheckedKeys=Oe,rt.forEach(function(Ge){var Ve=J[Ge];if(!Ve)return;var ze=Ve.node,Re=Ve.pos;Ue.checkedNodes.push(ze),Ue.checkedNodesPositions.push({node:ze,pos:Re})}),ce.setUncontrolledState({checkedKeys:rt},!1,{halfCheckedKeys:Oe})}ge&&ge(Me,Ue)},ce.onNodeLoad=function(ae){return new Promise(function(de){ce.setState(function(ne){var se=ne.loadedKeys,J=se===void 0?[]:se,ee=ne.loadingKeys,oe=ee===void 0?[]:ee,fe=ce.props,ke=fe.loadData,ge=fe.onLoad,De=ae.key;if(!ke||J.indexOf(De)!==-1||oe.indexOf(De)!==-1)return{};var Me=ke(ae);return Me.then(function(){var Ue=ce.state,Ke=Ue.loadedKeys,He=Ue.loadingKeys,Be=Object(A.a)(Ke,De),rt=Object(A.b)(He,De);ge&&ge(Be,{event:"load",node:ae}),ce.setUncontrolledState({loadedKeys:Be}),ce.setState({loadingKeys:rt}),de()}),{loadingKeys:Object(A.a)(oe,De)}})})},ce.onNodeMouseEnter=function(ae,de){var ne=ce.props.onMouseEnter;ne&&ne({event:ae,node:de})},ce.onNodeMouseLeave=function(ae,de){var ne=ce.props.onMouseLeave;ne&&ne({event:ae,node:de})},ce.onNodeContextMenu=function(ae,de){var ne=ce.props.onRightClick;ne&&(ae.preventDefault(),ne({event:ae,node:de}))},ce.onFocus=function(){var ae=ce.props.onFocus;ce.setState({focused:!0}),ae&&ae.apply(void 0,arguments)},ce.onBlur=function(){var ae=ce.props.onBlur;ce.setState({focused:!1}),ce.onActiveChange(null),ae&&ae.apply(void 0,arguments)},ce.getTreeNodeRequiredProps=function(){var ae=ce.state,de=ae.expandedKeys,ne=ae.selectedKeys,se=ae.loadedKeys,J=ae.loadingKeys,ee=ae.checkedKeys,oe=ae.halfCheckedKeys,fe=ae.dragOverNodeKey,ke=ae.dropPosition,ge=ae.keyEntities;return{expandedKeys:de||[],selectedKeys:ne||[],loadedKeys:se||[],loadingKeys:J||[],checkedKeys:ee||[],halfCheckedKeys:oe||[],dragOverNodeKey:fe,dropPosition:ke,keyEntities:ge}},ce.setExpandedKeys=function(ae){var de=ce.state.treeData,ne=Object(x.d)(de,ae);ce.setUncontrolledState({expandedKeys:ae,flattenNodes:ne},!0)},ce.onNodeExpand=function(ae,de){var ne=ce.state.expandedKeys,se=ce.state.listChanging,J=ce.props,ee=J.onExpand,oe=J.loadData,fe=de.key,ke=de.expanded;if(se)return;var ge=ne.indexOf(fe),De=!ke;if(Object(R.a)(ke&&ge!==-1||!ke&&ge===-1,"Expand state not sync with index check"),De?ne=Object(A.a)(ne,fe):ne=Object(A.b)(ne,fe),ce.setExpandedKeys(ne),ee&&ee(ne,{node:de,expanded:De,nativeEvent:ae.nativeEvent}),De&&oe){var Me=ce.onNodeLoad(de);Me&&Me.then(function(){var Ue=Object(x.d)(ce.state.treeData,ne);ce.setUncontrolledState({flattenNodes:Ue})})}},ce.onListChangeStart=function(){ce.setUncontrolledState({listChanging:!0})},ce.onListChangeEnd=function(){setTimeout(function(){ce.setUncontrolledState({listChanging:!1})})},ce.onActiveChange=function(ae){var de=ce.state.activeKey,ne=ce.props.onActiveChange;if(de===ae)return;ce.setState({activeKey:ae}),ae!==null&&ce.scrollTo({key:ae}),ne&&ne(ae)},ce.getActiveItem=function(){var ae=ce.state,de=ae.activeKey,ne=ae.flattenNodes;return de===null?null:ne.find(function(se){var J=se.data.key;return J===de})||null},ce.offsetActiveKey=function(ae){var de=ce.state,ne=de.flattenNodes,se=de.activeKey,J=ne.findIndex(function(fe){var ke=fe.data.key;return ke===se});J===-1&&ae<0&&(J=ne.length),J=(J+ae+ne.length)%ne.length;var ee=ne[J];if(ee){var oe=ee.data.key;ce.onActiveChange(oe)}else ce.onActiveChange(null)},ce.onKeyDown=function(ae){var de=ce.state,ne=de.activeKey,se=de.expandedKeys,J=de.checkedKeys,ee=ce.props,oe=ee.onKeyDown,fe=ee.checkable,ke=ee.selectable;switch(ae.which){case M.a.UP:{ce.offsetActiveKey(-1),ae.preventDefault();break}case M.a.DOWN:{ce.offsetActiveKey(1),ae.preventDefault();break}}var ge=ce.getActiveItem();if(ge&&ge.data){var De=ce.getTreeNodeRequiredProps(),Me=ge.data.isLeaf===!1||!!(ge.data.children||[]).length,Ue=Object(x.b)(Object(Y.a)(Object(Y.a)({},Object(x.f)(ne,De)),{},{data:ge.data,active:!0}));switch(ae.which){case M.a.LEFT:{Me&&se.includes(ne)?ce.onNodeExpand({},Ue):ge.parent&&ce.onActiveChange(ge.parent.data.key),ae.preventDefault();break}case M.a.RIGHT:{Me&&!se.includes(ne)?ce.onNodeExpand({},Ue):ge.children&&ge.children.length&&ce.onActiveChange(ge.children[0].data.key),ae.preventDefault();break}case M.a.ENTER:case M.a.SPACE:{fe&&!Ue.disabled&&Ue.checkable!==!1&&!Ue.disableCheckbox?ce.onNodeCheck({},Ue,!J.includes(ne)):!fe&&ke&&!Ue.disabled&&Ue.selectable!==!1&&ce.onNodeSelect({},Ue);break}}}oe&&oe(ae)},ce.setUncontrolledState=function(ae){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(ce.destroyed)return;var se=!1,J=!0,ee={};Object.keys(ae).forEach(function(oe){if(oe in ce.props){J=!1;return}se=!0,ee[oe]=ae[oe]}),se&&(!de||J)&&ce.setState(Object(Y.a)(Object(Y.a)({},ee),ne))},ce.scrollTo=function(ae){ce.listRef.current.scrollTo(ae)},ce}return Object(U.a)(Le,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ae,de=this.state,ne=de.focused,se=de.flattenNodes,J=de.keyEntities,ee=de.dragging,oe=de.activeKey,fe=this.props,ke=fe.prefixCls,ge=fe.className,De=fe.style,Me=fe.showLine,Ue=fe.focusable,Ke=fe.tabIndex,He=Ke===void 0?0:Ke,Be=fe.selectable,rt=fe.showIcon,Oe=fe.icon,Fe=fe.switcherIcon,je=fe.draggable,Ge=fe.checkable,Ve=fe.checkStrictly,ze=fe.disabled,Re=fe.motion,Qe=fe.loadData,Ye=fe.filterTreeNode,Pe=fe.height,We=fe.itemHeight,Se=fe.virtual,ye=fe.titleRender,xe=fe.onContextMenu,le=Object(A.f)(this.props);return B.createElement(_.a.Provider,{value:{prefixCls:ke,selectable:Be,showIcon:rt,icon:Oe,switcherIcon:Fe,draggable:je,checkable:Ge,checkStrictly:Ve,disabled:ze,keyEntities:J,loadData:Qe,filterTreeNode:Ye,titleRender:ye,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},B.createElement("div",{className:L()(ke,ge,(ae={},Object(he.a)(ae,"".concat(ke,"-show-line"),Me),Object(he.a)(ae,"".concat(ke,"-focused"),ne),Object(he.a)(ae,"".concat(ke,"-active-focused"),oe!==null),ae))},B.createElement(P,Object.assign({ref:this.listRef,prefixCls:ke,style:De,data:se,disabled:ze,selectable:Be,checkable:!!Ge,motion:Re,dragging:ee,height:Pe,itemHeight:We,virtual:Se,focusable:Ue,focused:ne,tabIndex:He,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:xe},this.getTreeNodeRequiredProps(),le))))}}],[{key:"getDerivedStateFromProps",value:function(ae,de){var ne=de.prevProps,se={prevProps:ae};function J(Oe){return!ne&&Oe in ae||ne&&ne[Oe]!==ae[Oe]}var ee;if(J("treeData")?ee=ae.treeData:J("children")&&(Object(R.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),ee=Object(x.c)(ae.children)),ee){se.treeData=ee;var oe=Object(x.a)(ee);se.keyEntities=Object(Y.a)(Object(he.a)({},s,T),oe.keyEntities)}var fe=se.keyEntities||de.keyEntities;if(J("expandedKeys")||ne&&J("autoExpandParent"))se.expandedKeys=ae.autoExpandParent||!ne&&ae.defaultExpandParent?Object(A.e)(ae.expandedKeys,fe):ae.expandedKeys;else if(!ne&&ae.defaultExpandAll){var ke=Object(Y.a)({},fe);delete ke[s],se.expandedKeys=Object.keys(ke).map(function(Oe){return ke[Oe].key})}else!ne&&ae.defaultExpandedKeys&&(se.expandedKeys=ae.autoExpandParent||ae.defaultExpandParent?Object(A.e)(ae.defaultExpandedKeys,fe):ae.defaultExpandedKeys);if(se.expandedKeys||delete se.expandedKeys,ee||se.expandedKeys){var ge=Object(x.d)(ee||de.treeData,se.expandedKeys||de.expandedKeys);se.flattenNodes=ge}if(ae.selectable&&(J("selectedKeys")?se.selectedKeys=Object(A.d)(ae.selectedKeys,ae):!ne&&ae.defaultSelectedKeys&&(se.selectedKeys=Object(A.d)(ae.defaultSelectedKeys,ae))),ae.checkable){var De;if(J("checkedKeys")?De=Object(A.j)(ae.checkedKeys)||{}:!ne&&ae.defaultCheckedKeys?De=Object(A.j)(ae.defaultCheckedKeys)||{}:ee&&(De=Object(A.j)(ae.checkedKeys)||{checkedKeys:de.checkedKeys,halfCheckedKeys:de.halfCheckedKeys}),De){var Me=De,Ue=Me.checkedKeys,Ke=Ue===void 0?[]:Ue,He=Me.halfCheckedKeys,Be=He===void 0?[]:He;if(!ae.checkStrictly){var rt=Object(N.a)(Ke,!0,fe);Ke=rt.checkedKeys,Be=rt.halfCheckedKeys}se.checkedKeys=Ke,se.halfCheckedKeys=Be}}return J("loadedKeys")&&(se.loadedKeys=ae.loadedKeys),se}}]),Le}(B.Component);$.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},$.TreeNode=d.a;var re=$,pe=tt.b=re},gJ3r:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return he});var he=[{value:"\u5317\u4EAC",label:"\u5317\u4EAC",children:[{value:"\u4E1C\u57CE",label:"\u4E1C\u57CE"},{value:"\u897F\u57CE",label:"\u897F\u57CE"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u4E30\u53F0",label:"\u4E30\u53F0"},{value:"\u77F3\u666F\u5C71",label:"\u77F3\u666F\u5C71"},{value:"\u6D77\u6DC0",label:"\u6D77\u6DC0"},{value:"\u95E8\u5934\u6C9F",label:"\u95E8\u5934\u6C9F"},{value:"\u623F\u5C71",label:"\u623F\u5C71"},{value:"\u901A\u5DDE",label:"\u901A\u5DDE"},{value:"\u987A\u4E49",label:"\u987A\u4E49"},{value:"\u660C\u5E73",label:"\u660C\u5E73"},{value:"\u5927\u5174",label:"\u5927\u5174"},{value:"\u5E73\u8C37",label:"\u5E73\u8C37"},{value:"\u6000\u67D4",label:"\u6000\u67D4"},{value:"\u5BC6\u4E91",label:"\u5BC6\u4E91"},{value:"\u5EF6\u5E86",label:"\u5EF6\u5E86"}]},{value:"\u4E0A\u6D77",label:"\u4E0A\u6D77",children:[{value:"\u5D07\u660E",label:"\u5D07\u660E"},{value:"\u9EC4\u6D66",label:"\u9EC4\u6D66"},{value:"\u5362\u6E7E",label:"\u5362\u6E7E"},{value:"\u5F90\u6C47",label:"\u5F90\u6C47"},{value:"\u957F\u5B81",label:"\u957F\u5B81"},{value:"\u9759\u5B89",label:"\u9759\u5B89"},{value:"\u666E\u9640",label:"\u666E\u9640"},{value:"\u95F8\u5317",label:"\u95F8\u5317"},{value:"\u8679\u53E3",label:"\u8679\u53E3"},{value:"\u6768\u6D66",label:"\u6768\u6D66"},{value:"\u95F5\u884C",label:"\u95F5\u884C"},{value:"\u5B9D\u5C71",label:"\u5B9D\u5C71"},{value:"\u5609\u5B9A",label:"\u5609\u5B9A"},{value:"\u6D66\u4E1C",label:"\u6D66\u4E1C"},{value:"\u91D1\u5C71",label:"\u91D1\u5C71"},{value:"\u677E\u6C5F",label:"\u677E\u6C5F"},{value:"\u9752\u6D66",label:"\u9752\u6D66"},{value:"\u5357\u6C47",label:"\u5357\u6C47"},{value:"\u5949\u8D24",label:"\u5949\u8D24"}]},{value:"\u5E7F\u4E1C",label:"\u5E7F\u4E1C",children:[{value:"\u5E7F\u5DDE",label:"\u5E7F\u5DDE"},{value:"\u6DF1\u5733",label:"\u6DF1\u5733"},{value:"\u73E0\u6D77",label:"\u73E0\u6D77"},{value:"\u4E1C\u839E",label:"\u4E1C\u839E"},{value:"\u4E2D\u5C71",label:"\u4E2D\u5C71"},{value:"\u4F5B\u5C71",label:"\u4F5B\u5C71"},{value:"\u60E0\u5DDE",label:"\u60E0\u5DDE"},{value:"\u6CB3\u6E90",label:"\u6CB3\u6E90"},{value:"\u6F6E\u5DDE",label:"\u6F6E\u5DDE"},{value:"\u6C5F\u95E8",label:"\u6C5F\u95E8"},{value:"\u63ED\u9633",label:"\u63ED\u9633"},{value:"\u8302\u540D",label:"\u8302\u540D"},{value:"\u6885\u5DDE",label:"\u6885\u5DDE"},{value:"\u6E05\u8FDC",label:"\u6E05\u8FDC"},{value:"\u6C55\u5934",label:"\u6C55\u5934"},{value:"\u6C55\u5C3E",label:"\u6C55\u5C3E"},{value:"\u97F6\u5173",label:"\u97F6\u5173"},{value:"\u987A\u5FB7",label:"\u987A\u5FB7"},{value:"\u9633\u6C5F",label:"\u9633\u6C5F"},{value:"\u4E91\u6D6E",label:"\u4E91\u6D6E"},{value:"\u6E5B\u6C5F",label:"\u6E5B\u6C5F"},{value:"\u8087\u5E86",label:"\u8087\u5E86"}]},{value:"\u6C5F\u82CF",label:"\u6C5F\u82CF",children:[{value:"\u5357\u4EAC",label:"\u5357\u4EAC"},{value:"\u5E38\u719F",label:"\u5E38\u719F"},{value:"\u5E38\u5DDE",label:"\u5E38\u5DDE"},{value:"\u6D77\u95E8",label:"\u6D77\u95E8"},{value:"\u6DEE\u5B89",label:"\u6DEE\u5B89"},{value:"\u6C5F\u90FD",label:"\u6C5F\u90FD"},{value:"\u6C5F\u9634",label:"\u6C5F\u9634"},{value:"\u6606\u5C71",label:"\u6606\u5C71"},{value:"\u8FDE\u4E91\u6E2F",label:"\u8FDE\u4E91\u6E2F"},{value:"\u5357\u901A",label:"\u5357\u901A"},{value:"\u542F\u4E1C",label:"\u542F\u4E1C"},{value:"\u6CAD\u9633",label:"\u6CAD\u9633"},{value:"\u5BBF\u8FC1",label:"\u5BBF\u8FC1"},{value:"\u82CF\u5DDE",label:"\u82CF\u5DDE"},{value:"\u592A\u4ED3",label:"\u592A\u4ED3"},{value:"\u6CF0\u5DDE",label:"\u6CF0\u5DDE"},{value:"\u540C\u91CC",label:"\u540C\u91CC"},{value:"\u65E0\u9521",label:"\u65E0\u9521"},{value:"\u5F90\u5DDE",label:"\u5F90\u5DDE"},{value:"\u76D0\u57CE",label:"\u76D0\u57CE"},{value:"\u626C\u5DDE",label:"\u626C\u5DDE"},{value:"\u5B9C\u5174",label:"\u5B9C\u5174"},{value:"\u4EEA\u5F81",label:"\u4EEA\u5F81"},{value:"\u5F20\u5BB6\u6E2F",label:"\u5F20\u5BB6\u6E2F"},{value:"\u9547\u6C5F",label:"\u9547\u6C5F"}]},{value:"\u91CD\u5E86",label:"\u91CD\u5E86",children:[{value:"\u4E07\u5DDE",label:"\u4E07\u5DDE"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u6E1D\u4E2D",label:"\u6E1D\u4E2D"},{value:"\u5927\u6E21\u53E3",label:"\u5927\u6E21\u53E3"},{value:"\u6C5F\u5317",label:"\u6C5F\u5317"},{value:"\u6C99\u576A\u575D",label:"\u6C99\u576A\u575D"},{value:"\u4E5D\u9F99\u5761",label:"\u4E5D\u9F99\u5761"},{value:"\u5357\u5CB8",label:"\u5357\u5CB8"},{value:"\u5317\u789A",label:"\u5317\u789A"},{value:"\u4E07\u76DB",label:"\u4E07\u76DB"},{value:"\u53CC\u6322",label:"\u53CC\u6322"},{value:"\u6E1D\u5317",label:"\u6E1D\u5317"},{value:"\u5DF4\u5357",label:"\u5DF4\u5357"},{value:"\u9ED4\u6C5F",label:"\u9ED4\u6C5F"},{value:"\u957F\u5BFF",label:"\u957F\u5BFF"},{value:"\u7DA6\u6C5F",label:"\u7DA6\u6C5F"},{value:"\u6F7C\u5357",label:"\u6F7C\u5357"},{value:"\u94DC\u6881",label:"\u94DC\u6881"},{value:"\u5927\u8DB3",label:"\u5927\u8DB3"},{value:"\u8363\u660C",label:"\u8363\u660C"},{value:"\u58C1\u5C71",label:"\u58C1\u5C71"},{value:"\u6881\u5E73",label:"\u6881\u5E73"},{value:"\u57CE\u53E3",label:"\u57CE\u53E3"},{value:"\u4E30\u90FD",label:"\u4E30\u90FD"},{value:"\u57AB\u6C5F",label:"\u57AB\u6C5F"},{value:"\u6B66\u9686",label:"\u6B66\u9686"},{value:"\u5FE0\u53BF",label:"\u5FE0\u53BF"},{value:"\u5F00\u53BF",label:"\u5F00\u53BF"},{value:"\u4E91\u9633",label:"\u4E91\u9633"},{value:"\u5949\u8282",label:"\u5949\u8282"},{value:"\u5DEB\u5C71",label:"\u5DEB\u5C71"},{value:"\u5DEB\u6EAA",label:"\u5DEB\u6EAA"},{value:"\u77F3\u67F1",label:"\u77F3\u67F1"},{value:"\u79C0\u5C71",label:"\u79C0\u5C71"},{value:"\u9149\u9633",label:"\u9149\u9633"},{value:"\u5F6D\u6C34",label:"\u5F6D\u6C34"},{value:"\u6C5F\u6D25",label:"\u6C5F\u6D25"},{value:"\u5408\u5DDD",label:"\u5408\u5DDD"},{value:"\u6C38\u5DDD",label:"\u6C38\u5DDD"},{value:"\u5357\u5DDD",label:"\u5357\u5DDD"}]},{value:"\u5B89\u5FBD",label:"\u5B89\u5FBD",children:[{value:"\u5408\u80A5",label:"\u5408\u80A5"},{value:"\u5B89\u5E86",label:"\u5B89\u5E86"},{value:"\u868C\u57E0",label:"\u868C\u57E0"},{value:"\u4EB3\u5DDE",label:"\u4EB3\u5DDE"},{value:"\u5DE2\u6E56",label:"\u5DE2\u6E56"},{value:"\u6EC1\u5DDE",label:"\u6EC1\u5DDE"},{value:"\u961C\u9633",label:"\u961C\u9633"},{value:"\u8D35\u6C60",label:"\u8D35\u6C60"},{value:"\u6DEE\u5317",label:"\u6DEE\u5317"},{value:"\u6DEE\u5316",label:"\u6DEE\u5316"},{value:"\u6DEE\u5357",label:"\u6DEE\u5357"},{value:"\u9EC4\u5C71",label:"\u9EC4\u5C71"},{value:"\u4E5D\u534E\u5C71",label:"\u4E5D\u534E\u5C71"},{value:"\u516D\u5B89",label:"\u516D\u5B89"},{value:"\u9A6C\u978D\u5C71",label:"\u9A6C\u978D\u5C71"},{value:"\u5BBF\u5DDE",label:"\u5BBF\u5DDE"},{value:"\u94DC\u9675",label:"\u94DC\u9675"},{value:"\u5C6F\u6EAA",label:"\u5C6F\u6EAA"},{value:"\u829C\u6E56",label:"\u829C\u6E56"},{value:"\u5BA3\u57CE",label:"\u5BA3\u57CE"}]},{value:"\u798F\u5EFA",label:"\u798F\u5EFA",children:[{value:"\u798F\u5DDE",label:"\u798F\u5DDE"},{value:"\u53A6\u95E8",label:"\u53A6\u95E8"},{value:"\u6CC9\u5DDE",label:"\u6CC9\u5DDE"},{value:"\u6F33\u5DDE",label:"\u6F33\u5DDE"},{value:"\u9F99\u5CA9",label:"\u9F99\u5CA9"},{value:"\u5357\u5E73",label:"\u5357\u5E73"},{value:"\u5B81\u5FB7",label:"\u5B81\u5FB7"},{value:"\u8386\u7530",label:"\u8386\u7530"},{value:"\u4E09\u660E",label:"\u4E09\u660E"}]},{value:"\u7518\u8083",label:"\u7518\u8083",children:[{value:"\u5170\u5DDE",label:"\u5170\u5DDE"},{value:"\u5609\u5CEA\u5173",label:"\u5609\u5CEA\u5173"},{value:"\u767D\u94F6",label:"\u767D\u94F6"},{value:"\u5B9A\u897F",label:"\u5B9A\u897F"},{value:"\u6566\u714C",label:"\u6566\u714C"},{value:"\u7518\u5357",label:"\u7518\u5357"},{value:"\u91D1\u660C",label:"\u91D1\u660C"},{value:"\u9152\u6CC9",label:"\u9152\u6CC9"},{value:"\u4E34\u590F",label:"\u4E34\u590F"},{value:"\u5E73\u51C9",label:"\u5E73\u51C9"},{value:"\u5929\u6C34",label:"\u5929\u6C34"},{value:"\u9647\u5357",label:"\u9647\u5357"},{value:"\u6B66\u5A01",label:"\u6B66\u5A01"},{value:"\u897F\u5CF0",label:"\u897F\u5CF0"},{value:"\u5F20\u6396",label:"\u5F20\u6396"}]},{value:"\u5E7F\u897F",label:"\u5E7F\u897F",children:[{value:"\u5357\u5B81",label:"\u5357\u5B81"},{value:"\u6765\u5BBE",label:"\u6765\u5BBE"},{value:"\u767E\u8272",label:"\u767E\u8272"},{value:"\u5317\u6D77",label:"\u5317\u6D77"},{value:"\u6842\u6797",label:"\u6842\u6797"},{value:"\u9632\u57CE\u6E2F",label:"\u9632\u57CE\u6E2F"},{value:"\u8D35\u6E2F",label:"\u8D35\u6E2F"},{value:"\u6CB3\u6C60",label:"\u6CB3\u6C60"},{value:"\u8D3A\u5DDE",label:"\u8D3A\u5DDE"},{value:"\u67F3\u5DDE",label:"\u67F3\u5DDE"},{value:"\u94A6\u5DDE",label:"\u94A6\u5DDE"},{value:"\u68A7\u5DDE",label:"\u68A7\u5DDE"},{value:"\u7389\u6797",label:"\u7389\u6797"}]},{value:"\u8D35\u5DDE",label:"\u8D35\u5DDE",children:[{value:"\u8D35\u9633",label:"\u8D35\u9633"},{value:"\u5B89\u987A",label:"\u5B89\u987A"},{value:"\u6BD5\u8282",label:"\u6BD5\u8282"},{value:"\u90FD\u5300",label:"\u90FD\u5300"},{value:"\u51EF\u91CC",label:"\u51EF\u91CC"},{value:"\u516D\u76D8\u6C34",label:"\u516D\u76D8\u6C34"},{value:"\u94DC\u4EC1",label:"\u94DC\u4EC1"},{value:"\u5174\u4E49",label:"\u5174\u4E49"},{value:"\u7389\u5C4F",label:"\u7389\u5C4F"},{value:"\u9075\u4E49",label:"\u9075\u4E49"}]},{value:"\u6D77\u5357",label:"\u6D77\u5357",children:[{value:"\u6D77\u53E3",label:"\u6D77\u53E3"},{value:"\u510B\u53BF",label:"\u510B\u53BF"},{value:"\u9675\u6C34",label:"\u9675\u6C34"},{value:"\u743C\u6D77",label:"\u743C\u6D77"},{value:"\u4E09\u4E9A",label:"\u4E09\u4E9A"},{value:"\u901A\u4EC0",label:"\u901A\u4EC0"},{value:"\u4E07\u5B81",label:"\u4E07\u5B81"}]},{value:"\u6CB3\u5317",label:"\u6CB3\u5317",children:[{value:"\u77F3\u5BB6\u5E84",label:"\u77F3\u5BB6\u5E84"},{value:"\u4FDD\u5B9A",label:"\u4FDD\u5B9A"},{value:"\u5317\u6234\u6CB3",label:"\u5317\u6234\u6CB3"},{value:"\u6CA7\u5DDE",label:"\u6CA7\u5DDE"},{value:"\u627F\u5FB7",label:"\u627F\u5FB7"},{value:"\u4E30\u6DA6",label:"\u4E30\u6DA6"},{value:"\u90AF\u90F8",label:"\u90AF\u90F8"},{value:"\u8861\u6C34",label:"\u8861\u6C34"},{value:"\u5ECA\u574A",label:"\u5ECA\u574A"},{value:"\u5357\u6234\u6CB3",label:"\u5357\u6234\u6CB3"},{value:"\u79E6\u7687\u5C9B",label:"\u79E6\u7687\u5C9B"},{value:"\u5510\u5C71",label:"\u5510\u5C71"},{value:"\u65B0\u57CE",label:"\u65B0\u57CE"},{value:"\u90A2\u53F0",label:"\u90A2\u53F0"},{value:"\u5F20\u5BB6\u53E3",label:"\u5F20\u5BB6\u53E3"}]},{value:"\u9ED1\u9F99\u6C5F",label:"\u9ED1\u9F99\u6C5F",children:[{value:"\u54C8\u5C14\u6EE8",label:"\u54C8\u5C14\u6EE8"},{value:"\u5317\u5B89",label:"\u5317\u5B89"},{value:"\u5927\u5E86",label:"\u5927\u5E86"},{value:"\u5927\u5174\u5B89\u5CAD",label:"\u5927\u5174\u5B89\u5CAD"},{value:"\u9E64\u5C97",label:"\u9E64\u5C97"},{value:"\u9ED1\u6CB3",label:"\u9ED1\u6CB3"},{value:"\u4F73\u6728\u65AF",label:"\u4F73\u6728\u65AF"},{value:"\u9E21\u897F",label:"\u9E21\u897F"},{value:"\u7261\u4E39\u6C5F",label:"\u7261\u4E39\u6C5F"},{value:"\u9F50\u9F50\u54C8\u5C14",label:"\u9F50\u9F50\u54C8\u5C14"},{value:"\u4E03\u53F0\u6CB3",label:"\u4E03\u53F0\u6CB3"},{value:"\u53CC\u9E2D\u5C71",label:"\u53CC\u9E2D\u5C71"},{value:"\u7EE5\u5316",label:"\u7EE5\u5316"},{value:"\u4F0A\u6625",label:"\u4F0A\u6625"}]},{value:"\u6CB3\u5357",label:"\u6CB3\u5357",children:[{value:"\u90D1\u5DDE",label:"\u90D1\u5DDE"},{value:"\u5B89\u9633",label:"\u5B89\u9633"},{value:"\u9E64\u58C1",label:"\u9E64\u58C1"},{value:"\u6F62\u5DDD",label:"\u6F62\u5DDD"},{value:"\u7126\u4F5C",label:"\u7126\u4F5C"},{value:"\u6D4E\u6E90",label:"\u6D4E\u6E90"},{value:"\u5F00\u5C01",label:"\u5F00\u5C01"},{value:"\u6F2F\u6CB3",label:"\u6F2F\u6CB3"},{value:"\u6D1B\u9633",label:"\u6D1B\u9633"},{value:"\u5357\u9633",label:"\u5357\u9633"},{value:"\u5E73\u9876\u5C71",label:"\u5E73\u9876\u5C71"},{value:"\u6FEE\u9633",label:"\u6FEE\u9633"},{value:"\u4E09\u95E8\u5CE1",label:"\u4E09\u95E8\u5CE1"},{value:"\u5546\u4E18",label:"\u5546\u4E18"},{value:"\u65B0\u4E61",label:"\u65B0\u4E61"},{value:"\u4FE1\u9633",label:"\u4FE1\u9633"},{value:"\u8BB8\u660C",label:"\u8BB8\u660C"},{value:"\u5468\u53E3",label:"\u5468\u53E3"},{value:"\u9A7B\u9A6C\u5E97",label:"\u9A7B\u9A6C\u5E97"}]},{value:"\u9999\u6E2F",label:"\u9999\u6E2F",children:[{value:"\u9999\u6E2F",label:"\u9999\u6E2F"},{value:"\u4E5D\u9F99",label:"\u4E5D\u9F99"},{value:"\u65B0\u754C",label:"\u65B0\u754C"}]},{value:"\u6E56\u5317",label:"\u6E56\u5317",children:[{value:"\u6B66\u6C49",label:"\u6B66\u6C49"},{value:"\u5929\u95E8",label:"\u5929\u95E8"},{value:"\u6069\u65BD",label:"\u6069\u65BD"},{value:"\u9102\u5DDE",label:"\u9102\u5DDE"},{value:"\u9EC4\u5188",label:"\u9EC4\u5188"},{value:"\u9EC4\u77F3",label:"\u9EC4\u77F3"},{value:"\u8346\u95E8",label:"\u8346\u95E8"},{value:"\u8346\u5DDE",label:"\u8346\u5DDE"},{value:"\u6F5C\u6C5F",label:"\u6F5C\u6C5F"},{value:"\u5341\u5830",label:"\u5341\u5830"},{value:"\u968F\u5DDE",label:"\u968F\u5DDE"},{value:"\u6B66\u7A74",label:"\u6B66\u7A74"},{value:"\u4ED9\u6843",label:"\u4ED9\u6843"},{value:"\u54B8\u5B81",label:"\u54B8\u5B81"},{value:"\u8944\u9633",label:"\u8944\u9633"},{value:"\u8944\u6A0A",label:"\u8944\u6A0A"},{value:"\u5B5D\u611F",label:"\u5B5D\u611F"},{value:"\u5B9C\u660C",label:"\u5B9C\u660C"}]},{value:"\u6E56\u5357",label:"\u6E56\u5357",children:[{value:"\u957F\u6C99",label:"\u957F\u6C99"},{value:"\u5E38\u5FB7",label:"\u5E38\u5FB7"},{value:"\u90F4\u5DDE",label:"\u90F4\u5DDE"},{value:"\u8861\u9633",label:"\u8861\u9633"},{value:"\u6000\u5316",label:"\u6000\u5316"},{value:"\u5409\u9996",label:"\u5409\u9996"},{value:"\u5A04\u5E95",label:"\u5A04\u5E95"},{value:"\u90B5\u9633",label:"\u90B5\u9633"},{value:"\u6E58\u6F6D",label:"\u6E58\u6F6D"},{value:"\u76CA\u9633",label:"\u76CA\u9633"},{value:"\u5CB3\u9633",label:"\u5CB3\u9633"},{value:"\u6C38\u5DDE",label:"\u6C38\u5DDE"},{value:"\u5F20\u5BB6\u754C",label:"\u5F20\u5BB6\u754C"},{value:"\u682A\u6D32",label:"\u682A\u6D32"}]},{value:"\u6C5F\u897F",label:"\u6C5F\u897F",children:[{value:"\u5357\u660C",label:"\u5357\u660C"},{value:"\u629A\u5DDE",label:"\u629A\u5DDE"},{value:"\u8D63\u5DDE",label:"\u8D63\u5DDE"},{value:"\u5409\u5B89",label:"\u5409\u5B89"},{value:"\u666F\u5FB7\u9547",label:"\u666F\u5FB7\u9547"},{value:"\u4E95\u5188\u5C71",label:"\u4E95\u5188\u5C71"},{value:"\u4E5D\u6C5F",label:"\u4E5D\u6C5F"},{value:"\u5E90\u5C71",label:"\u5E90\u5C71"},{value:"\u840D\u4E61",label:"\u840D\u4E61"},{value:"\u4E0A\u9976",label:"\u4E0A\u9976"},{value:"\u65B0\u4F59",label:"\u65B0\u4F59"},{value:"\u5B9C\u6625",label:"\u5B9C\u6625"},{value:"\u9E70\u6F6D",label:"\u9E70\u6F6D"}]},{value:"\u5409\u6797",label:"\u5409\u6797",children:[{value:"\u957F\u6625",label:"\u957F\u6625"},{value:"\u5409\u6797",label:"\u5409\u6797"},{value:"\u767D\u57CE",label:"\u767D\u57CE"},{value:"\u767D\u5C71",label:"\u767D\u5C71"},{value:"\u73F2\u6625",label:"\u73F2\u6625"},{value:"\u8FBD\u6E90",label:"\u8FBD\u6E90"},{value:"\u6885\u6CB3",label:"\u6885\u6CB3"},{value:"\u56DB\u5E73",label:"\u56DB\u5E73"},{value:"\u677E\u539F",label:"\u677E\u539F"},{value:"\u901A\u5316",label:"\u901A\u5316"},{value:"\u5EF6\u5409",label:"\u5EF6\u5409"}]},{value:"\u8FBD\u5B81",label:"\u8FBD\u5B81",children:[{value:"\u6C88\u9633",label:"\u6C88\u9633"},{value:"\u978D\u5C71",label:"\u978D\u5C71"},{value:"\u672C\u6EAA",label:"\u672C\u6EAA"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u5927\u8FDE",label:"\u5927\u8FDE"},{value:"\u4E39\u4E1C",label:"\u4E39\u4E1C"},{value:"\u629A\u987A",label:"\u629A\u987A"},{value:"\u961C\u65B0",label:"\u961C\u65B0"},{value:"\u846B\u82A6\u5C9B",label:"\u846B\u82A6\u5C9B"},{value:"\u9526\u5DDE",label:"\u9526\u5DDE"},{value:"\u8FBD\u9633",label:"\u8FBD\u9633"},{value:"\u76D8\u9526",label:"\u76D8\u9526"},{value:"\u94C1\u5CAD",label:"\u94C1\u5CAD"},{value:"\u8425\u53E3",label:"\u8425\u53E3"}]},{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8",children:[{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8"}]},{value:"\u5185\u8499\u53E4",label:"\u5185\u8499\u53E4",children:[{value:"\u547C\u548C\u6D69\u7279",label:"\u547C\u548C\u6D69\u7279"},{value:"\u963F\u62C9\u5584\u76DF",label:"\u963F\u62C9\u5584\u76DF"},{value:"\u5305\u5934",label:"\u5305\u5934"},{value:"\u8D64\u5CF0",label:"\u8D64\u5CF0"},{value:"\u4E1C\u80DC",label:"\u4E1C\u80DC"},{value:"\u6D77\u62C9\u5C14",label:"\u6D77\u62C9\u5C14"},{value:"\u96C6\u5B81",label:"\u96C6\u5B81"},{value:"\u4E34\u6CB3",label:"\u4E34\u6CB3"},{value:"\u901A\u8FBD",label:"\u901A\u8FBD"},{value:"\u4E4C\u6D77",label:"\u4E4C\u6D77"},{value:"\u4E4C\u5170\u6D69\u7279",label:"\u4E4C\u5170\u6D69\u7279"},{value:"\u9521\u6797\u6D69\u7279",label:"\u9521\u6797\u6D69\u7279"}]},{value:"\u5B81\u590F",label:"\u5B81\u590F",children:[{value:"\u94F6\u5DDD",label:"\u94F6\u5DDD"},{value:"\u56FA\u6E90",label:"\u56FA\u6E90"},{value:"\u77F3\u5634\u5C71",label:"\u77F3\u5634\u5C71"},{value:"\u5434\u5FE0",label:"\u5434\u5FE0"}]},{value:"\u9752\u6D77",label:"\u9752\u6D77",children:[{value:"\u897F\u5B81",label:"\u897F\u5B81"},{value:"\u5FB7\u4EE4\u54C8",label:"\u5FB7\u4EE4\u54C8"},{value:"\u683C\u5C14\u6728",label:"\u683C\u5C14\u6728"},{value:"\u5171\u548C",label:"\u5171\u548C"},{value:"\u6D77\u4E1C",label:"\u6D77\u4E1C"},{value:"\u6D77\u664F",label:"\u6D77\u664F"},{value:"\u739B\u6C81",label:"\u739B\u6C81"},{value:"\u540C\u4EC1",label:"\u540C\u4EC1"},{value:"\u7389\u6811",label:"\u7389\u6811"}]},{value:"\u5C71\u4E1C",label:"\u5C71\u4E1C",children:[{value:"\u6D4E\u5357",label:"\u6D4E\u5357"},{value:"\u6EE8\u5DDE",label:"\u6EE8\u5DDE"},{value:"\u5156\u5DDE",label:"\u5156\u5DDE"},{value:"\u5FB7\u5DDE",label:"\u5FB7\u5DDE"},{value:"\u4E1C\u8425",label:"\u4E1C\u8425"},{value:"\u83CF\u6CFD",label:"\u83CF\u6CFD"},{value:"\u6D4E\u5B81",label:"\u6D4E\u5B81"},{value:"\u83B1\u829C",label:"\u83B1\u829C"},{value:"\u804A\u57CE",label:"\u804A\u57CE"},{value:"\u4E34\u6C82",label:"\u4E34\u6C82"},{value:"\u84EC\u83B1",label:"\u84EC\u83B1"},{value:"\u9752\u5C9B",label:"\u9752\u5C9B"},{value:"\u66F2\u961C",label:"\u66F2\u961C"},{value:"\u65E5\u7167",label:"\u65E5\u7167"},{value:"\u6CF0\u5B89",label:"\u6CF0\u5B89"},{value:"\u6F4D\u574A",label:"\u6F4D\u574A"},{value:"\u5A01\u6D77",label:"\u5A01\u6D77"},{value:"\u70DF\u53F0",label:"\u70DF\u53F0"},{value:"\u67A3\u5E84",label:"\u67A3\u5E84"},{value:"\u6DC4\u535A",label:"\u6DC4\u535A"}]},{value:"\u5C71\u897F",label:"\u5C71\u897F",children:[{value:"\u592A\u539F",label:"\u592A\u539F"},{value:"\u5415\u6881",label:"\u5415\u6881"},{value:"\u957F\u6CBB",label:"\u957F\u6CBB"},{value:"\u5927\u540C",label:"\u5927\u540C"},{value:"\u5019\u9A6C",label:"\u5019\u9A6C"},{value:"\u664B\u57CE",label:"\u664B\u57CE"},{value:"\u79BB\u77F3",label:"\u79BB\u77F3"},{value:"\u4E34\u6C7E",label:"\u4E34\u6C7E"},{value:"\u5B81\u6B66",label:"\u5B81\u6B66"},{value:"\u6714\u5DDE",label:"\u6714\u5DDE"},{value:"\u5FFB\u5DDE",label:"\u5FFB\u5DDE"},{value:"\u9633\u6CC9",label:"\u9633\u6CC9"},{value:"\u6986\u6B21",label:"\u6986\u6B21"},{value:"\u664B\u4E2D",label:"\u664B\u4E2D"},{value:"\u8FD0\u57CE",label:"\u8FD0\u57CE"}]},{value:"\u9655\u897F",label:"\u9655\u897F",children:[{value:"\u897F\u5B89",label:"\u897F\u5B89"},{value:"\u5B89\u5EB7",label:"\u5B89\u5EB7"},{value:"\u5B9D\u9E21",label:"\u5B9D\u9E21"},{value:"\u6C49\u4E2D",label:"\u6C49\u4E2D"},{value:"\u6E2D\u5357",label:"\u6E2D\u5357"},{value:"\u5546\u5DDE",label:"\u5546\u5DDE"},{value:"\u7EE5\u5FB7",label:"\u7EE5\u5FB7"},{value:"\u94DC\u5DDD",label:"\u94DC\u5DDD"},{value:"\u54B8\u9633",label:"\u54B8\u9633"},{value:"\u5EF6\u5B89",label:"\u5EF6\u5B89"},{value:"\u6986\u6797",label:"\u6986\u6797"}]},{value:"\u56DB\u5DDD",label:"\u56DB\u5DDD",children:[{value:"\u6210\u90FD",label:"\u6210\u90FD"},{value:"\u5DF4\u4E2D",label:"\u5DF4\u4E2D"},{value:"\u8FBE\u5DDD",label:"\u8FBE\u5DDD"},{value:"\u5FB7\u9633",label:"\u5FB7\u9633"},{value:"\u90FD\u6C5F\u5830",label:"\u90FD\u6C5F\u5830"},{value:"\u5CE8\u7709\u5C71",label:"\u5CE8\u7709\u5C71"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u5E7F\u5B89",label:"\u5E7F\u5B89"},{value:"\u5E7F\u5143",label:"\u5E7F\u5143"},{value:"\u4E5D\u5BE8\u6C9F",label:"\u4E5D\u5BE8\u6C9F"},{value:"\u5EB7\u5B9A",label:"\u5EB7\u5B9A"},{value:"\u4E50\u5C71",label:"\u4E50\u5C71"},{value:"\u6CF8\u5DDE",label:"\u6CF8\u5DDE"},{value:"\u9A6C\u5C14\u5EB7",label:"\u9A6C\u5C14\u5EB7"},{value:"\u7EF5\u9633",label:"\u7EF5\u9633"},{value:"\u7709\u5C71",label:"\u7709\u5C71"},{value:"\u5357\u5145",label:"\u5357\u5145"},{value:"\u5185\u6C5F",label:"\u5185\u6C5F"},{value:"\u6500\u679D\u82B1",label:"\u6500\u679D\u82B1"},{value:"\u9042\u5B81",label:"\u9042\u5B81"},{value:"\u6C76\u5DDD",label:"\u6C76\u5DDD"},{value:"\u897F\u660C",label:"\u897F\u660C"},{value:"\u96C5\u5B89",label:"\u96C5\u5B89"},{value:"\u5B9C\u5BBE",label:"\u5B9C\u5BBE"},{value:"\u81EA\u8D21",label:"\u81EA\u8D21"},{value:"\u8D44\u9633",label:"\u8D44\u9633"}]},{value:"\u53F0\u6E7E",label:"\u53F0\u6E7E",children:[{value:"\u53F0\u5317",label:"\u53F0\u5317"},{value:"\u57FA\u9686",label:"\u57FA\u9686"},{value:"\u53F0\u5357",label:"\u53F0\u5357"},{value:"\u53F0\u4E2D",label:"\u53F0\u4E2D"},{value:"\u9AD8\u96C4",label:"\u9AD8\u96C4"},{value:"\u5C4F\u4E1C",label:"\u5C4F\u4E1C"},{value:"\u5357\u6295",label:"\u5357\u6295"},{value:"\u4E91\u6797",label:"\u4E91\u6797"},{value:"\u65B0\u7AF9",label:"\u65B0\u7AF9"},{value:"\u5F70\u5316",label:"\u5F70\u5316"},{value:"\u82D7\u6817",label:"\u82D7\u6817"},{value:"\u5609\u4E49",label:"\u5609\u4E49"},{value:"\u6843\u56ED",label:"\u6843\u56ED"},{value:"\u5B9C\u5170",label:"\u5B9C\u5170"},{value:"\u53F0\u4E1C",label:"\u53F0\u4E1C"},{value:"\u91D1\u95E8",label:"\u91D1\u95E8"},{value:"\u9A6C\u7956",label:"\u9A6C\u7956"},{value:"\u6F8E\u6E56",label:"\u6F8E\u6E56"}]},{value:"\u5929\u6D25",label:"\u5929\u6D25",children:[{value:"\u5929\u6D25",label:"\u5929\u6D25"},{value:"\u548C\u5E73",label:"\u548C\u5E73"},{value:"\u4E1C\u4E3D",label:"\u4E1C\u4E3D"},{value:"\u6CB3\u4E1C",label:"\u6CB3\u4E1C"},{value:"\u897F\u9752",label:"\u897F\u9752"},{value:"\u6CB3\u897F",label:"\u6CB3\u897F"},{value:"\u6D25\u5357",label:"\u6D25\u5357"},{value:"\u5357\u5F00",label:"\u5357\u5F00"},{value:"\u5317\u8FB0",label:"\u5317\u8FB0"},{value:"\u6CB3\u5317",label:"\u6CB3\u5317"},{value:"\u6B66\u6E05",label:"\u6B66\u6E05"},{value:"\u7EA2\u6322",label:"\u7EA2\u6322"},{value:"\u5858\u6CBD",label:"\u5858\u6CBD"},{value:"\u6C49\u6CBD",label:"\u6C49\u6CBD"},{value:"\u5927\u6E2F",label:"\u5927\u6E2F"},{value:"\u5B81\u6CB3",label:"\u5B81\u6CB3"},{value:"\u9759\u6D77",label:"\u9759\u6D77"},{value:"\u5B9D\u577B",label:"\u5B9D\u577B"},{value:"\u84DF\u53BF",label:"\u84DF\u53BF"}]},{value:"\u65B0\u7586",label:"\u65B0\u7586",children:[{value:"\u4E4C\u9C81\u6728\u9F50",label:"\u4E4C\u9C81\u6728\u9F50"},{value:"\u963F\u514B\u82CF",label:"\u963F\u514B\u82CF"},{value:"\u963F\u52D2\u6CF0",label:"\u963F\u52D2\u6CF0"},{value:"\u963F\u56FE\u4EC0",label:"\u963F\u56FE\u4EC0"},{value:"\u535A\u4E50",label:"\u535A\u4E50"},{value:"\u660C\u5409",label:"\u660C\u5409"},{value:"\u4E1C\u5C71",label:"\u4E1C\u5C71"},{value:"\u54C8\u5BC6",label:"\u54C8\u5BC6"},{value:"\u548C\u7530",label:"\u548C\u7530"},{value:"\u5580\u4EC0",label:"\u5580\u4EC0"},{value:"\u514B\u62C9\u739B\u4F9D",label:"\u514B\u62C9\u739B\u4F9D"},{value:"\u5E93\u8F66",label:"\u5E93\u8F66"},{value:"\u5E93\u5C14\u52D2",label:"\u5E93\u5C14\u52D2"},{value:"\u594E\u5C6F",label:"\u594E\u5C6F"},{value:"\u77F3\u6CB3\u5B50",label:"\u77F3\u6CB3\u5B50"},{value:"\u5854\u57CE",label:"\u5854\u57CE"},{value:"\u5410\u9C81\u756A",label:"\u5410\u9C81\u756A"},{value:"\u4F0A\u5B81",label:"\u4F0A\u5B81"}]},{value:"\u897F\u85CF",label:"\u897F\u85CF",children:[{value:"\u62C9\u8428",label:"\u62C9\u8428"},{value:"\u963F\u91CC",label:"\u963F\u91CC"},{value:"\u660C\u90FD",label:"\u660C\u90FD"},{value:"\u6797\u829D",label:"\u6797\u829D"},{value:"\u90A3\u66F2",label:"\u90A3\u66F2"},{value:"\u65E5\u5580\u5219",label:"\u65E5\u5580\u5219"},{value:"\u5C71\u5357",label:"\u5C71\u5357"}]},{value:"\u4E91\u5357",label:"\u4E91\u5357",children:[{value:"\u6606\u660E",label:"\u6606\u660E"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4FDD\u5C71",label:"\u4FDD\u5C71"},{value:"\u695A\u96C4",label:"\u695A\u96C4"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4E1C\u5DDD",label:"\u4E1C\u5DDD"},{value:"\u4E2A\u65E7",label:"\u4E2A\u65E7"},{value:"\u666F\u6D2A",label:"\u666F\u6D2A"},{value:"\u5F00\u8FDC",label:"\u5F00\u8FDC"},{value:"\u4E34\u6CA7",label:"\u4E34\u6CA7"},{value:"\u4E3D\u6C5F",label:"\u4E3D\u6C5F"},{value:"\u516D\u5E93",label:"\u516D\u5E93"},{value:"\u6F5E\u897F",label:"\u6F5E\u897F"},{value:"\u66F2\u9756",label:"\u66F2\u9756"},{value:"\u601D\u8305",label:"\u601D\u8305"},{value:"\u6587\u5C71",label:"\u6587\u5C71"},{value:"\u897F\u53CC\u7248\u7EB3",label:"\u897F\u53CC\u7248\u7EB3"},{value:"\u7389\u6EAA",label:"\u7389\u6EAA"},{value:"\u4E2D\u7538",label:"\u4E2D\u7538"},{value:"\u662D\u901A",label:"\u662D\u901A"}]},{value:"\u6D59\u6C5F",label:"\u6D59\u6C5F",children:[{value:"\u676D\u5DDE",label:"\u676D\u5DDE"},{value:"\u6E29\u5DDE",label:"\u6E29\u5DDE"},{value:"\u5B89\u5409",label:"\u5B89\u5409"},{value:"\u6148\u6EAA",label:"\u6148\u6EAA"},{value:"\u5B9A\u6D77",label:"\u5B9A\u6D77"},{value:"\u5949\u5316",label:"\u5949\u5316"},{value:"\u6D77\u76D0",label:"\u6D77\u76D0"},{value:"\u9EC4\u5CA9",label:"\u9EC4\u5CA9"},{value:"\u6E56\u5DDE",label:"\u6E56\u5DDE"},{value:"\u5609\u5174",label:"\u5609\u5174"},{value:"\u91D1\u534E",label:"\u91D1\u534E"},{value:"\u4E34\u5B89",label:"\u4E34\u5B89"},{value:"\u4E34\u6D77",label:"\u4E34\u6D77"},{value:"\u4E3D\u6C34",label:"\u4E3D\u6C34"},{value:"\u5B81\u6CE2",label:"\u5B81\u6CE2"},{value:"\u74EF\u6D77",label:"\u74EF\u6D77"},{value:"\u5E73\u6E56",label:"\u5E73\u6E56"},{value:"\u5343\u5C9B\u6E56",label:"\u5343\u5C9B\u6E56"},{value:"\u8862\u5DDE",label:"\u8862\u5DDE"},{value:"\u6C5F\u5C71",label:"\u6C5F\u5C71"},{value:"\u745E\u5B89",label:"\u745E\u5B89"},{value:"\u7ECD\u5174",label:"\u7ECD\u5174"},{value:"\u5D4A\u5DDE",label:"\u5D4A\u5DDE"},{value:"\u53F0\u5DDE",label:"\u53F0\u5DDE"},{value:"\u6E29\u5CAD",label:"\u6E29\u5CAD"},{value:"\u4F59\u59DA",label:"\u4F59\u59DA"},{value:"\u821F\u5C71",label:"\u821F\u5C71"}]},{value:"\u6D77\u5916",label:"\u6D77\u5916",children:[{value:"\u7F8E\u56FD",label:"\u7F8E\u56FD"},{value:"\u65E5\u672C",label:"\u65E5\u672C"},{value:"\u82F1\u56FD",label:"\u82F1\u56FD"},{value:"\u6CD5\u56FD",label:"\u6CD5\u56FD"},{value:"\u5FB7\u56FD",label:"\u5FB7\u56FD"},{value:"\u5176\u4ED6",label:"\u5176\u4ED6"}]}]},h78n:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return C});var he=ie("q1tI"),Y=ie.n(he),O=ie("TSYQ"),Z=ie.n(O),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},I=function(z){var V=z.map(function(){return Object(he.useRef)()}),P=Object(he.useRef)();return Object(he.useEffect)(function(){var N=Date.now(),$=!1;Object.keys(V).forEach(function(re){var pe=V[re].current;if(!pe)return;$=!0;var ve=pe.style;ve.transitionDuration=".3s, .3s, .3s, .06s",P.current&&N-P.current<100&&(ve.transitionDuration="0s, 0s")}),$&&(P.current=Date.now())}),[V]};function K(){return K=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(j[P]=V[P])}return j},K.apply(this,arguments)}function B(j,z){return _(j)||L(j,z)||R(j,z)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(j,z){if(!j)return;if(typeof j=="string")return E(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return E(j,z)}function E(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,P=new Array(z);V<z;V++)P[V]=j[V];return P}function L(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],P=!0,N=!1,$=void 0;try{for(var re=j[Symbol.iterator](),pe;!(P=(pe=re.next()).done)&&!(V.push(pe.value),z&&V.length===z);P=!0);}catch(ve){N=!0,$=ve}finally{try{!P&&re.return!=null&&re.return()}finally{if(N)throw $}}return V}function _(j){if(Array.isArray(j))return j}function A(j,z){if(j==null)return{};var V=x(j,z),P,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(N=0;N<$.length;N++){if(P=$[N],z.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function x(j,z){if(j==null)return{};var V={},P=Object.keys(j),N,$;for($=0;$<P.length;$++){if(N=P[$],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var y=function(z){var V=z.className,P=z.percent,N=z.prefixCls,$=z.strokeColor,re=z.strokeLinecap,pe=z.strokeWidth,ve=z.style,Ae=z.trailColor,Le=z.trailWidth,ce=z.transition,ae=A(z,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ae.gapPosition;var de=Array.isArray(P)?P:[P],ne=Array.isArray($)?$:[$],se=I(de),J=B(se,1),ee=J[0],oe=pe/2,fe=100-pe/2,ke="M ".concat(re==="round"?oe:0,",").concat(oe,`
L `).concat(re==="round"?fe:100,",").concat(oe),ge="0 0 100 ".concat(pe),De=0;return Y.a.createElement("svg",K({className:Z()("".concat(N,"-line"),V),viewBox:ge,preserveAspectRatio:"none",style:ve},ae),Y.a.createElement("path",{className:"".concat(N,"-line-trail"),d:ke,strokeLinecap:re,stroke:Ae,strokeWidth:Le||pe,fillOpacity:"0"}),de.map(function(Me,Ue){var Ke={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(De,"px"),transition:ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},He=ne[Ue]||ne[ne.length-1];return De+=Me,Y.a.createElement("path",{key:Ue,className:"".concat(N,"-line-path"),d:ke,strokeLinecap:re,stroke:He,strokeWidth:pe,fillOpacity:"0",ref:ee[Ue],style:Ke})}))};y.defaultProps=U;var h=y;function o(){return o=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(j[P]=V[P])}return j},o.apply(this,arguments)}function l(j,z){return w(j)||p(j,z)||S(j,z)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(j,z){if(!j)return;if(typeof j=="string")return g(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return g(j,z)}function g(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,P=new Array(z);V<z;V++)P[V]=j[V];return P}function p(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],P=!0,N=!1,$=void 0;try{for(var re=j[Symbol.iterator](),pe;!(P=(pe=re.next()).done)&&!(V.push(pe.value),z&&V.length===z);P=!0);}catch(ve){N=!0,$=ve}finally{try{!P&&re.return!=null&&re.return()}finally{if(N)throw $}}return V}function w(j){if(Array.isArray(j))return j}function b(j,z){if(j==null)return{};var V=u(j,z),P,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(N=0;N<$.length;N++){if(P=$[N],z.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function u(j,z){if(j==null)return{};var V={},P=Object.keys(j),N,$;for($=0;$<P.length;$++){if(N=P[$],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var f=0;function s(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function T(j,z,V,P){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,re=50-P/2,pe=0,ve=-re,Ae=0,Le=-2*re;switch($){case"left":pe=-re,ve=0,Ae=2*re,Le=0;break;case"right":pe=re,ve=0,Ae=-2*re,Le=0;break;case"bottom":ve=re,Le=2*re;break;default:}var ce="M 50,50 m ".concat(pe,",").concat(ve,`
a `).concat(re,",").concat(re," 0 1 1 ").concat(Ae,",").concat(-Le,`
a `).concat(re,",").concat(re," 0 1 1 ").concat(-Ae,",").concat(Le),ae=Math.PI*2*re,de={stroke:V,strokeDasharray:"".concat(z/100*(ae-N),"px ").concat(ae,"px"),strokeDashoffset:"-".concat(N/2+j/100*(ae-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ce,pathStyle:de}}var v=function(z){var V=z.prefixCls,P=z.strokeWidth,N=z.trailWidth,$=z.gapDegree,re=z.gapPosition,pe=z.trailColor,ve=z.strokeLinecap,Ae=z.style,Le=z.className,ce=z.strokeColor,ae=z.percent,de=b(z,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(he.useMemo)(function(){return f+=1,f},[]),se=T(0,100,pe,P,$,re),J=se.pathString,ee=se.pathStyle,oe=a(ae),fe=a(ce),ke=fe.find(function(Ke){return Object.prototype.toString.call(Ke)==="[object Object]"}),ge=I(oe),De=l(ge,1),Me=De[0],Ue=function(){var He=0;return oe.map(function(Be,rt){var Oe=fe[rt]||fe[fe.length-1],Fe=Object.prototype.toString.call(Oe)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ne,")"):"",je=T(He,Be,Oe,P,$,re);return He+=Be,Y.a.createElement("path",{key:rt,className:"".concat(V,"-circle-path"),d:je.pathString,stroke:Fe,strokeLinecap:ve,strokeWidth:P,opacity:Be===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:Me[rt]})})};return Y.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),Le),viewBox:"0 0 100 100",style:Ae},de),ke&&Y.a.createElement("defs",null,Y.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ke).sort(function(Ke,He){return s(Ke)-s(He)}).map(function(Ke,He){return Y.a.createElement("stop",{key:He,offset:Ke,stopColor:ke[Ke]})}))),Y.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:J,stroke:pe,strokeLinecap:ve,strokeWidth:N||P,fillOpacity:"0",style:ee}),Ue().reverse())};v.defaultProps=U;var C=v,D={Line:h,Circle:C}},hxT0:function(Et,tt,ie){Et.exports={bg:"bg___2samk",wrap:"wrap___1kw4T",crumbs:"crumbs___1aICA",titleWrap:"titleWrap___3U2TN",flexRow:"flexRow___2Ocys",flexJustifyCenter:"flexJustifyCenter___14s6l",flexAlignEnd:"flexAlignEnd___1lHt8",flexAlignCenter:"flexAlignCenter___2PtCV",flexColumn:"flexColumn___2Ssa4",formWrap:"formWrap___3Fcg8",fieldWrap:"fieldWrap___3K6pg",mdWrap:"mdWrap___3o_rf",backgroundFa:"backgroundFa___3dwFi",aBtn:"aBtn___12lxK",bBtn:"bBtn___18QB-",cascaderWrap:"cascaderWrap___ETHsj",listItem:"listItem___C62yl",right:"right___1iif8",one:"one___2Qd4F",schoolHintWrap:"schoolHintWrap___34WkA",colorCDCDCD:"colorCDCDCD___HqcpR",color0152d9:"color0152d9___cQ4G4",spanText:"spanText___1YP81"}},kSUc:function(Et,tt,ie){},lZu9:function(Et,tt,ie){(function(he){he(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(he){"use strict";he.defineMode("markdown",function(Y,O){var Z=he.getMode(Y,"text/html"),U=Z.name=="null";function I(P){if(he.findModeByName){var N=he.findModeByName(P);N&&(P=N.mime||N.mimes[0])}var $=he.getMode(Y,P);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var K={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var B in K)K.hasOwnProperty(B)&&O.tokenTypeOverrides[B]&&(K[B]=O.tokenTypeOverrides[B]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,L=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(P,N,$){return N.f=N.inline=$,$(P,N)}function d(P,N,$){return N.f=N.block=$,$(P,N)}function S(P){return!P||!/\S/.test(P.string)}function g(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==w){var N=U;if(!N){var $=he.innerMode(Z,P.htmlState);N=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}N&&(P.f=s,P.block=p,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function p(P,N){var $=P.column()===N.indentation,re=S(N.prevLine.stream),pe=N.indentedCode,ve=N.prevLine.hr,Ae=N.list!==!1,Le=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var ce=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ae)){for(N.list=null;ce<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=ce-N.listStack[N.listStack.length-1])}var ae=!re&&!ve&&!N.prevLine.header&&(!Ae||!pe)&&!N.prevLine.fencedCodeEnd,de=(N.list===!1||ve||re)&&N.indentation<=Le&&P.match(M),ne=null;if(N.indentationDiff>=4&&(pe||N.prevLine.fencedCodeEnd||N.prevLine.header||re))return P.skipToEnd(),N.indentedCode=!0,K.code;if(P.eatSpace())return null;if($&&N.indentation<=Le&&(ne=P.match(L))&&ne[1].length<=6)return N.quote=0,N.header=ne[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,u(N);if(N.indentation<=Le&&P.eat(">"))return N.quote=$?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),P.eatSpace(),u(N);if(!de&&!N.setext&&$&&N.indentation<=Le&&(ne=P.match(R))){var se=ne[1]?"ol":"ul";return N.indentation=ce+P.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&P.match(E,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+se]),u(N)}else{if($&&N.indentation<=Le&&(ne=P.match(x,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ne[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&I(ne[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=he.startState(N.localMode)),N.f=N.block=b,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,u(N);if(N.setext||(!ae||!Ae)&&!N.quote&&N.list===!1&&!N.code&&!de&&!y.test(P.string)&&(ne=P.lookAhead(1))&&(ne=ne.match(_)))return N.setext?(N.header=N.setext,N.setext=0,P.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=ne[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,u(N);if(de)return P.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,K.hr;if(P.peek()==="[")return l(P,N,D)}return l(P,N,N.inline)}function w(P,N){var $=Z.token(P,N.htmlState);if(!U){var re=he.innerMode(Z,N.htmlState);(re.mode.name=="xml"&&re.state.tagStart===null&&!re.state.context&&re.state.tokenize.isInText||N.md_inside&&P.current().indexOf(">")>-1)&&(N.f=s,N.block=p,N.htmlState=null)}return $}function b(P,N){var $=N.listStack[N.listStack.length-1]||0,re=N.indentation<$,pe=$+3;if(N.fencedEndRE&&N.indentation<=pe&&(re||P.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var ve;return re||(ve=u(N)),N.localMode=N.localState=null,N.block=p,N.f=s,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,re?d(P,N,N.block):ve}else return N.localMode?N.localMode.token(P,N.localState):(P.skipToEnd(),K.code)}function u(P){var N=[];if(P.formatting){N.push(K.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var $=0;$<P.formatting.length;$++)N.push(K.formatting+"-"+P.formatting[$]),P.formatting[$]==="header"&&N.push(K.formatting+"-"+P.formatting[$]+"-"+P.header),P.formatting[$]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=P.quote?N.push(K.formatting+"-"+P.formatting[$]+"-"+P.quote):N.push("error"))}if(P.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(P.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(P.linkHref?N.push(K.linkHref,"url"):(P.strong&&N.push(K.strong),P.em&&N.push(K.em),P.strikethrough&&N.push(K.strikethrough),P.emoji&&N.push(K.emoji),P.linkText&&N.push(K.linkText),P.code&&N.push(K.code),P.image&&N.push(K.image),P.imageAltText&&N.push(K.imageAltText,"link"),P.imageMarker&&N.push(K.imageMarker)),P.header&&N.push(K.header,K.header+"-"+P.header),P.quote&&(N.push(K.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=P.quote?N.push(K.quote+"-"+P.quote):N.push(K.quote+"-"+O.maxBlockquoteDepth)),P.list!==!1){var re=(P.listStack.length-1)%3;re?re===1?N.push(K.list2):N.push(K.list3):N.push(K.list1)}return P.trailingSpaceNewLine?N.push("trailing-space-new-line"):P.trailingSpace&&N.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function f(P,N){return P.match(A,!0)?u(N):void 0}function s(P,N){var $=N.text(P,N);if(typeof $!="undefined")return $;if(N.list)return N.list=null,u(N);if(N.taskList){var re=P.match(E,!0)[1]===" ";return re?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,u(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&P.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),u(N);var pe=P.next();if(N.linkTitle){N.linkTitle=!1;var ve=pe;pe==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ae="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(P.match(new RegExp(Ae),!0))return K.linkHref}if(pe==="`"){var Le=N.formatting;O.highlightFormatting&&(N.formatting="code"),P.eatWhile("`");var ce=P.current().length;if(N.code==0&&(!N.quote||ce==1))return N.code=ce,u(N);if(ce==N.code){var ae=u(N);return N.code=0,ae}else return N.formatting=Le,u(N)}else if(N.code)return u(N);if(pe==="\\"&&(P.next(),O.highlightFormatting)){var de=u(N),ne=K.formatting+"-escape";return de?de+" "+ne:ne}if(pe==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),u(N);if(pe==="["&&N.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),u(N);if(pe==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var de=u(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=T,de}if(pe==="["&&!N.image)return N.linkText&&P.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),u(N);if(pe==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var de=u(N);return N.linkText=!1,N.inline=N.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?T:s,de}if(pe==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var de=u(N);return de?de+=" ":de="",de+K.linkInline}if(pe==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var de=u(N);return de?de+=" ":de="",de+K.linkEmail}if(O.xml&&pe==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=P.string.indexOf(">",P.pos);if(se!=-1){var J=P.string.substring(P.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(N.md_inside=!0)}return P.backUp(1),N.htmlState=he.startState(Z),d(P,N,w)}if(O.xml&&pe==="<"&&P.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var ee=1,oe=P.pos==1?" ":P.string.charAt(P.pos-2);ee<3&&P.eat(pe);)ee++;var fe=P.peek()||" ",ke=!/\s/.test(fe)&&(!h.test(fe)||/\s/.test(oe)||h.test(oe)),ge=!/\s/.test(oe)&&(!h.test(oe)||/\s/.test(fe)||h.test(fe)),De=null,Me=null;if(ee%2&&(!N.em&&ke&&(pe==="*"||!ge||h.test(oe))?De=!0:N.em==pe&&ge&&(pe==="*"||!ke||h.test(fe))&&(De=!1)),ee>1&&(!N.strong&&ke&&(pe==="*"||!ge||h.test(oe))?Me=!0:N.strong==pe&&ge&&(pe==="*"||!ke||h.test(fe))&&(Me=!1)),Me!=null||De!=null){O.highlightFormatting&&(N.formatting=De==null?"strong":Me==null?"em":"strong em"),De===!0&&(N.em=pe),Me===!0&&(N.strong=pe);var ae=u(N);return De===!1&&(N.em=!1),Me===!1&&(N.strong=!1),ae}}else if(pe===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return u(N);P.backUp(1)}if(O.strikethrough){if(pe==="~"&&P.eatWhile(pe)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var ae=u(N);return N.strikethrough=!1,ae}else if(P.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),u(N)}else if(pe===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return u(N);P.backUp(2)}}if(O.emoji&&pe===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var Ue=u(N);return N.emoji=!1,Ue}return pe===" "&&(P.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),u(N)}function a(P,N){var $=P.next();if($===">"){N.f=N.inline=s,O.highlightFormatting&&(N.formatting="link");var re=u(N);return re?re+=" ":re="",re+K.linkInline}return P.match(/^[^>]+/,!0),K.linkInline}function T(P,N){if(P.eatSpace())return null;var $=P.next();return $==="("||$==="["?(N.f=N.inline=C($==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,u(N)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function C(P){return function(N,$){var re=N.next();if(re===P){$.f=$.inline=s,O.highlightFormatting&&($.formatting="link-string");var pe=u($);return $.linkHref=!1,pe}return N.match(v[P]),$.linkHref=!0,u($)}}function D(P,N){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=j,P.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,u(N)):l(P,N,s)}function j(P,N){if(P.match(/^\]:/,!0)){N.f=N.inline=z,O.highlightFormatting&&(N.formatting="link");var $=u(N);return N.linkText=!1,$}return P.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function z(P,N){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?N.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=s,K.linkHref+" url")}var V={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:s,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&he.copyState(Z,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?he.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,N){if(N.formatting=!1,P!=N.thisLine.stream){if(N.header=0,N.hr=!1,P.match(/^\s*$/,!0))return g(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:P},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=w)){var $=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(N.indentation=$,N.indentationDiff=null,$>0)return null}}return N.f(P,N)},innerMode:function(P){return P.block==w?{state:P.htmlState,mode:Z}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:V}},indent:function(P,N,$){return P.block==w&&Z.indent?Z.indent(P.htmlState,N,$):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,N,$):he.Pass},blankLine:g,getType:u,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),he.defineMIME("text/markdown","markdown"),he.defineMIME("text/x-markdown","markdown")})},osHv:function(Et,tt,ie){(function(he){he(ie("VrN/"))})(function(he){"use strict";var Y=he.Pos;function O(h,o){return h.line-o.line||h.ch-o.ch}var Z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+Z+"]["+U+"]*)","g");function K(h,o,l,d){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function B(h,o){var l=h.cm.getTokenTypeAt(Y(h.line,o));return l&&/\btag\b/.test(l)}function M(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function R(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function E(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(M(h))continue;return}if(!B(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function L(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}I.lastIndex=o,h.ch=o;var l=I.exec(h.text);if(l&&l.index==o)return l}}function _(h){for(;;){I.lastIndex=h.ch;var o=I.exec(h.text);if(!o){if(M(h))continue;return}if(!B(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function A(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function x(h,o){for(var l=[];;){var d=_(h),S,g=h.line,p=h.ch-(d?d[0].length:0);if(!d||!(S=E(h)))return;if(S=="selfClose")continue;if(d[1]){for(var w=l.length-1;w>=0;--w)if(l[w]==d[2]){l.length=w;break}if(w<0&&(!o||o==d[2]))return{tag:d[2],from:Y(g,p),to:Y(h.line,h.ch)}}else l.push(d[2])}}function y(h,o){for(var l=[];;){var d=A(h);if(!d)return;if(d=="selfClose"){L(h);continue}var S=h.line,g=h.ch,p=L(h);if(!p)return;if(p[1])l.push(p[2]);else{for(var w=l.length-1;w>=0;--w)if(l[w]==p[2]){l.length=w;break}if(w<0&&(!o||o==p[2]))return{tag:p[2],from:Y(h.line,h.ch),to:Y(S,g)}}}}he.registerHelper("fold","xml",function(h,o){for(var l=new K(h,o.line,0);;){var d=_(l);if(!d||l.line!=o.line)return;var S=E(l);if(!S)return;if(!d[1]&&S!="selfClose"){var g=Y(l.line,l.ch),p=x(l,d[2]);return p&&O(p.from,g)>0?{from:g,to:p.from}:null}}}),he.findMatchingTag=function(h,o,l){var d=new K(h,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var S=E(d),g=S&&Y(d.line,d.ch),p=S&&L(d);if(!S||!p||O(d,o)>0)return;var w={from:Y(d.line,d.ch),to:g,tag:p[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:p[1]?{open:y(d,p[2]),close:w,at:"close"}:(d=new K(h,g.line,g.ch,l),{open:w,close:x(d,p[2]),at:"open"})},he.findEnclosingTag=function(h,o,l,d){for(var S=new K(h,o.line,o.ch,l);;){var g=y(S,d);if(!g)break;var p=new K(h,o.line,o.ch,l),w=x(p,g.tag);if(w)return{open:g,close:w}}},he.scanForClosingTag=function(h,o,l,d){var S=new K(h,o.line,o.ch,d?{from:0,to:d}:null);return x(S,l)}})},p5ED:function(Et,tt,ie){"use strict";var he=ie("+L6B"),Y=ie("2/Rp"),O=ie("5Dmo"),Z=ie("3S7+"),U=ie("k1fw"),I=ie("tJVT"),K=ie("q1tI"),B=ie.n(K),M=ie("vHTk"),R=ie.n(M),E=ie("yEEn"),L=ie("ZW9T"),_=ie("1vsH");tt.a=function(A){var x=A.name,y=A.data,h=A.theme,o=A.type,l=A.filename,d=A.monacoEditor,S=A.className,g=A.style,p=A.close,w=A.onClose,b=A.hasMask,u=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(I.a)(u,2),s=f[0],a=f[1],T=Object(K.useState)(""),v=Object(I.a)(T,2),C=v[0],D=v[1],j,z=1024*1024,V=10*z,P=Object(K.useRef)();o==="office"&&(j=Object(_.T)(y).filesize,j>V&&(o="other")),l&&(d.filename=l),Object(K.useEffect)(function(){var re,pe,ve=(re=document.cookie)===null||re===void 0||((pe=re.replace(/\s/g,""))===null||pe===void 0)?void 0:pe.split(";");ve==null||ve.map(function(Ae){var Le=Ae.split("=");Le[0]==="_educoder_session"&&D(Le[1])})},[]);var N=function(){if(y.startsWith("http")||y.startsWith("/")){$();return}Object(_.z)(l||"educoder",y,l)},$=function(){Object(_.x)(l||x,y)};return console.log("data:",y,"fileanme:",l," name:",x),B.a.createElement("div",{style:Object(U.a)({},g||{}),className:"".concat(b&&R.a.bgBlack," ").concat(o?R.a.wrp:"hide")},p&&B.a.createElement("div",{className:R.a.close,ref:P},B.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return P.current}},B.a.createElement("span",{onClick:$},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return P.current}},B.a.createElement("span",{className:"",onClick:w},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(R.a[S]," ").concat(S," ").concat(R.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&B.a.createElement(L.b,d)),o==="audio"&&B.a.createElement("audio",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?y:"data:audio/mp3;base64,").concat(y),autoPlay:!0}),o==="video"&&B.a.createElement(B.a.Fragment,null,y!=null&&y.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(y),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(y),autoPlay:!0})),o==="html"&&B.a.createElement("iframe",{src:y+"&disposition=inline"}),o==="pdf"&&B.a.createElement("embed",{className:R.a.embed,src:y}),o==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(y)})),o==="other"&&B.a.createElement("div",null,B.a.createElement(Y.a,{type:"primary",size:"large",onClick:N},B.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&B.a.createElement(Y.a,{type:"primary",size:"large",onClick:N},B.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Et,tt,ie){},rUJ1:function(Et,tt){const ie=/[&<>"']/,he=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=b=>Z[b];function I(b,u){if(u){if(ie.test(b))return b.replace(he,U)}else if(Y.test(b))return b.replace(O,U);return b}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(b){return b.replace(K,(u,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const M=/(^|[^\[])\^/g;function R(b,u){b=b.source||b,u=u||"";const f={replace:(s,a)=>(a=a.source||a,a=a.replace(M,"$1"),b=b.replace(s,a),f),getRegex:()=>new RegExp(b,u)};return f}const E=/[^\w:]/g,L=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(b,u,f){if(b){let s;try{s=decodeURIComponent(B(f)).replace(E,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}u&&!L.test(f)&&(f=o(u,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(s){return null}return f}const A={},x=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,u){A[" "+b]||(x.test(b)?A[" "+b]=b+"/":A[" "+b]=g(b,"/",!0)),b=A[" "+b];const f=b.indexOf(":")===-1;return u.substring(0,2)==="//"?f?u:b.replace(y,"$1")+u:u.charAt(0)==="/"?f?u:b.replace(h,"$1")+u:b+u}const l={exec:function(){}};function d(b){let u=1,f,s;for(;u<arguments.length;u++){f=arguments[u];for(s in f)Object.prototype.hasOwnProperty.call(f,s)&&(b[s]=f[s])}return b}function S(b,u){const f=b.replace(/\|/g,(T,v,C)=>{let D=!1,j=v;for(;--j>=0&&C[j]==="\\";)D=!D;return D?"|":" |"}),s=f.split(/ \|/);let a=0;if(s.length>u)s.splice(u);else for(;s.length<u;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function g(b,u,f){const s=b.length;if(s===0)return"";let a=0;for(;a<s;){const T=b.charAt(s-a-1);if(T===u&&!f)a++;else if(T!==u&&f)a++;else break}return b.substr(0,s-a)}function p(b,u){if(b.indexOf(u[1])===-1)return-1;const f=b.length;let s=0,a=0;for(;a<f;a++)if(b[a]==="\\")a++;else if(b[a]===u[0])s++;else if(b[a]===u[1]&&(s--,s<0))return a;return-1}function w(b){b&&b.sanitize&&!b.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")}Et.exports={escape:I,unescape:B,edit:R,cleanUrl:_,resolveUrl:o,noopTest:l,merge:d,splitCells:S,rtrim:g,findClosingBracket:p,checkSanitizeDeprecation:w}},sboe:function(Et,tt,ie){"use strict";ie.d(tt,"a",function(){return O});var he=ie("q1tI"),Y=ie.n(he),O=he.createContext(null)},uK0f:function(Et,tt,ie){(function(he,Y){Et.exports=Y()})(this,function(){"use strict";function he(Y,O,Z){Z=Z||{},Z.childrenKeyName=Z.childrenKeyName||"children";var U=Y||[],I=[],K=0;do{var B=U.filter(function(M){return O(M,K)})[0];if(!B)break;I.push(B),U=B[Z.childrenKeyName]||[],K+=1}while(U.length>0);return I}return he})},ulZh:function(Et,tt,ie){typeof window!="undefined"&&function(Y,O){Et.exports=O()}(this,function(){return function(he){var Y={};function O(Z){if(Y[Z])return Y[Z].exports;var U=Y[Z]={i:Z,l:!1,exports:{}};return he[Z].call(U.exports,U,U.exports,O),U.l=!0,U.exports}return O.m=he,O.c=Y,O.d=function(Z,U,I){O.o(Z,U)||Object.defineProperty(Z,U,{enumerable:!0,get:I})},O.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},O.t=function(Z,U){if(U&1&&(Z=O(Z)),U&8)return Z;if(U&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var I=Object.create(null);if(O.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:Z}),U&2&&typeof Z!="string")for(var K in Z)O.d(I,K,function(B){return Z[B]}.bind(null,K));return I},O.n=function(Z){var U=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return O.d(U,"a",U),U},O.o=function(Z,U){return Object.prototype.hasOwnProperty.call(Z,U)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,Y,O){"use strict";var Z=Object.prototype.hasOwnProperty,U="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(U=!1));function K(E,L,_){this.fn=E,this.context=L,this.once=_||!1}function B(E,L,_,A,x){if(typeof _!="function")throw new TypeError("The listener must be a function");var y=new K(_,A||E,x),h=U?U+L:L;return E._events[h]?E._events[h].fn?E._events[h]=[E._events[h],y]:E._events[h].push(y):(E._events[h]=y,E._eventsCount++),E}function M(E,L){--E._eventsCount===0?E._events=new I:delete E._events[L]}function R(){this._events=new I,this._eventsCount=0}R.prototype.eventNames=function(){var L=[],_,A;if(this._eventsCount===0)return L;for(A in _=this._events)Z.call(_,A)&&L.push(U?A.slice(1):A);return Object.getOwnPropertySymbols?L.concat(Object.getOwnPropertySymbols(_)):L},R.prototype.listeners=function(L){var _=U?U+L:L,A=this._events[_];if(!A)return[];if(A.fn)return[A.fn];for(var x=0,y=A.length,h=new Array(y);x<y;x++)h[x]=A[x].fn;return h},R.prototype.listenerCount=function(L){var _=U?U+L:L,A=this._events[_];return A?A.fn?1:A.length:0},R.prototype.emit=function(L,_,A,x,y,h){var o=U?U+L:L;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,S,g;if(l.fn){l.once&&this.removeListener(L,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,_),!0;case 3:return l.fn.call(l.context,_,A),!0;case 4:return l.fn.call(l.context,_,A,x),!0;case 5:return l.fn.call(l.context,_,A,x,y),!0;case 6:return l.fn.call(l.context,_,A,x,y,h),!0}for(g=1,S=new Array(d-1);g<d;g++)S[g-1]=arguments[g];l.fn.apply(l.context,S)}else{var p=l.length,w;for(g=0;g<p;g++){l[g].once&&this.removeListener(L,l[g].fn,void 0,!0);switch(d){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,_);break;case 3:l[g].fn.call(l[g].context,_,A);break;case 4:l[g].fn.call(l[g].context,_,A,x);break;default:if(!S)for(w=1,S=new Array(d-1);w<d;w++)S[w-1]=arguments[w];l[g].fn.apply(l[g].context,S)}}}return!0},R.prototype.on=function(L,_,A){return B(this,L,_,A,!1)},R.prototype.once=function(L,_,A){return B(this,L,_,A,!0)},R.prototype.removeListener=function(L,_,A,x){var y=U?U+L:L;if(!this._events[y])return this;if(!_)return M(this,y),this;var h=this._events[y];if(h.fn)h.fn===_&&(!x||h.once)&&(!A||h.context===A)&&M(this,y);else{for(var o=0,l=[],d=h.length;o<d;o++)(h[o].fn!==_||x&&!h[o].once||A&&h[o].context!==A)&&l.push(h[o]);l.length?this._events[y]=l.length===1?l[0]:l:M(this,y)}return this},R.prototype.removeAllListeners=function(L){var _;return L?(_=U?U+L:L,this._events[_]&&M(this,_)):(this._events=new I,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=U,R.EventEmitter=R,he.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,Y,O){(function(Z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(R,E,L){if(L=L||{},R=R.trim(),E=E.trim(),!E){if(!L.alwaysNormalize)return R;var _=M.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");return _.path=M.normalizePath(_.path),M.buildURLFromParts(_)}var A=M.parseURL(E);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return L.alwaysNormalize?(A.path=M.normalizePath(A.path),M.buildURLFromParts(A)):E;var x=M.parseURL(R);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var y=I.exec(x.path);x.netLoc=y[1],x.path=y[2]}x.netLoc&&!x.path&&(x.path="/");var h={scheme:x.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(h.netLoc=x.netLoc,A.path[0]!=="/"))if(!A.path)h.path=x.path,A.params||(h.params=x.params,A.query||(h.query=x.query));else{var o=x.path,l=o.substring(0,o.lastIndexOf("/")+1)+A.path;h.path=M.normalizePath(l)}return h.path===null&&(h.path=L.alwaysNormalize?M.normalizePath(A.path):A.path),M.buildURLFromParts(h)},parseURL:function(R){var E=U.exec(R);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(K,"");R.length!==(R=R.replace(B,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};he.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(he,Y,O){function Z(L){var _={};function A(y){if(_[y])return _[y].exports;var h=_[y]={i:y,l:!1,exports:{}};return L[y].call(h.exports,h,h.exports,A),h.l=!0,h.exports}A.m=L,A.c=_,A.i=function(y){return y},A.d=function(y,h,o){A.o(y,h)||Object.defineProperty(y,h,{configurable:!1,enumerable:!0,get:o})},A.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},A.n=function(y){var h=y&&y.__esModule?function(){return y.default}:function(){return y};return A.d(h,"a",h),h},A.o=function(y,h){return Object.prototype.hasOwnProperty.call(y,h)},A.p="/",A.oe=function(y){throw console.error(y),y};var x=A(A.s=ENTRY_MODULE);return x.default||x}var U="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function K(L){return(L+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(L){return!isNaN(1*L)}function M(L,_,A){var x={};x[A]=[];var y=_.toString(),h=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return x;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+K(o)+I,"g"),d;d=l.exec(y);){if(d[3]==="dll-reference")continue;x[A].push(d[3])}for(l=new RegExp("\\("+K(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+I,"g");d=l.exec(y);)L[d[2]]||(x[A].push(d[1]),L[d[2]]=O(d[1]).m),x[d[2]]=x[d[2]]||[],x[d[2]].push(d[4]);for(var S=Object.keys(x),g=0;g<S.length;g++)for(var p=0;p<x[S[g]].length;p++)B(x[S[g]][p])&&(x[S[g]][p]=1*x[S[g]][p]);return x}function R(L){var _=Object.keys(L);return _.reduce(function(A,x){return A||L[x].length>0},!1)}function E(L,_){for(var A={main:[_]},x={main:[]},y={main:{}};R(A);)for(var h=Object.keys(A),o=0;o<h.length;o++){var l=h[o],d=A[l],S=d.pop();if(y[l]=y[l]||{},y[l][S]||!L[l][S])continue;y[l][S]=!0,x[l]=x[l]||[],x[l].push(S);for(var g=M(L,L[l][S],l),p=Object.keys(g),w=0;w<p.length;w++)A[p[w]]=A[p[w]]||[],A[p[w]]=A[p[w]].concat(g[p[w]])}return x}he.exports=function(L,_){_=_||{};var A={main:O.m},x=_.all?{main:Object.keys(A.main)}:E(A,L),y="";Object.keys(x).filter(function(S){return S!=="main"}).forEach(function(S){for(var g=0;x[S][g];)g++;x[S].push(g),A[S][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+S+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+x[S].map(function(p){return""+JSON.stringify(p)+": "+A[S][p].toString()}).join(",")+`});
`}),y=y+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(L))+")({"+x.main.map(function(S){return""+JSON.stringify(S)+": "+A.main[S].toString()}).join(",")+"}))(self);";var h=new window.Blob([y],{type:"text/javascript"});if(_.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"hlsDefaultConfig",function(){return w}),O.d(Y,"mergeConfig",function(){return u}),O.d(Y,"enableStreamingMode",function(){return f});var Z=O("./src/controller/abr-controller.ts"),U=O("./src/controller/audio-stream-controller.ts"),I=O("./src/controller/audio-track-controller.ts"),K=O("./src/controller/subtitle-stream-controller.ts"),B=O("./src/controller/subtitle-track-controller.ts"),M=O("./src/controller/buffer-controller.ts"),R=O("./src/controller/timeline-controller.ts"),E=O("./src/controller/cap-level-controller.ts"),L=O("./src/controller/fps-controller.ts"),_=O("./src/controller/eme-controller.ts"),A=O("./src/controller/cmcd-controller.ts"),x=O("./src/utils/xhr-loader.ts"),y=O("./src/utils/fetch-loader.ts"),h=O("./src/utils/cues.ts"),o=O("./src/utils/mediakeys-helper.ts"),l=O("./src/utils/logger.ts");function d(){return d=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var T=arguments[a];for(var v in T)Object.prototype.hasOwnProperty.call(T,v)&&(s[v]=T[v])}return s},d.apply(this,arguments)}function S(s,a){var T=Object.keys(s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);a&&(v=v.filter(function(C){return Object.getOwnPropertyDescriptor(s,C).enumerable})),T.push.apply(T,v)}return T}function g(s){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?S(Object(T),!0).forEach(function(v){p(s,v,T[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(T)):S(Object(T)).forEach(function(v){Object.defineProperty(s,v,Object.getOwnPropertyDescriptor(T,v))})}return s}function p(s,a,T){return a in s?Object.defineProperty(s,a,{value:T,enumerable:!0,configurable:!0,writable:!0}):s[a]=T,s}var w=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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:M.default,capLevelController:E.default,fpsController:L.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:B.default,timelineController:R.TimelineController,audioStreamController:U.default,audioTrackController:I.default,emeController:_.default,cmcdController:A.default});function b(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function u(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},s,a)}function f(s){var a=s.loader;if(a!==y.default&&a!==x.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var T=Object(y.fetchSupported)();T&&(s.loader=y.default,s.progressive=!0,s.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/ewma-bandwidth-estimator.ts"),I=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/errors.ts"),M=O("./src/types/loader.ts"),R=O("./src/utils/logger.ts");function E(A,x){for(var y=0;y<x.length;y++){var h=x[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function L(A,x,y){return x&&E(A.prototype,x),y&&E(A,y),A}var _=function(){function A(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 h=y.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var x=A.prototype;return x.registerListeners=function(){var h=this.hls;h.on(I.Events.FRAG_LOADING,this.onFragLoading,this),h.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(I.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var h=this.hls;h.off(I.Events.FRAG_LOADING,this.onFragLoading,this),h.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(I.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(h,o){var l=o.frag;if(l.type===M.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,S=l.config,g=l.media;if(!h||!g)return;var p=o?o.stats:h.stats,w=o?o.duration:h.duration;if(p.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||g.paused||!g.playbackRate||!g.readyState)return;var b=performance.now()-p.loading.start,u=Math.abs(g.playbackRate);if(b<=500*w/u)return;var f=l.levels,s=l.minAutoLevel,a=f[h.level],T=p.total||Math.max(p.loaded,Math.round(w*a.maxBitrate/8)),v=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),C=(T-p.loaded)/v,D=g.currentTime,j=(K.BufferHelper.bufferInfo(g,D,S.maxBufferHole).end-D)/u;if(j>=2*w/u||C<=j)return;var z=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>s;V--){var P=f[V].maxBitrate;if(z=w*P/(8*.8*v),z<j)break}if(z>=C)return;var N=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+C.toFixed(3)+` s
Estimated load time for the next fragment: `+z.toFixed(3)+` s
Time to underbuffer: `+j.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:p})},x.onFragLoaded=function(h,o){var l=o.frag,d=o.part;if(l.type===M.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var S=d?d.stats:l.stats,g=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],w=(p.loaded?p.loaded.bytes:0)+S.loaded,b=(p.loaded?p.loaded.duration:0)+g;p.loaded={bytes:w,duration:b},p.realBitrate=Math.round(8*w/b)}if(l.bitrateTest){var u={stats:S,frag:l,part:d,id:l.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,u),l.bitrateTest=!1}}},x.onFragBuffered=function(h,o){var l=o.frag,d=o.part,S=d?d.stats:l.stats;if(S.aborted)return;if(l.type!==M.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var g=S.parsing.end-S.loading.start;this.bwEstimator.sample(g,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},x.onError=function(h,o){switch(o.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,S=l.config,g=l.minAutoLevel,p=l.media,w=o?o.duration:h?h.duration:0,b=p?p.currentTime:0,u=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,s=(K.BufferHelper.bufferInfo(p,b,S.maxBufferHole).end-b)/u,a=this.findBestLevel(f,g,d,s,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,v=S.abrBandWidthFactor,C=S.abrBandWidthUpFactor;if(!s){var D=this.bitrateTestDelay;if(D){var j=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;T=j-D,R.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),v=C=1}}return a=this.findBestLevel(f,g,d,s+T,v,C),Math.max(a,0)},x.findBestLevel=function(h,o,l,d,S,g){for(var p,w=this.fragCurrent,b=this.partCurrent,u=this.lastLoadedFragLevel,f=this.hls.levels,s=f[u],a=!!(s!=null&&(p=s.details)!==null&&p!==void 0&&p.live),T=s==null?void 0:s.codecSet,v=b?b.duration:w?w.duration:0,C=l;C>=o;C--){var D=f[C];if(!D||T&&D.codecSet!==T)continue;var j=D.details,z=(b?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||v,V=void 0;C<=u?V=S*h:V=g*h;var P=f[C].maxBitrate,N=P*z/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+C+"/"+Math.round(V)+"/"+P+"/"+z+"/"+d+"/"+N),V>P&&(!N||a&&!this.bitrateTestDelay||N<d))return C}return-1},L(A,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),A}();Y.default=_},"./src/controller/audio-stream-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),I=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/controller/fragment-tracker.ts"),M=O("./src/types/level.ts"),R=O("./src/types/loader.ts"),E=O("./src/loader/fragment.ts"),L=O("./src/demux/chunk-cache.ts"),_=O("./src/demux/transmuxer-interface.ts"),A=O("./src/types/transmuxer.ts"),x=O("./src/controller/fragment-finders.ts"),y=O("./src/utils/discontinuities.ts"),h=O("./src/errors.ts"),o=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var u=arguments[b];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(w[f]=u[f])}return w},l.apply(this,arguments)}function d(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,S(w,b)}function S(w,b){return S=Object.setPrototypeOf||function(f,s){return f.__proto__=s,f},S(w,b)}var g=100,p=function(w){d(b,w);function b(f,s){var a;return a=w.call(this,f,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var u=b.prototype;return u.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},u._registerListeners=function(){var s=this.hls;s.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(I.Events.ERROR,this.onError,this),s.on(I.Events.BUFFER_RESET,this.onBufferReset,this),s.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u._unregisterListeners=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(I.Events.ERROR,this.onError,this),s.off(I.Events.BUFFER_RESET,this.onBufferReset,this),s.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u.onInitPtsFound=function(s,a){var T=a.frag,v=a.id,C=a.initPTS;if(v==="main"){var D=T.cc;this.initPTS[T.cc]=C,this.log("InitPTS for cc: "+D+" found from main: "+C),this.videoTrackCC=D,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},u.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},u.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var s,a=this.levels,T=this.trackId,v=a==null||((s=a[T])===null||s===void 0)?void 0:s.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var C,D=performance.now(),j=this.retryDate;(!j||D>=j||(C=this.media)!==null&&C!==void 0&&C.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var V=z.frag,P=z.part,N=z.cache,$=z.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var re=N.flush(),pe={frag:V,part:P,payload:re,networkDetails:null};this._handleFragmentLoadProgress(pe),$&&w.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),Ae=K.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),Le=Object(x.fragmentWithinToleranceTest)(Ae.end,this.config.maxFragLookUpTolerance,V);Le<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},u.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},u.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,T=a.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},u.doTickIdle=function(){var s,a,T=this.hls,v=this.levels,C=this.media,D=this.trackId,j=T.config;if(!v||!v[D])return;if(!C&&(this.startFragRequested||!j.startFragPrefetch))return;var z=v[D],V=z.details;if(!V||V.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(P===null)return;var N=P.len,$=this.getMaxBufferLength(),re=this.audioSwitch;if(N>=$&&!re)return;if(!re&&this._streamEnded(P,V)){T.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var pe=V.fragments,ve=pe[0].start,Ae=P.end;if(re){var Le=this.getLoadPosition();Ae=Le,V.PTSKnown&&Le<ve&&((P.end>ve||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),C.currentTime=ve+.05))}var ce=this.getNextFragment(Ae,V);if(!ce){this.bufferFlushed=!0;return}((s=ce.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=ce.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ce,V):this.loadFragment(ce,V,Ae)},u.getMaxBufferLength=function(){var s=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},u.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},u.onAudioTracksUpdated=function(s,a){var T=a.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(v){return new M.Level(v)})},u.onAudioTrackSwitching=function(s,a){var T=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(g):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},u.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},u.onLevelLoaded=function(s,a){this.mainDetails=a.details},u.onAudioTrackLoaded=function(s,a){var T,v=this.levels,C=a.details,D=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+C.startSN+","+C.endSN+"],duration:"+C.totalduration);var j=v[D],z=0;if(C.live||(T=j.details)!==null&&T!==void 0&&T.live){var V=this.mainDetails;if(C.fragments[0]||(C.deltaUpdateFailed=!0),C.deltaUpdateFailed||!V)return;!j.details&&C.hasProgramDateTime&&V.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(C,V),z=C.fragments[0].start):z=this.alignPlaylists(C,j.details)}j.details=C,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!C.live)&&this.setStartPosition(j.details,z),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(C)&&(this.state=U.State.IDLE),this.tick()},u._handleFragmentLoadProgress=function(s){var a,T=s.frag,v=s.part,C=s.payload,D=this.config,j=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var V=z[j];console.assert(V,"Audio track is defined on fragment load progress");var P=V.details;console.assert(P,"Audio track details are defined on fragment load progress");var N=D.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new _.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var re=this.initPTS[T.cc],pe=(a=T.initSegment)===null||a===void 0?void 0:a.data;if(re!==void 0){var ve=!1,Ae=v?v.index:-1,Le=Ae!==-1,ce=new A.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,C.byteLength,Ae,Le);$.push(C,pe,N,"",T,v,P.totalduration,ve,ce,re)}else{o.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+j);var ae=this.waitingData=this.waitingData||{frag:T,part:v,cache:new L.default,complete:!1},de=ae.cache;de.push(new Uint8Array(C)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},u._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,s)},u.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},u.onBufferCreated=function(s,a){var T=a.tracks.audio;T&&(this.mediaBuffer=T.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},u.onFragBuffered=function(s,a){var T=a.frag,v=a.part;if(T.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(v?" p: "+v.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,v)},u.onError=function(s,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var T=!0,v=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);v&&v.len>.5&&(T=!this.reduceMaxBufferLength(v.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},u.onBufferFlushed=function(s,a){var T=a.type;T===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},u._handleTransmuxComplete=function(s){var a,T="audio",v=this.hls,C=s.remuxResult,D=s.chunkMeta,j=this.getCurrentContext(D);if(!j){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var z=j.frag,V=j.part,P=C.audio,N=C.text,$=C.id3,re=C.initSegment;if(this.fragContextChanged(z))return;if(this.state=U.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),re!=null&&re.tracks&&(this._bufferInitSegment(re.tracks,z,D),v.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:T,tracks:re.tracks})),P){var pe=P.startPTS,ve=P.endPTS,Ae=P.startDTS,Le=P.endDTS;V&&(V.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ve,startDTS:Ae,endDTS:Le}),z.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,pe,ve,Ae,Le),this.bufferFragmentData(P,z,V,D)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var ce=l({frag:z,id:T},$);v.trigger(I.Events.FRAG_PARSING_METADATA,ce)}if(N){var ae=l({frag:z,id:T},N);v.trigger(I.Events.FRAG_PARSING_USERDATA,ae)}},u._bufferInitSegment=function(s,a,T){if(this.state!==U.State.PARSING)return;s.video&&delete s.video;var v=s.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,s);var C=v.initSegment;if(C!=null&&C.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:T,parent:a.type,data:C};this.hls.trigger(I.Events.BUFFER_APPENDING,D)}this.tick()},u.loadFragment=function(s,a,T){var v=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||v===B.FragmentState.NOT_LOADED||v===B.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,s,a,T)))},u.completeAudioSwitch=function(){var s=this.hls,a=this.media,T=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:T})},b}(U.default);Y.default=p},"./src/controller/audio-track-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts"),U=O("./src/errors.ts"),I=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function B(_,A){for(var x=0;x<A.length;x++){var y=A[x];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(_,y.key,y)}}function M(_,A,x){return A&&B(_.prototype,A),x&&B(_,x),_}function R(_,A){_.prototype=Object.create(A.prototype),_.prototype.constructor=_,E(_,A)}function E(_,A){return E=Object.setPrototypeOf||function(y,h){return y.__proto__=h,y},E(_,A)}var L=function(_){R(A,_);function A(y){var h;return h=_.call(this,y,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var x=A.prototype;return x.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(h,o){var l=o.id,d=o.details,S=this.tracksInGroup[l];if(!S){this.warn("Invalid audio track id "+l);return}var g=S.details;S.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,g))},x.onLevelLoading=function(h,o){this.switchLevel(o.level)},x.onLevelSwitching=function(h,o){this.switchLevel(o.level)},x.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(g){return!l||g.groupId===l});this.selectDefaultTrack&&!d.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var S={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},x.onError=function(h,o){if(_.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===K.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var d=o[h],S=d.id,g=d.groupId,p=g===void 0?"":g,w=d.name,b=d.type,u=d.url;if(this.trackId=h,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:p,name:w,type:b,url:u}),d.details&&!d.details.live)return;var f=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(f)},x.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},x.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,S=o.url;if(h)try{S=h.addDirectives(S)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:S,id:l,groupId:d,deliveryDirectives:h||null})}},M(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),A}(I.default);Y.default=L},"./src/controller/base-playlist-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return M});var Z=O("./src/polyfills/number.ts"),U=O("./src/types/level.ts"),I=O("./src/controller/level-helper.ts"),K=O("./src/utils/logger.ts"),B=O("./src/errors.ts"),M=function(){function R(L,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,_+":"),this.warn=K.logger.warn.bind(K.logger,_+":"),this.hls=L}var E=R.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(_,A){A.fatal&&A.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(_,A){var x=A==null?void 0:A.renditionReports;if(x)for(var y=0;y<x.length;y++){var h=x[y],o=""+h.URI;if(o===_.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var S=Math.min(A.age-A.partTarget,A.targetduration);d!==void 0&&S>A.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(Z.isFiniteNumber)(d)?d:void 0,U.HlsSkip.No)}}},E.loadPlaylist=function(_){},E.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},E.playlistLoaded=function(_,A,x){var y=this,h=A.details,o=A.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||x!=null&&x.live){if(h.reloaded(x),x&&this.log("live playlist "+_+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),x&&h.fragments.length>0&&Object(I.mergeDetails)(x,h),!this.canLoad||!h.live)return;var d,S=void 0,g=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var p=this.hls.config.lowLatencyMode,w=h.lastPartSn,b=h.endSN,u=h.lastPartIndex,f=u!==-1,s=w===b,a=p?0:u;f?(S=s?b+1:w,g=s?a:u+1):S=b+1;var T=h.age,v=T+h.ageHeader,C=Math.min(v-h.partTarget,h.targetduration*1.5);if(C>0){if(x&&C>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+C+" with playlist age: "+h.age),C=0;else{var D=Math.floor(C/h.targetduration);if(S+=D,g!==void 0){var j=Math.round(C%h.targetduration/h.partTarget);g+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+C+" skip sn "+D+" to part "+g)}h.tuneInGoal=C}if(d=this.getDeliveryDirectives(h,A.deliveryDirectives,S,g),p||!s){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,A.deliveryDirectives,S,g);var z=Object(I.computeReloadInterval)(h,o);S!==void 0&&h.canBlockReload&&(z-=h.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(d)},z)}else this.clearTimer()},E.getDeliveryDirectives=function(_,A,x,y){var h=Object(U.getSkipValue)(_,x);return A!=null&&A.skip&&_.deltaUpdateFailed&&(x=A.msn,y=A.part,h=U.HlsSkip.No),new U.HlsUrlParameters(x,y,h)},E.retryLoadingOrFail=function(_){var A=this,x=this.hls.config,y=this.retryCount<x.levelLoadingMaxRetry;if(y){var h;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(h=_.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' 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(he,Y,O){"use strict";O.r(Y),O.d(Y,"State",function(){return b}),O.d(Y,"default",function(){return u});var Z=O("./src/polyfills/number.ts"),U=O("./src/task-loop.ts"),I=O("./src/controller/fragment-tracker.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/utils/logger.ts"),M=O("./src/events.ts"),R=O("./src/errors.ts"),E=O("./src/types/transmuxer.ts"),L=O("./src/utils/mp4-tools.ts"),_=O("./src/utils/discontinuities.ts"),A=O("./src/controller/fragment-finders.ts"),x=O("./src/controller/level-helper.ts"),y=O("./src/loader/fragment-loader.ts"),h=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function d(f,s){for(var a=0;a<s.length;a++){var T=s[a];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(f,T.key,T)}}function S(f,s,a){return s&&d(f.prototype,s),a&&d(f,a),f}function g(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function p(f,s){f.prototype=Object.create(s.prototype),f.prototype.constructor=f,w(f,s)}function w(f,s){return w=Object.setPrototypeOf||function(T,v){return T.__proto__=v,T},w(f,s)}var b={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"},u=function(f){p(s,f);function s(T,v,C){var D;return D=f.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=b.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=C,D.log=B.logger.log.bind(B.logger,C+":"),D.warn=B.logger.warn.bind(B.logger,C+":"),D.hls=T,D.fragmentLoader=new y.default(T.config),D.fragmentTracker=v,D.config=T.config,D.decrypter=new h.default(T,T.config),T.on(M.Events.KEY_LOADED,D.onKeyLoaded,g(D)),D}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(v,C){var D=this.fragCurrent,j=this.fragmentTracker;if(!C.live&&D&&D.sn===C.endSN&&!v.nextStart){var z=j.getState(D);return z===I.FragmentState.PARTIAL||z===I.FragmentState.OK}return!1},a.onMediaAttached=function(v,C){var D=this.media=this.mediaBuffer=C.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(j.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var v=this.config,C=this.fragCurrent,D=this.media,j=this.mediaBuffer,z=this.state,V=D?D.currentTime:0,P=K.BufferHelper.bufferInfo(j||D,V,v.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+z),z===b.ENDED)this.resetLoadingState();else if(C&&!P.len){var N=v.maxFragLookUpTolerance,$=C.start-N,re=C.start+C.duration+N,pe=V>re;(V<$||pe)&&(pe&&C.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),C.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=V),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,C){if(this.state!==b.KEY_LOADING||C.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var D=this.levels[C.frag.level].details;D&&this.loadFragment(C.frag,D,C.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(v,C){this.log("Loading key for "+v.sn+" of ["+C.startSN+"-"+C.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=b.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(M.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,C,D){this._loadFragForPlayback(v,C,D)},a._loadFragForPlayback=function(v,C,D){var j=this,z=function(P){if(j.fragContextChanged(v)){j.warn("Fragment "+v.sn+(P.part?" p: "+P.part.index:"")+" of level "+v.level+" was dropped during download."),j.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,j._handleFragmentLoadProgress(P)};this._doFragLoad(v,C,D,z).then(function(V){if(!V)return;j.fragLoadError=0;var P=j.state;if(j.fragContextChanged(v)){(P===b.FRAG_LOADING||P===b.BACKTRACKING||!j.fragCurrent&&P===b.PARSING)&&(j.fragmentTracker.removeFragment(v),j.state=b.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+v.sn+" of level "+v.level),j.hls.trigger(M.Events.FRAG_LOADED,V),j.state===b.BACKTRACKING)){j.fragmentTracker.backtrack(v,V),j.resetFragmentLoading(v);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,C,D){if(D===void 0&&(D=null),!(v-C))return;var j={startOffset:v,endOffset:C,type:D};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(v){var C=this;this._doFragLoad(v).then(function(D){if(!D||C.fragContextChanged(v)||!C.levels)throw new Error("init load aborted");return D}).then(function(D){var j=C.hls,z=D.payload,V=v.decryptdata;if(z&&z.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var P=self.performance.now();return C.decrypter.webCryptoDecrypt(new Uint8Array(z),V.key.buffer,V.iv.buffer).then(function(N){var $=self.performance.now();return j.trigger(M.Events.FRAG_DECRYPTED,{frag:v,payload:N,stats:{tstart:P,tdecrypt:$}}),D.payload=N,D})}return D}).then(function(D){var j=C.fragCurrent,z=C.hls,V=C.levels;if(!V)throw new Error("init load aborted, missing levels");var P=V[v.level].details;console.assert(P,"Level details are defined when init segment is loaded");var N=v.stats;C.state=b.IDLE,C.fragLoadError=0,v.data=new Uint8Array(D.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),D.frag===j&&z.trigger(M.Events.FRAG_BUFFERED,{stats:N,frag:j,part:null,id:v.type}),C.tick()}).catch(function(D){C.warn(D),C.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var C=this.fragCurrent;return!v||!C||v.level!==C.level||v.sn!==C.sn||v.urlId!==C.urlId},a.fragBufferedComplete=function(v,C){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(C?" part: "+C.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(K.BufferHelper.getBuffered(D))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var C=this.transmuxer;if(!C)return;var D=v.frag,j=v.part,z=v.partsLoaded,V=!z||z.length===0||z.some(function(N){return!N}),P=new E.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,j?j.index:-1,!V);C.flush(P)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,C,D,j){var z=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(v.start,D||0),this.config.lowLatencyMode&&C){var V=C.partList;if(V&&j){D>v.end&&C.fragmentHint&&(v=C.fragmentHint);var P=this.getNextPart(V,v,D);if(P>-1){var N=V[P];return this.log("Loading part sn: "+v.sn+" p: "+N.index+" cc: "+v.cc+" of playlist ["+C.startSN+"-"+C.endSN+"] parts [0-"+P+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:v,part:V[P],targetBufferTime:D}),this.doFragPartsLoad(v,V,P,j).catch(function($){return z.handleFragLoadError($)})}else if(!v.url||this.loadedEndOfParts(V,D))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(C?"of ["+C.startSN+"-"+C.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(D.toFixed(3))),Object(Z.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:v,targetBufferTime:D}),this.fragmentLoader.load(v,j).catch(function($){return z.handleFragLoadError($)})},a.doFragPartsLoad=function(v,C,D,j){var z=this;return new Promise(function(V,P){var N=[],$=function re(pe){var ve=C[pe];z.fragmentLoader.loadPart(v,ve,j).then(function(Ae){N[ve.index]=Ae;var Le=Ae.part;z.hls.trigger(M.Events.FRAG_LOADED,Ae);var ce=C[pe+1];if(ce&&ce.fragment===v)re(pe+1);else return V({frag:v,part:Le,partsLoaded:N})}).catch(P)};$(D)})},a.handleFragLoadError=function(v){var C=v.data;return C&&C.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(C.frag,C.part):this.hls.trigger(M.Events.ERROR,C),null},a._handleTransmuxerFlush=function(v){var C=this.getCurrentContext(v);if(!C||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var D=C.frag,j=C.part,z=C.level,V=self.performance.now();D.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(D,j,z,v.partial)},a.getCurrentContext=function(v){var C=this.levels,D=v.level,j=v.sn,z=v.part;if(!C||!C[D])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+D+". The current chunk will not be buffered."),null;var V=C[D],P=z>-1?Object(x.getPartWith)(V,j,z):null,N=P?P.fragment:Object(x.getFragmentWithSN)(V,j,this.fragCurrent);return N?{frag:N,part:P,level:V}:null},a.bufferFragmentData=function(v,C,D,j){if(!v||this.state!==b.PARSING)return;var z=v.data1,V=v.data2,P=z;if(z&&V&&(P=Object(L.appendUint8Array)(z,V)),!P||!P.length)return;var N={type:v.type,frag:C,part:D,chunkMeta:j,parent:C.type,data:P};this.hls.trigger(M.Events.BUFFER_APPENDING,N),v.dropped&&v.independent&&!D&&this.flushBufferGap(C)},a.flushBufferGap=function(v){var C=this.media;if(!C)return;if(!K.BufferHelper.isBuffered(C,C.currentTime)){this.flushMainBuffer(0,v.start);return}var D=C.currentTime,j=K.BufferHelper.bufferInfo(C,D,0),z=v.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),P=Math.max(Math.min(v.start-V,j.end-V),D+V);v.start-P>V&&this.flushMainBuffer(P,v.start)},a.getFwdBufferInfo=function(v,C){var D=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var z=K.BufferHelper.bufferInfo(v,j,D.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,C);if(V&&z.nextStart<V.end)return K.BufferHelper.bufferInfo(v,j,Math.max(z.nextStart,D.maxBufferHole))}return z},a.getMaxBufferLength=function(v){var C=this.config,D;return v?D=Math.max(8*C.maxBufferSize/v,C.maxBufferLength):D=C.maxBufferLength,Math.min(D,C.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var C=this.config,D=v||C.maxBufferLength;return C.maxMaxBufferLength>=D?(C.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+C.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,C){var D,j,z=C.fragments,V=z.length;if(!V)return null;var P=this.config,N=z[0].start,$;if(C.live){var re=P.initialLiveManifestSize;if(V<re)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+re+")"),null;!C.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(C,z),this.startPosition=$?this.hls.liveSyncPosition||$.start:v)}else v<=N&&($=z[0]);if(!$){var pe=P.lowLatencyMode?C.partEnd:C.fragmentEnd;$=this.getFragmentAtPosition(v,pe,C)}return(D=$)!==null&&D!==void 0&&D.initSegment&&!((j=$)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(v,C,D){for(var j=-1,z=!1,V=!0,P=0,N=v.length;P<N;P++){var $=v[P];if(V=V&&!$.independent,j>-1&&D<$.start)break;var re=$.loaded;!re&&(z||$.independent||V)&&$.fragment===C&&(j=P),z=re}return j},a.loadedEndOfParts=function(v,C){var D=v[v.length-1];return D&&C>D.start&&D.loaded},a.getInitialLiveFragment=function(v,C){var D=this.fragPrevious,j=null;if(D){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),j=Object(A.findFragmentByPDT)(C,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var z=D.sn+1;if(z>=v.startSN&&z<=v.endSN){var V=C[z-v.startSN];D.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(A.findFragWithCC)(C,D.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(j=this.getFragmentAtPosition(P,this.bitrateTest?v.fragmentEnd:v.edge,v))}return j},a.getFragmentAtPosition=function(v,C,D){var j=this.config,z=this.fragPrevious,V=D.fragments,P=D.endSN,N=D.fragmentHint,$=j.maxFragLookUpTolerance,re=!!(j.lowLatencyMode&&D.partList&&N);re&&N&&!this.bitrateTest&&(V=V.concat(N),P=N.sn);var pe;if(v<C){var ve=v>C-$?0:$;pe=Object(A.findFragmentByPTS)(z,V,v,ve)}else pe=V[V.length-1];if(pe){var Ae=pe.sn-D.startSN,Le=z&&pe.level===z.level,ce=V[Ae+1],ae=this.fragmentTracker.getState(pe);if(ae===I.FragmentState.BACKTRACKED){pe=null;for(var de=Ae;V[de]&&this.fragmentTracker.getState(V[de])===I.FragmentState.BACKTRACKED;)z?pe=V[de--]:pe=V[--de];pe||(pe=ce)}else z&&pe.sn===z.sn&&!re&&(Le&&(pe.sn<P&&this.fragmentTracker.getState(ce)!==I.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+ce.sn),pe=ce):pe=null))}return pe},a.synchronizeToLiveEdge=function(v){var C=this.config,D=this.media;if(!D)return;var j=this.hls.liveSyncPosition,z=D.currentTime,V=v.fragments[0].start,P=v.edge,N=z>=V-C.maxFragLookUpTolerance&&z<=P;if(j!==null&&D.duration>j&&(z<j||!N)){var $=C.liveMaxLatencyDuration!==void 0?C.liveMaxLatencyDuration:C.liveMaxLatencyDurationCount*v.targetduration;(!N&&D.readyState<4||z<P-$)&&(this.loadedmetadata||(this.nextLoadPosition=j),D.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+j.toFixed(3)),D.currentTime=j))}},a.alignPlaylists=function(v,C){var D=this.levels,j=this.levelLastLoaded,z=this.fragPrevious,V=j!==null?D[j]:null,P=v.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var N=v.fragments[0].start,$=!C,re=v.alignedSliding&&Object(Z.isFiniteNumber)(N);if($||!re&&!N){Object(_.alignStream)(z,V,v);var pe=v.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(C?C.startSN:"na")+"->"+v.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+P),pe}return N},a.waitForCdnTuneIn=function(v){var C=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*C)},a.setStartPosition=function(v,C){var D=this.startPosition;if(D<C&&(D=-1),D===-1||this.lastCurrentTime===-1){var j=v.startTimeOffset;Object(Z.isFiniteNumber)(j)?(D=C+j,j<0&&(D+=v.totalduration),D=Math.min(Math.max(C,D),C+v.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+D),this.startPosition=D):v.live?D=this.hls.liveSyncPosition||C:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var v=this.media,C=0;return this.loadedmetadata&&v?C=v.currentTime:this.nextLoadPosition&&(C=this.nextLoadPosition),C},a.handleFragLoadAborted=function(v,C){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(C?" part"+C.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(v,C){if(C.fatal)return;var D=C.frag;if(!D||D.type!==v)return;var j=this.fragCurrent;console.assert(j&&D.sn===j.sn&&D.level===j.level&&D.urlId===j.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+v+" "+D.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else C.levelRetry?(v===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(B.logger.error(C.details+" reaches max retry, redispatch as fatal ..."),C.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(v,C,D){if(!v)return;var j=K.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(C,j,D),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var C=this.levels?this.levels[v].details:null;if(C!=null&&C.live)return this.startPosition=-1,this.setStartPosition(C,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(v,C,D,j){var z=this,V=D.details;console.assert(!!V,"level.details must be defined");var P=Object.keys(v.elementaryStreams).reduce(function(N,$){var re=v.elementaryStreams[$];if(re){var pe=re.endPTS-re.startPTS;if(pe<=0)return z.warn("Could not parse fragment "+v.sn+" "+$+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),N||!1;var ve=j?0:Object(x.updateFragPTSDTS)(V,v,re.startPTS,re.endPTS,re.startDTS,re.endDTS);return z.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:V,level:D,drift:ve,type:$,frag:v,start:re.startPTS,end:re.endPTS}),!0}return N},!1);P?(this.state=b.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:v,part:C})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(s,[{key:"state",get:function(){return this._state},set:function(v){var C=this._state;C!==v&&(this._state=v,this.log(C+"->"+v))}}]),s}(U.default)},"./src/controller/buffer-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return A});var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),I=O("./src/utils/logger.ts"),K=O("./src/errors.ts"),B=O("./src/utils/buffer-helper.ts"),M=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),E=O("./src/controller/buffer-operation-queue.ts"),L=Object(M.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function x(h){var o=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 l=o.hls,d=o.media,S=o.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:d})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var y=x.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 o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&L){var S=this.mediaSource=new L;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(S),this._objectUrl=d.src}},y.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(I.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(S){I.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):I.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(S){I.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",S)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,l){var d=this,S=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(g){if(S){var p=d.tracks[g];if(p&&typeof p.buffer.changeType=="function"){var w=l[g],b=w.codec,u=w.levelCodec,f=w.container,s=(p.levelCodec||p.codec).replace(_,"$1"),a=(u||b).replace(_,"$1");if(s!==a){var T=f+";codecs="+(u||b);d.appendChangeType(g,T)}}}else d.pendingTracks[g]=l[g]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,l){var d=this,S=this.operationQueue,g={execute:function(){var w=d.sourceBuffer[o];w&&(I.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),w.changeType(l)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){I.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(g,o)},y.onBufferAppending=function(o,l){var d=this,S=this.hls,g=this.operationQueue,p=this.tracks,w=l.data,b=l.type,u=l.frag,f=l.part,s=l.chunkMeta,a=s.buffering[b],T=self.performance.now();a.start=T;var v=u.stats.buffering,C=f?f.stats.buffering:null;v.start===0&&(v.start=T),C&&C.start===0&&(C.start=T);var D=p.audio,j=b==="audio"&&s.id===1&&(D==null?void 0:D.container)==="audio/mpeg",z={execute:function(){if(a.executeStart=self.performance.now(),j){var P=d.sourceBuffer[b];if(P){var N=u.start-P.timestampOffset;Math.abs(N)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+u.start+" (delta: "+N+") sn: "+u.sn+")"),P.timestampOffset=u.start)}}d.appendExecutor(w,b)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,v.first===0&&(v.first=P),C&&C.first===0&&(C.first=P);var N=d.sourceBuffer,$={};for(var re in N)$[re]=B.BufferHelper.getBuffered(N[re]);d.appendError=0,d.hls.trigger(U.Events.BUFFER_APPENDED,{type:b,frag:u,part:f,chunkMeta:s,parent:u.type,timeRanges:$})},onError:function(P){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",P);var N={type:K.ErrorTypes.MEDIA_ERROR,parent:u.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=K.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,N.details=K.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>S.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),S.trigger(U.Events.ERROR,N)}};g.append(z,b)},y.onBufferFlushing=function(o,l){var d=this,S=this.operationQueue,g=function(w){return{execute:d.removeExecutor.bind(d,w,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(U.Events.BUFFER_FLUSHED,{type:w})},onError:function(u){I.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",u)}}};l.type?S.append(g(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){S.append(g(p),p)})},y.onFragParsed=function(o,l){var d=this,S=l.frag,g=l.part,p=[],w=g?g.elementaryStreams:S.elementaryStreams;w[R.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(w[R.ElementaryStreamTypes.AUDIO]&&p.push("audio"),w[R.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var f=self.performance.now();S.stats.buffering.end=f,g&&(g.stats.buffering.end=f);var s=g?g.stats:S.stats;d.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:g,stats:s,id:S.type})};p.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,p)},y.onFragChanged=function(o,l){this.flushBackBuffer()},y.onBufferEos=function(o,l){var d=this,S=this.getSourceBufferTypes().reduce(function(g,p){var w=d.sourceBuffer[p];return(!l.type||l.type===p)&&(w&&!w.ended&&(w.ended=!0,I.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),g&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var g=d.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},y.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,S=this.sourceBuffer;if(!d||l===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(p)||p<0)return;var w=d.currentTime,b=l.levelTargetDuration,u=Math.max(p,b),f=Math.floor(w/b)*b-u;g.forEach(function(s){var a=S[s];if(a){var T=B.BufferHelper.getBuffered(a);T.length>0&&f>T.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),l.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:s}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,S=this.mediaSource,g=o.fragments[0].start+o.totalduration,p=d.duration,w=Object(Z.isFiniteNumber)(S.duration)?S.duration:0;o.live&&l.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(g>w&&g>p||!Object(Z.isFiniteNumber)(p))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),S.duration=g)},y.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,S=d.length;if(S&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var g=Math.max(0,d[0].start),p=Math.max(g,g+o.totalduration);l.setLiveSeekableRange(g,p)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,S=Object.keys(d).length;if(S&&!o||S===2){this.createSourceBuffers(d),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(p){l.executeNext(p)})}},y.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var g in o)if(!l[g]){var p=o[g];if(!p)throw Error("source buffer exists for track "+g+", however track does not");var w=p.levelCodec||p.codec,b=p.container+";codecs="+w;I.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var u=l[g]=d.addSourceBuffer(b),f=g;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[g]={buffer:u,codec:w,container:p.container,levelCodec:p.levelCodec,id:p.id},S++}catch(s){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:b})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},y._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,l){I.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},y.removeExecutor=function(o,l,d){var S=this.media,g=this.mediaSource,p=this.operationQueue,w=this.sourceBuffer,b=w[o];if(!S||!g||!b){I.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var u=Object(Z.isFiniteNumber)(S.duration)?S.duration:Infinity,f=Object(Z.isFiniteNumber)(g.duration)?g.duration:Infinity,s=Math.max(0,l),a=Math.min(d,u,f);a>s?(I.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(s,a)):p.shiftAndExecuteNext(o)},y.appendExecutor=function(o,l){var d=this.operationQueue,S=this.sourceBuffer,g=S[l];if(!g){I.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}g.ended=!1,console.assert(!g.updating,l+" sourceBuffer must not be updating"),g.appendBuffer(o)},y.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,g=l.map(function(p){return S.appendBlocker(p)});Promise.all(g).then(function(){o(),l.forEach(function(p){var w=d.sourceBuffer[p];(!w||!w.updating)&&S.shiftAndExecuteNext(p)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,l,d){var S=this.sourceBuffer[o];if(!S)return;var g=d.bind(this,o);this.listeners[o].push({event:l,listener:g}),S.addEventListener(l,g)},y.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return U});var Z=O("./src/utils/logger.ts"),U=function(){function I(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var K=I.prototype;return K.append=function(M,R){var E=this.queues[R];E.push(M),E.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(M,R){var E=this.queues[R];E.unshift(M),this.executeNext(R)},K.appendBlocker=function(M){var R,E=new Promise(function(_){R=_}),L={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(L,M),E},K.executeNext=function(M){var R=this.buffers,E=this.queues,L=R[M],_=E[M];if(_.length){var A=_[0];try{A.execute()}catch(x){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(x),(!L||!L.updating)&&(_.shift(),this.executeNext(M))}}},K.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},K.current=function(M){return this.queues[M][0]},I}()},"./src/controller/cap-level-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts");function U(B,M){for(var R=0;R<M.length;R++){var E=M[R];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(B,E.key,E)}}function I(B,M,R){return M&&U(B.prototype,M),R&&U(B,R),B}var K=function(){function B(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 M=B.prototype;return M.setStreamController=function(E){this.streamController=E},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var E=this.hls;E.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var E=this.hls;E.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(E,L){B.isLevelAllowed(L.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(L.droppedLevel)},M.onMediaAttaching=function(E,L){this.media=L.media instanceof HTMLVideoElement?L.media:null},M.onManifestParsed=function(E,L){var _=this.hls;this.restrictedLevels=[],this.firstLevel=L.firstLevel,_.config.capLevelToPlayerSize&&L.video&&this.startCapping()},M.onBufferCodecs=function(E,L){var _=this.hls;_.config.capLevelToPlayerSize&&L.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var L=this.hls;L.autoLevelCapping=this.getMaxLevel(E.length-1),L.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=L.autoLevelCapping}}},M.getMaxLevel=function(E){var L=this,_=this.hls.levels;if(!_.length)return-1;var A=_.filter(function(x,y){return B.isLevelAllowed(y,L.restrictedLevels)&&y<=E});return this.clientRect=null,B.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,L={width:0,height:0};if(E){var _=E.getBoundingClientRect();L.width=_.width,L.height=_.height,!L.width&&!L.height&&(L.width=_.right-_.left||E.width||0,L.height=_.bottom-_.top||E.height||0)}return this.clientRect=L,L},B.isLevelAllowed=function(E,L){return L===void 0&&(L=[]),L.indexOf(E)===-1},B.getMaxLevelByMediaSize=function(E,L,_){if(!E||!E.length)return-1;for(var A=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},x=E.length-1,y=0;y<E.length;y+=1){var h=E[y];if((h.width>=L||h.height>=_)&&A(h,E[y+1])){x=y;break}}return x},I(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(L){}return E}}]),B}();Y.default=K},"./src/controller/cmcd-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return A});var Z=O("./src/events.ts"),U=O("./src/types/cmcd.ts"),I=O("./src/utils/buffer-helper.ts"),K=O("./src/utils/logger.ts");function B(x,y){for(var h=0;h<y.length;h++){var o=y[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function M(x,y,h){return y&&B(x.prototype,y),h&&B(x,h),x}function R(x,y){var h=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(h)return(h=h.call(x)).next.bind(h);if(Array.isArray(x)||(h=E(x))||y&&x&&typeof x.length=="number"){h&&(x=h);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[o++]}}}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 E(x,y){if(!x)return;if(typeof x=="string")return L(x,y);var h=Object.prototype.toString.call(x).slice(8,-1);if(h==="Object"&&x.constructor&&(h=x.constructor.name),h==="Map"||h==="Set")return Array.from(x);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return L(x,y)}function L(x,y){(y==null||y>x.length)&&(y=x.length);for(var h=0,o=new Array(y);h<y;h++)o[h]=x[h];return o}function _(){return _=Object.assign||function(x){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(x[o]=h[o])}return x},_.apply(this,arguments)}var A=function(){function x(h){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){K.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(S){try{var g=S.frag,p=o.hls.levels[g.level],w=o.getObjectType(g),b={d:g.duration*1e3,ot:w};(w===U.CMCDObjectType.VIDEO||w===U.CMCDObjectType.AUDIO||w==U.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=o.getTopBandwidth(w),b.bl=o.getBufferLength(w)),o.apply(S,b)}catch(u){K.logger.warn("Could not generate segment CMCD data.",u)}},this.hls=h;var l=this.config=h.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||x.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var y=x.prototype;return y.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.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(o,l){this.media=l.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(o,l){var d,S;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(S=l.tracks.video)===null||S===void 0?void 0:S.buffer},y.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(o,l){l===void 0&&(l={}),_(l,this.createData());var d=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var S=x.toHeaders(l);if(!Object.keys(S).length)return;o.headers||(o.headers={}),_(o.headers,S)}else{var g=x.toQuery(l);if(!g)return;o.url=x.appendQueryToUri(o.url,g)}},y.getObjectType=function(o){var l=o.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(o){for(var l=0,d=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=R(d),g;!(g=S()).done;){var p=g.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},y.getBufferLength=function(o){var l=this.hls.media,d=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var S=I.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return S.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var g=S.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(w,b,u){l(w),this.loader.load(w,b,u)},M(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},y.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var g=S.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(w,b,u){l(w),this.loader.load(w,b,u)},M(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},x.serialize=function(o){for(var l=[],d=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},S=function(j){return Math.round(j)},g=function(j){return S(j/100)*100},p=function(j){return encodeURIComponent(j)},w={br:S,d:S,bl:g,dl:g,mtp:g,nor:p,rtp:g,tb:S},b=Object.keys(o||{}).sort(),u=R(b),f;!(f=u()).done;){var s=f.value,a=o[s];if(!d(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var T=w[s];T&&(a=T(a));var v=typeof a,C=void 0;s==="ot"||s==="sf"||s==="st"?C=s+"="+a:v==="boolean"?C=s:v==="number"?C=s+"="+a:C=s+"="+JSON.stringify(a),l.push(C)}return l.join(",")},x.toHeaders=function(o){for(var l=Object.keys(o),d={},S=["Object","Request","Session","Status"],g=[{},{},{},{}],p={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},w=0,b=l;w<b.length;w++){var u=b[w],f=p[u]!=null?p[u]:1;g[f][u]=o[u]}for(var s=0;s<g.length;s++){var a=x.serialize(g[s]);a&&(d["CMCD-"+S[s]]=a)}return d},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},x}()},"./src/controller/eme-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts"),U=O("./src/errors.ts"),I=O("./src/utils/logger.ts"),K=O("./src/utils/mediakeys-helper.ts");function B(A,x){for(var y=0;y<x.length;y++){var h=x[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function M(A,x,y){return x&&B(A.prototype,x),y&&B(A,y),A}var R=3,E=function(x,y,h){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),y.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},L=function(x,y,h,o){switch(x){case K.KeySystems.WIDEVINE:return E(y,h,o);default:throw new Error("Unknown key-system: "+x)}},_=function(){function A(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 x=A.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(h){switch(h){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},x._attemptKeySystemAccess=function(h,o,l){var d=this,S=L(h,o,l,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(h,S);this.mediaKeysPromise=g.then(function(p){return d._onMediaKeySystemAccessObtained(h,p)}),g.catch(function(p){I.logger.error('Failed to obtain key-system "'+h+'" access:',p)})},x._onMediaKeySystemAccessObtained=function(h,o){var l=this;I.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return d.mediaKeys=g,I.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),g});return S.catch(function(g){I.logger.error("Failed to create media-keys:",g)}),S},x._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(h){var o=this;I.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},x._onKeySessionMessage=function(h,o){I.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){I.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},x.onMediaEncrypted=function(h){var o=this;if(I.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},x._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(h,o){var l=this,d=this._mediaKeysList[0];if(!d){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var S=d.mediaKeysSession;if(!S){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,S.generateRequest(h,o).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(g){I.logger.error("Error generating key-session request:",g),l.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(h,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,l);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,d,h),S=void 0}catch(g){I.logger.error(g)}try{d.readyState||d.open("POST",h,!0),S&&S.call(this.hls,d,h)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return d},x._onLicenseRequestReadyStageChange=function(h,o,l,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var S=h.response,g=this._licenseResponseCallback;if(g)try{S=g.call(this.hls,h,o)}catch(w){I.logger.error(w)}d(S)}else{if(I.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=R-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,d)}break}},x._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},x._requestLicense=function(h,o){I.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),S=this._createLicenseXhr(d,h,o);I.logger.log("Sending license request to URL: "+d);var g=this._generateLicenseRequestChallenge(l,h);S.send(g)}catch(p){I.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),d=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,l,d)},M(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();Y.default=_},"./src/controller/fps-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts"),U=O("./src/utils/logger.ts"),I=function(){function K(M){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=M,this.registerListeners()}var B=K.prototype;return B.setStreamController=function(R){this.streamController=R},B.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(R,E){var L=this.hls.config;if(L.capLevelOnFPSDrop){var _=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),L.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(R,E,L){var _=performance.now();if(E){if(this.lastTime){var A=_-this.lastTime,x=L-this.lastDroppedFrames,y=E-this.lastDecodedFrames,h=1e3*x/A,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:x,currentDecoded:y,totalDroppedFrames:L}),h>0&&x>o.config.fpsDroppedMonitoringThreshold*y){var l=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=L,this.lastDecodedFrames=E}},B.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var E=R.getVideoPlaybackQuality();this.checkFPS(R,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();Y.default=I},"./src/controller/fragment-finders.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"findFragmentByPDT",function(){return I}),O.d(Y,"findFragmentByPTS",function(){return K}),O.d(Y,"fragmentWithinToleranceTest",function(){return B}),O.d(Y,"pdtWithinToleranceTest",function(){return M}),O.d(Y,"findFragWithCC",function(){return R});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/binary-search.ts");function I(E,L,_){if(L===null||!Array.isArray(E)||!E.length||!Object(Z.isFiniteNumber)(L))return null;var A=E[0].programDateTime;if(L<(A||0))return null;var x=E[E.length-1].endProgramDateTime;if(L>=(x||0))return null;_=_||0;for(var y=0;y<E.length;++y){var h=E[y];if(M(L,_,h))return h}return null}function K(E,L,_,A){_===void 0&&(_=0),A===void 0&&(A=0);var x=null;if(E?x=L[E.sn-L[0].sn+1]||null:_===0&&L[0].start===0&&(x=L[0]),x&&B(_,A,x)===0)return x;var y=U.default.search(L,B.bind(null,_,A));return y||x}function B(E,L,_){E===void 0&&(E=0),L===void 0&&(L=0);var A=Math.min(L,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-A<=E?1:_.start-A>E&&_.start?-1:0}function M(E,L,_){var A=Math.min(L,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,x=_.endProgramDateTime||0;return x-A>E}function R(E,L){return U.default.search(E,function(_){return _.cc<L?1:_.cc>L?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"FragmentState",function(){return I}),O.d(Y,"FragmentTracker",function(){return K});var Z=O("./src/events.ts"),U=O("./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 K=function(){function R(L){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=L,this._registerListeners()}var E=R.prototype;return E._registerListeners=function(){var _=this.hls;_.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var _=this.hls;_.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(_,A){if(A===U.PlaylistLevelType.MAIN){var x=this.activeFragment,y=this.activeParts;if(!x)return null;if(y)for(var h=y.length;h--;){var o=y[h],l=o?o.end:x.appendedPTS;if(o.start<=_&&l!==void 0&&_<=l)return h>9&&(this.activeParts=y.slice(h-9)),o}else if(x.start<=_&&x.appendedPTS!==void 0&&_<=x.appendedPTS)return x}return this.getBufferedFrag(_,A)},E.getBufferedFrag=function(_,A){for(var x=this.fragments,y=Object.keys(x),h=y.length;h--;){var o=x[y[h]];if((o==null?void 0:o.body.type)===A&&o.buffered){var l=o.body;if(l.start<=_&&_<=l.end)return l}}return null},E.detectEvictedFragments=function(_,A,x){var y=this;Object.keys(this.fragments).forEach(function(h){var o=y.fragments[h];if(!o)return;if(!o.buffered){o.body.type===x&&y.removeFragment(o.body);return}var l=o.range[_];if(!l)return;l.time.some(function(d){var S=!y.isTimeBuffered(d.startPTS,d.endPTS,A);return S&&y.removeFragment(o.body),S})})},E.detectPartialFragments=function(_){var A=this,x=this.timeRanges,y=_.frag,h=_.part;if(!x||y.sn==="initSegment")return;var o=M(y),l=this.fragments[o];if(!l)return;Object.keys(x).forEach(function(d){var S=y.elementaryStreams[d];if(!S)return;var g=x[d],p=h!==null||S.partial===!0;l.range[d]=A.getBufferedTimes(y,h,p,g)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},E.fragBuffered=function(_){var A=M(_),x=this.fragments[A];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},E.getBufferedTimes=function(_,A,x,y){for(var h={time:[],partial:x},o=A?A.start:_.start,l=A?A.end:_.end,d=_.minEndPTS||l,S=_.maxStartPTS||o,g=0;g<y.length;g++){var p=y.start(g)-this.bufferPadding,w=y.end(g)+this.bufferPadding;if(S>=p&&d<=w){h.time.push({startPTS:Math.max(o,y.start(g)),endPTS:Math.min(l,y.end(g))});break}else if(o<w&&l>p)h.partial=!0,h.time.push({startPTS:Math.max(o,y.start(g)),endPTS:Math.min(l,y.end(g))});else if(l<=p)break}return h},E.getPartialFragment=function(_){var A=null,x,y,h,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(S){var g=d[S];if(!g)return;B(g)&&(y=g.body.start-l,h=g.body.end+l,_>=y&&_<=h&&(x=Math.min(_-y,h-_),o<=x&&(A=g.body,o=x)))}),A},E.getState=function(_){var A=M(_),x=this.fragments[A];return x?x.buffered?B(x)?I.PARTIAL:I.OK:x.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},E.backtrack=function(_,A){var x=M(_),y=this.fragments[x];if(!y||y.backtrack)return null;var h=y.backtrack=A||y.loaded;return y.loaded=null,h},E.getBacktrackData=function(_){var A=M(_),x=this.fragments[A];if(x){var y,h=x.backtrack;if(h!=null&&(y=h.payload)!==null&&y!==void 0&&y.byteLength)return h;this.removeFragment(_)}return null},E.isTimeBuffered=function(_,A,x){for(var y,h,o=0;o<x.length;o++){if(y=x.start(o)-this.bufferPadding,h=x.end(o)+this.bufferPadding,_>=y&&A<=h)return!0;if(A<=y)return!1}return!1},E.onFragLoaded=function(_,A){var x=A.frag,y=A.part;if(x.sn==="initSegment"||x.bitrateTest||y)return;var h=M(x);this.fragments[h]={body:x,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(_,A){var x=this,y=A.frag,h=A.part,o=A.timeRanges;if(y.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=y,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var S=o[d];if(x.detectEvictedFragments(d,S),!h)for(var g=0;g<S.length;g++)y.appendedPTS=Math.max(S.end(g),y.appendedPTS||0)})},E.onFragBuffered=function(_,A){this.detectPartialFragments(A)},E.hasFragment=function(_){var A=M(_);return!!this.fragments[A]},E.removeFragmentsInRange=function(_,A,x){var y=this;Object.keys(this.fragments).forEach(function(h){var o=y.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===x&&l.start<A&&l.end>_&&y.removeFragment(l)}})},E.removeFragment=function(_){var A=M(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[A]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function B(R){var E,L;return R.buffered&&(((E=R.range.video)===null||E===void 0?void 0:E.partial)||((L=R.range.audio)===null||L===void 0?void 0:L.partial))}function M(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return B}),O.d(Y,"MAX_START_GAP_JUMP",function(){return M}),O.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d(Y,"SKIP_BUFFER_RANGE_START",function(){return E}),O.d(Y,"default",function(){return L});var Z=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),I=O("./src/events.ts"),K=O("./src/utils/logger.ts"),B=250,M=2,R=.1,E=.05,L=function(){function _(x,y,h,o){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=x,this.media=y,this.fragmentTracker=h,this.hls=o}var A=_.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(y){var h=this.config,o=this.media,l=this.stalled,d=o.currentTime,S=o.seeking,g=this.seeking&&!S,p=!this.seeking&&S;if(this.seeking=S,d!==y){if(this.moved=!0,l!==null){if(this.stallReported){var w=self.performance.now()-l;K.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var b=Z.BufferHelper.bufferInfo(o,d,0),u=b.len>0,f=b.nextStart||0;if(!u&&!f)return;if(S){var s=b.len>M,a=!f||f-d>M&&!this.fragmentTracker.getPartialFragment(d);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,v=Math.max(f,b.start||0)-d,C=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=C==null||((T=C.details)===null||T===void 0)?void 0:T.live,j=D?C.details.targetduration*2:M;if(v>0&&v<=j){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(l===null){this.stalled=z;return}var V=z-l;!S&&V>=B&&this._reportStall(b.len);var P=Z.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(P,V)},A._tryFixBufferStall=function(y,h){var o=this.config,l=this.fragmentTracker,d=this.media,S=d.currentTime,g=l.getPartialFragment(S);if(g){var p=this._trySkipBufferHole(g);if(p)return}y.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(y){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+y+")"),h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},A._trySkipBufferHole=function(y){for(var h=this.config,o=this.hls,l=this.media,d=l.currentTime,S=0,g=Z.BufferHelper.getBuffered(l),p=0;p<g.length;p++){var w=g.start(p);if(d+h.maxBufferHole>=S&&d<w){var b=Math.max(w+E,l.currentTime+R);return K.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,y&&o.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:y}),b}S=g.end(p)}return 0},A._tryNudgeBuffer=function(){var y=this.config,h=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<y.nudgeMaxRetry){var S=l+d*y.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+l+" to "+S),o.currentTime=S,h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+y.nudgeMaxRetry+" nudges"),h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),I=O("./src/demux/id3.ts"),K=.25,B=function(){function M(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var R=M.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var L=this.hls;L.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),L.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var L=this.hls;L.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),L.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(L,_){this.media=_.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(L){if(!this.media)return;for(var _=0;_<L.length;_++){var A=L[_];if(A.kind==="metadata"&&A.label==="id3")return Object(U.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(L,_){if(!this.media)return;var A=_.frag,x=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<x.length;h++){var o=I.getID3Frames(x[h].data);if(o){var l=x[h].pts,d=h<x.length-1?x[h+1].pts:A.end,S=d-l;S<=0&&(d=l+K);for(var g=0;g<o.length;g++){var p=o[g];if(!I.isTimeStampFrame(p)){var w=new y(l,d,"");w.value=p,this.id3Track.addCue(w)}}}}},R.onBufferFlushing=function(L,_){var A=_.startOffset,x=_.endOffset,y=_.type;if(!y||y==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,A,x)}},M}();Y.default=B},"./src/controller/latency-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return M});var Z=O("./src/errors.ts"),U=O("./src/events.ts"),I=O("./src/utils/logger.ts");function K(R,E){for(var L=0;L<E.length;L++){var _=E[L];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function B(R,E,L){return E&&K(R.prototype,E),L&&K(R,L),R}var M=function(){function R(L){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=L,this.config=L.config,this.registerListeners()}var E=R.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},E.onMediaAttached=function(_,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(_,A){var x=A.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(_,A){if(A.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var _=this.media,A=this.levelDetails;if(!_||!A)return;this.currentTime=_.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var y=this.config,h=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var d=x-l,S=Math.min(this.maxLatency,l+A.targetduration),g=d<S;if(A.live&&g&&d>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;_.playbackRate=Math.min(p,Math.max(1,w))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},E.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},E.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},B(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,A=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:A?_.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var A=_.holdBack,x=_.partHoldBack,y=_.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,d=h.lowLatencyMode,S=this.hls.userConfig,g=d&&x||A;(S.liveSyncDuration||S.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:l*y);var p=y,w=1;return g+Math.min(this.stallCount*w,p)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),A=this.targetLatency,x=this.levelDetails;if(_===null||A===null||x===null)return null;var y=x.edge,h=_-A-this.edgeStalled,o=y-x.totalduration,l=y-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,h),l)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var A=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-A,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,A=this.levelDetails;if(!_||!A)return 0;var x=_.buffered.length;return x?_.buffered.end(x-1):A.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return h});var Z=O("./src/types/level.ts"),U=O("./src/events.ts"),I=O("./src/errors.ts"),K=O("./src/utils/codecs.ts"),B=O("./src/controller/level-helper.ts"),M=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var S in d)Object.prototype.hasOwnProperty.call(d,S)&&(o[S]=d[S])}return o},E.apply(this,arguments)}function L(o,l){for(var d=0;d<l.length;d++){var S=l[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function _(o,l,d){return l&&L(o.prototype,l),d&&L(o,d),o}function A(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,x(o,l)}function x(o,l){return x=Object.setPrototypeOf||function(S,g){return S.__proto__=g,S},x(o,l)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){A(l,o);function l(S){var g;return g=o.call(this,S,"[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 d=l.prototype;return d._registerListeners=function(){var g=this.hls;g.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(U.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var g=this.hls;g.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(U.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var g=this._levels;g.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(g,p){var w=[],b=[],u=[],f,s={},a,T=!1,v=!1,C=!1;if(p.levels.forEach(function(V){var P=V.attrs;T=T||!!(V.width&&V.height),v=v||!!V.videoCodec,C=C||!!V.audioCodec,y&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=s[N],a?a.url.push(V.url):(a=new Z.Level(V),s[N]=a,w.push(a)),P&&(P.AUDIO&&Object(B.addGroupId)(a,"audio",P.AUDIO),P.SUBTITLES&&Object(B.addGroupId)(a,"text",P.SUBTITLES))}),(T||v)&&C&&(w=w.filter(function(V){var P=V.videoCodec,N=V.width,$=V.height;return!!P||!!(N&&$)})),w=w.filter(function(V){var P=V.audioCodec,N=V.videoCodec;return(!P||Object(K.isCodecSupportedInMp4)(P,"audio"))&&(!N||Object(K.isCodecSupportedInMp4)(N,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(V){return!V.audioCodec||Object(K.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(b)),p.subtitles&&(u=p.subtitles,Object(B.assignTrackIdsByGroup)(u)),w.length>0){f=w[0].bitrate,w.sort(function(V,P){return V.bitrate-P.bitrate}),this._levels=w;for(var D=0;D<w.length;D++)if(w[D].bitrate===f){this._firstLevel=D,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+f);break}var j=C&&!v,z={levels:w,audioTracks:b,subtitleTracks:u,firstLevel:this._firstLevel,stats:p.stats,audio:C,video:v,altAudio:!j&&b.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(g,p){if(o.prototype.onError.call(this,g,p),p.fatal)return;var w=p.context,b=this._levels[this.currentLevelIndex];if(w&&(w.type===R.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&w.groupId===b.audioGroupIds[b.urlId]||w.type===R.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&w.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var u=!1,f=!0,s;switch(p.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(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=p.frag.level)):s=p.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(f=!1),s=w.level),u=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:s=p.level,u=!0;break}s!==void 0&&this.recoverLevel(p,s,u,f)},d.recoverLevel=function(g,p,w,b){var u=g.details,f=this._levels[p];if(f.loadError++,w){var s=this.retryLoadingOrFail(g);if(s)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=f.url.length;if(a>1&&f.loadError<a)g.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var T=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(u+": switch to "+T),g.levelRetry=!0,this.hls.nextAutoLevel=T)}}},d.redundantFailover=function(g){var p=this._levels[g],w=p.url.length;if(w>1){var b=(p.urlId+1)%w;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(u){u.urlId=b}),this.level=g}},d.onFragLoaded=function(g,p){var w=p.frag;if(w!==void 0&&w.type===R.PlaylistLevelType.MAIN){var b=this._levels[w.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(g,p){var w,b=p.level,u=p.details,f=this._levels[b];if(!f){var s;this.warn("Invalid level index "+b),(s=p.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(u.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(b,p,f.details)):(w=p.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(u.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(g,p){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var b=-1,u=this.hls.audioTracks[p.id].groupId,f=0;f<w.audioGroupIds.length;f++)if(w.audioGroupIds[f]===u){b=f;break}b!==w.urlId&&(w.urlId=b,this.startLoad())}},d.loadPlaylist=function(g){var p=this.currentLevelIndex,w=this._levels[p];if(this.canLoad&&w&&w.url.length>0){var b=w.urlId,u=w.url[b];if(g)try{u=g.addDirectives(u)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+p+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+b+" "+u),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:u,level:p,id:b,deliveryDirectives:g||null})}},d.removeLevel=function(g,p){var w=function(f,s){return s!==p},b=this._levels.filter(function(u,f){return f!==g?!0:u.url.length>1&&p!==void 0?(u.url=u.url.filter(w),u.audioGroupIds&&(u.audioGroupIds=u.audioGroupIds.filter(w)),u.textGroupIds&&(u.textGroupIds=u.textGroupIds.filter(w)),u.urlId=0,!0):!1}).map(function(u,f){var s=u.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=f}),u});this._levels=b,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:b})},_(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var p,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===g&&(p=w[g])!==null&&p!==void 0&&p.details)return;if(g<0||g>=w.length){var b=g<0;if(this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:b,reason:"invalid level idx"}),b)return;g=Math.min(g,w.length-1)}this.clearTimer();var u=this.currentLevelIndex,f=w[u],s=w[g];this.log("switching to level "+g+" from "+u),this.currentLevelIndex=g;var a=E({},s,{level:g,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var T=s.details;if(!T||T.live){var v=this.switchParams(s.uri,f==null?void 0:f.details);this.loadPlaylist(v)}}},{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)}}]),l}(M.default)},"./src/controller/level-helper.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"addGroupId",function(){return I}),O.d(Y,"assignTrackIdsByGroup",function(){return K}),O.d(Y,"updatePTS",function(){return B}),O.d(Y,"updateFragPTSDTS",function(){return R}),O.d(Y,"mergeDetails",function(){return E}),O.d(Y,"mapPartIntersection",function(){return L}),O.d(Y,"mapFragmentIntersection",function(){return _}),O.d(Y,"adjustSliding",function(){return A}),O.d(Y,"addSliding",function(){return x}),O.d(Y,"computeReloadInterval",function(){return y}),O.d(Y,"getFragmentWithSN",function(){return h}),O.d(Y,"getPartWith",function(){return o});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts");function I(l,d,S){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(S);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(S);break}}function K(l){var d={};l.forEach(function(S){var g=S.groupId||"";S.id=d[g]=d[g]||0,d[g]++})}function B(l,d,S){var g=l[d],p=l[S];M(g,p)}function M(l,d){var S=d.startPTS;if(Object(Z.isFiniteNumber)(S)){var g=0,p;d.sn>l.sn?(g=S-l.start,p=l):(g=l.start-S,p=d),p.duration!==g&&(p.duration=g)}else if(d.sn>l.sn){var w=l.cc===d.cc;w&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function R(l,d,S,g,p,w){var b=g-S;b<=0&&(U.logger.warn("Fragment should have a positive duration",d),g=S+d.duration,w=p+d.duration);var u=S,f=g,s=d.startPTS,a=d.endPTS;if(Object(Z.isFiniteNumber)(s)){var T=Math.abs(s-S);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(T,d.deltaPTS):d.deltaPTS=T,u=Math.max(S,s),S=Math.min(S,s),p=Math.min(p,d.startDTS),f=Math.min(g,a),g=Math.max(g,a),w=Math.max(w,d.endDTS)}d.duration=g-S;var v=S-d.start;d.appendedPTS=g,d.start=d.startPTS=S,d.maxStartPTS=u,d.startDTS=p,d.endPTS=g,d.minEndPTS=f,d.endDTS=w;var C=d.sn;if(!l||C<l.startSN||C>l.endSN)return 0;var D,j=C-l.startSN,z=l.fragments;for(z[j]=d,D=j;D>0;D--)M(z[D],z[D-1]);for(D=j;D<z.length-1;D++)M(z[D],z[D+1]);return l.fragmentHint&&M(z[z.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,v}function E(l,d){for(var S=null,g=l.fragments,p=g.length-1;p>=0;p--){var w=g[p].initSegment;if(w){S=w;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,u;if(_(l,d,function(D,j){D.relurl&&(b=D.cc-j.cc),Object(Z.isFiniteNumber)(D.startPTS)&&Object(Z.isFiniteNumber)(D.endPTS)&&(j.start=j.startPTS=D.startPTS,j.startDTS=D.startDTS,j.appendedPTS=D.appendedPTS,j.maxStartPTS=D.maxStartPTS,j.endPTS=D.endPTS,j.endDTS=D.endDTS,j.minEndPTS=D.minEndPTS,j.duration=D.endPTS-D.startPTS,j.duration&&(u=j),d.PTSKnown=d.alignedSliding=!0),j.elementaryStreams=D.elementaryStreams,j.loader=D.loader,j.stats=D.stats,j.urlId=D.urlId,D.initSegment&&(j.initSegment=D.initSegment,S=D.initSegment)}),S){var f=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;f.forEach(function(D){var j;(!D.initSegment||D.initSegment.relurl===((j=S)===null||j===void 0?void 0:j.relurl))&&(D.initSegment=S)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(D){return!D}),d.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=d.skippedSegments;s--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<a.length;T++)a[T].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),L(l.partList,d.partList,function(D,j){j.elementaryStreams=D.elementaryStreams,j.stats=D.stats}),u?R(d,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):A(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var v=d.advancedDateTime;if(d.advanced&&v){var C=d.edge;d.driftStart||(d.driftStartTime=v,d.driftStart=C),d.driftEndTime=v,d.driftEnd=C}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function L(l,d,S){if(l&&d)for(var g=0,p=0,w=l.length;p<=w;p++){var b=l[p],u=d[p+g];b&&u&&b.index===u.index&&b.fragment.sn===u.fragment.sn?S(b,u):g--}}function _(l,d,S){for(var g=d.skippedSegments,p=Math.max(l.startSN,d.startSN)-d.startSN,w=(l.fragmentHint?1:0)+(g?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,b=d.startSN-l.startSN,u=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,s=p;s<=w;s++){var a=f[b+s],T=u[s];g&&!T&&s<g&&(T=d.fragments[s]=a),a&&T&&S(a,T)}}function A(l,d){var S=d.startSN+d.skippedSegments-l.startSN,g=l.fragments;if(S<0||S>=g.length)return;x(d,g[S].start)}function x(l,d){if(d){for(var S=l.fragments,g=l.skippedSegments;g<S.length;g++)S[g].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function y(l,d){var S=1e3*l.levelTargetDuration,g=S/2,p=l.age,w=p>0&&p<S*3,b=d.loading.end-d.loading.start,u,f=l.availabilityDelay;if(l.updated===!1)if(w){var s=333*l.misses;u=Math.max(Math.min(g,b*2),s),l.availabilityDelay=(l.availabilityDelay||0)+u}else u=g;else w?(f=Math.min(f||S/2,p),l.availabilityDelay=f,u=f+S-p):u=S-b;return Math.round(u)}function h(l,d,S){if(!l||!l.details)return null;var g=l.details,p=g.fragments[d-g.startSN];return p||(p=g.fragmentHint,p&&p.sn===d?p:d<g.startSN&&S&&S.sn===d?S:null)}function o(l,d,S){if(!l||!l.details)return null;var g=l.details.partList;if(g)for(var p=g.length;p--;){var w=g[p];if(w.index===S&&w.fragment.sn===d)return w}return null}},"./src/controller/stream-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return g});var Z=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),I=O("./src/is-supported.ts"),K=O("./src/events.ts"),B=O("./src/utils/buffer-helper.ts"),M=O("./src/controller/fragment-tracker.ts"),R=O("./src/types/loader.ts"),E=O("./src/loader/fragment.ts"),L=O("./src/demux/transmuxer-interface.ts"),_=O("./src/types/transmuxer.ts"),A=O("./src/controller/gap-controller.ts"),x=O("./src/errors.ts"),y=O("./src/utils/logger.ts");function h(p,w){for(var b=0;b<w.length;b++){var u=w[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function o(p,w,b){return w&&h(p.prototype,w),b&&h(p,b),p}function l(p,w){p.prototype=Object.create(w.prototype),p.prototype.constructor=p,d(p,w)}function d(p,w){return d=Object.setPrototypeOf||function(u,f){return u.__proto__=f,u},d(p,w)}var S=100,g=function(p){l(w,p);function w(u,f){var s;return s=p.call(this,u,f,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var b=w.prototype;return b._registerListeners=function(){var f=this.hls;f.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(K.Events.ERROR,this.onError,this),f.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var f=this.hls;f.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(K.Events.ERROR,this.onError,this),f.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(f){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=a.startLevel;T===-1&&(a.config.testBandwidth?(T=0,this.bitrateTest=!0):T=a.nextAutoLevel),this.level=a.nextLoadLevel=T,this.loadedmetadata=!1}s>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),f=s),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var f,s=this.levels,a=this.level,T=s==null||((f=s[a])===null||f===void 0)?void 0:f.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var v,C=self.performance.now(),D=this.retryDate;(!D||C>=D||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var f,s,a=this.hls,T=this.levelLastLoaded,v=this.levels,C=this.media,D=a.config,j=a.nextLoadLevel;if(T===null||!C&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[j])return;var z=v[j];this.level=a.nextLoadLevel=j;var V=z.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=U.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:C,R.PlaylistLevelType.MAIN);if(P===null)return;var N=P.len,$=this.getMaxBufferLength(z.maxBitrate);if(N>=$)return;if(this._streamEnded(P,V)){var re={};this.altAudio&&(re.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,re),this.state=U.State.ENDED;return}var pe=P.end,ve=this.getNextFragment(pe,V);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Ae=ve.sn-V.startSN;Ae>1&&(ve=V.fragments[Ae-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===M.FragmentState.OK&&this.nextLoadPosition>pe){var Le=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(C,Le,R.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,V)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((f=ve.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((s=ve.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ve,V):this.loadFragment(ve,V,pe)},b.loadFragment=function(f,s,a){var T,v=this.fragmentTracker.getState(f);if(this.fragCurrent=f,v===M.FragmentState.BACKTRACKED){var C=this.fragmentTracker.getBacktrackData(f);if(C){this._handleFragmentLoadProgress(C),this._handleFragmentLoadComplete(C);return}else v=M.FragmentState.NOT_LOADED}v===M.FragmentState.NOT_LOADED||v===M.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,f,s,a)):v===M.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(f){var s=this.fragmentTracker.getAppendedFrag(f,R.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},b.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,R.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var f=this.levels,s=this.media;if(s!=null&&s.readyState){var a,T=this.getAppendedFrag(s.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!s.paused&&f){var v=this.hls.nextLoadLevel,C=f[v],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*C.maxBitrate/(1e3*D)+1:a=0}else a=0;var j=this.getBufferedFrag(s.currentTime+a);if(j){var z=this.followingBufferedFrag(j);if(z){this.abortCurrentFrag();var V=z.maxStartPTS?z.maxStartPTS:z.start,P=z.duration,N=Math.max(j.end,V+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(f,s){p.prototype.flushMainBuffer.call(this,f,s,this.altAudio?"video":null)},b.onMediaAttached=function(f,s){p.prototype.onMediaAttached.call(this,f,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var f=this.media,s=f?f.currentTime:null;Object(Z.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(f,s){var a=!1,T=!1,v;s.levels.forEach(function(C){v=C.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=a&&T&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},b.onLevelLoading=function(f,s){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var T=a[s.level];(!T.details||T.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(T.details))&&(this.state=U.State.WAITING_LEVEL)},b.onLevelLoaded=function(f,s){var a,T=this.levels,v=s.level,C=s.details,D=C.totalduration;if(!T){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+C.startSN+","+C.endSN+"], cc ["+C.startCC+", "+C.endCC+"] duration:"+D);var j=this.fragCurrent;j&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==s.level&&j.loader&&(this.state=U.State.IDLE,j.loader.abort()));var z=T[v],V=0;if(C.live||(a=z.details)!==null&&a!==void 0&&a.live){if(C.fragments[0]||(C.deltaUpdateFailed=!0),C.deltaUpdateFailed)return;V=this.alignPlaylists(C,z.details)}if(z.details=C,this.levelLastLoaded=v,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:C,level:v}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(C))return;this.state=U.State.IDLE}this.startFragRequested?C.live&&this.synchronizeToLiveEdge(C):this.setStartPosition(C,V),this.tick()},b._handleFragmentLoadProgress=function(f){var s,a=f.frag,T=f.part,v=f.payload,C=this.levels;if(!C){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var D=C[a.level],j=D.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var z=D.videoCodec,V=j.PTSKnown||!j.live,P=(s=a.initSegment)===null||s===void 0?void 0:s.data,N=this._getAudioCodec(D),$=this.transmuxer=this.transmuxer||new L.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),re=T?T.index:-1,pe=re!==-1,ve=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,re,pe),Ae=this.initPTS[a.cc];$.push(v,P,N,z,a,T,j.totalduration,V,ve,Ae)},b.onAudioTrackSwitching=function(f,s){var a=this.altAudio,T=!!s.url,v=s.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var C=this.fragCurrent;C!=null&&C.loader&&(this.log("Switching to main audio track, cancel main fragment load"),C.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;a&&D.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:v})}},b.onAudioTrackSwitched=function(f,s){var a=s.id,T=!!this.hls.audioTracks[a].url;if(T){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=T,this.tick()},b.onBufferCreated=function(f,s){var a=s.tracks,T,v,C=!1;for(var D in a){var j=a[D];if(j.id==="main"){if(v=D,T=j,D==="video"){var z=a[D];z&&(this.videoBuffer=z.buffer)}}else C=!0}C&&T?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(f,s){var a=s.frag,T=s.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(T?" p: "+T.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var v=T?T.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,T)},b.onError=function(f,s){switch(s.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,s);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=U.State.ERROR):!s.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,T=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);T&&T.len>.5&&(a=!this.reduceMaxBufferLength(T.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var f=this.media,s=this.gapController;if(!f||!s||!f.readyState)return;var a=B.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(f,s){var a=s.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,a,R.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(f,s){this.levels=s.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var f=this.media,s=f.currentTime,a=this.startPosition;if(a>=0&&s<a){if(f.seeking){y.logger.log("could not seek to "+a+", already seeking at "+s);return}var T=B.BufferHelper.getBuffered(f),v=T.length?T.start(0):0,C=v-a;C>0&&(C<this.config.maxBufferHole||C<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+C+" to match buffer start"),a+=C,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),f.currentTime=a}},b._getAudioCodec=function(f){var s=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},b._loadBitrateTestFrag=function(f){var s=this;this._doFragLoad(f).then(function(a){var T=s.hls;if(!a||T.nextLoadLevel||s.fragContextChanged(f))return;s.fragLoadError=0,s.state=U.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var v=f.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),T.trigger(K.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(f){var s,a="main",T=this.hls,v=f.remuxResult,C=f.chunkMeta,D=this.getCurrentContext(C);if(!D){this.warn("The loading context changed while buffering fragment "+C.sn+" of level "+C.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(C.level);return}var j=D.frag,z=D.part,V=D.level,P=v.video,N=v.text,$=v.id3,re=v.initSegment,pe=this.altAudio?void 0:v.audio;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,re){re.tracks&&(this._bufferInitSegment(V,re.tracks,j,C),T.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:a,tracks:re.tracks}));var ve=re.initPTS,Ae=re.timescale;Object(Z.isFiniteNumber)(ve)&&(this.initPTS[j.cc]=ve,T.trigger(K.Events.INIT_PTS_FOUND,{frag:j,id:a,initPTS:ve,timescale:Ae}))}if(P&&v.independent!==!1){if(V.details){var Le=P.startPTS,ce=P.endPTS,ae=P.startDTS,de=P.endDTS;if(z)z.elementaryStreams[P.type]={startPTS:Le,endPTS:ce,startDTS:ae,endDTS:de};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<Le){this.backtrack(j);return}j.setElementaryStreamInfo(P.type,j.start,ce,j.start,de,!0)}j.setElementaryStreamInfo(P.type,Le,ce,ae,de),this.bufferFragmentData(P,j,z,C)}}else if(v.independent===!1){this.backtrack(j);return}if(pe){var se=pe.startPTS,J=pe.endPTS,ee=pe.startDTS,oe=pe.endDTS;z&&(z.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:J,startDTS:ee,endDTS:oe}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,se,J,ee,oe),this.bufferFragmentData(pe,j,z,C)}if($!=null&&(s=$.samples)!==null&&s!==void 0&&s.length){var fe={frag:j,id:a,samples:$.samples};T.trigger(K.Events.FRAG_PARSING_METADATA,fe)}if(N){var ke={frag:j,id:a,samples:N.samples};T.trigger(K.Events.FRAG_PARSING_USERDATA,ke)}},b._bufferInitSegment=function(f,s,a,T){var v=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var C=s.audio,D=s.video,j=s.audiovideo;if(C){var z=f.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),C.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(z="mp4a.40.5")),V.indexOf("android")!==-1&&C.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),f.audioCodec&&f.audioCodec!==z&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+z+'"'),C.levelCodec=z,C.id="main",this.log("Init audio buffer, container:"+C.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(f.audioCodec||"")+"/"+C.codec+"]")}D&&(D.levelCodec=f.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+D.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(P){var N=s[P],$=N.initSegment;$!=null&&$.byteLength&&v.hls.trigger(K.Events.BUFFER_APPENDING,{type:P,data:$,frag:a,part:null,chunkMeta:T,parent:a.type})}),this.tick()},b.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var s=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,s?this.resetFragmentLoading(f):this.state=U.State.BACKTRACKING},b.checkFragmentChanged=function(){var f=this.media,s=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(B.BufferHelper.isBuffered(f,a)?s=this.getAppendedFrag(a):B.BufferHelper.isBuffered(f,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var T=this.fragPlaying,v=s.level;(!T||s.sn!==T.sn||T.level!==v||s.urlId!==T.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:s}),(!T||T.level!==v)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=s)}}},o(w,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"SubtitleStreamController",function(){return l});var Z=O("./src/events.ts"),U=O("./src/utils/logger.ts"),I=O("./src/utils/buffer-helper.ts"),K=O("./src/controller/fragment-finders.ts"),B=O("./src/utils/discontinuities.ts"),M=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),E=O("./src/controller/base-stream-controller.ts"),L=O("./src/types/loader.ts"),_=O("./src/types/level.ts");function A(d,S){for(var g=0;g<S.length;g++){var p=S[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(d,p.key,p)}}function x(d,S,g){return S&&A(d.prototype,S),g&&A(d,g),d}function y(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,h(d,S)}function h(d,S){return h=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},h(d,S)}var o=500,l=function(d){y(S,d);function S(p,w){var b;return b=d.call(this,p,w,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var g=S.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var w=this.hls;w.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(Z.Events.ERROR,this.onError,this),w.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var w=this.hls;w.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(Z.Events.ERROR,this.onError,this),w.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(w,b){this.mainDetails=b.details},g.onSubtitleFragProcessed=function(w,b){var u=b.frag,f=b.success;if(this.fragPrevious=u,this.state=E.State.IDLE,!f)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,T=u.start,v=0;v<s.length;v++)if(T>=s[v].start&&T<=s[v].end){a=s[v];break}var C=u.start+u.duration;a?a.end=C:(a={start:T,end:C},s.push(a)),this.fragmentTracker.fragBuffered(u)},g.onBufferFlushing=function(w,b){var u=b.startOffset,f=b.endOffset;if(u===0&&f!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var T=a[s].details,v=T.targetduration,C=f-v;if(C<=0)return;b.endOffsetSubtitles=Math.max(0,C),this.tracksBuffered.forEach(function(D){for(var j=0;j<D.length;){if(D[j].end<=C){D.shift();continue}else if(D[j].start<C)D[j].start=C;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(u,C,L.PlaylistLevelType.SUBTITLE)}},g.onError=function(w,b){var u,f=b.frag;if(!f||f.type!==L.PlaylistLevelType.SUBTITLE)return;(u=this.fragCurrent)!==null&&u!==void 0&&u.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},g.onSubtitleTracksUpdated=function(w,b){var u=this,f=b.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(s){return new _.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){u.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(w,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var u=this.levels[this.currentTrackId];u!=null&&u.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,u&&this.setInterval(o)},g.onSubtitleTrackLoaded=function(w,b){var u,f=b.details,s=b.id,a=this.currentTrackId,T=this.levels;if(!T.length)return;var v=T[a];if(s>=T.length||s!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(u=v.details)!==null&&u!==void 0&&u.live){var C=this.mainDetails;if(f.deltaUpdateFailed||!C)return;var D=C.fragments[0];if(!v.details)f.hasProgramDateTime&&C.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(f,C):D&&Object(M.addSliding)(f,D.start);else{var j=this.alignPlaylists(f,v.details);j===0&&D&&Object(M.addSliding)(f,D.start)}}if(v.details=f,this.levelLastLoaded=s,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var z=Object(K.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(w){var b=w.frag,u=w.payload,f=b.decryptdata,s=this.hls;if(this.fragContextChanged(b))return;if(u&&u.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(u),f.key.buffer,f.iv.buffer).then(function(T){var v=performance.now();s.trigger(Z.Events.FRAG_DECRYPTED,{frag:b,payload:T,stats:{tstart:a,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var w,b=this.currentTrackId,u=this.levels;if(!u.length||!u[b]||!u[b].details)return;var f=u[b].details,s=f.targetduration,a=this.config,T=this.media,v=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-s,a.maxBufferHole),C=v.end,D=v.len,j=this.getMaxBufferLength()+s;if(D>j)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var z=f.fragments,V=z.length,P=f.edge,N,$=this.fragPrevious;if(C<P){var re=a.maxFragLookUpTolerance;$&&f.hasProgramDateTime&&(N=Object(K.findFragmentByPDT)(z,$.endProgramDateTime,re)),N||(N=Object(K.findFragmentByPTS)($,z,C,re),!N&&$&&$.start<z[0].start&&(N=z[0]))}else N=z[V-1];(w=N)!==null&&w!==void 0&&w.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===R.FragmentState.NOT_LOADED&&this.loadFragment(N,f,C)}},g.loadFragment=function(w,b,u){this.fragCurrent=w,d.prototype.loadFragment.call(this,w,b,u)},x(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(E.default)},"./src/controller/subtitle-track-controller.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),I=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function B(A,x){for(var y=0;y<x.length;y++){var h=x[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function M(A,x,y){return x&&B(A.prototype,x),y&&B(A,y),A}function R(A,x){A.prototype=Object.create(x.prototype),A.prototype.constructor=A,E(A,x)}function E(A,x){return E=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},E(A,x)}var L=function(A){R(x,A);function x(h){var o;return o=A.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var y=x.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},y.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},y.onMediaAttached=function(o,l){if(this.media=l.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(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},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 o=_(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),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(o,l){this.tracks=l.subtitleTracks},y.onSubtitleTrackLoaded=function(o,l){var d=l.id,S=l.details,g=this.trackId,p=this.tracksInGroup[g];if(!p){this.warn("Invalid subtitle track id "+d);return}var w=p.details;p.details=l.details,this.log("subtitle track "+d+" loaded ["+S.startSN+"-"+S.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,w))},y.onLevelLoading=function(o,l){this.switchLevel(l.level)},y.onLevelSwitching=function(o,l){this.switchLevel(l.level)},y.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=g;var p=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=d;var w={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,w),p!==-1&&this.setSubtitleTrack(p,S)}},y.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var S=l[d];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},y.onError=function(o,l){if(A.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},y.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,S=l.groupId,g=l.url;if(o)try{g=o.addDirectives(g)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:g,id:d,groupId:S,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var l=this,d=this.media,S=this.subtitleDisplay,g=this.trackId;if(!d)return;var p=_(d.textTracks),w=p.filter(function(f){return f.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(f){f.mode="disabled"});else{var b=w[g];b&&(b.mode="disabled")}var u=w[o];u&&(u.mode=S?"showing":"hidden")},y.setSubtitleTrack=function(o,l){var d,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=S[o])!==null&&d!==void 0&&d.details)||o<-1||o>=S.length)return;this.clearTimer();var g=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var p=g.id,w=g.groupId,b=w===void 0?"":w,u=g.name,f=g.type,s=g.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:u,type:f,url:s});var a=this.switchParams(g.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=_(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},M(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),x}(I.default);function _(A){for(var x=[],y=0;y<A.length;y++){var h=A[y];h.kind==="subtitles"&&h.label&&x.push(A[y])}return x}Y.default=L},"./src/controller/timeline-controller.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"TimelineController",function(){return _});var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),I=O("./src/utils/cea-608-parser.ts"),K=O("./src/utils/output-filter.ts"),B=O("./src/utils/webvtt-parser.ts"),M=O("./src/utils/texttrack-utils.ts"),R=O("./src/utils/imsc1-ttml-parser.ts"),E=O("./src/types/loader.ts"),L=O("./src/utils/logger.ts"),_=function(){function h(l){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=l,this.config=l.config,this.Cues=l.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 d=new K.default(this,"textTrack1"),S=new K.default(this,"textTrack2"),g=new K.default(this,"textTrack3"),p=new K.default(this,"textTrack4");this.cea608Parser1=new I.default(1,d,S),this.cea608Parser2=new I.default(3,g,p)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(U.Events.FRAG_LOADING,this.onFragLoading,this),d.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,S,g,p,w){for(var b=!1,u=w.length;u--;){var f=w[u],s=x(f[0],f[1],S,g);if(s>=0&&(f[0]=Math.min(f[0],S),f[1]=Math.max(f[1],g),b=!0,s/(g-S)>.5))return}if(b||w.push([S,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,S,g,p)}else{var T=this.Cues.newCue(null,S,g,p);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:T,track:d})}},o.onInitPtsFound=function(d,S){var g=this,p=S.frag,w=S.id,b=S.initPTS,u=S.timescale,f=this.unparsedVttFrags;w==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=u),f.length&&(this.unparsedVttFrags=[],f.forEach(function(s){g.onFragLoaded(U.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(d){var S=this.media;if(S)for(var g=0;g<S.textTracks.length;g++){var p=S.textTracks[g];if(p[d])return p}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var S=this.captionsProperties,g=this.captionsTracks,p=this.media,w=S[d],b=w.label,u=w.languageCode,f=this.getExistingTrack(d);if(f)g[d]=f,Object(M.clearCurrentCues)(g[d]),Object(M.sendAddTrackEvent)(g[d],p);else{var s=this.createTextTrack("captions",b,u);s&&(s[d]=!0,g[d]=s)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var S=this.captionsProperties[d];if(!S)return;var g=S.label,p={_id:d,label:g,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[d]=p,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(d,S,g){var p=this.media;return p?p.addTextTrack(d,S,g):void 0},o.onMediaAttaching=function(d,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(S){Object(M.clearCurrentCues)(d[S]),delete d[S]}),this.nonNativeCaptionsTracks={}},o.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())},o._cleanTracks=function(){var d=this.media;if(!d)return;var S=d.textTracks;if(S)for(var g=0;g<S.length;g++)Object(M.clearCurrentCues)(S[g])},o.onSubtitleTracksUpdated=function(d,S){var g=this;this.textTracks=[];var p=S.subtitleTracks||[],w=p.some(function(s){return s.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var b=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var T;if(a<u.length){for(var v=null,C=0;C<u.length;C++)if(A(u[C],s)){v=u[C];break}v&&(T=v)}T?Object(M.clearCurrentCues)(T):(T=g.createTextTrack("subtitles",s.name,s.lang),T&&(T.mode="disabled")),T&&(T.groupId=s.groupId,g.textTracks.push(T))})}else if(!b&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(d,S){var g=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(p){var w=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!w)return;var b="textTrack"+w[1],u=g.captionsProperties[b];if(!u)return;u.label=p.name,p.lang&&(u.languageCode=p.lang),u.media=p})},o.onFragLoading=function(d,S){var g=this.cea608Parser1,p=this.cea608Parser2,w=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(g&&p))return;if(S.frag.type===E.PlaylistLevelType.MAIN){var u,f,s=S.frag.sn,a=(u=S==null||((f=S.part)===null||f===void 0)?void 0:f.index)!=null?u:-1;s===w+1||s===w&&a===b+1||(g.reset(),p.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(d,S){var g=S.frag,p=S.payload,w=this.initPTS,b=this.unparsedVttFrags;if(g.type===E.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Z.isFiniteNumber)(w[g.cc])){b.push(S),w.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var u=g.decryptdata;if(u==null||u.key==null||u.method!=="AES-128"){var f=this.tracks[g.level],s=this.vttCCs;s[g.cc]||(s[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),f&&f.textCodec===R.IMSC1_CODEC?this._parseIMSC1(g,p):this._parseVTTs(g,p,s)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,S){var g=this,p=this.hls;Object(R.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(w){g._appendCues(w,d.level),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(w){L.logger.log("Failed to parse IMSC1: "+w),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:w})})},o._parseVTTs=function(d,S,g){var p=this,w=this.hls;Object(B.parseWebVTT)(S,this.initPTS[d.cc],this.timescale[d.cc],g,d.cc,d.start,function(b){p._appendCues(b,d.level),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){p._fallbackToIMSC1(d,S),L.logger.log("Failed to parse VTT cue: "+b),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,S){var g=this,p=this.tracks[d.level];p.textCodec||Object(R.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(){p.textCodec=R.IMSC1_CODEC,g._parseIMSC1(d,S)},function(){p.textCodec="wvtt"})},o._appendCues=function(d,S){var g=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[S];if(p.mode==="disabled")return;d.forEach(function(u){return Object(M.addCueToTrack)(p,u)})}else{var w=this.tracks[S],b=w.default?"default":"subtitles"+S;g.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,S){var g=S.frag;if(g.type===E.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(U.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,S){var g=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(g&&p))return;for(var w=0;w<S.samples.length;w++){var b=S.samples[w].bytes;if(b){var u=this.extractCea608Data(b);g.addData(S.samples[w].pts,u[0]),p.addData(S.samples[w].pts,u[1])}}},o.onBufferFlushing=function(d,S){var g=S.startOffset,p=S.endOffset,w=S.endOffsetSubtitles,b=S.type,u=this.media;if(!u||u.currentTime<p)return;if(!b||b==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(M.removeCuesInRange)(f[a],g,p)})}if(this.config.renderTextTracksNatively&&(g===0&&w!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(M.removeCuesInRange)(s[a],g,w)})}},o.extractCea608Data=function(d){for(var S=d[0]&31,g=2,p=[[],[]],w=0;w<S;w++){var b=d[g++],u=127&d[g++],f=127&d[g++],s=(4&b)!==0,a=3&b;if(u===0&&f===0)continue;s&&((a===0||a===1)&&(p[a].push(u),p[a].push(f)))}return p},h}();function A(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function x(h,o,l,d){return Math.min(o,d)-Math.max(h,l)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return Z});var Z=function(){function U(K,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=B}var I=U.prototype;return I.decrypt=function(B,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,B)},U}()},"./src/crypt/aes-decryptor.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"removePadding",function(){return U}),O.d(Y,"default",function(){return I});var Z=O("./src/utils/typed-array.ts");function U(K){var B=K.byteLength,M=B&&new DataView(K.buffer).getUint8(B-1);return M?Object(Z.sliceUint8)(K,0,B-M):K}var I=function(){function K(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var B=K.prototype;return B.uint8ArrayToUint32Array_=function(R){for(var E=new DataView(R),L=new Uint32Array(4),_=0;_<4;_++)L[_]=E.getUint32(_*4);return L},B.initTable=function(){var R=this.sBox,E=this.invSBox,L=this.subMix,_=L[0],A=L[1],x=L[2],y=L[3],h=this.invSubMix,o=h[0],l=h[1],d=h[2],S=h[3],g=new Uint32Array(256),p=0,w=0,b=0;for(b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(b=0;b<256;b++){var u=w^w<<1^w<<2^w<<3^w<<4;u=u>>>8^u&255^99,R[p]=u,E[u]=p;var f=g[p],s=g[f],a=g[s],T=g[u]*257^u*16843008;_[p]=T<<24|T>>>8,A[p]=T<<16|T>>>16,x[p]=T<<8|T>>>24,y[p]=T,T=a*16843009^s*65537^f*257^p*16843008,o[u]=T<<24|T>>>8,l[u]=T<<16|T>>>16,d[u]=T<<8|T>>>24,S[u]=T,p?(p=f^g[g[g[a^f]]],w^=g[g[w]]):p=w=1}},B.expandKey=function(R){for(var E=this.uint8ArrayToUint32Array_(R),L=!0,_=0;_<E.length&&L;)L=E[_]===this.key[_],_++;if(L)return;this.key=E;var A=this.keySize=E.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var x=this.ksRows=(A+6+1)*4,y,h,o=this.keySchedule=new Uint32Array(x),l=this.invKeySchedule=new Uint32Array(x),d=this.sBox,S=this.rcon,g=this.invSubMix,p=g[0],w=g[1],b=g[2],u=g[3],f,s;for(y=0;y<x;y++){if(y<A){f=o[y]=E[y];continue}s=f,y%A===0?(s=s<<8|s>>>24,s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255],s^=S[y/A|0]<<24):A>6&&y%A===4&&(s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255]),o[y]=f=(o[y-A]^s)>>>0}for(h=0;h<x;h++)y=x-h,h&3?s=o[y]:s=o[y-4],h<4||y<=4?l[h]=s:l[h]=p[d[s>>>24]]^w[d[s>>>16&255]]^b[d[s>>>8&255]]^u[d[s&255]],l[h]=l[h]>>>0},B.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},B.decrypt=function(R,E,L){for(var _=this.keySize+6,A=this.invKeySchedule,x=this.invSBox,y=this.invSubMix,h=y[0],o=y[1],l=y[2],d=y[3],S=this.uint8ArrayToUint32Array_(L),g=S[0],p=S[1],w=S[2],b=S[3],u=new Int32Array(R),f=new Int32Array(u.length),s,a,T,v,C,D,j,z,V,P,N,$,re,pe,ve=this.networkToHostOrderSwap;E<u.length;){for(V=ve(u[E]),P=ve(u[E+1]),N=ve(u[E+2]),$=ve(u[E+3]),C=V^A[0],D=$^A[1],j=N^A[2],z=P^A[3],re=4,pe=1;pe<_;pe++)s=h[C>>>24]^o[D>>16&255]^l[j>>8&255]^d[z&255]^A[re],a=h[D>>>24]^o[j>>16&255]^l[z>>8&255]^d[C&255]^A[re+1],T=h[j>>>24]^o[z>>16&255]^l[C>>8&255]^d[D&255]^A[re+2],v=h[z>>>24]^o[C>>16&255]^l[D>>8&255]^d[j&255]^A[re+3],C=s,D=a,j=T,z=v,re=re+4;s=x[C>>>24]<<24^x[D>>16&255]<<16^x[j>>8&255]<<8^x[z&255]^A[re],a=x[D>>>24]<<24^x[j>>16&255]<<16^x[z>>8&255]<<8^x[C&255]^A[re+1],T=x[j>>>24]<<24^x[z>>16&255]<<16^x[C>>8&255]<<8^x[D&255]^A[re+2],v=x[z>>>24]<<24^x[C>>16&255]<<16^x[D>>8&255]<<8^x[j&255]^A[re+3],f[E]=ve(s^g),f[E+1]=ve(v^p),f[E+2]=ve(T^w),f[E+3]=ve(a^b),g=V,p=P,w=N,b=$,E=E+4}return f.buffer},K}()},"./src/crypt/decrypter.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return E});var Z=O("./src/crypt/aes-crypto.ts"),U=O("./src/crypt/fast-aes-key.ts"),I=O("./src/crypt/aes-decryptor.ts"),K=O("./src/utils/logger.ts"),B=O("./src/utils/mp4-tools.ts"),M=O("./src/utils/typed-array.ts"),R=16,E=function(){function L(A,x,y){var h=y===void 0?{}:y,o=h.removePKCS7Padding,l=o===void 0?!0:o;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=A,this.config=x,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=L.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var y=new Uint8Array(x);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(x,y,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),y,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),y,h).then(o)},_.softwareDecrypt=function(x,y,h){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(x=Object(B.appendUint8Array)(d,x),this.remainderData=null);var S=this.getValidChunk(x);if(!S.length)return null;o&&(h=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new I.default),g.expandKey(y);var p=l;return this.currentResult=g.decrypt(S.buffer,0,h),this.currentIV=Object(M.sliceUint8)(S,-16).buffer,p||null},_.webCryptoDecrypt=function(x,y,h){var o=this,l=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new U.default(l,y)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var S=new Z.default(l,h);return S.decrypt(x.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,x,y,h)})},_.onWebCryptoError=function(x,y,h,o){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,h,o)},_.getValidChunk=function(x){var y=x,h=x.length-x.length%R;return h!==x.length&&(y=Object(M.sliceUint8)(x,0,h),this.remainderData=Object(M.sliceUint8)(x,h)),y},_.logOnce=function(x){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},L}()},"./src/crypt/fast-aes-key.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return Z});var Z=function(){function U(K,B){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=B}var I=U.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/adts.ts"),I=O("./src/utils/logger.ts"),K=O("./src/demux/id3.ts");function B(E,L){E.prototype=Object.create(L.prototype),E.prototype.constructor=E,M(E,L)}function M(E,L){return M=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},M(E,L)}var R=function(E){B(L,E);function L(A,x){var y;return y=E.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=A,y.config=x,y}var _=L.prototype;return _.resetInitSegment=function(x,y,h){E.prototype.resetInitSegment.call(this,x,y,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:h,inputTimeScale:9e4,dropped:0}},L.probe=function(x){if(!x)return!1;for(var y=K.getID3Data(x,0)||[],h=y.length,o=x.length;h<o;h++)if(U.probe(x,h))return I.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(x,y){return U.canParse(x,y)},_.appendFrame=function(x,y,h){U.initTrackConfig(x,this.observer,y,h,x.manifestCodec);var o=U.appendFrame(x,y,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},L}(Z.default);R.minProbeByteLength=9,Y.default=R},"./src/demux/adts.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"getAudioConfig",function(){return K}),O.d(Y,"isHeaderPattern",function(){return B}),O.d(Y,"getHeaderLength",function(){return M}),O.d(Y,"getFullFrameLength",function(){return R}),O.d(Y,"canGetFrameLength",function(){return E}),O.d(Y,"isHeader",function(){return L}),O.d(Y,"canParse",function(){return _}),O.d(Y,"probe",function(){return A}),O.d(Y,"initTrackConfig",function(){return x}),O.d(Y,"getFrameDuration",function(){return y}),O.d(Y,"parseFrameHeader",function(){return h}),O.d(Y,"appendFrame",function(){return o});var Z=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),I=O("./src/events.ts");function K(l,d,S,g){var p,w,b,u,f=navigator.userAgent.toLowerCase(),s=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((d[S+2]&192)>>>6)+1;var T=(d[S+2]&60)>>>2;if(T>a.length-1){l.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return b=(d[S+2]&1)<<2,b|=(d[S+3]&192)>>>6,Z.logger.log("manifest codec:"+g+", ADTS type:"+p+", samplingIndex:"+T),/firefox/i.test(f)?T>=6?(p=5,u=new Array(4),w=T-3):(p=2,u=new Array(2),w=T):f.indexOf("android")!==-1?(p=2,u=new Array(2),w=T):(p=5,u=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&T>=6?w=T-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(T>=6&&b===1||/vivaldi/i.test(f))||!g&&b===1)&&(p=2,u=new Array(2)),w=T)),u[0]=p<<3,u[0]|=(T&14)>>1,u[1]|=(T&1)<<7,u[1]|=b<<3,p===5&&(u[1]|=(w&14)>>1,u[2]=(w&1)<<7,u[2]|=2<<2,u[3]=0),{config:u,samplerate:a[T],channelCount:b,codec:"mp4a.40."+p,manifestCodec:s}}function B(l,d){return l[d]===255&&(l[d+1]&246)===240}function M(l,d){return l[d+1]&1?7:9}function R(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function E(l,d){return d+5<l.length}function L(l,d){return d+1<l.length&&B(l,d)}function _(l,d){return E(l,d)&&B(l,d)&&R(l,d)<=l.length-d}function A(l,d){if(L(l,d)){var S=M(l,d);if(d+S>=l.length)return!1;var g=R(l,d);if(g<=S)return!1;var p=d+g;return p===l.length||L(l,p)}return!1}function x(l,d,S,g,p){if(!l.samplerate){var w=K(d,S,g,p);if(!w)return;l.config=w.config,l.samplerate=w.samplerate,l.channelCount=w.channelCount,l.codec=w.codec,l.manifestCodec=w.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function y(l){return 1024*9e4/l}function h(l,d,S,g,p){var w=M(l,d),b=R(l,d);if(b-=w,b>0){var u=S+g*p;return{headerLength:w,frameLength:b,stamp:u}}}function o(l,d,S,g,p){var w=y(l.samplerate),b=h(d,S,g,p,w);if(b){var u=b.frameLength,f=b.headerLength,s=b.stamp,a=f+u,T=Math.max(0,S+a-d.length),v;T?(v=new Uint8Array(a-f),v.set(d.subarray(S+f,d.length),0)):v=d.subarray(S+f,S+a);var C={unit:v,pts:s};return T||l.samples.push(C),{sample:C,length:a,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"initPTSFn",function(){return R});var Z=O("./src/polyfills/number.ts"),U=O("./src/demux/id3.ts"),I=O("./src/demux/dummy-demuxed-track.ts"),K=O("./src/utils/mp4-tools.ts"),B=O("./src/utils/typed-array.ts"),M=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var L=E.prototype;return L.resetInitSegment=function(A,x,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},L.resetTimeStamp=function(){},L.resetContiguity=function(){},L.canParse=function(A,x){return!1},L.appendFrame=function(A,x,y){},L.demux=function(A,x){this.cachedData&&(A=Object(K.appendUint8Array)(this.cachedData,A),this.cachedData=null);var y=U.getID3Data(A,0),h=y?y.length:0,o,l,d=this._audioTrack,S=this._id3Track,g=y?U.getTimeStamp(y):void 0,p=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(g,x)),y&&y.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),l=this.initPTS;h<p;){if(this.canParse(A,h)){var w=this.appendFrame(d,A,h);w?(this.frameIndex++,l=w.sample.pts,h+=w.length,o=h):h=p}else U.canParse(A,h)?(y=U.getID3Data(A,h),S.samples.push({pts:l,dts:l,data:y}),h+=y.length,o=h):h++;if(h===p&&o!==p){var b=Object(B.sliceUint8)(A,o);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(I.dummyTrack)(),id3Track:S,textTrack:Object(I.dummyTrack)()}},L.demuxSampleAes=function(A,x,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},L.flush=function(A){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},L.destroy=function(){},E}(),R=function(L,_){return Object(Z.isFiniteNumber)(L)?L*90:_*9e4};Y.default=M},"./src/demux/chunk-cache.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return Z});var Z=function(){function I(){this.chunks=[],this.dataLength=0}var K=I.prototype;return K.push=function(M){this.chunks.push(M),this.dataLength+=M.length},K.flush=function(){var M=this.chunks,R=this.dataLength,E;if(M.length)M.length===1?E=M[0]:E=U(M,R);else return new Uint8Array(0);return this.reset(),E},K.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function U(I,K){for(var B=new Uint8Array(K),M=0,R=0;R<I.length;R++){var E=I[R];B.set(E,M),M+=E.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/utils/logger.ts"),U=function(){function I(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var K=I.prototype;return K.loadWord=function(){var M=this.data,R=this.bytesAvailable,E=M.byteLength-R,L=new Uint8Array(4),_=Math.min(4,R);if(_===0)throw new Error("no bytes available");L.set(M.subarray(E,E+_)),this.word=new DataView(L.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},K.skipBits=function(M){var R;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,R=M>>3,M-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},K.readBits=function(M){var R=Math.min(this.bitsAvailable,M),E=this.word>>>32-R;return M>32&&Z.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=M-R,R>0&&this.bitsAvailable?E<<R|this.readBits(R):E},K.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},K.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(M){for(var R=8,E=8,L,_=0;_<M;_++)E!==0&&(L=this.readEG(),E=(R+L+256)%256),R=E===0?R:E},K.readSPS=function(){var M=0,R=0,E=0,L=0,_,A,x,y=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),S=this.skipEG.bind(this),g=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);y();var w=y();if(h(5),d(3),y(),g(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var b=o();if(b===3&&d(1),g(),g(),d(1),l())for(A=b!==3?8:12,x=0;x<A;x++)l()&&(x<6?p(16):p(64))}g();var u=o();if(u===0)o();else if(u===1)for(d(1),S(),S(),_=o(),x=0;x<_;x++)S();g(),d(1);var f=o(),s=o(),a=h(1);a===0&&d(1),d(1),l()&&(M=o(),R=o(),E=o(),L=o());var T=[1,1];if(l()&&l()){var v=y();switch(v){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((f+1)*16-M*2-R*2),height:(2-a)*(s+1)*16-(a?2:4)*(E+L),pixelRatio:T}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();Y.default=U},"./src/demux/id3.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"isHeader",function(){return Z}),O.d(Y,"isFooter",function(){return U}),O.d(Y,"getID3Data",function(){return I}),O.d(Y,"canParse",function(){return B}),O.d(Y,"getTimeStamp",function(){return M}),O.d(Y,"isTimeStampFrame",function(){return R}),O.d(Y,"getID3Frames",function(){return L}),O.d(Y,"decodeFrame",function(){return _}),O.d(Y,"utf8ArrayToStr",function(){return o}),O.d(Y,"testables",function(){return l});var Z=function(p,w){return w+10<=p.length&&(p[w]===73&&p[w+1]===68&&p[w+2]===51&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},U=function(p,w){return w+10<=p.length&&(p[w]===51&&p[w+1]===68&&p[w+2]===73&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},I=function(p,w){for(var b=w,u=0;Z(p,w);){u+=10;var f=K(p,w+6);u+=f,U(p,w+10)&&(u+=10),w+=u}return u>0?p.subarray(b,b+u):void 0},K=function(p,w){var b=0;return b=(p[w]&127)<<21,b|=(p[w+1]&127)<<14,b|=(p[w+2]&127)<<7,b|=p[w+3]&127,b},B=function(p,w){return Z(p,w)&&K(p,w+6)+10<=p.length-w},M=function(p){for(var w=L(p),b=0;b<w.length;b++){var u=w[b];if(R(u))return h(u)}return},R=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},E=function(p){var w=String.fromCharCode(p[0],p[1],p[2],p[3]),b=K(p,4),u=10;return{type:w,size:b,data:p.subarray(u,u+b)}},L=function(p){for(var w=0,b=[];Z(p,w);){var u=K(p,w+6);w+=10;for(var f=w+u;w+8<f;){var s=E(p.subarray(w)),a=_(s);a&&b.push(a),w+=s.size+10}U(p,w)&&(w+=10)}return b},_=function(p){return p.type==="PRIV"?A(p):p.type[0]==="W"?y(p):x(p)},A=function(p){if(p.size<2)return;var w=o(p.data,!0),b=new Uint8Array(p.data.subarray(w.length+1));return{key:p.type,info:w,data:b.buffer}},x=function(p){if(p.size<2)return;if(p.type==="TXXX"){var w=1,b=o(p.data.subarray(w),!0);w+=b.length+1;var u=o(p.data.subarray(w));return{key:p.type,info:b,data:u}}var f=o(p.data.subarray(1));return{key:p.type,data:f}},y=function(p){if(p.type==="WXXX"){if(p.size<2)return;var w=1,b=o(p.data.subarray(w),!0);w+=b.length+1;var u=o(p.data.subarray(w));return{key:p.type,info:b,data:u}}var f=o(p.data);return{key:p.type,data:f}},h=function(p){if(p.data.byteLength===8){var w=new Uint8Array(p.data),b=w[3]&1,u=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return u/=45,b&&(u+=4772185884e-2),Math.round(u)}return},o=function(p,w){w===void 0&&(w=!1);var b=S();if(b){var u=b.decode(p);if(w){var f=u.indexOf("\0");return f!==-1?u.substring(0,f):u}return u.replace(/\0/g,"")}for(var s=p.length,a,T,v,C="",D=0;D<s;){if(a=p[D++],a===0&&w)return C;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:C+=String.fromCharCode(a);break;case 12:case 13:T=p[D++],C+=String.fromCharCode((a&31)<<6|T&63);break;case 14:T=p[D++],v=p[D++],C+=String.fromCharCode((a&15)<<12|(T&63)<<6|(v&63)<<0);break;default:}}return C},l={decodeTextFrame:x},d;function S(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/id3.ts"),I=O("./src/utils/logger.ts"),K=O("./src/demux/mpegaudio.ts");function B(E,L){E.prototype=Object.create(L.prototype),E.prototype.constructor=E,M(E,L)}function M(E,L){return M=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},M(E,L)}var R=function(E){B(L,E);function L(){return E.apply(this,arguments)||this}var _=L.prototype;return _.resetInitSegment=function(x,y,h){E.prototype.resetInitSegment.call(this,x,y,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:h,inputTimeScale:9e4,dropped:0}},L.probe=function(x){if(!x)return!1;for(var y=U.getID3Data(x,0)||[],h=y.length,o=x.length;h<o;h++)if(K.probe(x,h))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(x,y){return K.canParse(x,y)},_.appendFrame=function(x,y,h){return this.initPTS===null?void 0:K.appendFrame(x,y,h,this.initPTS,this.frameIndex)},L}(Z.default);R.minProbeByteLength=4,Y.default=R},"./src/demux/mp4demuxer.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/utils/mp4-tools.ts"),U=O("./src/demux/dummy-demuxed-track.ts"),I=function(){function K(M,R){this.remainderData=null,this.config=void 0,this.config=R}var B=K.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},K.probe=function(R){return Object(Z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},B.demux=function(R){var E=R,L=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(Z.appendUint8Array)(this.remainderData,R));var _=Object(Z.segmentValidRange)(E);this.remainderData=_.remainder,L.samples=_.valid||new Uint8Array}else L.samples=E;return{audioTrack:Object(U.dummyTrack)(),avcTrack:L,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.flush=function(){var R=Object(U.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:R,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.demuxSampleAes=function(R,E,L){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},K}();I.minProbeByteLength=1024,Y.default=I},"./src/demux/mpegaudio.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"appendFrame",function(){return M}),O.d(Y,"parseHeader",function(){return R}),O.d(Y,"isHeaderPattern",function(){return E}),O.d(Y,"isHeader",function(){return L}),O.d(Y,"canParse",function(){return _}),O.d(Y,"probe",function(){return A});var Z=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function M(x,y,h,o,l){if(h+24>y.length)return;var d=R(y,h);if(d&&h+d.frameLength<=y.length){var S=d.samplesPerFrame*9e4/d.sampleRate,g=o+l*S,p={unit:y.subarray(h,h+d.frameLength),pts:g,dts:g};return x.config=[],x.channelCount=d.channelCount,x.samplerate=d.sampleRate,x.samples.push(p),{sample:p,length:d.frameLength,missing:0}}}function R(x,y){var h=x[y+1]>>3&3,o=x[y+1]>>1&3,l=x[y+2]>>4&15,d=x[y+2]>>2&3;if(h!==1&&l!==0&&l!==15&&d!==3){var S=x[y+2]>>1&1,g=x[y+3]>>6,p=h===3?3-o:o===3?3:4,w=U[p*14+l-1]*1e3,b=h===3?0:h===2?1:2,u=I[b*3+d],f=g===3?1:2,s=K[h][o],a=B[o],T=s*8*a,v=Math.floor(s*w/u+S)*a;if(Z===null){var C=navigator.userAgent||"",D=C.match(/Chrome\/(\d+)/i);Z=D?parseInt(D[1]):0}var j=!!Z&&Z<=87;return j&&o===2&&w>=224e3&&g===0&&(x[y+3]=x[y+3]|128),{sampleRate:u,channelCount:f,frameLength:v,samplesPerFrame:T}}}function E(x,y){return x[y]===255&&(x[y+1]&224)===224&&(x[y+1]&6)!==0}function L(x,y){return y+1<x.length&&E(x,y)}function _(x,y){var h=4;return E(x,y)&&h<=x.length-y}function A(x,y){if(y+1<x.length&&E(x,y)){var h=4,o=R(x,y),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var d=y+l;return d===x.length||L(x,d)}return!1}},"./src/demux/sample-aes.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/crypt/decrypter.ts"),U=O("./src/demux/tsdemuxer.ts"),I=function(){function K(M,R,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new Z.default(M,R,{removePKCS7Padding:!1})}var B=K.prototype;return B.decryptBuffer=function(R,E){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,E)},B.decryptAacSample=function(R,E,L,_){var A=R[E].unit,x=A.subarray(16,A.length-A.length%16),y=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),h=this;this.decryptBuffer(y,function(o){var l=new Uint8Array(o);A.set(l,16),_||h.decryptAacSamples(R,E+1,L)})},B.decryptAacSamples=function(R,E,L){for(;;E++){if(E>=R.length){L();return}if(R[E].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(R,E,L,_),!_)return}},B.getAvcEncryptedData=function(R){for(var E=Math.floor((R.length-48)/160)*16+16,L=new Int8Array(E),_=0,A=32;A<=R.length-16;A+=160,_+=16)L.set(R.subarray(A,A+16),_);return L},B.getAvcDecryptedUnit=function(R,E){for(var L=new Uint8Array(E),_=0,A=32;A<=R.length-16;A+=160,_+=16)R.set(L.subarray(_,_+16),A);return R},B.decryptAvcSample=function(R,E,L,_,A,x){var y=Object(U.discardEPB)(A.data),h=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(h.buffer,function(l){A.data=o.getAvcDecryptedUnit(y,l),x||o.decryptAvcSamples(R,E,L+1,_)})},B.decryptAvcSamples=function(R,E,L,_){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,L=0){if(E>=R.length){_();return}for(var A=R[E].units;!(L>=A.length);L++){var x=A[L];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(R,E,L,_,x,y),!y)return}}},K}();Y.default=I},"./src/demux/transmuxer-interface.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return A});var Z=O("./node_modules/webworkify-webpack/index.js"),U=O.n(Z),I=O("./src/events.ts"),K=O("./src/demux/transmuxer.ts"),B=O("./src/utils/logger.ts"),M=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),E=O("./node_modules/eventemitter3/index.js"),L=O.n(E),_=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function x(h,o,l,d){var S=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var g=h.config,p=function(s,a){a=a||{},a.frag=S.frag,a.id=S.id,h.trigger(s,a)};this.observer=new E.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,p),this.observer.on(I.Events.ERROR,p);var w={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var u;try{u=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),u.addEventListener("message",this.onwmsg),u.onerror=function(f){h.trigger(I.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},u.postMessage({cmd:"init",typeSupported:w,vendor:b,id:o,config:JSON.stringify(g)})}catch(f){B.logger.warn("Error in worker:",f),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),u&&self.URL.revokeObjectURL(u.objectURL),this.transmuxer=new K.default(this.observer,w,g,b,o),this.worker=null}}else this.transmuxer=new K.default(this.observer,w,g,b,o)}var y=x.prototype;return y.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},y.push=function(o,l,d,S,g,p,w,b,u,f){var s=this;u.transmuxing.start=self.performance.now();var a=this.transmuxer,T=this.worker,v=p?p.start:g.start,C=g.decryptdata,D=this.frag,j=!(D&&g.cc===D.cc),z=!(D&&u.level===D.level),V=D?u.sn-D.sn:-1,P=this.part?u.part-this.part.index:1,N=!z&&(V===1||V===0&&P===1),$=self.performance.now();(z||V||g.stats.parsing.start===0)&&(g.stats.parsing.start=$),p&&(P||!N)&&(p.stats.parsing.start=$);var re=new K.TransmuxState(j,N,b,z,v);if(!N||j){B.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+`
discontinuity: `+j+`
trackSwitch: `+z+`
contiguous: `+N+`
accurateTimeOffset: `+b+`
timeOffset: `+v);var pe=new K.TransmuxConfig(d,S,l,w,f);this.configureTransmuxer(pe)}if(this.frag=g,this.part=p,T)T.postMessage({cmd:"demux",data:o,decryptdata:C,chunkMeta:u,state:re},o instanceof ArrayBuffer?[o]:[]);else if(a){var ve=a.push(o,C,u,re);Object(K.isPromise)(ve)?ve.then(function(Ae){s.handleTransmuxComplete(Ae)}):this.handleTransmuxComplete(ve)}},y.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(d){var g=d.flush(o);Object(K.isPromise)(g)?g.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(g,o)}},y.handleFlushResult=function(o,l){var d=this;o.forEach(function(S){d.handleTransmuxComplete(S)}),this.onFlush(l)},y.onWorkerMessage=function(o){var l=o.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},y.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return M});var Z=O("./src/demux/transmuxer.ts"),U=O("./src/events.ts"),I=O("./src/utils/logger.ts"),K=O("./node_modules/eventemitter3/index.js"),B=O.n(K);function M(A){var x=new K.EventEmitter,y=function(o,l){A.postMessage({event:o,data:l})};x.on(U.Events.FRAG_DECRYPTED,y),x.on(U.Events.ERROR,y),A.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);A.transmuxer=new Z.default(x,o.typeSupported,l,o.vendor,o.id),Object(I.enableLogs)(l.debug),y("init",null);break}case"configure":{A.transmuxer.configure(o.config);break}case"demux":{var d=A.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(d)?d.then(function(p){R(A,p)}):R(A,d);break}case"flush":{var S=o.chunkMeta,g=A.transmuxer.flush(S);Object(Z.isPromise)(g)?g.then(function(p){L(A,p,S)}):L(A,g,S);break}default:break}})}function R(A,x){if(_(x.remuxResult))return;var y=[],h=x.remuxResult,o=h.audio,l=h.video;o&&E(y,o),l&&E(y,l),A.postMessage({event:"transmuxComplete",data:x},y)}function E(A,x){x.data1&&A.push(x.data1.buffer),x.data2&&A.push(x.data2.buffer)}function L(A,x,y){x.forEach(function(h){R(A,h)}),A.postMessage({event:"flush",data:y})}function _(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return l}),O.d(Y,"isPromise",function(){return g}),O.d(Y,"TransmuxConfig",function(){return p}),O.d(Y,"TransmuxState",function(){return w});var Z=O("./src/events.ts"),U=O("./src/errors.ts"),I=O("./src/crypt/decrypter.ts"),K=O("./src/demux/aacdemuxer.ts"),B=O("./src/demux/mp4demuxer.ts"),M=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),E=O("./src/remux/mp4-remuxer.ts"),L=O("./src/remux/passthrough-remuxer.ts"),_=O("./src/demux/chunk-cache.ts"),A=O("./src/utils/mp4-tools.ts"),x=O("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(b){x.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var h=[{demux:M.default,remux:E.default},{demux:B.default,remux:L.default},{demux:K.default,remux:E.default},{demux:R.default,remux:E.default}],o=1024;h.forEach(function(b){var u=b.demux;o=Math.max(o,u.minProbeByteLength)});var l=function(){function b(f,s,a,T,v){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=f,this.typeSupported=s,this.config=a,this.vendor=T,this.id=v}var u=b.prototype;return u.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},u.push=function(s,a,T,v){var C=this,D=T.transmuxing;D.executeStart=y();var j=new Uint8Array(s),z=this.cache,V=this.config,P=this.currentTransmuxState,N=this.transmuxConfig;v&&(this.currentTransmuxState=v);var $=d(j,a);if($&&$.method==="AES-128"){var re=this.getDecrypter();if(V.enableSoftwareAES){var pe=re.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!pe)return D.executeEnd=y(),S(T);j=new Uint8Array(pe)}else return this.decryptionPromise=re.webCryptoDecrypt(j,$.key.buffer,$.iv.buffer).then(function(De){var Me=C.push(De,null,T);return C.decryptionPromise=null,Me}),this.decryptionPromise}var ve=v||P,Ae=ve.contiguous,Le=ve.discontinuity,ce=ve.trackSwitch,ae=ve.accurateTimeOffset,de=ve.timeOffset,ne=N.audioCodec,se=N.videoCodec,J=N.defaultInitPts,ee=N.duration,oe=N.initSegmentData;if((Le||ce)&&this.resetInitSegment(oe,ne,se,ee),Le&&this.resetInitialTimestamp(J),Ae||this.resetContiguity(),this.needsProbing(j,Le,ce)){if(z.dataLength){var fe=z.flush();j=Object(A.appendUint8Array)(fe,j)}this.configureTransmuxer(j,N)}var ke=this.transmux(j,$,de,ae,T),ge=this.currentTransmuxState;return ge.contiguous=!0,ge.discontinuity=!1,ge.trackSwitch=!1,D.executeEnd=y(),ke},u.flush=function(s){var a=this,T=s.transmuxing;T.executeStart=y();var v=this.decrypter,C=this.cache,D=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(s)});var z=[],V=D.timeOffset;if(v){var P=v.flush();P&&z.push(this.push(P,null,s))}var N=C.dataLength;C.reset();var $=this.demuxer,re=this.remuxer;if(!$||!re)return N>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=y(),[S(s)];var pe=$.flush(V);return g(pe)?pe.then(function(ve){return a.flushRemux(z,ve,s),z}):(this.flushRemux(z,pe,s),z)},u.flushRemux=function(s,a,T){var v=a.audioTrack,C=a.avcTrack,D=a.id3Track,j=a.textTrack,z=this.currentTransmuxState,V=z.accurateTimeOffset,P=z.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var N=this.remuxer.remux(v,C,D,j,P,V,!0,this.id);s.push({remuxResult:N,chunkMeta:T}),T.transmuxing.executeEnd=y()},u.resetInitialTimestamp=function(s){var a=this.demuxer,T=this.remuxer;if(!a||!T)return;a.resetTimeStamp(s),T.resetTimeStamp(s)},u.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},u.resetInitSegment=function(s,a,T,v){var C=this.demuxer,D=this.remuxer;if(!C||!D)return;C.resetInitSegment(a,T,v),D.resetInitSegment(s,a,T)},u.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},u.transmux=function(s,a,T,v,C){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(s,a,T,v,C):D=this.transmuxUnencrypted(s,T,v,C),D},u.transmuxUnencrypted=function(s,a,T,v){var C=this.demuxer.demux(s,a,!1,!this.config.progressive),D=C.audioTrack,j=C.avcTrack,z=C.id3Track,V=C.textTrack,P=this.remuxer.remux(D,j,z,V,a,T,!1,this.id);return{remuxResult:P,chunkMeta:v}},u.transmuxSampleAes=function(s,a,T,v,C){var D=this;return this.demuxer.demuxSampleAes(s,a,T).then(function(j){var z=D.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,T,v,!1,D.id);return{remuxResult:z,chunkMeta:C}})},u.configureTransmuxer=function(s,a){for(var T=this.config,v=this.observer,C=this.typeSupported,D=this.vendor,j=a.audioCodec,z=a.defaultInitPts,V=a.duration,P=a.initSegmentData,N=a.videoCodec,$,re=0,pe=h.length;re<pe;re++)if(h[re].demux.probe(s)){$=h[re];break}$||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:B.default,remux:L.default});var ve=this.demuxer,Ae=this.remuxer,Le=$.remux,ce=$.demux;(!Ae||!(Ae instanceof Le))&&(this.remuxer=new Le(v,T,C,D)),(!ve||!(ve instanceof ce))&&(this.demuxer=new ce(v,T,C),this.probe=ce.probe),this.resetInitSegment(P,j,N,V),this.resetInitialTimestamp(z)},u.needsProbing=function(s,a,T){return!this.demuxer||!this.remuxer||a||T},u.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new I.default(this.observer,this.config)),s},b}();function d(b,u){var f=null;return b.byteLength>0&&u!=null&&u.key!=null&&u.iv!==null&&u.method!=null&&(f=u),f}var S=function(u){return{remuxResult:{},chunkMeta:u}};function g(b){return"then"in b&&b.then instanceof Function}var p=function(u,f,s,a,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=u,this.videoCodec=f,this.initSegmentData=s,this.duration=a,this.defaultInitPts=T},w=function(u,f,s,a,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=u,this.contiguous=f,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"discardEPB",function(){return S});var Z=O("./src/demux/adts.ts"),U=O("./src/demux/mpegaudio.ts"),I=O("./src/demux/exp-golomb.ts"),K=O("./src/demux/id3.ts"),B=O("./src/demux/sample-aes.ts"),M=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),E=O("./src/utils/logger.ts"),L=O("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},A=function(){function g(w,b,u){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=w,this.config=b,this.typeSupported=u}g.probe=function(b){var u=g.syncOffset(b);return u<0?!1:(u&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+u+", junk ahead ?"),!0)},g.syncOffset=function(b){for(var u=Math.min(1e3,b.length-3*188),f=0;f<u;){if(b[f]===71&&b[f+188]===71&&b[f+2*188]===71)return f;f++}return-1},g.createTrack=function(b,u){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:_[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?u:void 0}};var p=g.prototype;return p.resetInitSegment=function(b,u,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",f),this._audioTrack=g.createTrack("audio",f),this._id3Track=g.createTrack("id3",f),this._txtTrack=g.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=u,this._duration=f},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,u=this._avcTrack,f=this._id3Track;b&&(b.pesData=null),u&&(u.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,u,f,s){f===void 0&&(f=!1),s===void 0&&(s=!1),f||(this.sampleAes=null);var a,T=this._avcTrack,v=this._audioTrack,C=this._id3Track,D=T.pid,j=T.pesData,z=v.pid,V=C.pid,P=v.pesData,N=C.pesData,$=!1,re=this.pmtParsed,pe=this._pmtId,ve=b.length;if(this.remainderData&&(b=Object(R.appendUint8Array)(this.remainderData,b),ve=b.length,this.remainderData=null),ve<188&&!s)return this.remainderData=b,{audioTrack:v,avcTrack:T,id3Track:C,textTrack:this._txtTrack};var Ae=Math.max(0,g.syncOffset(b));ve-=(ve+Ae)%188,ve<b.byteLength&&!s&&(this.remainderData=new Uint8Array(b.buffer,ve,b.buffer.byteLength-ve));for(var Le=Ae;Le<ve;Le+=188)if(b[Le]===71){var ce=!!(b[Le+1]&64),ae=((b[Le+1]&31)<<8)+b[Le+2],de=(b[Le+3]&48)>>4,ne=void 0;if(de>1){if(ne=Le+5+b[Le+4],ne===Le+188)continue}else ne=Le+4;switch(ae){case D:ce&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(b.subarray(ne,Le+188)),j.size+=Le+188-ne);break;case z:ce&&(P&&(a=o(P))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(b.subarray(ne,Le+188)),P.size+=Le+188-ne);break;case V:ce&&(N&&(a=o(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(b.subarray(ne,Le+188)),N.size+=Le+188-ne);break;case 0:ce&&(ne+=b[ne]+1),pe=this._pmtId=y(b,ne);break;case pe:{ce&&(ne+=b[ne]+1);var se=h(b,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);D=se.avc,D>0&&(T.pid=D),z=se.audio,z>0&&(v.pid=z,v.isAAC=se.isAAC),V=se.id3,V>0&&(C.pid=V),$&&!re&&(E.logger.log("reparse from beginning"),$=!1,Le=Ae-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=j,v.pesData=P,C.pesData=N;var J={audioTrack:v,avcTrack:T,id3Track:C,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(J),J},p.flush=function(){var b=this.remainderData;this.remainderData=null;var u;return b?u=this.demux(b,-1,!1,!0):u={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(u),this.sampleAes?this.decrypt(u,this.sampleAes):u},p.extractRemainingSamples=function(b){var u=b.audioTrack,f=b.avcTrack,s=b.id3Track,a=f.pesData,T=u.pesData,v=s.pesData,C;a&&(C=o(a))?(this.parseAVCPES(C,!0),f.pesData=null):f.pesData=a,T&&(C=o(T))?(u.isAAC?this.parseAACPES(C):this.parseMPEGPES(C),u.pesData=null):(T!=null&&T.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),u.pesData=T),v&&(C=o(v))?(this.parseID3PES(C),s.pesData=null):s.pesData=v},p.demuxSampleAes=function(b,u,f){var s=this.demux(b,f,!0,!this.config.progressive),a=this.sampleAes=new B.default(this.observer,this.config,u);return this.decrypt(s,a)},p.decrypt=function(b,u){return new Promise(function(f){var s=b.audioTrack,a=b.avcTrack;s.samples&&s.isAAC?u.decryptAacSamples(s.samples,0,function(){a.samples?u.decryptAvcSamples(a.samples,0,0,function(){f(b)}):f(b)}):a.samples&&u.decryptAvcSamples(a.samples,0,0,function(){f(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,u){var f=this,s=this._avcTrack,a=this.parseAVCNALu(b.data),T=!1,v=this.avcSample,C,D=!1;b.data=null,v&&a.length&&!s.audFound&&(l(v,s),v=this.avcSample=x(!1,b.pts,b.dts,"")),a.forEach(function(j){switch(j.type){case 1:{C=!0,v||(v=f.avcSample=x(!0,b.pts,b.dts,"")),T&&(v.debug+="NDR "),v.frame=!0;var z=j.data;if(D&&z.length>4){var V=new I.default(z).readSliceType();(V===2||V===4||V===7||V===9)&&(v.key=!0)}break}case 5:C=!0,v||(v=f.avcSample=x(!0,b.pts,b.dts,"")),T&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{C=!0,T&&v&&(v.debug+="SEI ");var P=new I.default(S(j.data));P.readUByte();for(var N=0,$=0,re=!1,pe=0;!re&&P.bytesAvailable>1;){N=0;do pe=P.readUByte(),N+=pe;while(pe===255);$=0;do pe=P.readUByte(),$+=pe;while(pe===255);if(N===4&&P.bytesAvailable!==0){re=!0;var ve=P.readUByte();if(ve===181){var Ae=P.readUShort();if(Ae===49){var Le=P.readUInt();if(Le===1195456820){var ce=P.readUByte();if(ce===3){for(var ae=P.readUByte(),de=P.readUByte(),ne=31&ae,se=[ae,de],J=0;J<ne;J++)se.push(P.readUByte()),se.push(P.readUByte()),se.push(P.readUByte());d(f._txtTrack.samples,{type:3,pts:b.pts,bytes:se})}}}}}else if(N===5&&P.bytesAvailable!==0){if(re=!0,$>16){for(var ee=[],oe=0;oe<16;oe++)ee.push(P.readUByte().toString(16)),(oe===3||oe===5||oe===7||oe===9)&&ee.push("-");for(var fe=$-16,ke=new Uint8Array(fe),ge=0;ge<fe;ge++)ke[ge]=P.readUByte();d(f._txtTrack.samples,{pts:b.pts,payloadType:N,uuid:ee.join(""),userData:Object(K.utf8ArrayToStr)(ke),userDataBytes:ke})}}else if($<P.bytesAvailable)for(var De=0;De<$;De++)P.readUByte()}break}case 7:if(C=!0,D=!0,T&&v&&(v.debug+="SPS "),!s.sps){var Me=new I.default(j.data),Ue=Me.readSPS();s.width=Ue.width,s.height=Ue.height,s.pixelRatio=Ue.pixelRatio,s.sps=[j.data],s.duration=f._duration;for(var Ke=j.data.subarray(1,4),He="avc1.",Be=0;Be<3;Be++){var rt=Ke[Be].toString(16);rt.length<2&&(rt="0"+rt),He+=rt}s.codec=He}break;case 8:C=!0,T&&v&&(v.debug+="PPS "),s.pps||(s.pps=[j.data]);break;case 9:C=!1,s.audFound=!0,v&&l(v,s),v=f.avcSample=x(!1,b.pts,b.dts,T?"AUD ":"");break;case 12:C=!1;break;default:C=!1,v&&(v.debug+="unknown NAL "+j.type+" ");break}if(v&&C){var Oe=v.units;Oe.push(j)}}),u&&v&&(l(v,s),this.avcSample=null)},p.getLastNalUnit=function(){var b,u=this.avcSample,f;if(!u||u.units.length===0){var s=this._avcTrack.samples;u=s[s.length-1]}if((b=u)!==null&&b!==void 0&&b.units){var a=u.units;f=a[a.length-1]}return f},p.parseAVCNALu=function(b){var u=b.byteLength,f=this._avcTrack,s=f.naluState||0,a=s,T=[],v=0,C,D,j,z=-1,V=0;for(s===-1&&(z=0,V=b[0]&31,s=0,v=1);v<u;){if(C=b[v++],!s){s=C?0:1;continue}if(s===1){s=C?0:2;continue}if(!C)s=3;else if(C===1){if(z>=0){var P={data:b.subarray(z,v-s-1),type:V};T.push(P)}else{var N=this.getLastNalUnit();if(N&&(a&&v<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),D=v-s-1,D>0)){var $=new Uint8Array(N.data.byteLength+D);$.set(N.data,0),$.set(b.subarray(0,D),N.data.byteLength),N.data=$,N.state=0}}v<u?(j=b[v]&31,z=v,V=j,s=0):s=-1}else s=0}if(z>=0&&s>=0){var re={data:b.subarray(z,u),type:V,state:s};T.push(re)}if(T.length===0){var pe=this.getLastNalUnit();if(pe){var ve=new Uint8Array(pe.data.byteLength+b.byteLength);ve.set(pe.data,0),ve.set(b,pe.data.byteLength),pe.data=ve}}return f.naluState=s,T},p.parseAACPES=function(b){var u=0,f=this._audioTrack,s=this.aacOverFlow,a=b.data;if(s){this.aacOverFlow=null;var T=s.sample.unit.byteLength,v=Math.min(s.missing,T),C=T-v;s.sample.unit.set(a.subarray(0,v),C),f.samples.push(s.sample),u=s.missing}var D,j;for(D=u,j=a.length;D<j-1&&!Z.isHeader(a,D);D++);if(D!==u){var z,V;if(D<j-1?(z="AAC PES did not start with ADTS header,offset:"+D,V=!1):(z="no ADTS header found in AAC PES",V=!0),E.logger.warn("parsing error:"+z),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:z}),V)return}Z.initTrackConfig(f,this.observer,a,D,this.audioCodec);var P;if(b.pts!==void 0)P=b.pts;else if(s){var N=Z.getFrameDuration(f.samplerate);P=s.sample.pts+N}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;D<j;)if(Z.isHeader(a,D)){if(D+5<j){var re=Z.appendFrame(f,a,D,P,$);if(re)if(re.missing)this.aacOverFlow=re;else{D+=re.length,$++;continue}}break}else D++},p.parseMPEGPES=function(b){var u=b.data,f=u.length,s=0,a=0,T=b.pts;if(T===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(U.isHeader(u,a)){var v=U.appendFrame(this._audioTrack,u,a,T,s);if(v)a+=v.length,s++;else break}else a++},p.parseID3PES=function(b){if(b.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},g}();A.minProbeByteLength=188;function x(g,p,w,b){return{key:g,frame:!1,pts:p,dts:w,units:[],debug:b,length:0}}function y(g,p){return(g[p+10]&31)<<8|g[p+11]}function h(g,p,w,b){var u={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(g[p+1]&15)<<8|g[p+2],s=p+3+f-4,a=(g[p+10]&15)<<8|g[p+11];for(p+=12+a;p<s;){var T=(g[p+1]&31)<<8|g[p+2];switch(g[p]){case 207:if(!b){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:u.audio===-1&&(u.audio=T);break;case 21:u.id3===-1&&(u.id3=T);break;case 219:if(!b){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:u.avc===-1&&(u.avc=T);break;case 3:case 4:w?u.audio===-1&&(u.audio=T,u.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((g[p+3]&15)<<8|g[p+4])+5}return u}function o(g){var p=0,w,b,u,f,s,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var T=new Uint8Array(a[0].length+a[1].length);T.set(a[0]),T.set(a[1],a[0].length),a[0]=T,a.splice(1,1)}w=a[0];var v=(w[0]<<16)+(w[1]<<8)+w[2];if(v===1){if(b=(w[4]<<8)+w[5],b&&b>g.size-6)return null;var C=w[7];C&192&&(f=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,C&64?(s=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,f-s>60*9e4&&(E.logger.warn(Math.round((f-s)/9e4)+"s delta between PTS and DTS, align them"),f=s)):s=f),u=w[8];var D=u+9;if(g.size<=D)return null;g.size-=D;for(var j=new Uint8Array(g.size),z=0,V=a.length;z<V;z++){w=a[z];var P=w.byteLength;if(D)if(D>P){D-=P;continue}else w=w.subarray(D),P-=D,D=0;j.set(w,p),p+=P}return b&&(b-=u+3),{data:j,pts:f,dts:s,len:b}}return null}function l(g,p){if(g.units.length&&g.frame){if(g.pts===void 0){var w=p.samples,b=w.length;if(b){var u=w[b-1];g.pts=u.pts,g.dts=u.dts}else{p.dropped++;return}}p.samples.push(g)}g.debug.length&&E.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function d(g,p){var w=g.length;if(w>0){if(p.pts>=g[w-1].pts)g.push(p);else for(var b=w-1;b>=0;b--)if(p.pts<g[b].pts){g.splice(b,0,p);break}}else g.push(p)}function S(g){for(var p=g.byteLength,w=[],b=1;b<p-2;)g[b]===0&&g[b+1]===0&&g[b+2]===3?(w.push(b+2),b+=2):b++;if(w.length===0)return g;var u=p-w.length,f=new Uint8Array(u),s=0;for(b=0;b<u;s++,b++)s===w[0]&&(s++,w.shift()),f[b]=g[s];return f}Y.default=A},"./src/errors.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"ErrorTypes",function(){return Z}),O.d(Y,"ErrorDetails",function(){return U});var Z;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(Z||(Z={}));var U;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"Events",function(){return Z});var Z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return g});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Z),I=O("./src/loader/playlist-loader.ts"),K=O("./src/loader/key-loader.ts"),B=O("./src/controller/id3-track-controller.ts"),M=O("./src/controller/latency-controller.ts"),R=O("./src/controller/level-controller.ts"),E=O("./src/controller/fragment-tracker.ts"),L=O("./src/controller/stream-controller.ts"),_=O("./src/is-supported.ts"),A=O("./src/utils/logger.ts"),x=O("./src/config.ts"),y=O("./node_modules/eventemitter3/index.js"),h=O.n(y),o=O("./src/events.ts"),l=O("./src/errors.ts");function d(p,w){for(var b=0;b<w.length;b++){var u=w[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function S(p,w,b){return w&&d(p.prototype,w),b&&d(p,b),p}var g=function(){p.isSupported=function(){return Object(_.isSupported)()};function p(b){b===void 0&&(b={}),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 u=this.config=Object(x.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(A.enableLogs)(u.debug),this._autoLevelCapping=-1,u.progressive&&Object(x.enableStreamingMode)(u);var f=u.abrController,s=u.bufferController,a=u.capLevelController,T=u.fpsController,v=this.abrController=new f(this),C=this.bufferController=new s(this),D=this.capLevelController=new a(this),j=new T(this),z=new I.default(this),V=new K.default(this),P=new B.default(this),N=this.levelController=new R.default(this),$=new E.FragmentTracker(this),re=this.streamController=new L.default(this,$);D.setStreamController(re),j.setStreamController(re);var pe=[N,re];this.networkControllers=pe;var ve=[z,V,v,C,D,j,P,$];this.audioTrackController=this.createController(u.audioTrackController,null,pe),this.createController(u.audioStreamController,$,pe),this.subtitleTrackController=this.createController(u.subtitleTrackController,null,pe),this.createController(u.subtitleStreamController,$,pe),this.createController(u.timelineController,null,ve),this.emeController=this.createController(u.emeController,null,ve),this.cmcdController=this.createController(u.cmcdController,null,ve),this.latencyController=this.createController(M.default,null,ve),this.coreComponents=ve}var w=p.prototype;return w.createController=function(u,f,s){if(u){var a=f?new u(this,f):new u(this);return s&&s.push(a),a}return null},w.on=function(u,f,s){s===void 0&&(s=this),this._emitter.on(u,f,s)},w.once=function(u,f,s){s===void 0&&(s=this),this._emitter.once(u,f,s)},w.removeAllListeners=function(u){this._emitter.removeAllListeners(u)},w.off=function(u,f,s,a){s===void 0&&(s=this),this._emitter.off(u,f,s,a)},w.listeners=function(u){return this._emitter.listeners(u)},w.emit=function(u,f,s){return this._emitter.emit(u,f,s)},w.trigger=function(u,f){if(this.config.debug)return this.emit(u,u,f);try{return this.emit(u,u,f)}catch(s){A.logger.error("An internal error happened while handling event "+u+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:u,error:s})}return!1},w.listenerCount=function(u){return this._emitter.listenerCount(u)},w.destroy=function(){A.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(u){return u.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(u){return u.destroy()}),this.coreComponents.length=0},w.attachMedia=function(u){A.logger.log("attachMedia"),this._media=u,this.trigger(o.Events.MEDIA_ATTACHING,{media:u})},w.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(u){this.stopLoad();var f=this.media,s=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,u,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),f&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:u})},w.startLoad=function(u){u===void 0&&(u=-1),A.logger.log("startLoad("+u+")"),this.networkControllers.forEach(function(f){f.startLoad(u)})},w.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(u){u.stopLoad()})},w.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){A.logger.log("recoverMediaError");var u=this._media;this.detachMedia(),u&&this.attachMedia(u)},w.removeLevel=function(u,f){f===void 0&&(f=0),this.levelController.removeLevel(u,f)},S(p,[{key:"levels",get:function(){var u=this.levelController.levels;return u||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(u){A.logger.log("set currentLevel:"+u),this.loadLevel=u,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(u){A.logger.log("set nextLevel:"+u),this.levelController.manualLevel=u,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(u){A.logger.log("set loadLevel:"+u),this.levelController.manualLevel=u}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(u){this.levelController.nextLoadLevel=u}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(u){A.logger.log("set firstLevel:"+u),this.levelController.firstLevel=u}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(u){A.logger.log("set startLevel:"+u),u!==-1&&(u=Math.max(u,this.minAutoLevel)),this.levelController.startLevel=u}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(u){var f=!!u;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(u){this._autoLevelCapping!==u&&(A.logger.log("set autoLevelCapping:"+u),this._autoLevelCapping=u)}},{key:"bandwidthEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var u=this.levels,f=this.config.minAutoBitrate;if(!u)return 0;for(var s=u.length,a=0;a<s;a++)if(u[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var u=this.levels,f=this.autoLevelCapping,s;return f===-1&&u&&u.length?s=u.length-1:s=f,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(u){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,u)}},{key:"audioTracks",get:function(){var u=this.audioTrackController;return u?u.audioTracks:[]}},{key:"audioTrack",get:function(){var u=this.audioTrackController;return u?u.audioTrack:-1},set:function(u){var f=this.audioTrackController;f&&(f.audioTrack=u)}},{key:"subtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTrack:-1},set:function(u){var f=this.subtitleTrackController;f&&(f.subtitleTrack=u)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var u=this.subtitleTrackController;return u?u.subtitleDisplay:!1},set:function(u){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=u)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(u){this.config.lowLatencyMode=u}},{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 o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:x.hlsDefaultConfig},set:function(u){p.defaultConfig=u}}]),p}();g.defaultConfig=void 0},"./src/is-supported.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"isSupported",function(){return I}),O.d(Y,"changeTypeSupported",function(){return K});var Z=O("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var B=Object(Z.getMediaSource)();if(!B)return!1;var M=U(),R=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!R&&!!E}function K(){var B,M=U();return typeof(M==null||((B=M.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return A}),O.d(Y,"LoadError",function(){return y});var Z=O("./src/polyfills/number.ts"),U=O("./src/errors.ts");function I(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,E(h,o)}function K(h){var o=typeof Map=="function"?new Map:void 0;return K=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,S)}function S(){return B(d,arguments,L(this).constructor)}return S.prototype=Object.create(d.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),E(S,d)},K(h)}function B(h,o,l){return M()?B=Reflect.construct:B=function(S,g,p){var w=[null];w.push.apply(w,g);var b=Function.bind.apply(S,w),u=new b;return p&&E(u,p.prototype),u},B.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function R(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function E(h,o){return E=Object.setPrototypeOf||function(d,S){return d.__proto__=S,d},E(h,o)}function L(h){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},L(h)}var _=Math.pow(2,17),A=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,S){var g=this,p=d.url;if(!p)return Promise.reject(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var w=this.config,b=w.fLoader,u=w.loader;return new Promise(function(f,s){g.loader&&g.loader.destroy();var a=g.loader=d.loader=b?new b(w):new u(w),T=x(d),v={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:_};d.stats=a.stats,a.load(T,v,{onSuccess:function(D,j,z,V){g.resetLoader(d,a),f({frag:d,part:null,payload:D.data,networkDetails:V})},onError:function(D,j,z){g.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:D,networkDetails:z}))},onAbort:function(D,j,z){g.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:z}))},onTimeout:function(D,j,z){g.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:z}))},onProgress:function(D,j,z,V){S&&S({frag:d,part:null,payload:z,networkDetails:V})}})})},o.loadPart=function(d,S,g){var p=this;this.abort();var w=this.config,b=w.fLoader,u=w.loader;return new Promise(function(f,s){p.loader&&p.loader.destroy();var a=p.loader=d.loader=b?new b(w):new u(w),T=x(d,S),v={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:_};S.stats=a.stats,a.load(T,v,{onSuccess:function(D,j,z,V){p.resetLoader(d,a),p.updateStatsFromPart(d,S);var P={frag:d,part:S,payload:D.data,networkDetails:V};g(P),f(P)},onError:function(D,j,z){p.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:S,response:D,networkDetails:z}))},onAbort:function(D,j,z){d.stats.aborted=S.stats.aborted,p.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:S,networkDetails:z}))},onTimeout:function(D,j,z){p.resetLoader(d,a),s(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:S,networkDetails:z}))}})})},o.updateStatsFromPart=function(d,S){var g=d.stats,p=S.stats,w=p.total;if(g.loaded+=p.loaded,w){var b=Math.round(d.duration/S.duration),u=Math.min(Math.round(g.loaded/w),b),f=b-u,s=f*Math.round(g.loaded/u);g.total=g.loaded+s}else g.total=Math.max(g.loaded,g.total);var a=g.loading,T=p.loading;a.start?a.first+=T.first-T.start:(a.start=T.start,a.first=T.first),a.end=T.end},o.resetLoader=function(d,S){d.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},h}();function x(h,o){o===void 0&&(o=null);var l=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},S=l.byteRangeStartOffset,g=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(S)&&Object(Z.isFiniteNumber)(g)&&(d.rangeStart=S,d.rangeEnd=g),d}var y=function(h){I(o,h);function o(l){for(var d,S=arguments.length,g=new Array(S>1?S-1:0),p=1;p<S;p++)g[p-1]=arguments[p];return d=h.call.apply(h,[this].concat(g))||this,d.data=void 0,d.data=l,d}return o}(K(Error))},"./src/loader/fragment.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"ElementaryStreamTypes",function(){return A}),O.d(Y,"BaseSegment",function(){return x}),O.d(Y,"Fragment",function(){return y}),O.d(Y,"Part",function(){return h});var Z=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(U),K=O("./src/utils/logger.ts"),B=O("./src/loader/level-key.ts"),M=O("./src/loader/load-stats.ts");function R(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,E(o,l)}function E(o,l){return E=Object.setPrototypeOf||function(S,g){return S.__proto__=g,S},E(o,l)}function L(o,l){for(var d=0;d<l.length;d++){var S=l[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function _(o,l,d){return l&&L(o.prototype,l),d&&L(o,d),o}var A;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(A||(A={}));var x=function(){function o(d){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[A.AUDIO]=null,S[A.VIDEO]=null,S[A.AUDIOVIDEO]=null,S),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(S,g){var p=S.split("@",2),w=[];p.length===1?w[0]=g?g.byteRangeEndOffset:0:w[0]=parseInt(p[1]),w[1]=parseInt(p[0])+w[0],this._byteRange=w},_(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),y=function(o){R(l,o);function l(S,g){var p;return p=o.call(this,g)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new M.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=S,p}var d=l.prototype;return d.createInitializationVector=function(g){for(var p=new Uint8Array(16),w=12;w<16;w++)p[w]=g>>8*(15-w)&255;return p},d.setDecryptDataFromLevelKey=function(g,p){var w=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(w=B.LevelKey.fromURI(g.uri),w.method=g.method,w.iv=this.createInitializationVector(p),w.keyFormat="identity"),w},d.setElementaryStreamInfo=function(g,p,w,b,u,f){f===void 0&&(f=!1);var s=this.elementaryStreams,a=s[g];if(!a){s[g]={startPTS:p,endPTS:w,startDTS:b,endDTS:u,partial:f};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,u)},d.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[A.AUDIO]=null,g[A.VIDEO]=null,g[A.AUDIOVIDEO]=null},_(l,[{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&&K.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(Z.isFiniteNumber)(this.programDateTime))return null;var g=Object(Z.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)}}]),l}(x),h=function(o){R(l,o);function l(d,S,g,p,w){var b;b=o.call(this,g)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new M.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=S,b.index=p;var u=d.enumeratedString("BYTERANGE");return u&&b.setByteRange(u,w),w&&(b.fragOffset=w.fragOffset+w.duration),b}return _(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),l}(x)},"./src/loader/key-loader.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return K});var Z=O("./src/events.ts"),U=O("./src/errors.ts"),I=O("./src/utils/logger.ts"),K=function(){function B(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var M=B.prototype;return M._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var L=this.loaders[E];L&&L.destroy()}this.loaders={}},M.onKeyLoading=function(E,L){var _=L.frag,A=_.type,x=this.loaders[A];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 h=this.hls.config;if(x&&(I.logger.warn("abort previous key loader for type:"+A),x.abort()),!y){I.logger.warn("key uri is falsy");return}var o=h.loader,l=_.loader=this.loaders[A]=new o(h);this.decrypturl=y,this.decryptkey=null;var d={url:y,frag:_,responseType:"arraybuffer"},S={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,S,g)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:_}))},M.loadsuccess=function(E,L,_){var A=_.frag;if(!A.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(E.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:A})},M.loaderror=function(E,L){var _=L.frag,A=_.loader;A&&A.abort(),delete this.loaders[_.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:E})},M.loadtimeout=function(E,L){var _=L.frag,A=_.loader;A&&A.abort(),delete this.loaders[_.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},B}()},"./src/loader/level-details.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"LevelDetails",function(){return B});var Z=O("./src/polyfills/number.ts");function U(M,R){for(var E=0;E<R.length;E++){var L=R[E];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(M,L.key,L)}}function I(M,R,E){return R&&U(M.prototype,R),E&&U(M,E),M}var K=10,B=function(){function M(E){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=E}var R=M.prototype;return R.reloaded=function(L){if(!L){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-L.lastPartSn,A=this.lastPartIndex-L.lastPartIndex;this.updated=this.endSN!==L.endSN||!!A||!!_,this.advanced=this.endSN>L.endSN||_>0||_===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(L.misses*.6):this.misses=L.misses+1,this.availabilityDelay=L.availabilityDelay},I(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var L=this.driftEndTime-this.driftStartTime;if(L>0){var _=this.driftEnd-this.driftStart;return _*1e3/L}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var L;return(L=this.fragments)!==null&&L!==void 0&&L.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 L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"LevelKey",function(){return B});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Z);function I(M,R){for(var E=0;E<R.length;E++){var L=R[E];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(M,L.key,L)}}function K(M,R,E){return R&&I(M.prototype,R),E&&I(M,E),M}var B=function(){M.fromURL=function(E,L){return new M(E,L)},M.fromURI=function(E){return new M(E)};function M(R,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(Z.buildAbsoluteURL)(R,E,{alwaysNormalize:!0}):this._uri=R}return K(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"LoadStats",function(){return Z});var Z=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(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return l});var Z=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(U),K=O("./src/loader/fragment.ts"),B=O("./src/loader/level-details.ts"),M=O("./src/loader/level-key.ts"),R=O("./src/utils/attr-list.ts"),E=O("./src/utils/logger.ts"),L=O("./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,A=/#EXT-X-MEDIA:(.*)/g,x=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("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var b,u;return h.test((b=(u=U.parseURL(w))===null||u===void 0?void 0:u.path)!=null?b:"")}var l=function(){function w(){}return w.findGroup=function(u,f){for(var s=0;s<u.length;s++){var a=u[s];if(a.id===f)return a}},w.convertAVC1ToAVCOTI=function(u){var f=u.split(".");if(f.length>2){var s=f.shift()+".";return s+=parseInt(f.shift()).toString(16),s+=("000"+parseInt(f.shift()).toString(16)).substr(-4),s}return u},w.resolve=function(u,f){return U.buildAbsoluteURL(f,u,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(u,f){var s=[],a={},T=!1;_.lastIndex=0;for(var v;(v=_.exec(u))!=null;)if(v[1]){var C=new R.AttrList(v[1]),D={attrs:C,bitrate:C.decimalInteger("AVERAGE-BANDWIDTH")||C.decimalInteger("BANDWIDTH"),name:C.NAME,url:w.resolve(v[2],f)},j=C.decimalResolution("RESOLUTION");j&&(D.width=j.width,D.height=j.height),d((C.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=w.convertAVC1ToAVCOTI(D.videoCodec)),s.push(D)}else if(v[3]){var z=new R.AttrList(v[3]);z["DATA-ID"]&&(T=!0,a[z["DATA-ID"]]=z)}return{levels:s,sessionData:T?a:null}},w.parseMasterPlaylistMedia=function(u,f,s,a){a===void 0&&(a=[]);var T,v=[],C=0;for(A.lastIndex=0;(T=A.exec(u))!==null;){var D=new R.AttrList(T[1]);if(D.TYPE===s){var j={attrs:D,bitrate:0,id:C++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:s,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?w.resolve(D.URI,f):""};if(a.length){var z=w.findGroup(a,j.groupId)||a[0];S(j,z,"audioCodec"),S(j,z,"textCodec")}v.push(j)}}return v},w.parseLevelPlaylist=function(u,f,s,a,T){var v=new B.LevelDetails(f),C=v.fragments,D=null,j=0,z=0,V=0,P=0,N=null,$=new K.Fragment(a,f),re,pe,ve,Ae=-1,Le=!1;for(x.lastIndex=0,v.m3u8=u;(re=x.exec(u))!==null;){Le&&(Le=!1,$=new K.Fragment(a,f),$.start=V,$.sn=j,$.cc=P,$.level=s,D&&($.initSegment=D,$.rawProgramDateTime=D.rawProgramDateTime));var ce=re[1];if(ce){$.duration=parseFloat(ce);var ae=(" "+re[2]).slice(1);$.title=ae||null,$.tagList.push(ae?["INF",ce,ae]:["INF",ce])}else if(re[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,ve&&($.levelkey=ve),$.sn=j,$.level=s,$.cc=P,$.urlId=T,C.push($),$.relurl=(" "+re[3]).slice(1),p($,N),N=$,V+=$.duration,j++,z=0,Le=!0);else if(re[4]){var de=(" "+re[4]).slice(1);N?$.setByteRange(de,N):$.setByteRange(de)}else if(re[5])$.rawProgramDateTime=(" "+re[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Ae===-1&&(Ae=C.length);else{if(re=re[0].match(y),!re){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<re.length&&!(typeof re[pe]!="undefined");pe++);var ne=(" "+re[pe]).slice(1),se=(" "+re[pe+1]).slice(1),J=re[pe+2]?(" "+re[pe+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":v.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":j=v.startSN=parseInt(se);break;case"SKIP":{var ee=new R.AttrList(se),oe=ee.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(oe)){v.skippedSegments=oe;for(var fe=oe;fe--;)C.unshift(null);j+=oe}var ke=ee.enumeratedString("RECENTLY-REMOVED-DATERANGES");ke&&(v.recentlyRemovedDateranges=ke.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(se);break;case"VERSION":v.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(se||J)&&$.tagList.push(J?[se,J]:[se]);break;case"DIS":P++;case"GAP":$.tagList.push([ne]);break;case"BITRATE":$.tagList.push([ne,se]);break;case"DISCONTINUITY-SEQ":P=parseInt(se);break;case"KEY":{var ge,De=new R.AttrList(se),Me=De.enumeratedString("METHOD"),Ue=De.URI,Ke=De.hexadecimalInteger("IV"),He=De.enumeratedString("KEYFORMATVERSIONS"),Be=De.enumeratedString("KEYID"),rt=(ge=De.enumeratedString("KEYFORMAT"))!=null?ge:"identity",Oe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Oe.indexOf(rt)>-1){E.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;Me&&(ve=M.LevelKey.fromURL(f,Ue),Ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(ve.method=Me,ve.keyFormat=rt,Be&&(ve.keyID=Be),He&&(ve.keyFormatVersions=He),ve.iv=Ke));break}case"START":{var Fe=new R.AttrList(se),je=Fe.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(je)&&(v.startTimeOffset=je);break}case"MAP":{var Ge=new R.AttrList(se);$.relurl=Ge.URI,Ge.BYTERANGE&&$.setByteRange(Ge.BYTERANGE),$.level=s,$.sn="initSegment",ve&&($.levelkey=ve),$.initSegment=null,D=$,Le=!0;break}case"SERVER-CONTROL":{var Ve=new R.AttrList(se);v.canBlockReload=Ve.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Ve.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Ve.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Ve.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Ve.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ze=new R.AttrList(se);v.partTarget=ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=v.partList;Re||(Re=v.partList=[]);var Qe=z>0?Re[Re.length-1]:void 0,Ye=z++,Pe=new K.Part(new R.AttrList(se),$,f,Ye,Qe);Re.push(Pe),$.duration+=Pe.duration;break}case"PRELOAD-HINT":{var We=new R.AttrList(se);v.preloadHint=We;break}case"RENDITION-REPORT":{var Se=new R.AttrList(se);v.renditionReports=v.renditionReports||[],v.renditionReports.push(Se);break}default:E.logger.warn("line parsed but not handled: "+re);break}}}N&&!N.relurl?(C.pop(),V-=N.duration,v.partList&&(v.fragmentHint=N)):v.partList&&(p($,N),$.cc=P,v.fragmentHint=$);var ye=C.length,xe=C[0],le=C[ye-1];if(V+=v.skippedSegments*v.targetduration,V>0&&ye&&le){v.averagetargetduration=V/ye;var ue=le.sn;v.endSN=ue!=="initSegment"?ue:0,xe&&(v.startCC=xe.cc,xe.initSegment||v.fragments.every(function(me){return me.relurl&&o(me.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new K.Fragment(a,f),$.relurl=le.relurl,$.level=s,$.sn="initSegment",xe.initSegment=$,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(V+=v.fragmentHint.duration),v.totalduration=V,v.endCC=P,Ae>0&&g(C,Ae),v},w}();function d(w,b){["video","audio","text"].forEach(function(u){var f=w.filter(function(a){return Object(L.isCodecType)(a,u)});if(f.length){var s=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[u+"Codec"]=s.length>0?s[0]:f[0],w=w.filter(function(a){return f.indexOf(a)===-1})}}),b.unknownCodecs=w}function S(w,b,u){var f=b[u];f&&(w[u]=f)}function g(w,b){for(var u=w[b],f=b;f--;){var s=w[f];if(!s)return;s.programDateTime=u.programDateTime-s.duration*1e3,u=s}}function p(w,b){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):b!=null&&b.programDateTime&&(w.programDateTime=b.endProgramDateTime),Object(Z.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),I=O("./src/errors.ts"),K=O("./src/utils/logger.ts"),B=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),E=O("./src/utils/attr-list.ts");function L(x){var y=x.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 _(x,y){var h=x.url;return(h===void 0||h.indexOf("data:")===0)&&(h=y.url),h}var A=function(){function x(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var y=x.prototype;return y.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,S=l.loader,g=d||S,p=new g(l);return o.loader=p,this.loaders[o.type]=p,p},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},y.onLevelLoading=function(o,l){var d=l.id,S=l.level,g=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:null,level:S,responseType:"text",type:R.PlaylistContextType.LEVEL,url:g,deliveryDirectives:p})},y.onAudioTrackLoading=function(o,l){var d=l.id,S=l.groupId,g=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:p})},y.onSubtitleTrackLoading=function(o,l){var d=l.id,S=l.groupId,g=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:p})},y.load=function(o){var l,d=this.hls.config,S=this.getInternalLoader(o);if(S){var g=S.context;if(g&&g.url===o.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var p,w,b,u;switch(o.type){case R.PlaylistContextType.MANIFEST:p=d.manifestLoadingMaxRetry,w=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,u=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:p=0,w=d.levelLoadingTimeOut;break;default:p=d.levelLoadingMaxRetry,w=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,u=d.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var f;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var s=f.partTarget,a=f.targetduration;s&&a&&(w=Math.min(Math.max(s*3,a*.8)*1e3,w))}}var T={timeout:w,maxRetry:p,retryDelay:b,maxRetryDelay:u,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,T,v)},y.loadsuccess=function(o,l,d,S){if(S===void 0&&(S=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,S);return}this.resetInternalLoader(d.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",S);return}l.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,S):this.handleMasterPlaylist(o,l,d,S)},y.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},y.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},y.handleMasterPlaylist=function(o,l,d,S){var g=this.hls,p=o.data,w=_(o,d),b=M.default.parseMasterPlaylist(p,w),u=b.levels,f=b.sessionData;if(!u.length){this.handleManifestParsingError(o,d,"no level found in manifest",S);return}var s=u.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=u.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),T=M.default.parseMasterPlaylistMedia(p,w,"AUDIO",s),v=M.default.parseMasterPlaylistMedia(p,w,"SUBTITLES",a),C=M.default.parseMasterPlaylistMedia(p,w,"CLOSED-CAPTIONS");if(T.length){var D=T.some(function(j){return!j.url});!D&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}g.trigger(U.Events.MANIFEST_LOADED,{levels:u,audioTracks:T,subtitles:v,captions:C,url:w,stats:l,networkDetails:S,sessionData:f})},y.handleTrackOrLevelPlaylist=function(o,l,d,S){var g=this.hls,p=d.id,w=d.level,b=d.type,u=_(o,d),f=Object(Z.isFiniteNumber)(p)?p:0,s=Object(Z.isFiniteNumber)(w)?w:f,a=L(d),T=M.default.parseLevelPlaylist(o.data,u,s,a,f);if(!T.fragments.length){g.trigger(U.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===R.PlaylistContextType.MANIFEST){var v={attrs:new E.AttrList({}),bitrate:0,details:T,name:"",url:u};g.trigger(U.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:u,stats:l,networkDetails:S,sessionData:null})}if(l.parsing.end=performance.now(),T.needSidxRanges){var C,D=(C=T.fragments[0].initSegment)===null||C===void 0?void 0:C.url;this.load({url:D,isSidxRequest:!0,type:b,level:w,levelDetails:T,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=T,this.handlePlaylistLoaded(o,l,d,S)},y.handleSidxRequest=function(o,l){var d=Object(B.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var S=d.references,g=l.levelDetails;S.forEach(function(p,w){var b=p.info,u=g.fragments[w];u.byteRange.length===0&&u.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),u.initSegment&&u.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,l,d,S){this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:S})},y.handleNetworkError=function(o,l,d,S){d===void 0&&(d=!1),K.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=I.ErrorDetails.UNKNOWN,p=!1,w=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:g=d?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case R.PlaylistContextType.LEVEL:g=d?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.AUDIO_TRACK:g=d?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:g=d?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}w&&this.resetInternalLoader(o.type);var b={type:I.ErrorTypes.NETWORK_ERROR,details:g,fatal:p,url:o.url,loader:w,context:o,networkDetails:l};S&&(b.response=S),this.hls.trigger(U.Events.ERROR,b)},y.handlePlaylistLoaded=function(o,l,d,S){var g=d.type,p=d.level,w=d.id,b=d.groupId,u=d.loader,f=d.levelDetails,s=d.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",S);return}if(!u)return;f.live&&(u.getCacheAge&&(f.ageHeader=u.getCacheAge()||0),(!u.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(g){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:f,level:p||0,id:w||0,stats:l,networkDetails:S,deliveryDirectives:s});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:l,networkDetails:S,deliveryDirectives:s});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:l,networkDetails:S,deliveryDirectives:s});break}},x}();Y.default=A},"./src/polyfills/number.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"isFiniteNumber",function(){return Z}),O.d(Y,"MAX_SAFE_INTEGER",function(){return U});var Z=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,Y,O){"use strict";O.r(Y);var Z=function(){function U(){}return U.getSilentFrame=function(K,B){switch(K){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();Y.default=Z},"./src/remux/mp4-generator.ts":function(he,Y,O){"use strict";O.r(Y);var Z=Math.pow(2,32)-1,U=function(){function I(){}return I.init=function(){I.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var B;for(B in I.types)I.types.hasOwnProperty(B)&&(I.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var M=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:M,audio:R};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=L,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]),A=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,_,x,_,A),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,E))},I.box=function(B){for(var M=8,R=arguments.length,E=new Array(R>1?R-1:0),L=1;L<R;L++)E[L-1]=arguments[L];for(var _=E.length,A=_;_--;)M+=E[_].byteLength;var x=new Uint8Array(M);for(x[0]=M>>24&255,x[1]=M>>16&255,x[2]=M>>8&255,x[3]=M&255,x.set(B,4),_=0,M=8;_<A;_++)x.set(E[_],M),M+=E[_].byteLength;return x},I.hdlr=function(B){return I.box(I.types.hdlr,I.HDLR_TYPES[B])},I.mdat=function(B){return I.box(I.types.mdat,B)},I.mdhd=function(B,M){M*=B;var R=Math.floor(M/(Z+1)),E=Math.floor(M%(Z+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,B>>24&255,B>>16&255,B>>8&255,B&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},I.mdia=function(B){return I.box(I.types.mdia,I.mdhd(B.timescale,B.duration),I.hdlr(B.type),I.minf(B))},I.mfhd=function(B){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},I.minf=function(B){return B.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(B)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(B))},I.moof=function(B,M,R){return I.box(I.types.moof,I.mfhd(B),I.traf(R,M))},I.moov=function(B){for(var M=B.length,R=[];M--;)R[M]=I.trak(B[M]);return I.box.apply(null,[I.types.moov,I.mvhd(B[0].timescale,B[0].duration)].concat(R).concat(I.mvex(B)))},I.mvex=function(B){for(var M=B.length,R=[];M--;)R[M]=I.trex(B[M]);return I.box.apply(null,[I.types.mvex].concat(R))},I.mvhd=function(B,M){M*=B;var R=Math.floor(M/(Z+1)),E=Math.floor(M%(Z+1)),L=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&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,L)},I.sdtp=function(B){var M=B.samples||[],R=new Uint8Array(4+M.length),E,L;for(E=0;E<M.length;E++)L=M[E].flags,R[E+4]=L.dependsOn<<4|L.isDependedOn<<2|L.hasRedundancy;return I.box(I.types.sdtp,R)},I.stbl=function(B){return I.box(I.types.stbl,I.stsd(B),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(B){var M=[],R=[],E,L,_;for(E=0;E<B.sps.length;E++)L=B.sps[E],_=L.byteLength,M.push(_>>>8&255),M.push(_&255),M=M.concat(Array.prototype.slice.call(L));for(E=0;E<B.pps.length;E++)L=B.pps[E],_=L.byteLength,R.push(_>>>8&255),R.push(_&255),R=R.concat(Array.prototype.slice.call(L));var A=I.box(I.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|B.sps.length].concat(M).concat([B.pps.length]).concat(R))),x=B.width,y=B.height,h=B.pixelRatio[0],o=B.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,x>>8&255,x&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]),A,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},I.esds=function(B){var M=B.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(B.config).concat([6,1,2]))},I.mp4a=function(B){var M=B.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,B.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),I.box(I.types.esds,I.esds(B)))},I.mp3=function(B){var M=B.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,B.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},I.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(B)):I.box(I.types.stsd,I.STSD,I.mp4a(B)):I.box(I.types.stsd,I.STSD,I.avc1(B))},I.tkhd=function(B){var M=B.id,R=B.duration*B.timescale,E=B.width,L=B.height,_=Math.floor(R/(Z+1)),A=Math.floor(R%(Z+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,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,A>>24,A>>16&255,A>>8&255,A&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,E>>8&255,E&255,0,0,L>>8&255,L&255,0,0]))},I.traf=function(B,M){var R=I.sdtp(B),E=B.id,L=Math.floor(M/(Z+1)),_=Math.floor(M%(Z+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,L>>24,L>>16&255,L>>8&255,L&255,_>>24,_>>16&255,_>>8&255,_&255])),I.trun(B,R.length+16+20+8+16+8+8),R)},I.trak=function(B){return B.duration=B.duration||4294967295,I.box(I.types.trak,I.tkhd(B),I.mdia(B))},I.trex=function(B){var M=B.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(B,M){var R=B.samples||[],E=R.length,L=12+16*E,_=new Uint8Array(L),A,x,y,h,o,l;for(M+=8+L,_.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),A=0;A<E;A++)x=R[A],y=x.duration,h=x.size,o=x.flags,l=x.cts,_.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*A);return I.box(I.types.trun,_)},I.initSegment=function(B){I.types||I.init();var M=I.moov(B),R=new Uint8Array(I.FTYP.byteLength+M.byteLength);return R.set(I.FTYP),R.set(M,I.FTYP.byteLength),R},I}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,Y.default=U},"./src/remux/mp4-remuxer.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return l}),O.d(Y,"normalizePts",function(){return d});var Z=O("./src/polyfills/number.ts"),U=O("./src/remux/aac-helper.ts"),I=O("./src/remux/mp4-generator.ts"),K=O("./src/events.ts"),B=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),E=O("./src/utils/timescale-conversion.ts");function L(){return L=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var u=arguments[b];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(w[f]=u[f])}return w},L.apply(this,arguments)}var _=10*1e3,A=1024,x=1152,y=null,h=null,o=!1,l=function(){function w(u,f,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=u,this.config=f,this.typeSupported=s,this.ISGenerated=!1,y===null){var T=navigator.userAgent||"",v=T.match(/Chrome\/(\d+)/i);y=v?parseInt(v[1]):0}if(h===null){var C=navigator.userAgent.match(/Safari\/(\d+)/i);h=C?parseInt(C[1]):0}o=!!y&&y<75||!!h&&h<600}var b=w.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},b.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(f){var s=!1,a=f.reduce(function(T,v){var C=v.pts-T;return C<-4294967296?(s=!0,d(T,v.pts)):C>0?T:v.pts},f[0].pts);return s&&M.logger.debug("PTS rollover detected"),a},b.remux=function(f,s,a,T,v,C,D,j){var z,V,P,N,$,re,pe=v,ve=v,Ae=f.pid>-1,Le=s.pid>-1,ce=s.samples.length,ae=f.samples.length>0,de=ce>1,ne=(!Ae||ae)&&(!Le||de)||this.ISGenerated||D;if(ne){this.ISGenerated||(P=this.generateIS(f,s,v));var se=this.isVideoContiguous,J=-1;if(de&&(J=S(s.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(re=!0,J>0){M.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+ce+" video samples due to a missing keyframe");var ee=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(J),s.dropped+=J,ve+=(s.samples[0].pts-ee)/(s.timescale||9e4)}else J===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+ce+" video samples"),re=!1);if(this.ISGenerated){if(ae&&de){var oe=this.getVideoStartPts(s.samples),fe=d(f.samples[0].pts,oe)-oe,ke=fe/s.inputTimeScale;pe+=Math.max(0,ke),ve+=Math.max(0,-ke)}if(ae){if(f.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(f,s,v)),V=this.remuxAudio(f,pe,this.isAudioContiguous,C,Le||de||j===R.PlaylistLevelType.AUDIO?ve:void 0),de){var ge=V?V.endPTS-V.startPTS:0;s.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(f,s,v)),z=this.remuxVideo(s,ve,se,ge)}}else de&&(z=this.remuxVideo(s,ve,se,0));z&&(z.firstKeyFrame=J,z.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,v)),T.samples.length&&(N=this.remuxText(T,v))),{audio:V,video:z,initSegment:P,independent:re,text:N,id3:$}},b.generateIS=function(f,s,a){var T=f.samples,v=s.samples,C=this.typeSupported,D={},j=!Object(Z.isFiniteNumber)(this._initPTS),z="audio/mp4",V,P,N;if(j&&(V=P=Infinity),f.config&&T.length&&(f.timescale=f.samplerate,f.isAAC||(C.mpeg?(z="audio/mpeg",f.codec=""):C.mp3&&(f.codec="mp3")),D.audio={id:"audio",container:z,codec:f.codec,initSegment:!f.isAAC&&C.mpeg?new Uint8Array(0):I.default.initSegment([f]),metadata:{channelCount:f.channelCount}},j&&(N=f.inputTimeScale,V=P=T[0].pts-Math.round(N*a))),s.sps&&s.pps&&v.length&&(s.timescale=s.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:I.default.initSegment([s]),metadata:{width:s.width,height:s.height}},j)){N=s.inputTimeScale;var $=this.getVideoStartPts(v),re=Math.round(N*a);P=Math.min(P,d(v[0].dts,$)-re),V=Math.min(V,$-re)}if(Object.keys(D).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=P),{tracks:D,initPTS:V,timescale:N}},b.remuxVideo=function(f,s,a,T){var v=f.inputTimeScale,C=f.samples,D=[],j=C.length,z=this._initPTS,V=this.nextAvcDts,P=8,N,$,re,pe=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Ae=0,Le=!1;if(!a||V===null){var ce=s*v,ae=C[0].pts-d(C[0].dts,C[0].pts);V=ce-ae}for(var de=0;de<j;de++){var ne=C[de];if(ne.pts=d(ne.pts-z,V),ne.dts=d(ne.dts-z,V),ne.dts>ne.pts){var se=9e4*.2;Ae=Math.max(Math.min(Ae,ne.pts-ne.dts),-1*se)}ne.dts<C[de>0?de-1:de].dts&&(Le=!0)}Le&&C.sort(function(xt,Ct){var st=xt.dts-Ct.dts,Mt=xt.pts-Ct.pts;return st||Mt}),$=C[0].dts,re=C[C.length-1].dts;var J=Math.round((re-$)/(j-1));if(Ae<0){if(Ae<J*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ee=Ae,oe=0;oe<j;oe++)C[oe].dts=ee=Math.max(ee,C[oe].pts-J),C[oe].pts=Math.max(ee,C[oe].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Ae,!0)+" ms to overcome this issue");for(var fe=0;fe<j;fe++)C[fe].dts=C[fe].dts+Ae}$=C[0].dts}if(a){var ke=$-V,ge=ke>J,De=ke<-1;if(ge||De){ge?M.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),$=V;var Me=C[0].pts-ke;C[0].dts=$,C[0].pts=Me,M.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Me,!0)+"/"+Object(E.toMsFromMpegTsClock)($,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(ke,!0)+" ms")}}o&&($=Math.max(0,$));for(var Ue=0,Ke=0,He=0;He<j;He++){for(var Be=C[He],rt=Be.units,Oe=rt.length,Fe=0,je=0;je<Oe;je++)Fe+=rt[je].data.length;Ke+=Fe,Ue+=Oe,Be.length=Fe,Be.dts=Math.max(Be.dts,$),Be.pts=Math.max(Be.pts,Be.dts,0),pe=Math.min(Be.pts,pe),ve=Math.max(Be.pts,ve)}re=C[j-1].dts;var Ge=Ke+4*Ue+8,Ve;try{Ve=new Uint8Array(Ge)}catch(xt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ge,reason:"fail allocating video mdat "+Ge});return}var ze=new DataView(Ve.buffer);ze.setUint32(0,Ge),Ve.set(I.default.types.mdat,4);for(var Re=0;Re<j;Re++){for(var Qe=C[Re],Ye=Qe.units,Pe=0,We=0,Se=Ye.length;We<Se;We++){var ye=Ye[We],xe=ye.data,le=ye.data.byteLength;ze.setUint32(P,le),P+=4,Ve.set(xe,P),P+=le,Pe+=4+le}if(Re<j-1)N=C[Re+1].dts-Qe.dts;else{var ue=this.config,me=Qe.dts-C[Re>0?Re-1:Re].dts;if(ue.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ee=Math.floor(ue.maxBufferHole*v),we=(T?pe+T*v:this.nextAudioPts)-Qe.pts;we>Ee?(N=we-me,N<0&&(N=me),M.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=me}else N=me}var Ie=Math.round(Qe.pts-Qe.dts);D.push(new g(Qe.key,N,Pe,Ie))}if(D.length&&y&&y<70){var $e=D[0].flags;$e.dependsOn=2,$e.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=re+N,this.isVideoContiguous=!0;var at=I.default.moof(f.sequenceNumber++,$,L({},f,{samples:D})),ht="video",ut={data1:at,data2:Ve,startPTS:pe/v,endPTS:(ve+N)/v,startDTS:$/v,endDTS:V/v,type:ht,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Ve.length,"MDAT length must not be zero"),ut},b.remuxAudio=function(f,s,a,T,v){var C=f.inputTimeScale,D=f.samplerate?f.samplerate:C,j=C/D,z=f.isAAC?A:x,V=z*j,P=this._initPTS,N=!f.isAAC&&this.typeSupported.mpeg,$=[],re=f.samples,pe=N?0:8,ve=this.nextAudioPts||-1,Ae=s*C;if(this.isAudioContiguous=a=a||re.length&&ve>0&&(T&&Math.abs(Ae-ve)<9e3||Math.abs(d(re[0].pts-P,Ae)-ve)<20*V),re.forEach(function(xe){xe.pts=d(xe.pts-P,Ae)}),!a||ve<0){if(re=re.filter(function(xe){return xe.pts>=0}),!re.length)return;v===0?ve=0:T?ve=Math.max(0,Ae):ve=re[0].pts}if(f.isAAC)for(var Le=v!==void 0,ce=this.config.maxAudioFramesDrift,ae=0,de=ve;ae<re.length;ae++){var ne=re[ae],se=ne.pts,J=se-de,ee=Math.abs(1e3*J/C);if(J<=-ce*V&&Le)ae===0&&(M.logger.warn("Audio frame @ "+(se/C).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/C)+" ms."),this.nextAudioPts=ve=de=se);else if(J>=ce*V&&ee<_&&Le){var oe=Math.round(J/V);de=se-oe*V,de<0&&(oe--,de+=V),ae===0&&(this.nextAudioPts=ve=de),M.logger.warn("[mp4-remuxer]: Injecting "+oe+" audio frame @ "+(de/C).toFixed(3)+"s due to "+Math.round(1e3*J/C)+" ms gap.");for(var fe=0;fe<oe;fe++){var ke=Math.max(de,0),ge=U.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);ge||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=ne.unit.subarray()),re.splice(ae,0,{unit:ge,pts:ke}),de+=V,ae++}}ne.pts=de,de+=V}for(var De=null,Me=null,Ue,Ke=0,He=re.length;He--;)Ke+=re[He].unit.byteLength;for(var Be=0,rt=re.length;Be<rt;Be++){var Oe=re[Be],Fe=Oe.unit,je=Oe.pts;if(Me!==null){var Ge=$[Be-1];Ge.duration=Math.round((je-Me)/j)}else if(a&&f.isAAC&&(je=ve),De=je,Ke>0){Ke+=pe;try{Ue=new Uint8Array(Ke)}catch(xe){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ke,reason:"fail allocating audio mdat "+Ke});return}if(!N){var Ve=new DataView(Ue.buffer);Ve.setUint32(0,Ke),Ue.set(I.default.types.mdat,4)}}else return;Ue.set(Fe,pe);var ze=Fe.byteLength;pe+=ze,$.push(new g(!0,z,ze,0)),Me=je}var Re=$.length;if(!Re)return;var Qe=$[$.length-1];this.nextAudioPts=ve=Me+j*Qe.duration;var Ye=N?new Uint8Array(0):I.default.moof(f.sequenceNumber++,De/j,L({},f,{samples:$}));f.samples=[];var Pe=De/C,We=ve/C,Se="audio",ye={data1:Ye,data2:Ue,startPTS:Pe,endPTS:We,startDTS:Pe,endDTS:We,type:Se,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(Ue.length,"MDAT length must not be zero"),ye},b.remuxEmptyAudio=function(f,s,a,T){var v=f.inputTimeScale,C=f.samplerate?f.samplerate:v,D=v/C,j=this.nextAudioPts,z=(j!==null?j:T.startDTS*v)+this._initDTS,V=T.endDTS*v+this._initDTS,P=D*A,N=Math.ceil((V-z)/P),$=U.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var re=[],pe=0;pe<N;pe++){var ve=z+pe*P;re.push({unit:$,pts:ve,dts:ve})}return f.samples=re,this.remuxAudio(f,s,a,!1)},b.remuxID3=function(f,s){var a=f.samples.length;if(!a)return;for(var T=f.inputTimeScale,v=this._initPTS,C=this._initDTS,D=0;D<a;D++){var j=f.samples[D];j.pts=d(j.pts-v,s*T)/T,j.dts=d(j.dts-C,s*T)/T}var z=f.samples;return f.samples=[],{samples:z}},b.remuxText=function(f,s){var a=f.samples.length;if(!a)return;for(var T=f.inputTimeScale,v=this._initPTS,C=0;C<a;C++){var D=f.samples[C];D.pts=d(D.pts-v,s*T)/T}f.samples.sort(function(z,V){return z.pts-V.pts});var j=f.samples;return f.samples=[],{samples:j}},w}();function d(w,b){var u;if(b===null)return w;for(b<w?u=-8589934592:u=8589934592;Math.abs(w-b)>4294967296;)w+=u;return w}function S(w){for(var b=0;b<w.length;b++)if(w[b].key)return b;return-1}var g=function(b,u,f,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=u,this.size=f,this.cts=s,this.flags=new p(b)},p=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/mp4-tools.ts"),I=O("./src/loader/fragment.ts"),K=O("./src/utils/logger.ts"),B=function(){function E(){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 L=E.prototype;return L.destroy=function(){},L.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},L.resetNextTimestamp=function(){this.lastEndDTS=null},L.resetInitSegment=function(A,x,y){this.audioCodec=x,this.videoCodec=y,this.generateInitSegment(A),this.emitInitSegment=!0},L.generateInitSegment=function(A){var x=this.audioCodec,y=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(A);x||(x=R(h.audio,I.ElementaryStreamTypes.AUDIO)),y||(y=R(h.video,I.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:x+","+y,initSegment:A,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:x,initSegment:A,id:"audio"}:h.video?o.video={container:"video/mp4",codec:y,initSegment:A,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},L.remux=function(A,x,y,h,o){var l=this.initPTS,d=this.lastEndDTS,S={audio:void 0,video:void 0,text:h,id3:y,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var g=x.samples;if(!g||!g.length)return S;var p={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(g),w=this.initData),!w||!w.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=M(w,g,d));var b=Object(U.getDuration)(g,w),u=d,f=b+u;Object(U.offsetStartDTS)(w,g,l),b>0?this.lastEndDTS=f:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!w.audio,a=!!w.video,T="";s&&(T+="audio"),a&&(T+="video");var v={data1:g,startPTS:u,startDTS:u,endPTS:f,endDTS:f,type:T,hasAudio:s,hasVideo:a,nb:1,dropped:0};return S.audio=v.type==="audio"?v:void 0,S.video=v.type!=="audio"?v:void 0,S.text=h,S.id3=y,S.initSegment=p,S},E}(),M=function(L,_,A){return Object(U.getStartDTS)(L,_)-A};function R(E,L){var _=E==null?void 0:E.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||L===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=B},"./src/task-loop.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return Z});var Z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=U.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},U}()},"./src/types/cmcd.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"CMCDVersion",function(){return Z}),O.d(Y,"CMCDObjectType",function(){return U}),O.d(Y,"CMCDStreamingFormat",function(){return I}),O.d(Y,"CMCDStreamType",function(){return K});var Z=1,U;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(U||(U={}));var I;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(I||(I={}));var K;(function(B){B.VOD="v",B.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"HlsSkip",function(){return I}),O.d(Y,"getSkipValue",function(){return K}),O.d(Y,"HlsUrlParameters",function(){return B}),O.d(Y,"Level",function(){return M});function Z(R,E){for(var L=0;L<E.length;L++){var _=E[L];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function U(R,E,L){return E&&Z(R.prototype,E),L&&Z(R,L),R}var I;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(I||(I={}));function K(R,E){var L=R.canSkipUntil,_=R.canSkipDateRanges,A=R.endSN,x=E!==void 0?E-A:0;return L&&x<L?_?I.v2:I.Yes:I.No}var B=function(){function R(L,_,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=L,this.part=_,this.skip=A}var E=R.prototype;return E.addDirectives=function(_){var A=new self.URL(_);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},R}(),M=function(){function R(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(L){return L}).join(",").replace(/\.[^.,]+/g,"")}return U(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(L){var _=L%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),R}()},"./src/types/loader.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"PlaylistContextType",function(){return Z}),O.d(Y,"PlaylistLevelType",function(){return U});var Z;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var U;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"ChunkMetadata",function(){return Z});var Z=function(K,B,M,R,E,L){R===void 0&&(R=0),E===void 0&&(E=-1),L===void 0&&(L=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=K,this.sn=B,this.id=M,this.size=R,this.part=E,this.partial=L};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"AttrList",function(){return I});var Z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function K(M){typeof M=="string"&&(M=K.parseAttrList(M));for(var R in M)M.hasOwnProperty(R)&&(this[R]=M[R])}var B=K.prototype;return B.decimalInteger=function(R){var E=parseInt(this[R],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},B.hexadecimalInteger=function(R){if(this[R]){var E=(this[R]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var L=new Uint8Array(E.length/2),_=0;_<E.length/2;_++)L[_]=parseInt(E.slice(_*2,_*2+2),16);return L}else return null},B.hexadecimalIntegerAsNumber=function(R){var E=parseInt(this[R],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},B.decimalFloatingPoint=function(R){return parseFloat(this[R])},B.optionalFloat=function(R,E){var L=this[R];return L?parseFloat(L):E},B.enumeratedString=function(R){return this[R]},B.bool=function(R){return this[R]==="YES"},B.decimalResolution=function(R){var E=Z.exec(this[R]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},K.parseAttrList=function(R){var E,L={},_='"';for(U.lastIndex=0;(E=U.exec(R))!==null;){var A=E[2];A.indexOf(_)===0&&A.lastIndexOf(_)===A.length-1&&(A=A.slice(1,-1)),L[E[1]]=A}return L},K}()},"./src/utils/binary-search.ts":function(he,Y,O){"use strict";O.r(Y);var Z={search:function(I,K){for(var B=0,M=I.length-1,R=null,E=null;B<=M;){R=(B+M)/2|0,E=I[R];var L=K(E);if(L>0)B=R+1;else if(L<0)M=R-1;else return E}return null}};Y.default=Z},"./src/utils/buffer-helper.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"BufferHelper",function(){return I});var Z=O("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function K(){}return K.isBuffered=function(M,R){try{if(M){for(var E=K.getBuffered(M),L=0;L<E.length;L++)if(R>=E.start(L)&&R<=E.end(L))return!0}}catch(_){}return!1},K.bufferInfo=function(M,R,E){try{if(M){var L=K.getBuffered(M),_=[],A;for(A=0;A<L.length;A++)_.push({start:L.start(A),end:L.end(A)});return this.bufferedInfo(_,R,E)}}catch(x){}return{len:0,start:R,end:R,nextStart:void 0}},K.bufferedInfo=function(M,R,E){R=Math.max(0,R),M.sort(function(p,w){var b=p.start-w.start;return b||w.end-p.end});var L=[];if(E)for(var _=0;_<M.length;_++){var A=L.length;if(A){var x=L[A-1].end;M[_].start-x<E?M[_].end>x&&(L[A-1].end=M[_].end):L.push(M[_])}else L.push(M[_])}else L=M;for(var y=0,h,o=R,l=R,d=0;d<L.length;d++){var S=L[d].start,g=L[d].end;if(R+E>=S&&R<g)o=S,l=g,y=l-R;else if(R+E<S){h=S;break}}return{len:y,start:o||0,end:l||0,nextStart:h}},K.getBuffered=function(M){try{return M.buffered}catch(R){return Z.logger.log("failed to get media.buffered",R),U}},K}()},"./src/utils/cea-608-parser.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"Row",function(){return l}),O.d(Y,"CaptionScreen",function(){return d});var Z=O("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},I=function(f){var s=f;return U.hasOwnProperty(f)&&(s=U[f]),String.fromCharCode(s)},K=15,B=100,M={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},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},L={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(u){u[u.ERROR=0]="ERROR",u[u.TEXT=1]="TEXT",u[u.WARNING=2]="WARNING",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u[u.DATA=3]="DATA"})(A||(A={}));var x=function(){function u(){this.time=null,this.verboseLevel=A.ERROR}var f=u.prototype;return f.log=function(a,T){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+T)},u}(),y=function(f){for(var s=[],a=0;a<f.length;a++)s.push(f[a].toString(16));return s},h=function(){function u(s,a,T,v,C){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=T||!1,this.background=v||"black",this.flash=C||!1}var f=u.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var T=["foreground","underline","italics","background","flash"],v=0;v<T.length;v++){var C=T[v];a.hasOwnProperty(C)&&(this[C]=a[C])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},u}(),o=function(){function u(s,a,T,v,C,D){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new h(a,T,v,C,D)}var f=u.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,T){this.uchar=a,this.penState.copy(T)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},u}(),l=function(){function u(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<B;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new h}var f=u.prototype;return f.equals=function(a){for(var T=!0,v=0;v<B;v++)if(!this.chars[v].equals(a.chars[v])){T=!1;break}return T},f.copy=function(a){for(var T=0;T<B;T++)this.chars[T].copy(a.chars[T])},f.isEmpty=function(){for(var a=!0,T=0;T<B;T++)if(!this.chars[T].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},f.moveCursor=function(a){var T=this.pos+a;if(a>1)for(var v=this.pos+1;v<T+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(T)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var T=I(a);if(this.pos>=B){this.logger.log(A.ERROR,"Cannot insert "+a.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var T;for(T=a;T<B;T++)this.chars[T].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],T=!0,v=0;v<B;v++){var C=this.chars[v].uchar;C!==" "&&(T=!1),a.push(C)}return T?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var T=this.chars[this.pos];T.setPenState(this.currPenState)},u}(),d=function(){function u(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<K;a++)this.rows.push(new l(s));this.logger=s,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=u.prototype;return f.reset=function(){for(var a=0;a<K;a++)this.rows[a].clear();this.currRow=K-1},f.equals=function(a){for(var T=!0,v=0;v<K;v++)if(!this.rows[v].equals(a.rows[v])){T=!1;break}return T},f.copy=function(a){for(var T=0;T<K;T++)this.rows[T].copy(a.rows[T])},f.isEmpty=function(){for(var a=!0,T=0;T<K;T++)if(!this.rows[T].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var T=this.rows[this.currRow];T.insertChar(a)},f.setPen=function(a){var T=this.rows[this.currRow];T.setPenStyles(a)},f.moveCursor=function(a){var T=this.rows[this.currRow];T.moveCursor(a)},f.setCursor=function(a){this.logger.log(A.INFO,"setCursor: "+a);var T=this.rows[this.currRow];T.setCursor(a)},f.setPAC=function(a){this.logger.log(A.INFO,"pacData = "+JSON.stringify(a));var T=a.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var v=0;v<K;v++)this.rows[v].clear();var C=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var j=D.rows[C].cueStartTime,z=this.logger.time;if(j&&z!==null&&j<z)for(var V=0;V<this.nrRollUpRows;V++)this.rows[T-this.nrRollUpRows+V+1].copy(D.rows[C+V])}}this.currRow=T;var P=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,$=Math.max(N-1,0);P.setCursor(a.indent),a.color=P.chars[$].penState.foreground}var re={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(re)},f.setBkgData=function(a){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(a,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(A.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var T=[],v="",C=-1,D=0;D<K;D++){var j=this.rows[D].getTextString();j&&(C=D+1,a?T.push("Row "+C+": '"+j+"'"):T.push(j.trim()))}return T.length>0&&(a?v="["+T.join(" | ")+"]":v=T.join(`
`)),v},f.getTextAndFormat=function(){return this.rows},u}(),S=function(){function u(s,a,T){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(T),this.nonDisplayedMemory=new d(T),this.lastOutputScreen=new d(T),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var f=u.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(A.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},f.insertChars=function(a){for(var T=0;T<a.length;T++)this.writeScreen.insertChar(a[T]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(A.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(A.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(A.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(A.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var T={flash:!1};if(T.underline=a%2===1,T.italics=a>=46,T.italics)T.foreground="white";else{var v=Math.floor(a/2)-16,C=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=C[v]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},u}(),g=function(){function u(s,a,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new x;this.channels=[null,new S(s,a,v),new S(s+1,T,v)],this.cmdHistory=b(),this.logger=v}var f=u.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,T){this.channels[a].setHandler(T)},f.addData=function(a,T){var v,C,D,j=!1;this.logger.time=a;for(var z=0;z<T.length;z+=2){if(C=T[z]&127,D=T[z+1]&127,C===0&&D===0)continue;if(this.logger.log(A.DATA,"["+y([T[z],T[z+1]])+"] -> ("+y([C,D])+")"),v=this.parseCmd(C,D),v||(v=this.parseMidrow(C,D)),v||(v=this.parsePAC(C,D)),v||(v=this.parseBackgroundAttributes(C,D)),!v&&(j=this.parseChars(C,D),j)){var V=this.currentChannel;if(V&&V>0){var P=this.channels[V];P.insertChars(j)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!j&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+y([C,D])+" orig: "+y([T[z],T[z+1]]))}},f.parseCmd=function(a,T){var v=this.cmdHistory,C=(a===20||a===28||a===21||a===29)&&T>=32&&T<=47,D=(a===23||a===31)&&T>=33&&T<=35;if(!(C||D))return!1;if(w(a,T,v))return p(null,null,v),this.logger.log(A.DEBUG,"Repeated command ("+y([a,T])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,z=this.channels[j];return a===20||a===21||a===28||a===29?T===32?z.ccRCL():T===33?z.ccBS():T===34?z.ccAOF():T===35?z.ccAON():T===36?z.ccDER():T===37?z.ccRU(2):T===38?z.ccRU(3):T===39?z.ccRU(4):T===40?z.ccFON():T===41?z.ccRDC():T===42?z.ccTR():T===43?z.ccRTD():T===44?z.ccEDM():T===45?z.ccCR():T===46?z.ccENM():T===47&&z.ccEOC():z.ccTO(T-32),p(a,T,v),this.currentChannel=j,!0},f.parseMidrow=function(a,T){var v=0;if((a===17||a===25)&&T>=32&&T<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var C=this.channels[v];return C?(C.ccMIDROW(T),this.logger.log(A.DEBUG,"MIDROW ("+y([a,T])+")"),!0):!1}return!1},f.parsePAC=function(a,T){var v,C=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&T>=64&&T<=127,j=(a===16||a===24)&&T>=64&&T<=95;if(!(D||j))return!1;if(w(a,T,C))return p(null,null,C),!0;var z=a<=23?1:2;T>=64&&T<=95?v=z===1?M[a]:E[a]:v=z===1?R[a]:L[a];var V=this.channels[z];return V?(V.setPAC(this.interpretPAC(v,T)),p(a,T,C),this.currentChannel=z,!0):!1},f.interpretPAC=function(a,T){var v,C={color:null,italics:!1,indent:null,underline:!1,row:a};return T>95?v=T-96:v=T-64,C.underline=(v&1)===1,v<=13?C.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(C.italics=!0,C.color="white"):C.indent=Math.floor((v-16)/2)*4,C},f.parseChars=function(a,T){var v,C=null,D=null;if(a>=25?(v=2,D=a-8):(v=1,D=a),D>=17&&D<=19){var j;D===17?j=T+80:D===18?j=T+112:j=T+144,this.logger.log(A.INFO,"Special char '"+I(j)+"' in channel "+v),C=[j]}else a>=32&&a<=127&&(C=T===0?[a]:[a,T]);if(C){var z=y(C);this.logger.log(A.DEBUG,"Char codes = "+z.join(",")),p(a,T,this.cmdHistory)}return C},f.parseBackgroundAttributes=function(a,T){var v=(a===16||a===24)&&T>=32&&T<=47,C=(a===23||a===31)&&T>=45&&T<=47;if(!(v||C))return!1;var D,j={};a===16||a===24?(D=Math.floor((T-32)/2),j.background=_[D],T%2===1&&(j.background=j.background+"_semi")):T===45?j.background="transparent":(j.foreground="black",T===47&&(j.underline=!0));var z=a<=23?1:2,V=this.channels[z];return V.setBkgData(j),p(a,T,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var T=this.channels[a];T&&T.reset()}this.cmdHistory=b()},f.cueSplitAtTime=function(a){for(var T=0;T<this.channels.length;T++){var v=this.channels[T];v&&v.cueSplitAtTime(a)}},u}();function p(u,f,s){s.a=u,s.b=f}function w(u,f,s){return s.a===u&&s.b===f}function b(){return{a:null,b:null}}Y.default=g},"./src/utils/codecs.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"isCodecType",function(){return U}),O.d(Y,"isCodecSupportedInMp4",function(){return I});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(K,B){var M=Z[B];return!!M&&M[K.slice(0,4)]===!0}function I(K,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/utils/vttparser.ts"),U=O("./src/utils/webvtt-parser.ts"),I=O("./src/utils/texttrack-utils.ts"),K=/\s/,B={newCue:function(R,E,L,_){for(var A=[],x,y,h,o,l,d=self.VTTCue||self.TextTrackCue,S=0;S<_.rows.length;S++)if(x=_.rows[S],h=!0,o=0,l="",!x.isEmpty()){for(var g=0;g<x.chars.length;g++)K.test(x.chars[g].uchar)&&h?o++:(l+=x.chars[g].uchar,h=!1);x.cueStartTime=E,E===L&&(L+=1e-4),o>=16?o--:o++;var p=Object(Z.fixLineBreaks)(l.trim()),w=Object(U.generateCueId)(E,L,p);(!R||!R.cues||!R.cues.getCueById(w))&&(y=new d(E,L,p),y.id=w,y.line=S+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),A.push(y))}return R&&A.length&&(A.sort(function(b,u){return b.line==="auto"||u.line==="auto"?0:b.line>8&&u.line>8?u.line-b.line:b.line-u.line}),A.forEach(function(b){return Object(I.addCueToTrack)(R,b)})),A}};Y.default=B},"./src/utils/discontinuities.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"findFirstFragWithCC",function(){return K}),O.d(Y,"shouldAlignOnDiscontinuities",function(){return B}),O.d(Y,"findDiscontinuousReferenceFrag",function(){return M}),O.d(Y,"adjustSlidingStart",function(){return E}),O.d(Y,"alignStream",function(){return L}),O.d(Y,"alignPDT",function(){return A}),O.d(Y,"alignFragmentByPDTDelta",function(){return x}),O.d(Y,"alignMediaPlaylistByPDT",function(){return y});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts"),I=O("./src/controller/level-helper.ts");function K(h,o){for(var l=null,d=0,S=h.length;d<S;d++){var g=h[d];if(g&&g.cc===o){l=g;break}}return l}function B(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function M(h,o){var l=h.fragments,d=o.fragments;if(!d.length||!l.length){U.logger.log("No fragments to align");return}var S=K(l,d[0].cc);if(!S||S&&!S.startPTS){U.logger.log("No frag in previous level to align on");return}return S}function R(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function E(h,o){for(var l=o.fragments,d=0,S=l.length;d<S;d++)R(l[d],h);o.fragmentHint&&R(o.fragmentHint,h),o.alignedSliding=!0}function L(h,o,l){if(!o)return;_(h,l,o),!l.alignedSliding&&o.details&&A(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(I.adjustSliding)(o.details,l)}function _(h,o,l){if(B(h,l,o)){var d=M(l.details,o);d&&Object(Z.isFiniteNumber)(d.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(d.start,o))}}function A(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,S=(d-l)/1e3+o.fragments[0].start;S&&Object(Z.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+S.toFixed(3)+" "+h.url+" "),E(S,h))}function x(h,o){var l=h.programDateTime;if(!l)return;var d=(l-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function y(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,S=l-d*1e3;h.fragments.forEach(function(g){x(g,S)}),h.fragmentHint&&x(h.fragmentHint,S),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/utils/ewma.ts"),U=function(){function I(B,M,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 Z.default(B),this.fast_=new Z.default(M)}var K=I.prototype;return K.update=function(M,R){var E=this.slow_,L=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new Z.default(M,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Z.default(R,L.getEstimate(),L.getTotalWeight()))},K.sample=function(M,R){M=Math.max(M,this.minDelayMs_);var E=8*R,L=M/1e3,_=E/L;this.fast_.sample(L,_),this.slow_.sample(L,_)},K.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},I}();Y.default=U},"./src/utils/ewma.ts":function(he,Y,O){"use strict";O.r(Y);var Z=function(){function U(K,B,M){B===void 0&&(B=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=B,this.totalWeight_=M}var I=U.prototype;return I.sample=function(B,M){var R=Math.pow(this.alpha_,B);this.estimate_=M*(1-R)+R*this.estimate_,this.totalWeight_+=B},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},U}();Y.default=Z},"./src/utils/fetch-loader.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"fetchSupported",function(){return x});var Z=O("./src/polyfills/number.ts"),U=O("./src/loader/load-stats.ts"),I=O("./src/demux/chunk-cache.ts");function K(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,L(d,S)}function B(d){var S=typeof Map=="function"?new Map:void 0;return B=function(p){if(p===null||!E(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(p))return S.get(p);S.set(p,w)}function w(){return M(p,arguments,_(this).constructor)}return w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),L(w,p)},B(d)}function M(d,S,g){return R()?M=Reflect.construct:M=function(w,b,u){var f=[null];f.push.apply(f,b);var s=Function.bind.apply(w,f),a=new s;return u&&L(a,u.prototype),a},M.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(d){return!1}}function E(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function L(d,S){return L=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},L(d,S)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},_(d)}function A(){return A=Object.assign||function(d){for(var S=1;S<arguments.length;S++){var g=arguments[S];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(d[p]=g[p])}return d},A.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var y=function(){function d(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||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var S=d.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(p,w,b){var u=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var s=h(p,this.controller.signal),a=b.onProgress,T=p.responseType==="arraybuffer",v=T?"byteLength":"length";this.context=p,this.config=w,this.callbacks=b,this.request=this.fetchSetup(p,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){u.abortInternal(),b.onTimeout(f,p,u.response)},w.timeout),self.fetch(this.request).then(function(C){if(u.response=u.loader=C,!C.ok){var D=C.status,j=C.statusText;throw new l(j||"fetch, bad network response",D,C)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(C.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(w.highWaterMark)?u.loadProgressively(C,f,p,w.highWaterMark,a):T?C.arrayBuffer():C.text()}).then(function(C){var D=u.response;self.clearTimeout(u.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=C[v];var j={url:D.url,data:C};a&&!Object(Z.isFiniteNumber)(w.highWaterMark)&&a(f,p,C,D),b.onSuccess(j,f,p,D)}).catch(function(C){if(self.clearTimeout(u.requestTimeout),f.aborted)return;var D=C.code||0;b.onError({code:D,text:C.message},p,C.details)})},S.getCacheAge=function(){var p=null;if(this.response){var w=this.response.headers.get("age");p=w?parseFloat(w):null}return p},S.loadProgressively=function(p,w,b,u,f){u===void 0&&(u=0);var s=new I.default,a=p.body.getReader(),T=function v(){return a.read().then(function(C){if(C.done)return s.dataLength&&f(w,b,s.flush(),p),Promise.resolve(new ArrayBuffer(0));var D=C.value,j=D.length;return w.loaded+=j,j<u||s.dataLength?(s.push(D),s.dataLength>=u&&f(w,b,s.flush(),p)):f(w,b,D,p),v()}).catch(function(){return Promise.reject()})};return T()},d}();function h(d,S){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(A({},d.headers))};return d.rangeEnd&&g.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),g}function o(d,S){return new self.Request(d.url,S)}var l=function(d){K(S,d);function S(g,p,w){var b;return b=d.call(this,g)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=w,b}return S}(B(Error));Y.default=y},"./src/utils/imsc1-ttml-parser.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"IMSC1_CODEC",function(){return E}),O.d(Y,"parseIMSC1",function(){return x});var Z=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/vttparser.ts"),I=O("./src/utils/vttcue.ts"),K=O("./src/demux/id3.ts"),B=O("./src/utils/timescale-conversion.ts"),M=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(u){for(var f=1;f<arguments.length;f++){var s=arguments[f];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(u[a]=s[a])}return u},R.apply(this,arguments)}var E="stpp.ttml.im1t",L=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(u,f,s,a,T){var v=Object(Z.findBox)(new Uint8Array(u),["mdat"]);if(v.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var C=v[0],D=Object(K.utf8ArrayToStr)(new Uint8Array(u,C.start,C.end-C.start)),j=Object(B.toTimescaleFromScale)(f,1,s);try{a(y(D,j))}catch(z){T(z)}}function y(u,f){var s=new DOMParser,a=s.parseFromString(u,"text/xml"),T=a.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},C=Object.keys(v).reduce(function(P,N){return P[N]=T.getAttribute("ttp:"+N)||v[N],P},{}),D=T.getAttribute("xml:space")!=="preserve",j=o(h(T,"styling","style")),z=o(h(T,"layout","region")),V=h(T,"body","[begin]");return[].map.call(V,function(P){var N=l(P,D);if(!N||!P.hasAttribute("begin"))return null;var $=p(P.getAttribute("begin"),C),re=p(P.getAttribute("dur"),C),pe=p(P.getAttribute("end"),C);if($===null)throw g(P);if(pe===null){if(re===null)throw g(P);pe=$+re}var ve=new I.default($-f,pe-f,N);ve.id=Object(M.generateCueId)(ve.startTime,ve.endTime,ve.text);var Ae=z[P.getAttribute("region")],Le=j[P.getAttribute("style")];ve.position=10,ve.size=80;var ce=d(Ae,Le),ae=ce.textAlign;if(ae){var de=A[ae];de&&(ve.lineAlign=de),ve.align=ae}return R(ve,ce),ve}).filter(function(P){return P!==null})}function h(u,f,s){var a=u.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(u){return u.reduce(function(f,s){var a=s.getAttribute("xml:id");return a&&(f[a]=s),f},{})}function l(u,f){return[].slice.call(u.childNodes).reduce(function(s,a,T){var v;return a.nodeName==="br"&&T?s+`
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?l(a,f):f?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function d(u,f){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(T,v){var C=S(f,s,v)||S(u,s,v);return C&&(T[v]=C),T},{})}function S(u,f,s){return u.hasAttributeNS(f,s)?u.getAttributeNS(f,s):null}function g(u){return new Error("Could not parse ttml timestamp "+u)}function p(u,f){if(!u)return null;var s=Object(U.parseTimeStamp)(u);return s===null&&(L.test(u)?s=w(u,f):_.test(u)&&(s=b(u,f))),s}function w(u,f){var s=L.exec(u),a=(s[4]|0)+(s[5]|0)/f.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/f.frameRate}function b(u,f){var s=_.exec(u),a=Number(s[1]),T=s[2];switch(T){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"enableLogs",function(){return M}),O.d(Y,"logger",function(){return R});var Z=function(){},U={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},I=U;function K(E){var L=self.console[E];return L?L.bind(self.console,"["+E+"] >"):Z}function B(E){for(var L=arguments.length,_=new Array(L>1?L-1:0),A=1;A<L;A++)_[A-1]=arguments[A];_.forEach(function(x){I[x]=E[x]?E[x].bind(E):K(x)})}function M(E){if(self.console&&E===!0||typeof E=="object"){B(E,"debug","log","info","warn","error");try{I.log()}catch(L){I=U}}else I=U}var R=I},"./src/utils/mediakeys-helper.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"KeySystems",function(){return Z}),O.d(Y,"requestMediaKeySystemAccess",function(){return U});var Z;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"bin2str",function(){return B}),O.d(Y,"readUint16",function(){return M}),O.d(Y,"readUint32",function(){return R}),O.d(Y,"writeUint32",function(){return E}),O.d(Y,"findBox",function(){return L}),O.d(Y,"parseSegmentIndex",function(){return _}),O.d(Y,"parseInitSegment",function(){return A}),O.d(Y,"getStartDTS",function(){return x}),O.d(Y,"getDuration",function(){return y}),O.d(Y,"computeRawDurationFromSamples",function(){return h}),O.d(Y,"offsetStartDTS",function(){return o}),O.d(Y,"segmentValidRange",function(){return l}),O.d(Y,"appendUint8Array",function(){return d});var Z=O("./src/utils/typed-array.ts"),U=O("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,K=[].push;function B(S){return String.fromCharCode.apply(null,S)}function M(S,g){"data"in S&&(g+=S.start,S=S.data);var p=S[g]<<8|S[g+1];return p<0?65536+p:p}function R(S,g){"data"in S&&(g+=S.start,S=S.data);var p=S[g]<<24|S[g+1]<<16|S[g+2]<<8|S[g+3];return p<0?4294967296+p:p}function E(S,g,p){"data"in S&&(g+=S.start,S=S.data),S[g]=p>>24,S[g+1]=p>>16&255,S[g+2]=p>>8&255,S[g+3]=p&255}function L(S,g){var p=[];if(!g.length)return p;var w,b,u;"data"in S?(w=S.data,b=S.start,u=S.end):(w=S,b=0,u=w.byteLength);for(var f=b;f<u;){var s=R(w,f),a=B(w.subarray(f+4,f+8)),T=s>1?f+s:u;if(a===g[0])if(g.length===1)p.push({data:w,start:f+8,end:T});else{var v=L({data:w,start:f+8,end:T},g.slice(1));v.length&&K.apply(p,v)}f=T}return p}function _(S){var g=L(S,["moov"]),p=g[0],w=p?p.end:null,b=L(S,["sidx"]);if(!b||!b[0])return null;var u=[],f=b[0],s=f.data[0],a=s===0?8:16,T=R(f,a);a+=4;var v=0,C=0;s===0?a+=8:a+=16,a+=2;var D=f.end+C,j=M(f,a);a+=2;for(var z=0;z<j;z++){var V=a,P=R(f,V);V+=4;var N=P&2147483647,$=(P&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var re=R(f,V);V+=4,u.push({referenceSize:N,subsegmentDuration:re,info:{duration:re/T,start:D,end:D+N-1}}),D+=N,V+=4,a=V}return{earliestPresentationTime:v,timescale:T,version:s,referencesCount:j,references:u,moovEndOffset:w}}function A(S){for(var g=[],p=L(S,["moov","trak"]),w=0;w<p.length;w++){var b=p[w],u=L(b,["tkhd"])[0];if(u){var f=u.data[u.start],s=f===0?12:20,a=R(u,s),T=L(b,["mdia","mdhd"])[0];if(T){f=T.data[T.start],s=f===0?12:20;var v=R(T,s),C=L(b,["mdia","hdlr"])[0];if(C){var D=B(C.data.subarray(C.start+8,C.start+12)),j={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[D];if(j){var z=L(b,["mdia","minf","stbl","stsd"])[0],V=void 0;z&&(V=B(z.data.subarray(z.start+12,z.start+16))),g[a]={timescale:v,type:j},g[j]={timescale:v,id:a,codec:V}}}}}}var P=L(S,["moov","mvex","trex"]);return P.forEach(function(N){var $=R(N,4),re=g[$];re&&(re.default={duration:R(N,12),flags:R(N,20)})}),g}function x(S,g){return L(g,["moof","traf"]).reduce(function(p,w){var b=L(w,["tfdt"])[0],u=b.data[b.start],f=L(w,["tfhd"]).reduce(function(s,a){var T=R(a,4),v=S[T];if(v){var C=R(b,4);u===1&&(C*=Math.pow(2,32),C+=R(b,8));var D=v.timescale||9e4,j=C/D;if(isFinite(j)&&(s===null||j<s))return j}return s},null);return f!==null&&isFinite(f)&&(p===null||f<p)?f:p},null)||0}function y(S,g){for(var p=0,w=0,b=0,u=L(S,["moof","traf"]),f=0;f<u.length;f++){var s=u[f],a=L(s,["tfhd"])[0],T=R(a,4),v=g[T];if(!v)continue;var C=v.default,D=R(a,0)|(C==null?void 0:C.flags),j=C==null?void 0:C.duration;D&8&&(D&2?j=R(a,12):j=R(a,8));for(var z=v.timescale||9e4,V=L(s,["trun"]),P=0;P<V.length;P++){if(j){var N=R(V[P],4);p=j*N}else p=h(V[P]);v.type===U.ElementaryStreamTypes.VIDEO?w+=p/z:v.type===U.ElementaryStreamTypes.AUDIO&&(b+=p/z)}}if(w===0&&b===0){var $=_(S);if($!=null&&$.references)return $.references.reduce(function(re,pe){return re+pe.info.duration||0},0)}return w||b}function h(S){var g=R(S,0),p=8;g&1&&(p+=4),g&4&&(p+=4);for(var w=0,b=R(S,4),u=0;u<b;u++){if(g&256){var f=R(S,p);w+=f,p+=4}g&512&&(p+=4),g&1024&&(p+=4),g&2048&&(p+=4)}return w}function o(S,g,p){L(g,["moof","traf"]).forEach(function(w){L(w,["tfhd"]).forEach(function(b){var u=R(b,4),f=S[u];if(!f)return;var s=f.timescale||9e4;L(w,["tfdt"]).forEach(function(a){var T=a.data[a.start],v=R(a,4);if(T===0)E(a,4,v-p*s);else{v*=Math.pow(2,32),v+=R(a,8),v-=p*s,v=Math.max(v,0);var C=Math.floor(v/(I+1)),D=Math.floor(v%(I+1));E(a,4,C),E(a,8,D)}})})})}function l(S){var g={valid:null,remainder:null},p=L(S,["moof"]);if(p){if(p.length<2)return g.remainder=S,g}else return g;var w=p[p.length-1];return g.valid=Object(Z.sliceUint8)(S,0,w.start-8),g.remainder=Object(Z.sliceUint8)(S,w.start-8),g}function d(S,g){var p=new Uint8Array(S.length+g.length);return p.set(S),p.set(g,S.length),p}},"./src/utils/output-filter.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"default",function(){return Z});var Z=function(){function U(K,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=B}var I=U.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(B,M,R){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=M,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"sendAddTrackEvent",function(){return U}),O.d(Y,"addCueToTrack",function(){return I}),O.d(Y,"clearCurrentCues",function(){return K}),O.d(Y,"removeCuesInRange",function(){return B}),O.d(Y,"getCuesInRange",function(){return R});var Z=O("./src/utils/logger.ts");function U(E,L){var _;try{_=new Event("addtrack")}catch(A){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=E,L.dispatchEvent(_)}function I(E,L){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(L.id))try{if(E.addCue(L),!E.cues.getCueById(L.id))throw new Error("addCue is failed for: "+L)}catch(x){Z.logger.debug("[texttrack-utils]: "+x);var A=new self.TextTrackCue(L.startTime,L.endTime,L.text);A.id=L.id,E.addCue(A)}_==="disabled"&&(E.mode=_)}function K(E){var L=E.mode;if(L==="disabled"&&(E.mode="hidden"),E.cues)for(var _=E.cues.length;_--;)E.removeCue(E.cues[_]);L==="disabled"&&(E.mode=L)}function B(E,L,_){var A=E.mode;if(A==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var x=R(E.cues,L,_),y=0;y<x.length;y++)E.removeCue(x[y]);A==="disabled"&&(E.mode=A)}function M(E,L){if(L<E[0].startTime)return 0;var _=E.length-1;if(L>E[_].endTime)return-1;for(var A=0,x=_;A<=x;){var y=Math.floor((x+A)/2);if(L<E[y].startTime)x=y-1;else if(L>E[y].startTime&&A<_)A=y+1;else return y}return E[A].startTime-L<L-E[x].startTime?A:x}function R(E,L,_){var A=[],x=M(E,L);if(x>-1)for(var y=x,h=E.length;y<h;y++){var o=E[y];if(o.startTime>=L&&o.endTime<=_)A.push(o);else if(o.startTime>_)return A}return A}},"./src/utils/time-ranges.ts":function(he,Y,O){"use strict";O.r(Y);var Z={toString:function(I){for(var K="",B=I.length,M=0;M<B;M++)K+="["+I.start(M).toFixed(3)+","+I.end(M).toFixed(3)+"]";return K}};Y.default=Z},"./src/utils/timescale-conversion.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"toTimescaleFromBase",function(){return U}),O.d(Y,"toTimescaleFromScale",function(){return I}),O.d(Y,"toMsFromMpegTsClock",function(){return K}),O.d(Y,"toMpegTsClockFromTimescale",function(){return B});var Z=9e4;function U(M,R,E,L){E===void 0&&(E=1),L===void 0&&(L=!1);var _=M*R*E;return L?Math.round(_):_}function I(M,R,E,L){return E===void 0&&(E=1),L===void 0&&(L=!1),U(M,R,1/E,L)}function K(M,R){return R===void 0&&(R=!1),U(M,1e3,1/Z,R)}function B(M,R){return R===void 0&&(R=1),U(M,Z,1/R)}},"./src/utils/typed-array.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"sliceUint8",function(){return Z});function Z(U,I,K){return Uint8Array.prototype.slice?U.slice(I,K):new Uint8Array(Array.prototype.slice.call(U,I,K))}},"./src/utils/vttcue.ts":function(he,Y,O){"use strict";O.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],U=["start","middle","end","left","right"];function I(E,L){if(typeof L!="string")return!1;if(!Array.isArray(E))return!1;var _=L.toLowerCase();return~E.indexOf(_)?_:!1}function K(E){return I(Z,E)}function B(E){return I(U,E)}function M(E){for(var L=arguments.length,_=new Array(L>1?L-1:0),A=1;A<L;A++)_[A-1]=arguments[A];for(var x=1;x<arguments.length;x++){var y=arguments[x];for(var h in y)E[h]=y[h]}return E}function R(E,L,_){var A=this,x={enumerable:!0};A.hasBeenReset=!1;var y="",h=!1,o=E,l=L,d=_,S=null,g="",p=!0,w="auto",b="start",u=50,f="middle",s=50,a="middle";Object.defineProperty(A,"id",M({},x,{get:function(){return y},set:function(v){y=""+v}})),Object.defineProperty(A,"pauseOnExit",M({},x,{get:function(){return h},set:function(v){h=!!v}})),Object.defineProperty(A,"startTime",M({},x,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",M({},x,{get:function(){return l},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",M({},x,{get:function(){return d},set:function(v){d=""+v,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",M({},x,{get:function(){return S},set:function(v){S=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",M({},x,{get:function(){return g},set:function(v){var C=K(v);if(C===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=C,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",M({},x,{get:function(){return p},set:function(v){p=!!v,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",M({},x,{get:function(){return w},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",M({},x,{get:function(){return b},set:function(v){var C=B(v);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");b=C,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",M({},x,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",M({},x,{get:function(){return f},set:function(v){var C=B(v);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");f=C,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",M({},x,{get:function(){return s},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",M({},x,{get:function(){return a},set:function(v){var C=B(v);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");a=C,this.hasBeenReset=!0}})),A.displayState=void 0}return R.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"parseTimeStamp",function(){return I}),O.d(Y,"fixLineBreaks",function(){return L}),O.d(Y,"VTTParser",function(){return _});var Z=O("./src/utils/vttcue.ts"),U=function(){function A(){}var x=A.prototype;return x.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},A}();function I(A){function x(h,o,l,d){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var y=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?x(y[2],y[3],0,y[4]):x(y[1],y[2],y[3],y[4]):null}var K=function(){function A(){this.values=Object.create(null)}var x=A.prototype;return x.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},x.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},x.has=function(h){return h in this.values},x.alt=function(h,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(h,o);break}},x.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},x.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},A}();function B(A,x,y,h){var o=h?A.split(h):[A];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(y);if(d.length!==2)continue;var S=d[0],g=d[1];x(S,g)}}var M=new Z.default(0,0,""),R=M.align==="middle"?"middle":"center";function E(A,x,y){var h=A;function o(){var S=I(A);if(S===null)throw new Error("Malformed timestamp: "+h);return A=A.replace(/^[^\sa-zA-Z-]+/,""),S}function l(S,g){var p=new K;B(S,function(u,f){var s;switch(u){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===f){p.set(u,y[a].region);break}break;case"vertical":p.alt(u,f,["rl","lr"]);break;case"line":s=f.split(","),p.integer(u,s[0]),p.percent(u,s[0])&&p.set("snapToLines",!1),p.alt(u,s[0],["auto"]),s.length===2&&p.alt("lineAlign",s[1],["start",R,"end"]);break;case"position":s=f.split(","),p.percent(u,s[0]),s.length===2&&p.alt("positionAlign",s[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":p.percent(u,f);break;case"align":p.alt(u,f,["start",R,"end","left","right"]);break}},/:/,/\s/),g.region=p.get("region",null),g.vertical=p.get("vertical","");var w=p.get("line","auto");w==="auto"&&M.line===-1&&(w=-1),g.line=w,g.lineAlign=p.get("lineAlign","start"),g.snapToLines=p.get("snapToLines",!0),g.size=p.get("size",100),g.align=p.get("align",R);var b=p.get("position","auto");b==="auto"&&M.position===50&&(b=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=b}function d(){A=A.replace(/^\s+/,"")}if(d(),x.startTime=o(),d(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);A=A.substr(3),d(),x.endTime=o(),d(),l(A,x)}function L(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=A.prototype;return x.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var b=o.buffer,u=0;for(b=L(b);u<b.length&&b[u]!=="\r"&&b[u]!==`
`;)++u;var f=b.substr(0,u);return b[u]==="\r"&&++u,b[u]===`
`&&++u,o.buffer=b.substr(u),f}function d(b){B(b,function(u,f){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=l();var g=S.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:S=l();switch(o.state){case"HEADER":/:/.test(S)?d(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(S,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=S.indexOf("-->")!==-1;if(!S||w&&(p=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(he,Y,O){"use strict";O.r(Y),O.d(Y,"generateCueId",function(){return _}),O.d(Y,"parseWebVTT",function(){return x});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/vttparser.ts"),I=O("./src/demux/id3.ts"),K=O("./src/utils/timescale-conversion.ts"),B=O("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,R=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},E=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),S=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*S,o},L=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function _(y,h,o){return L(y.toString())+L(h.toString())+L(o)}var A=function(h,o,l){var d=h[o],S=h[d.prevCC];if(!S||!S.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(g=S)!==null&&g!==void 0&&g.new;){var g;h.ccOffset+=d.start-S.start,d.new=!1,d=S,S=h[d.prevCC]}h.presentationOffset=l};function x(y,h,o,l,d,S,g,p){var w=new U.VTTParser,b=Object(I.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(M,`
`).split(`
`),u=[],f=Object(K.toMpegTsClockFromTimescale)(h,o),s="00:00.000",a=0,T=0,v,C=!0,D=!1;w.oncue=function(j){var z=l[d],V=l.ccOffset,P=(a-f)/9e4;if(z!=null&&z.new&&(T!==void 0?V=l.ccOffset=z.start:A(l,d,P)),P&&(V=P-l.presentationOffset),D){var N=j.endTime-j.startTime,$=Object(B.normalizePts)((j.startTime+V-T)*9e4,S*9e4)/9e4;j.startTime=$,j.endTime=$+N}var re=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(re)),j.id||(j.id=_(j.startTime,j.endTime,re)),j.endTime>0&&u.push(j)},w.onparsingerror=function(j){v=j},w.onflush=function(){if(v){p(v);return}g(u)},b.forEach(function(j){if(C)if(R(j,"X-TIMESTAMP-MAP=")){C=!1,D=!0,j.substr(16).split(",").forEach(function(z){R(z,"LOCAL:")?s=z.substr(6):R(z,"MPEGTS:")&&(a=parseInt(z.substr(7)))});try{T=E(s)/1e3}catch(z){D=!1,v=z}return}else j===""&&(C=!1);w.parse(j+`
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(he,Y,O){"use strict";O.r(Y);var Z=O("./src/utils/logger.ts"),U=O("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,K=function(){function B(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 U.LoadStats,this.retryDelay=0}var M=B.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},M.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(E,L,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=L,this.callbacks=_,this.retryDelay=L.retryDelay,this.loadInternal()},M.loadInternal=function(){var E=this.config,L=this.context;if(!E)return;var _=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var x=this.xhrSetup;try{if(x)try{x(_,L.url)}catch(o){_.open("GET",L.url,!0),x(_,L.url)}_.readyState||_.open("GET",L.url,!0);var y=this.context.headers;if(y)for(var h in y)_.setRequestHeader(h,y[h])}catch(o){this.callbacks.onError({code:_.status,text:o.message},L,_);return}L.rangeEnd&&_.setRequestHeader("Range","bytes="+L.rangeStart+"-"+(L.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=L.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),_.send()},M.readystatechange=function(){var E=this.context,L=this.loader,_=this.stats;if(!E||!L)return;var A=L.readyState,x=this.config;if(_.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),A===4){L.onreadystatechange=null,L.onprogress=null;var y=L.status;if(y>=200&&y<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var h,o;if(E.responseType==="arraybuffer"?(h=L.response,o=h.byteLength):(h=L.responseText,o=h.length),_.loaded=_.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(_,E,h,L),!this.callbacks)return;var d={url:L.responseURL,data:h};this.callbacks.onSuccess(d,_,E,L)}else _.retry>=x.maxRetry||y>=400&&y<499?(Z.logger.error(y+" while loading "+E.url),this.callbacks.onError({code:y,text:L.statusText},E,L)):(Z.logger.warn(y+" while loading "+E.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,x.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},M.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(E){var L=this.stats;L.loaded=E.loaded,E.lengthComputable&&(L.total=E.total)},M.getCacheAge=function(){var E=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var L=this.loader.getResponseHeader("age");E=L?parseFloat(L):null}return E},B}();Y.default=K}}).default})},vHTk:function(Et,tt,ie){Et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);