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

367 lines
1.0 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[206,6,7,10],{"+NIl":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function($,D){"use strict";function Z(k,x){k.cmdState.push(x)}function B(k){return k.cmdState.length>0?k.cmdState[k.cmdState.length-1]:null}function M(k){var x=k.cmdState.pop();x&&x.closeBracket()}function G(k){for(var x=k.cmdState,E=x.length-1;E>=0;E--){var h=x[E];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function W(k,x,E){return function(){this.name=k,this.bracketNo=0,this.style=x,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var _={};_.importmodule=W("importmodule","tag",["string","builtin"]),_.documentclass=W("documentclass","tag",["","atom"]),_.usepackage=W("usepackage","tag",["atom"]),_.begin=W("begin","tag",["atom"]),_.end=W("end","tag",["atom"]),_.label=W("label","tag",["atom"]),_.ref=W("ref","tag",["atom"]),_.eqref=W("eqref","tag",["atom"]),_.cite=W("cite","tag",["atom"]),_.bibitem=W("bibitem","tag",["atom"]),_.Bibitem=W("Bibitem","tag",["atom"]),_.RBibitem=W("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(k,x){k.f=x}function y(k,x){var E;if(k.match(/^\\[a-zA-Z@]+/)){var h=k.current().slice(1);return E=_.hasOwnProperty(h)?_[h]:_.DEFAULT,E=new E,Z(x,E),O(x,R),E.style}if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/\\]/))return"tag";if(k.match("\\["))return O(x,function(u,d){return A(u,d,"\\]")}),"keyword";if(k.match("\\("))return O(x,function(u,d){return A(u,d,"\\)")}),"keyword";if(k.match("$$"))return O(x,function(u,d){return A(u,d,"$$")}),"keyword";if(k.match("$"))return O(x,function(u,d){return A(u,d,"$")}),"keyword";var o=k.next();if(o=="%")return k.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=B(x),E)E.closeBracket(o),O(x,R);else return"error";return"bracket"}else return o=="{"||o=="["?(E=_.DEFAULT,E=new E,Z(x,E),"bracket"):/\d/.test(o)?(k.eatWhile(/[\w.%]/),"atom"):(k.eatWhile(/[\w\-_]/),E=G(x),E.name=="begin"&&(E.argument=k.current()),E.styleIdentifier())}function A(k,x,E){if(k.eatSpace())return null;if(E&&k.match(E))return O(x,y),"keyword";if(k.match(/^\\[a-zA-Z@]+/))return"tag";if(k.match(/^[a-zA-Z]+/))return"variable-2";if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/]/))return"tag";if(k.match(/^[\^_&]/))return"tag";if(k.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(k.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=k.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(k.skipToEnd(),"comment"):"error"}function R(k,x){var E=k.peek(),h;return E=="{"||E=="["?(h=B(x),h.openBracket(E),k.eat(E),O(x,y),"bracket"):/[ \t\r]/.test(E)?(k.eat(E),null):(O(x,y),M(x),y(k,x))}return{startState:function(){var k=D.inMathMode?function(x,E){return A(x,E)}:y;return{cmdState:[],f:k}},copyState:function(k){return{cmdState:k.cmdState.slice(),f:k.f}},token:function(k,x){return x.f(k,x)},blankLine:function(k){k.f=y,k.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"19Vz":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(W,_,O){var y=O&&O!=ce.Init;if(_&&!y)W.on("blur",B),W.on("change",M),W.on("swapDoc",M),ce.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Z(W)}),M(W);else if(!_&&y){W.off("blur",B),W.off("change",M),W.off("swapDoc",M),ce.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),$(W);var A=W.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}_&&!W.hasFocus()&&B(W)});function $(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){$(W);var _=W.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=W.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var O=W.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),_.appendChild(O),W.display.lineSpace.insertBefore(_,W.display.lineSpace.firstChild)}function Z(W){setTimeout(function(){var _=!1,O=W.getInputField();O.nodeName=="TEXTAREA"?_=!O.value:W.lineCount()==1&&(_=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),_?D(W):$(W)},20)}function B(W){G(W)&&D(W)}function M(W){var _=W.getWrapperElement(),O=G(W);_.className=_.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?D(W):$(W)}function G(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ce.defineMode("xml",function(Z,B){var M=Z.indentUnit,G={},W=B.htmlMode?$:D;for(var _ in W)G[_]=W[_];for(var _ in B)G[_]=B[_];var O,y;function A(a,C){function m(j){return C.tokenize=j,j(a,C)}var T=a.next();if(T=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(x("atom","]]>")):null:a.match("--")?m(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),C.tokenize=x("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",C.tokenize=R,"tag bracket");if(T=="&"){var U;return a.eat("#")?a.eat("x")?U=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):U=a.eatWhile(/[\d]/)&&a.eat(";"):U=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),U?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function R(a,C){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return C.tokenize=A,O=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return O="equals",null;if(m=="<"){C.tokenize=A,C.state=d,C.tagName=C.tagStart=null;var T=C.tokenize(a,C);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(m)?(C.tokenize=k(m),C.stringStartCol=a.column(),C.tokenize(a,C)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function k(a){var C=function(m,T){for(;!m.eol();)if(m.next()==a){T.tokenize=R;break}return"string"};return C.isInAttribute=!0,C}function x(a,C){return function(m,T){for(;!m.eol();){if(m.match(C)){T.tokenize=A;break}m.next()}return a}}function E(a){return function(C,m){for(var T;(T=C.next())!=null;){if(T=="<")return m.tokenize=E(a+1),m.tokenize(C,m);if(T==">")if(a==1){m.tokenize=A;break}else return m.tokenize=E(a-1),m.tokenize(C,m)}return"meta"}}function h(a,C,m){this.prev=a.context,this.tagName=C,this.indent=a.indented,this.startOfLine=m,(G.doNotIndent.hasOwnProperty(C)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,C){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!G.contextGrabbers.hasOwnProperty(m)||!G.contextGrabbers[m].hasOwnProperty(C))return;o(a)}}function d(a,C,m){return a=="openTag"?(m.tagStart=C.column(),S):a=="closeTag"?v:d}function S(a,C,m){return a=="word"?(m.tagName=C.current(),y="tag",b):G.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,C,m)):(y="error",S)}function v(a,C,m){if(a=="word"){var T=C.current();return m.context&&m.context.tagName!=T&&G.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==T||G.matchClosing===!1?(y="tag",p):(y="tag error",w)}else return G.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,C,m)):(y="error",w)}function p(a,C,m){return a!="endTag"?(y="error",p):(o(m),d)}function w(a,C,m){return y="error",p(a,C,m)}function b(a,C,m){if(a=="word")return y="attribute",s;if(a=="endTag"||a=="selfcloseTag"){var T=m.tagName,U=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(T)?u(m,T):(u(m,T),m.context=new h(m,T,U==m.indented)),d}return y="error",b}function s(a,C,m){return a=="equals"?f:(G.allowMissing||(y="error"),b(a,C,m))}function f(a,C,m){return a=="string"?l:a=="word"&&G.allowUnquoted?(y="string",b):(y="error",b(a,C,m))}function l(a,C,m){return a=="string"?l:b(a,C,m)}return{startState:function(a){var C={tokenize:A,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(C.baseIndent=a),C},token:function(a,C){if(!C.tagName&&a.sol()&&(C.indented=a.indentation()),a.eatSpace())return null;O=null;var m=C.tokenize(a,C);return(m||O)&&m!="comment"&&(y=null,C.state=C.state(O||m,a,C),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,C,m){var T=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(T&&T.noIndent)return ce.Pass;if(a.tokenize!=R&&a.tokenize!=A)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var U=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(U&&U[1])for(;T;)if(T.tagName==U[2]){T=T.prev;break}else if(G.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(U)for(;T;){var j=G.contextGrabbers[T.tagName];if(j&&j.hasOwnProperty(U[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+M:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.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 C=[],m=a.context;m;m=m.prev)m.tagName&&C.push(m.tagName);return C.reverse()}}}),ce.defineMIME("text/xml","xml"),ce.defineMIME("application/xml","xml"),ce.mimeModes.hasOwnProperty("text/html")||ce.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(wt,nt,re){"use strict";var ce=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function D(){if(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce($)}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 B(R){return typeof R=="string"&&Z.test(R)}for(var M=B,G=[],W=0;W<256;++W)G.push((W+256).toString(16).substr(1));function _(R){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(G[R[k+0]]+G[R[k+1]]+G[R[k+2]]+G[R[k+3]]+"-"+G[R[k+4]]+G[R[k+5]]+"-"+G[R[k+6]]+G[R[k+7]]+"-"+G[R[k+8]]+G[R[k+9]]+"-"+G[R[k+10]]+G[R[k+11]]+G[R[k+12]]+G[R[k+13]]+G[R[k+14]]+G[R[k+15]]).toLowerCase();if(!M(x))throw TypeError("Stringified UUID is invalid");return x}var O=_;function y(R,k,x){R=R||{};var E=R.random||(R.rng||D)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,k){x=x||0;for(var h=0;h<16;++h)k[x+h]=E[h];return k}return O(E)}var A=nt.a=y},"7ahc":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return S});var ce=re("k1fw"),$=re("0Owb"),D=re("+L6B"),Z=re("2/Rp"),B=re("y8nQ"),M=re("Vl3Y"),G=re("tJVT"),W=re("OaEy"),_=re("2fM7"),O=re("q1tI"),y=re.n(O),A=re("VrN/"),R=re.n(A),k=re("p77/"),x=re.n(k),E=re("c5Ni"),h=re.n(E),o=_.a.Option,u={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"]};nt.b=function(v){var p=v.callback,w=v.onCancel,b=Object(O.useState)("python"),s=Object(G.a)(b,2),f=s[0],l=s[1];function a(m){l(d[m][1])}function C(m){p(m)}return y.a.createElement(M.a,Object($.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(_.a,{onChange:a},Object.keys(d).map(function(m){return y.a.createElement(o,{key:m,value:m},d[m][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(S,{mode:f})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(v){var p=v.value,w=v.onChange,b=v.mode,s=v.options,f=s===void 0?{}:s,l=Object(O.useRef)(),a=Object(O.useState)(),C=Object(G.a)(a,2),m=C[0],T=C[1];return Object(O.useEffect)(function(){if(m){function U(j){var F=j.getValue();w&&w(F)}return m.on("change",U),function(){m.off("change",U)}}},[m,w]),Object(O.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(O.useEffect)(function(){m&&((p!==m.getValue()||p==="")&&setTimeout(function(){m.setValue(p||" ")},300))},[m,p]),Object(O.useEffect)(function(){if(l.current&&!m){var U=R.a.fromTextArea(l.current,Object(ce.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));T(U)}},[l.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:l}))}},"7ixt":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return D});var ce={adjustX:1,adjustY:1},$=[0,0],D={left:{points:["cr","cl"],overflow:ce,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:ce,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:ce,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:ce,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:ce,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:ce,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:ce,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:ce,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:ce,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:ce,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:ce,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:ce,offset:[-4,0],targetOffset:$}},Z=D},"815F":function(wt,nt,re){"use strict";re.d(nt,"e",function(){return G}),re.d(nt,"c",function(){return _}),re.d(nt,"d",function(){return O}),re.d(nt,"a",function(){return A}),re.d(nt,"f",function(){return R}),re.d(nt,"b",function(){return k});var ce=re("KQm4"),$=re("VTBJ"),D=re("Ff2n"),Z=re("Zm9Q"),B=re("Kwbf"),M=re("OZM5");function G(x,E){return x!=null?x:E}function W(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=new Map;function h(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(o||[]).forEach(function(d){var S=d.key,v=d.children;Object(B.a)(S!=null,"Tree node must have a certain key: [".concat(u).concat(S,"]"));var p=String(S);Object(B.a)(!E.has(p)||S===null||S===void 0,"Same 'key' exist in the Tree: ".concat(p)),E.set(p,!0),h(v,"".concat(u).concat(p," > "))})}h(x)}function _(x){function E(h){var o=Object(Z.a)(h);return o.map(function(u){if(!Object(M.i)(u))return Object(B.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var d=u.key,S=u.props,v=S.children,p=Object(D.a)(S,["children"]),w=Object($.a)({key:d},p),b=E(v);return b.length&&(w.children=b),w}).filter(function(u){return u})}return E(x)}function O(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(E===!0?[]:E),o=[];function u(d){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return d.map(function(v,p){var w=Object(M.h)(S?S.pos:"0",p),b=G(v.key,w),s=Object($.a)(Object($.a)({},v),{},{parent:S,pos:w,children:null,data:v,isStart:[].concat(Object(ce.a)(S?S.isStart:[]),[p===0]),isEnd:[].concat(Object(ce.a)(S?S.isEnd:[]),[p===d.length-1])});return o.push(s),E===!0||h.has(b)?s.children=u(v.children||[],s):s.children=[],s})}return u(x),o}function y(x,E,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,v){return G(S.key,v)};function u(d,S,v){var p=d?d.children:x,w=d?Object(M.h)(v.pos,S):"0";if(d){var b=o(d,w),s={node:d,index:S,pos:w,key:b,parentPos:v.node?v.pos:null,level:v.level+1};E(s)}p&&p.forEach(function(f,l){u(f,l,{node:d,pos:w,level:v?v.level+1:-1})})}u(null)}function A(x){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=E.initWrapper,o=E.processEntity,u=E.onProcessFinished,d=arguments.length>2?arguments[2]:void 0,S={},v={},p={posEntities:S,keyEntities:v};return h&&(p=h(p)||p),y(x,function(w){var b=w.node,s=w.index,f=w.pos,l=w.key,a=w.parentPos,C=w.level,m={node:b,index:s,key:l,pos:f,level:C},T=G(l,f);S[f]=m,v[T]=m,m.parent=S[a],m.parent&&(m.parent.children=m.parent.children||[],m.parent.children.push(m)),o&&o(m,p)},d),u&&u(p),p}function R(x,E){var h=E.expandedKeys,o=E.selectedKeys,u=E.loadedKeys,d=E.loadingKeys,S=E.checkedKeys,v=E.halfCheckedKeys,p=E.dragOverNodeKey,w=E.dropPosition,b=E.keyEntities,s=b[x],f={eventKey:x,expanded:h.indexOf(x)!==-1,selected:o.indexOf(x)!==-1,loaded:u.indexOf(x)!==-1,loading:d.indexOf(x)!==-1,checked:S.indexOf(x)!==-1,halfChecked:v.indexOf(x)!==-1,pos:String(s?s.pos:""),dragOver:p===x&&w===0,dragOverGapTop:p===x&&w===-1,dragOverGapBottom:p===x&&w===1};return f}function k(x){var E=x.data,h=x.expanded,o=x.selected,u=x.checked,d=x.loaded,S=x.loading,v=x.halfChecked,p=x.dragOver,w=x.dragOverGapTop,b=x.dragOverGapBottom,s=x.pos,f=x.active,l=Object($.a)(Object($.a)({},E),{},{expanded:h,selected:o,checked:u,loaded:d,loading:S,halfChecked:v,dragOver:p,dragOverGapTop:w,dragOverGapBottom:b,pos:s,active:f});return"props"in l||Object.defineProperty(l,"props",{get:function(){return Object(B.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),x}}),l}},"8EBN":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";ce.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$<ce.modeInfo.length;$++){var D=ce.modeInfo[$];D.mimes&&(D.mime=D.mimes[0])}ce.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var B=0;B<ce.modeInfo.length;B++){var M=ce.modeInfo[B];if(M.mime==Z)return M;if(M.mimes){for(var G=0;G<M.mimes.length;G++)if(M.mimes[G]==Z)return M}}if(/\+xml$/.test(Z))return ce.findModeByMIME("application/xml");if(/\+json$/.test(Z))return ce.findModeByMIME("application/json")},ce.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var B=0;B<ce.modeInfo.length;B++){var M=ce.modeInfo[B];if(M.ext){for(var G=0;G<M.ext.length;G++)if(M.ext[G]==Z)return M}}},ce.findModeByFileName=function(Z){for(var B=0;B<ce.modeInfo.length;B++){var M=ce.modeInfo[B];if(M.file&&M.file.test(Z))return M}var G=Z.lastIndexOf("."),W=G>-1&&Z.substring(G+1,Z.length);if(W)return ce.findModeByExtension(W)},ce.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B<ce.modeInfo.length;B++){var M=ce.modeInfo[B];if(M.name.toLowerCase()==Z)return M;if(M.alias){for(var G=0;G<M.alias.length;G++)if(M.alias[G].toLowerCase()==Z)return M}}}})},"8Jsi":function(wt,nt,re){"use strict";re.d(nt,"d",function(){return a}),re.d(nt,"a",function(){return ne}),re.d(nt,"b",function(){return Ae}),re.d(nt,"c",function(){return fe});var ce=re("1OyB"),$=re("vuIU"),D=re("Ji7U"),Z=re("LK+K"),B=re("KQm4"),M=re("U8pU"),G=re("ODXe"),W=re("VTBJ"),_=re("q1tI"),O=re("qNPg"),y=re("2Qr1"),A=re("815F"),R=re("NvD2"),k=re("wPlo"),x=re("6cGi"),E=re("Kwbf"),h=re("4IlW"),o=re("YrtM"),u=re("fAei"),d=_.createContext(null);function S(De,Ie){if(!De)return!0;var Be=De.data,ze=Be.disabled,Ke=Be.disableCheckbox;switch(Ie){case"select":return ze;case"checkbox":return ze||Ke}return!1}function v(De,Ie){var Be=_.useCallback(function(Ke){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,tt=De.get(Ke);return!Re&&S(tt,Ve)?null:tt},[De]),ze=_.useCallback(function(Ke){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,tt=Ie.get(Ke);return!Re&&S(tt,Ve)?null:tt},[Ie]);return[Be,ze]}function p(De){return _.useMemo(function(){var Ie=new Map,Be=new Map;return De.forEach(function(ze){Ie.set(ze.key,ze),Be.set(ze.data.value,ze)}),[Ie,Be]},[De])}var w={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},b=function(Ie,Be){var ze=Ie.prefixCls,Ke=Ie.height,Ve=Ie.itemHeight,Re=Ie.virtual,tt=Ie.options,it=Ie.flattenOptions,Me=Ie.multiple,We=Ie.searchValue,xe=Ie.onSelect,ye=Ie.onToggleOpen,Ce=Ie.open,le=Ie.notFoundContent,de=Ie.onMouseEnter,me=_.useContext(d),Ee=me.checkable,we=me.checkedKeys,Ue=me.halfCheckedKeys,Ze=me.treeExpandedKeys,at=me.treeDefaultExpandAll,vt=me.treeDefaultExpandedKeys,mt=me.onTreeExpand,Ct=me.treeIcon,Tt=me.showTreeIcon,ut=me.switcherIcon,Rt=me.treeLine,kt=me.treeNodeFilterProp,zt=me.loadData,Nt=me.treeLoadedKeys,Et=me.treeMotion,_t=me.onTreeLoad,Kt=_.useRef(),dt=Object(o.a)(function(){return tt},[Ce,tt],function(lt,$e){return $e[0]&&lt[1]!==$e[1]}),Zt=p(it),jt=Object(G.a)(Zt,2),Jt=jt[0],ar=jt[1],cr=v(Jt,ar),Er=Object(G.a)(cr,2),Ot=Er[0],ft=Er[1],or=_.useMemo(function(){return we.map(function(lt){var $e=ft(lt);return $e?$e.key:null})},[we]),xr=_.useMemo(function(){return Ee?{checked:or,halfChecked:Ue}:null},[or,Ue,Ee]);_.useEffect(function(){if(Ce&&!Me&&or.length){var lt;(lt=Kt.current)===null||lt===void 0||lt.scrollTo({key:or[0]})}},[Ce]);var ur=String(We).toLowerCase(),It=function($e){return ur?String($e[kt]).toLowerCase().includes(ur):!1},gr=_.useState(vt),sr=Object(G.a)(gr,2),Yr=sr[0],et=sr[1],Lt=_.useState(null),Kr=Object(G.a)(Lt,2),wr=Kr[0],$r=Kr[1],Gr=_.useMemo(function(){return Ze?Object(B.a)(Ze):We?wr:Yr},[Yr,wr,ur,Ze]);_.useEffect(function(){We&&$r(it.map(function(lt){return lt.key}))},[We]);var z=function($e){et($e),$r($e),mt&&mt($e)},c=function($e){$e.preventDefault()},g=function($e,gt){var yt=gt.node.key,Pt=Ot(yt,Ee?"checkbox":"select");Pt!==null&&xe(Pt.data.value,{selected:!we.includes(Pt.data.value)}),Me||ye(!1)},N=_.useState(null),q=Object(G.a)(N,2),K=q[0],Se=q[1],Qe=Ot(K);if(_.useImperativeHandle(Be,function(){return{onKeyDown:function($e){var gt,yt=$e.which;switch(yt){case h.a.UP:case h.a.DOWN:case h.a.LEFT:case h.a.RIGHT:(gt=Kt.current)===null||gt===void 0||gt.onKeyDown($e);break;case h.a.ENTER:{Qe!==null&&g(null,{node:{key:K},selected:!we.includes(Qe.data.value)});break}case h.a.ESC:ye(!1)}},onKeyUp:function(){}}}),dt.length===0)return _.createElement("div",{role:"listbox",className:"".concat(ze,"-empty"),onMouseDown:c},le);var ot={};return Nt&&(ot.loadedKeys=Nt),Gr&&(ot.expandedKeys=Gr),_.createElement("div",{onMouseDown:c,onMouseEnter:de},Qe&&Ce&&_.createElement("span",{style:w,"aria-live":"assertive"},Qe.data.value),_.createElement(u.b,Object.assign({ref:Kt,focusable:!1,prefixCls:"".concat(ze,"-tree"),treeData:dt,height:Ke,itemHeight:Ve,virtual:Re,multiple:Me,icon:Ct,showIcon:Tt,switcherIcon:ut,showLine:Rt,loadData:We?null:zt,motion:Et,checkable:Ee,checkStrictly:!0,checkedKeys:xr,selectedKeys:Ee?[]:or,defaultExpandAll:at},ot,{onActiveChange:Se,onSelect:g,onCheck:g,onExpand:z,onLoad:_t,filterTreeNode:It})))},s=_.forwardRef(b);s.displayName="OptionList";var f=s,l=function(){return null},a=l,C=re("Ff2n"),m=re("Zm9Q");function T(De){return Object(m.a)(De).map(function(Ie){if(!_.isValidElement(Ie)||!Ie.type)return null;var Be=Ie.key,ze=Ie.props,Ke=ze.children,Ve=ze.value,Re=Object(C.a)(ze,["children","value"]),tt=Object(W.a)({key:Be,value:Ve},Re),it=T(Ke);return it.length&&(tt.children=it),tt}).filter(function(Ie){return Ie})}function U(De){if(!De)return De;var Ie=Object(W.a)({},De);return"props"in Ie||Object.defineProperty(Ie,"props",{get:function(){return Object(E.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),Ie}}),Ie}function j(De,Ie,Be,ze,Ke){var Ve=null,Re=null;function tt(){function it(Me){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",xe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Me.map(function(ye,Ce){var le="".concat(We,"-").concat(Ce),de=Be.includes(ye.value),me=it(ye.children||[],le,de),Ee=_.createElement(a,Object.assign({},ye),me.map(function(Ue){return Ue.node}));if(Ie===ye.value&&(Ve=Ee),de){var we={pos:le,node:Ee,children:me};return xe||Re.push(we),we}return null}).filter(function(ye){return ye})}Re||(Re=[],it(ze),Re.sort(function(Me,We){var xe=Me.node.props.value,ye=We.node.props.value,Ce=Be.indexOf(xe),le=Be.indexOf(ye);return Ce-le}))}Object.defineProperty(De,"triggerNode",{get:function(){return Object(E.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),tt(),Ve}}),Object.defineProperty(De,"allCheckedNodes",{get:function(){return Object(E.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),tt(),Ke?Re:Re.map(function(Me){var We=Me.node;return We})}})}function F(De){return Array.isArray(De)?De:De!==void 0?[De]:[]}function V(De,Ie){var Be=new Map;return Ie.forEach(function(ze){var Ke=ze.data;Be.set(Ke.value,Ke)}),De.map(function(ze){return U(Be.get(ze))})}function P(De,Ie){var Be=V([De],Ie)[0];return Be?Be.disabled:!1}function I(De){return De.disabled||De.disableCheckbox||De.checkable===!1}function X(De){for(var Ie=De.parent,Be=0,ze=Ie;ze;)ze=ze.parent,Be+=1;return Be}function oe(De){function Ie(ze){return(ze||[]).map(function(Ke){var Ve=Ke.value,Re=Ke.key,tt=Ke.children,it=Object(W.a)(Object(W.a)({},Ke),{},{key:"key"in Ke?Re:Ve});return tt&&(it.children=Ie(tt)),it})}var Be=Object(A.d)(Ie(De),!0);return Be.map(function(ze){return{key:ze.data.key,data:ze.data,level:X(ze)}})}function pe(De){return function(Ie,Be){var ze=Be[De];return String(ze).toLowerCase().includes(String(Ie).toLowerCase())}}function ve(De,Ie,Be){var ze=Be.optionFilterProp,Ke=Be.filterOption;if(Ke===!1)return Ie;var Ve;typeof Ke=="function"?Ve=Ke:Ve=pe(ze);function Re(tt){var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return tt.map(function(Me){var We=Me.children,xe=it||Ve(De,U(Me)),ye=Re(We||[],xe);return xe||ye.length?Object(W.a)(Object(W.a)({},Me),{},{children:ye}):null}).filter(function(Me){return Me})}return Re(Ie)}function Le(De,Ie,Be,ze){var Ke=new Map;return F(Ie).forEach(function(Ve){Ve&&Object(M.a)(Ve)==="object"&&"value"in Ve&&Ke.set(Ve.value,Ve)}),De.map(function(Ve){var Re={value:Ve},tt=Be(Ve,"select",!0),it=tt?ze(tt.data):Ve;if(Ke.has(Ve)){var Me=Ke.get(Ve);Re.label="label"in Me?Me.label:it,"halfChecked"in Me&&(Re.halfChecked=Me.halfChecked)}else Re.label=it;return Re})}function ke(De,Ie){var Be=new Set(De);return Be.add(Ie),Array.from(Be)}function he(De,Ie){var Be=new Set(De);return Be.delete(Ie),Array.from(Be)}function ae(De){var Ie=De.searchPlaceholder,Be=De.treeCheckStrictly,ze=De.treeCheckable,Ke=De.labelInValue,Ve=De.value,Re=De.multiple;Object(E.a)(!Ie,"`searchPlaceholder` has been removed."),Be&&Ke===!1&&Object(E.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Ke||Be)&&Object(E.a)(F(Ve).every(function(tt){return tt&&Object(M.a)(tt)==="object"&&"value"in tt}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),Be||Re||ze?Object(E.a)(!Ve||Array.isArray(Ve),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(E.a)(!Array.isArray(Ve),"`value` should not be array when `TreeSelect` is single mode.")}var ue=ae,ie=10;function se(De,Ie){var Be=Ie.id,ze=Ie.pId,Ke=Ie.rootPId,Ve={},Re=[],tt=De.map(function(it){var Me=Object(W.a)({},it),We=Me[Be];return Ve[We]=Me,Me.key=Me.key||We,Me});return tt.forEach(function(it){var Me=it[ze],We=Ve[Me];We&&(We.children=We.children||[],We.children.push(it)),(Me===Ke||!We&&Ke===null)&&Re.push(it)}),Re}function J(De,Ie){var Be=0,ze=new Set;function Ke(Ve){return(Ve||[]).map(function(Re){var tt=Re.key,it=Re.value,Me=Re.children,We=Object(C.a)(Re,["key","value","children"]),xe="value"in Re?it:tt,ye=Object(W.a)(Object(W.a)({},We),{},{key:tt!=null?tt:xe,value:xe,title:Ie(Re)});return"children"in Re&&(ye.children=Ke(Me)),ye})}return Ke(De)}function ee(De,Ie,Be){var ze=Be.getLabelProp,Ke=Be.simpleMode,Ve=_.useRef({});return De?(Ve.current.formatTreeData=Ve.current.treeData===De?Ve.current.formatTreeData:J(Ke?se(De,Object(W.a)({id:"id",pId:"pId",rootPId:null},Ke!==!0?Ke:{})):De,ze),Ve.current.treeData=De):Ve.current.formatTreeData=Ve.current.children===Ie?Ve.current.formatTreeData:J(T(Ie),ze),Ve.current.formatTreeData}var ne="SHOW_ALL",fe="SHOW_PARENT",Ae="SHOW_CHILD";function ge(De,Ie,Be){var ze=new Set(De);return Ie===Ae?De.filter(function(Ke){var Ve=Be[Ke];return!(Ve&&Ve.children&&Ve.children.every(function(Re){var tt=Re.node;return I(tt)||ze.has(tt.key)}))}):Ie===fe?De.filter(function(Ke){var Ve=Be[Ke],Re=Ve?Ve.parent:null;return!(Re&&!I(Re.node)&&ze.has(Re.node.key))}):De}function Oe(De,Ie){var Be=Ie.value,ze=Ie.getEntityByValue,Ke=Ie.getEntityByKey,Ve=Ie.treeConduction,Re=Ie.showCheckedStrategy,tt=Ie.conductKeyEntities,it=Ie.getLabelProp;return _.useMemo(function(){var Me=De;if(Ve){var We=ge(De.map(function(xe){var ye=ze(xe);return ye?ye.key:xe}),Re,tt);Me=We.map(function(xe){var ye=Ke(xe);return ye?ye.data.value:xe})}return Le(Me,Be,ze,it)},[De,Be,Ve,Re,ze])}var Pe=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],je=Object(O.a)({prefixCls:"rc-tree-select",components:{optionList:f},convertChildrenToData:function(){return null},flattenOptions:oe,getLabeledValue:y.e,filterOptions:ve,isValueDisabled:P,findValueOption:V,omitDOMProps:function(Ie){var Be=Object(W.a)({},Ie);return Pe.forEach(function(ze){delete Be[ze]}),Be}});je.displayName="Select";var Ge=_.forwardRef(function(De,Ie){var Be=De.multiple,ze=De.treeCheckable,Ke=De.treeCheckStrictly,Ve=De.showCheckedStrategy,Re=Ve===void 0?"SHOW_CHILD":Ve,tt=De.labelInValue,it=De.loadData,Me=De.treeLoadedKeys,We=De.treeNodeFilterProp,xe=We===void 0?"value":We,ye=De.treeNodeLabelProp,Ce=De.treeDataSimpleMode,le=De.treeData,de=De.treeExpandedKeys,me=De.treeDefaultExpandedKeys,Ee=De.treeDefaultExpandAll,we=De.children,Ue=De.treeIcon,Ze=De.showTreeIcon,at=De.switcherIcon,vt=De.treeLine,mt=De.treeMotion,Ct=De.filterTreeNode,Tt=De.dropdownPopupAlign,ut=De.onChange,Rt=De.onTreeExpand,kt=De.onTreeLoad,zt=De.onDropdownVisibleChange,Nt=De.onSelect,Et=De.onDeselect,_t=ze||Ke,Kt=Be||_t,dt=ze&&!Ke,Zt=Ke||tt,jt=_.useRef(null);_.useImperativeHandle(Ie,function(){return{focus:jt.current.focus,blur:jt.current.blur}});var Jt=function(yt){return le&&yt.label||yt.title},ar=function(yt){return ye?yt[ye]:Jt(yt)},cr=ee(le,we,{getLabelProp:Jt,simpleMode:Ce}),Er=Object(_.useMemo)(function(){return oe(cr)},[cr]),Ot=p(Er),ft=Object(G.a)(Ot,2),or=ft[0],xr=ft[1],ur=v(or,xr),It=Object(G.a)(ur,2),gr=It[0],sr=It[1],Yr=Object(_.useMemo)(function(){return dt?Object(A.a)(cr):{keyEntities:null}},[cr,ze,Ke]),et=Yr.keyEntities,Lt=Object(x.a)(De.defaultValue,{value:De.value}),Kr=Object(G.a)(Lt,2),wr=Kr[0],$r=Kr[1],Gr=function(yt){var Pt=[],nr=[];return yt.forEach(function(Yt){sr(Yt)?nr.push(Yt):Pt.push(Yt)}),{missingRawValues:Pt,existRawValues:nr}},z=Object(_.useMemo)(function(){var gt=[],yt=[];if(F(wr).forEach(function(Vt){if(Vt&&Object(M.a)(Vt)==="object"&&"value"in Vt)if(Vt.halfChecked&&Ke){var Cr=sr(Vt.value);gt.push(Cr?Cr.key:Vt.value)}else yt.push(Vt.value);else yt.push(Vt)}),dt){var Pt=Gr(yt),nr=Pt.missingRawValues,Yt=Pt.existRawValues,Qt=Yt.map(function(Vt){return sr(Vt).key}),vr=Object(R.a)(Qt,!0,et),Wr=vr.checkedKeys,tr=vr.halfCheckedKeys;return[[].concat(Object(B.a)(nr),Object(B.a)(Wr.map(function(Vt){return gr(Vt).data.value}))),tr]}return[yt,gt]},[wr,Kt,Zt,ze,Ke]),c=Object(G.a)(z,2),g=c[0],N=c[1],q=Oe(g,{treeConduction:dt,value:wr,showCheckedStrategy:Re,conductKeyEntities:et,getEntityByValue:sr,getEntityByKey:gr,getLabelProp:ar}),K=function(yt,Pt,nr){if($r(Kt?yt:yt[0]),ut){var Yt=yt;if(dt&&Re!=="SHOW_ALL"){var Qt=yt.map(function(yr){var Or=sr(yr);return Or?Or.key:yr}),vr=ge(Qt,Re,et);Yt=vr.map(function(yr){var Or=gr(yr);return Or?Or.data.value:yr})}var Wr=Pt||{triggerValue:void 0,selected:void 0},tr=Wr.triggerValue,Vt=Wr.selected,Cr=Zt?Le(Yt,wr,sr,ar):Yt;if(Ke){var zr=N.map(function(yr){var Or=gr(yr);return Or?Or.data.value:yr}).filter(function(yr){return!Yt.includes(yr)});Cr=[].concat(Object(B.a)(Cr),Object(B.a)(Le(zr,wr,sr,ar)))}var ir={preValue:q,triggerValue:tr},dn=!0;(Ke||nr==="selection"&&!Vt)&&(dn=!1),j(ir,tr,yt,cr,dn),_t?ir.checked=Vt:ir.selected=Vt,ut(Kt?Cr:Cr[0],Zt?null:Yt.map(function(yr){var Or=sr(yr);return Or?ar(Or.data):null}),ir)}},Se=function(yt,Pt,nr){var Yt=yt;if(!Kt)K([yt],{selected:!0,triggerValue:yt},nr);else{var Qt=ke(g,yt);if(dt){var vr=Gr(Qt),Wr=vr.missingRawValues,tr=vr.existRawValues,Vt=tr.map(function(ir){return sr(ir).key}),Cr=Object(R.a)(Vt,!0,et),zr=Cr.checkedKeys;Qt=[].concat(Object(B.a)(Wr),Object(B.a)(zr.map(function(ir){return gr(ir).data.value})))}K(Qt,{selected:!0,triggerValue:yt},nr)}Nt&&Nt(Yt,Pt)},Qe=function(yt,Pt,nr){var Yt=yt,Qt=he(g,yt);if(dt){var vr=Gr(Qt),Wr=vr.missingRawValues,tr=vr.existRawValues,Vt=tr.map(function(ir){return sr(ir).key}),Cr=Object(R.a)(Vt,{checked:!1,halfCheckedKeys:N},et),zr=Cr.checkedKeys;Qt=[].concat(Object(B.a)(Wr),Object(B.a)(zr.map(function(ir){return gr(ir).data.value})))}K(Qt,{selected:!1,triggerValue:yt},nr),Et&&Et(Yt,Pt)},ot=function(){K([],null,"clear")},lt=_.useCallback(function(gt){if(zt){var yt={};Object.defineProperty(yt,"documentClickClose",{get:function(){return Object(E.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),zt(gt,yt)}},[zt]),$e={optionLabelProp:null,optionFilterProp:xe,dropdownAlign:Tt,internalProps:{mark:k.a,onClear:ot,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:Se,onRawDeselect:Qe}};return"filterTreeNode"in De&&($e.filterOption=Ct),_.createElement(d.Provider,{value:{checkable:_t,loadData:it,treeLoadedKeys:Me,onTreeLoad:kt,checkedKeys:g,halfCheckedKeys:N,treeDefaultExpandAll:Ee,treeExpandedKeys:de,treeDefaultExpandedKeys:me,onTreeExpand:Rt,treeIcon:Ue,treeMotion:mt,showTreeIcon:Ze,switcherIcon:at,treeLine:vt,treeNodeFilterProp:xe}},_.createElement(je,Object.assign({ref:jt,mode:Kt?"multiple":null},De,$e,{value:q,labelInValue:!0,options:cr,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:lt})))}),He=function(De){Object(D.a)(Be,De);var Ie=Object(Z.a)(Be);function Be(){var ze;return Object(ce.a)(this,Be),ze=Ie.apply(this,arguments),ze.selectRef=_.createRef(),ze.focus=function(){ze.selectRef.current.focus()},ze.blur=function(){ze.selectRef.current.blur()},ze}return Object($.a)(Be,[{key:"render",value:function(){return _.createElement(Ge,Object.assign({ref:this.selectRef},this.props))}}]),Be}(_.Component);He.TreeNode=a,He.SHOW_ALL=ne,He.SHOW_PARENT=fe,He.SHOW_CHILD=Ae;var Fe=He,qe=nt.e=Fe},"8hTe":function(wt,nt,re){wt.exports={button:"button___1wy9m"}},"8pgt":function(wt,nt,re){wt.exports={flexRow:"flexRow___2kcn2",flexColumn:"flexColumn___2bS_0",formWrap:"formWrap___3t-wi",example:"example___2J2YZ",footerWrap:"footerWrap___3u6gg"}},"9Bee":function(wt,nt,re){"use strict";var ce=re("DYRE"),$=re("zeV3"),D=re("+L6B"),Z=re("2/Rp"),B=re("k1fw"),M=re("9og8"),G=re("tJVT"),W=re("WmNS"),_=re.n(W),O=re("q1tI"),y=re.n(O),A=re("vg9a"),R=re("DlQD"),k=re.n(R),x=re("rUJ1");function E(z,c){var g=z.match(/^(\s+)(?:```)/);if(g===null)return c;var N=g[1];return c.split(`
`).map(function(q){var K=q.match(/^\s+/);if(K===null)return q;var Se=Object(G.a)(K,1),Qe=Se[0];return Qe.length>=N.length?q.slice(N.length):q}).join(`
`)}var h=[],o=["<ul>"],u=new k.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){h.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(z,c,g,N){if(c>=z.length||z[c].level<=g)return c;var q=z[c];N.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),c++;var K=[];return c=p(z,c,q.level,K),K.length>0&&(N.push("<ul>"),K.forEach(function(Se){N.push(Se)}),N.push("</ul>")),N.push("</li>"),c=p(z,c,g,N),c}function w(){return p(h,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(c){var g=d.exec(c);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(c){var g=this.rules.block.fences.exec(c);if(g){var N=g[0],q=E(N,g[3]||""),K=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(K)>=0){var Se=l(),Qe=q;q=Se,a[Se]={type:"block",expression:Qe}}return{type:"code",raw:N,lang:K,text:q}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,l=function(){return"__special_katext_id_".concat(f++,"__")},a={};function C(){return a}function m(){f=0,a={}}function T(z){return z=z.replace(s,function(c,g){var N=l();return a[N]={type:"inline",expression:g},N}),z}var U=u.listitem;u.listitem=function(z){return U(T(z))};var j=u.paragraph;u.paragraph=function(z){return j(T(z))};var F=u.tablecell;u.tablecell=function(z,c){return F(T(z),c)},u.code=function(z,c,g){var N=(c||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(g?z:Object(x.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(g?z:Object(x.escape)(z,!0))+"</code></pre>"},u.heading=function(z,c,g){var N=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:N,level:c,text:z}),"<h"+c+' id="'+N+'">'+z+"</h"+c+">"},k.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),k.a.use({tokenizer:b,renderer:u});var V=k.a,P=re("SJMd"),I=re("ulZh"),X=re.n(I),oe=re("m3rI"),pe=re("Oy/b"),ve=re("p5ED"),Le=re("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ke=function(z,c){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,N){g.__proto__=N}||function(g,N){for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(g[q]=N[q])})(z,c)};function he(z,c){function g(){this.constructor=z}ke(z,c),z.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function ae(z,c,g,N){return new(g||(g=Promise))(function(q,K){function Se(lt){try{ot(N.next(lt))}catch($e){K($e)}}function Qe(lt){try{ot(N.throw(lt))}catch($e){K($e)}}function ot(lt){var $e;lt.done?q(lt.value):($e=lt.value,$e instanceof g?$e:new g(function(gt){gt($e)})).then(Se,Qe)}ot((N=N.apply(z,c||[])).next())})}function ue(z,c){var g,N,q,K,Se={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Qe(0),throw:Qe(1),return:Qe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Qe(ot){return function(lt){return function($e){if(g)throw new TypeError("Generator is already executing.");for(;Se;)try{if(g=1,N&&(q=2&$e[0]?N.return:$e[0]?N.throw||((q=N.return)&&q.call(N),0):N.next)&&!(q=q.call(N,$e[1])).done)return q;switch(N=0,q&&($e=[2&$e[0],q.value]),$e[0]){case 0:case 1:q=$e;break;case 4:return Se.label++,{value:$e[1],done:!1};case 5:Se.label++,N=$e[1],$e=[0];continue;case 7:$e=Se.ops.pop(),Se.trys.pop();continue;default:if(!(q=Se.trys,(q=q.length>0&&q[q.length-1])||$e[0]!==6&&$e[0]!==2)){Se=0;continue}if($e[0]===3&&(!q||$e[1]>q[0]&&$e[1]<q[3])){Se.label=$e[1];break}if($e[0]===6&&Se.label<q[1]){Se.label=q[1],q=$e;break}if(q&&Se.label<q[2]){Se.label=q[2],Se.ops.push($e);break}q[2]&&Se.ops.pop(),Se.trys.pop();continue}$e=c.call(z,Se)}catch(gt){$e=[6,gt],N=0}finally{g=q=0}if(5&$e[0])throw $e[1];return{value:$e[0]?$e[1]:void 0,done:!0}}([ot,lt])}}}function ie(){for(var z=0,c=0,g=arguments.length;c<g;c++)z+=arguments[c].length;var N=Array(z),q=0;for(c=0;c<g;c++)for(var K=arguments[c],Se=0,Qe=K.length;Se<Qe;Se++,q++)N[q]=K[Se];return N}var se=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(c,g){for(var N=0,q=g;N<q.length;N++){var K=q[N],Se=K[0],Qe=K[1];c.setAttribute(Se,Qe)}},z.createRect=function(c,g,N){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",g.toString()),N&&z.setAttributes(q,N),q},z.createLine=function(c,g,N,q,K){var Se=document.createElementNS("http://www.w3.org/2000/svg","line");return Se.setAttribute("x1",c.toString()),Se.setAttribute("y1",g.toString()),Se.setAttribute("x2",N.toString()),Se.setAttribute("y2",q.toString()),K&&z.setAttributes(Se,K),Se},z.createPolygon=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",c),g&&z.setAttributes(N,g),N},z.createCircle=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(c/2).toString()),N.setAttribute("cy",(c/2).toString()),N.setAttribute("r",c.toString()),g&&z.setAttributes(N,g),N},z.createEllipse=function(c,g,N){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(g/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(g/2).toString()),N&&z.setAttributes(q,N),q},z.createGroup=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&z.setAttributes(g,c),g},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(c,g,N,q,K,Se,Qe){var ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(ot,[["id",c],["orient",g],["markerWidth",N.toString()],["markerHeight",q.toString()],["refX",K.toString()],["refY",Se.toString()]]),ot.appendChild(Qe),ot},z.createText=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),c&&z.setAttributes(g,c),g},z.createTSpan=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=c,g&&z.setAttributes(N,g),N},z.createImage=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&z.setAttributes(g,c),g},z.createPoint=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=c,N.y=g,N},z.createPath=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",c),g&&z.setAttributes(N,g),N},z}(),J=function(){function z(){}return z.addKey=function(c){z.key=c},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),ee=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(c,g,N){var q=this;return new Promise(function(K){var Se=N!==void 0?N:document.createElement("canvas");c===null&&(q.markersOnly=!0,q.naturalSize=!1);var Qe=document.createElementNS("http://www.w3.org/2000/svg","svg");Qe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Qe.setAttribute("width",g.width.baseVal.valueAsString),Qe.setAttribute("height",g.height.baseVal.valueAsString),Qe.setAttribute("viewBox","0 0 "+g.viewBox.baseVal.width.toString()+" "+g.viewBox.baseVal.height.toString()),Qe.innerHTML=g.innerHTML,q.naturalSize===!0?(Qe.width.baseVal.value=c.naturalWidth,Qe.height.baseVal.value=c.naturalHeight):q.width!==void 0&&q.height!==void 0&&(Qe.width.baseVal.value=q.width,Qe.height.baseVal.value=q.height),Se.width=Qe.width.baseVal.value,Se.height=Qe.height.baseVal.value;var ot=Qe.outerHTML,lt=Se.getContext("2d");q.markersOnly!==!0&&lt.drawImage(c,0,0,Se.width,Se.height);var $e=window.URL,gt=new Image(Se.width,Se.height);gt.setAttribute("crossOrigin","anonymous");var yt=new Blob([ot],{type:"image/svg+xml"}),Pt=$e.createObjectURL(yt);gt.onload=function(){lt.drawImage(gt,0,0),$e.revokeObjectURL(Pt);var nr=Se.toDataURL(q.imageType,q.imageQuality);K(nr)},gt.src=Pt})},z}(),ne=function(){},fe=function(){function z(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.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},z.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)},z.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 Ae("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ae("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Ae("@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;
`))},z.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Ae=function(z,c){this.selector=z,this.style=c},ge=function(z,c){this.localName=z,this.style=c},Oe=function(){function z(c,g,N,q,K){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=g,this.markerItems=N,this.uiStyleSettings=q,this.styles=K,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(c){var g=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 N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(N,'<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(K){var Se=document.createElement("div");Se.className=""+g.toolbarButtonStyleClass.name,Se.setAttribute("data-type-name",K.typeName),Se.innerHTML=K.icon,Se.addEventListener("click",function(){g.markerToolbarButtonClicked(Se,K)}),g.buttons.push(Se),g.markerButtons.push(Se)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var 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()},z.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},z.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.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 g=0;g<this.markerButtons.length;g++)g<c||g===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[g]):(g===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[g]))}},z.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")},z.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(g){g.className=g.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),g.className=g.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),g.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(c,g,N){var q=this,K=document.createElement("div");switch(K.className=""+this.toolbarButtonStyleClass.name,K.innerHTML=g,K.setAttribute("data-action",N),K.addEventListener("click",function(){q.actionToolbarButtonClicked(K,N)}),N){case"select":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":K.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":K.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":K.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":K.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(K),this.buttons.push(K)},z.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 Ae("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Ae("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(c,g){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(c,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.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)},z.prototype.setActiveMarkerButton=function(c){var g=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===c});g&&this.setActiveButton(g)},z.prototype.setCurrentMarker=function(c){var g=this;this.currentMarker=c,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){g.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},z}(),Pe=function(){function z(c,g,N,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=g,this.uiStyleSettings=N,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.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 g=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*g)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
padding: `+g+`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 Ae("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Ae("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(c){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(c){var g,N,q=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var Se;K.uiStyleSettings=q.uiStyleSettings;var Qe=document.createElement("div");Qe.className=q.toolboxButtonStyleClass.name+" "+((Se=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Se!==void 0?Se:q.toolboxButtonStyleColorsClass.name),Qe.innerHTML=K.icon,Qe.title=K.title,Qe.addEventListener("click",function(){q.panelButtonClick(K)}),q.panelButtons.push(Qe),q.buttonRow.appendChild(Qe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(c){var g=this,N=-1;if(c!==this.activePanel){N=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(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,Se){var Qe,ot;K.className=g.toolboxButtonStyleClass.name+" "+(Se===N?""+((Qe=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Qe!==void 0?Qe:g.toolboxActiveButtonStyleColorsClass.name):""+((ot=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ot!==void 0?ot:g.toolboxButtonStyleColorsClass.name))})},z}(),je=function(z,c){this.title=z,this.icon=c},Ge=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Se.colors=[],Se.addTransparent=!1,Se.colorBoxes=[],Se.colors=N,Se.currentColor=q,Se.setCurrentColor=Se.setCurrentColor.bind(Se),Se.getColorBox=Se.getColorBox.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(q){var K=g.getColorBox(q);N.appendChild(K),g.colorBoxes.push(K)}),N},c.prototype.getColorBox=function(g){var N=this,q=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-q,Se=document.createElement("div");Se.style.display="inline-block",Se.style.boxSizing="content-box",Se.style.width=K-2+"px",Se.style.height=K-2+"px",Se.style.padding="1px",Se.style.marginRight="2px",Se.style.marginBottom="2px",Se.style.borderWidth="2px",Se.style.borderStyle="solid",Se.style.borderRadius=(K+2)/2+"px",Se.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Se.addEventListener("click",function(){N.setCurrentColor(g,Se)});var Qe=document.createElement("div");return Qe.style.display="inline-block",Qe.style.width=K-2+"px",Qe.style.height=K-2+"px",Qe.style.backgroundColor=g,Qe.style.borderRadius=K/2+"px",g==="transparent"&&(Qe.style.fill=this.uiStyleSettings.toolboxAccentColor,Qe.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),Se.appendChild(Qe),Se},c.prototype.setCurrentColor=function(g,N){var q=this;this.currentColor=g,this.colorBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},c}(je),He=function(){function z(c,g,N){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=g,this.globalSettings=N,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(c){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(c,g){},z.prototype.dblClick=function(c,g){},z.prototype.manipulate=function(c){},z.prototype.pointerUp=function(c){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},z.prototype.scale=function(c,g){},z.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},z.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},z.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)}},z.typeName="MarkerBase",z}(),Fe=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.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},z}(),qe=function(){function z(){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 z.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},z}(),De=function(){function z(){}return z.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},z.toSVGMatrix=function(c,g){return c.a=g.a,c.b=g.b,c.c=g.c,c.d=g.d,c.e=g.e,c.f=g.f,c},z}(),Ie=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(se.createTransform()),K.setupControlBox(),K}return he(c,z),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(g){this._visual=g;var N=se.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(g);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(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Se=this.container.transform.baseVal.getItem(0);Se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(g){var N=this.state;z.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},c.prototype.manipulate=function(g){var N=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(g)},c.prototype.resize=function(g){var N=this.manipulationStartLeft,q=this.manipulationStartWidth,K=this.manipulationStartTop,Se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+g.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+g.y-this.manipulationStartY,Se=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Se=this.manipulationStartHeight+g.y-this.manipulationStartY}q>=0?(this.left=N,this.width=q):(this.left=N+q,this.width=-q),Se>=0?(this.top=K,this.height=Se):(this.top=K+Se,this.height=-Se),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var N=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},c.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},c.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var N=this.container.getCTM(),q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(N)).x,y:q.y}},c.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var N=this.container.getCTM();N=N.inverse();var q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(N)).x,y:q.y}},c.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var g=se.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),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 Fe,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,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 g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,N=-g/2,q=N,K=(this.width+this.CB_DISTANCE)/2-g/2,Se=(this.height+this.CB_DISTANCE)/2-g/2,Qe=this.height+this.CB_DISTANCE-g/2,ot=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,N,q),this.positionGrip(this.controlGrips.topCenter.visual,K,q),this.positionGrip(this.controlGrips.topRight.visual,ot,q),this.positionGrip(this.controlGrips.centerLeft.visual,N,Se),this.positionGrip(this.controlGrips.centerRight.visual,ot,Se),this.positionGrip(this.controlGrips.bottomLeft.visual,N,Qe),this.positionGrip(this.controlGrips.bottomCenter.visual,K,Qe),this.positionGrip(this.controlGrips.bottomRight.visual,ot,Qe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,q-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(g,N,q){var K=g.transform.baseVal.getItem(0);K.setTranslate(N,q),g.transform.baseVal.replaceItem(K,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:De.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:De.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N);var q=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:q.x*g,y:q.y*N});this.left=K.x,this.top=K.y,this.width=this.width*g,this.height=this.height*N,this.adjustControlBox()},c}(He),Be=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==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(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(g){z.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,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},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){var N=g;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.setSize()},c.title="Rectangle marker",c}(Ie),ze=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Se.widths=[],Se.widthBoxes=[],Se.widths=N,Se.currentWidth=q,Se.setCurrentWidth=Se.setCurrentWidth.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentWidth(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.innerText=q.toString(),Se.style.marginRight="5px",K.appendChild(Se);var Qe=document.createElement("div");Qe.style.minHeight="20px",Qe.style.flexGrow="2",Qe.style.display="flex",Qe.style.alignItems="center";var ot=document.createElement("hr");ot.style.minWidth="20px",ot.style.border="0px",ot.style.borderTop=q+"px solid "+g.uiStyleSettings.toolboxColor,ot.style.flexGrow="2",Qe.appendChild(ot),K.appendChild(Qe),g.widthBoxes.push(K)}),N},c.prototype.setCurrentWidth=function(g,N){var q=this;this.currentWidth=g,this.widthBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(je),Ke=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Se.styles=[],Se.styleBoxes=[],Se.styles=N,Se.currentStyle=q,Se.setCurrentStyle=Se.setCurrentStyle.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/g.styles.length-5+"%",K.style.borderColor=q===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentStyle(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.style.minHeight="20px",Se.style.flexGrow="2",Se.style.overflow="hidden";var Qe=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+g.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
</svg>`;Se.innerHTML=Qe,K.appendChild(Se),g.styleBoxes.push(K)}),N},c.prototype.setCurrentStyle=function(g,N){var q=this;this.currentStyle=g,this.styleBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(je),Ve=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(Be),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},tt=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return he(c,z),c.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(g){var N=this.state;z.prototype.pointerUp.call(this,g),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(g),this._state="select",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},c.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){z.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 g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},c.prototype.positionGrip=function(g,N,q){var K=g.transform.baseVal.getItem(0);K.setTranslate(N,q),g.transform.baseVal.replaceItem(K,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.x1=this.x1*g,this.y1=this.y1*N,this.x2=this.x2*g,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},c}(He),it=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==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(g,N){z.prototype.pointerDown.call(this,g,N),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(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,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 g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.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}(tt),Me=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Se.fonts=[],Se.fontBoxes=[],Se.fonts=N,Se.currentFont=q,Se.setCurrentFont=Se.setCurrentFont.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(q){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/g.fonts.length-5+"%",K.style.borderColor=q===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentFont(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.style.display="flex",Se.style.minHeight="20px",Se.style.flexGrow="2",Se.style.fontFamily=q,Se.style.overflow="hidden";var Qe=document.createElement("div");Qe.style.whiteSpace="nowrap",Qe.style.overflow="hidden",Qe.style.textOverflow="ellipsis",Qe.innerHTML="The quick brown fox jumps over the lazy dog",Se.appendChild(Qe),K.appendChild(Se),g.fontBoxes.push(K)}),N},c.prototype.setCurrentFont=function(g,N){var q=this;this.currentFont=g,this.fontBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(je),We=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.color="transparent",K.padding=5,K.DEFAULT_TEXT="your text here",K.text=K.DEFAULT_TEXT,K.isMoved=!1,K.color=q.defaultColor,K.fontFamily=q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setColor=K.setColor.bind(K),K.setFont=K.setFont.bind(K),K.renderText=K.renderText.bind(K),K.sizeText=K.sizeText.bind(K),K.textEditDivClicked=K.textEditDivClicked.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.setSize=K.setSize.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.colorPanel=new Ge("Color",q.defaultColorSet,q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K}return he(c,z),c.prototype.ownsTarget=function(g){if(z.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(q){q===g&&(N=!0)}),N},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(g,N){z.prototype.pointerDown.call(this,g,N),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.renderText=function(){var g=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(N){g.textElement.appendChild(se.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var g=this.textElement.getBBox(),N=1;if(g.width>0&&g.height>0){var q=(1*this.width-this.width*this.padding*2/100)/g.width,K=(1*this.height-this.height*this.padding*2/100)/g.height;N=Math.min(q,K)}return N},c.prototype.getTextPosition=function(g){var N=this.textElement.getBBox(),q=0,K=0;return N.width>0&&N.height>0&&(q=(this.width-N.width*g)/2,K=this.height/2-N.height*g/2),{x:q,y:K}},c.prototype.sizeText=function(){var g=this.textElement.getBBox(),N=this.getTextScale(),q=this.getTextPosition(N);q.y-=g.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){z.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(g){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,g),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var g=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(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&N>.9;)N-=.1,g.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var q=N.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(q)),N.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.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 g=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),K={x:q.width*g,y:q.height*g};N.x-=K.x/2,N.y-=K.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},c.prototype.dblClick=function(g,N){z.prototype.dblClick.call(this,g,N),this.showTextEditor()},c.prototype.setColor=function(g){this.textElement&&se.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},c.prototype.setFont=function(g){this.textElement&&se.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,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 g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var N=g;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),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}(Ie),xe=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=q.defaultColor,K.lineWidth=q.defaultStrokeWidth,K.pixelRatio=q.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new Ge("Color",q.defaultColorSet,q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var g=se.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,N){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(g.x,g.y),this.drawing=!0):z.prototype.pointerDown.call(this,g,N)},c.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),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(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,g)},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(),z.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=N[0],K=N[1],Se=N[2],Qe=N[3],ot=!1,lt=0;lt<this.canvasElement.height;lt++)for(var $e=0;$e<this.canvasElement.width;$e++)g.data[lt*this.canvasElement.width*4+4*$e+3]>0&&(ot=!0,lt<K&&(K=lt),$e<q&&(q=$e),lt>Qe&&(Qe=lt),$e>Se&&(Se=$e));if(ot){this.left=q/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(Se-q)/this.pixelRatio,this.height=(Qe-K)/this.pixelRatio;var gt=document.createElement("canvas");gt.width=Se-q,gt.height=Qe-K,gt.getContext("2d").putImageData(this.canvasContext.getImageData(q,K,Se-q,Qe-K),0,0),this.drawingImgUrl=gt.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(g){this.color=g,this.colorChanged(g)},c.prototype.setLineWidth=function(g){this.lineWidth=g},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 g=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){this.createVisual(),z.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),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}(Ie),ye=function(z){function c(g,N,q){var K=z.call(this,g,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return K.typeBoxes=[],K.currentType=N,K.setCurrentType=K.setCurrentType.bind(K),K}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var q=function(Qe){var ot="both";switch(Qe){case 0:ot="both";break;case 1:ot="start";break;case 2:ot="end";break;case 3:ot="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=ot===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){g.setCurrentType(ot,lt)}),N.appendChild(lt),ot==="both"||ot==="start"){var $e=document.createElement("div");$e.style.display="flex",$e.style.alignItems="center",$e.style.minHeight="20px",$e.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,$e.style.marginLeft="5px",lt.appendChild($e)}var gt=document.createElement("div");gt.style.display="flex",gt.style.alignItems="center",gt.style.minHeight="20px",gt.style.flexGrow="2";var yt=document.createElement("hr");if(yt.style.minWidth="20px",yt.style.border="0px",yt.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),yt.style.flexGrow="2",gt.appendChild(yt),lt.appendChild(gt),ot==="both"||ot==="end"){var Pt=document.createElement("div");Pt.style.display="flex",Pt.style.alignItems="center",Pt.style.minHeight="20px",Pt.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Pt.style.marginRight="5px",lt.appendChild(Pt)}K.typeBoxes.push(lt)},K=this,Se=0;Se<4;Se++)q(Se);return N},c.prototype.setCurrentType=function(g,N){var q=this;this.currentType=g,this.typeBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(je),Ce=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new ye("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},c.prototype.getArrowPoints=function(g,N){var q=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return g-q/2+","+(N+K/2)+" "+g+","+(N-K/2)+" "+(g+q/2)+","+(N+K/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(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(z.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 g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},c.prototype.setArrowType=function(g){this.arrowType=g,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 g=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.arrowType=N.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}(it),le=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor=q.defaultFillColor,K.strokeWidth=0,K.fillPanel=new Ge("Color",q.defaultColorSet,q.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(Be),de=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Se.opacities=[],Se.opacityBoxes=[],Se.opacities=N,Se.currentOpacity=q,Se.setCurrentOpacity=Se.setCurrentOpacity.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentOpacity(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.innerText=100*q+"%",K.appendChild(Se),g.opacityBoxes.push(K)}),N},c.prototype.setCurrentOpacity=function(g,N){var q=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(je),me=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=q.defaultHighlightColor,K.strokeWidth=0,K.opacity=q.defaultHighlightOpacity,K.fillPanel=new Ge("Color",q.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new de("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return he(c,z),c.prototype.setOpacity=function(g){this.opacity=g,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 g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},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(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=q.defaultStrokeColor,K.bgColor=q.defaultFillColor,K.fontFamily=q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new Ge("Text color",q.defaultColorSet,K.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>'),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new Ge("Fill color",q.defaultColorSet,K.bgColor,Ee),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new qe,K.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return he(c,z),c.prototype.ownsTarget=function(g){return z.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},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(g,N){this.state==="new"&&z.prototype.pointerDown.call(this,g,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,g,N)},c.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,g);else{var N=this.state==="creating";z.prototype.pointerUp.call(this,g),this.setTipPoints(N),this.positionTip()}},c.prototype.manipulate=function(g){if(this.tipMoving){var N=this.unrotatePoint(g);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,g)},c.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",g]]),se.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},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(g){g===void 0&&(g=!1);var N=Math.min(this.height/2,15),q=this.height/5;g&&(this.tipPosition={x:N+q/2,y:this.height+20});var K=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+q,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-q,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?K<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-q,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-q},this.tipBase2Position={x:this.width,y:this.height-N}):K<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-q})},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.positionTip()},c.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var g=this.tipGrip.visual.transform.baseVal.getItem(0);g.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(g,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(),z.prototype.select.call(this)},c.prototype.getState=function(){var g=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var N=g;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,z.prototype.restoreState.call(this,g),this.createTip(),this.setTipPoints()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.tipPosition={x:this.tipPosition.x*g,y:this.tipPosition.y*N},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),Ue=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.fillColor=q.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new Ge("Line color",ie(q.defaultColorSet,["transparent"]),q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new Ge("Fill color",ie(q.defaultColorSet,["transparent"]),K.fillColor,Ee),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new de("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==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(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){z.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(g){z.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(g){this.opacity=g,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 g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var N=g;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),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}(Ie),Ze=function(z){function c(g,N,q){return z.call(this,g,N,q)||this}return he(c,z),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==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(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(z.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 g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(g+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 g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g),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}(it),at=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokePanel.colors=q.defaultColorSet,K.fillColor="transparent",K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},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}(Ue),vt=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.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))},z.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.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}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),mt=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},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(g,N){z.prototype.pointerDown.call(this,g,N),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(N)&&(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(){z.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,z.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/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(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),z.prototype.resize.call(this,g),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(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},c.prototype.scale=function(g,N){this.curveX=this.curveX*g,this.curveY=this.curveY*N,z.prototype.scale.call(this,g,N)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.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}(tt),Ct=function(){function z(c,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=g}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Tt=function(z){function c(g,N,q){var K=z.call(this,g,!1)||this;return K.dataUrl=N,K.state=q,K}return he(c,z),c}(Ct),ut=function(z){function c(g,N,q){q===void 0&&(q=!1);var K=z.call(this,g,q)||this;return K.marker=N,K}return he(c,z),c}(Ct),Rt=function(){function z(){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 z.prototype.addEventListener=function(c,g){this[c].push(g)},z.prototype.removeEventListener=function(c,g){var N=this[c].indexOf(g);N>-1&&this[c].splice(N,1)},z}(),kt=function(){function z(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 vt,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 Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,at,Ue,me,we,Ze,le,it,mt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,Ue,me,we]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,me]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var g=this;this._availableMarkerTypes.splice(0),c.forEach(function(N){if(typeof N=="string"){var q=g.ALL_MARKER_TYPES.find(function(K){return K.typeName===N});q!==void 0&&g._availableMarkerTypes.push(q)}else g._availableMarkerTypes.push(N)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(g){return g(new Ct(c))})},z.prototype.render=function(){return ae(this,void 0,void 0,function(){var c;return ue(this,function(g){switch(g.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 g.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},z.prototype.close=function(c){var g=this;if(c===void 0&&(c=!1),this.isOpen){var N=!1;c||this.eventListeners.beforeclose.forEach(function(q){var K=new Ct(g,!0);q(K),K.defaultPrevented&&(N=!0)}),N||(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 Ct(g))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var c,g=[],N=0;N<arguments.length;N++)g[N]=arguments[N];(c=this._availableMarkerTypes).push.apply(c,g)},z.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(g){c(g.dataUrl,g.state)})},z.prototype.removeRenderEventListener=function(c){},z.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},z.prototype.removeCloseEventListener=function(c){},z.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))},z.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,g=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,N=g<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(g,N)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(c,g){this._isResizing=!0;var N=c/this.imageWidth,q=g/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(g),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(N,q),this._isResizing=!1},z.prototype.scaleMarkers=function(c,g){var N,q=this;this._currentMarker&&this._currentMarker instanceof We?this._currentMarker.scale(c,g):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(K){K!==q._currentMarker&&K.scale(c,g)}),N!==void 0&&this.setCurrentMarker(N)},z.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"},z.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=c.left-g.left,this.top=c.top-g.top},z.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)},z.prototype.addDefs=function(){for(var c,g=[],N=0;N<arguments.length;N++)g[N]=arguments[N];this.defs=se.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,g)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.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)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.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)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.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)},z.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()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 Oe(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 Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(c,g){if(c==="marker"&&g!==void 0)this.createNewMarker(g);else if(c==="action")switch(g){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()}},z.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var K=new ut(c,c._currentMarker,!0);q(K),K.defaultPrevented&&(g=!0)}),!g){var N=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 ut(c,N))})}}},z.prototype.clear=function(){var c=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Se){var Qe=new ut(c,void 0,!0);Se(Qe),Qe.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var N=function(Se){var Qe=q.markers[Se];q.setCurrentMarker(q.markers[Se]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(ot){return ot(new ut(c,Qe))})},q=this,K=this.markers.length-1;K>=0;K--)N(K);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.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))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===g.width&&N.height===g.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(K){return K(new Ct(c))})}else this.undoRedoManager.replaceLastUndoStep(g),this.eventListeners.statechange.forEach(function(K){return K(new Ct(c))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var c=this,g=this.undoRedoManager.undo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Ct(c))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var c=this,g=this.undoRedoManager.redo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Ct(c))}))},z.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},z.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},z.prototype.startRenderAndClose=function(){return ae(this,void 0,void 0,function(){var c,g,N=this;return ue(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return c=q.sent(),g=this.getState(),this.eventListeners.render.forEach(function(K){return K(new Tt(N,c,g))}),this.close(!0),[2]}})})},z.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var g={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return g.markers.push(N.getState())}),g},z.prototype.restoreState=function(c){var g=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(N){var q=g._availableMarkerTypes.find(function(Se){return Se.typeName===N.typeName});if(q!==void 0){var K=g.addNewMarker(q);K.restoreState(N),g.markers.push(K)}}),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(N){return N(new Ct(g))})},z.prototype.addNewMarker=function(c){var g=se.createGroup();return this.markerImage.appendChild(g),new c(g,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(c){var g,N=this;(g=typeof c=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(g),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(g.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new ut(N,N._currentMarker))}))},z.prototype.markerCreated=function(c){var g=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new ut(g,g._currentMarker))})},z.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},z.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},z.prototype.markerStateChanged=function(c){var g=this;this.eventListeners.markerchange.forEach(function(N){return N(new ut(g,c))})},z.prototype.setCurrentMarker=function(c){var g=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new ut(g,g._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(N){return N(new ut(g,g._currentMarker))}))},z.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 g=this.markers.find(function(N){return N.ownsTarget(c.target)});g!==void 0?(this.setCurrentMarker(g),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))},z.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var g=this.markers.find(function(N){return N.ownsTarget(c.target)});g!==void 0&&g!==this._currentMarker&&this.setCurrentMarker(g),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},z.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}))},z.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()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.markerImage.getBoundingClientRect();return{x:(c-N.left)/this.zoomLevel,y:(g-N.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.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()},z.prototype.addLicenseKey=function(c){J.addKey(c)},z.prototype.addEventListener=function(c,g){this.eventListeners.addEventListener(c,g)},z.prototype.removeEventListener=function(c,g){this.eventListeners.removeEventListener(c,g)},z.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(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.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(g){return g(new Ct(c))}))},z.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new Ct(c))}))},z.instanceCounter=0,z}();/* **********************************
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 zt=function(z,c){return(zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,N){g.__proto__=N}||function(g,N){for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(g[q]=N[q])})(z,c)};function Nt(z,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function g(){this.constructor=z}zt(z,c),z.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function Et(z,c,g,N){return new(g||(g=Promise))(function(q,K){function Se(lt){try{ot(N.next(lt))}catch($e){K($e)}}function Qe(lt){try{ot(N.throw(lt))}catch($e){K($e)}}function ot(lt){var $e;lt.done?q(lt.value):($e=lt.value,$e instanceof g?$e:new g(function(gt){gt($e)})).then(Se,Qe)}ot((N=N.apply(z,c||[])).next())})}function _t(z,c){var g,N,q,K,Se={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Qe(0),throw:Qe(1),return:Qe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Qe(ot){return function(lt){return function($e){if(g)throw new TypeError("Generator is already executing.");for(;Se;)try{if(g=1,N&&(q=2&$e[0]?N.return:$e[0]?N.throw||((q=N.return)&&q.call(N),0):N.next)&&!(q=q.call(N,$e[1])).done)return q;switch(N=0,q&&($e=[2&$e[0],q.value]),$e[0]){case 0:case 1:q=$e;break;case 4:return Se.label++,{value:$e[1],done:!1};case 5:Se.label++,N=$e[1],$e=[0];continue;case 7:$e=Se.ops.pop(),Se.trys.pop();continue;default:if(!(q=Se.trys,(q=q.length>0&&q[q.length-1])||$e[0]!==6&&$e[0]!==2)){Se=0;continue}if($e[0]===3&&(!q||$e[1]>q[0]&&$e[1]<q[3])){Se.label=$e[1];break}if($e[0]===6&&Se.label<q[1]){Se.label=q[1],q=$e;break}if(q&&Se.label<q[2]){Se.label=q[2],Se.ops.push($e);break}q[2]&&Se.ops.pop(),Se.trys.pop();continue}$e=c.call(z,Se)}catch(gt){$e=[6,gt],N=0}finally{g=q=0}if(5&$e[0])throw $e[1];return{value:$e[0]?$e[1]:void 0,done:!0}}([ot,lt])}}}var Kt=function(){function z(){}return z.addKey=function(c){z.key=c},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),dt=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(c,g){for(var N=0,q=g;N<q.length;N++){var K=q[N],Se=K[0],Qe=K[1];c.setAttribute(Se,Qe)}},z.createRect=function(c,g,N){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",g.toString()),N&&z.setAttributes(q,N),q},z.createLine=function(c,g,N,q,K){var Se=document.createElementNS("http://www.w3.org/2000/svg","line");return Se.setAttribute("x1",c.toString()),Se.setAttribute("y1",g.toString()),Se.setAttribute("x2",N.toString()),Se.setAttribute("y2",q.toString()),K&&z.setAttributes(Se,K),Se},z.createPolygon=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",c),g&&z.setAttributes(N,g),N},z.createCircle=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(c/2).toString()),N.setAttribute("cy",(c/2).toString()),N.setAttribute("r",c.toString()),g&&z.setAttributes(N,g),N},z.createEllipse=function(c,g,N){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(g/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(g/2).toString()),N&&z.setAttributes(q,N),q},z.createGroup=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&z.setAttributes(g,c),g},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(c,g,N,q,K,Se,Qe){var ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(ot,[["id",c],["orient",g],["markerWidth",N.toString()],["markerHeight",q.toString()],["refX",K.toString()],["refY",Se.toString()]]),ot.appendChild(Qe),ot},z.createText=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),c&&z.setAttributes(g,c),g},z.createTSpan=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=c,g&&z.setAttributes(N,g),N},z.createImage=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&z.setAttributes(g,c),g},z.createPoint=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=c,N.y=g,N},z.createPath=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",c),g&&z.setAttributes(N,g),N},z.createElement=function(c,g){var N=document.createElementNS("http://www.w3.org/2000/svg",c);return g&&z.setAttributes(N,g),N},z.getHollowRectanglePath=function(c,g,N,q,K,Se,Qe,ot){return"M"+c+","+g+"V"+(g+q)+"H"+(c+N)+"V"+g+"H"+K+"V"+Se+"H"+(K+Qe)+"V"+(Se+ot)+"H"+K+"V"+g+"Z"},z}(),Zt=function(){function z(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.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},z.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)},z.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 jt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Jt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Jt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),jt=function(z,c){this.selector=z,this.style=c},Jt=function(z,c){this.localName=z,this.style=c},ar=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},z.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},z.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(g){return c.appendChild(g.getUI())}),c},z}(),cr=function(){function z(){}return z.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},z}(),Er=function(z){function c(){var g=z!==null&&z.apply(this,arguments)||this;return g.buttons=[],g}return Nt(c,z),c.prototype.addButton=function(g){g.className=this.buttonClassName,g.colorsClassName=this.buttonColorsClassName,g.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(g)},c.prototype.getUI=function(){var g=z.prototype.getUI.call(this);return this.buttons.forEach(function(N){return g.appendChild(N.getUI())}),g},c}(cr),Ot=function(){function z(c,g){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=g,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),z.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},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),ft=function(z){function c(){var g=z!==null&&z.apply(this,arguments)||this;return g.elements=[],g}return Nt(c,z),c.prototype.addElement=function(g){this.elements.push(g)},c.prototype.getUI=function(){var g=z.prototype.getUI.call(this);return this.elements.forEach(function(N){return g.appendChild(N)}),g},c}(cr),or=function(){function z(c,g){this.horizontal=c,this.vertical=g}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(c){return c/this.ratio},z.prototype.getHorizontalLength=function(c){return c*this.ratio},z}(),xr=function(){function z(){}return z.getIcon=function(c,g){if(c>0&&g>0){var N=new or(c,g),q=N.ratio>=1?20:N.getHorizontalLength(20),K=N.ratio<1?20:N.getVerticalLength(20),Se=document.createElementNS("http://www.w3.org/2000/svg","svg");Se.setAttribute("xmlns","http://www.w3.org/2000/svg"),Se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Se);var Qe=dt.createDefs();Se.appendChild(Qe);var ot=dt.createElement("clipPath",[["id","text-bg-clip"]]);Qe.appendChild(ot);var lt=dt.createPath(dt.getHollowRectanglePath((24-q)/2,(24-K)/2,q,K,(24-q)/2+2,(24-K)/2+2,q-4,K-4));Se.appendChild(lt);var $e=dt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);$e.appendChild(dt.createTSpan(c+":"+g)),Se.appendChild($e);var gt=$e.getBBox();dt.setAttributes($e,[["x",((24-gt.width)/2).toString()],["y",((24-gt.height)/2-gt.y).toString()]]);var yt=dt.createPath(dt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(gt.width))/2,(24-Math.ceil(gt.height))/2,Math.ceil(gt.width),Math.ceil(gt.height)));return ot.appendChild(yt),dt.setAttributes(lt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Se),Se.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},z}(),ur=function(z){function c(g,N,q){var K=z.call(this,g,N)||this;return K.isDropdownOpen=!1,K.onClick=K.dropdownButtonClicked,K.dropdownButtons=q,K}return Nt(c,z),c.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=g.className,N.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(N.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}(Ot),It=function(){function z(c,g){this.GRIP_SIZE=10,this.color=c,this.fillColor=g,this.visual=dt.createGroup(),this.visual.appendChild(dt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(dt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},z.prototype.setCenter=function(c,g){this.visual.childNodes.forEach(function(N){return dt.setAttributes(N,[["cx",c.toString()],["cy",g.toString()]])})},z}(),gr=function(){function z(c,g,N,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=g,this.margin=N,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(z.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(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&dt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var c=this;this.cropShadeElement=dt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=dt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;g<this.numberOfGridLines;g++)this.horizontalGridLines.push(dt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(dt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return c.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return c.gridContainer.appendChild(N)}),this.cropRectElement=dt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(c){this.cropRect=c;var g=Object.assign({},this.cropRect);this.zoomFactor!==1&&(g.width=this.cropRect.width*this.zoomFactor,g.height=this.cropRect.height*this.zoomFactor,g.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-g.width/2,g.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),dt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var N=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(K,Se){var Qe=g.y+N*(Se+1);dt.setAttributes(K,[["x1",""+g.x],["y1",""+Qe],["x2",""+(g.x+g.width)],["y2",""+Qe]])});var q=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(K,Se){var Qe=g.x+q*(Se+1);dt.setAttributes(K,[["x1",""+Qe],["y1",""+g.y],["x2",""+Qe],["y2",""+(g.y+g.height)]])}),dt.setAttributes(this.cropShadeElement,[["d",dt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.container.getBoundingClientRect();return{x:c-N.left+this.margin,y:g-N.top+this.margin}},z.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)},z.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(g)}c.preventDefault()},z.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},z.prototype.move=function(c){var g=c.x-this.previousPoint.x,N=c.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},z.prototype.resize=function(c){var g=Object.assign({},this.cropRect),N=c.x-this.previousPoint.x,q=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+N<this.margin&&(N=this.margin-g.x),g.x+=N,g.width=this.cropRect.x+this.cropRect.width-g.x;break;case this.bottomRightGrip:case this.topRightGrip:g.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-g.width),g.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=q,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=q}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=c,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.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,g=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=N: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=g-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)}},z.prototype.getRescaledRect=function(c,g,N,q,K,Se){var Qe=N/c,ot=q/g;return{x:(K.x-Se)*Qe+Se,y:(K.y-Se)*ot+Se,width:K.width*Qe,height:K.height*ot}},z.prototype.scaleCanvas=function(c,g){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,g,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=g,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},z}(),sr=function(){function z(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(z.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},z.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},z.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();dt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},z.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)}},z.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 g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var q=N%5==0?this.height/3:this.height/6;g+="h4v"+-q+"h1v"+q}g+="v1H0Z",this.scaleShape=dt.createPath(g);var K=dt.createTransform();this.scaleShape.transform.baseVal.appendItem(K),c.appendChild(this.scaleShape),this.angleLabelElement=dt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=dt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Se=dt.createTSpan("");return Se.innerHTML="&deg;",this.angleLabelElement.appendChild(Se),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},z}(),Yr=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(c,g,N,q,K,Se,Qe){var ot=this;return new Promise(function(lt){var $e=document.createElement("canvas");$e.width=c.width.baseVal.value-2*q,$e.height=c.height.baseVal.value-2*q;var gt=1,yt=1;ot.naturalSize===!0?(gt=g.naturalWidth/(c.width.baseVal.value-2*q)/Se,yt=g.naturalHeight/(c.height.baseVal.value-2*q)/Qe,$e.width=g.naturalWidth/Se,$e.height=g.naturalHeight/Qe):ot.width!==void 0&&ot.height!==void 0&&(gt=ot.width/N.width,yt=ot.height/N.height,$e.width*=gt,$e.height*=yt);var Pt=$e.getContext("2d");Pt.translate($e.width/2,$e.height/2),Pt.rotate(K*Math.PI/180),Pt.scale(Se,Qe),Pt.translate(-$e.width/2,-$e.height/2),Pt.drawImage(g,0,0,$e.width,$e.height);var nr=document.createElement("canvas");nr.width=N.width*gt,nr.height=N.height*yt,nr.getContext("2d").putImageData(Pt.getImageData((N.x-q)*gt,(N.y-q)*yt,N.width*gt,N.height*yt),0,0),lt(nr.toDataURL(ot.imageType,ot.imageQuality))})},z}(),et=function(){function z(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=z.instanceCounter++,this.styles=new Zt(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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.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(z.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(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.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}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.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(g){return g()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},z.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},z.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},z.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},z.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=g+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(g,N)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",dt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(c,g){this.imageWidth=Math.round(c),this.imageHeight=Math.round(g),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()},z.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 g=c.toDataURL();dt.setAttributes(this.editingTarget,[["href",g]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=c.left-g.left-this.CANVAS_MARGIN,this.top=c.top-g.top-this.CANVAS_MARGIN},z.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=dt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=dt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=dt.createGroup(),this.editingTargetRotationScaleContainer=dt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=dt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var g=dt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(g),this.editingTargetContainer=dt.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=dt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new gr(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,g=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 "+g+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-g+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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,g=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new ar,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 g=new Er;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var N=[];this.aspectRatios.forEach(function(yt){var Pt=new Ot(xr.getIcon(yt.horizontal,yt.vertical),yt.horizontal===0&&yt.vertical===0?"FREE":yt.horizontal+":"+yt.vertical);Pt.onClick=function(){return c.ratioButtonClicked(yt)},N.push(Pt)}),this.aspectRatioButton=new ur(xr.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Ot('<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},g.addButton(q);var K=new Ot('<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(K.isActive=this.zoomToCropEnabled,K.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,K.isActive=c.zoomToCropEnabled},g.addButton(K),!Kt.isLicensed){var Se=new ft;this.topToolbar.addElementBlock(Se);var Qe=document.createElement("div");Qe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ot=document.createElement("a");ot.style.color="currentColor",ot.href="https://markerjs.com/products/cropro",ot.target="_blank",ot.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>',Qe.appendChild(ot),Se.addElement(Qe)}var lt=new Er;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var $e=new Ot('<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");$e.onClick=this.startRenderAndClose,lt.addButton($e),this.styles.settings.toolbarOkButtonStyleColorsClassName&&($e.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var gt=new Ot('<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");gt.onClick=this.close,lt.addButton(gt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(gt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new ar,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 g=new Er;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var N=new Ot('<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");N.onClick=this.rotateLeftButtonClicked,g.addButton(N);var q=new Ot('<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,g.addButton(q);var K=new ft;K.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(K),this.straightener=new sr("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},K.addElement(this.straightener.getUI());var Se=new Er;Se.minWidth=2*this.toolbarHeight+"px",Se.contentAlign="end",this.bottomToolbar.addButtonBlock(Se);var Qe=new Ot('<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");Qe.onClick=this.flipHorizontallyButtonClicked,Se.addButton(Qe);var ot=new Ot('<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");ot.onClick=this.flipVerticallyButtonClicked,Se.addButton(ot)},z.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=xr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new or(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(c){if(c){var g=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.cropImage.getBoundingClientRect();return{x:c-N.left,y:g-N.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.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()},z.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)},z.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)},z.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},z.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},z.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 g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Et(this,void 0,void 0,function(){var c,g;return _t(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return c=N.sent(),g=this.getState(),this.renderEventListeners.forEach(function(q){return q(c,g)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Et(this,void 0,void 0,function(){var c;return _t(this,function(g){switch(g.label){case 0:return(c=new Yr).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),dt.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 g.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,g.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Jt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Jt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Jt("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 Jt("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 Jt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Lt=re("8hTe"),Kr=re.n(Lt),wr=/<pre[^>]*>/g;function $r(z){var c=document.createElement("div");return c.innerHTML=z,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var Gr=nt.a=function(z){var c=z.value,g=c===void 0?"":c,N=z.edit,q=N===void 0?!1:N,K=z.className,Se=z.showTextOnly,Qe=z.showLines,ot=z.replaces,lt=z.zoomImg,$e=z.hasMask,gt=z.style,yt=gt===void 0?{}:gt,Pt=z.stylesPrev,nr=Pt===void 0?{}:Pt,Yt=String(g),Qt=Object(O.useRef)(),vr=Object(O.useRef)(),Wr=Object(O.useState)(""),tr=Object(G.a)(Wr,2),Vt=tr[0],Cr=tr[1],zr=Object(O.useState)("office"),ir=Object(G.a)(zr,2),dn=ir[0],yr=ir[1],Or=function(){var Xt=new et(vr.current);Xt.displayMode="popup",Xt.addRenderEventListener(function(){var Pr=Object(M.a)(_.a.mark(function Wt(Sr){var qt;return _.a.wrap(function(Ar){for(;;)switch(Ar.prev=Ar.next){case 0:return Qt.current.style.display="none",Ar.next=3,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Sr}});case 3:qt=Ar.sent,qt!=null&&qt.id&&ot(vr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(qt==null?void 0:qt.id,"?type=").concat(qt.content_type));case 5:case"end":return Ar.stop()}},Wt)}));return function(Wt){return Pr.apply(this,arguments)}}()),Xt.show()},Rn=function(){var Xt=new kt(vr.current);Xt.settings.displayMode="popup",Xt.addEventListener("render",function(){var Pr=Object(M.a)(_.a.mark(function Wt(Sr){var qt;return _.a.wrap(function(Ar){for(;;)switch(Ar.prev=Ar.next){case 0:if(Qt.current.style.display="none",!vr.current){Ar.next=6;break}return Ar.next=4,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Sr.dataUrl}});case 4:qt=Ar.sent,qt!=null&&qt.id&&ot(vr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(qt==null?void 0:qt.id,"?type=").concat(qt.content_type));case 6:case"end":return Ar.stop()}},Wt)}));return function(Wt){return Pr.apply(this,arguments)}}()),Xt.show(),window.markerArea=Xt},on=Object(O.useMemo)(function(){Qt.current&&(Qt.current.style.zIndex=-1);try{var hr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Xt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Yt=Yt.replace(hr,"("+oe.a.API_SERVER+"/api/attachments/").replace(Xt,'"'+oe.a.API_SERVER+"/api/attachments/").replace(Pr,'"'+oe.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(pn){}var Wt=V(Yt),Sr=C();if(Yt.match(/\[TOC\]/)&&(Wt=Wt.replace("<p>[TOC]</p>",w()),S()),Wt=Wt.replace(/(__special_katext_id_\d+__)/g,function(pn,Ar){var Nr=Sr[Ar],An=Nr.type,xn=Nr.expression;return Object(pe.renderToString)($r(xn)||"",{displayMode:An==="block",throwOnError:!1,output:"html"})}),Wt=Wt.replace(/▁/g,"\u2581\u2581\u2581"),m(),Se){var qt=document.createElement("div");return qt.innerHTML=Wt,qt.innerText}return setTimeout(function(){return Gn()},500),Wt},[Yt]),qr=Object(O.useRef)();v.WebkitLineClamp=Qe,Qe&&(yt=Object(B.a)(Object(B.a)({},yt),v));function gn(hr){var Xt=hr.target;if(Xt.tagName.toUpperCase()==="IMG"){if(lt){var Pr=Xt.getAttribute("src");Cr(Pr),yr("image")}}else if(Xt.tagName.toUpperCase()==="A"){var Wt=Xt.getAttribute("href");if(Wt.indexOf("office")>-1)hr.preventDefault(),Cr(Wt),yr("office");else if(Wt.indexOf("application/pdf")>-1)hr.preventDefault(),Cr(Wt),yr("pdf");else if(Wt.indexOf("text/html")>-1)hr.preventDefault(),Cr(Wt),yr("html");else if(Wt.startsWith("#")){hr.preventDefault();var Sr=document.getElementById(Wt.replace("#",""));Sr&&Sr.scrollIntoView(!0)}}}var Gn=function(){var Xt,Pr=(Xt=qr.current)===null||Xt===void 0?void 0:Xt.querySelectorAll("video");Pr==null||Pr.forEach(function(Wt){if(Wt.oncontextmenu=function(){return!1},Wt.src.indexOf(".m3u8")>-1&&!Wt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var Sr=new X.a;Sr.loadSource(Wt.src),Sr.attachMedia(Wt)}}})};Object(O.useEffect)(function(){if(qr.current&&on&&(on.match(wr)&&window.PR.prettyPrint()),qr.current)return qr.current.addEventListener("click",gn),function(){qr.current.removeEventListener("click",gn),m(),S()}},[on,qr.current,gn]);var vn=function(Xt){if(!q)return;Xt.target.nodeName==="IMG"?(Qt.current.style.zIndex=1,Qt.current.style.display="flex",Qt.current.style.width=Xt.target.clientWidth+"px",Qt.current.style.height=Xt.target.clientHeight+"px",Qt.current.style.top=Xt.target.offsetTop+"px",Qt.current.style.left=Xt.target.offsetLeft+"px",vr.current.src=Xt.target.getAttribute("src")):Qt.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:qr,style:Object(B.a)({},yt),className:"".concat(K||""," markdown-body ").concat(Kr.a.mdBody),onMouseOver:vn,dangerouslySetInnerHTML:{__html:on}}),y.a.createElement("div",{ref:Qt,className:Kr.a.button},y.a.createElement($.a,null,y.a.createElement(Z.a,{onClick:function(){return Or()}},"\u88C1\u526A"),y.a.createElement(Z.a,{onClick:function(){return Rn()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:vr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ve.a,{close:!0,data:Vt,type:Vt!=null&&Vt.length?dn:"",style:Object(B.a)({},nr),onClose:function(){return Cr("")}}))}},"9VGf":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return D});var ce=re("q1tI"),$=re.n(ce);function D(Z,B){var M=Object(ce.useRef)();Object(ce.useEffect)(function(){M.current=Z}),Object(ce.useEffect)(function(){function G(){M.current()}if(B!==null){var W=setInterval(G,B);return function(){return clearInterval(W)}}},[B])}},Bd2K:function(wt,nt,re){(function(ce){ce(re("VrN/"),re("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(_,O,y){if(y!=ce.Init&&y&&_.removeKeyMap("autoCloseTags"),!O)return;var A={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(A["'/'"]=function(R){return M(R)}),(typeof O!="object"||O.whenOpening!==!1)&&(A["'>'"]=function(R){return Z(R)}),_.addKeyMap(A)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Z(_){if(_.getOption("disableInput"))return ce.Pass;for(var O=_.listSelections(),y=[],A=_.getOption("autoCloseTags"),R=0;R<O.length;R++){if(!O[R].empty())return ce.Pass;var k=O[R].head,x=_.getTokenAt(k),E=ce.innerMode(_.getMode(),x.state),h=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(h),u=o&&o.name;if(!u)return ce.Pass;var d=E.mode.configuration=="html",S=typeof A=="object"&&A.dontCloseTags||d&&$,v=typeof A=="object"&&A.indentTags||d&&D;x.end>k.ch&&(u=u.slice(0,u.length-x.end+k.ch));var p=u.toLowerCase();if(!u||x.type=="string"&&(x.end!=k.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==k.ch-x.start-1||S&&G(S,p)>-1||W(_,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(h)||[],u,k,!0))return ce.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&G(w,u)>-1){y[R]={text:"/>",newPos:ce.Pos(k.line,k.ch+2)};continue}var b=v&&G(v,p)>-1;y[R]={indent:b,text:">"+(b?`
`:"")+"</"+u+">",newPos:b?ce.Pos(k.line+1,0):ce.Pos(k.line,k.ch+1)}}for(var s=typeof A=="object"&&A.dontIndentOnAutoClose,R=O.length-1;R>=0;R--){var f=y[R];_.replaceRange(f.text,O[R].head,O[R].anchor,"+insert");var l=_.listSelections().slice(0);l[R]={head:f.newPos,anchor:f.newPos},_.setSelections(l),!s&&f.indent&&(_.indentLine(f.newPos.line,null,!0),_.indentLine(f.newPos.line+1,null,!0))}}function B(_,O){for(var y=_.listSelections(),A=[],R=O?"/":"</",k=_.getOption("autoCloseTags"),x=typeof k=="object"&&k.dontIndentOnSlash,E=0;E<y.length;E++){if(!y[E].empty())return ce.Pass;var h=y[E].head,o=_.getTokenAt(h),u=ce.innerMode(_.getMode(),o.state),d=u.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return ce.Pass;var S,v=u.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(v&&u.mode.name=="javascript")S=R+"script";else if(v&&u.mode.name=="css")S=R+"style";else{var p=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(d);if(!p||p.length&&W(_,p,p[p.length-1],h))return ce.Pass;S=R+p[p.length-1]}_.getLine(h.line).charAt(o.end)!=">"&&(S+=">"),A[E]=S}if(_.replaceSelections(A),y=_.listSelections(),!x)for(var E=0;E<y.length;E++)(E==y.length-1||y[E].head.line<y[E+1].head.line)&&_.indentLine(y[E].head.line)}function M(_){return _.getOption("disableInput")?ce.Pass:B(_,!0)}ce.commands.closeTag=function(_){return B(_)};function G(_,O){if(_.indexOf)return _.indexOf(O);for(var y=0,A=_.length;y<A;++y)if(_[y]==O)return y;return-1}function W(_,O,y,A,R){if(!ce.scanForClosingTag)return!1;var k=Math.min(_.lastLine()+1,A.line+500),x=ce.scanForClosingTag(_,A,null,k);if(!x||x.tag!=y)return!1;for(var E=R?1:0,h=O.length-1;h>=0&&O[h]==y;h--)++E;A=x.to;for(var h=1;h<E;h++){var o=ce.scanForClosingTag(_,A,null,k);if(!o||o.tag!=y)return!1;A=o.to}return!0}})},BjJ7:function(wt,nt,re){"use strict";re.d(nt,"d",function(){return $}),re.d(nt,"c",function(){return D}),re.d(nt,"e",function(){return Z}),re.d(nt,"b",function(){return B}),re.d(nt,"a",function(){return G});var ce=re("m3rI");function $(W){var _=!0;if(W.length>0){for(var O=0;O<W.length;O++)if(W[O].compile_success==0||!W[O].compile_success){_=!1;break}}else _=!1;return _}function D(W){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],y=0;y<W.length;y++){var A=W[y],R=_?"".concat(_,"/").concat(A.name):"".concat(A.name);O.push({title:A.name,isLeaf:!(A.type==="tree"),key:R})}return O}function Z(W,_,O){for(var y=0;y<W.length;y++){var A=W[y];if(A.key===_){A.children=O;break}A.children&&Z(A.children,_,O)}return W}function B(W,_,O){var y;return function(){var A=this,R=arguments,k=function(){y=null,O||W.apply(A,R)},x=O&&!y;clearTimeout(y),y=setTimeout(k,_),x&&W.apply(A,R)}}var M=!0,G=ce.a.API_SERVER},"C+DQ":function(wt,nt,re){},DlQD:function(wt,nt,re){(function(ce,$){wt.exports=$()})(this,function(){"use strict";function ce(xe,ye){for(var Ce=0;Ce<ye.length;Ce++){var le=ye[Ce];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(xe,le.key,le)}}function $(xe,ye,Ce){return ye&&ce(xe.prototype,ye),Ce&&ce(xe,Ce),xe}function D(xe,ye){if(!xe)return;if(typeof xe=="string")return Z(xe,ye);var Ce=Object.prototype.toString.call(xe).slice(8,-1);if(Ce==="Object"&&xe.constructor&&(Ce=xe.constructor.name),Ce==="Map"||Ce==="Set")return Array.from(xe);if(Ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ce))return Z(xe,ye)}function Z(xe,ye){(ye==null||ye>xe.length)&&(ye=xe.length);for(var Ce=0,le=new Array(ye);Ce<ye;Ce++)le[Ce]=xe[Ce];return le}function B(xe,ye){var Ce;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(Ce=D(xe))||ye&&xe&&typeof xe.length=="number"){Ce&&(xe=Ce);var le=0;return function(){return le>=xe.length?{done:!0}:{done:!1,value:xe[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 Ce=xe[Symbol.iterator](),Ce.next.bind(Ce)}function M(xe,ye){return ye={exports:{}},xe(ye,ye.exports),ye.exports}var G=M(function(xe){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 Ce(le){xe.exports.defaults=le}xe.exports={defaults:ye(),getDefaults:ye,changeDefaults:Ce}}),W=G.defaults,_=G.getDefaults,O=G.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=function(ye){return x[ye]};function h(xe,ye){if(ye){if(y.test(xe))return xe.replace(A,E)}else if(R.test(xe))return xe.replace(k,E);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(xe){return xe.replace(o,function(ye,Ce){return Ce=Ce.toLowerCase(),Ce==="colon"?":":Ce.charAt(0)==="#"?Ce.charAt(1)==="x"?String.fromCharCode(parseInt(Ce.substring(2),16)):String.fromCharCode(+Ce.substring(1)):""})}var d=/(^|[^\[])\^/g;function S(xe,ye){xe=xe.source||xe,ye=ye||"";var Ce={replace:function(de,me){return me=me.source||me,me=me.replace(d,"$1"),xe=xe.replace(de,me),Ce},getRegex:function(){return new RegExp(xe,ye)}};return Ce}var v=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(xe,ye,Ce){if(xe){var le;try{le=decodeURIComponent(u(Ce)).replace(v,"").toLowerCase()}catch(de){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}ye&&!p.test(Ce)&&(Ce=a(ye,Ce));try{Ce=encodeURI(Ce).replace(/%25/g,"%")}catch(de){return null}return Ce}var b={},s=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,ye){b[" "+xe]||(s.test(xe)?b[" "+xe]=xe+"/":b[" "+xe]=U(xe,"/",!0)),xe=b[" "+xe];var Ce=xe.indexOf(":")===-1;return ye.substring(0,2)==="//"?Ce?ye:xe.replace(f,"$1")+ye:ye.charAt(0)==="/"?Ce?ye:xe.replace(l,"$1")+ye:xe+ye}var C={exec:function(){}};function m(xe){for(var ye=1,Ce,le;ye<arguments.length;ye++){Ce=arguments[ye];for(le in Ce)Object.prototype.hasOwnProperty.call(Ce,le)&&(xe[le]=Ce[le])}return xe}function T(xe,ye){var Ce=xe.replace(/\|/g,function(me,Ee,we){for(var Ue=!1,Ze=Ee;--Ze>=0&&we[Ze]==="\\";)Ue=!Ue;return Ue?"|":" |"}),le=Ce.split(/ \|/),de=0;if(le.length>ye)le.splice(ye);else for(;le.length<ye;)le.push("");for(;de<le.length;de++)le[de]=le[de].trim().replace(/\\\|/g,"|");return le}function U(xe,ye,Ce){var le=xe.length;if(le===0)return"";for(var de=0;de<le;){var me=xe.charAt(le-de-1);if(me===ye&&!Ce)de++;else if(me!==ye&&Ce)de++;else break}return xe.substr(0,le-de)}function j(xe,ye){if(xe.indexOf(ye[1])===-1)return-1;for(var Ce=xe.length,le=0,de=0;de<Ce;de++)if(xe[de]==="\\")de++;else if(xe[de]===ye[0])le++;else if(xe[de]===ye[1]&&(le--,le<0))return de;return-1}function F(xe){xe&&xe.sanitize&&!xe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:u,edit:S,cleanUrl:w,resolveUrl:a,noopTest:C,merge:m,splitCells:T,rtrim:U,findClosingBracket:j,checkSanitizeDeprecation:F},P=G.defaults,I=V.rtrim,X=V.splitCells,oe=V.escape,pe=V.findClosingBracket;function ve(xe,ye,Ce){var le=ye.href,de=ye.title?oe(ye.title):null,me=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:Ce,href:le,title:de,text:me}:{type:"image",raw:Ce,href:le,title:de,text:oe(me)}}function Le(xe,ye){var Ce=xe.match(/^(\s+)(?:```)/);if(Ce===null)return ye;var le=Ce[1];return ye.split(`
`).map(function(de){var me=de.match(/^\s+/);if(me===null)return de;var Ee=me[0];return Ee.length>=le.length?de.slice(le.length):de}).join(`
`)}var ke=function(){function xe(Ce){this.options=Ce||P}var ye=xe.prototype;return ye.space=function(le){var de=this.rules.block.newline.exec(le);if(de)return de[0].length>1?{type:"space",raw:de[0]}:{raw:`
`}},ye.code=function(le,de){var me=this.rules.block.code.exec(le);if(me){var Ee=de[de.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:I(we,`
`)}}},ye.fences=function(le){var de=this.rules.block.fences.exec(le);if(de){var me=de[0],Ee=Le(me,de[3]||"");return{type:"code",raw:me,lang:de[2]?de[2].trim():de[2],text:Ee}}},ye.heading=function(le){var de=this.rules.block.heading.exec(le);if(de)return{type:"heading",raw:de[0],depth:de[1].length,text:de[2]}},ye.nptable=function(le){var de=this.rules.block.nptable.exec(le);if(de){var me={type:"table",header:X(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
`):[],raw:de[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]=X(me.cells[we],me.header.length);return me}}},ye.hr=function(le){var de=this.rules.block.hr.exec(le);if(de)return{type:"hr",raw:de[0]}},ye.blockquote=function(le){var de=this.rules.block.blockquote.exec(le);if(de){var me=de[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:de[0],text:me}}},ye.list=function(le){var de=this.rules.block.list.exec(le);if(de){for(var me=de[0],Ee=de[2],we=Ee.length>1,Ue=Ee[Ee.length-1]===")",Ze={type:"list",raw:me,ordered:we,start:we?+Ee.slice(0,-1):"",loose:!1,items:[]},at=de[0].match(this.rules.block.item),vt=!1,mt,Ct,Tt,ut,Rt,kt,zt,Nt=at.length,Et=0;Et<Nt;Et++)mt=at[Et],me=mt,Ct=mt.length,mt=mt.replace(/^ *([*+-]|\d+[.)]) */,""),~mt.indexOf(`
`)&&(Ct-=mt.length,mt=this.options.pedantic?mt.replace(/^ {1,4}/gm,""):mt.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),Et!==Nt-1&&(Tt=this.rules.block.bullet.exec(at[Et+1])[0],(we?Tt.length===1||!Ue&&Tt[Tt.length-1]===")":Tt.length>1||this.options.smartLists&&Tt!==Ee)&&(ut=at.slice(Et+1).join(`
`),Ze.raw=Ze.raw.substring(0,Ze.raw.length-ut.length),Et=Nt-1)),Rt=vt||/\n\n(?!\s*$)/.test(mt),Et!==Nt-1&&(vt=mt.charAt(mt.length-1)===`
`,Rt||(Rt=vt)),Rt&&(Ze.loose=!0),kt=/^\[[ xX]\] /.test(mt),zt=void 0,kt&&(zt=mt[1]!==" ",mt=mt.replace(/^\[[ xX]\] +/,"")),Ze.items.push({type:"list_item",raw:me,task:kt,checked:zt,loose:Rt,text:mt});return Ze}},ye.html=function(le){var de=this.rules.block.html.exec(le);if(de)return{type:this.options.sanitize?"paragraph":"html",raw:de[0],pre:!this.options.sanitizer&&(de[1]==="pre"||de[1]==="script"||de[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):oe(de[0]):de[0]}},ye.def=function(le){var de=this.rules.block.def.exec(le);if(de){de[3]&&(de[3]=de[3].substring(1,de[3].length-1));var me=de[1].toLowerCase().replace(/\s+/g," ");return{tag:me,raw:de[0],href:de[2],title:de[3]}}},ye.table=function(le){var de=this.rules.block.table.exec(le);if(de){var me={type:"table",header:X(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
`):[]};if(me.header.length===me.align.length){me.raw=de[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]=X(me.cells[we].replace(/^ *\| *| *\| *$/g,""),me.header.length);return me}}},ye.lheading=function(le){var de=this.rules.block.lheading.exec(le);if(de)return{type:"heading",raw:de[0],depth:de[2].charAt(0)==="="?1:2,text:de[1]}},ye.paragraph=function(le){var de=this.rules.block.paragraph.exec(le);if(de)return{type:"paragraph",raw:de[0],text:de[1].charAt(de[1].length-1)===`
`?de[1].slice(0,-1):de[1]}},ye.text=function(le,de){var me=this.rules.block.text.exec(le);if(me){var Ee=de[de.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 de=this.rules.inline.escape.exec(le);if(de)return{type:"escape",raw:de[0],text:oe(de[1])}},ye.tag=function(le,de,me){var Ee=this.rules.inline.tag.exec(le);if(Ee)return!de&&/^<a /i.test(Ee[0])?de=!0:de&&/^<\/a>/i.test(Ee[0])&&(de=!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:de,inRawBlock:me,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]}},ye.link=function(le){var de=this.rules.inline.link.exec(le);if(de){var me=pe(de[2],"()");if(me>-1){var Ee=de[0].indexOf("!")===0?5:4,we=Ee+de[1].length+me;de[2]=de[2].substring(0,me),de[0]=de[0].substring(0,we).trim(),de[3]=""}var Ue=de[2],Ze="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ue);at?(Ue=at[1],Ze=at[3]):Ze=""}else Ze=de[3]?de[3].slice(1,-1):"";Ue=Ue.trim().replace(/^<([\s\S]*)>$/,"$1");var vt=ve(de,{href:Ue&&Ue.replace(this.rules.inline._escapes,"$1"),title:Ze&&Ze.replace(this.rules.inline._escapes,"$1")},de[0]);return vt}},ye.reflink=function(le,de){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=de[Ee.toLowerCase()],!Ee||!Ee.href){var we=me[0].charAt(0);return{type:"text",raw:we,text:we}}var Ue=ve(me,Ee,me[0]);return Ue}},ye.strong=function(le,de,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)))){de=de.slice(-1*le.length);var we=Ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var Ue;(Ee=we.exec(de))!=null;)if(Ue=this.rules.inline.strong.middle.exec(de.slice(0,Ee.index+3)),Ue)return{type:"strong",raw:le.slice(0,Ue[0].length),text:le.slice(2,Ue[0].length-2)}}},ye.em=function(le,de,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)))){de=de.slice(-1*le.length);var we=Ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var Ue;(Ee=we.exec(de))!=null;)if(Ue=this.rules.inline.em.middle.exec(de.slice(0,Ee.index+2)),Ue)return{type:"em",raw:le.slice(0,Ue[0].length),text:le.slice(1,Ue[0].length-1)}}},ye.codespan=function(le){var de=this.rules.inline.code.exec(le);if(de){var me=de[2].replace(/\n/g," "),Ee=/[^ ]/.test(me),we=me.startsWith(" ")&&me.endsWith(" ");return Ee&&we&&(me=me.substring(1,me.length-1)),me=oe(me,!0),{type:"codespan",raw:de[0],text:me}}},ye.br=function(le){var de=this.rules.inline.br.exec(le);if(de)return{type:"br",raw:de[0]}},ye.del=function(le){var de=this.rules.inline.del.exec(le);if(de)return{type:"del",raw:de[0],text:de[1]}},ye.autolink=function(le,de){var me=this.rules.inline.autolink.exec(le);if(me){var Ee,we;return me[2]==="@"?(Ee=oe(this.options.mangle?de(me[1]):me[1]),we="mailto:"+Ee):(Ee=oe(me[1]),we=Ee),{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.url=function(le,de){var me;if(me=this.rules.inline.url.exec(le)){var Ee,we;if(me[2]==="@")Ee=oe(this.options.mangle?de(me[0]):me[0]),we="mailto:"+Ee;else{var Ue;do Ue=me[0],me[0]=this.rules.inline._backpedal.exec(me[0])[0];while(Ue!==me[0]);Ee=oe(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,de,me){var Ee=this.rules.inline.text.exec(le);if(Ee){var we;return de?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]:we=oe(this.options.smartypants?me(Ee[0]):Ee[0]),{type:"text",raw:Ee[0],text:we}}},xe}(),he=V.noopTest,ae=V.edit,ue=V.merge,ie={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ae(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ae(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ae(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=ae(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ae(ie._paragraph).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.blockquote=ae(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=ue({},ie),ie.gfm=ue({},ie.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ie.gfm.nptable=ae(ie.gfm.nptable).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.gfm.table=ae(ie.gfm.table).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.pedantic=ue({},ie.normal,{html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:he,paragraph:ae(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,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",ie._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=ue({},se),se.pedantic=ue({},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=ue({},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=ue({},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:ie,inline:se},ee=G.defaults,ne=J.block,fe=J.inline;function Ae(xe){return xe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ge(xe){var ye="",Ce,le,de=xe.length;for(Ce=0;Ce<de;Ce++)le=xe.charCodeAt(Ce),Math.random()>.5&&(le="x"+le.toString(16)),ye+="&#"+le+";";return ye}var Oe=function(){function xe(Ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ce||ee,this.options.tokenizer=this.options.tokenizer||new ke,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:ne.normal,inline:fe.normal};this.options.pedantic?(le.block=ne.pedantic,le.inline=fe.pedantic):this.options.gfm&&(le.block=ne.gfm,this.options.breaks?le.inline=fe.breaks:le.inline=fe.gfm),this.tokenizer.rules=le}xe.lex=function(le,de){var me=new xe(de);return me.lex(le)};var ye=xe.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,de,me){de===void 0&&(de=[]),me===void 0&&(me=!0),le=le.replace(/^ +$/gm,"");for(var Ee,we,Ue,Ze;le;){if(Ee=this.tokenizer.space(le)){le=le.substring(Ee.raw.length),Ee.type&&de.push(Ee);continue}if(Ee=this.tokenizer.code(le,de)){le=le.substring(Ee.raw.length),Ee.type?de.push(Ee):(Ze=de[de.length-1],Ze.raw+=`
`+Ee.raw,Ze.text+=`
`+Ee.text);continue}if(Ee=this.tokenizer.fences(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.heading(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.nptable(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.hr(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.blockquote(le)){le=le.substring(Ee.raw.length),Ee.tokens=this.blockTokens(Ee.text,[],me),de.push(Ee);continue}if(Ee=this.tokenizer.list(le)){for(le=le.substring(Ee.raw.length),Ue=Ee.items.length,we=0;we<Ue;we++)Ee.items[we].tokens=this.blockTokens(Ee.items[we].text,[],!1);de.push(Ee);continue}if(Ee=this.tokenizer.html(le)){le=le.substring(Ee.raw.length),de.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),de.push(Ee);continue}if(Ee=this.tokenizer.lheading(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(me&&(Ee=this.tokenizer.paragraph(le))){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.text(le,de)){le=le.substring(Ee.raw.length),Ee.type?de.push(Ee):(Ze=de[de.length-1],Ze.raw+=`
`+Ee.raw,Ze.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 de},ye.inline=function(le){var de,me,Ee,we,Ue,Ze,at=le.length;for(de=0;de<at;de++){Ze=le[de];switch(Ze.type){case"paragraph":case"text":case"heading":{Ze.tokens=[],this.inlineTokens(Ze.text,Ze.tokens);break}case"table":{for(Ze.tokens={header:[],cells:[]},we=Ze.header.length,me=0;me<we;me++)Ze.tokens.header[me]=[],this.inlineTokens(Ze.header[me],Ze.tokens.header[me]);for(we=Ze.cells.length,me=0;me<we;me++)for(Ue=Ze.cells[me],Ze.tokens.cells[me]=[],Ee=0;Ee<Ue.length;Ee++)Ze.tokens.cells[me][Ee]=[],this.inlineTokens(Ue[Ee],Ze.tokens.cells[me][Ee]);break}case"blockquote":{this.inline(Ze.tokens);break}case"list":{for(we=Ze.items.length,me=0;me<we;me++)this.inline(Ze.items[me].tokens);break}}}return le},ye.inlineTokens=function(le,de,me,Ee,we){de===void 0&&(de=[]),me===void 0&&(me=!1),Ee===void 0&&(Ee=!1),we===void 0&&(we="");var Ue,Ze=le,at;if(this.tokens.links){var vt=Object.keys(this.tokens.links);if(vt.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(Ze))!=null;)vt.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(Ze))!=null;)Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(Ue=this.tokenizer.escape(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.tag(le,me,Ee)){le=le.substring(Ue.raw.length),me=Ue.inLink,Ee=Ue.inRawBlock,de.push(Ue);continue}if(Ue=this.tokenizer.link(le)){le=le.substring(Ue.raw.length),Ue.type==="link"&&(Ue.tokens=this.inlineTokens(Ue.text,[],!0,Ee)),de.push(Ue);continue}if(Ue=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(Ue.raw.length),Ue.type==="link"&&(Ue.tokens=this.inlineTokens(Ue.text,[],!0,Ee)),de.push(Ue);continue}if(Ue=this.tokenizer.strong(le,Ze,we)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.em(le,Ze,we)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.codespan(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.br(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.del(le)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.autolink(le,ge)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(!me&&(Ue=this.tokenizer.url(le,ge))){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.inlineText(le,Ee,Ae)){le=le.substring(Ue.raw.length),we=Ue.raw.slice(-1),de.push(Ue);continue}if(le){var mt="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(mt);break}else throw new Error(mt)}}return de},$(xe,null,[{key:"rules",get:function(){return{block:ne,inline:fe}}}]),xe}(),Pe=G.defaults,je=V.cleanUrl,Ge=V.escape,He=function(){function xe(Ce){this.options=Ce||Pe}var ye=xe.prototype;return ye.code=function(le,de,me){var Ee=(de||"").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+Ge(Ee,!0)+'">'+(me?le:Ge(le,!0))+`</code></pre>
`:"<pre><code>"+(me?le:Ge(le,!0))+`</code></pre>
`},ye.blockquote=function(le){return`<blockquote>
`+le+`</blockquote>
`},ye.html=function(le){return le},ye.heading=function(le,de,me,Ee){return this.options.headerIds?"<h"+de+' id="'+this.options.headerPrefix+Ee.slug(me)+'">'+le+"</h"+de+`>
`:"<h"+de+">"+le+"</h"+de+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(le,de,me){var Ee=de?"ol":"ul",we=de&&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,de){return de&&(de="<tbody>"+de+"</tbody>"),`<table>
<thead>
`+le+`</thead>
`+de+`</table>
`},ye.tablerow=function(le){return`<tr>
`+le+`</tr>
`},ye.tablecell=function(le,de){var me=de.header?"th":"td",Ee=de.align?"<"+me+' align="'+de.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,de,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<a href="'+Ge(le)+'"';return de&&(Ee+=' title="'+de+'"'),Ee+=">"+me+"</a>",Ee},ye.image=function(le,de,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<img src="'+le+'" alt="'+me+'"';return de&&(Ee+=' title="'+de+'"'),Ee+=this.options.xhtml?"/>":">",Ee},ye.text=function(le){return le},xe}(),Fe=function(){function xe(){}var ye=xe.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,de,me){return""+me},ye.image=function(le,de,me){return""+me},ye.br=function(){return""},xe}(),qe=function(){function xe(){this.seen={}}var ye=xe.prototype;return ye.slug=function(le){var de=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(de)){var me=de;do this.seen[me]++,de=me+"-"+this.seen[me];while(this.seen.hasOwnProperty(de))}return this.seen[de]=0,de},xe}(),De=G.defaults,Ie=V.unescape,Be=function(){function xe(Ce){this.options=Ce||De,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new qe}xe.parse=function(le,de){var me=new xe(de);return me.parse(le)};var ye=xe.prototype;return ye.parse=function(le,de){de===void 0&&(de=!0);var me="",Ee,we,Ue,Ze,at,vt,mt,Ct,Tt,ut,Rt,kt,zt,Nt,Et,_t,Kt,dt,Zt=le.length;for(Ee=0;Ee<Zt;Ee++){ut=le[Ee];switch(ut.type){case"space":continue;case"hr":{me+=this.renderer.hr();continue}case"heading":{me+=this.renderer.heading(this.parseInline(ut.tokens),ut.depth,Ie(this.parseInline(ut.tokens,this.textRenderer)),this.slugger);continue}case"code":{me+=this.renderer.code(ut.text,ut.lang,ut.escaped);continue}case"table":{for(Ct="",mt="",Ze=ut.header.length,we=0;we<Ze;we++)mt+=this.renderer.tablecell(this.parseInline(ut.tokens.header[we]),{header:!0,align:ut.align[we]});for(Ct+=this.renderer.tablerow(mt),Tt="",Ze=ut.cells.length,we=0;we<Ze;we++){for(vt=ut.tokens.cells[we],mt="",at=vt.length,Ue=0;Ue<at;Ue++)mt+=this.renderer.tablecell(this.parseInline(vt[Ue]),{header:!1,align:ut.align[Ue]});Tt+=this.renderer.tablerow(mt)}me+=this.renderer.table(Ct,Tt);continue}case"blockquote":{Tt=this.parse(ut.tokens),me+=this.renderer.blockquote(Tt);continue}case"list":{for(Rt=ut.ordered,kt=ut.start,zt=ut.loose,Ze=ut.items.length,Tt="",we=0;we<Ze;we++)Et=ut.items[we],_t=Et.checked,Kt=Et.task,Nt="",Et.task&&(dt=this.renderer.checkbox(_t),zt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=dt+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=dt+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:dt}):Nt+=dt),Nt+=this.parse(Et.tokens,zt),Tt+=this.renderer.listitem(Nt,Kt,_t);me+=this.renderer.list(Tt,Rt,kt);continue}case"html":{me+=this.renderer.html(ut.text);continue}case"paragraph":{me+=this.renderer.paragraph(this.parseInline(ut.tokens));continue}case"text":{for(Tt=ut.tokens?this.parseInline(ut.tokens):ut.text;Ee+1<Zt&&le[Ee+1].type==="text";)ut=le[++Ee],Tt+=`
`+(ut.tokens?this.parseInline(ut.tokens):ut.text);me+=de?this.renderer.paragraph(Tt):Tt;continue}default:{var jt='Token with "'+ut.type+'" type was not found.';if(this.options.silent){console.error(jt);return}else throw new Error(jt)}}}return me},ye.parseInline=function(le,de){de=de||this.renderer;var me="",Ee,we,Ue=le.length;for(Ee=0;Ee<Ue;Ee++){we=le[Ee];switch(we.type){case"escape":{me+=de.text(we.text);break}case"html":{me+=de.html(we.text);break}case"link":{me+=de.link(we.href,we.title,this.parseInline(we.tokens,de));break}case"image":{me+=de.image(we.href,we.title,we.text);break}case"strong":{me+=de.strong(this.parseInline(we.tokens,de));break}case"em":{me+=de.em(this.parseInline(we.tokens,de));break}case"codespan":{me+=de.codespan(we.text);break}case"br":{me+=de.br();break}case"del":{me+=de.del(this.parseInline(we.tokens,de));break}case"text":{me+=de.text(we.text);break}default:{var Ze='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error(Ze);return}else throw new Error(Ze)}}}return me},xe}(),ze=V.merge,Ke=V.checkSanitizeDeprecation,Ve=V.escape,Re=G.getDefaults,tt=G.changeDefaults,it=G.defaults;function Me(xe,ye,Ce){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ye=="function"&&(Ce=ye,ye=null),ye=ze({},Me.defaults,ye||{}),Ke(ye),Ce){var le=ye.highlight,de;try{de=Oe.lex(xe,ye)}catch(Ue){return Ce(Ue)}var me=function(Ze){var at;if(!Ze)try{at=Be.parse(de,ye)}catch(vt){Ze=vt}return ye.highlight=le,Ze?Ce(Ze):Ce(null,at)};if(!le||le.length<3)return me();if(delete ye.highlight,!de.length)return me();var Ee=0;Me.walkTokens(de,function(Ue){Ue.type==="code"&&(Ee++,setTimeout(function(){le(Ue.text,Ue.lang,function(Ze,at){if(Ze)return me(Ze);at!=null&&at!==Ue.text&&(Ue.text=at,Ue.escaped=!0),Ee--,Ee===0&&me()})},0))}),Ee===0&&me();return}try{var we=Oe.lex(xe,ye);return ye.walkTokens&&Me.walkTokens(we,ye.walkTokens),Be.parse(we,ye)}catch(Ue){if(Ue.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+Ve(Ue.message+"",!0)+"</pre>";throw Ue}}Me.options=Me.setOptions=function(xe){return ze(Me.defaults,xe),tt(Me.defaults),Me},Me.getDefaults=Re,Me.defaults=it,Me.use=function(xe){var ye=ze({},xe);if(xe.renderer&&function(){var le=Me.defaults.renderer||new He,de=function(we){var Ue=le[we];le[we]=function(){for(var Ze=arguments.length,at=new Array(Ze),vt=0;vt<Ze;vt++)at[vt]=arguments[vt];var mt=xe.renderer[we].apply(le,at);return mt===!1&&(mt=Ue.apply(le,at)),mt}};for(var me in xe.renderer)de(me);ye.renderer=le}(),xe.tokenizer&&function(){var le=Me.defaults.tokenizer||new ke,de=function(we){var Ue=le[we];le[we]=function(){for(var Ze=arguments.length,at=new Array(Ze),vt=0;vt<Ze;vt++)at[vt]=arguments[vt];var mt=xe.tokenizer[we].apply(le,at);return mt===!1&&(mt=Ue.apply(le,at)),mt}};for(var me in xe.tokenizer)de(me);ye.tokenizer=le}(),xe.walkTokens){var Ce=Me.defaults.walkTokens;ye.walkTokens=function(le){xe.walkTokens(le),Ce&&Ce(le)}}Me.setOptions(ye)},Me.walkTokens=function(xe,ye){for(var Ce=B(xe),le;!(le=Ce()).done;){var de=le.value;ye(de);switch(de.type){case"table":{for(var me=B(de.tokens.header),Ee;!(Ee=me()).done;){var we=Ee.value;Me.walkTokens(we,ye)}for(var Ue=B(de.tokens.cells),Ze;!(Ze=Ue()).done;)for(var at=Ze.value,vt=B(at),mt;!(mt=vt()).done;){var Ct=mt.value;Me.walkTokens(Ct,ye)}break}case"list":{Me.walkTokens(de.items,ye);break}default:de.tokens&&Me.walkTokens(de.tokens,ye)}}},Me.Parser=Be,Me.parser=Be.parse,Me.Renderer=He,Me.TextRenderer=Fe,Me.Lexer=Oe,Me.lexer=Oe.lex,Me.Tokenizer=ke,Me.Slugger=qe,Me.parse=Me;var We=Me;return We})},ELLl:function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(x,E,h){h&&h!=ce.Init&&(x.removeKeyMap(B),x.state.closeBrackets=null),E&&(M(Z(E,"pairs")),x.state.closeBrackets=E,x.addKeyMap(B))});function Z(x,E){return E=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[E]!=null?x[E]:$[E]}var B={Backspace:_,Enter:O};function M(x){for(var E=0;E<x.length;E++){var h=x.charAt(E),o="'"+h+"'";B[o]||(B[o]=G(h))}}M($.pairs+"`");function G(x){return function(E){return A(E,x)}}function W(x){var E=x.state.closeBrackets;if(!E||E.override)return E;var h=x.getModeAt(x.getCursor());return h.closeBrackets||E}function _(x){var E=W(x);if(!E||x.getOption("disableInput"))return ce.Pass;for(var h=Z(E,"pairs"),o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return ce.Pass;var d=R(x,o[u].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}for(var u=o.length-1;u>=0;u--){var S=o[u].head;x.replaceRange("",D(S.line,S.ch-1),D(S.line,S.ch+1),"+delete")}}function O(x){var E=W(x),h=E&&Z(E,"explode");if(!h||x.getOption("disableInput"))return ce.Pass;for(var o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return ce.Pass;var d=R(x,o[u].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}x.operation(function(){var S=x.lineSeparator()||`
`;x.replaceSelection(S+S,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var v=0;v<o.length;v++){var p=o[v].head.line;x.indentLine(p,null,!0),x.indentLine(p+1,null,!0)}})}function y(x){var E=ce.cmpPos(x.anchor,x.head)>0;return{anchor:new D(x.anchor.line,x.anchor.ch+(E?-1:1)),head:new D(x.head.line,x.head.ch+(E?1:-1))}}function A(x,E){var h=W(x);if(!h||x.getOption("disableInput"))return ce.Pass;var o=Z(h,"pairs"),u=o.indexOf(E);if(u==-1)return ce.Pass;for(var d=Z(h,"closeBefore"),S=Z(h,"triples"),v=o.charAt(u+1)==E,p=x.listSelections(),w=u%2==0,b,s=0;s<p.length;s++){var f=p[s],l=f.head,a,C=x.getRange(l,D(l.line,l.ch+1));if(w&&!f.empty())a="surround";else if((v||!w)&&C==E)v&&k(x,l)?a="both":S.indexOf(E)>=0&&x.getRange(l,D(l.line,l.ch+3))==E+E+E?a="skipThree":a="skip";else if(v&&l.ch>1&&S.indexOf(E)>=0&&x.getRange(D(l.line,l.ch-2),l)==E+E){if(l.ch>2&&/\bstring/.test(x.getTokenTypeAt(D(l.line,l.ch-2))))return ce.Pass;a="addFour"}else if(v){var m=l.ch==0?" ":x.getRange(D(l.line,l.ch-1),l);if(!ce.isWordChar(C)&&m!=E&&!ce.isWordChar(m))a="both";else return ce.Pass}else if(w&&(C.length===0||/\s/.test(C)||d.indexOf(C)>-1))a="both";else return ce.Pass;if(!b)b=a;else if(b!=a)return ce.Pass}var T=u%2?o.charAt(u-1):E,U=u%2?E:o.charAt(u+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 F=x.getSelections(),j=0;j<F.length;j++)F[j]=T+F[j]+U;x.replaceSelections(F,"around"),F=x.listSelections().slice();for(var j=0;j<F.length;j++)F[j]=y(F[j]);x.setSelections(F)}else b=="both"?(x.replaceSelection(T+U,null),x.triggerElectric(T+U),x.execCommand("goCharLeft")):b=="addFour"&&(x.replaceSelection(T+T+T+T,"before"),x.execCommand("goCharRight"))})}function R(x,E){var h=x.getRange(D(E.line,E.ch-1),D(E.line,E.ch+1));return h.length==2?h:null}function k(x,E){var h=x.getTokenAt(D(E.line,E.ch+1));return/\bstring/.test(h.type)&&h.start==E.ch&&(E.ch==0||!/\bstring/.test(x.getTokenTypeAt(E)))}})},GfqC:function(wt,nt,re){"use strict";var ce=re("q1tI"),$=re.n(ce),D=re("TSYQ"),Z=re.n(D);function B(V,P){var I="cannot "+V.method+" "+V.action+" "+P.status+"'",X=new Error(I);return X.status=P.status,X.method=V.method,X.url=V.action,X}function M(V){var P=V.responseText||V.response;if(!P)return P;try{return JSON.parse(P)}catch(I){return P}}function G(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 I=new FormData;V.data&&Object.keys(V.data).forEach(function(oe){var pe=V.data[oe];if(Array.isArray(pe)){pe.forEach(function(ve){I.append(oe+"[]",ve)});return}I.append(oe,V.data[oe])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),P.onerror=function(pe){V.onError(pe)},P.onload=function(){return P.status<200||P.status>=300?V.onError(B(V,P),M(P)):V.onSuccess(M(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var X=V.headers||{};return X["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(oe){X[oe]!==null&&P.setRequestHeader(oe,X[oe])}),P.send(I),{abort:function(){P.abort()}}}var W=+new Date,_=0;function O(){return"rc-upload-"+W+"-"+ ++_}function y(V,P){return V.indexOf(P,V.length-P.length)!==-1}var A=function(V,P){if(V&&P){var I=Array.isArray(P)?P:P.split(","),X=V.name||"",oe=V.type||"",pe=oe.replace(/\/.*$/,"");return I.some(function(ve){var Le=ve.trim();return Le.charAt(0)==="."?y(X.toLowerCase(),Le.toLowerCase()):/\/\*$/.test(Le)?pe===Le.replace(/\/.*$/,""):oe===Le})}return!0};function R(V,P){var I=V.createReader(),X=[];function oe(){I.readEntries(function(pe){var ve=Array.prototype.slice.apply(pe);X=X.concat(ve);var Le=!ve.length;Le?P(X):oe()})}oe()}var k=function(P,I,X){var oe=function pe(ve,Le){Le=Le||"",ve.isFile?ve.file(function(ke){X(ke)&&(ve.fullPath&&!ke.webkitRelativePath&&(Object.defineProperties(ke,{webkitRelativePath:{writable:!0}}),ke.webkitRelativePath=ve.fullPath.replace(/^\//,""),Object.defineProperties(ke,{webkitRelativePath:{writable:!1}})),I([ke]))}):ve.isDirectory&&R(ve,function(ke){ke.forEach(function(he){pe(he,""+Le+ve.name+"/")})})};P.forEach(function(pe){oe(pe.webkitGetAsEntry())})},x=k,E=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var X in I)Object.prototype.hasOwnProperty.call(I,X)&&(V[X]=I[X])}return V},h=function(){function V(P,I){var X=[],oe=!0,pe=!1,ve=void 0;try{for(var Le=P[Symbol.iterator](),ke;!(oe=(ke=Le.next()).done)&&!(X.push(ke.value),I&&X.length===I);oe=!0);}catch(he){pe=!0,ve=he}finally{try{!oe&&Le.return&&Le.return()}finally{if(pe)throw ve}}return X}return function(P,I){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return V(P,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(P,I){for(var X=0;X<I.length;X++){var oe=I[X];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(P,oe.key,oe)}}return function(P,I,X){return I&&V(P.prototype,I),X&&V(P,X),P}}();function u(V,P,I){return P in V?Object.defineProperty(V,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):V[P]=I,V}function d(V,P){var I={};for(var X in V){if(P.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;I[X]=V[X]}return I}function S(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function v(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(I,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(I[X]=P[X]),I},{})},b=function(V){p(P,V);function P(){var I,X,oe,pe;S(this,P);for(var ve=arguments.length,Le=Array(ve),ke=0;ke<ve;ke++)Le[ke]=arguments[ke];return pe=(X=(oe=v(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Le))),oe),oe.state={uid:O()},oe.reqs={},oe.onChange=function(he){var ae=he.target.files;oe.uploadFiles(ae),oe.reset()},oe.onClick=function(he){var ae=oe.fileInput;if(!ae)return;var ue=oe.props,ie=ue.children,se=ue.onClick;ie&&ie.type==="button"&&(ae.parentNode.focus(),ae.parentNode.querySelector("button").blur()),ae.click(),se&&se(he)},oe.onKeyDown=function(he){he.key==="Enter"&&oe.onClick()},oe.onFileDrop=function(he){var ae=oe.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(oe.props.directory)x(Array.prototype.slice.call(he.dataTransfer.items),oe.uploadFiles,function(ie){return A(ie,oe.props.accept)});else{var ue=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ie){return A(ie,oe.props.accept)});ae===!1&&(ue=ue.slice(0,1)),oe.uploadFiles(ue)}},oe.uploadFiles=function(he){var ae=Array.prototype.slice.call(he);ae.map(function(ue){return ue.uid=O(),ue}).forEach(function(ue){oe.upload(ue,ae)})},oe.saveFileInput=function(he){oe.fileInput=he},X),v(oe,pe)}return o(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,oe){var pe=this,ve=this.props;if(!ve.beforeUpload)return setTimeout(function(){return pe.post(X)},0);var Le=ve.beforeUpload(X,oe);Le&&Le.then?Le.then(function(ke){var he=Object.prototype.toString.call(ke);return he==="[object File]"||he==="[object Blob]"?pe.post(ke):pe.post(X)}).catch(function(ke){console.log(ke)}):Le!==!1&&setTimeout(function(){return pe.post(X)},0);return}},{key:"post",value:function(X){var oe=this;if(!this._isMounted)return;var pe=this.props,ve=pe.onStart,Le=pe.onProgress,ke=pe.transformFile,he=ke===void 0?function(ae){return ae}:ke;new Promise(function(ae){var ue=pe.action;return typeof ue=="function"&&(ue=ue(X)),ae(ue)}).then(function(ae){var ue=X.uid,ie=pe.customRequest||G,se=Promise.resolve(he(X)).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),ne=ee[0],fe=ee[1],Ae={action:ae,filename:pe.name,data:fe,file:ne,headers:pe.headers,withCredentials:pe.withCredentials,method:pe.method||"post",onProgress:Le?function(ge){Le(ge,X)}:null,onSuccess:function(Oe,Pe){delete oe.reqs[ue],pe.onSuccess(Oe,X,Pe)},onError:function(Oe,Pe){delete oe.reqs[ue],pe.onError(Oe,Pe,X)}};ve(X),oe.reqs[ue]=ie(Ae)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function(X){var oe=this.reqs;if(X){var pe=X;X&&X.uid&&(pe=X.uid),oe[pe]&&oe[pe].abort&&oe[pe].abort(),delete oe[pe]}else Object.keys(oe).forEach(function(ve){oe[ve]&&oe[ve].abort&&oe[ve].abort(),delete oe[ve]})}},{key:"render",value:function(){var X,oe=this.props,pe=oe.component,ve=oe.prefixCls,Le=oe.className,ke=oe.disabled,he=oe.id,ae=oe.style,ue=oe.multiple,ie=oe.accept,se=oe.children,J=oe.directory,ee=oe.openFileDialogOnClick,ne=oe.onMouseEnter,fe=oe.onMouseLeave,Ae=d(oe,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ge=Z()((X={},u(X,ve,!0),u(X,ve+"-disabled",ke),u(X,Le,Le),X)),Oe=ke?{}:{onClick:ee?this.onClick:function(){},onKeyDown:ee?this.onKeyDown:function(){},onMouseEnter:ne,onMouseLeave:fe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(pe,E({},Oe,{className:ge,role:"button",style:ae}),$.a.createElement("input",E({},w(Ae),{id:he,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:ue,onChange:this.onChange})),se)}}]),P}(ce.Component),s=b,f=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var X in I)Object.prototype.hasOwnProperty.call(I,X)&&(V[X]=I[X])}return V},l=function(){function V(P,I){for(var X=0;X<I.length;X++){var oe=I[X];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(P,oe.key,oe)}}return function(P,I,X){return I&&V(P.prototype,I),X&&V(P,X),P}}();function a(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function C(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 m(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 T(){}var U=function(V){m(P,V);function P(){var I,X,oe,pe;a(this,P);for(var ve=arguments.length,Le=Array(ve),ke=0;ke<ve;ke++)Le[ke]=arguments[ke];return pe=(X=(oe=C(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Le))),oe),oe.saveUploader=function(he){oe.uploader=he},X),C(oe,pe)}return l(P,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(s,f({},this.props,{ref:this.saveUploader}))}}]),P}(ce.Component);U.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:T,onError:T,onSuccess:T,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=U,F=nt.a=j},Gytx:function(wt,nt){wt.exports=function(ce,$,D,Z){var B=D?D.call(Z,ce,$):void 0;if(B!==void 0)return!!B;if(ce===$)return!0;if(typeof ce!="object"||!ce||typeof $!="object"||!$)return!1;var M=Object.keys(ce),G=Object.keys($);if(M.length!==G.length)return!1;for(var W=Object.prototype.hasOwnProperty.bind($),_=0;_<M.length;_++){var O=M[_];if(!W(O))return!1;var y=ce[O],A=$[O];if(B=D?D.call(Z,y,A,O):void 0,B===!1||B===void 0&&y!==A)return!1}return!0}},HmJG:function(wt,nt,re){},LdHM:function(wt,nt,re){"use strict";re.d(nt,"b",function(){return d}),re.d(nt,"a",function(){return v});var ce=re("1OyB"),$=re("vuIU"),D=re("Ji7U"),Z=re("LK+K"),B=re("q1tI"),M=re("rePB"),G=re("Ff2n"),W=re("ODXe"),_=re("4IlW"),O=re("bX4T"),y=re("YrtM"),A=re("TSYQ"),R=re.n(A),k=re("+nKL"),x=re("8OUc"),E=function(X,oe){var pe=X.prefixCls,ve=X.id,Le=X.flattenOptions,ke=X.childrenAsData,he=X.values,ae=X.searchValue,ue=X.multiple,ie=X.defaultActiveFirstOption,se=X.height,J=X.itemHeight,ee=X.notFoundContent,ne=X.open,fe=X.menuItemSelectedIcon,Ae=X.virtual,ge=X.onSelect,Oe=X.onToggleOpen,Pe=X.onActiveValue,je=X.onScroll,Ge=X.onMouseEnter,He="".concat(pe,"-item"),Fe=Object(y.a)(function(){return Le},[ne,Le],function(We,xe){return xe[0]&&We[1]!==xe[1]}),qe=B.useRef(null),De=function(xe){xe.preventDefault()},Ie=function(xe){qe.current&&qe.current.scrollTo({index:xe})},Be=function(xe){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ce=Fe.length,le=0;le<Ce;le+=1){var de=(xe+le*ye+Ce)%Ce,me=Fe[de],Ee=me.group,we=me.data;if(!Ee&&!we.disabled)return de}return-1},ze=B.useState(function(){return Be(0)}),Ke=Object(W.a)(ze,2),Ve=Ke[0],Re=Ke[1],tt=function(xe){Re(xe);var ye=Fe[xe];if(!ye){Pe(null,-1);return}Pe(ye.data.value,xe)};B.useEffect(function(){tt(ie!==!1?Be(0):-1)},[Fe.length,ae]),B.useEffect(function(){var We=setTimeout(function(){if(!ue&&ne&&he.size===1){var xe=Array.from(he)[0],ye=Fe.findIndex(function(Ce){var le=Ce.data;return le.value===xe});tt(ye),Ie(ye)}});return function(){return clearTimeout(We)}},[ne]);var it=function(xe){xe!==void 0&&ge(xe,{selected:!he.has(xe)}),ue||Oe(!1)};if(B.useImperativeHandle(oe,function(){return{onKeyDown:function(xe){var ye=xe.which;switch(ye){case _.a.UP:case _.a.DOWN:{var Ce=0;if(ye===_.a.UP?Ce=-1:ye===_.a.DOWN&&(Ce=1),Ce!==0){var le=Be(Ve+Ce,Ce);Ie(le),tt(le)}break}case _.a.ENTER:{var de=Fe[Ve];de&&!de.data.disabled?it(de.data.value):it(void 0),ne&&xe.preventDefault();break}case _.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(xe){Ie(xe)}}}),Fe.length===0)return B.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(He,"-empty"),onMouseDown:De},ee);function Me(We){var xe=Fe[We];if(!xe)return null;var ye=xe.data||{},Ce=ye.value,le=ye.label,de=ye.children,me=Object(O.a)(ye,!0),Ee=ke?de:le;return xe?B.createElement("div",Object.assign({"aria-label":typeof Ee=="string"?Ee:null},me,{key:We,role:"option",id:"".concat(ve,"_list_").concat(We),"aria-selected":he.has(Ce)}),Ce):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Me(Ve-1),Me(Ve),Me(Ve+1)),B.createElement(k.a,{itemKey:"key",ref:qe,data:Fe,height:se,itemHeight:J,fullHeight:!1,onMouseDown:De,onScroll:je,virtual:Ae,onMouseEnter:Ge},function(We,xe){var ye,Ce=We.group,le=We.groupOption,de=We.data,me=de.label,Ee=de.key;if(Ce)return B.createElement("div",{className:R()(He,"".concat(He,"-group"))},me!==void 0?me:Ee);var we=de.disabled,Ue=de.value,Ze=de.title,at=de.children,vt=de.style,mt=de.className,Ct=Object(G.a)(de,["disabled","value","title","children","style","className"]),Tt=he.has(Ue),ut="".concat(He,"-option"),Rt=R()(He,ut,mt,(ye={},Object(M.a)(ye,"".concat(ut,"-grouped"),le),Object(M.a)(ye,"".concat(ut,"-active"),Ve===xe&&!we),Object(M.a)(ye,"".concat(ut,"-disabled"),we),Object(M.a)(ye,"".concat(ut,"-selected"),Tt),ye)),kt=ke?at:me,zt=!fe||typeof fe=="function"||Tt;return B.createElement("div",Object.assign({},Ct,{"aria-selected":Tt,className:Rt,title:Ze,onMouseMove:function(){if(Ve===xe||we)return;tt(xe)},onClick:function(){we||it(Ue)},style:vt}),B.createElement("div",{className:"".concat(ut,"-content")},kt||Ue),B.isValidElement(fe)||Tt,zt&&B.createElement(x.a,{className:"".concat(He,"-option-state"),customizeIcon:fe,customizeIconProps:{isSelected:Tt}},Tt?"\u2713":null))}))},h=B.forwardRef(E);h.displayName="OptionList";var o=h,u=function(){return null};u.isSelectOption=!0;var d=u,S=function(){return null};S.isSelectOptGroup=!0;var v=S,p=re("VTBJ"),w=re("Zm9Q");function b(I){var X=I.key,oe=I.props,pe=oe.children,ve=oe.value,Le=Object(G.a)(oe,["children","value"]);return Object(p.a)({key:X,value:ve!==void 0?ve:X,children:pe},Le)}function s(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(I).map(function(oe,pe){if(!B.isValidElement(oe)||!oe.type)return null;var ve=oe.type.isSelectOptGroup,Le=oe.key,ke=oe.props,he=ke.children,ae=Object(G.a)(ke,["children"]);return X||!ve?b(oe):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Le===null?pe:Le,"__"),label:Le},ae),{},{options:s(he)})}).filter(function(oe){return oe})}var f=re("2Qr1"),l=re("qNPg"),a=re("U8pU"),C=re("Kwbf"),m=re("WKfj");function T(I){var X=I.mode,oe=I.options,pe=I.children,ve=I.backfill,Le=I.allowClear,ke=I.placeholder,he=I.getInputElement,ae=I.showSearch,ue=I.onSearch,ie=I.defaultOpen,se=I.autoFocus,J=I.labelInValue,ee=I.value,ne=I.inputValue,fe=I.optionLabelProp,Ae=X==="multiple"||X==="tags",ge=ae!==void 0?ae:Ae||X==="combobox",Oe=oe||s(pe);if(Object(C.a)(X!=="tags"||Oe.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Pe=Oe.some(function(He){return He.options?He.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(C.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(X!=="combobox"||!fe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(X==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(C.a)(X==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(C.b)(X!=="combobox"||!he||!Le||!ke,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ue&&!ge&&X!=="combobox"&&X!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!ie||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 je=Object(m.d)(ee);Object(C.a)(!J||je.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(C.a)(!Ae||Array.isArray(ee),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var Ge=null;Object(w.a)(pe).some(function(He){if(!B.isValidElement(He)||!He.type)return!1;var Fe=He.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var qe=Object(w.a)(He.props.children).every(function(De){return!B.isValidElement(De)||!He.type||De.type.isSelectOption?!0:(Ge=De.type,!1)});return!qe}return Ge=Fe,!0}),Ge&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ge.displayName||Ge.name||Ge,"`.")),Object(C.a)(ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var U=T,j=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:s,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:U,fillOptionsWithMissingValue:f.a}),F=function(I){Object(D.a)(oe,I);var X=Object(Z.a)(oe);function oe(){var pe;return Object(ce.a)(this,oe),pe=X.apply(this,arguments),pe.selectRef=B.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object($.a)(oe,[{key:"render",value:function(){return B.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),oe}(B.Component);F.Option=d,F.OptGroup=v;var V=F,P=nt.c=V},M8RZ:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return _});var ce=re("fWQN"),$=re("mtLc"),D=re("yKVA"),Z=re("879j"),B=re("q1tI"),M=re.n(B),G=re("i8i4"),W=re.n(G),_=function(O){Object(D.a)(A,O);var y=Object(Z.a)(A);function A(R){var k;Object(ce.a)(this,A),k=y.call(this,R);var x=window.document;return k.node=x.createElement("div"),x.body.appendChild(k.node),k}return Object($.a)(A,[{key:"render",value:function(){var k=this.props.children;return Object(G.createPortal)(k,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(M.a.Component)},NvD2:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return M});var ce=re("Kwbf");function $(G,W){var _=new Set;return G.forEach(function(O){W.has(O)||_.add(O)}),_}function D(G){var W=G||{},_=W.disabled,O=W.disableCheckbox,y=W.checkable;return!!(_||O)||y===!1}function Z(G,W,_,O){for(var y=new Set(G),A=new Set,R=0;R<=_;R+=1){var k=W.get(R)||new Set;k.forEach(function(o){var u=o.key,d=o.node,S=o.children,v=S===void 0?[]:S;y.has(u)&&!O(d)&&v.filter(function(p){return!O(p.node)}).forEach(function(p){y.add(p.key)})})}for(var x=new Set,E=_;E>=0;E-=1){var h=W.get(E)||new Set;h.forEach(function(o){var u=o.parent,d=o.node;if(O(d)||!o.parent||x.has(o.parent.key))return;if(O(o.parent.node)){x.add(u.key);return}var S=!0,v=!1;(u.children||[]).filter(function(p){return!O(p.node)}).forEach(function(p){var w=p.key,b=y.has(w);S&&!b&&(S=!1),!v&&(b||A.has(w))&&(v=!0)}),S&&y.add(u.key),v&&A.add(u.key),x.add(u.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from($(A,y))}}function B(G,W,_,O,y){for(var A=new Set(G),R=new Set(W),k=0;k<=O;k+=1){var x=_.get(k)||new Set;x.forEach(function(u){var d=u.key,S=u.node,v=u.children,p=v===void 0?[]:v;!A.has(d)&&!R.has(d)&&!y(S)&&p.filter(function(w){return!y(w.node)}).forEach(function(w){A.delete(w.key)})})}R=new Set;for(var E=new Set,h=O;h>=0;h-=1){var o=_.get(h)||new Set;o.forEach(function(u){var d=u.parent,S=u.node;if(y(S)||!u.parent||E.has(u.parent.key))return;if(y(u.parent.node)){E.add(d.key);return}var v=!0,p=!1;(d.children||[]).filter(function(w){return!y(w.node)}).forEach(function(w){var b=w.key,s=A.has(b);v&&!s&&(v=!1),!p&&(s||R.has(b))&&(p=!0)}),v||A.delete(d.key),p&&R.add(d.key),E.add(d.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from($(R,A))}}function M(G,W,_,O){var y=[],A;O?A=O:A=D;var R=new Set(G.filter(function(h){var o=!!_[h];return o||y.push(h),o})),k=new Map,x=0;Object.keys(_).forEach(function(h){var o=_[h],u=o.level,d=k.get(u);d||(d=new Set,k.set(u,d)),d.add(o),x=Math.max(x,u)}),Object(ce.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var E;return W===!0?E=Z(R,k,x,A):E=B(R,W.halfCheckedKeys,k,x,A),E}},OLES:function(wt,nt,re){"use strict";var ce=re("U8pU"),$=re("VTBJ"),D=re("Ff2n"),Z=re("q1tI"),B=re("uciX"),M=re("7ixt"),G=function(R){var k=R.overlay,x=R.prefixCls,E=R.id,h=R.overlayInnerStyle;return Z.createElement("div",{className:"".concat(x,"-inner"),id:E,role:"tooltip",style:h},typeof k=="function"?k():k)},W=G,_=function(R,k){var x=R.overlayClassName,E=R.trigger,h=E===void 0?["hover"]:E,o=R.mouseEnterDelay,u=o===void 0?0:o,d=R.mouseLeaveDelay,S=d===void 0?.1:d,v=R.overlayStyle,p=R.prefixCls,w=p===void 0?"rc-tooltip":p,b=R.children,s=R.onVisibleChange,f=R.afterVisibleChange,l=R.transitionName,a=R.animation,C=R.placement,m=C===void 0?"right":C,T=R.align,U=T===void 0?{}:T,j=R.destroyTooltipOnHide,F=j===void 0?!1:j,V=R.defaultVisible,P=R.getTooltipContainer,I=R.overlayInnerStyle,X=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),oe=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(k,function(){return oe.current});var pe=Object($.a)({},X);"visible"in R&&(pe.popupVisible=R.visible);var ve=function(){var ue=R.arrowContent,ie=ue===void 0?null:ue,se=R.overlay,J=R.id;return[Z.createElement("div",{className:"".concat(w,"-arrow"),key:"arrow"},ie),Z.createElement(W,{key:"content",prefixCls:w,id:J,overlay:se,overlayInnerStyle:I})]},Le=!1,ke=!1;if(typeof F=="boolean")Le=F;else if(F&&Object(ce.a)(F)==="object"){var he=F.keepParent;Le=he===!0,ke=he===!1}return Z.createElement(B.a,Object.assign({popupClassName:x,prefixCls:w,popup:ve,action:h,builtinPlacements:M.a,popupPlacement:m,ref:oe,popupAlign:U,getPopupContainer:P,onPopupVisibleChange:s,afterPopupVisibleChange:f,popupTransitionName:l,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Le,autoDestroy:ke,mouseLeaveDelay:S,popupStyle:v,mouseEnterDelay:u},pe),b)},O=Object(Z.forwardRef)(_),y=nt.a=O},OZM5:function(wt,nt,re){"use strict";re.d(nt,"b",function(){return O}),re.d(nt,"a",function(){return y}),re.d(nt,"k",function(){return A}),re.d(nt,"h",function(){return R}),re.d(nt,"i",function(){return k}),re.d(nt,"g",function(){return x}),re.d(nt,"c",function(){return E}),re.d(nt,"d",function(){return h}),re.d(nt,"j",function(){return d}),re.d(nt,"e",function(){return S}),re.d(nt,"f",function(){return v});var ce=re("KQm4"),$=re("U8pU"),D=re("Ff2n"),Z=re("q1tI"),B=re.n(Z),M=re("Kwbf"),G=re("WaYH"),W=.25,_=2;function O(p,w){var b=p.slice(),s=b.indexOf(w);return s>=0&&b.splice(s,1),b}function y(p,w){var b=p.slice();return b.indexOf(w)===-1&&b.push(w),b}function A(p){return p.split("-")}function R(p,w){return"".concat(p,"-").concat(w)}function k(p){return p&&p.type&&p.type.isTreeNode}function x(p,w){var b=[p],s=w[p];function f(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];l.forEach(function(a){var C=a.key,m=a.children;b.push(C),f(m)})}return f(s.children),b}function E(p,w){var b=p.clientY,s=w.selectHandle.getBoundingClientRect(),f=s.top,l=s.bottom,a=s.height,C=Math.max(a*W,_);return b<=f+C?-1:b>=l-C?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 u(p,w){if(!p)return[];var b=w||{},s=b.processProps,f=s===void 0?o:s,l=Array.isArray(p)?p:[p];return l.map(function(a){var C=a.children,m=Object(D.a)(a,["children"]),T=u(C,w);return B.a.createElement(G.a,Object.assign({},f(m)),T)})}function d(p){if(!p)return null;var w;if(Array.isArray(p))w={checkedKeys:p,halfCheckedKeys:void 0};else if(Object($.a)(p)==="object")w={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(M.a)(!1,"`checkedKeys` is not an array or an object"),null;return w}function S(p,w){var b=new Set;function s(f){if(b.has(f))return;var l=w[f];if(!l)return;b.add(f);var a=l.parent,C=l.node;if(C.disabled)return;a&&s(a.key)}return(p||[]).forEach(function(f){s(f)}),Object(ce.a)(b)}function v(p){var w={};return Object.keys(p).forEach(function(b){(b.startsWith("data-")||b.startsWith("aria-"))&&(w[b]=p[b])}),w}},Ot1p:function(wt,nt,re){"use strict";var ce=re("2qtc"),$=re("kLXV"),D=re("rAM+"),Z=re("miYZ"),B=re("tsqr"),M=re("9og8"),G=re("tJVT"),W=re("jrin"),_=re("WmNS"),O=re.n(_),y=re("q1tI"),A=re.n(y),R=re("VrN/"),k=re.n(R),x=re("bdgK"),E=re("p77/"),h=re("Bd2K"),o=re("ELLl"),u=re("19Vz"),d=re("lZu9"),S=re("+NIl"),v=re("kSUc"),p=re("9Bee"),w=function(we){var Ue=we.value,Ze=Ue===void 0?"":Ue,at=we.className,vt=we.showTextOnly,mt=we.showLines,Ct=we.style,Tt=Ct===void 0?{}:Ct,ut=Object(y.useMemo)(function(){return""},[Ze]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:ut}}))},b=re("0Owb"),s=re("dejd"),f=re("C+DQ"),l=re("1vsH"),a=re("m3rI"),C=[{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 m(we){var Ue=we.onActionCallback,Ze=we.title,at=we.icon,vt=we.actionName,mt=we.className,Ct=mt===void 0?"":mt,Tt=we.children;function ut(){Ue(vt)}return A.a.createElement("a",{title:Ze,className:Ct,onClick:ut},A.a.createElement("i",{className:"md-iconfont ".concat(at)}),Tt)}var T=function(we){var Ue=we.watch,Ze=we.showNullButton,at=we.onActionCallback,vt=we.fullScreen,mt=we.insertTemp,Ct=we.hidetoolBar,Tt=we.uuid,ut=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(Tt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Rt=[].concat(C,[{title:"".concat(Ue?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ue?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Rt.map(function(kt,zt){return A.a.createElement("li",{key:zt},kt.actionName?A.a.createElement(m,Object(b.a)({},kt,{onActionCallback:at})):A.a.createElement("span",{className:"v-line"}))}),Ze?A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,mt&&A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(mt),onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(m,{icon:"".concat(vt?"icon-shrink":"icon-enlarge"),title:vt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:at})))},U=re("M8RZ"),j=re("+L6B"),F=re("2/Rp"),V=re("y8nQ"),P=re("Vl3Y"),I=re("5NDa"),X=re("5rEg"),oe={labelCol:{span:4},wrapperCol:{span:20}},pe=function(we){var Ue=we.callback,Ze=we.onCancel;function at(vt){Ue(vt)}return A.a.createElement(P.a,Object(b.a)({},oe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:at}),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(X.a,null)),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(X.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},ve=re("7ahc"),Le=re("HmJG"),ke=re("BjJ7"),he=P.a.useForm,ae={width:280,marginRight:10},ue={labelCol:{span:5},wrapperCol:{span:19}},ie=function(we){var Ue=we.callback,Ze=we.onCancel,at=he(),vt=Object(G.a)(at,1),mt=vt[0];function Ct(Rt){Ue(Rt)}function Tt(Rt,kt){if(Rt.status===-1){B.b.error(Rt.message);return}mt.setFieldsValue({src:"/api/attachments/".concat(Rt.id),type:kt.type})}function ut(Rt){var kt=Rt.target.files[0];J(kt,Tt)}return A.a.createElement(P.a,Object(b.a)({form:mt},ue,{className:"upload-image-panel",onFinish:Ct}),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(X.a,{style:ae})),A.a.createElement(se,{onFileChange:ut}))),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(X.a,{style:{width:264}})),A.a.createElement(P.a.Item,{style:{textAlign:"right"}},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))};function se(we){var Ue=we.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ue}))}function J(we,Ue){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ze=new FormData;Ze.append("editormd-image-file",we),Ze.append("file_param_name","editormd-image-file"),Ze.append("byxhr","true");var at=new window.XMLHttpRequest;at.withCredentials=!0,at.addEventListener("load",function(vt){Ue(JSON.parse(vt.target.responseText),we)},!1),at.addEventListener("error",function(vt){console.error(vt)},!1),at.open("POST","".concat(ke.a,"/api/attachments.json")),at.send(Ze)}var ee=re("giR+"),ne=re("fyUT"),fe=re("7Kak"),Ae=re("9yH6"),ge=Ae.a.Group,Oe={margin:"0 8px"},Pe=function(we){var Ue=we.callback,Ze=we.onCancel;function at(vt){Ue(vt)}return A.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:at},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Oe},"\u884C\u6570"),A.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ne.a,null)),A.a.createElement("span",{style:Oe},"\u5217\u6570"),A.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ne.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(P.a.Item,{name:"align"},A.a.createElement(ge,null,A.a.createElement(Ae.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Ae.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Ae.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Ae.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},je=re("ErOA"),Ge=re("7Cbv"),He="link",Fe="upload-image",qe="code-block",De="add-table",Ie="------------",Be={default:Ie,left:":".concat(Ie),center:":".concat(Ie,":"),right:"".concat(Ie,":")},ze=re("9VGf"),Ke,Ve;function Re(){}var tt=0,it=1e4,Me="\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 xe(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ce=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"],de=(Ke={},Object(W.a)(Ke,Ce+"-B","bold"),Object(W.a)(Ke,Ce+"-I","italic"),Ke),me=(Ve={},Object(W.a)(Ve,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(Ve,qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(Ve,Fe,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(Ve,De,"\u6DFB\u52A0\u8868\u683C"),Ve),Ee=nt.a=function(we){var Ue=we.defaultValue,Ze=Ue===void 0?"":Ue,at=we.onChange,vt=we.width,mt=vt===void 0?"100%":vt,Ct=we.height,Tt=Ct===void 0?400:Ct,ut=we.miniToolbar,Rt=ut===void 0?!1:ut,kt=we.isFocus,zt=kt===void 0?!1:kt,Nt=we.watch,Et=we.insertTemp,_t=we.mode,Kt=_t===void 0?"markdown":_t,dt=we.id,Zt=dt===void 0?"markdown-editor-id":dt,jt=we.showResizeBar,Jt=jt===void 0?!1:jt,ar=we.noStorage,cr=ar===void 0?!1:ar,Er=we.showNullButton,Ot=Er===void 0?!1:Er,ft=we.hidetoolBar,or=ft===void 0?!1:ft,xr=we.fullScreen,ur=xr===void 0?!1:xr,It=we.onBlur,gr=we.onCMBeforeChange,sr=we.onFullScreen,Yr=we.className,et=Yr===void 0?"":Yr,Lt=we.disablePaste,Kr=Lt===void 0?!1:Lt,wr=we.placeholder,$r=wr===void 0?"":wr,Gr=we.values,z=Gr===void 0?"":Gr,c=Object(y.useState)(null),g=Object(G.a)(c,2),N=g[0],q=g[1],K=Object(y.useState)(Ze),Se=Object(G.a)(K,2),Qe=Se[0],ot=Se[1],lt=Object(y.useState)(Nt),$e=Object(G.a)(lt,2),gt=$e[0],yt=$e[1],Pt=Object(y.useState)(ur),nr=Object(G.a)(Pt,2),Yt=nr[0],Qt=nr[1],vr=Object(y.useState)(""),Wr=Object(G.a)(vr,2),tr=Wr[0],Vt=Wr[1],Cr=Object(y.useState)(0),zr=Object(G.a)(Cr,2),ir=zr[0],dn=zr[1],yr=Object(y.useState)(Tt),Or=Object(G.a)(yr,2),Rn=Or[0],on=Or[1],qr=Object(y.useState)(!1),gn=Object(G.a)(qr,2),Gn=gn[0],vn=gn[1],hr=Object(y.useRef)(Object(Ge.a)()),Xt=Object(y.useRef)(!1),Pr=Object(y.useRef)(),Wt=Object(y.useRef)(),Sr=Object(y.useRef)(),qt=Object(y.useRef)(),pn=Object(y.useRef)(),Ar=function(){var Xe=Object(M.a)(O.a.mark(function Ye(){var pt,xt;return O.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:hr.current}});case 2:xt=$t.sent,xt!=null&&(pt=xt.attachments)!==null&&pt!==void 0&&pt.length&&(console.log("cm:",N,Wt),xt.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?N.replaceSelection("![,](/api/attachments/".concat(Bt.id,"?type=").concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Bt.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,'&disposition=inline" target="_blank">').concat(Bt.name,"</a>")):N.replaceSelection("[".concat(Bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return $t.stop()}},Ye)}));return function(){return Xe.apply(this,arguments)}}();Object(y.useEffect)(function(){ot(z),N==null||N.setValue(z)},[z]),Object(y.useEffect)(function(){sr==null||sr(Yt)},[Yt]),Object(y.useEffect)(function(){if(Wt.current){var Xe=k.a.fromTextArea(Wt.current,{mode:Kt,lineNumbers:!Rt,lineWrapping:!0,value:Ze,autoCloseTags:!0,autoCloseBrackets:!0});zt&&Xe.focus();function Ye(pt,xt){if(Kr){xt.preventDefault();return}var Mt=xt.clipboardData;if(Mt){var $t=Mt.types.toString(),Bt=Mt.items;if($t==="Files"||Mt.types.indexOf("Files")>-1){if(xt.preventDefault(),Kt=="stex")return;try{var dr,Lr=Bt[1];((dr=Bt[0])===null||dr===void 0?void 0:dr.kind)==="file"&&(Lr=Bt[0]);var Ft=Lr.getAsFile(),Zr=Ft.name.split(".").pop();J(Ft,function(Gt){if(Gt.id){var kr,pr,Mr;(Ft==null||((kr=Ft.type)===null||kr===void 0)?void 0:kr.indexOf("image"))>-1?Xe.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):(Ft==null||((pr=Ft.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?Xe.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Ft==null||((Mr=Ft.type)===null||Mr===void 0)?void 0:Mr.indexOf("pdf"))>-1?Xe.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):le.includes(Zr)?Xe.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):Xe.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Xe.on("paste",Ye),Xe.on("dragleave",function(pt,xt){Sr.current.classList.remove("mouse-hover-md")}),Xe.on("dragover",function(pt,xt){Sr.current.classList.add("mouse-hover-md")}),Xe.on("drop",function(pt,xt){Sr.current.classList.add("mouse-hover-md");var Mt;if(Mt=xt.dataTransfer.files,Mt.length>0){xt.preventDefault(),xt.stopPropagation();for(var $t=function(Lr){var Ft=Mt[Lr],Zr=Ft.name.split(".").pop();J(Ft,function(Gt){if(Gt.id){var kr,pr,Mr;(Ft==null||((kr=Ft.type)===null||kr===void 0)?void 0:kr.indexOf("image"))>-1?Xe.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):(Ft==null||((pr=Ft.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?Xe.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Ft==null||((Mr=Ft.type)===null||Mr===void 0)?void 0:Mr.indexOf("pdf"))>-1?Xe.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):le.includes(Zr)?Xe.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):Xe.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt<Mt.length;Bt++)$t(Bt)}}),q(Xe),function(){Xe.off("paste",Ye)}}},[]);var Nr=Object(y.useCallback)(function(){if(Sr.current)try{}catch(Xe){console.log(Xe,"---- to set md editor body height")}},[Rn,Sr,Yt]);Object(y.useEffect)(function(){function Xe(){var pt=new x.default(function(xt){var Mt=Object(D.a)(xt),$t;try{for(Mt.s();!($t=Mt.n()).done;){var Bt=$t.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&(Nr(),N.setSize("100%","100%"),N.refresh())}}catch(dr){Mt.e(dr)}finally{Mt.f()}});return pt.observe(Wt.current.parentElement),pt}if(N){var Ye=Xe();return function(){Ye.unobserve(Wt.current.parentElement)}}},[N,Nr]),Object(y.useEffect)(function(){if(N){for(var Xe=[],Ye=function(){var Bt=xt[pt];Mt=Object(G.a)(Bt,2);var dr=Mt[0],Lr=Mt[1],Ft=Object(W.a)({},dr,function(){An(Lr)});Xe.push(Ft),N.addKeyMap(Ft)},pt=0,xt=Object.entries(de);pt<xt.length;pt++){var Mt;Ye()}return Pr.current=setInterval(function(){Xt.current&&Ar()},4e3),function(){clearInterval(Pr.current);var $t=Object(D.a)(Xe),Bt;try{for($t.s();!(Bt=$t.n()).done;){var dr=Bt.value;N.removeKeyMap(dr)}}catch(Lr){$t.e(Lr)}finally{$t.f()}}}},[N]),Object(y.useEffect)(function(){ur!==Yt&&Qt(ur)},[ur]),Object(ze.a)(function(){if(!cr&&ir>0){var Xe=new Date().getTime(),Ye=window.sessionStorage.getItem(Zt);Xe>=ir+it&&(!Ye||Ye!==Qe)&&(window.sessionStorage.setItem(Zt,Qe),vn(!0))}},it),Object(y.useEffect)(function(){yt(Nt)},[N,Nt]),Object(y.useEffect)(function(){N&&(zt&&N.focus())},[N,zt]),Object(y.useEffect)(function(){if(gt&&N){var Xe=N.getScrollerElement();function Ye(pt){var xt=pt.target;if(pn.current){var Mt=xt.scrollTop/xt.scrollHeight;pn.current.scrollTop=pn.current.scrollHeight*Mt}}return Xe.addEventListener("scroll",Ye),function(){Xe.removeEventListener("scroll",Ye)}}},[N,gt]),Object(y.useEffect)(function(){if(N&&gr){function Xe(Ye,pt){gr(Ye,pt)}return N.on("beforeChange",Xe),function(){N.off("beforeChange",Xe)}}},[N,gr]),Object(y.useEffect)(function(){if(N&&It){function Xe(){It(N.getValue())}return N.on("blur",Xe),function(){N.off("blur",Xe)}}},[N,It]),Object(y.useEffect)(function(){if(N){function Xe(Ye){var pt=Ye.getValue();ot(pt),dn(new Date().getTime()),Ye.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),at&&at(pt)}return N.on("change",Xe),function(){N.off("change",Xe)}}},[N,at]),Object(y.useEffect)(function(){N&&(Ze==null?(N.setValue(""),ot("")):Ze!==N.getValue()&&(N.setValue(Ze),ot(Ze),N.setCursor(N.lineCount(),0)))},[N,Ze]);var An=Object(y.useCallback)(function(Xe){var Ye=N.getCursor(),pt=N.getSelection(),xt=pt.split(`
`);switch(Xe){case"bold":return N.replaceSelection("**"+pt+"**"),pt===""&&N.setCursor(Ye.line,Ye.ch+2),N.focus();case"italic":return N.replaceSelection("*"+pt+"*"),pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.focus();case"code":return N.replaceSelection("`"+pt+"`"),pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+pt+"$$`"),pt===""&&N.setCursor(Ye.line,Ye.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+pt+"\n```"),N.setCursor(Ye.line+1,pt.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
`),N.focus();case"list-ul":return pt===""?N.replaceSelection("- "+pt):N.replaceSelection(xt.map(function(Mt){return Mt===""?"":"- ".concat(Mt)}).join(`
`)),N.focus();case"list-ol":return pt===""?N.replaceSelection("1. "+pt):N.replaceSelection(xt.map(function(Mt,$t){return Mt===""?"":"".concat($t+1,". ").concat(Mt)}).join(`
`)),N.focus();case"add-null-ch":return pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.replaceSelection(Me),N.focus();case"inster-template-1":return pt===""&&N.setCursor(Ye.line,Ye.ch),N.replaceSelection(We),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return yt(!gt),N.focus();case"trigger-full-screen":return Qt(!Yt),N.focus();case He:Vt(He);return;case qe:Vt(qe);return;case Fe:Vt(Fe);return;case De:Vt(De);return;default:throw new Error}},[N,gt,Yt]),xn=Object(y.useCallback)(function(Xe){Vt("");switch(tr){case He:var Ye=Xe.title,pt=Xe.link;return N.replaceSelection("[".concat(Ye,"](").concat(pt,")")),N.focus();case qe:var xt=Xe.language,Mt=Xe.content;return N.replaceSelection(["```"+xt,Mt,"```"].join(`
`)),N.focus();case Fe:var $t=Xe.src,Bt=Xe.alt;return Bt?N.replaceSelection("![ ".concat(Bt," ]( ").concat($t,' "').concat(Bt,'" )')):N.replaceSelection("![,](".concat($t,")")),N.focus();case De:for(var dr=Xe.row,Lr=Xe.col,Ft=Xe.align,Zr=`
`,Gt=0;Gt<dr;Gt++){for(var kr=[],pr=[],Mr=0;Mr<Lr;Mr++)Gt===1&&pr.push(Be[Ft]),kr.push(" ");Gt===1&&(Zr+="| ".concat(pr.join(" | "),` |
`)),Zr+="| ".concat(kr.join(Lr===1?"":" | "),` |
`)}return N.replaceSelection(Zr+`
`),N.focus();default:throw new Error}},[N,tr]),_n=Object(y.useMemo)(function(){switch(tr){case He:return A.a.createElement(pe,{callback:xn,onCancel:Cn});case qe:return A.a.createElement(ve.b,{callback:xn,onCancel:Cn});case Fe:return A.a.createElement(ie,{callback:xn,onCancel:Cn});case De:return A.a.createElement(Pe,{callback:xn,onCancel:Cn});default:return null}},[tr]);function Cn(){Vt("")}Object(y.useEffect)(function(){if(qt.current){var Xe=qt.current,Ye=!1,pt=0;function xt(Bt){Ye=!0,pt=Bt.pageY}function Mt(){Ye=!1}function $t(Bt){if(Ye){var dr=Bt.pageY-pt;dr<0&&(dr=0),dr>300&&(dr=300);var Lr=Tt+dr+"px";on(Lr)}}return Xe.addEventListener("mousedown",xt),document.addEventListener("mousemove",$t),document.addEventListener("mouseup",Mt),function(){Xe.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",$t),document.removeEventListener("mouseup",Mt)}}},[N,qt]),Object(y.useEffect)(function(){on(Tt)},[Tt]);var sn=xe(mt),Pn=xe(Rn),cn={width:sn,height:Pn},zn=Object(y.useMemo)(function(){if(ir){var Xe=new Date(ir),Ye=Xe.getHours(),pt=Xe.getMinutes(),xt=Xe.getSeconds();return Ye=Ye<10?"0"+Ye:Ye,pt=pt<10?"0"+pt:pt,xt=xt<10?"0"+xt:xt,"".concat(Ye,":").concat(pt,":").concat(xt)}return 0},[ir]);function ri(){window.sessionStorage.removeItem(Zt),vn(!1),dn(0)}function Ln(){vn(!1),dn(0),N.setValue(window.sessionStorage.getItem(Zt))}function Ut(Xe,Ye){var pt=N.getValue();pt=pt.replace(Xe,Ye),ot(pt),N==null||N.setValue(pt)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Sr},A.a.createElement("div",{className:"markdown-editor-container ".concat(et," ").concat(gt?"on-preview":""," ").concat(Rt?"mini":""," ").concat(Yt?"full-screen":""),style:cn},A.a.createElement(T,{insertTemp:Et,watch:gt,fullScreen:Yt,showNullButton:Ot,onActionCallback:An,hidetoolBar:or,uuid:hr.current,setOpenPhones:function(){Xt.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Wt,placeholder:$r})),gt?A.a.createElement("div",{ref:pn,className:"preview-container"},Kt==="stex"&&A.a.createElement(w,{value:Qe}),Kt!=="stex"&&A.a.createElement(p.a,{edit:!0,value:Qe,replaces:Ut})):null))),Jt?A.a.createElement("a",{ref:qt,className:"editor-resize"}):null,A.a.createElement(U.a,null,me[tr]?A.a.createElement($.a,{centered:!0,title:me[tr],visible:!0,onCancel:Cn,footer:null,className:"markdown-popup-form"},_n):null))}},RxwV:function(wt,nt,re){"use strict";var ce=re("q1tI"),$=re("uciX"),D=re("2W6z"),Z=re.n(D),B=re("4IlW"),M=re("uK0f"),G=re.n(M);function W(ae,ue){if(ae===ue)return!0;if(!ae||!ue)return!1;var ie=ae.length;if(ue.length!==ie)return!1;for(var se=0;se<ie;se++)if(ae[se]!==ue[se])return!1;return!0}function _(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(ie){return typeof ie}:_=function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie},_(ae)}function O(ae,ue){if(!(ae instanceof ue))throw new TypeError("Cannot call a class as a function")}function y(ae,ue){for(var ie=0;ie<ue.length;ie++){var se=ue[ie];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function A(ae,ue,ie){return ue&&y(ae.prototype,ue),ie&&y(ae,ie),ae}function R(ae,ue){if(typeof ue!="function"&&ue!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(ue&&ue.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),ue&&k(ae,ue)}function k(ae,ue){return k=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},k(ae,ue)}function x(ae){var ue=o();return function(){var ie=u(ae),se;if(ue){var J=u(this).constructor;se=Reflect.construct(ie,arguments,J)}else se=ie.apply(this,arguments);return E(this,se)}}function E(ae,ue){return ue&&(_(ue)==="object"||typeof ue=="function")?ue: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 u(ae){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(ie){return ie.__proto__||Object.getPrototypeOf(ie)},u(ae)}var d=function(){var ae=function(ue){R(se,ue);var ie=x(se);function se(){var J;return O(this,se),J=ie.apply(this,arguments),J.menuItems={},J.saveMenuItem=function(ee){return function(ne){J.menuItems[ee]=ne}},J}return A(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 ne=this.props,fe=ne.fieldNames,Ae=ne.defaultFieldNames;return fe[ee]||Ae[ee]}},{key:"getOption",value:function(ee,ne){var fe=this.props,Ae=fe.prefixCls,ge=fe.expandTrigger,Oe=fe.expandIcon,Pe=fe.loadingIcon,je=this.props.onSelect.bind(this,ee,ne),Ge=this.props.onItemDoubleClick.bind(this,ee,ne),He={onClick:je,onDoubleClick:Ge},Fe="".concat(Ae,"-menu-item"),qe=null,De=ee[this.getFieldName("children")]&&ee[this.getFieldName("children")].length>0;(De||ee.isLeaf===!1)&&(Fe+=" ".concat(Ae,"-menu-item-expand"),ee.loading||(qe=ce.createElement("span",{className:"".concat(Ae,"-menu-item-expand-icon")},Oe))),ge==="hover"&&(De||ee.isLeaf===!1)&&(He={onMouseEnter:this.delayOnSelect.bind(this,je),onMouseLeave:this.delayOnSelect.bind(this),onClick:je}),this.isActiveOption(ee,ne)&&(Fe+=" ".concat(Ae,"-menu-item-active"),He.ref=this.saveMenuItem(ne)),ee.disabled&&(Fe+=" ".concat(Ae,"-menu-item-disabled"));var Ie=null;ee.loading&&(Fe+=" ".concat(Ae,"-menu-item-loading"),Ie=Pe||null);var Be="";return"title"in ee?Be=ee.title:typeof ee[this.getFieldName("label")]=="string"&&(Be=ee[this.getFieldName("label")]),ce.createElement("li",Object.assign({key:ee[this.getFieldName("value")],className:Fe,title:Be},He,{role:"menuitem",onMouseDown:function(Ke){return Ke.preventDefault()}}),ee[this.getFieldName("label")],qe,Ie)}},{key:"getActiveOptions",value:function(ee){var ne=this,fe=this.props.options,Ae=ee||this.props.activeValue;return G()(fe,function(ge,Oe){return ge[ne.getFieldName("value")]===Ae[Oe]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ee=this,ne=this.props.options,fe=this.getActiveOptions().map(function(Ae){return Ae[ee.getFieldName("children")]}).filter(function(Ae){return!!Ae});return fe.unshift(ne),fe}},{key:"delayOnSelect",value:function(ee){for(var ne=this,fe=arguments.length,Ae=new Array(fe>1?fe-1:0),ge=1;ge<fe;ge++)Ae[ge-1]=arguments[ge];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof ee=="function"&&(this.delayTimer=window.setTimeout(function(){ee(Ae),ne.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var ee=this.getShowOptions().length,ne=0;ne<ee;ne++){var fe=this.menuItems[ne];fe&&fe.parentElement&&(fe.parentElement.scrollTop=fe.offsetTop)}}},{key:"isActiveOption",value:function(ee,ne){var fe=this.props.activeValue,Ae=fe===void 0?[]:fe;return Ae[ne]===ee[this.getFieldName("value")]}},{key:"render",value:function(){var ee=this,ne=this.props,fe=ne.prefixCls,Ae=ne.dropdownMenuColumnStyle;return ce.createElement("div",null,this.getShowOptions().map(function(ge,Oe){return ce.createElement("ul",{className:"".concat(fe,"-menu"),key:Oe,style:Ae},ge.map(function(Pe){return ee.getOption(Pe,Oe)}))}))}}]),se}(ce.Component);return ae.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ae}(),S=d,v={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=v;function w(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(ie){return typeof ie}:w=function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie},w(ae)}function b(ae,ue){if(ae==null)return{};var ie=s(ae,ue),se,J;if(Object.getOwnPropertySymbols){var ee=Object.getOwnPropertySymbols(ae);for(J=0;J<ee.length;J++){if(se=ee[J],ue.indexOf(se)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ae,se))continue;ie[se]=ae[se]}}return ie}function s(ae,ue){if(ae==null)return{};var ie={},se=Object.keys(ae),J,ee;for(ee=0;ee<se.length;ee++){if(J=se[ee],ue.indexOf(J)>=0)continue;ie[J]=ae[J]}return ie}function f(ae){return m(ae)||C(ae)||a(ae)||l()}function l(){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,ue){if(!ae)return;if(typeof ae=="string")return T(ae,ue);var ie=Object.prototype.toString.call(ae).slice(8,-1);if(ie==="Object"&&ae.constructor&&(ie=ae.constructor.name),ie==="Map"||ie==="Set")return Array.from(ae);if(ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie))return T(ae,ue)}function C(ae){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ae))return Array.from(ae)}function m(ae){if(Array.isArray(ae))return T(ae)}function T(ae,ue){(ue==null||ue>ae.length)&&(ue=ae.length);for(var ie=0,se=new Array(ue);ie<ue;ie++)se[ie]=ae[ie];return se}function U(ae,ue){if(!(ae instanceof ue))throw new TypeError("Cannot call a class as a function")}function j(ae,ue){for(var ie=0;ie<ue.length;ie++){var se=ue[ie];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function F(ae,ue,ie){return ue&&j(ae.prototype,ue),ie&&j(ae,ie),ae}function V(ae,ue){if(typeof ue!="function"&&ue!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(ue&&ue.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),ue&&P(ae,ue)}function P(ae,ue){return P=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},P(ae,ue)}function I(ae){var ue=pe();return function(){var ie=ve(ae),se;if(ue){var J=ve(this).constructor;se=Reflect.construct(ie,arguments,J)}else se=ie.apply(this,arguments);return X(this,se)}}function X(ae,ue){return ue&&(w(ue)==="object"||typeof ue=="function")?ue:oe(ae)}function oe(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(ie){return ie.__proto__||Object.getPrototypeOf(ie)},ve(ae)}var Le=function(){var ae=function(ue){V(se,ue);var ie=I(se);function se(J){var ee;U(this,se),ee=ie.call(this,J),ee.setPopupVisible=function(fe){var Ae=ee.state.value;"popupVisible"in ee.props||ee.setState({popupVisible:fe}),fe&&!ee.state.popupVisible&&ee.setState({activeValue:Ae}),ee.props.onPopupVisibleChange(fe)},ee.handleChange=function(fe,Ae,ge){var Oe=Ae.visible;(ge.type!=="keydown"||ge.keyCode===B.a.ENTER)&&(ee.props.onChange(fe.map(function(Pe){return Pe[ee.getFieldName("value")]}),fe),ee.setPopupVisible(Oe))},ee.handlePopupVisibleChange=function(fe){ee.setPopupVisible(fe)},ee.handleMenuSelect=function(fe,Ae,ge){var Oe=ee.trigger.getRootDomNode();Oe&&Oe.focus&&Oe.focus();var Pe=ee.props,je=Pe.changeOnSelect,Ge=Pe.loadData,He=Pe.expandTrigger;if(!fe||fe.disabled)return;var Fe=ee.state.activeValue;Fe=Fe.slice(0,Ae+1),Fe[Ae]=fe[ee.getFieldName("value")];var qe=ee.getActiveOptions(Fe);if(fe.isLeaf===!1&&!fe[ee.getFieldName("children")]&&Ge){je&&ee.handleChange(qe,{visible:!0},ge),ee.setState({activeValue:Fe}),Ge(qe);return}var De={};!fe[ee.getFieldName("children")]||!fe[ee.getFieldName("children")].length?(ee.handleChange(qe,{visible:!1},ge),De.value=Fe):je&&(ge.type==="click"||ge.type==="keydown")&&(He==="hover"?ee.handleChange(qe,{visible:!1},ge):ee.handleChange(qe,{visible:!0},ge),De.value=Fe),De.activeValue=Fe,("value"in ee.props||ge.type==="keydown"&&ge.keyCode!==B.a.ENTER)&&delete De.value,ee.setState(De)},ee.handleItemDoubleClick=function(){var fe=ee.props.changeOnSelect;fe&&ee.setPopupVisible(!1)},ee.handleKeyDown=function(fe){var Ae=ee.props.children;if(Ae&&Ae.props.onKeyDown){Ae.props.onKeyDown(fe);return}var ge=f(ee.state.activeValue),Oe=ge.length-1<0?0:ge.length-1,Pe=ee.getCurrentLevelOptions(),je=Pe.map(function(qe){return qe[ee.getFieldName("value")]}).indexOf(ge[Oe]);if(fe.keyCode!==B.a.DOWN&&fe.keyCode!==B.a.UP&&fe.keyCode!==B.a.LEFT&&fe.keyCode!==B.a.RIGHT&&fe.keyCode!==B.a.ENTER&&fe.keyCode!==B.a.SPACE&&fe.keyCode!==B.a.BACKSPACE&&fe.keyCode!==B.a.ESC&&fe.keyCode!==B.a.TAB)return;if(!ee.state.popupVisible&&fe.keyCode!==B.a.BACKSPACE&&fe.keyCode!==B.a.LEFT&&fe.keyCode!==B.a.RIGHT&&fe.keyCode!==B.a.ESC&&fe.keyCode!==B.a.TAB){ee.setPopupVisible(!0);return}if(fe.keyCode===B.a.DOWN||fe.keyCode===B.a.UP){fe.preventDefault();var Ge=je;Ge!==-1?fe.keyCode===B.a.DOWN?(Ge+=1,Ge=Ge>=Pe.length?0:Ge):(Ge-=1,Ge=Ge<0?Pe.length-1:Ge):Ge=0,ge[Oe]=Pe[Ge][ee.getFieldName("value")]}else if(fe.keyCode===B.a.LEFT||fe.keyCode===B.a.BACKSPACE)fe.preventDefault(),ge.splice(ge.length-1,1);else if(fe.keyCode===B.a.RIGHT)fe.preventDefault(),Pe[je]&&Pe[je][ee.getFieldName("children")]&&ge.push(Pe[je][ee.getFieldName("children")][0][ee.getFieldName("value")]);else if(fe.keyCode===B.a.ESC||fe.keyCode===B.a.TAB){ee.setPopupVisible(!1);return}(!ge||ge.length===0)&&ee.setPopupVisible(!1);var He=ee.getActiveOptions(ge),Fe=He[He.length-1];ee.handleMenuSelect(Fe,He.length-1,fe),ee.props.onKeyDown&&ee.props.onKeyDown(fe)},ee.saveTrigger=function(fe){ee.trigger=fe};var ne=[];return"value"in J?ne=J.value||[]:"defaultValue"in J&&(ne=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:ne,value:ne,prevProps:J},ee.defaultFieldNames={label:"label",value:"value",children:"children"},ee}return F(se,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ee){var ne=this.defaultFieldNames,fe=this.props,Ae=fe.fieldNames,ge=fe.filedNames;return"filedNames"in this.props?ge[ee]||ne[ee]:Ae[ee]||ne[ee]}},{key:"getFieldNames",value:function(){var ee=this.props,ne=ee.fieldNames,fe=ee.filedNames;return"filedNames"in this.props?fe:ne}},{key:"getCurrentLevelOptions",value:function(){var ee=this,ne=this.props.options,fe=ne===void 0?[]:ne,Ae=this.state.activeValue,ge=Ae===void 0?[]:Ae,Oe=G()(fe,function(Pe,je){return Pe[ee.getFieldName("value")]===ge[je]},{childrenKeyName:this.getFieldName("children")});return Oe[Oe.length-2]?Oe[Oe.length-2][this.getFieldName("children")]:f(fe).filter(function(Pe){return!Pe.disabled})}},{key:"getActiveOptions",value:function(ee){var ne=this;return G()(this.props.options||[],function(fe,Ae){return fe[ne.getFieldName("value")]===ee[Ae]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ee=this.props,ne=ee.prefixCls,fe=ee.transitionName,Ae=ee.popupClassName,ge=ee.options,Oe=ge===void 0?[]:ge,Pe=ee.disabled,je=ee.builtinPlacements,Ge=ee.popupPlacement,He=ee.children,Fe=ee.dropdownRender,qe=b(ee,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),De=ce.createElement("div",null),Ie="";Oe&&Oe.length>0?De=ce.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})):Ie=" ".concat(ne,"-menus-empty");var Be=De;return Fe&&(Be=Fe(De)),ce.createElement($.a,Object.assign({ref:this.saveTrigger},qe,{popupPlacement:Ge,builtinPlacements:je,popupTransitionName:fe,action:Pe?[]:["click"],popupVisible:Pe?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(ne,"-menus"),popupClassName:Ae+Ie,popup:Be}),ce.cloneElement(He,{onKeyDown:this.handleKeyDown,tabIndex:Pe?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ee,ne){var fe=ne.prevProps,Ae=fe===void 0?{}:fe,ge={prevProps:ee};return"value"in ee&&!W(Ae.value,ee.value)&&(ge.value=ee.value||[],"loadData"in ee||(ge.activeValue=ee.value||[])),"popupVisible"in ee&&(ge.popupVisible=ee.popupVisible),ge}}]),se}(ce.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}(),ke=Le,he=nt.a=ke},SJMd:function(wt,nt){/**
* @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 re,ce,$,D=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var M,G;(function(){var W=window,_=["break,continue,do,else,for,if,return,while"],O=[_,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"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"],R=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[y,"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",E=[y,"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=[_,"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"],u=[_,"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=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[A,k,R,E,h,o,u,d],v=/^(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",s="typ",f="lit",l="pun",a="pln",C="tag",m="dec",T="src",U="atn",j="atv",F="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(ge){for(var Oe=0,Pe=!1,je=!1,Ge=0,He=ge.length;Ge<He;++Ge){var Fe=ge[Ge];if(Fe.ignoreCase)je=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,je=!1;break}}var qe={b:8,t:9,n:10,v:11,f:12,r:13};function De(Ve){var Re=Ve.charCodeAt(0);if(Re!==92)return Re;var tt=Ve.charAt(1);return Re=qe[tt],Re||("0"<=tt&&tt<="7"?parseInt(Ve.substring(1),8):tt==="u"||tt==="x"?parseInt(Ve.substring(2),16):Ve.charCodeAt(1))}function Ie(Ve){if(Ve<32)return(Ve<16?"\\x0":"\\x")+Ve.toString(16);var Re=String.fromCharCode(Ve);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function Be(Ve){var Re=Ve.substring(1,Ve.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")),tt=[],it=Re[0]==="^",Me=["["];it&&Me.push("^");for(var We=it?1:0,xe=Re.length;We<xe;++We){var ye=Re[We];if(/\\[bdsw]/i.test(ye))Me.push(ye);else{var Ce=De(ye),le;We+2<xe&&Re[We+1]==="-"?(le=De(Re[We+2]),We+=2):le=Ce,tt.push([Ce,le]),le<65||Ce>122||(le<65||Ce>90||tt.push([Math.max(65,Ce)|32,Math.min(le,90)|32]),le<97||Ce>122||tt.push([Math.max(97,Ce)&~32,Math.min(le,122)&~32]))}}tt.sort(function(we,Ue){return we[0]-Ue[0]||Ue[1]-we[1]});for(var de=[],me=[],We=0;We<tt.length;++We){var Ee=tt[We];Ee[0]<=me[1]+1?me[1]=Math.max(me[1],Ee[1]):de.push(me=Ee)}for(var We=0;We<de.length;++We){var Ee=de[We];Me.push(Ie(Ee[0])),Ee[1]>Ee[0]&&(Ee[1]+1>Ee[0]&&Me.push("-"),Me.push(Ie(Ee[1])))}return Me.push("]"),Me.join("")}function ze(Ve){for(var Re=Ve.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")),tt=Re.length,it=[],Me=0,We=0;Me<tt;++Me){var xe=Re[Me];if(xe==="(")++We;else if(xe.charAt(0)==="\\"){var ye=+xe.substring(1);ye&&(ye<=We?it[ye]=-1:Re[Me]=Ie(ye))}}for(var Me=1;Me<it.length;++Me)it[Me]===-1&&(it[Me]=++Oe);for(var Me=0,We=0;Me<tt;++Me){var xe=Re[Me];if(xe==="(")++We,it[We]||(Re[Me]="(?:");else if(xe.charAt(0)==="\\"){var ye=+xe.substring(1);ye&&ye<=We&&(Re[Me]="\\"+it[ye])}}for(var Me=0;Me<tt;++Me)Re[Me]==="^"&&Re[Me+1]!=="^"&&(Re[Me]="");if(Ve.ignoreCase&&Pe)for(var Me=0;Me<tt;++Me){var xe=Re[Me],Ce=xe.charAt(0);xe.length>=2&&Ce==="["?Re[Me]=Be(xe):Ce!=="\\"&&(Re[Me]=xe.replace(/[a-zA-Z]/g,function(me){var Ee=me.charCodeAt(0);return"["+String.fromCharCode(Ee&~32,Ee|32)+"]"}))}return Re.join("")}for(var Ke=[],Ge=0,He=ge.length;Ge<He;++Ge){var Fe=ge[Ge];if(Fe.global||Fe.multiline)throw new Error(""+Fe);Ke.push("(?:"+ze(Fe)+")")}return new RegExp(Ke.join("|"),je?"gi":"g")}function I(ge,Oe){var Pe=/(?:^|\s)nocode(?:\s|$)/,je=[],Ge=0,He=[],Fe=0;function qe(De){var Ie=De.nodeType;if(Ie==1){if(Pe.test(De.className))return;for(var Be=De.firstChild;Be;Be=Be.nextSibling)qe(Be);var ze=De.nodeName.toLowerCase();(ze==="br"||ze==="li")&&(je[Fe]=`
`,He[Fe<<1]=Ge++,He[Fe++<<1|1]=De)}else if(Ie==3||Ie==4){var Ke=De.nodeValue;Ke.length&&(Oe?Ke=Ke.replace(/\r\n?/g,`
`):Ke=Ke.replace(/[ \t\r\n]+/g," "),je[Fe]=Ke,He[Fe<<1]=Ge,Ge+=Ke.length,He[Fe++<<1|1]=De)}}return qe(ge),{sourceCode:je.join("").replace(/\n$/,""),spans:He}}function X(ge,Oe,Pe,je,Ge){if(!Pe)return;var He={sourceNode:ge,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Oe,decorations:null};je(He),Ge.push.apply(Ge,He.decorations)}var oe=/\S/;function pe(ge){for(var Oe=void 0,Pe=ge.firstChild;Pe;Pe=Pe.nextSibling){var je=Pe.nodeType;Oe=je===1?Oe?ge:Pe:je===3&&oe.test(Pe.nodeValue)?ge:Oe}return Oe===ge?void 0:Oe}function ve(ge,Oe){var Pe={},je;(function(){for(var Fe=ge.concat(Oe),qe=[],De={},Ie=0,Be=Fe.length;Ie<Be;++Ie){var ze=Fe[Ie],Ke=ze[3];if(Ke)for(var Ve=Ke.length;--Ve>=0;)Pe[Ke.charAt(Ve)]=ze;var Re=ze[1],tt=""+Re;De.hasOwnProperty(tt)||(qe.push(Re),De[tt]=null)}qe.push(/[\0-\uffff]/),je=P(qe)})();var Ge=Oe.length,He=function(Fe){for(var qe=Fe.sourceCode,De=Fe.basePos,Ie=Fe.sourceNode,Be=[De,a],ze=0,Ke=qe.match(je)||[],Ve={},Re=0,tt=Ke.length;Re<tt;++Re){var it=Ke[Re],Me=Ve[it],We=void 0,xe;if(typeof Me=="string")xe=!1;else{var ye=Pe[it.charAt(0)];if(ye)We=it.match(ye[1]),Me=ye[0];else{for(var Ce=0;Ce<Ge;++Ce)if(ye=Oe[Ce],We=it.match(ye[1]),We){Me=ye[0];break}We||(Me=a)}xe=Me.length>=5&&Me.substring(0,5)==="lang-",xe&&!(We&&typeof We[1]=="string")&&(xe=!1,Me=T),xe||(Ve[it]=Me)}var le=ze;if(ze+=it.length,!xe)Be.push(De+le,Me);else{var de=We[1],me=it.indexOf(de),Ee=me+de.length;We[2]&&(Ee=it.length-We[2].length,me=Ee-de.length);var we=Me.substring(5);X(Ie,De+le,it.substring(0,me),He,Be),X(Ie,De+le+me,de,se(we,de),Be),X(Ie,De+le+Ee,it.substring(Ee),He,Be)}}Fe.decorations=Be};return He}function Le(ge){var Oe=[],Pe=[];ge.tripleQuotedStrings?Oe.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ge.multiLineStrings?Oe.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ge.verbatimStrings&&Pe.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=ge.hashComments;je&&(ge.cStyleComments?(je>1?Oe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([b,/^#[^\r\n]*/,null,"#"])),ge.cStyleComments&&(Pe.push([b,/^\/\/[^\r\n]*/,null]),Pe.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ge=ge.regexLiterals;if(Ge){var He=Ge>1?"":`
\r`,Fe=He?".":"[\\S\\s]",qe="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+qe+")")])}var De=ge.types;De&&Pe.push([s,De]);var Ie=(""+ge.keywords).replace(/^ | $/g,"");Ie.length&&Pe.push([w,new RegExp("^(?:"+Ie.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([a,/^\s+/,null,` \r
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return ge.regexLiterals&&(Be+="(?!s*/)"),Pe.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[s,/^(?:[@_]?[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],[l,new RegExp(Be),null]),ve(Oe,Pe)}var ke=Le({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ge,Oe,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,Ge=/\r\n?|\n/,He=ge.ownerDocument,Fe=He.createElement("li");ge.firstChild;)Fe.appendChild(ge.firstChild);var qe=[Fe];function De(Re){var tt=Re.nodeType;if(tt==1&&!je.test(Re.className))if(Re.nodeName==="br")Ie(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var it=Re.firstChild;it;it=it.nextSibling)De(it);else if((tt==3||tt==4)&&Pe){var Me=Re.nodeValue,We=Me.match(Ge);if(We){var xe=Me.substring(0,We.index);Re.nodeValue=xe;var ye=Me.substring(We.index+We[0].length);if(ye){var Ce=Re.parentNode;Ce.insertBefore(He.createTextNode(ye),Re.nextSibling)}Ie(Re),xe||Re.parentNode.removeChild(Re)}}}function Ie(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function tt(We,xe){var ye=xe?We.cloneNode(!1):We,Ce=We.parentNode;if(Ce){var le=tt(Ce,1),de=We.nextSibling;le.appendChild(ye);for(var me=de;me;me=de)de=me.nextSibling,le.appendChild(me)}return ye}for(var it=tt(Re.nextSibling,0),Me;(Me=it.parentNode)&&Me.nodeType===1;)it=Me;qe.push(it)}for(var Be=0;Be<qe.length;++Be)De(qe[Be]);Oe===(Oe|0)&&qe[0].setAttribute("value",Oe);var ze=He.createElement("ol");ze.className="linenums";for(var Ke=Math.max(0,Oe-1|0)||0,Be=0,Ve=qe.length;Be<Ve;++Be)Fe=qe[Be],Fe.className="L"+(Be+Ke)%10,Fe.firstChild||Fe.appendChild(He.createTextNode("\xA0")),ze.appendChild(Fe);ge.appendChild(ze)}function ae(ge){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Pe=/\n/g,je=ge.sourceCode,Ge=je.length,He=0,Fe=ge.spans,qe=Fe.length,De=0,Ie=ge.decorations,Be=Ie.length,ze=0;Ie[Be]=Ge;var Ke,Ve;for(Ve=Ke=0;Ve<Be;)Ie[Ve]!==Ie[Ve+2]?(Ie[Ke++]=Ie[Ve++],Ie[Ke++]=Ie[Ve++]):Ve+=2;for(Be=Ke,Ve=Ke=0;Ve<Be;){for(var Re=Ie[Ve],tt=Ie[Ve+1],it=Ve+2;it+2<=Be&&Ie[it+1]===tt;)it+=2;Ie[Ke++]=Re,Ie[Ke++]=tt,Ve=it}Be=Ie.length=Ke;var Me=ge.sourceNode,We="";Me&&(We=Me.style.display,Me.style.display="none");try{for(var xe=null;De<qe;){var ye=Fe[De],Ce=Fe[De+2]||Ge,le=Ie[ze+2]||Ge,it=Math.min(Ce,le),de=Fe[De+1],me;if(de.nodeType!==1&&(me=je.substring(He,it))){Oe&&(me=me.replace(Pe,"\r")),de.nodeValue=me;var Ee=de.ownerDocument,we=Ee.createElement("span");we.className=Ie[ze+1];var Ue=de.parentNode;Ue.replaceChild(we,de),we.appendChild(de),He<Ce&&(Fe[De+1]=de=Ee.createTextNode(je.substring(it,Ce)),Ue.insertBefore(de,we.nextSibling))}He=it,He>=Ce&&(De+=2),He>=le&&(ze+=2)}}finally{Me&&(Me.style.display=We)}}var ue={};function ie(ge,Oe){for(var Pe=Oe.length;--Pe>=0;){var je=Oe[Pe];ue.hasOwnProperty(je)?W.console&&console.warn("cannot override language handler %s",je):ue[je]=ge}}function se(ge,Oe){return ge&&ue.hasOwnProperty(ge)||(ge=/^\s*</.test(Oe)?"default-markup":"default-code"),ue[ge]}ie(ke,["default-code"]),ie(ve([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ie(ve([[a,/^[\s]+/,null,` \r
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[U,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ie(ve([],[[j,/^[\s\S]+/]]),["uq.val"]),ie(Le({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ie(Le({keywords:"null,true,false"}),["json"]),ie(Le({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ie(Le({keywords:R,cStyleComments:!0}),["java"]),ie(Le({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Le({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Le({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Le({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Le({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Le({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ve([],[[p,/^[\s\S]+/]]),["regex"]);function J(ge){var Oe=ge.langExtension;try{var Pe=I(ge.sourceNode,ge.pre),je=Pe.sourceCode;ge.sourceCode=je,ge.spans=Pe.spans,ge.basePos=0,se(Oe,je)(ge),ae(ge)}catch(Ge){W.console&&console.log(Ge&&Ge.stack||Ge)}}function ee(ge,Oe,Pe){var je=Pe||!1,Ge=Oe||null,He=document.createElement("div");He.innerHTML="<pre>"+ge+"</pre>",He=He.firstChild,je&&he(He,je,!0);var Fe={langExtension:Ge,numberLines:je,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Fe),He.innerHTML}function ne(ge,Oe){var Pe=Oe||document.body,je=Pe.ownerDocument||document;function Ge(ye){return Pe.getElementsByTagName(ye)}for(var He=[Ge("pre"),Ge("code"),Ge("xmp")],Fe=[],qe=0;qe<He.length;++qe)for(var De=0,Ie=He[qe].length;De<Ie;++De)Fe.push(He[qe][De]);He=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var ze=0,Ke=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ve=/\bprettyprint\b/,Re=/\bprettyprinted\b/,tt=/pre|xmp/i,it=/^code$/i,Me=/^(?:pre|code|xmp)$/i,We={};function xe(){for(var ye=W.PR_SHOULD_USE_CONTINUATION?Be.now()+250:Infinity;ze<Fe.length&&Be.now()<ye;ze++){for(var Ce=Fe[ze],le=We,de=Ce;de=de.previousSibling;){var me=de.nodeType,Ee=(me===7||me===8)&&de.nodeValue;if(Ee?!/^\??prettify\b/.test(Ee):me!==3||/\S/.test(de.nodeValue))break;if(Ee){le={},Ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Nt,Et,_t){le[Et]=_t});break}}var we=Ce.className;if((le!==We||Ve.test(we))&&!Re.test(we)){for(var Ue=!1,Ze=Ce.parentNode;Ze;Ze=Ze.parentNode){var at=Ze.tagName;if(Me.test(at)&&Ze.className&&Ve.test(Ze.className)){Ue=!0;break}}if(!Ue){Ce.className+=" prettyprinted";var vt=le.lang;if(!vt){vt=we.match(Ke);var mt;!vt&&(mt=pe(Ce))&&it.test(mt.tagName)&&(vt=mt.className.match(Ke)),vt&&(vt=vt[1])}var Ct;if(tt.test(Ce.tagName))Ct=1;else{var Tt=Ce.currentStyle,ut=je.defaultView,Rt=Tt?Tt.whiteSpace:ut&&ut.getComputedStyle?ut.getComputedStyle(Ce,null).getPropertyValue("white-space"):0;Ct=Rt&&Rt.substring(0,3)==="pre"}var kt=le.linenums;(kt=kt==="true"||+kt)||(kt=we.match(/\blinenums\b(?::(\d+))?/),kt=kt?kt[1]&&kt[1].length?+kt[1]:!0:!1),kt&&he(Ce,kt,Ct);var zt={langExtension:vt,sourceNode:Ce,numberLines:kt,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};J(zt)}}}ze<Fe.length?W.setTimeout(xe,250):typeof ge=="function"&&ge()}xe()}var fe=W.PR={createSimpleLexer:ve,registerLangHandler:ie,sourceDecorator:Le,PR_ATTRIB_NAME:U,PR_ATTRIB_VALUE:j,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:w,PR_LITERAL:f,PR_NOCODE:F,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:T,PR_STRING:p,PR_TAG:C,PR_TYPE:s,prettyPrintOne:D?W.prettyPrintOne=ee:M=ee,prettyPrint:G=D?W.prettyPrint=ne:G=ne},Ae=W.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return fe})})()},"VrN/":function(wt,nt,re){(function(ce,$){wt.exports=$()})(this,function(){"use strict";var ce=navigator.userAgent,$=navigator.platform,D=/gecko\/\d/i.test(ce),Z=/MSIE \d/.test(ce),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),M=/Edge\/(\d+)/.exec(ce),G=Z||B||M,W=G&&(Z?document.documentMode||6:+(M||B)[1]),_=!M&&/WebKit\//.test(ce),O=_&&/Qt\/\d+\.\d+/.test(ce),y=!M&&/Chrome\//.test(ce),A=/Opera\//.test(ce),R=/Apple Computer/.test(navigator.vendor),k=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ce),x=/PhantomJS/.test(ce),E=!M&&/AppleWebKit/.test(ce)&&/Mobile\/\w+/.test(ce),h=/Android/.test(ce),o=E||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ce),u=E||/Mac/.test($),d=/\bCrOS\b/.test(ce),S=/win/i.test($),v=A&&ce.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,_=!0);var p=u&&(O||A&&(v==null||v<12.11)),w=D||G&&W>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var s=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 l(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 L=0;L<t.length;++L)i.appendChild(t[L]);return i}function C(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=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 T(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 U(){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 F(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()};E?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(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 I(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 X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=r||0,H=i||0;;){var Y=e.indexOf(" ",L);if(Y<0||Y>=t)return H+(t-L);H+=Y-L,H+=n-H%n,L=Y+1}}var oe=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};oe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},oe.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,Le={toString:function(){return"CodeMirror.Pass"}},ke={scroll:!1},he={origin:"*mouse"},ae={origin:"+move"};function ue(e,t,n){for(var r=0,i=0;;){var L=e.indexOf(" ",r);L==-1&&(L=e.length);var H=L-r;if(L==e.length||i+H>=t)return r+Math.min(H,t-i);if(i+=L-r,i+=n-i%n,r=L+1,i>=t)return r}}var ie=[""];function se(e){for(;ie.length<=e;)ie.push(J(ie)+" ");return ie[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 ne(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 Ae(e,t){var n;return Object.create?n=Object.create(e):(fe.prototype=e,n=new fe),t&&I(t,n),n}var ge=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ge.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ge=/[\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&&Ge.test(e)}function Fe(e,t,n){for(;(n<0?t>0:t<e.length)&&He(e.charAt(t));)t+=n;return t}function qe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,L=r<0?Math.ceil(i):Math.floor(i);if(L==t)return e(L)?t:n;e(L)?n=L:t=L+r}}function De(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,L=0;L<e.length;++L){var H=e[L];(H.from<n&&H.to>t||t==n&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,n),H.level==1?"rtl":"ltr",L),i=!0)}i||r(t,n,"ltr")}var Ie=null;function Be(e,t,n){var r;Ie=null;for(var i=0;i<e.length;++i){var L=e[i];if(L.from<t&&L.to>t)return i;L.to==t&&(L.from!=L.to&&n=="before"?r=i:Ie=i),L.from==t&&(L.from!=L.to&&n!="before"?r=i:Ie=i)}return r!=null?r:Ie}var ze=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]/,L=/[LRr]/,H=/[Lb1n]/,Y=/[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 rt=0,st=Te;rt<Ne;++rt){var ct=_e[rt];ct=="m"?_e[rt]=st:st=ct}for(var bt=0,ht=Te;bt<Ne;++bt){var St=_e[bt];St=="1"&&ht=="r"?_e[bt]="n":L.test(St)&&(ht=St,St=="r"&&(_e[bt]="R"))}for(var Dt=1,At=_e[0];Dt<Ne-1;++Dt){var Ht=_e[Dt];Ht=="+"&&At=="1"&&_e[Dt+1]=="1"?_e[Dt]="1":Ht==","&&At==_e[Dt+1]&&(At=="1"||At=="n")&&(_e[Dt]=At),At=Ht}for(var lr=0;lr<Ne;++lr){var Br=_e[lr];if(Br==",")_e[lr]="N";else if(Br=="%"){var br=void 0;for(br=lr+1;br<Ne&&_e[br]=="%";++br);for(var un=lr&&_e[lr-1]=="!"||br<Ne&&_e[br]=="1"?"1":"N",rn=lr;rn<br;++rn)_e[rn]=un;lr=br-1}}for(var Rr=0,nn=Te;Rr<Ne;++Rr){var Hr=_e[Rr];nn=="L"&&Hr=="1"?_e[Rr]="L":L.test(Hr)&&(nn=Hr)}for(var Ir=0;Ir<Ne;++Ir)if(i.test(_e[Ir])){var _r=void 0;for(_r=Ir+1;_r<Ne&&i.test(_e[_r]);++_r);for(var Tr=(Ir?_e[Ir-1]:Te)=="L",an=(_r<Ne?_e[_r]:Te)=="L",yi=Tr==an?Tr?"L":"R":Te,Kn=Ir;Kn<_r;++Kn)_e[Kn]=yi;Ir=_r-1}for(var Xr=[],wn,jr=0;jr<Ne;)if(H.test(_e[jr])){var $a=jr;for(++jr;jr<Ne&&H.test(_e[jr]);++jr);Xr.push(new Q(0,$a,jr))}else{var On=jr,ei=Xr.length,ti=be=="rtl"?1:0;for(++jr;jr<Ne&&_e[jr]!="L";++jr);for(var Qr=On;Qr<jr;)if(Y.test(_e[Qr])){On<Qr&&(Xr.splice(ei,0,new Q(1,On,Qr)),ei+=ti);var bi=Qr;for(++Qr;Qr<jr&&Y.test(_e[Qr]);++Qr);Xr.splice(ei,0,new Q(2,bi,Qr)),ei+=ti,On=Qr}else++Qr;On<jr&&Xr.splice(ei,0,new Q(1,On,jr))}return be=="ltr"&&(Xr[0].level==1&&(wn=te.match(/^\s+/))&&(Xr[0].from=wn[0].length,Xr.unshift(new Q(0,0,wn[0].length))),J(Xr).level==1&&(wn=te.match(/\s+$/))&&(J(Xr).to-=wn[0].length,Xr.push(new Q(0,Ne-wn[0].length,Ne)))),be=="rtl"?Xr.reverse():Xr}}();function Ke(e,t){var n=e.order;return n==null&&(n=e.order=ze(e.text,t)),n}var Ve=[],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]||Ve).concat(n)}};function tt(e,t){return e._handlers&&e._handlers[t]||Ve}function it(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 L=pe(i,n);L>-1&&(r[t]=i.slice(0,L).concat(i.slice(L+1)))}}}function Me(e,t){var n=tt(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}}),Me(e,n||t.type,e,t),me(t)||t.codemirrorIgnore}function xe(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 tt(e,t).length>0}function Ce(e){e.prototype.on=function(t,n){Re(this,t,n)},e.prototype.off=function(t,n){it(this,t,n)}}function le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function de(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),de(e)}function we(e){return e.target||e.srcElement}function Ue(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Ze=function(){if(G&&W<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),at;function vt(e){if(at==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&W<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 mt;function Ct(e){if(mt!=null)return mt;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:mt=r.right-n.right<3}var Tt=`
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 L=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),H=L.indexOf("\r");H!=-1?(n.push(L.slice(0,H)),t+=H+1):(n.push(L),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ut=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},Rt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),kt=null;function zt(e){if(kt!=null)return kt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return kt=Math.abs(n.left-r.left)>1}var Nt={},Et={};function _t(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Nt[e]=t}function Kt(e,t){Et[e]=t}function dt(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return dt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return dt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Zt(e,t){t=dt(t);var n=Nt[t.name];if(!n)return Zt(e,"text/plain");var r=n(e,t);if(jt.hasOwnProperty(t.name)){var i=jt[t.name];for(var L in i){if(!i.hasOwnProperty(L))continue;r.hasOwnProperty(L)&&(r["_"+L]=r[L]),r[L]=i[L]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var jt={};function Jt(e,t){var n=jt.hasOwnProperty(e)?jt[e]:jt[e]={};I(t,n)}function ar(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 cr(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 Er(e,t,n){return e.startState?e.startState(t,n):!0}var Ot=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};Ot.prototype.eol=function(){return this.pos>=this.string.length},Ot.prototype.sol=function(){return this.pos==this.lineStart},Ot.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ot.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ot.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},Ot.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ot.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ot.prototype.skipToEnd=function(){this.pos=this.string.length},Ot.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ot.prototype.backUp=function(e){this.pos-=e},Ot.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(H){return n?H.toLowerCase():H},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Ot.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ot.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ot.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ot.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],L=i.chunkSize();if(t<L){n=i;break}t-=L}return n.lines[t]}function or(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(L){var H=L.text;i==n.line&&(H=H.slice(0,n.ch)),i==t.line&&(H=H.slice(t.ch)),r.push(H),++i}),r}function xr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function ur(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function It(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 gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],L=i.height;if(t<L){e=i;continue e}t-=L,n+=i.chunkSize()}return n}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Y=e.lines[H],Q=Y.height;if(t<Q)break;t-=Q}return n+H}function sr(e,t){return t>=e.first&&t<e.first+e.size}function Yr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,n){if(n===void 0&&(n=null),!(this instanceof et))return new et(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Lt(e,t){return e.line-t.line||e.ch-t.ch}function Kr(e,t){return e.sticky==t.sticky&&Lt(e,t)==0}function wr(e){return et(e.line,e.ch)}function $r(e,t){return Lt(e,t)<0?t:e}function Gr(e,t){return Lt(e,t)<0?e:t}function z(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 et(e.first,0);var n=e.first+e.size-1;return t.line>n?et(n,ft(e,n).text.length):g(t,ft(e,t.line).text.length)}function g(e,t){var n=e.ch;return n==null||n>t?et(e.line,t):n<0?et(e.line,0):e}function N(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},K=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};K.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},K.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}},K.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},K.fromSaved=function(e,t,n){return t instanceof q?new K(e,ar(e.mode,t.state),n,t.lookAhead):new K(e,ar(e.mode,t),n)},K.prototype.save=function(e){var t=e!==!1?ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function Se(e,t,n,r){var i=[e.state.modeGen],L={};Yt(e,t.text,e.doc.mode,n,function(te,be){return i.push(te,be)},L,r);for(var H=n.state,Y=function(te){n.baseTokens=i;var be=e.state.overlays[te],Te=1,Ne=0;n.state=!0,Yt(e,t.text,be.mode,n,function(_e,Je){for(var rt=Te;Ne<_e;){var st=i[Te];st>_e&&i.splice(Te,1,_e,i[Te+1],st),Te+=2,Ne=Math.min(_e,st)}if(!Je)return;if(be.opaque)i.splice(rt,Te-rt,_e,"overlay "+Je),Te=rt+2;else for(;rt<Te;rt+=2){var ct=i[rt+1];i[rt+1]=(ct?ct+" ":"")+"overlay "+Je}},L),n.state=H,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:i,classes:L.bgClass||L.textClass?L:null}}function Qe(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=ot(e,It(t)),i=t.text.length>e.options.maxHighlightLength&&ar(e.doc.mode,r.state),L=Se(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=L.styles,L.classes?t.styleClasses=L.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 ot(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new K(r,!0,t);var L=Qt(e,t,n),H=L>r.first&&ft(r,L-1).stateAfter,Y=H?K.fromSaved(r,H,L):new K(r,Er(r.mode),L);return r.iter(L,t,function(Q){lt(e,Q.text,Y);var te=Y.line;Q.stateAfter=te==t-1||te%5==0||te>=i.viewFrom&&te<i.viewTo?Y.save():null,Y.nextLine()}),n&&(r.modeFrontier=Y.line),Y}function lt(e,t,n,r){var i=e.doc.mode,L=new Ot(t,e.options.tabSize,n);for(L.start=L.pos=r||0,t==""&&$e(i,n.state);!L.eol();)gt(i,L,n.state),L.start=L.pos}function $e(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=cr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function gt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=cr(e,n).mode);var L=e.token(t,n);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var yt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Pt(e,t,n,r){var i=e.doc,L=i.mode,H;t=c(i,t);var Y=ft(i,t.line),Q=ot(e,t.line,n),te=new Ot(Y.text,e.options.tabSize,Q),be;for(r&&(be=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,H=gt(L,te,Q.state),r&&be.push(new yt(te,H,ar(i.mode,Q.state)));return r?be:new yt(te,H,Q.state)}function nr(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 Yt(e,t,n,r,i,L,H){var Y=n.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,te=null,be=new Ot(t,e.options.tabSize,r),Te,Ne=e.options.addModeClass&&[null];for(t==""&&nr($e(n,r.state),L);!be.eol();){if(be.pos>e.options.maxHighlightLength?(Y=!1,H&&lt(e,t,r,be.pos),be.pos=t.length,Te=null):Te=nr(gt(n,be,r.state,Ne),L),Ne){var _e=Ne[0].name;_e&&(Te="m-"+(Te?_e+" "+Te:_e))}if(!Y||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 Qt(e,t,n){for(var r,i,L=e.doc,H=n?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>H;--Y){if(Y<=L.first)return L.first;var Q=ft(L,Y-1),te=Q.stateAfter;if(te&&(!n||Y+(te instanceof q?te.lookAhead:0)<=L.modeFrontier))return Y;var be=X(Q.text,null,e.options.tabSize);(i==null||r>be)&&(i=Y-1,r=be)}return i}function vr(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 Wr=!1,tr=!1;function Vt(){Wr=!0}function Cr(){tr=!0}function zr(e,t,n){this.marker=e,this.from=t,this.to=n}function ir(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function dn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Or(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var L=e[i],H=L.marker,Y=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(Y||L.from==t&&H.type=="bookmark"&&(!n||!L.marker.insertLeft)){var Q=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(r||(r=[])).push(new zr(H,L.from,Q?null:L.to))}}return r}function Rn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var L=e[i],H=L.marker,Y=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(Y||L.from==t&&H.type=="bookmark"&&(!n||L.marker.insertLeft)){var Q=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(r||(r=[])).push(new zr(H,Q?null:L.from-t,L.to==null?null:L.to-t))}}return r}function on(e,t){if(t.full)return null;var n=sr(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=sr(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,L=t.to.ch,H=Lt(t.from,t.to)==0,Y=Or(n,i,H),Q=Rn(r,L,H),te=t.text.length==1,be=J(t.text).length+(te?i:0);if(Y)for(var Te=0;Te<Y.length;++Te){var Ne=Y[Te];if(Ne.to==null){var _e=ir(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 rt=Q[Je];if(rt.to!=null&&(rt.to+=be),rt.from==null){var st=ir(Y,rt.marker);st||(rt.from=be,te&&(Y||(Y=[])).push(rt))}else rt.from+=be,te&&(Y||(Y=[])).push(rt)}Y&&(Y=qr(Y)),Q&&Q!=Y&&(Q=qr(Q));var ct=[Y];if(!te){var bt=t.text.length-2,ht;if(bt>0&&Y)for(var St=0;St<Y.length;++St)Y[St].to==null&&(ht||(ht=[])).push(new zr(Y[St].marker,null,null));for(var Dt=0;Dt<bt;++Dt)ct.push(ht);ct.push(Q)}return ct}function qr(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 gn(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 rt=_e.markedSpans[Je].marker;rt.readOnly&&(!r||pe(r,rt)==-1)&&(r||(r=[])).push(rt)}}),!r)return null;for(var i=[{from:t,to:n}],L=0;L<r.length;++L)for(var H=r[L],Y=H.find(0),Q=0;Q<i.length;++Q){var te=i[Q];if(Lt(te.to,Y.from)<0||Lt(te.from,Y.to)>0)continue;var be=[Q,1],Te=Lt(te.from,Y.from),Ne=Lt(te.to,Y.to);(Te<0||!H.inclusiveLeft&&!Te)&&be.push({from:te.from,to:Y.from}),(Ne>0||!H.inclusiveRight&&!Ne)&&be.push({from:Y.to,to:te.to}),i.splice.apply(i,be),Q+=be.length-3}return i}function Gn(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 vn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function hr(e){return e.inclusiveLeft?-1:0}function Xt(e){return e.inclusiveRight?1:0}function Pr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),L=Lt(r.from,i.from)||hr(e)-hr(t);if(L)return-L;var H=Lt(r.to,i.to)||Xt(e)-Xt(t);return H||t.id-e.id}function Wt(e,t){var n=tr&&e.markedSpans,r;if(n)for(var i=void 0,L=0;L<n.length;++L)i=n[L],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Pr(r,i.marker)<0)&&(r=i.marker);return r}function Sr(e){return Wt(e,!0)}function qt(e){return Wt(e,!1)}function pn(e,t){var n=tr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var L=n[i];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!r||Pr(r,L.marker)<0)&&(r=L.marker)}return r}function Ar(e,t,n,r,i){var L=ft(e,t),H=tr&&L.markedSpans;if(H)for(var Y=0;Y<H.length;++Y){var Q=H[Y];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),be=Lt(te.from,n)||hr(Q.marker)-hr(i),Te=Lt(te.to,r)||Xt(Q.marker)-Xt(i);if(be>=0&&Te<=0||be<=0&&Te>=0)continue;if(be<=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?Lt(te.to,n)>=0:Lt(te.to,n)>0)||be>=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?Lt(te.from,r)<=0:Lt(te.from,r)<0))return!0}}function Nr(e){for(var t;t=Sr(e);)e=t.find(-1,!0).line;return e}function An(e){for(var t;t=qt(e);)e=t.find(1,!0).line;return e}function xn(e){for(var t,n;t=qt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function _n(e,t){var n=ft(e,t),r=Nr(n);return n==r?t:It(r)}function Cn(e,t){if(t>e.lastLine())return t;var n=ft(e,t),r;if(!sn(e,n))return t;for(;r=qt(n);)n=r.find(1,!0).line;return It(n)+1}function sn(e,t){var n=tr&&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&&Pn(e,t,r))return!0}}function Pn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Pn(e,r.line,ir(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,L=0;L<t.markedSpans.length;++L)if(i=t.markedSpans[L],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Pn(e,t,i))return!0}function cn(e){e=Nr(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 L=n.parent;L;n=L,L=n.parent)for(var H=0;H<L.children.length;++H){var Y=L.children[H];if(Y==n)break;t+=Y.height}return t}function zn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Sr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=qt(r);){var L=n.find(0,!0);t-=r.text.length-L.from.ch,r=L.to.line,t+=r.text.length-L.to.ch}return t}function ri(e){var t=e.display,n=e.doc;t.maxLine=ft(n,n.first),t.maxLineLength=zn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=zn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Ln=function(e,t,n){this.text=e,vn(this,t),this.height=n?n(this):1};Ln.prototype.lineNo=function(){return It(this)},Ce(Ln);function Ut(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gn(e),vn(e,n);var i=r?r(e):1;i!=e.height&&ur(e,i)}function Xe(e){e.parent=null,Gn(e)}var Ye={},pt={};function xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?pt:Ye;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Mt(e,t){var n=C("span",null,null,_?"padding-right: .1px":null),r={pre:C("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 L=i?t.rest[i-1]:t.line,H=void 0;r.pos=0,r.addToken=Bt,Ct(e.display.measure)&&(H=Ke(L,e.doc.direction))&&(r.addToken=Lr(r.addToken,H)),r.map=[];var Y=t!=e.display.externalMeasured&&It(L);Zr(L,r,Qe(e,L,Y)),L.styleClasses&&(L.styleClasses.bgClass&&(r.bgClass=F(L.styleClasses.bgClass,r.bgClass||"")),L.styleClasses.textClass&&(r.textClass=F(L.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(vt(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(_){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 Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=F(r.pre.className,r.textClass||"")),r}function $t(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 Bt(e,t,n,r,i,L,H){if(!t)return;var Y=e.splitSpaces?dr(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,be;if(!Q.test(t))e.col+=t.length,be=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,be),G&&W<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(Y.slice(Te,Te+_e));G&&W<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 rt=void 0;if(Ne[0]==" "){var st=e.cm.options.tabSize,ct=st-e.col%st;rt=be.appendChild(a("span",se(ct),"cm-tab")),rt.setAttribute("role","presentation"),rt.setAttribute("cm-text"," "),e.col+=ct}else Ne[0]=="\r"||Ne[0]==`
`?(rt=be.appendChild(a("span",Ne[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),rt.setAttribute("cm-text",Ne[0]),e.col+=1):(rt=e.cm.options.specialCharPlaceholder(Ne[0]),rt.setAttribute("cm-text",Ne[0]),G&&W<9?be.appendChild(a("span",[rt])):be.appendChild(rt),e.col+=1);e.map.push(e.pos,e.pos+1,rt),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,n||r||i||te||L||H){var bt=n||"";r&&(bt+=r),i&&(bt+=i);var ht=a("span",[be],bt,L);if(H)for(var St in H)H.hasOwnProperty(St)&&St!="style"&&St!="class"&&ht.setAttribute(St,H[St]);return e.content.appendChild(ht)}e.content.appendChild(be)}function dr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var L=e.charAt(i);L==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(L="\xA0"),r+=L,n=L==" "}return r}function Lr(e,t){return function(n,r,i,L,H,Y,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,L,H,Y,Q);e(n,r.slice(0,Te.to-te),i,L,null,Y,Q),L=null,r=r.slice(Te.to-te),te=Te.to}}}function Ft(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 Zr(e,t,n){var r=e.markedSpans,i=e.text,L=0;if(!r){for(var H=1;H<n.length;H+=2)t.addToken(t,i.slice(L,L=n[H]),xt(n[H+1],t.cm.options));return}for(var Y=i.length,Q=0,te=1,be="",Te,Ne,_e=0,Je,rt,st,ct,bt;;){if(_e==Q){Je=rt=st=Ne="",bt=null,ct=null,_e=Infinity;for(var ht=[],St=void 0,Dt=0;Dt<r.length;++Dt){var At=r[Dt],Ht=At.marker;if(Ht.type=="bookmark"&&At.from==Q&&Ht.widgetNode)ht.push(Ht);else if(At.from<=Q&&(At.to==null||At.to>Q||Ht.collapsed&&At.to==Q&&At.from==Q)){if(At.to!=null&&At.to!=Q&&_e>At.to&&(_e=At.to,rt=""),Ht.className&&(Je+=" "+Ht.className),Ht.css&&(Ne=(Ne?Ne+";":"")+Ht.css),Ht.startStyle&&At.from==Q&&(st+=" "+Ht.startStyle),Ht.endStyle&&At.to==_e&&(St||(St=[])).push(Ht.endStyle,At.to),Ht.title&&((bt||(bt={})).title=Ht.title),Ht.attributes)for(var lr in Ht.attributes)(bt||(bt={}))[lr]=Ht.attributes[lr];Ht.collapsed&&(!ct||Pr(ct.marker,Ht)<0)&&(ct=At)}else At.from>Q&&_e>At.from&&(_e=At.from)}if(St)for(var Br=0;Br<St.length;Br+=2)St[Br+1]==_e&&(rt+=" "+St[Br]);if(!ct||ct.from==Q)for(var br=0;br<ht.length;++br)Ft(t,0,ht[br]);if(ct&&(ct.from||0)==Q){if(Ft(t,(ct.to==null?Y+1:ct.to)-Q,ct.marker,ct.from==null),ct.to==null)return;ct.to==Q&&(ct=!1)}}if(Q>=Y)break;for(var un=Math.min(Y,_e);;){if(be){var rn=Q+be.length;if(!ct){var Rr=rn>un?be.slice(0,un-Q):be;t.addToken(t,Rr,Te?Te+Je:Je,st,Q+Rr.length==_e?rt:"",Ne,bt)}if(rn>=un){be=be.slice(un-Q),Q=un;break}Q=rn,st=""}be=i.slice(L,L=n[te++]),Te=xt(n[te++],t.cm.options)}}}function Gt(e,t,n){this.line=t,this.rest=xn(t),this.size=this.rest?It(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=sn(e,t)}function kr(e,t,n){for(var r=[],i,L=t;L<n;L=i){var H=new Gt(e.doc,ft(e.doc,L),L);i=L+H.size,r.push(H)}return r}var pr=null;function Mr(e){pr?pr.ops.push(e):e.ownsGroup=pr={ops:[e],delayedCallbacks:[]}}function Mn(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 In(e,t){var n=e.ownsGroup;if(!n)return;try{Mn(n)}finally{pr=null,t(n)}}var mn=null;function fr(e,t){var n=tt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;pr?i=pr.delayedCallbacks:mn?i=mn:(i=mn=[],setTimeout(Gi,0));for(var L=function(Y){i.push(function(){return n[Y].apply(null,r)})},H=0;H<n.length;++H)L(H)}function Gi(){var e=mn;mn=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var L=t.changes[i];L=="text"?Ms(e,t):L=="gutter"?qa(e,t,n,r):L=="class"?fa(e,t):L=="widget"&&Is(e,t,r)}t.changes=null}function Ei(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),G&&W<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=Ei(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Qa(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Mt(e,t)}function Ms(e,t){var n=t.text.className,r=Qa(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,fa(e,t)):n&&(t.text.className=n)}function fa(e,t){Ps(e,t),t.line.wrapClass?Ei(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 qa(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=Ei(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 L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=Ei(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),H.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",Yr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,be=L.hasOwnProperty(te)&&L[te];be&&Y.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,L=void 0;i;i=L)L=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Ns(e,t,n,r){var i=Qa(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),fa(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var L=Ei(n),H=0,Y=t.widgets;H<Y.length;++H){var Q=Y[H],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?L.insertBefore(te,n.gutter||n.text):L.appendChild(te),fr(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 xi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(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;"),l(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 zi(e){return e.lineSpace.offsetTop}function pa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(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 Sn(e){return ve-e.display.nativeBarWidth}function Vn(e){return e.display.scroller.clientWidth-Sn(e)-e.display.barWidth}function ma(e){return e.display.scroller.clientHeight-Sn(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&Vn(e);if(!t.measure.heights||r&&t.measure.width!=i){var L=t.measure.heights=[];if(r){t.measure.width=i;for(var H=t.text.firstChild.getClientRects(),Y=0;Y<H.length-1;Y++){var Q=H[Y],te=H[Y+1];Math.abs(Q.bottom-te.bottom)>2&&L.push((Q.bottom+te.top)/2-n.top)}}L.push(n.bottom-n.top)}}function no(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(It(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Nr(t);var n=It(t),r=e.display.externalMeasured=new Gt(e.doc,t,n);r.lineN=n;var i=r.built=Mt(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Tn(e,ni(e,t),n,r)}function ga(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[$n(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function ni(e,t){var n=It(t),r=ga(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ca(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Tn(e,t,n,r,i){t.before&&(n=-1);var L=n+(r||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,n,r),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:i?H.rtop:H.top,bottom:i?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,L,H,Y,Q,te=0;te<e.length;te+=3)if(Y=e[te],Q=e[te+1],t<Y?(i=0,L=1,H="left"):t<Q?(i=t-Y,L=i+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(L=Q-Y,i=L-1,t>=Q&&(H="right")),i!=null){if(r=e[te+2],Y==Q&&n==(r.insertLeft?"left":"right")&&(H=n),n=="left"&&i==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],H="left";if(n=="right"&&i==Q-Y)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],H="right";break}return{node:r,start:i,end:L,collapse:H,coverStart:Y,coverEnd:Q}}function js(e,t){var n=ao;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=oo(t.map,n,r),L=i.node,H=i.start,Y=i.end,Q=i.collapse,te;if(L.nodeType==3){for(var be=0;be<4;be++){for(;H&&He(t.line.text.charAt(i.coverStart+H));)--H;for(;i.coverStart+Y<i.coverEnd&&He(t.line.text.charAt(i.coverStart+Y));)++Y;if(G&&W<9&&H==0&&Y==i.coverEnd-i.coverStart?te=L.parentNode.getBoundingClientRect():te=js(m(L,H,Y).getClientRects(),r),te.left||te.right||H==0)break;Y=H,H=H-1,Q="right"}G&&W<11&&(te=Hs(e.display.measure,te))}else{H>0&&(Q=r="right");var Te;e.options.lineWrapping&&(Te=L.getClientRects()).length>1?te=Te[r=="right"?Te.length-1:0]:te=L.getBoundingClientRect()}if(G&&W<9&&!H&&(!te||!te.left&&!te.right)){var Ne=L.parentNode.getClientRects()[0];Ne?te={left:Ne.left,right:Ne.left+ai(e.display),top:Ne.top,bottom:Ne.bottom}:te=ao}for(var _e=te.top-t.rect.top,Je=te.bottom-t.rect.top,rt=(_e+Je)/2,st=t.view.measure.heights,ct=0;ct<st.length-1&&!(rt<st[ct]);ct++);var bt=ct?st[ct-1]:0,ht=st[ct],St={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:bt,bottom:ht};return!te.left&&!te.right&&(St.bogus=!0),e.options.singleCursorHeightPerLine||(St.rtop=_e,St.rbottom=Je),St}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!zt(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 so(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 lo(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function Ci(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return y&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return y&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function va(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=xi(e.widgets[n]));return t}function Vi(e,t,n,r,i){if(!i){var L=va(t);n.top+=L,n.bottom+=L}if(r=="line")return n;r||(r="local");var H=cn(t);if(r=="local"?H+=zi(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();H+=Y.top+(r=="window"?0:co());var Q=Y.left+(r=="window"?0:uo());n.left+=Q,n.right+=Q}return n.top+=H,n.bottom+=H,n}function ho(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var L=e.display.sizer.getBoundingClientRect();r+=L.left,i+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:i-H.top}}function ya(e,t,n,r,i){return r||(r=ft(e.doc,t.line)),Vi(e,r,io(e,r,t.ch,i),n)}function yn(e,t,n,r,i,L){r=r||ft(e.doc,t.line),i||(i=ni(e,r));function H(Je,rt){var st=Tn(e,i,Je,rt?"right":"left",L);return rt?st.left=st.right:st.right=st.left,Vi(e,r,st,n)}var Y=Ke(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"),!Y)return H(te=="before"?Q-1:Q,te=="before");function be(Je,rt,st){var ct=Y[rt],bt=ct.level==1;return H(st?Je-1:Je,bt!=st)}var Te=Be(Y,Q,te),Ne=Ie,_e=be(Q,Te,te=="before");return Ne!=null&&(_e.other=be(Q,Ne,te!="before")),_e}function fo(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=ai(e.display)*t.ch);var r=ft(e.doc,t.line),i=cn(r)+zi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ba(e,t,n,r,i){var L=et(e,t,n);return L.xRel=i,r&&(L.outside=r),L}function Ea(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ba(r.first,0,null,-1,-1);var i=gr(r,n),L=r.first+r.size-1;if(i>L)return ba(r.first+r.size-1,ft(r,L).text.length,null,1,1);t<0&&(t=0);for(var H=ft(r,i);;){var Y=Ks(e,H,i,t,n),Q=pn(H,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var te=Q.find(1);if(te.line==i)return te;H=ft(r,i=te.line)}}function po(e,t,n,r){r-=va(t);var i=t.text.length,L=qe(function(H){return Tn(e,n,H-1).bottom<=r},i,0);return i=qe(function(H){return Tn(e,n,H).top>r},L,i),{begin:L,end:i}}function mo(e,t,n,r){n||(n=ni(e,t));var i=Vi(e,t,Tn(e,n,r),"line").top;return po(e,t,n,i)}function xa(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 L=ni(e,t),H=va(t),Y=0,Q=t.text.length,te=!0,be=Ke(t,e.doc.direction);if(be){var Te=(e.options.lineWrapping?zs:Gs)(e,t,n,L,be,r,i);te=Te.level!=1,Y=te?Te.from:Te.to-1,Q=te?Te.to:Te.from-1}var Ne=null,_e=null,Je=qe(function(Dt){var At=Tn(e,L,Dt);return At.top+=H,At.bottom+=H,xa(At,r,i,!1)?(At.top<=i&&At.left<=r&&(Ne=Dt,_e=At),!0):!1},Y,Q),rt,st,ct=!1;if(_e){var bt=r-_e.left<_e.right-r,ht=bt==te;Je=Ne+(ht?0:1),st=ht?"after":"before",rt=bt?_e.left:_e.right}else{!te&&(Je==Q||Je==Y)&&Je++,st=Je==0?"after":Je==t.text.length?"before":Tn(e,L,Je-(te?1:0)).bottom+H<=i==te?"after":"before";var St=yn(e,et(n,Je,st),"line",t,L);rt=St.left,ct=i<St.top?-1:i>=St.bottom?1:0}return Je=Fe(t.text,Je,1),ba(n,Je,st,ct,r-rt)}function Gs(e,t,n,r,i,L,H){var Y=qe(function(Te){var Ne=i[Te],_e=Ne.level!=1;return xa(yn(e,et(n,_e?Ne.to:Ne.from,_e?"before":"after"),"line",t,r),L,H,!0)},0,i.length-1),Q=i[Y];if(Y>0){var te=Q.level!=1,be=yn(e,et(n,te?Q.from:Q.to,te?"after":"before"),"line",t,r);xa(be,L,H,!0)&&be.top>H&&(Q=i[Y-1])}return Q}function zs(e,t,n,r,i,L,H){var Y=po(e,t,r,H),Q=Y.begin,te=Y.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,rt=Tn(e,r,Je?Math.min(te,_e.to)-1:Math.max(Q,_e.from)).right,st=rt<L?L-rt+1e9:rt-L;(!be||Te>st)&&(be=_e,Te=st)}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 Xn;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Xn==null){Xn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Xn.appendChild(document.createTextNode("x")),Xn.appendChild(a("br"));Xn.appendChild(document.createTextNode("x"))}l(e.measure,Xn);var n=Xn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function ai(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ca(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var Y=e.display.gutterSpecs[H].className;n[Y]=L.offsetLeft+L.clientLeft+i,r[Y]=L.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=ii(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ai(e.display)-3);return function(i){if(sn(e.doc,i))return 0;var L=0;if(i.widgets)for(var H=0;H<i.widgets.length;H++)i.widgets[H].height&&(L+=i.widgets[H].height);return n?L+(Math.ceil(i.text.length/r)||1)*t:L+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&ur(r,i)})}function Yn(e,t,n,r){var i=e.display;if(!n&&we(t).getAttribute("cm-not-content")=="true")return null;var L,H,Y=i.lineSpace.getBoundingClientRect();try{L=t.clientX-Y.left,H=t.clientY-Y.top}catch(Te){return null}var Q=Ea(e,L,H),te;if(r&&Q.xRel>0&&(te=ft(e.doc,Q.line).text).length==Q.ch){var be=X(te,te.length,e.options.tabSize)-te.length;Q=et(Q.line,Math.max(0,Math.round((L-ro(e.display).left)/ai(e.display))-be))}return Q}function $n(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 en(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)tr&&_n(e.doc,t)<i.viewTo&&Fn(e);else if(n<=i.viewFrom)tr&&Cn(e.doc,n+r)>i.viewFrom?Fn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Fn(e);else if(t<=i.viewFrom){var L=Xi(e,n,n+r,1);L?(i.view=i.view.slice(L.index),i.viewFrom=L.lineN,i.viewTo+=r):Fn(e)}else if(n>=i.viewTo){var H=Xi(e,t,t,-1);H?(i.view=i.view.slice(0,H.index),i.viewTo=H.lineN):Fn(e)}else{var Y=Xi(e,t,t,-1),Q=Xi(e,n,n+r,1);Y&&Q?(i.view=i.view.slice(0,Y.index).concat(kr(e,Y.lineN,Q.lineN)).concat(i.view.slice(Q.index)),i.viewTo+=r):Fn(e)}var te=i.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(i.externalMeasured=null))}function Nn(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 L=r.view[$n(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);pe(H,n)==-1&&H.push(n)}function Fn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Xi(e,t,n,r){var i=$n(e,t),L,H=e.display.view;if(!tr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var Y=e.display.viewFrom,Q=0;Q<i;Q++)Y+=H[Q].size;if(Y!=t){if(r>0){if(i==H.length-1)return null;L=Y+H[i].size-t,i++}else L=Y-t;t+=L,n+=L}for(;_n(e.doc,n)!=n;){if(i==(r<0?0:H.length-1))return null;n+=r*H[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=kr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=kr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice($n(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(kr(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,$n(e,n)))),r.viewTo=n}function vo(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 Si(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),L=r.selection=document.createDocumentFragment(),H=0;H<n.sel.ranges.length;H++){if(!t&&H==n.sel.primIndex)continue;var Y=n.sel.ranges[H];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&bo(e,Y.head,i),Q||Xs(e,Y,L)}return r}function bo(e,t,n){var r=yn(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 L=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=r.other.left+"px",L.style.top=r.other.top+"px",L.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Yi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,L=document.createDocumentFragment(),H=ro(e.display),Y=H.left,Q=Math.max(r.sizerWidth,Vn(e)-r.sizer.offsetLeft)-H.right,te=i.direction=="ltr";function be(ht,St,Dt,At){St<0&&(St=0),St=Math.round(St),At=Math.round(At),L.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ht+`px;
top: `+St+"px; width: "+(Dt==null?Q-ht:Dt)+`px;
height: `+(At-St)+"px"))}function Te(ht,St,Dt){var At=ft(i,ht),Ht=At.text.length,lr,Br;function br(Rr,nn){return ya(e,et(ht,Rr),"div",At,nn)}function un(Rr,nn,Hr){var Ir=mo(e,At,null,Rr),_r=nn=="ltr"==(Hr=="after")?"left":"right",Tr=Hr=="after"?Ir.begin:Ir.end-(/\s/.test(At.text.charAt(Ir.end-1))?2:1);return br(Tr,_r)[_r]}var rn=Ke(At,i.direction);return De(rn,St||0,Dt==null?Ht:Dt,function(Rr,nn,Hr,Ir){var _r=Hr=="ltr",Tr=br(Rr,_r?"left":"right"),an=br(nn-1,_r?"right":"left"),yi=St==null&&Rr==0,Kn=Dt==null&&nn==Ht,Xr=Ir==0,wn=!rn||Ir==rn.length-1;if(an.top-Tr.top<=3){var jr=(te?yi:Kn)&&Xr,$a=(te?Kn:yi)&&wn,On=jr?Y:(_r?Tr:an).left,ei=$a?Q:(_r?an:Tr).right;be(On,Tr.top,ei-On,Tr.bottom)}else{var ti,Qr,bi,Za;_r?(ti=te&&yi&&Xr?Y:Tr.left,Qr=te?Q:un(Rr,Hr,"before"),bi=te?Y:un(nn,Hr,"after"),Za=te&&Kn&&wn?Q:an.right):(ti=te?un(Rr,Hr,"before"):Y,Qr=!te&&yi&&Xr?Q:Tr.right,bi=!te&&Kn&&wn?Y:an.left,Za=te?un(nn,Hr,"after"):Q),be(ti,Tr.top,Qr-ti,Tr.bottom),Tr.bottom<an.top&&be(Y,Tr.bottom,null,an.top),be(bi,an.top,Za-bi,an.bottom)}(!lr||Yi(Tr,lr)<0)&&(lr=Tr),Yi(an,lr)<0&&(lr=an),(!Br||Yi(Tr,Br)<0)&&(Br=Tr),Yi(an,Br)<0&&(Br=an)}),{start:lr,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),rt=ft(i,_e.line),st=Nr(Je)==Nr(rt),ct=Te(Ne.line,Ne.ch,st?Je.text.length+1:null).end,bt=Te(_e.line,st?0:null,_e.ch).start;st&&(ct.top<bt.top-2?(be(ct.right,ct.top,null,ct.bottom),be(Y,bt.top,bt.left,bt.bottom)):be(ct.right,ct.top,bt.left-ct.right,ct.bottom)),ct.bottom<bt.top&&be(Y,ct.bottom,null,bt.top)}n.appendChild(L)}function wa(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()||oi(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),Aa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,oi(e))},100)}function Aa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Me(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(),_&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),wa(e)}function oi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,s(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function $i(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],L=e.options.lineWrapping,H=void 0,Y=0;if(i.hidden)continue;if(G&&W<8){var Q=i.node.offsetTop+i.node.offsetHeight;H=Q-n,n=Q}else{var te=i.node.getBoundingClientRect();H=te.bottom-te.top,!L&&i.text.firstChild&&(Y=i.text.firstChild.getBoundingClientRect().right-te.left-1)}var be=i.line.height-H;if((be>.005||be<-.005)&&(ur(i.line,H),Co(i.line),i.rest))for(var Te=0;Te<i.rest.length;Te++)Co(i.rest[Te]);if(Y>e.display.sizerWidth){var Ne=Math.ceil(Y/ai(e.display));Ne>e.display.maxLineLength&&(e.display.maxLineLength=Ne,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Co(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 Zi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-zi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,L=gr(t,r),H=gr(t,i);if(n&&n.ensure){var Y=n.ensure.from.line,Q=n.ensure.to.line;Y<L?(L=Y,H=gr(t,cn(ft(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=H&&(L=gr(t,cn(ft(t,Q))-e.wrapper.clientHeight),H=Q)}return{from:L,to:Math.max(H,L+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 L=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-zi(e.display))+`px;
height: `+(t.bottom-t.top+Sn(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(i),e.display.lineSpace.removeChild(L)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?et(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?et(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,Y=yn(e,t),Q=!n||n==t?Y:yn(e,n);i={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var te=La(e,i),be=e.doc.scrollTop,Te=e.doc.scrollLeft;if(te.scrollTop!=null&&(wi(e,te.scrollTop),Math.abs(e.doc.scrollTop-be)>1&&(H=!0)),te.scrollLeft!=null&&(Zn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Te)>1&&(H=!0)),!H)break}return i}function Zs(e,t){var n=La(e,t);n.scrollTop!=null&&wi(e,n.scrollTop),n.scrollLeft!=null&&Zn(e,n.scrollLeft)}function La(e,t){var n=e.display,r=ii(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,L=ma(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var Y=e.doc.height+pa(n),Q=t.top<r,te=t.bottom>Y-r;if(t.top<i)H.scrollTop=Q?0:t.top;else if(t.bottom>i+L){var be=Math.min(t.top,(te?Y:t.bottom)-L);be!=i&&(H.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=Vn(e)-n.gutters.offsetWidth,Je=t.right-t.left>_e;return Je&&(t.right=t.left+_e),t.left<10?H.scrollLeft=0:t.left<Ne?H.scrollLeft=Math.max(0,t.left+Te-(Je?0:10)):t.right>_e+Ne-3&&(H.scrollLeft=t.right+(Je?0:10)-_e),H}function ka(e,t){if(t==null)return;Ji(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function si(e){Ji(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ti(e,t,n){(t!=null||n!=null)&&Ji(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ji(e),e.curOp.scrollToPos=t}function Ji(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=fo(e,t.from),r=fo(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=La(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});Ti(e,i.scrollLeft,i.scrollTop)}function wi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Oa(e,{top:t}),To(e,t,!0),D&&Oa(e),ki(e,100)}function To(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,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ai(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+pa(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+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Jn=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,G&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Jn.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 L=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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}},Jn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Jn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Jn.prototype.zeroWidthHack=function(){var e=u&&!k?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new oe,this.disableVert=new oe},Jn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),L=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Jn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Li=function(){};Li.prototype.update=function(){return{bottom:0,right:0}},Li.prototype.setScrollLeft=function(){},Li.prototype.setScrollTop=function(){},Li.prototype.clear=function(){};function li(e,t){t||(t=Ai(e));var n=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&$i(e),wo(e,Ai(e)),n=e.display.barWidth,r=e.display.barHeight}function wo(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 Ao={native:Jn,null:Li};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[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):wi(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Qn(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},Mr(e.curOp)}function qn(e){var t=e.curOp;t&&In(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 L=0;L<t.length;L++)nl(t[L]);for(var H=0;H<t.length;H++)il(t[H])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ri(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 Qi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Da(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&$i(t),e.barMeasure=Ai(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+Sn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Vn(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==U();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&li(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&wa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&ko(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&To(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 L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var Y=0;Y<L.length;++Y)L[Y].lines.length||Me(L[Y],"hide");if(H)for(var Q=0;Q<H.length;++Q)H[Q].lines.length&&Me(H[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ln(e,t){if(e.curOp)return t();Qn(e);try{return t()}finally{qn(e)}}function Fr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Qn(e);try{return t.apply(e,arguments)}finally{qn(e)}}}function Jr(e){return function(){if(this.curOp)return e.apply(this,arguments);Qn(this);try{return e.apply(this,arguments)}finally{qn(this)}}}function Ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Qn(t);try{return e.apply(this,arguments)}finally{qn(t)}}}function ki(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=ot(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(r.line>=e.display.viewFrom){var H=L.styles,Y=L.text.length>e.options.maxHighlightLength?ar(t.mode,r.state):null,Q=Se(e,L,r,!0);Y&&(r.state=Y),L.styles=Q.styles;var te=L.styleClasses,be=Q.classes;be?L.styleClasses=be:te&&(L.styleClasses=null);for(var Te=!H||H.length!=L.styles.length||te!=be&&(!te||!be||te.bgClass!=be.bgClass||te.textClass!=be.textClass),Ne=0;!Te&&Ne<H.length;++Ne)Te=H[Ne]!=L.styles[Ne];Te&&i.push(r.line),L.stateAfter=r.save(),r.nextLine()}else L.text.length<=e.options.maxHighlightLength&&lt(e,L.text,r),L.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ki(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ln(e,function(){for(var L=0;L<i.length;L++)Nn(e,i[L],"text")})}var Qi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Zi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Vn(e),this.force=n,this.dims=Ca(e),this.events=[]};Qi.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},Qi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Me.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=Sn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Sn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=U();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&T(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==U())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(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 Da(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Fn(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&&vo(e)==0)return!1;Oo(e)&&(Fn(e),t.dims=Ca(e));var i=r.first+r.size,L=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<L&&L-n.viewFrom<20&&(L=Math.max(r.first,n.viewFrom)),n.viewTo>H&&n.viewTo-H<20&&(H=Math.min(i,n.viewTo)),tr&&(L=_n(e.doc,L),H=Cn(e.doc,H));var Y=L!=n.viewFrom||H!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,L,H),n.viewOffset=cn(ft(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=vo(e);if(!Y&&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,Y&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ki(e,400)),n.updateLineNumbers=null,!0}function ko(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Vn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+pa(e.display)-ma(e),n.top)}),t.visible=Zi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Zi(e.display,e.doc,n));if(!Da(e,t))break;$i(e);var i=Ai(e);Si(e),li(e,i),_a(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 Oa(e,t){var n=new Qi(e,t);if(Da(e,n)){$i(e),ko(e,n);var r=Ai(e);Si(e),li(e,r),_a(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,L=r.lineDiv,H=L.firstChild;function Y(Je){var rt=Je.nextSibling;return _&&u&&e.display.currentWheelTarget==Je?Je.style.display="none":Je.parentNode.removeChild(Je),rt}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!=L){var Ne=Ns(e,Te,te,n);L.insertBefore(Ne,H)}else{for(;H!=Te.node;)H=Y(H);var _e=i&&t!=null&&t<=te&&Te.lineNumber;Te.changes&&(pe(Te.changes,"gutter")>-1&&(_e=!1),Ja(e,Te,te,n)),_e&&(f(Te.lineNumber),Te.lineNumber.appendChild(document.createTextNode(Yr(e.options,te)))),H=Te.node.nextSibling}te+=Te.size}for(;H;)H=Y(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(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+Sn(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,L=r+"px",H=0;H<n.length;H++)if(!n[H].hidden){e.options.fixedGutter&&(n[H].gutter&&(n[H].gutter.style.left=L),n[H].gutterBackground&&(n[H].gutterBackground.style.left=L));var Y=n[H].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Yr(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")),L=i.firstChild.offsetWidth,H=i.offsetWidth-L;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(L,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function Pa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var L=e[i],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:L,style:H})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(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],L=i.className,H=i.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+L));H&&(Y.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function Di(e){Ro(e.display),en(e),Do(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=C("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=C("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var L=C("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[L],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"),G&&W<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!_&&!(D&&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=Pa(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var qi=0,hn=null;G?hn=-.53:D?hn=15:y?hn=-.7:R&&(hn=-1/3);function _o(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=_o(e);return t.x*=hn,t.y*=hn,t}function Po(e,t){var n=_o(t),r=n.x,i=n.y,L=e.display,H=L.scroller,Y=H.scrollWidth>H.clientWidth,Q=H.scrollHeight>H.clientHeight;if(!(r&&Y||i&&Q))return;if(i&&u&&_){e:for(var te=t.target,be=L.view;te!=H;te=te.parentNode)for(var Te=0;Te<be.length;Te++)if(be[Te].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!D&&!A&&hn!=null){i&&Q&&wi(e,Math.max(0,H.scrollTop+i*hn)),Zn(e,Math.max(0,H.scrollLeft+r*hn)),(!i||i&&Q)&&le(t),L.wheelStartX=null;return}if(i&&hn!=null){var Ne=i*hn,_e=e.doc.scrollTop,Je=_e+L.wrapper.clientHeight;Ne<0?_e=Math.max(0,_e+Ne-50):Je=Math.min(e.doc.height,Je+Ne+50),Oa(e,{top:_e,bottom:Je})}qi<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=r,L.wheelDY=i,setTimeout(function(){if(L.wheelStartX==null)return;var rt=H.scrollLeft-L.wheelStartX,st=H.scrollTop-L.wheelStartY,ct=st&&L.wheelDY&&st/L.wheelDY||rt&&L.wheelDX&&rt/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!ct)return;hn=(hn*qi+ct)/(qi+1),++qi},200)):(L.wheelDX+=r,L.wheelDY+=i))}var fn=function(e,t){this.ranges=e,this.primIndex=t};fn.prototype.primary=function(){return this.ranges[this.primIndex]},fn.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(!Kr(n.anchor,r.anchor)||!Kr(n.head,r.head))return!1}return!0},fn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new er(wr(this.ranges[t].anchor),wr(this.ranges[t].head));return new fn(e,this.primIndex)},fn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},fn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Lt(t,r.from())>=0&&Lt(e,r.to())<=0)return n}return-1};var er=function(e,t){this.anchor=e,this.head=t};er.prototype.from=function(){return Gr(this.anchor,this.head)},er.prototype.to=function(){return $r(this.anchor,this.head)},er.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function bn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Ne,_e){return Lt(Ne.from(),_e.from())}),n=pe(t,i);for(var L=1;L<t.length;L++){var H=t[L],Y=t[L-1],Q=Lt(Y.to(),H.from());if(r&&!H.empty()?Q>0:Q>=0){var te=Gr(Y.from(),H.from()),be=$r(Y.to(),H.to()),Te=Y.empty()?H.from()==H.head:Y.from()==Y.head;L<=n&&--n,t.splice(--L,2,new er(Te?be:te,Te?te:be))}}return new fn(t,n)}function Un(e,t){return new fn([new er(e,t||e)],0)}function Bn(e){return e.text?et(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(Lt(e,t.from)<0)return e;if(Lt(e,t.to)<=0)return Bn(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+=Bn(t).ch-t.to.ch),et(n,r)}function Ma(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new er(Mo(i.anchor,t),Mo(i.head,t)))}return bn(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?et(n.line,e.ch-t.ch+n.ch):et(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],i=et(e.first,0),L=i,H=0;H<t.length;H++){var Y=t[H],Q=Io(Y.from,i,L),te=Io(Bn(Y),i,L);if(i=Y.to,L=te,n=="around"){var be=e.sel.ranges[H],Te=Lt(be.head,be.anchor)<0;r[H]=new er(Te?te:Q,Te?Q:te)}else r[H]=new er(Q,Q)}return new fn(r,e.sel.primIndex)}function Ia(e){e.doc.mode=Zt(e.options,e.doc.modeOption),Oi(e)}function Oi(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,ki(e,100),e.state.modeGen++,e.curOp&&en(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Na(e,t,n,r){function i(bt){return n?n[bt]:null}function L(bt,ht,St){Ut(bt,ht,St,r),fr(bt,"change",bt,t)}function H(bt,ht){for(var St=[],Dt=bt;Dt<ht;++Dt)St.push(new Ln(te[Dt],i(Dt),r));return St}var Y=t.from,Q=t.to,te=t.text,be=ft(e,Y.line),Te=ft(e,Q.line),Ne=J(te),_e=i(te.length-1),Je=Q.line-Y.line;if(t.full)e.insert(0,H(0,te.length)),e.remove(te.length,e.size-te.length);else if(No(e,t)){var rt=H(0,te.length-1);L(Te,Te.text,_e),Je&&e.remove(Y.line,Je),rt.length&&e.insert(Y.line,rt)}else if(be==Te)if(te.length==1)L(be,be.text.slice(0,Y.ch)+Ne+be.text.slice(Q.ch),_e);else{var st=H(1,te.length-1);st.push(new Ln(Ne+be.text.slice(Q.ch),_e,r)),L(be,be.text.slice(0,Y.ch)+te[0],i(0)),e.insert(Y.line+1,st)}else if(te.length==1)L(be,be.text.slice(0,Y.ch)+te[0]+Te.text.slice(Q.ch),i(0)),e.remove(Y.line+1,Je);else{L(be,be.text.slice(0,Y.ch)+te[0],i(0)),L(Te,Ne+Te.text.slice(Q.ch),_e);var ct=H(1,te.length-1);Je>1&&e.remove(Y.line+1,Je-1),e.insert(Y.line+1,ct)}fr(e,"change",e,t)}function jn(e,t,n){function r(i,L,H){if(i.linked)for(var Y=0;Y<i.linked.length;++Y){var Q=i.linked[Y];if(Q.doc==L)continue;var te=H&&Q.sharedHist;if(n&&!te)continue;t(Q.doc,te),r(Q.doc,i,te)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ia(e),Uo(e),e.options.lineWrapping||ri(e),e.options.mode=t.modeOption,en(e)}function Uo(e){(e.doc.direction=="rtl"?j:s)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){ln(e,function(){Uo(e),en(e)})}function ea(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 Fa(e,t){var n={from:wr(t.from),to:Bn(t),text:or(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),jn(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(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 jo(e,t,n,r){var i=e.history;i.undone.length=0;var L=+new Date,H,Y;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(i,i.lastOp==r)))Y=J(H.changes),Lt(t.from,t.to)==0&&Lt(t.from,Y.to)==0?Y.to=Bn(t):H.changes.push(Fa(e,t));else{var Q=J(i.done);for((!Q||!Q.ranges)&&ta(e.sel,i.done),H={changes:[Fa(e,t)],generation:i.generation},i.done.push(H);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=L,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,Y||Me(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,L=r&&r.origin;n==i.lastSelOp||L&&i.lastSelOrigin==L&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==L||ml(e,L,J(i.done),t))?i.done[i.done.length-1]=t:ta(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=L,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function ta(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((i||(i=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}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 Ho(e,t){var n=yl(e,t),r=on(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var L=n[i],H=r[i];if(L&&H){e:for(var Y=0;Y<H.length;++Y){for(var Q=H[Y],te=0;te<L.length;++te)if(L[te].marker==Q.marker)continue e;L.push(Q)}}else H&&(n[i]=H)}return n}function ui(e,t,n){for(var r=[],i=0;i<e.length;++i){var L=e[i];if(L.ranges){r.push(n?fn.prototype.deepCopy.call(L):L);continue}var H=L.changes,Y=[];r.push({changes:Y});for(var Q=0;Q<H.length;++Q){var te=H[Q],be=void 0;if(Y.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(Y)[Te]=te[Te],delete te[Te]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var L=Lt(t,i)<0;L!=Lt(n,i)<0?(i=t,t=n):L!=Lt(t,n)<0&&(t=n)}return new er(i,t)}else return new er(n||t,t)}function ra(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vr(e,new fn([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)r[L]=Ua(e.sel.ranges[L],t[L],null,i);var H=bn(e.cm,r,e.sel.primIndex);Vr(e,H,n)}function Ba(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Vr(e,bn(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Vr(e,Un(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var L=0;L<i.length;L++)this.ranges[L]=new er(c(e,i[L].anchor),c(e,i[L].head))},origin:n&&n.origin};return Me(e,"beforeSelectionChange",e,r),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?bn(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,na(e,t,n)):Vr(e,t,n)}function Vr(e,t,n){na(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function na(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(Lt(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&si(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),fr(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,L=0;L<t.ranges.length;L++){var H=t.ranges[L],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],Q=ia(e,H.anchor,Y&&Y.anchor,n,r),te=ia(e,H.head,Y&&Y.head,n,r);(i||Q!=H.anchor||te!=H.head)&&(i||(i=t.ranges.slice(0,L)),i[L]=new er(Q,te))}return i?bn(e.cm,i,t.primIndex):t}function di(e,t,n,r,i){var L=ft(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var Y=L.markedSpans[H],Q=Y.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,be="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(te?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(be?Y.to>=t.ch:Y.to>t.ch))){if(i&&(Me(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(L.markedSpans){--H;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=$o(e,Te,-r,Te&&Te.line==t.line?L:null)),Te&&Te.line==t.line&&(Ne=Lt(Te,n))&&(r<0?Ne<0:Ne>0))return di(e,Te,t,r,i)}var _e=Q.find(r<0?-1:1);return(r<0?te:be)&&(_e=$o(e,_e,r,_e.line==t.line?L:null)),_e?di(e,_e,t,r,i):null}}return t}function ia(e,t,n,r,i){var L=r||1,H=di(e,t,n,L,i)||!i&&di(e,t,n,L,!0)||di(e,t,n,-L,i)||!i&&di(e,t,n,-L,!0);return H||(e.cantEdit=!0,et(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?c(e,et(t.line-1)):null:n>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+n)}function Zo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),ke)}function Jo(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,L,H,Y){i&&(r.from=c(e,i)),L&&(r.to=c(e,L)),H&&(r.text=H),Y!==void 0&&(r.origin=Y)}),Me(e,"beforeChange",e,r),e.cm&&Me(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 ci(e,t,n){if(e.cm){if(!e.cm.curOp)return Fr(e.cm,ci)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Wr&&!n&&gn(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Qo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Qo(e,t)}function Qo(e,t){if(t.text.length==1&&t.text[0]==""&&Lt(t.from,t.to)==0)return;var n=Ma(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),Ri(e,t,n,on(e,t));var r=[];jn(e,function(i,L){!L&&pe(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),Ri(i,t,null,on(i,t))})}function aa(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,L,H=e.sel,Y=t=="undo"?i.done:i.undone,Q=t=="undo"?i.undone:i.done,te=0;te<Y.length&&!(L=Y[te],n?L.ranges&&!L.equals(e.sel):!L.ranges);te++);if(te==Y.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(L=Y.pop(),L.ranges){if(ta(L,Q),n&&!L.equals(e.sel)){Vr(e,L,{clearRedo:!1});return}H=L}else if(r){Y.push(L);return}else break;var be=[];ta(H,Q),Q.push({changes:be,generation:i.generation}),i.generation=L.generation||++i.maxGeneration;for(var Te=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Ne=function(rt){var st=L.changes[rt];if(st.origin=t,Te&&!Jo(e,st,!1))return Y.length=0,{};be.push(Fa(e,st));var ct=rt?Ma(e,st):J(Y);Ri(e,st,ct,Ho(e,st)),!rt&&e.cm&&e.cm.scrollIntoView({from:st.from,to:Bn(st)});var bt=[];jn(e,function(ht,St){!St&&pe(bt,ht.history)==-1&&(rs(ht.history,st),bt.push(ht.history)),Ri(ht,st,null,Ho(ht,st))})},_e=L.changes.length-1;_e>=0;--_e){var Je=Ne(_e);if(Je)return Je.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new fn(ee(e.sel.ranges,function(i){return new er(et(i.anchor.line+t,i.anchor.ch),et(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){en(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Nn(e.cm,r,"gutter")}}function Ri(e,t,n,r){if(e.cm&&!e.cm.curOp)return Fr(e.cm,Ri)(e,t,n,r);if(t.to.line<e.first){qo(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);qo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:et(L,ft(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=or(e,t.from,t.to),n||(n=Ma(e,t)),e.cm?El(e.cm,t,r):Na(e,t,r),na(e,n,ke),e.cantEdit&&ia(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,L=t.from,H=t.to,Y=!1,Q=L.line;e.options.lineWrapping||(Q=It(Nr(ft(r,L.line))),r.iter(Q,H.line+1,function(_e){if(_e==i.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),Na(r,t,n,go(e)),e.options.lineWrapping||(r.iter(Q,L.line+t.text.length,function(_e){var Je=zn(_e);Je>i.maxLineLength&&(i.maxLine=_e,i.maxLineLength=Je,i.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),vr(r,L.line),ki(e,400);var te=t.text.length-(H.line-L.line)-1;t.full?en(e):L.line==H.line&&t.text.length==1&&!No(e.doc,t)?Nn(e,L.line,"text"):en(e,L.line,H.line+1,te);var be=ye(e,"changes"),Te=ye(e,"change");if(Te||be){var Ne={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};Te&&fr(e,"change",e,Ne),be&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ne)}e.display.selForContextMenu=null}function hi(e,t,n,r,i){var L;r||(r=n),Lt(r,n)<0&&(L=[r,n],n=L[0],r=L[1]),typeof t=="string"&&(t=e.splitLines(t)),ci(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var L=e[i],H=!0;if(L.ranges){L.copied||(L=e[i]=L.deepCopy(),L.copied=!0);for(var Y=0;Y<L.ranges.length;Y++)es(L.ranges[Y].anchor,t,n,r),es(L.ranges[Y].head,t,n,r);continue}for(var Q=0;Q<L.changes.length;++Q){var te=L.changes[Q];if(n<te.from.line)te.from=et(te.from.line+r,te.from.ch),te.to=et(te.to.line+r,te.to.ch);else if(t<=te.to.line){H=!1;break}}H||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function _i(e,t,n,r){var i=t,L=t;return typeof t=="number"?L=ft(e,z(e,t)):i=It(t),i==null?null:(r(L,i)&&e.cm&&Nn(e.cm,i,n),L)}function Pi(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}Pi.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,Xe(i),fr(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 Mi(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}Mi.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 L=Math.min(t,i-e),H=r.height;if(r.removeInner(e,L),this.height-=H-r.height,i==L&&(this.children.splice(n--,1),r.parent=null),(t-=L)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Pi))){var Y=[];this.collapse(Y),this.children=[new Pi(Y)],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],L=i.chunkSize();if(e<=L){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var H=i.lines.length%25+25,Y=H;Y<i.lines.length;){var Q=new Pi(i.lines.slice(Y,Y+=25));i.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}i.lines=i.lines.slice(0,H),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Mi(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 Mi(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],L=i.chunkSize();if(e<L){var H=Math.min(t,L-e);if(i.iterN(e,H,n))return!0;if((t-=H)==0)break;e=0}else e-=L}}};var Ii=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Ii.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=It(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 L=xi(this);ur(n,Math.max(0,n.height-L)),e&&(ln(e,function(){ns(e,n,-L),Nn(e,r,"widget")}),fr(e,"lineWidgetCleared",e,this,r))},Ii.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=xi(this)-t;if(!i)return;sn(this.doc,r)||ur(r,r.height+i),n&&ln(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),fr(n,"lineWidgetChanged",n,e,It(r))})},Ce(Ii);function ns(e,t,n){cn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ka(e,n)}function xl(e,t,n,r){var i=new Ii(e,n,r),L=e.cm;return L&&i.noHScroll&&(L.display.alignWidgets=!0),_i(e,t,"widget",function(H){var Y=H.widgets||(H.widgets=[]);if(i.insertAt==null?Y.push(i):Y.splice(Math.min(Y.length-1,Math.max(0,i.insertAt)),0,i),i.line=H,L&&!sn(e,H)){var Q=cn(H)<e.scrollTop;ur(H,H.height+xi(i)),Q&&ka(L,i.height),L.curOp.forceUpdate=!0}return!0}),L&&fr(L,"lineWidgetAdded",L,i,typeof t=="number"?t:It(t)),i}var is=0,Wn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Wn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Qn(e),ye(this,"clear")){var n=this.find();n&&fr(this,"clear",n.from,n.to)}for(var r=null,i=null,L=0;L<this.lines.length;++L){var H=this.lines[L],Y=ir(H.markedSpans,this);e&&!this.collapsed?Nn(e,It(H),"text"):e&&(Y.to!=null&&(i=It(H)),Y.from!=null&&(r=It(H))),H.markedSpans=dn(H.markedSpans,Y),Y.from==null&&this.collapsed&&!sn(this.doc,H)&&e&&ur(H,ii(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=Nr(this.lines[Q]),be=zn(te);be>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=be,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&en(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&fr(e,"markerCleared",e,this,r,i),t&&qn(e),this.parent&&this.parent.clear()},Wn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var L=this.lines[i],H=ir(L.markedSpans,this);if(H.from!=null&&(n=et(t?L:It(L),H.from),e==-1))return n;if(H.to!=null&&(r=et(t?L:It(L),H.to),e==1))return r}return n&&{from:n,to:r}},Wn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ln(r,function(){var i=t.line,L=It(t.line),H=ga(r,L);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!sn(n.doc,i)&&n.height!=null){var Y=n.height;n.height=null;var Q=xi(n)-Y;Q&&ur(i,i.height+Q)}fr(r,"markerChanged",r,e)})},Wn.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)},Wn.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)}},Ce(Wn);function fi(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,fi)(e,t,n,r,i);var L=new Wn(e,i),H=Lt(t,n);if(r&&I(r,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=C("span",[L.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(Ar(e,t.line,t,n,L)||t.line!=n.line&&Ar(e,n.line,t,n,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");Cr()}L.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,te;if(e.iter(Y,n.line+1,function(Te){Q&&L.collapsed&&!Q.options.lineWrapping&&Nr(Te)==Q.display.maxLine&&(te=!0),L.collapsed&&Y!=t.line&&ur(Te,0),yr(Te,new zr(L,Y==t.line?t.ch:null,Y==n.line?n.ch:null)),++Y}),L.collapsed&&e.iter(t.line,n.line+1,function(Te){sn(e,Te)&&ur(Te,0)}),L.clearOnEnter&&Re(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Vt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++is,L.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),L.collapsed)en(Q,t.line,n.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var be=t.line;be<=n.line;be++)Nn(Q,be,"text");L.atomic&&Xo(Q.doc),fr(Q,"markerAdded",Q,L)}return L}var Ni=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Ni.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();fr(this,"clear")},Ni.prototype.find=function(e,t){return this.primary.find(e,t)},Ce(Ni);function Cl(e,t,n,r,i){r=I(r),r.shared=!1;var L=[fi(e,t,n,r,i)],H=L[0],Y=r.widgetNode;return jn(e,function(Q){Y&&(r.widgetNode=Y.cloneNode(!0)),L.push(fi(Q,c(Q,t),c(Q,n),r,i));for(var te=0;te<Q.linked.length;++te)if(Q.linked[te].isParent)return;H=J(L)}),new Ni(L,H)}function as(e){return e.findMarks(et(e.first,0),e.clipPos(et(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(),L=e.clipPos(i.from),H=e.clipPos(i.to);if(Lt(L,H)){var Y=fi(e,L,H,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],L=[i.primary.doc];jn(i.primary.doc,function(Q){return L.push(Q)});for(var H=0;H<i.markers.length;H++){var Y=i.markers[H];pe(L,Y.doc)==-1&&(Y.parent=null,i.markers.splice(H--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,tn=function(e,t,n,r,i){if(!(this instanceof tn))return new tn(e,t,n,r,i);n==null&&(n=0),Mi.call(this,[new Pi([new Ln("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var L=et(n,0);this.sel=Un(L),this.history=new ea(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)),Na(this,{from:L,to:L,text:e}),Vr(this,Un(L),ke)};tn.prototype=Ae(Mi.prototype,{constructor:tn,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=xr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ur(function(e){var t=et(this.first,0),n=this.first+this.size-1;ci(this,{from:t,to:et(n,ft(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ti(this.cm,0,0),Vr(this,Un(t),ke)}),replaceRange:function(e,t,n,r){t=c(this,t),n=n?c(this,n):t,hi(this,e,t,n,r)},getRange:function(e,t,n){var r=or(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(sr(this,e))return ft(this,e)},getLineNumber:function(e){return It(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),Nr(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){Go(this,c(this,typeof e=="number"?et(e,t||0):e),null,n)}),setSelection:Ur(function(e,t,n){Go(this,c(this,e),c(this,t||e),n)}),extendSelection:Ur(function(e,t,n){ra(this,c(this,e),t&&c(this,t),n)}),extendSelections:Ur(function(e,t){Ko(this,N(this,e),t)}),extendSelectionsBy:Ur(function(e,t){var n=ee(this.sel.ranges,e);Ko(this,N(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)),Vr(this,bn(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))),Vr(this,bn(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=or(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=or(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,L=0;L<i.ranges.length;L++){var H=i.ranges[L];r[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:n}}for(var Y=t&&t!="end"&&hl(this,r,t),Q=r.length-1;Q>=0;Q--)ci(this,r[Q]);Y?zo(this,Y):this.cm&&si(this.cm)}),undo:Ur(function(){aa(this,"undo")}),redo:Ur(function(){aa(this,"redo")}),undoSelection:Ur(function(){aa(this,"undo",!0)}),redoSelection:Ur(function(){aa(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 ea(this.history.maxGeneration),jn(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:ui(this.history.done),undone:ui(this.history.undone)}},setHistory:function(e){var t=this.history=new ea(this.history.maxGeneration);t.done=ui(e.done.slice(0),null,!0),t.undone=ui(e.undone.slice(0),null,!0)},setGutterMarker:Ur(function(e,t,n){return _i(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&je(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ur(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&_i(t,n,"gutter",function(){return n.gutterMarkers[e]=null,je(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!sr(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=It(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 _i(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 _i(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=r[i];if(L)if(n==null)r[i]=null;else{var H=L.match(b(n));if(!H)return!1;var Y=H.index+H[0].length;r[i]=L.slice(0,H.index)+(!H.index||Y==L.length?"":" ")+L.slice(Y)||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 fi(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),fi(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(L){var H=L.markedSpans;if(H)for(var Y=0;Y<H.length;Y++){var Q=H[Y];!(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 L=i.text.length+r;if(L>e)return t=e,!0;e-=L,++n}),c(this,et(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 tn(xr(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 tn(xr(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,as(this)),r},unlinkDoc:function(e){if(e instanceof mr&&(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(as(this));break}if(e.history==this.history){var r=[e.id];jn(e,function(i){return r.push(i.id)},!0),e.history=new ea(null),e.history.done=ui(this.history.done,r),e.history.undone=ui(this.history.undone,r)}},iterLinkedDocs:function(e){jn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Tt(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)})}),tn.prototype.eachLine=tn.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),We(t,e)||kn(t.display,e))return;le(e),G&&(os=+new Date);var n=Yn(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,L=Array(i),H=0,Y=function(){++H==i&&Fr(t,function(){n=c(t.doc,n);var _e={from:n,to:n,text:t.doc.splitLines(L.filter(function(Je){return Je!=null}).join(t.doc.lineSeparator())),origin:"paste"};ci(t.doc,_e),zo(t.doc,Un(c(t.doc,n),c(t.doc,Bn(_e))))})()},Q=function(_e,Je){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,_e.type)==-1){Y();return}var rt=new FileReader;rt.onerror=function(){return Y()},rt.onload=function(){var st=rt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(st)){Y();return}L[Je]=st,Y()},rt.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()),na(t.doc,Un(n,n)),Te)for(var Ne=0;Ne<Te.length;++Ne)hi(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(G&&(!e.state.draggingText||+new Date-os<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&&!R){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function kl(e,t){var n=Yn(e,t);if(!n)return;var r=document.createDocumentFragment();bo(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)),l(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(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 L=0;L<n.length;L++)e(n[L])})}var us=!1;function Dl(){if(us)return;Ol(),us=!0}function Ol(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Re(window,"blur",function(){return ls(oi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Hn={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"},Fi=0;Fi<10;Fi++)Hn[Fi+48]=Hn[Fi+96]=String(Fi);for(var oa=65;oa<=90;oa++)Hn[oa]=String.fromCharCode(oa);for(var Ui=1;Ui<=12;Ui++)Hn[Ui+111]=Hn[Ui+63235]="F"+Ui;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=u?Dn.macDefault:Dn.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,L,H=0;H<t.length-1;H++){var Y=t[H];if(/^(cmd|meta|m)$/i.test(Y))L=!0;else if(/^a(lt)?$/i.test(Y))n=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))i=!0;else throw new Error("Unrecognized modifier name: "+Y)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),L&&(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),L=0;L<i.length;L++){var H=void 0,Y=void 0;L==i.length-1?(Y=i.join(" "),H=r):(Y=i.slice(0,L+1).join(" "),H="...");var Q=t[Y];if(!Q)t[Y]=H;else if(Q!=H)throw new Error("Inconsistent bindings for "+Y)}delete e[n]}for(var te in t)e[te]=t[te];return e}function pi(e,t,n,r){t=sa(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 pi(e,t.fallthrough,n,r);for(var L=0;L<t.fallthrough.length;L++){var H=pi(e,t.fallthrough[L],n,r);if(H)return H}}}function ds(e){var t=typeof e=="string"?e:Hn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(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 hs(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Hn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function sa(e){return typeof e=="string"?Dn[e]:e}function mi(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var L=t(n[i]);r.length&&Lt(L.from,J(r).to)<=0;){var H=r.pop();if(Lt(H.from,L.from)<0){L.from=H.from;break}}r.push(L)}ln(e,function(){for(var Y=r.length-1;Y>=0;Y--)hi(e.doc,"",r[Y].from,r[Y].to,"+delete");si(e)})}function ja(e,t,n){var r=Fe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Wa(e,t,n){var r=ja(e,t.ch,n);return r==null?null:new et(t.line,r,n<0?"after":"before")}function Ha(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var L=Ke(n,t.doc.direction);if(L){var H=i<0?J(L):L[0],Y=i<0==(H.level==1),Q=Y?"after":"before",te;if(H.level>0||t.doc.direction=="rtl"){var be=ni(t,n);te=i<0?n.text.length-1:0;var Te=Tn(t,be,te).top;te=qe(function(Ne){return Tn(t,be,Ne).top==Te},i<0==(H.level==1)?H.from:H.to-1,te),Q=="before"&&(te=ja(n,te,1))}else te=i<0?H.to:H.from;return new et(r,te,Q)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Ke(t,e.doc.direction);if(!i)return Wa(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 L=Be(i,n.ch,n.sticky),H=i[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>n.ch:H.from<n.ch))return Wa(t,n,r);var Y=function(ct,bt){return ja(t,ct instanceof et?ct.ch:ct,bt)},Q,te=function(ct){return e.options.lineWrapping?(Q=Q||ni(e,t),mo(e,t,Q,ct)):{begin:0,end:t.text.length}},be=te(n.sticky=="before"?Y(n,-1):n.ch);if(e.doc.direction=="rtl"||H.level==1){var Te=H.level==1==r<0,Ne=Y(n,Te?1:-1);if(Ne!=null&&(Te?Ne<=H.to&&Ne<=be.end:Ne>=H.from&&Ne>=be.begin)){var _e=Te?"before":"after";return new et(n.line,Ne,_e)}}var Je=function(ct,bt,ht){for(var St=function(lr,Br){return Br?new et(n.line,Y(lr,1),"before"):new et(n.line,lr,"after")};ct>=0&&ct<i.length;ct+=bt){var Dt=i[ct],At=bt>0==(Dt.level!=1),Ht=At?ht.begin:Y(ht.end,-1);if(Dt.from<=Ht&&Ht<Dt.to)return St(Ht,At);if(Ht=At?Dt.from:Y(Dt.to,-1),ht.begin<=Ht&&Ht<ht.end)return St(Ht,At)}},rt=Je(L+r,r,be);if(rt)return rt;var st=r>0?be.end:Y(be.begin,-1);return st!=null&&!(r>0&&st==t.text.length)&&(rt=Je(r>0?0:i.length-1,r,te(st)),rt)?rt:null}var Bi={selectAll:Zo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ke)},killLine:function(e){return mi(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:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return mi(e,function(t){return{from:et(t.from().line,0),to:c(e.doc,et(t.to().line+1,0))}})},delLineLeft:function(e){return mi(e,function(t){return{from:et(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return mi(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 mi(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(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(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/)?ps(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 L=n[i].from(),H=X(e.getLine(L.line),L.ch,r);t.push(se(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ln(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,L=ft(e.doc,i.line).text;if(L){if(i.ch==L.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(L.charAt(i.ch-1)+L.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var H=ft(e.doc,i.line-1).text;H&&(i=new et(i.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),et(i.line-1,H.length-1),i,"+transpose"))}}n.push(new er(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ln(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);si(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var n=ft(e.doc,t),r=Nr(n);return r!=n&&(t=It(r)),Ha(!0,e,r,t,1)}function Il(e,t){var n=ft(e.doc,t),r=An(n);return r!=n&&(t=It(r)),Ha(!0,e,n,t,-1)}function ps(e,t){var n=fs(e,t.line),r=ft(e.doc,n.line),i=Ke(r,e.doc.direction);if(!i||i[0].level==0){var L=Math.max(n.ch,r.text.search(/\S/)),H=t.line==n.line&&t.ch<=L&&t.ch;return et(n.line,H?0:L,n.sticky)}return n}function la(e,t,n){if(typeof t=="string"&&(t=Bi[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)!=Le}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=pi(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&pi(t,e.options.extraKeys,n,e)||pi(t,e.options.keyMap,n,e)}var Fl=new oe;function ji(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(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())}),ms(e,i+" "+t,n,r))return!0}return ms(e,t,n,r)}function ms(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&fr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(le(n),wa(e)),!!i}function gs(e,t){var n=hs(t,!0);return n?t.shiftKey&&!e.state.keySeq?ji(e,"Shift-"+n,t,function(r){return la(e,r,!0)})||ji(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return la(e,r)}):ji(e,n,t,function(r){return la(e,r)}):!1}function Ul(e,t,n){return ji(e,"'"+n+"'",t,function(r){return la(e,r,!0)})}var Ka=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=U(),We(t,e))return;G&&W<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);A&&(Ka=r?n:null,!r&&n==88&&!Rt&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!u&&!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)&&(s(t,"CodeMirror-crosshair"),it(document,"keyup",n),it(document,"mouseover",n))}Re(document,"keyup",n),Re(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),We(this,e)}function bs(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||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==Ka){Ka=null,le(e);return}if(A&&(!e.which||e.which<10)&&gs(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,Ga=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ga.prototype.compare=function(e,t,n){return this.time+jl>e&&Lt(t,this.pos)==0&&n==this.button};var Wi,Hi;function Wl(e,t){var n=+new Date;return Hi&&Hi.compare(n,e,t)?(Wi=Hi=null,"triple"):Wi&&Wi.compare(n,e,t)?(Hi=new Ga(n,e,t),Wi=null,"double"):(Wi=new Ga(n,e,t),Hi=null,"single")}function Es(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)){_||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(za(t,e))return;var r=Yn(t,e),i=Ue(e),L=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,L,e))return;i==1?r?Gl(t,r,L,e):we(e)==n.scroller&&le(e):i==2?(r&&ra(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var L="Click";return r=="double"?L="Double"+L:r=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,ji(e,cs(L,i),i,function(H){if(typeof H=="string"&&(H=Bi[H]),!H)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=H(e,n)!=Le}finally{e.state.suppressEdits=!1}return Y})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var L=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=L?"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=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){G?setTimeout(P(Eo,e),0):e.curOp.focus=U();var i=Kl(e,n,r),L=e.doc.sel,H;e.options.dragDrop&&Ze&&!e.isReadOnly()&&n=="single"&&(H=L.contains(t))>-1&&(Lt((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(Lt(H.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,L=!1,H=Fr(e,function(te){_&&(i.scroller.draggable=!1),e.state.draggingText=!1,it(i.wrapper.ownerDocument,"mouseup",H),it(i.wrapper.ownerDocument,"mousemove",Y),it(i.scroller,"dragstart",Q),it(i.scroller,"drop",H),L||(le(te),r.addNew||ra(e.doc,n,null,null,r.extend),_&&!R||G&&W==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),Y=function(te){L=L||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return L=!0};_&&(i.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Re(i.wrapper.ownerDocument,"mouseup",H),Re(i.wrapper.ownerDocument,"mousemove",Y),Re(i.scroller,"dragstart",Q),Re(i.scroller,"drop",H),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new er(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new er(et(t.line,0),c(e.doc,et(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,L=e.doc;le(t);var H,Y,Q=L.sel,te=Q.ranges;if(r.addNew&&!r.extend?(Y=L.sel.contains(n),Y>-1?H=te[Y]:H=new er(n,n)):(H=L.sel.primary(),Y=L.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new er(n,n)),n=Yn(e,t,!0,!0),Y=-1;else{var be=xs(e,n,r.unit);r.extend?H=Ua(H,be.anchor,be.head,r.extend):H=be}r.addNew?Y==-1?(Y=te.length,Vr(L,bn(e,te.concat([H]),Y),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Y].empty()&&r.unit=="char"&&!r.extend?(Vr(L,bn(e,te.slice(0,Y).concat(te.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=L.sel):Ba(L,Y,H,he):(Y=0,Vr(L,new fn([H],0),he),Q=L.sel);var Te=n;function Ne(ht){if(Lt(Te,ht)==0)return;if(Te=ht,r.unit=="rectangle"){for(var St=[],Dt=e.options.tabSize,At=X(ft(L,n.line).text,n.ch,Dt),Ht=X(ft(L,ht.line).text,ht.ch,Dt),lr=Math.min(At,Ht),Br=Math.max(At,Ht),br=Math.min(n.line,ht.line),un=Math.min(e.lastLine(),Math.max(n.line,ht.line));br<=un;br++){var rn=ft(L,br).text,Rr=ue(rn,lr,Dt);lr==Br?St.push(new er(et(br,Rr),et(br,Rr))):rn.length>Rr&&St.push(new er(et(br,Rr),et(br,ue(rn,Br,Dt))))}St.length||St.push(new er(n,n)),Vr(L,bn(e,Q.ranges.slice(0,Y).concat(St),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ht)}else{var nn=H,Hr=xs(e,ht,r.unit),Ir=nn.anchor,_r;Lt(Hr.anchor,Ir)>0?(_r=Hr.head,Ir=Gr(nn.from(),Hr.anchor)):(_r=Hr.anchor,Ir=$r(nn.to(),Hr.head));var Tr=Q.ranges.slice(0);Tr[Y]=Xl(e,new er(c(L,Ir),_r)),Vr(L,bn(e,Tr,Y),he)}}var _e=i.wrapper.getBoundingClientRect(),Je=0;function rt(ht){var St=++Je,Dt=Yn(e,ht,!0,r.unit=="rectangle");if(!Dt)return;if(Lt(Dt,Te)!=0){e.curOp.focus=U(),Ne(Dt);var At=Zi(i,L);(Dt.line>=At.to||Dt.line<At.from)&&setTimeout(Fr(e,function(){Je==St&&rt(ht)}),150)}else{var Ht=ht.clientY<_e.top?-20:ht.clientY>_e.bottom?20:0;Ht&&setTimeout(Fr(e,function(){if(Je!=St)return;i.scroller.scrollTop+=Ht,rt(ht)}),50)}}function st(ht){e.state.selectingText=!1,Je=Infinity,ht&&(le(ht),i.input.focus()),it(i.wrapper.ownerDocument,"mousemove",ct),it(i.wrapper.ownerDocument,"mouseup",bt),L.history.lastSelOrigin=null}var ct=Fr(e,function(ht){ht.buttons===0||!Ue(ht)?st(ht):rt(ht)}),bt=Fr(e,st);e.state.selectingText=bt,Re(i.wrapper.ownerDocument,"mousemove",ct),Re(i.wrapper.ownerDocument,"mouseup",bt)}function Xl(e,t){var n=t.anchor,r=t.head,i=ft(e.doc,n.line);if(Lt(n,r)==0&&n.sticky==r.sticky)return t;var L=Ke(i);if(!L)return t;var H=Be(L,n.ch,n.sticky),Y=L[H];if(Y.from!=n.ch&&Y.to!=n.ch)return t;var Q=H+(Y.from==n.ch==(Y.level!=1)?0:1);if(Q==0||Q==L.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=Be(L,r.ch,r.sticky),Te=be-H||(r.ch-n.ch)*(Y.level==1?-1:1);be==Q-1||be==Q?te=Te<0:te=Te>0}var Ne=L[Q+(te?-1:0)],_e=te==(Ne.level==1),Je=_e?Ne.from:Ne.to,rt=_e?"after":"before";return n.ch==Je&&n.sticky==rt?t:new er(new et(n.line,Je,rt),r)}function Cs(e,t,n,r){var i,L;if(t.touches)i=t.touches[0].clientX,L=t.touches[0].clientY;else try{i=t.clientX,L=t.clientY}catch(Ne){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&le(t);var H=e.display,Y=H.lineDiv.getBoundingClientRect();if(L>Y.bottom||!ye(e,n))return me(t);L-=Y.top-H.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=H.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=i){var be=gr(e.doc,L),Te=e.display.gutterSpecs[Q];return Me(e,n,e,be,Te.className,t),me(t)}}}function za(e,t){return Cs(e,t,"gutterClick",!0)}function Ss(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")?Cs(e,t,"gutterContextMenu",!1):!1}function Ts(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Ci(e)}var gi={toString:function(){return"CodeMirror.Init"}},ws={},ua={};function $l(e){var t=e.optionHandlers;function n(r,i,L,H){e.defaults[r]=i,L&&(t[r]=H?function(Y,Q,te){te!=gi&&L(Y,Q,te)}:L)}e.defineOption=n,e.Init=gi,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ia(r)},!0),n("indentUnit",2,Ia,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Oi(r),Ci(r),en(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var L=[],H=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,L.push(et(H,be))}H++});for(var Y=L.length-1;Y>=0;Y--)hi(r.doc,i,L[Y],et(L[Y].line,L[Y].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,L){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),L!=gi&&r.refresh()}),n("specialCharPlaceholder",$t,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){Ts(r),Di(r)},!0),n("keyMap","default",function(r,i,L){var H=sa(i),Y=L!=gi&&sa(L);Y&&Y.detach&&Y.detach(r,H),H.attach&&H.attach(r,Y||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pa(i,r.options.lineNumbers),Di(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Sa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),li(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=Pa(r.options.gutters,i),Di(r)},!0),n("firstLineNumber",1,Di,!0),n("lineNumberFormatter",function(r){return r},Di,!0),n("showCursorWhenSelecting",!1,Si,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(oi(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,Si,!0),n("singleCursorHeightPerLine",!0,Si,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Oi,!0),n("addModeClass",!1,Oi,!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,Oi,!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!=gi;if(!t!=!r){var i=e.display.dragFunctions,L=t?Re:it;L(e.display.scroller,"dragstart",i.start),L(e.display.scroller,"dragenter",i.enter),L(e.display.scroller,"dragover",i.over),L(e.display.scroller,"dragleave",i.leave),L(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):(s(e.display.wrapper,"CodeMirror-wrap"),ri(e)),Ta(e),en(e),Ci(e),setTimeout(function(){return li(e)},100)}function mr(e,t){var n=this;if(!(this instanceof mr))return new mr(e,t);this.options=t=t?I(t):{},I(ws,t,!1);var r=t.value;typeof r=="string"?r=new tn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new mr.inputStyles[t.inputStyle](this),L=this.display=new dl(e,r,i,t);L.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(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 oe,keySeq:null,specialChars:null},t.autofocus&&!o&&L.input.focus(),G&&W<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),Qn(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Aa(n)},20):oi(this);for(var H in ua)ua.hasOwnProperty(H)&&ua[H](this,t[H],gi);Oo(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Va.length;++Y)Va[Y](this);qn(this),_&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}mr.defaults=ws,mr.optionHandlers=ua;function Ql(e){var t=e.display;Re(t.scroller,"mousedown",Fr(e,Es)),G&&W<11?Re(t.scroller,"dblclick",Fr(e,function(Q){if(We(e,Q))return;var te=Yn(e,Q);if(!te||za(e,Q)||kn(e.display,Q))return;le(Q);var be=e.findWordAt(te);ra(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 Ss(e,Q)}),Re(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Ss(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 L(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function H(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)&&!L(Q)&&!za(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||H(te,te.prev)?Te=new er(be,be):!te.prev.prev||H(te,te.prev.prev)?Te=e.findWordAt(be):Te=new er(et(be.line,0),c(e.doc,et(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&&(wi(e,t.scroller.scrollTop),Zn(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(Q){return Po(e,Q)}),Re(t.scroller,"DOMMouseScroll",function(Q){return Po(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)||ss(e)}};var Y=t.input.getField();Re(Y,"keyup",function(Q){return ys.call(e,Q)}),Re(Y,"keydown",Fr(e,vs)),Re(Y,"keypress",Fr(e,bs)),Re(Y,"focus",function(Q){return Aa(e,Q)}),Re(Y,"blur",function(Q){return oi(e,Q)})}var Va=[];mr.defineInitHook=function(e){return Va.push(e)};function Ki(e,t,n,r){var i=e.doc,L;n==null&&(n="add"),n=="smart"&&(i.mode.indent?L=ot(e,t).state:n="prev");var H=e.options.tabSize,Y=ft(i,t),Q=X(Y.text,null,H);Y.stateAfter&&(Y.stateAfter=null);var te=Y.text.match(/^\s*/)[0],be;if(!r&&!/\S/.test(Y.text))be=0,n="not";else if(n=="smart"&&(be=i.mode.indent(L,Y.text.slice(te.length),Y.text),be==Le||be>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?be=X(ft(i,t-1).text,null,H):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/H);_e;--_e)Ne+=H,Te+=" ";if(Ne<be&&(Te+=se(be-Ne)),Te!=te)return hi(i,Te,et(t,0),et(t,te.length),"+input"),Y.stateAfter=null,!0;for(var Je=0;Je<i.sel.ranges.length;Je++){var rt=i.sel.ranges[Je];if(rt.head.line==t&&rt.head.ch<te.length){var st=et(t,te.length);Ba(i,Je,new er(st,st));break}}}var En=null;function da(e){En=e}function Xa(e,t,n,r,i){var L=e.doc;e.display.shift=!1,r||(r=L.sel);var H=+new Date-200,Y=i=="paste"||e.state.pasteIncoming>H,Q=Tt(t),te=null;if(Y&&r.ranges.length>1)if(En&&En.text.join(`
`)==t){if(r.ranges.length%En.text.length==0){te=[];for(var be=0;be<En.text.length;be++)te.push(L.splitLines(En.text[be]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=ee(Q,function(ct){return[ct]}));for(var Te=e.curOp.updateInput,Ne=r.ranges.length-1;Ne>=0;Ne--){var _e=r.ranges[Ne],Je=_e.from(),rt=_e.to();_e.empty()&&(n&&n>0?Je=et(Je.line,Je.ch-n):e.state.overwrite&&!Y?rt=et(rt.line,Math.min(ft(L,rt.line).text.length,rt.ch+J(Q).length)):Y&&En&&En.lineWise&&En.text.join(`
`)==Q.join(`
`)&&(Je=rt=et(Je.line,0)));var st={from:Je,to:rt,text:te?te[Ne%te.length]:Q,origin:i||(Y?"paste":e.state.cutIncoming>H?"cut":"+input")};ci(e.doc,st),fr(e,"inputRead",e,st)}t&&!Y&&Ls(e,t),si(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Te),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ln(t,function(){return Xa(t,n,0,null,"paste")}),!0}function Ls(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 L=e.getModeAt(i.head),H=!1;if(L.electricChars){for(var Y=0;Y<L.electricChars.length;Y++)if(t.indexOf(L.electricChars.charAt(Y))>-1){H=Ki(e,i.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(ft(e.doc,i.head.line).text.slice(0,i.head.ch))&&(H=Ki(e,i.head.line,"smart")));H&&fr(e,"electricInput",e,i.head.line)}}function ks(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,L={anchor:et(i,0),head:et(i+1,0)};n.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){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 _?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),Ds(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 L=this.options,H=L[r];if(L[r]==i&&r!="mode")return;L[r]=i,t.hasOwnProperty(r)&&Fr(this,t[r])(this,i,H),Me(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"](sa(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,L=0;L<i.length;++L)if(i[L]==r||i[L].name==r)return i.splice(L,1),!0},addOverlay:Jr(function(r,i){var L=r.token?r:e.getMode(this.options,r);if(L.startState)throw new Error("Overlays may not be stateful.");ne(this.state.overlays,{mode:L,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(H){return H.priority}),this.state.modeGen++,en(this)}),removeOverlay:Jr(function(r){for(var i=this.state.overlays,L=0;L<i.length;++L){var H=i[L].modeSpec;if(H==r||typeof r=="string"&&H.name==r){i.splice(L,1),this.state.modeGen++,en(this);return}}}),indentLine:Jr(function(r,i,L){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),sr(this.doc,r)&&Ki(this,r,i,L)}),indentSelection:Jr(function(r){for(var i=this.doc.sel.ranges,L=-1,H=0;H<i.length;H++){var Y=i[H];if(Y.empty())Y.head.line>L&&(Ki(this,Y.head.line,r,!0),L=Y.head.line,H==this.doc.sel.primIndex&&si(this));else{var Q=Y.from(),te=Y.to(),be=Math.max(L,Q.line);L=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Te=be;Te<L;++Te)Ki(this,Te,r);var Ne=this.doc.sel.ranges;Q.ch==0&&i.length==Ne.length&&Ne[H].from().ch>0&&Ba(this.doc,H,new er(Q,Ne[H].to()),ke)}}}),getTokenAt:function(r,i){return Pt(this,r,i)},getLineTokens:function(r,i){return Pt(this,et(r),i,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var i=Qe(this,ft(this.doc,r.line)),L=0,H=(i.length-1)/2,Y=r.ch,Q;if(Y==0)Q=i[2];else for(;;){var te=L+H>>1;if((te?i[te*2-1]:0)>=Y)H=te;else if(i[te*2+1]<Y)L=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 L=[];if(!n.hasOwnProperty(i))return L;var H=n[i],Y=this.getModeAt(r);if(typeof Y[i]=="string")H[Y[i]]&&L.push(H[Y[i]]);else if(Y[i])for(var Q=0;Q<Y[i].length;Q++){var te=H[Y[i][Q]];te&&L.push(te)}else Y.helperType&&H[Y.helperType]?L.push(H[Y.helperType]):H[Y.name]&&L.push(H[Y.name]);for(var be=0;be<H._global.length;be++){var Te=H._global[be];Te.pred(Y,this)&&pe(L,Te.val)==-1&&L.push(Te.val)}return L},getStateAfter:function(r,i){var L=this.doc;return r=z(L,r==null?L.first+L.size-1:r),ot(this,r+1,i).state},cursorCoords:function(r,i){var L,H=this.doc.sel.primary();return r==null?L=H.head:typeof r=="object"?L=c(this.doc,r):L=r?H.from():H.to(),yn(this,L,i||"page")},charCoords:function(r,i){return ya(this,c(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ho(this,r,i||"page"),Ea(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ho(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,L){var H=!1,Y;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,H=!0),Y=ft(this.doc,r)}else Y=r;return Vi(this,Y,{top:0,left:0},i||"page",L||H).top+(H?this.doc.height-cn(Y):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ai(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,L,H,Y){var Q=this.display;r=yn(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),H=="over")te=r.top;else if(H=="above"||H=="near"){var Te=Math.max(Q.wrapper.clientHeight,this.doc.height),Ne=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(H=="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="",Y=="right"?(be=Q.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(Y=="left"?be=0:Y=="middle"&&(be=(Q.sizer.clientWidth-i.offsetWidth)/2),i.style.left=be+"px"),L&&Zs(this,{left:be,top:te,right:be+i.offsetWidth,bottom:te+i.offsetHeight})},triggerOnKeyDown:Jr(vs),triggerOnKeyPress:Jr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Jr(Es),execCommand:function(r){if(Bi.hasOwnProperty(r))return Bi[r].call(null,this)},triggerElectric:Jr(function(r){Ls(this,r)}),findPosH:function(r,i,L,H){var Y=1;i<0&&(Y=-1,i=-i);for(var Q=c(this.doc,r),te=0;te<i&&!(Q=Ya(this.doc,Q,Y,L,H),Q.hitSide);++te);return Q},moveH:Jr(function(r,i){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?Ya(L.doc,H.head,r,i,L.options.rtlMoveVisually):r<0?H.from():H.to()},ae)}),deleteH:Jr(function(r,i){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):mi(this,function(Y){var Q=Ya(H,Y.head,r,i,!1);return r<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(r,i,L,H){var Y=1,Q=H;i<0&&(Y=-1,i=-i);for(var te=c(this.doc,r),be=0;be<i;++be){var Te=yn(this,te,"div");if(Q==null?Q=Te.left:Te.left=Q,te=Rs(this,Te,Y,L),te.hitSide)break}return te},moveV:Jr(function(r,i){var L=this,H=this.doc,Y=[],Q=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(be){if(Q)return r<0?be.from():be.to();var Te=yn(L,be.head,"div");be.goalColumn!=null&&(Te.left=be.goalColumn),Y.push(Te.left);var Ne=Rs(L,Te,r,i);return i=="page"&&be==H.sel.primary()&&ka(L,ya(L,Ne,"div").top-Te.top),Ne},ae),Y.length)for(var te=0;te<H.sel.ranges.length;te++)H.sel.ranges[te].goalColumn=Y[te]}),findWordAt:function(r){var i=this.doc,L=ft(i,r.line).text,H=r.ch,Y=r.ch;if(L){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==L.length)&&H?--H:++Y;for(var te=L.charAt(H),be=Pe(te,Q)?function(Te){return Pe(Te,Q)}:/\s/.test(te)?function(Te){return/\s/.test(Te)}:function(Te){return!/\s/.test(Te)&&!Pe(Te)};H>0&&be(L.charAt(H-1));)--H;for(;Y<L.length&&be(L.charAt(Y));)++Y}return new er(et(r.line,H),et(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):s(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==U()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jr(function(r,i){Ti(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Sn(this)-this.display.barHeight,width:r.scrollWidth-Sn(this)-this.display.barWidth,clientHeight:ma(this),clientWidth:Vn(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:et(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):So(this,r.from,r.to,r.margin)}),setSize:Jr(function(r,i){var L=this,H=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=H(r)),i!=null&&(this.display.wrapper.style.height=H(i)),this.options.lineWrapping&&lo(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){Nn(L,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(r){return ln(this,r)},startOperation:function(){return Qn(this)},endOperation:function(){return qn(this)},refresh:Jr(function(){var r=this.display.cachedTextHeight;en(this),this.curOp.forceUpdate=!0,Ci(this),Ti(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-ii(this.display))>.5||this.options.lineWrapping)&&Ta(this),Me(this,"refresh",this)}),swapDoc:Jr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),Ci(this),this.display.input.reset(),Ti(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,fr(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}},Ce(e),e.registerHelper=function(r,i,L){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=L},e.registerGlobalHelper=function(r,i,L,H){e.registerHelper(r,i,H),n[r]._global.push({pred:L,val:H})}}function Ya(e,t,n,r,i){var L=t,H=n,Y=ft(e,t.line),Q=i&&e.direction=="rtl"?-n:n;function te(){var bt=t.line+Q;return bt<e.first||bt>=e.first+e.size?!1:(t=new et(bt,t.ch,t.sticky),Y=ft(e,bt))}function be(bt){var ht;if(r=="codepoint"){var St=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(St)?ht=null:ht=new et(t.line,Math.max(0,Math.min(Y.text.length,t.ch+n*(St>=55296&&St<56320?2:1))),-n)}else i?ht=Ml(e.cm,Y,t,n):ht=Wa(Y,t,n);if(ht==null)if(!bt&&te())t=Ha(i,e.cm,Y,t.line,Q);else return!1;else t=ht;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 rt=Y.text.charAt(t.ch)||`
`,st=Pe(rt,_e)?"w":Ne&&rt==`
`?"n":!Ne||/\s/.test(rt)?null:"p";if(Ne&&!Je&&!st&&(st="s"),Te&&Te!=st){n<0&&(n=1,be(),t.sticky="after");break}if(st&&(Te=st),n>0&&!be(!Je))break}var ct=ia(e,t,L,H,!0);return Kr(L,ct)&&(ct.hitSide=!0),ct}function Rs(e,t,n,r){var i=e.doc,L=t.left,H;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*ii(e.display),3);H=(n>0?t.bottom:t.top)+n*Q}else r=="line"&&(H=n>0?t.bottom+3:t.top-3);for(var te;!(te=Ea(e,L,H),!te.outside);){if(n<0?H<=0:H>=i.height){te.hitSide=!0;break}H+=n*5}return te}var rr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new oe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};rr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Ds(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function L(Y){for(var Q=Y.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(Y){if(!L(Y)||We(r,Y)||As(Y,r))return;W<=11&&setTimeout(Fr(r,function(){return t.updateFromDOM()}),20)}),Re(i,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Re(i,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Re(i,"compositionend",function(Y){t.composing&&(Y.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 H(Y){if(!L(Y)||We(r,Y))return;if(r.somethingSelected())da({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ks(r);da({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var te=En.text.join(`
`);if(Y.clipboardData.setData("Text",te),Y.clipboardData.getData("Text")==te){Y.preventDefault();return}}var be=Os(),Te=be.firstChild;r.display.lineSpace.insertBefore(be,r.display.lineSpace.firstChild),Te.value=En.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",H),Re(i,"cut",H)},rr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},rr.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},rr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},rr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},rr.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 L=ca(t,e.anchorNode,e.anchorOffset),H=ca(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&Lt(Gr(L,H),r)==0&&Lt($r(L,H),i)==0)return;var Y=t.display.view,Q=r.line>=t.display.viewFrom&&_s(t,r)||{node:Y[0].measure.map[2],offset:0},te=i.line<t.display.viewTo&&_s(t,i);if(!te){var be=Y[Y.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=m(Q.node,Q.offset,te.offset,te.node)}catch(Je){}_e&&(!D&&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):D&&this.startGracePeriod()),this.rememberSelection()},rr.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)},rr.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},rr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},rr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},rr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},rr.prototype.blur=function(){this.div.blur()},rr.prototype.getField=function(){return this.div},rr.prototype.supportsTouch=function(){return!0},rr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ln(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)},rr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},rr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&y&&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=ca(t,e.anchorNode,e.anchorOffset),r=ca(t,e.focusNode,e.focusOffset);n&&r&&ln(t,function(){Vr(t.doc,Un(n,r),ke),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},rr.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=et(r.line-1,ft(e.doc,r.line-1).length)),i.ch==ft(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=et(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var L,H,Y;r.line==t.viewFrom||(L=$n(e,r.line))==0?(H=It(t.view[0].line),Y=t.view[0].node):(H=It(t.view[L].line),Y=t.view[L-1].node.nextSibling);var Q=$n(e,i.line),te,be;if(Q==t.view.length-1?(te=t.viewTo-1,be=t.lineDiv.lastChild):(te=It(t.view[Q+1].line)-1,be=t.view[Q+1].node.previousSibling),!Y)return!1;for(var Te=e.doc.splitLines(tu(e,Y,be,H,te)),Ne=or(e.doc,et(H,0),et(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(),H++;else break;for(var _e=0,Je=0,rt=Te[0],st=Ne[0],ct=Math.min(rt.length,st.length);_e<ct&&rt.charCodeAt(_e)==st.charCodeAt(_e);)++_e;for(var bt=J(Te),ht=J(Ne),St=Math.min(bt.length-(Te.length==1?_e:0),ht.length-(Ne.length==1?_e:0));Je<St&&bt.charCodeAt(bt.length-Je-1)==ht.charCodeAt(ht.length-Je-1);)++Je;if(Te.length==1&&Ne.length==1&&H==r.line)for(;_e&&_e>r.ch&&bt.charCodeAt(bt.length-Je-1)==ht.charCodeAt(ht.length-Je-1);)_e--,Je++;Te[Te.length-1]=bt.slice(0,bt.length-Je).replace(/^\u200b+/,""),Te[0]=Te[0].slice(_e).replace(/\u200b+$/,"");var Dt=et(H,_e),At=et(te,Ne.length?J(Ne).length-Je:0);if(Te.length>1||Te[0]||Lt(Dt,At))return hi(e.doc,Te,Dt,At,"+input"),!0},rr.prototype.ensurePolled=function(){this.forceCompositionEnd()},rr.prototype.reset=function(){this.forceCompositionEnd()},rr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},rr.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)},rr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ln(this.cm,function(){return en(e.cm)})},rr.prototype.setUneditable=function(e){e.contentEditable="false"},rr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Fr(this.cm,Xa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},rr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},rr.prototype.onContextMenu=function(){},rr.prototype.resetPosition=function(){},rr.prototype.needsContentAttribute=!0;function _s(e,t){var n=ga(e,t.line);if(!n||n.hidden)return null;var r=ft(e.doc,t.line),i=no(n,r,t.line),L=Ke(r,e.doc.direction),H="left";if(L){var Y=Be(L,t.ch);H=Y%2?"right":"left"}var Q=oo(i.map,t.ch,H);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 vi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var L="",H=!1,Y=e.doc.lineSeparator(),Q=!1;function te(_e){return function(Je){return Je.id==_e}}function be(){H&&(L+=Y,Q&&(L+=Y),H=Q=!1)}function Te(_e){_e&&(be(),L+=_e)}function Ne(_e){if(_e.nodeType==1){var Je=_e.getAttribute("cm-text");if(Je){Te(Je);return}var rt=_e.getAttribute("cm-marker"),st;if(rt){var ct=e.findMarks(et(r,0),et(i+1,0),te(+rt));ct.length&&(st=ct[0].find(0))&&Te(or(e.doc,st.from,st.to).join(Y));return}if(_e.getAttribute("contenteditable")=="false")return;var bt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;bt&&be();for(var ht=0;ht<_e.childNodes.length;ht++)Ne(_e.childNodes[ht]);/^(pre|p)$/i.test(_e.nodeName)&&(Q=!0),bt&&(H=!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 L}function ca(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return vi(e.clipPos(et(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 L=e.display.view[i];if(L.node==r)return ru(L,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!T(r,t))return vi(et(It(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var L=e.rest?J(e.rest):e.line;return vi(et(It(L),L.text.length),i)}var H=t.nodeType==3?t:null,Y=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,n&&(n=H.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Q=e.measure,te=Q.maps;function be(st,ct,bt){for(var ht=-1;ht<(te?te.length:0);ht++)for(var St=ht<0?Q.map:te[ht],Dt=0;Dt<St.length;Dt+=3){var At=St[Dt+2];if(At==st||At==ct){var Ht=It(ht<0?e.line:e.rest[ht]),lr=St[Dt]+bt;return(bt<0||At!=st)&&(lr=St[Dt+(bt?1:0)]),et(Ht,lr)}}}var Te=be(H,Y,n);if(Te)return vi(Te,i);for(var Ne=Y.nextSibling,_e=H?H.nodeValue.length-n:0;Ne;Ne=Ne.nextSibling){if(Te=be(Ne,Ne.firstChild,0),Te)return vi(et(Te.line,Te.ch-_e),i);_e+=Ne.textContent.length}for(var Je=Y.previousSibling,rt=n;Je;Je=Je.previousSibling){if(Te=be(Je,Je.firstChild,-1),Te)return vi(et(Te.line,Te.ch+rt),i);rt+=Je.textContent.length}}var Dr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new oe,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),E&&(i.style.width="0px"),Re(i,"input",function(){G&&W>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Re(i,"paste",function(H){if(We(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function L(H){if(We(r,H))return;if(r.somethingSelected())da({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ks(r);da({lineWise:!0,text:Y.text}),H.type=="cut"?r.setSelections(Y.ranges,null,ke):(n.prevInput="",i.value=Y.text.join(`
`),V(i))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(i,"cut",L),Re(i,"copy",L),Re(e.scroller,"paste",function(H){if(kn(e,H)||We(r,H))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Y=new Event("paste");Y.clipboardData=H.clipboardData,i.dispatchEvent(Y)}),Re(e.lineSpace,"selectstart",function(H){kn(e,H)||le(H)}),Re(i,"compositionstart",function(){var H=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:H,range:r.markText(H,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=Os(),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=yo(e);if(e.options.moveInputWithCursor){var i=yn(e,n.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+H.top-L.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+H.left-L.left))}return r},Dr.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(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),G&&W>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",G&&W>=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||U()!=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||ut(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(G&&W>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=i.charCodeAt(0);if(L==8203&&!r&&(r="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Y=Math.min(r.length,i.length);H<Y&&r.charCodeAt(H)==i.charCodeAt(H);)++H;return ln(t,function(){Xa(t,i.slice(H),r.length-H,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(){G&&W>=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 L=Yn(n,e),H=r.scroller.scrollTop;if(!L||A)return;var Y=n.options.resetSelectionOnContextMenu;Y&&n.doc.sel.contains(L)==-1&&Fr(n,Vr)(n.doc,Un(L),ke);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: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Te;_&&(Te=window.scrollY),r.input.focus(),_&&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 rt=n.somethingSelected(),st="\u200B"+(rt?i.value:"");i.value="\u21DA",i.value=st,t.prevInput=rt?"":"\u200B",i.selectionStart=1,i.selectionEnd=st.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,G&&W<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),i.selectionStart!=null){(!G||G&&W<9)&&Ne();var rt=0,st=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Fr(n,Zo)(n):rt++<10?r.detectingSelectAll=setTimeout(st,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(st,200)}}if(G&&W>=9&&Ne(),w){Ee(e);var Je=function(){it(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?I(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=U();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Y.getValue()}var i;if(e.form&&(Re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var L=e.form;i=L.submit;try{var H=L.submit=function(){r(),L.submit=i,L.submit(),L.submit=H}}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&&(it(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var Y=mr(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function iu(e){e.off=it,e.on=Re,e.wheelEventPixels=cl,e.Doc=tn,e.splitLines=Tt,e.countColumn=X,e.findColumn=ue,e.isWordChar=Oe,e.Pass=Le,e.signal=Me,e.Line=Ln,e.changeEnd=Bn,e.scrollbarModel=Ao,e.Pos=et,e.cmpPos=Lt,e.modes=Nt,e.mimeModes=Et,e.resolveMode=dt,e.getMode=Zt,e.modeExtensions=jt,e.extendMode=Jt,e.copyState=ar,e.startState=Er,e.innerMode=cr,e.commands=Bi,e.keyMap=Dn,e.keyName=hs,e.isModifierKey=ds,e.lookupKey=pi,e.normalizeKeyMap=Pl,e.StringStream=Ot,e.SharedTextMarker=Ni,e.TextMarker=Wn,e.LineWidget=Ii,e.e_preventDefault=le,e.e_stopPropagation=de,e.e_stop=Ee,e.addClass=j,e.contains=T,e.rmClass=s,e.keyNames=Hn}$l(mr),ql(mr);var au="iter insert remove copy getEditor constructor".split(" ");for(var ha in tn.prototype)tn.prototype.hasOwnProperty(ha)&&pe(au,ha)<0&&(mr.prototype[ha]=function(e){return function(){return e.apply(this.doc,arguments)}}(tn.prototype[ha]));return Ce(tn),mr.inputStyles={textarea:Dr,contenteditable:rr},mr.defineMode=function(e){!mr.defaults.mode&&e!="null"&&(mr.defaults.mode=e),_t.apply(this,arguments)},mr.defineMIME=Kt,mr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),mr.defineMIME("text/plain","null"),mr.defineExtension=function(e,t){mr.prototype[e]=t},mr.defineDocExtension=function(e,t){tn.prototype[e]=t},mr.fromTextArea=nu,iu(mr),mr.version="5.58.2",mr})},WaYH:function(wt,nt,re){"use strict";var ce=re("rePB"),$=re("Ff2n"),D=re("VTBJ"),Z=re("1OyB"),B=re("vuIU"),M=re("JX7q"),G=re("Ji7U"),W=re("LK+K"),_=re("q1tI"),O=re("TSYQ"),y=re.n(O),A=re("sboe"),R=re("OZM5"),k=function(w){var b=w.prefixCls,s=w.level,f=w.isStart,l=w.isEnd;if(!s)return null;for(var a="".concat(b,"-indent-unit"),C=[],m=0;m<s;m+=1){var T;C.push(_.createElement("span",{key:m,className:y()(a,(T={},Object(ce.a)(T,"".concat(a,"-start"),f[m+1]),Object(ce.a)(T,"".concat(a,"-end"),l[m+1]),Object(ce.a)(T,"".concat(a,"-end-first-level"),!m&&l[0]),T))}))}return _.createElement("span",{"aria-hidden":"true",className:"".concat(b,"-indent")},C)},x=k,E=re("815F"),h="open",o="close",u="---",d=function(p){Object(G.a)(b,p);var w=Object(W.a)(b);function b(){var s;return Object(Z.a)(this,b),s=w.apply(this,arguments),s.state={dragNodeHighlight:!1},s.onSelectorClick=function(f){var l=s.props.context.onNodeClick;l(f,Object(E.b)(s.props)),s.isSelectable()?s.onSelect(f):s.onCheck(f)},s.onSelectorDoubleClick=function(f){var l=s.props.context.onNodeDoubleClick;l(f,Object(E.b)(s.props))},s.onSelect=function(f){if(s.isDisabled())return;var l=s.props.context.onNodeSelect;f.preventDefault(),l(f,Object(E.b)(s.props))},s.onCheck=function(f){if(s.isDisabled())return;var l=s.props,a=l.disableCheckbox,C=l.checked,m=s.props.context.onNodeCheck;if(!s.isCheckable()||a)return;f.preventDefault();var T=!C;m(f,Object(E.b)(s.props),T)},s.onMouseEnter=function(f){var l=s.props.context.onNodeMouseEnter;l(f,Object(E.b)(s.props))},s.onMouseLeave=function(f){var l=s.props.context.onNodeMouseLeave;l(f,Object(E.b)(s.props))},s.onContextMenu=function(f){var l=s.props.context.onNodeContextMenu;l(f,Object(E.b)(s.props))},s.onDragStart=function(f){var l=s.props.context.onNodeDragStart;f.stopPropagation(),s.setState({dragNodeHighlight:!0}),l(f,Object(M.a)(s));try{f.dataTransfer.setData("text/plain","")}catch(a){}},s.onDragEnter=function(f){var l=s.props.context.onNodeDragEnter;f.preventDefault(),f.stopPropagation(),l(f,Object(M.a)(s))},s.onDragOver=function(f){var l=s.props.context.onNodeDragOver;f.preventDefault(),f.stopPropagation(),l(f,Object(M.a)(s))},s.onDragLeave=function(f){var l=s.props.context.onNodeDragLeave;f.stopPropagation(),l(f,Object(M.a)(s))},s.onDragEnd=function(f){var l=s.props.context.onNodeDragEnd;f.stopPropagation(),s.setState({dragNodeHighlight:!1}),l(f,Object(M.a)(s))},s.onDrop=function(f){var l=s.props.context.onNodeDrop;f.preventDefault(),f.stopPropagation(),s.setState({dragNodeHighlight:!1}),l(f,Object(M.a)(s))},s.onExpand=function(f){var l=s.props.context.onNodeExpand;l(f,Object(E.b)(s.props))},s.setSelectHandle=function(f){s.selectHandle=f},s.getNodeState=function(){var f=s.props.expanded;return s.isLeaf()?null:f?h:o},s.hasChildren=function(){var f=s.props.eventKey,l=s.props.context.keyEntities,a=l[f]||{},C=a.children;return!!(C||[]).length},s.isLeaf=function(){var f=s.props,l=f.isLeaf,a=f.loaded,C=s.props.context.loadData,m=s.hasChildren();return l===!1?!1:l||!C&&!m||C&&a&&!m},s.isDisabled=function(){var f=s.props.disabled,l=s.props.context.disabled;return!!(l||f)},s.isCheckable=function(){var f=s.props.checkable,l=s.props.context.checkable;return!l||f===!1?!1:l},s.syncLoadData=function(f){var l=f.expanded,a=f.loading,C=f.loaded,m=s.props.context,T=m.loadData,U=m.onNodeLoad;if(a)return;T&&l&&!s.isLeaf()&&(!s.hasChildren()&&!C&&U(Object(E.b)(s.props)))},s.renderSwitcher=function(){var f=s.props,l=f.expanded,a=f.switcherIcon,C=s.props.context,m=C.prefixCls,T=C.switcherIcon,U=a||T;if(s.isLeaf())return _.createElement("span",{className:y()("".concat(m,"-switcher"),"".concat(m,"-switcher-noop"))},typeof U=="function"?U(Object(D.a)(Object(D.a)({},s.props),{},{isLeaf:!0})):U);var j=y()("".concat(m,"-switcher"),"".concat(m,"-switcher_").concat(l?h:o));return _.createElement("span",{onClick:s.onExpand,className:j},typeof U=="function"?U(Object(D.a)(Object(D.a)({},s.props),{},{isLeaf:!1})):U)},s.renderCheckbox=function(){var f=s.props,l=f.checked,a=f.halfChecked,C=f.disableCheckbox,m=s.props.context.prefixCls,T=s.isDisabled(),U=s.isCheckable();if(!U)return null;var j=typeof U!="boolean"?U:null;return _.createElement("span",{className:y()("".concat(m,"-checkbox"),l&&"".concat(m,"-checkbox-checked"),!l&&a&&"".concat(m,"-checkbox-indeterminate"),(T||C)&&"".concat(m,"-checkbox-disabled")),onClick:s.onCheck},j)},s.renderIcon=function(){var f=s.props.loading,l=s.props.context.prefixCls;return _.createElement("span",{className:y()("".concat(l,"-iconEle"),"".concat(l,"-icon__").concat(s.getNodeState()||"docu"),f&&"".concat(l,"-icon_loading"))})},s.renderSelector=function(){var f=s.state.dragNodeHighlight,l=s.props,a=l.title,C=l.selected,m=l.icon,T=l.loading,U=l.data,j=s.props.context,F=j.prefixCls,V=j.showIcon,P=j.icon,I=j.draggable,X=j.loadData,oe=j.titleRender,pe=s.isDisabled(),ve="".concat(F,"-node-content-wrapper"),Le;if(V){var ke=m||P;Le=ke?_.createElement("span",{className:y()("".concat(F,"-iconEle"),"".concat(F,"-icon__customize"))},typeof ke=="function"?ke(s.props):ke):s.renderIcon()}else X&&T&&(Le=s.renderIcon());var he;typeof a=="function"?he=a(U):oe?he=oe(U):he=a;var ae=_.createElement("span",{className:"".concat(F,"-title")},he);return _.createElement("span",{ref:s.setSelectHandle,title:typeof a=="string"?a:"",className:y()("".concat(ve),"".concat(ve,"-").concat(s.getNodeState()||"normal"),!pe&&(C||f)&&"".concat(F,"-node-selected"),!pe&&I&&"draggable"),draggable:!pe&&I||void 0,"aria-grabbed":!pe&&I||void 0,onMouseEnter:s.onMouseEnter,onMouseLeave:s.onMouseLeave,onContextMenu:s.onContextMenu,onClick:s.onSelectorClick,onDoubleClick:s.onSelectorDoubleClick,onDragStart:I?s.onDragStart:void 0},Le,ae)},s}return Object(B.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,l=this.props.context.selectable;return typeof f=="boolean"?f:l}},{key:"render",value:function(){var f,l=this.props,a=l.eventKey,C=l.className,m=l.style,T=l.dragOver,U=l.dragOverGapTop,j=l.dragOverGapBottom,F=l.isLeaf,V=l.isStart,P=l.isEnd,I=l.expanded,X=l.selected,oe=l.checked,pe=l.halfChecked,ve=l.loading,Le=l.domRef,ke=l.active,he=l.onMouseMove,ae=Object($.a)(l,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),ue=this.props.context,ie=ue.prefixCls,se=ue.filterTreeNode,J=ue.draggable,ee=ue.keyEntities,ne=this.isDisabled(),fe=Object(R.f)(ae),Ae=ee[a]||{},ge=Ae.level,Oe=P[P.length-1];return _.createElement("div",Object.assign({ref:Le,className:y()(C,"".concat(ie,"-treenode"),(f={},Object(ce.a)(f,"".concat(ie,"-treenode-disabled"),ne),Object(ce.a)(f,"".concat(ie,"-treenode-switcher-").concat(I?"open":"close"),!F),Object(ce.a)(f,"".concat(ie,"-treenode-checkbox-checked"),oe),Object(ce.a)(f,"".concat(ie,"-treenode-checkbox-indeterminate"),pe),Object(ce.a)(f,"".concat(ie,"-treenode-selected"),X),Object(ce.a)(f,"".concat(ie,"-treenode-loading"),ve),Object(ce.a)(f,"".concat(ie,"-treenode-active"),ke),Object(ce.a)(f,"".concat(ie,"-treenode-leaf-last"),Oe),Object(ce.a)(f,"drag-over",!ne&&T),Object(ce.a)(f,"drag-over-gap-top",!ne&&U),Object(ce.a)(f,"drag-over-gap-bottom",!ne&&j),Object(ce.a)(f,"filter-node",se&&se(Object(E.b)(this.props))),f)),style:m,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:he},fe),_.createElement(x,{prefixCls:ie,level:ge,isStart:V,isEnd:P}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),b}(_.Component),S=function(w){return _.createElement(A.a.Consumer,null,function(b){return _.createElement(d,Object.assign({},w,{context:b}))})};S.displayName="TreeNode",S.defaultProps={title:u},S.isTreeNode=1;var v=nt.a=S},X8EC:function(wt,nt,re){"use strict";re.r(nt);var ce=re("+L6B"),$=re("2/Rp"),D=re("DZo9"),Z=re("8z0m"),B=re("oBTY"),M=re("OaEy"),G=re("2fM7"),W=re("sRBo"),_=re("kaz8"),O=re("7Kak"),y=re("9yH6"),A=re("BoS7"),R=re("Sdc0"),k=re("14J3"),x=re("BMrR"),E=re("jCWc"),h=re("kPKH"),o=re("O3gP"),u=re("lrIw"),d=re("k1fw"),S=re("miYZ"),v=re("tsqr"),p=re("9og8"),w=re("y8nQ"),b=re("Vl3Y"),s=re("tJVT"),f=re("PpiC"),l=re("nRaC"),a=re("5RzL"),C=re("5NDa"),m=re("5rEg"),T=re("WmNS"),U=re.n(T),j=re("q1tI"),F=re.n(j),V=re("9kvl"),P=re("Ot1p"),I=re("hxT0"),X=re.n(I),oe=re("1vsH"),pe=re("m3rI"),ve=re("ErOA"),Le=re("jrin"),ke=re("R9oj"),he=re("ECub"),ae=re("YNHc"),ue=re.n(ae),ie=re("4i/N"),se=re("UESt"),J=Object(j.createRef)(),ee=function(We){var xe=We.dataSource,ye=We.placeholder,Ce=We.defaultValue,le=We.onChange,de=Object(j.useState)(!1),me=Object(s.a)(de,2),Ee=me[0],we=me[1],Ue=Object(j.useState)({data:[],objData:{},ids:[]}),Ze=Object(s.a)(Ue,2),at=Ze[0],vt=Ze[1],mt=Object(j.useState)({}),Ct=Object(s.a)(mt,2),Tt=Ct[0],ut=Ct[1];Object(j.useEffect)(function(){window.addEventListener("click",function(){we(!1),ut({})})},[]),Object(j.useEffect)(function(){if(Ce){var Et={},_t=[];Ce.forEach(function(Kt){var dt=Kt.sub_discipline,Zt=Object(f.a)(Kt,["sub_discipline"]);dt&&(Et[dt.id]=Object(d.a)(Object(d.a)({},Zt),{},{sub_disciplines:[dt]}),_t.push(dt.id))}),vt({ids:_t,data:Object.values(Et),objData:Et}),le(_t)}},[Ce]);var Rt=function(){return F.a.createElement("div",{className:ue.a.emptyWrap},F.a.createElement(he.a,{image:he.a.PRESENTED_IMAGE_SIMPLE}))},kt=function(_t){if(at.ids.includes(_t.id))return!1;var Kt=Tt.sub_disciplines,dt=Object(f.a)(Tt,["sub_disciplines"]),Zt=Object(d.a)(Object(d.a)({},at.objData),{},Object(Le.a)({},_t.id,Object(d.a)(Object(d.a)({},dt),{},{sub_disciplines:[_t]})));vt({ids:[].concat(Object(B.a)(at.ids),[_t.id]),data:Object.values(Zt),objData:Zt}),le([].concat(Object(B.a)(at.ids),[_t.id]))},zt=function(_t){var Kt=at.objData;delete Kt[_t];var dt=at.ids.filter(function(Zt){return Zt!==_t});vt({data:Object.values(Kt),objData:Kt,ids:dt}),le(dt)},Nt=45;return J&&J.current&&J.current.clientHeight>45&&(Nt=J.current.clientHeight+5),F.a.createElement("div",{className:ue.a.cascaderContainer,onClick:function(_t){_t.stopPropagation()}},F.a.createElement("div",{ref:J,className:ue.a.valueWrap,onClick:function(){return we(!Ee)}},at.data.length===0&&F.a.createElement("span",{className:ue.a.placeholder},ye||"\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B"),at.data.map(function(Et){return F.a.createElement("div",{className:ue.a.valueItem,key:Et.id},F.a.createElement("span",null,Et.name),F.a.createElement("span",null,"/"),F.a.createElement("span",null,Et.sub_disciplines[0].name),F.a.createElement("span",{onClick:function(Kt){Kt.stopPropagation(),Kt.preventDefault(),zt(Et.sub_disciplines[0].id)}},F.a.createElement(ie.a,null)))})),Ee&&F.a.createElement("div",{className:ue.a.modalWrap,style:{top:Nt}},F.a.createElement("div",{className:ue.a.left},xe.length===0&&Rt(),xe.length>0&&xe.map(function(Et){return F.a.createElement("div",{key:Et.id,onClick:function(){return ut(Et)}},F.a.createElement("span",null,Et.name),F.a.createElement("span",null,F.a.createElement(se.a,null)))})),Tt.sub_disciplines&&F.a.createElement("div",{className:ue.a.right},Tt.sub_disciplines.length===0&&Rt(),Tt.sub_disciplines.length>0&&Tt.sub_disciplines.map(function(Et){var _t=at.ids.includes(Et.id);return F.a.createElement("div",{key:Et.id,className:_t?ue.a.disabled:"",onClick:function(){return kt(Et)}},Et.name)}))))},ne=ee,fe=re("2qtc"),Ae=re("kLXV"),ge=re("6UJt"),Oe=re("DFOY"),Pe=re("wd/R"),je=re.n(Pe),Ge=re("jO45"),He=re("jN4g"),Fe=re("gJ3r"),qe=re("8pgt"),De=re.n(qe),Ie=function(We,xe){return xe.some(function(ye){return ye.label.toLowerCase().indexOf(We.toLowerCase())>-1})},Be=m.a.TextArea,ze=function(We){var xe=We.newCourse,ye=We.globalSetting,Ce=We.loading,le=We.dispatch,de=We.schoolName,me=We.onSuccess,Ee=me===void 0?function(){}:me,we=Object(f.a)(We,["newCourse","globalSetting","loading","dispatch","schoolName","onSuccess"]),Ue=b.a.useForm(),Ze=Object(s.a)(Ue,1),at=Ze[0];Object(j.useEffect)(function(){at.setFieldsValue({name:de})},[de]);var vt=function(){var mt=Object(p.a)(U.a.mark(function Ct(Tt){var ut,Rt,kt,zt,Nt,Et,_t;return U.a.wrap(function(dt){for(;;)switch(dt.prev=dt.next){case 0:return ut=Tt||{},Rt=ut.name,kt=ut.city,zt=kt===void 0?[]:kt,Nt=ut.address,Et=ut.remarks,dt.next=3,le({type:"newCourse/appplySchool",payload:{name:Rt,province:zt[0],city:zt[1],address:Nt,remarks:Et}});case 3:_t=dt.sent,le({type:"newCourse/setActionTabs",payload:{}}),_t&&(v.b.success("\u65B0\u589E\u53D1\u5E03\u5355\u4F4D\u6210\u529F\uFF01"),Ee(Rt));case 6:case"end":return dt.stop()}},Ct)}));return function(Tt){return mt.apply(this,arguments)}}();return F.a.createElement(Ae.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:xe.actionTabs.key==="NewCourse-AppplySchool",title:"\u7533\u8BF7\u53D1\u5E03\u5355\u4F4D",width:"600px",footer:null},F.a.createElement(b.a,{className:De.a.formWrap,form:at,labelCol:{span:4},wrapperCol:{span:20},onFinish:vt},F.a.createElement(b.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D\uFF1A",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B66\u6821\u6216\u5DE5\u4F5C\u5355\u4F4D"}]},F.a.createElement(m.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"})),F.a.createElement("div",{className:"".concat(De.a.flexRow," ").concat(De.a.example)},F.a.createElement("div",null,"\u793A\u4F8B\uFF1A"),F.a.createElement("div",{className:De.a.flexColumn},F.a.createElement("div",null,F.a.createElement(Ge.a,{style:{color:"rgb(82, 196, 26)"}}),F.a.createElement("span",{className:"font14 ml5"},"\u6B63\u786E\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784")),F.a.createElement("div",null,F.a.createElement(He.a,{style:{color:"red"}}),F.a.createElement("span",{className:"font14 ml5"},"\u9519\u8BEF\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784",je()().format("YYYY"),"\u6625")))),F.a.createElement(b.a.Item,{label:"\u5730\u533A\uFF1A",name:"city"},F.a.createElement(Oe.a,{allowClear:!0,size:"large",options:Fe.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730",showSearch:{matchInputWidth:!0,filter:Ie}})),F.a.createElement(b.a.Item,{label:"\u8BE6\u7EC6\u5730\u5740\uFF1A",name:"address"},F.a.createElement(m.a,{placeholder:"\u8BF7\u586B\u5199\u5B8C\u6574\u7684\u5730\u5740\u4FE1\u606F"})),F.a.createElement(b.a.Item,{label:"\u8BF4\u660E\uFF1A",name:"remarks"},F.a.createElement(Be,{placeholder:"\u518D\u6B21\u8BF4\u660E\u7279\u522B\u60C5\u51B5\uFF08\u9009\u586B\uFF09"})),F.a.createElement("div",{className:De.a.footerWrap},F.a.createElement(b.a.Item,null,F.a.createElement($.a,{className:"mr5",size:"large",onClick:function(){le({type:"newCourse/setActionTabs",payload:{}})}},"\u53D6\u6D88"),F.a.createElement($.a,{size:"large",type:"primary",htmlType:"submit",loading:Ce["newCourse/appplySchool"]},"\u4FDD\u5B58")))))},Ke=Object(V.a)(function(Me){var We=Me.newCourse,xe=Me.loading,ye=Me.globalSetting;return{newCourse:We,globalSetting:ye,loading:xe.effects}})(ze),Ve=m.a.TextArea,Re=a.a.TreeNode,tt=function(We){var xe,ye,Ce=We.user,le=We.newCourse,de=We.globalSetting,me=We.loading,Ee=We.dispatch,we=Object(f.a)(We,["user","newCourse","globalSetting","loading","dispatch"]),Ue=b.a.useForm(),Ze=Object(s.a)(Ue,1),at=Ze[0],vt=Object(j.useState)({}),mt=Object(s.a)(vt,2),Ct=mt[0],Tt=mt[1],ut=Object(j.useState)(),Rt=Object(s.a)(ut,2),kt=Rt[0],zt=Rt[1],Nt=Object(j.useRef)(),Et=Object(j.useState)(!0),_t=Object(s.a)(Et,2),Kt=_t[0],dt=_t[1],Zt=Object(j.useState)(!1),jt=Object(s.a)(Zt,2),Jt=jt[0],ar=jt[1],cr=Object(j.useState)(),Er=Object(s.a)(cr,2),Ot=Er[0],ft=Er[1],or=Object(j.useState)(!0),xr=Object(s.a)(or,2),ur=xr[0],It=xr[1],gr=Object(j.useState)(!1),sr=Object(s.a)(gr,2),Yr=sr[0],et=sr[1],Lt=Object(j.useState)(!1),Kr=Object(s.a)(Lt,2),wr=Kr[0],$r=Kr[1],Gr=Object(j.useState)(-1),z=Object(s.a)(Gr,2),c=z[0],g=z[1],N=Object(j.useState)(!0),q=Object(s.a)(N,2),K=q[0],Se=q[1],Qe=Object(j.useState)([]),ot=Object(s.a)(Qe,2),lt=ot[0],$e=ot[1],gt=Object(j.useState)([]),yt=Object(s.a)(gt,2),Pt=yt[0],nr=yt[1],Yt=Object(j.useState)([]),Qt=Object(s.a)(Yt,2),vr=Qt[0],Wr=Qt[1],tr=Object(j.useState)([]),Vt=Object(s.a)(tr,2),Cr=Vt[0],zr=Vt[1],ir=Object(j.useState)(!1),dn=Object(s.a)(ir,2),yr=dn[0],Or=dn[1],Rn=Object(j.useState)(!1),on=Object(s.a)(Rn,2),qr=on[0],gn=on[1],Gn=Object(j.useState)(1),vn=Object(s.a)(Gn,2),hr=vn[0],Xt=vn[1],Pr=Object(j.useState)([]),Wt=Object(s.a)(Pr,2),Sr=Wt[0],qt=Wt[1],pn=Object(j.useState)([]),Ar=Object(s.a)(pn,2),Nr=Ar[0],An=Ar[1];Object(j.useEffect)(function(){var Ut,Xe;xn(),_n(),Nt.current=(Ut=we.match.params)===null||Ut===void 0?void 0:Ut.pathId,zt(!!Nt.current),Object(oe.Z)(de==null||((Xe=de.setting)===null||Xe===void 0)?void 0:Xe.name),at.setFieldsValue({learning_notes_title:"\u8BFE\u7A0B\u987B\u77E5"}),Nt.current&&cn(),Cn()},[]);var xn=function(){var Ut=Object(p.a)(U.a.mark(function Xe(){var Ye;return U.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return xt.next=2,Object(ve.a)("/api/disciplines.json",{method:"get",params:{source:"subject"}});case 2:Ye=xt.sent,Wr(Ye.disciplines);case 4:case"end":return xt.stop()}},Xe)}));return function(){return Ut.apply(this,arguments)}}(),_n=function(){var Ut=Object(p.a)(U.a.mark(function Xe(){var Ye;return U.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return Se(!0),xt.next=3,Ee({type:"newCourse/getSchoolOption"});case 3:Ye=xt.sent,Se(!1),$e(Ye==null?void 0:Ye.schools),nr(Ye==null?void 0:Ye.schools);case 7:case"end":return xt.stop()}},Xe)}));return function(){return Ut.apply(this,arguments)}}();function Cn(){return sn.apply(this,arguments)}function sn(){return sn=Object(p.a)(U.a.mark(function Ut(){var Xe;return U.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Object(ve.a)("/admins/departments.json",{method:"Get",params:{page:1,per_page:200}});case 2:Xe=pt.sent,Xe&&(Xe==null||Xe.departments.forEach(function(xt){xt.label=xt.name,xt.value=xt.id}),qt(Xe==null?void 0:Xe.departments));case 4:case"end":return pt.stop()}},Ut)})),sn.apply(this,arguments)}var Pn=function(){var Xe,Ye;if(we!=null&&(Xe=we.location)!==null&&Xe!==void 0&&(Ye=Xe.query)!==null&&Ye!==void 0&&Ye.username){var pt,xt;V.d.push("/users/".concat(we==null||((pt=we.location)===null||pt===void 0||((xt=pt.query)===null||xt===void 0))?void 0:xt.username,"/paths"));return}V.d.push(kt?"/paths/".concat(Nt.current):"/paths")},cn=function(){var Ut=Object(p.a)(U.a.mark(function Xe(){var Ye,pt,xt,Mt,$t,Bt,dr,Lr,Ft,Zr,Gt,kr,pr,Mr,Mn;return U.a.wrap(function(mn){for(;;)switch(mn.prev=mn.next){case 0:return mn.next=2,Ee({type:"newCourse/getEditCourseData",payload:{id:Nt.current}});case 2:Ye=mn.sent,Ye&&(Ft={name:Ye.name,name_en:Ye.name_en,intro:Ye.description,content:Ye==null||((pt=Ye.toast)===null||pt===void 0)?void 0:pt.content,notice:Ye.learning_notes,school_id:Ye==null?void 0:Ye.school,learning_notes_title:Ye.learning_notes_title||"\u8BFE\u7A0B\u987B\u77E5"},Ye.disciplines&&Ye.disciplines.length>0&&zr(Ye.disciplines),at.setFieldsValue(Ft),$r(Ye==null||((xt=Ye.toast)===null||xt===void 0)?void 0:xt.is_open),g(Ye==null||((Mt=Ye.toast)===null||Mt===void 0)?void 0:Mt.open_num),dt(Ye==null?void 0:Ye.cust_seq),ar(Ye==null?void 0:Ye.show_spoc),et(Ye==null?void 0:Ye.show_history),It(Ye==null?void 0:Ye.show_tag),(Ye==null||(($t=Ye.attachments)===null||$t===void 0)?void 0:$t.length)>0&&ft([{uid:Ye==null||((Zr=Ye.attachments)===null||Zr===void 0||((Gt=Zr[0])===null||Gt===void 0))?void 0:Gt.id,name:Ye==null||((kr=Ye.attachments)===null||kr===void 0||((pr=kr[0])===null||pr===void 0))?void 0:pr.title,response:{id:Ye==null||((Mr=Ye.attachments)===null||Mr===void 0||((Mn=Mr[0])===null||Mn===void 0))?void 0:Mn.id}}]),Tt({name:Ye.name,intro:Ye.description,notice:Ye.learning_notes,content:Ye==null||((Bt=Ye.toast)===null||Bt===void 0)?void 0:Bt.content}),Or(Ye==null?void 0:Ye.member_can_edit),gn(Ye==null?void 0:Ye.can_copy),Xt(Ye==null||((dr=Ye.public_ranges)===null||dr===void 0)?void 0:dr.type),An(Ye==null||((Lr=Ye.public_ranges)===null||Lr===void 0)?void 0:Lr.department_ranges));case 4:case"end":return mn.stop()}},Xe)}));return function(){return Ut.apply(this,arguments)}}(),zn=function(){var Ut=Object(p.a)(U.a.mark(function Xe(Ye){var pt,xt,Mt,$t,Bt,dr,Lr,Ft,Zr,Gt,kr,pr,Mr,Mn,In;return U.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:if(Mt=Ye||{},$t=Mt.name,Bt=Mt.intro,dr=Mt.notice,Lr=Mt.name_en,Ft=Mt.learning_notes_title,Zr=Mt.sub_discipline_ids,Gt=Mt.school_id,kr=kt?"newCourse/editCourse":"newCourse/submitCourse",pr=!1,Mr=null,lt.map(function(Gi){Gt===Gi.name&&(pr=!0,Mr=Gi.id)}),pr){fr.next=7;break}return fr.abrupt("return",v.b.error("\u672A\u627E\u5230\u5305\u542B'".concat(Gt,"'\u7684\u53D1\u5E03\u5355\u4F4D")));case 7:return Mn={id:Nt.current,name:$t,name_en:Lr,description:Bt,learning_notes:dr,cust_seq:Kt,show_spoc:Jt,school_id:Mr,show_tag:ur,show_history:Yr,learning_notes_title:Ft,attachment_ids:[Ot==null||((pt=Ot[0])===null||pt===void 0||((xt=pt.response)===null||xt===void 0))?void 0:xt.id],sub_discipline_ids:Zr,subject_toast_attributes:{is_open:wr,open_num:c,content:Ye.content},can_copy:qr,member_can_edit:yr,public_ranges:{type:hr,department_ids:Nr}},fr.next=10,Ee({type:kr,payload:Object(d.a)({},Mn)});case 10:In=fr.sent,(In==null?void 0:In.subject_id)&&V.d.push("/paths/".concat(In.subject_id));case 12:case"end":return fr.stop()}},Xe)}));return function(Ye){return Ut.apply(this,arguments)}}(),ri=function(){Ee({type:"newCourse/setActionTabs",payload:{key:"NewCourse-AppplySchool"}})},Ln=function(Xe){_n(),Tt(Object(d.a)({},at.getFieldsValue()))};return Object(j.useEffect)(function(){var Ut;at.setFieldsValue({school_id:(Ut=lt[0])===null||Ut===void 0?void 0:Ut.name})},[lt]),F.a.createElement("div",{className:X.a.wrap},F.a.createElement("div",{className:X.a.bg},F.a.createElement("div",{className:X.a.crumbs},F.a.createElement("span",null,"\u5B9E\u9A8C\u8BFE\u7A0B"),F.a.createElement("i",{className:"iconfont icon-zhankai1"}),F.a.createElement("b",null,kt?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u9A8C\u8BFE\u7A0B")),F.a.createElement("div",{className:X.a.titleWrap},F.a.createElement("span",null,kt?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u9A8C\u8BFE\u7A0B"),F.a.createElement("b",{onClick:Pn},"\u8FD4\u56DE")),F.a.createElement(b.a,{form:at,className:X.a.formWrap,scrollToFirstError:!0,layout:"vertical",colon:!1,onValuesChange:function(){var Xe=at.getFieldsValue();"school_id"in Xe&&nr(lt.filter(function(Ye){return Ye.name.includes(Xe.school_id)})),Tt(Object(d.a)({},Xe))},onFinish:zn},F.a.createElement("div",{className:X.a.fieldWrap},F.a.createElement(b.a.Item,{extra:F.a.createElement("div",{className:"tr c-grey-333 font12 mt3"},"".concat(((xe=Ct.name)===null||xe===void 0?void 0:xe.length)||0,"/60")),name:"name",label:"\u5B9E\u9A8C\u8BFE\u7A0B\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u8BFE\u7A0B\u540D\u79F0"}]},F.a.createElement(Ve,{maxLength:60,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),F.a.createElement(b.a.Item,{name:"name_en",label:"\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0",rules:[{message:"\u8BF7\u8F93\u5165\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0"}]},F.a.createElement(m.a,{maxLength:200,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A",addonAfter:"".concat(((ye=Ct.name_en)===null||ye===void 0?void 0:ye.length)||0,"/200")})),F.a.createElement(b.a.Item,{name:"sub_discipline_ids",label:"\u65B9\u5411&\u8BFE\u7A0B"},F.a.createElement(ne,{defaultValue:Cr,dataSource:vr,onChange:function(Xe){return at.setFieldsValue({sub_discipline_ids:Xe})}})),F.a.createElement(b.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D",name:"school_id",wrapperCol:{span:24},extra:!K&&Ct.school_id&&!(lt!=null&&lt.find(function(Ut){return Ut.name===Ct.school_id}))&&F.a.createElement("div",{className:X.a.schoolHintWrap},F.a.createElement("span",{className:X.a.colorCDCDCD},"\u672A\u627E\u5230\u5305\u542B\u201C",Ct.school_id,"\u201D\u7684\u53D1\u5E03\u5355\u4F4D\uFF0C"),F.a.createElement("span",{className:"".concat(X.a.color0152d9),onClick:ri},"\u7533\u8BF7\u65B0\u589E")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"}]},F.a.createElement(u.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D",showSearch:!0,size:"large",options:Pt==null?void 0:Pt.map(function(Ut){return{value:Ut.name}})}))),F.a.createElement("div",{className:X.a.mdWrap},F.a.createElement(b.a.Item,{name:"intro",label:"\u7B80\u4ECB",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u7B80\u4ECB"},{max:8e3,message:"\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u7B80\u4ECB\u6700\u5927\u9650\u52368000\u4E2A\u5B57\u7B26"}]},F.a.createElement(P.a,{watch:!0,defaultValue:Ct.intro}))),F.a.createElement("div",{className:X.a.mdWrap},F.a.createElement(x.a,{align:"top",className:"mb10 mt10"},F.a.createElement(h.a,null,F.a.createElement("span",{className:"c-red mr10"},"*")),F.a.createElement(h.a,{flex:"1"},F.a.createElement(b.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"}]},F.a.createElement(m.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165"})))),F.a.createElement(b.a.Item,{name:"notice",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5"},{max:1e4,message:"\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},F.a.createElement(P.a,{insertTemp:"1",watch:!0,defaultValue:Ct.notice}))),F.a.createElement("div",{className:X.a.mdWrap},F.a.createElement("div",{style:{display:"flex",alignItems:"center"}},F.a.createElement(R.a,{checked:wr,style:{marginRight:11,minWidth:32},onChange:function(Xe){$r(Xe)}}),F.a.createElement("span",{className:X.a.spanText},"\u8BFE\u7A0B\u63D0\u793A",F.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"))),wr&&F.a.createElement(b.a.Item,{style:{marginTop:10},name:"content",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A"},{max:1e4,message:"\u5B9E\u9A8C\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},F.a.createElement(P.a,{insertTemp:"1",watch:!0,defaultValue:Ct.content})),wr&&F.a.createElement("div",{style:{marginTop:20,borderBottom:"1px solid #DBDCE0",paddingBottom:7}},F.a.createElement("label",{style:{color:"#000",marginRight:10}},"\u63D0\u793A\u6B21\u6570"),F.a.createElement(y.a.Group,{value:c,onChange:function(Xe){g(Xe.target.value)}},F.a.createElement(y.a,{className:"c-black",value:-1},"\u6BCF\u6B21"),F.a.createElement(y.a,{className:"ml20 c-black",value:1},"\u4E00\u6B21")))),F.a.createElement("div",{className:X.a.mdWrap,style:{marginTop:25}},F.a.createElement(_.a,{checked:Kt,onChange:function(Xe){dt(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u5C55\u793A\u9ED8\u8BA4\u7AE0\u8282\u5E8F\u53F7",F.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"))),F.a.createElement("br",null),F.a.createElement(_.a,{style:{marginTop:"10px"},checked:Jt,onChange:function(Xe){return ar(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u81EA\u9009\u5E76\u5C55\u793ASPOC\u8BFE\u5802",F.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"))),F.a.createElement("br",null),F.a.createElement(_.a,{style:{marginTop:"10px"},checked:ur,onChange:function(Xe){return It(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u5C55\u793A\u6280\u672F\u6807\u7B7E\u6A21\u5757",F.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"))),F.a.createElement("br",null),F.a.createElement(_.a,{style:{marginTop:"10px"},checked:Yr,onChange:function(Xe){return et(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u5C55\u793A\u5386\u53F2\u8BFE\u5802\u6A21\u5757",F.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"))),F.a.createElement("br",null),F.a.createElement(_.a,{style:{marginTop:"10px"},checked:qr,onChange:function(Xe){return gn(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u53EF\u590D\u5236\u8BFE\u7A0B",F.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u8BE5\u8BFE\u7A0B\u5185\u6240\u6709\u8D44\u6E90\u53EF\u88AB\u590D\u5236\u6210\u4E00\u4E2A\u65B0\u7684\u8BFE\u7A0B\uFF09"))),F.a.createElement("br",null),F.a.createElement(_.a,{style:{marginTop:"10px"},checked:yr,onChange:function(Xe){return Or(Xe==null?void 0:Xe.target.checked)}},F.a.createElement("span",{className:X.a.spanText},"\u53EF\u7F16\u8F91\u8BFE\u7A0B",F.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u8BE5\u8BFE\u7A0B\u7684\u534F\u4F5C\u8005\u53EF\u7F16\u8F91\u8BFE\u7A0B\u7684\u89C4\u5219\uFF0C\u5426\u5219\u53EA\u80FD\u65B0\u5EFA\u8BFE\u7A0B\u7AE0\u8282\uFF09"))),F.a.createElement("br",null),F.a.createElement("div",{className:X.a.mdWrap},F.a.createElement("div",{style:{display:"flex"}},F.a.createElement("div",{className:"c-black mb10",style:{marginRight:10}},"\u516C\u5F00\u8303\u56F4"),F.a.createElement(y.a.Group,{value:hr,onChange:function(Xe){return Xt(Xe.target.value)}},F.a.createElement(y.a,{value:1},"\u5168\u90E8"),F.a.createElement(y.a,{value:2},"\u90E8\u5206\u5B66\u9662"))),hr===2&&F.a.createElement(G.a,{value:Nr,style:{width:"100%"},mode:"multiple",placeholder:"\u8BF7\u9009\u62E9\u516C\u5F00\u7684\u5B66\u9662",options:Sr,onChange:function(Xe){An(Xe)},optionLabelProp:"label"})),F.a.createElement("div",{className:"mt10"},F.a.createElement("div",{className:"c-black mb10"},"\u81EA\u5B9A\u4E49\u9876\u90E8\u80CC\u666F\u56FE"),F.a.createElement(Z.a,{action:pe.a.API_SERVER+"/api/attachments.json",withCredentials:!0,fileList:Ot,onChange:function(Xe){var Ye,pt=(Xe==null?void 0:Xe.file.size)/1024/1024<2;if(!((Ye=Xe.fileList)!==null&&Ye!==void 0&&Ye.length))return!1;if(!pt)ft(Object(B.a)(Ot));else{var xt;ft(Xe==null||((xt=Xe.fileList)===null||xt===void 0)?void 0:xt.slice(-1))}},beforeUpload:function(Xe){var Ye=Xe.type==="image/jpeg"||Xe.type==="image/png";if(!Ye)return v.b.error("\u53EA\u80FD\u4E0A\u4F20jpg \u6216\u8005png\u56FE\u7247"),!1;var pt=Xe.size/1024/1024<2;return pt?Ye&&pt:(v.b.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u5927\u4E8E2m"),!1)},onRemove:function(Xe){ft([])}},F.a.createElement("div",{className:X.a.aBtn},"\u4E0A\u4F20\u56FE\u7247"),F.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")))),F.a.createElement("div",{className:X.a.backgroundFa},F.a.createElement("div",{className:X.a.bBtn,onClick:Pn},"\u53D6\u6D88"),F.a.createElement($.a,{className:X.a.cBtn,onClick:function(){return at.submit()},loading:me["newCourse/editCourse"]||me["newCourse/submitCourse"]},"\u63D0\u4EA4"," "))),F.a.createElement(Ke,{schoolName:Ct.school_id,onSuccess:Ln})))},it=nt.default=Object(V.a)(function(Me){var We=Me.user,xe=Me.newCourse,ye=Me.loading,Ce=Me.globalSetting;return{user:We,newCourse:xe,globalSetting:Ce,loading:ye.effects}})(tt)},XIdC:function(wt,nt,re){"use strict";var ce=re("rePB"),$=re("ODXe"),D=re("Ff2n"),Z=re("q1tI"),B=re.n(Z),M=re("TSYQ"),G=re.n(M),W=re("6cGi"),_=re("4IlW"),O=Z.forwardRef(function(y,A){var R,k=y.prefixCls,x=k===void 0?"rc-switch":k,E=y.className,h=y.checked,o=y.defaultChecked,u=y.disabled,d=y.loadingIcon,S=y.checkedChildren,v=y.unCheckedChildren,p=y.onClick,w=y.onChange,b=y.onKeyDown,s=Object(D.a)(y,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),f=Object(W.a)(!1,{value:h,defaultValue:o}),l=Object($.a)(f,2),a=l[0],C=l[1];function m(F,V){var P=a;return u||(P=F,C(P),w==null||w(P,V)),P}function T(F){F.which===_.a.LEFT?m(!1,F):F.which===_.a.RIGHT&&m(!0,F),b==null||b(F)}function U(F){var V=m(!a,F);p==null||p(V,F)}var j=G()(x,E,(R={},Object(ce.a)(R,"".concat(x,"-checked"),a),Object(ce.a)(R,"".concat(x,"-disabled"),u),R));return Z.createElement("button",Object.assign({},s,{type:"button",role:"switch","aria-checked":a,disabled:u,className:j,ref:A,onKeyDown:T,onClick:U}),d,Z.createElement("span",{className:"".concat(x,"-inner")},a?S:v))});O.displayName="Switch",nt.a=O},Y1PL:function(wt,nt,re){"use strict";re.r(nt),re.d(nt,"ResizableTextArea",function(){return pe});var ce=re("wx14"),$=re("1OyB"),D=re("vuIU"),Z=re("Ji7U"),B=re("LK+K"),M=re("q1tI"),G=re("VTBJ"),W=re("rePB"),_=re("Zm9Q"),O=re("Kwbf"),y=re("c+Xe"),A=re("m+aA"),R=re("bdgK"),k=new Map;function x(ke){ke.forEach(function(he){var ae,ue=he.target;(ae=k.get(ue))===null||ae===void 0||ae.forEach(function(ie){return ie(ue)})})}var E=new R.default(x),h=null,o=null;function u(ke,he){k.has(ke)||(k.set(ke,new Set),E.observe(ke)),k.get(ke).add(he)}function d(ke,he){k.has(ke)&&(k.get(ke).delete(he),k.get(ke).size||(E.unobserve(ke),k.delete(ke)))}var S=function(ke){Object(Z.a)(ae,ke);var he=Object(B.a)(ae);function ae(){return Object($.a)(this,ae),he.apply(this,arguments)}return Object(D.a)(ae,[{key:"render",value:function(){return this.props.children}}]),ae}(M.Component),v=M.createContext(null);function p(ke){var he=ke.children,ae=ke.onBatchResize,ue=M.useRef(0),ie=M.useRef([]),se=M.useContext(v),J=M.useCallback(function(ee,ne,fe){ue.current+=1;var Ae=ue.current;ie.current.push({size:ee,element:ne,data:fe}),Promise.resolve().then(function(){Ae===ue.current&&(ae==null||ae(ie.current),ie.current=[])}),se==null||se(ee,ne,fe)},[ae,se]);return M.createElement(v.Provider,{value:J},he)}function w(ke){var he=ke.children,ae=ke.disabled,ue=M.useRef(null),ie=M.useRef(null),se=M.useContext(v),J=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ee=M.isValidElement(he)&&Object(y.c)(he),ne=ee?he.ref:null,fe=M.useMemo(function(){return Object(y.a)(ne,ue)},[ne,ue]),Ae=M.useRef(ke);Ae.current=ke;var ge=M.useCallback(function(Oe){var Pe=Ae.current,je=Pe.onResize,Ge=Pe.data,He=Oe.getBoundingClientRect(),Fe=He.width,qe=He.height,De=Oe.offsetWidth,Ie=Oe.offsetHeight,Be=Math.floor(Fe),ze=Math.floor(qe);if(J.current.width!==Be||J.current.height!==ze||J.current.offsetWidth!==De||J.current.offsetHeight!==Ie){var Ke={width:Be,height:ze,offsetWidth:De,offsetHeight:Ie};J.current=Ke;var Ve=De===Math.round(Fe)?Fe:De,Re=Ie===Math.round(qe)?qe:Ie,tt=Object(G.a)(Object(G.a)({},Ke),{},{offsetWidth:Ve,offsetHeight:Re});se==null||se(tt,Oe,Ge),je&&Promise.resolve().then(function(){je(tt,Oe)})}},[]);return M.useEffect(function(){var Oe=Object(A.a)(ue.current)||Object(A.a)(ie.current);return Oe&&!ae&&u(Oe,ge),function(){return d(Oe,ge)}},[ue.current,ae]),M.createElement(S,{ref:ie},ee?M.cloneElement(he,{ref:fe}):he)}var b="rc-observer-key";function s(ke){var he=ke.children,ae=Object(_.a)(he);return ae.map(function(ue,ie){var se=(ue==null?void 0:ue.key)||"".concat(b,"-").concat(ie);return M.createElement(w,Object(ce.a)({},ke,{key:se}),ue)})}s.Collection=p;var f=s,l=re("bT9E"),a=re("TSYQ"),C=re.n(a),m=`
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
`,T=["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"],U={},j;function F(ke){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=ke.getAttribute("id")||ke.getAttribute("data-reactid")||ke.getAttribute("name");if(he&&U[ae])return U[ae];var ue=window.getComputedStyle(ke),ie=ue.getPropertyValue("box-sizing")||ue.getPropertyValue("-moz-box-sizing")||ue.getPropertyValue("-webkit-box-sizing"),se=parseFloat(ue.getPropertyValue("padding-bottom"))+parseFloat(ue.getPropertyValue("padding-top")),J=parseFloat(ue.getPropertyValue("border-bottom-width"))+parseFloat(ue.getPropertyValue("border-top-width")),ee=T.map(function(fe){return"".concat(fe,":").concat(ue.getPropertyValue(fe))}).join(";"),ne={sizingStyle:ee,paddingSize:se,borderSize:J,boxSizing:ie};return he&&ae&&(U[ae]=ne),ne}function V(ke){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ue=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)),ke.getAttribute("wrap")?j.setAttribute("wrap",ke.getAttribute("wrap")):j.removeAttribute("wrap");var ie=F(ke,he),se=ie.paddingSize,J=ie.borderSize,ee=ie.boxSizing,ne=ie.sizingStyle;j.setAttribute("style","".concat(ne,";").concat(m)),j.value=ke.value||ke.placeholder||"";var fe=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,ge=j.scrollHeight,Oe;if(ee==="border-box"?ge+=J:ee==="content-box"&&(ge-=se),ae!==null||ue!==null){j.value=" ";var Pe=j.scrollHeight-se;ae!==null&&(fe=Pe*ae,ee==="border-box"&&(fe=fe+se+J),ge=Math.max(fe,ge)),ue!==null&&(Ae=Pe*ue,ee==="border-box"&&(Ae=Ae+se+J),Oe=ge>Ae?"":"hidden",ge=Math.min(Ae,ge))}return{height:ge,minHeight:fe,maxHeight:Ae,overflowY:Oe,resize:"none"}}var P=re("Gytx"),I=re.n(P),X;(function(ke){ke[ke.NONE=0]="NONE",ke[ke.RESIZING=1]="RESIZING",ke[ke.RESIZED=2]="RESIZED"})(X||(X={}));var oe=function(ke){Object(Z.a)(ae,ke);var he=Object(B.a)(ae);function ae(ue){var ie;return Object($.a)(this,ae),ie=he.call(this,ue),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(se){ie.textArea=se},ie.handleResize=function(se){var J=ie.state.resizeStatus,ee=ie.props,ne=ee.autoSize,fe=ee.onResize;if(J!==X.NONE)return;typeof fe=="function"&&fe(se),ne&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var se=ie.props.autoSize;if(!se||!ie.textArea)return;var J=se.minRows,ee=se.maxRows,ne=V(ie.textArea,!1,J,ee);ie.setState({textareaStyles:ne,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:X.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:X.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var se=ie.props,J=se.prefixCls,ee=J===void 0?"rc-textarea":J,ne=se.autoSize,fe=se.onResize,Ae=se.className,ge=se.disabled,Oe=ie.state,Pe=Oe.textareaStyles,je=Oe.resizeStatus,Ge=Object(l.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=C()(ee,Ae,Object(W.a)({},"".concat(ee,"-disabled"),ge));"value"in Ge&&(Ge.value=Ge.value||"");var Fe=Object(G.a)(Object(G.a)(Object(G.a)({},ie.props.style),Pe),je===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(f,{onResize:ie.handleResize,disabled:!(ne||fe)},M.createElement("textarea",Object(ce.a)({},Ge,{className:He,style:Fe,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:X.NONE},ie}return Object(D.a)(ae,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!I()(ie.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ie=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,se)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ae}(M.Component),pe=oe,ve=function(ke){Object(Z.a)(ae,ke);var he=Object(B.a)(ae);function ae(ue){var ie;Object($.a)(this,ae),ie=he.call(this,ue),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(J){ie.resizableTextArea=J},ie.handleChange=function(J){var ee=ie.props.onChange;ie.setValue(J.target.value,function(){ie.resizableTextArea.resizeTextarea()}),ee&&ee(J)},ie.handleKeyDown=function(J){var ee=ie.props,ne=ee.onPressEnter,fe=ee.onKeyDown;J.keyCode===13&&ne&&ne(J),fe&&fe(J)};var se=typeof ue.value=="undefined"||ue.value===null?ue.defaultValue:ue.value;return ie.state={value:se},ie}return Object(D.a)(ae,[{key:"setValue",value:function(ie,se){"value"in this.props||this.setState({value:ie},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(pe,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),ae}(M.Component),Le=nt.default=ve},YNHc:function(wt,nt,re){wt.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(wt,nt,re){"use strict";function ce(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function $(y,A){return(!A||y!=="hidden")&&y!=="visible"&&y!=="clip"}function D(y,A){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var R=getComputedStyle(y,null);return $(R.overflowY,A)||$(R.overflowX,A)||function(k){var x=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(h){return null}}(k);return!!x&&(x.clientHeight<k.scrollHeight||x.clientWidth<k.scrollWidth)}(y)}return!1}function Z(y,A,R,k,x,E,h,o){return E<y&&h>A||E>y&&h<A?0:E<=y&&o<=R||h>=A&&o>=R?E-y-k:h>A&&o<R||E<y&&o>R?h-A+x:0}var B=function(y,A){var R=window,k=A.scrollMode,x=A.block,E=A.inline,h=A.boundary,o=A.skipOverflowHiddenElements,u=typeof h=="function"?h:function(Pe){return Pe!==h};if(!ce(y))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,S=[],v=y;ce(v)&&u(v);){if((v=v.parentElement)===d){S.push(v);break}v!=null&&v===document.body&&D(v)&&!D(document.documentElement)||v!=null&&D(v,o)&&S.push(v)}for(var p=R.visualViewport?R.visualViewport.width:innerWidth,w=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,s=window.scrollY||pageYOffset,f=y.getBoundingClientRect(),l=f.height,a=f.width,C=f.top,m=f.right,T=f.bottom,U=f.left,j=x==="start"||x==="nearest"?C:x==="end"?T:C+l/2,F=E==="center"?U+a/2:E==="end"?m:U,V=[],P=0;P<S.length;P++){var I=S[P],X=I.getBoundingClientRect(),oe=X.height,pe=X.width,ve=X.top,Le=X.right,ke=X.bottom,he=X.left;if(k==="if-needed"&&C>=0&&U>=0&&T<=w&&m<=p&&C>=ve&&T<=ke&&U>=he&&m<=Le)return V;var ae=getComputedStyle(I),ue=parseInt(ae.borderLeftWidth,10),ie=parseInt(ae.borderTopWidth,10),se=parseInt(ae.borderRightWidth,10),J=parseInt(ae.borderBottomWidth,10),ee=0,ne=0,fe="offsetWidth"in I?I.offsetWidth-I.clientWidth-ue-se:0,Ae="offsetHeight"in I?I.offsetHeight-I.clientHeight-ie-J:0;if(d===I)ee=x==="start"?j:x==="end"?j-w:x==="nearest"?Z(s,s+w,w,ie,J,s+j,s+j+l,l):j-w/2,ne=E==="start"?F:E==="center"?F-p/2:E==="end"?F-p:Z(b,b+p,p,ue,se,b+F,b+F+a,a),ee=Math.max(0,ee+s),ne=Math.max(0,ne+b);else{ee=x==="start"?j-ve-ie:x==="end"?j-ke+J+Ae:x==="nearest"?Z(ve,ke,oe,ie,J+Ae,j,j+l,l):j-(ve+oe/2)+Ae/2,ne=E==="start"?F-he-ue:E==="center"?F-(he+pe/2)+fe/2:E==="end"?F-Le+se+fe:Z(he,Le,pe,ue,se+fe,F,F+a,a);var ge=I.scrollLeft,Oe=I.scrollTop;j+=Oe-(ee=Math.max(0,Math.min(Oe+ee,I.scrollHeight-oe+Ae))),F+=ge-(ne=Math.max(0,Math.min(ge+ne,I.scrollWidth-pe+fe)))}V.push({el:I,top:ee,left:ne})}return V};function M(y){return y===Object(y)&&Object.keys(y).length!==0}function G(y,A){A===void 0&&(A="auto");var R="scrollBehavior"in document.body.style;y.forEach(function(k){var x=k.el,E=k.top,h=k.left;x.scroll&&R?x.scroll({top:E,left:h,behavior:A}):(x.scrollTop=E,x.scrollLeft=h)})}function W(y){return y===!1?{block:"end",inline:"nearest"}:M(y)?y:{block:"start",inline:"nearest"}}function _(y,A){var R=!y.ownerDocument.documentElement.contains(y);if(M(A)&&typeof A.behavior=="function")return A.behavior(R?[]:B(y,A));if(R)return;var k=W(A);return G(B(y,k),k.behavior)}var O=nt.a=_},Zss7:function(wt,nt,re){var ce;(function($){var D=/^\s+/,Z=/\s+$/,B=0,M=$.round,G=$.min,W=$.max,_=$.random;function O(J,ee){if(J=J||"",ee=ee||{},J instanceof O)return J;if(!(this instanceof O))return new O(J,ee);var ne=y(J);this._originalInput=J,this._r=ne.r,this._g=ne.g,this._b=ne.b,this._a=ne.a,this._roundA=M(100*this._a)/100,this._format=ee.format||ne.format,this._gradientType=ee.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=ne.ok,this._tc_id=B++}O.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,ne,fe,Ae,ge,Oe;return ee=J.r/255,ne=J.g/255,fe=J.b/255,ee<=.03928?Ae=ee/12.92:Ae=$.pow((ee+.055)/1.055,2.4),ne<=.03928?ge=ne/12.92:ge=$.pow((ne+.055)/1.055,2.4),fe<=.03928?Oe=fe/12.92:Oe=$.pow((fe+.055)/1.055,2.4),.2126*Ae+.7152*ge+.0722*Oe},setAlpha:function(J){return this._a=V(J),this._roundA=M(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=M(J.h*360),ne=M(J.s*100),fe=M(J.v*100);return this._a==1?"hsv("+ee+", "+ne+"%, "+fe+"%)":"hsva("+ee+", "+ne+"%, "+fe+"%, "+this._roundA+")"},toHsl:function(){var J=R(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=R(this._r,this._g,this._b),ee=M(J.h*360),ne=M(J.s*100),fe=M(J.l*100);return this._a==1?"hsl("+ee+", "+ne+"%, "+fe+"%)":"hsla("+ee+", "+ne+"%, "+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:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(P(this._r,255)*100)+"%",g:M(P(this._g,255)*100)+"%",b:M(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(P(this._b,255)*100)+"%)":"rgba("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(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="#"+u(this._r,this._g,this._b,this._a),ne=ee,fe=this._gradientType?"GradientType = 1, ":"";if(J){var Ae=O(J);ne="#"+u(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+fe+"startColorstr="+ee+",endColorstr="+ne+")"},toString:function(J){var ee=!!J;J=J||this._format;var ne=!1,fe=this._a<1&&this._a>=0,Ae=!ee&&fe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ae?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(ne=this.toRgbString()),J==="prgb"&&(ne=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(ne=this.toHexString()),J==="hex3"&&(ne=this.toHexString(!0)),J==="hex4"&&(ne=this.toHex8String(!0)),J==="hex8"&&(ne=this.toHex8String()),J==="name"&&(ne=this.toName()),J==="hsl"&&(ne=this.toHslString()),J==="hsv"&&(ne=this.toHsvString()),ne||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(J,ee){var ne=J.apply(null,[this].concat([].slice.call(ee)));return this._r=ne._r,this._g=ne._g,this._b=ne._b,this.setAlpha(ne._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(v,arguments)},spin:function(){return this._applyModification(s,arguments)},_applyCombination:function(J,ee){return J.apply(null,[this].concat([].slice.call(ee)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},O.fromRatio=function(J,ee){if(typeof J=="object"){var ne={};for(var fe in J)J.hasOwnProperty(fe)&&(fe==="a"?ne[fe]=J[fe]:ne[fe]=Le(J[fe]));J=ne}return O(J,ee)};function y(J){var ee={r:0,g:0,b:0},ne=1,fe=null,Ae=null,ge=null,Oe=!1,Pe=!1;return typeof J=="string"&&(J=ie(J)),typeof J=="object"&&(ue(J.r)&&ue(J.g)&&ue(J.b)?(ee=A(J.r,J.g,J.b),Oe=!0,Pe=String(J.r).substr(-1)==="%"?"prgb":"rgb"):ue(J.h)&&ue(J.s)&&ue(J.v)?(fe=Le(J.s),Ae=Le(J.v),ee=E(J.h,fe,Ae),Oe=!0,Pe="hsv"):ue(J.h)&&ue(J.s)&&ue(J.l)&&(fe=Le(J.s),ge=Le(J.l),ee=k(J.h,fe,ge),Oe=!0,Pe="hsl"),J.hasOwnProperty("a")&&(ne=J.a)),ne=V(ne),{ok:Oe,format:J.format||Pe,r:G(255,W(ee.r,0)),g:G(255,W(ee.g,0)),b:G(255,W(ee.b,0)),a:ne}}function A(J,ee,ne){return{r:P(J,255)*255,g:P(ee,255)*255,b:P(ne,255)*255}}function R(J,ee,ne){J=P(J,255),ee=P(ee,255),ne=P(ne,255);var fe=W(J,ee,ne),Ae=G(J,ee,ne),ge,Oe,Pe=(fe+Ae)/2;if(fe==Ae)ge=Oe=0;else{var je=fe-Ae;Oe=Pe>.5?je/(2-fe-Ae):je/(fe+Ae);switch(fe){case J:ge=(ee-ne)/je+(ee<ne?6:0);break;case ee:ge=(ne-J)/je+2;break;case ne:ge=(J-ee)/je+4;break}ge/=6}return{h:ge,s:Oe,l:Pe}}function k(J,ee,ne){var fe,Ae,ge;J=P(J,360),ee=P(ee,100),ne=P(ne,100);function Oe(Ge,He,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?Ge+(He-Ge)*6*Fe:Fe<1/2?He:Fe<2/3?Ge+(He-Ge)*(2/3-Fe)*6:Ge}if(ee===0)fe=Ae=ge=ne;else{var Pe=ne<.5?ne*(1+ee):ne+ee-ne*ee,je=2*ne-Pe;fe=Oe(je,Pe,J+1/3),Ae=Oe(je,Pe,J),ge=Oe(je,Pe,J-1/3)}return{r:fe*255,g:Ae*255,b:ge*255}}function x(J,ee,ne){J=P(J,255),ee=P(ee,255),ne=P(ne,255);var fe=W(J,ee,ne),Ae=G(J,ee,ne),ge,Oe,Pe=fe,je=fe-Ae;if(Oe=fe===0?0:je/fe,fe==Ae)ge=0;else{switch(fe){case J:ge=(ee-ne)/je+(ee<ne?6:0);break;case ee:ge=(ne-J)/je+2;break;case ne:ge=(J-ee)/je+4;break}ge/=6}return{h:ge,s:Oe,v:Pe}}function E(J,ee,ne){J=P(J,360)*6,ee=P(ee,100),ne=P(ne,100);var fe=$.floor(J),Ae=J-fe,ge=ne*(1-ee),Oe=ne*(1-Ae*ee),Pe=ne*(1-(1-Ae)*ee),je=fe%6,Ge=[ne,Oe,ge,ge,Pe,ne][je],He=[Pe,ne,ne,Oe,ge,ge][je],Fe=[ge,ge,Pe,ne,ne,Oe][je];return{r:Ge*255,g:He*255,b:Fe*255}}function h(J,ee,ne,fe){var Ae=[ve(M(J).toString(16)),ve(M(ee).toString(16)),ve(M(ne).toString(16))];return fe&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function o(J,ee,ne,fe,Ae){var ge=[ve(M(J).toString(16)),ve(M(ee).toString(16)),ve(M(ne).toString(16)),ve(ke(fe))];return Ae&&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 u(J,ee,ne,fe){var Ae=[ve(ke(fe)),ve(M(J).toString(16)),ve(M(ee).toString(16)),ve(M(ne).toString(16))];return Ae.join("")}O.equals=function(J,ee){return!J||!ee?!1:O(J).toRgbString()==O(ee).toRgbString()},O.random=function(){return O.fromRatio({r:_(),g:_(),b:_()})};function d(J,ee){ee=ee===0?0:ee||10;var ne=O(J).toHsl();return ne.s-=ee/100,ne.s=I(ne.s),O(ne)}function S(J,ee){ee=ee===0?0:ee||10;var ne=O(J).toHsl();return ne.s+=ee/100,ne.s=I(ne.s),O(ne)}function v(J){return O(J).desaturate(100)}function p(J,ee){ee=ee===0?0:ee||10;var ne=O(J).toHsl();return ne.l+=ee/100,ne.l=I(ne.l),O(ne)}function w(J,ee){ee=ee===0?0:ee||10;var ne=O(J).toRgb();return ne.r=W(0,G(255,ne.r-M(255*-(ee/100)))),ne.g=W(0,G(255,ne.g-M(255*-(ee/100)))),ne.b=W(0,G(255,ne.b-M(255*-(ee/100)))),O(ne)}function b(J,ee){ee=ee===0?0:ee||10;var ne=O(J).toHsl();return ne.l-=ee/100,ne.l=I(ne.l),O(ne)}function s(J,ee){var ne=O(J).toHsl(),fe=(ne.h+ee)%360;return ne.h=fe<0?360+fe:fe,O(ne)}function f(J){var ee=O(J).toHsl();return ee.h=(ee.h+180)%360,O(ee)}function l(J){var ee=O(J).toHsl(),ne=ee.h;return[O(J),O({h:(ne+120)%360,s:ee.s,l:ee.l}),O({h:(ne+240)%360,s:ee.s,l:ee.l})]}function a(J){var ee=O(J).toHsl(),ne=ee.h;return[O(J),O({h:(ne+90)%360,s:ee.s,l:ee.l}),O({h:(ne+180)%360,s:ee.s,l:ee.l}),O({h:(ne+270)%360,s:ee.s,l:ee.l})]}function C(J){var ee=O(J).toHsl(),ne=ee.h;return[O(J),O({h:(ne+72)%360,s:ee.s,l:ee.l}),O({h:(ne+216)%360,s:ee.s,l:ee.l})]}function m(J,ee,ne){ee=ee||6,ne=ne||30;var fe=O(J).toHsl(),Ae=360/ne,ge=[O(J)];for(fe.h=(fe.h-(Ae*ee>>1)+720)%360;--ee;)fe.h=(fe.h+Ae)%360,ge.push(O(fe));return ge}function T(J,ee){ee=ee||6;for(var ne=O(J).toHsv(),fe=ne.h,Ae=ne.s,ge=ne.v,Oe=[],Pe=1/ee;ee--;)Oe.push(O({h:fe,s:Ae,v:ge})),ge=(ge+Pe)%1;return Oe}O.mix=function(J,ee,ne){ne=ne===0?0:ne||50;var fe=O(J).toRgb(),Ae=O(ee).toRgb(),ge=ne/100,Oe={r:(Ae.r-fe.r)*ge+fe.r,g:(Ae.g-fe.g)*ge+fe.g,b:(Ae.b-fe.b)*ge+fe.b,a:(Ae.a-fe.a)*ge+fe.a};return O(Oe)},O.readability=function(J,ee){var ne=O(J),fe=O(ee);return($.max(ne.getLuminance(),fe.getLuminance())+.05)/($.min(ne.getLuminance(),fe.getLuminance())+.05)},O.isReadable=function(J,ee,ne){var fe=O.readability(J,ee),Ae,ge;ge=!1,Ae=se(ne);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":ge=fe>=4.5;break;case"AAlarge":ge=fe>=3;break;case"AAAsmall":ge=fe>=7;break}return ge},O.mostReadable=function(J,ee,ne){var fe=null,Ae=0,ge,Oe,Pe,je;ne=ne||{},Oe=ne.includeFallbackColors,Pe=ne.level,je=ne.size;for(var Ge=0;Ge<ee.length;Ge++)ge=O.readability(J,ee[Ge]),ge>Ae&&(Ae=ge,fe=O(ee[Ge]));return O.isReadable(J,fe,{level:Pe,size:je})||!Oe?fe:(ne.includeFallbackColors=!1,O.mostReadable(J,["#fff","#000"],ne))};var U=O.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=O.hexNames=F(U);function F(J){var ee={};for(var ne in J)J.hasOwnProperty(ne)&&(ee[J[ne]]=ne);return ee}function V(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function P(J,ee){oe(J)&&(J="100%");var ne=pe(J);return J=G(ee,W(0,parseFloat(J))),ne&&(J=parseInt(J*ee,10)/100),$.abs(J-ee)<1e-6?1:J%ee/parseFloat(ee)}function I(J){return G(1,W(0,J))}function X(J){return parseInt(J,16)}function oe(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 Le(J){return J<=1&&(J=J*100+"%"),J}function ke(J){return $.round(parseFloat(J)*255).toString(16)}function he(J){return X(J)/255}var ae=function(){var J="[-\\+]?\\d+%?",ee="[-\\+]?\\d*\\.\\d+%?",ne="(?:"+ee+")|(?:"+J+")",fe="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?",Ae="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?";return{CSS_UNIT:new RegExp(ne),rgb:new RegExp("rgb"+fe),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+fe),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+fe),hsva:new RegExp("hsva"+Ae),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 ue(J){return!!ae.CSS_UNIT.exec(J)}function ie(J){J=J.replace(D,"").replace(Z,"").toLowerCase();var ee=!1;if(U[J])J=U[J],ee=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ne;return(ne=ae.rgb.exec(J))?{r:ne[1],g:ne[2],b:ne[3]}:(ne=ae.rgba.exec(J))?{r:ne[1],g:ne[2],b:ne[3],a:ne[4]}:(ne=ae.hsl.exec(J))?{h:ne[1],s:ne[2],l:ne[3]}:(ne=ae.hsla.exec(J))?{h:ne[1],s:ne[2],l:ne[3],a:ne[4]}:(ne=ae.hsv.exec(J))?{h:ne[1],s:ne[2],v:ne[3]}:(ne=ae.hsva.exec(J))?{h:ne[1],s:ne[2],v:ne[3],a:ne[4]}:(ne=ae.hex8.exec(J))?{r:X(ne[1]),g:X(ne[2]),b:X(ne[3]),a:he(ne[4]),format:ee?"name":"hex8"}:(ne=ae.hex6.exec(J))?{r:X(ne[1]),g:X(ne[2]),b:X(ne[3]),format:ee?"name":"hex"}:(ne=ae.hex4.exec(J))?{r:X(ne[1]+""+ne[1]),g:X(ne[2]+""+ne[2]),b:X(ne[3]+""+ne[3]),a:he(ne[4]+""+ne[4]),format:ee?"name":"hex8"}:(ne=ae.hex3.exec(J))?{r:X(ne[1]+""+ne[1]),g:X(ne[2]+""+ne[2]),b:X(ne[3]+""+ne[3]),format:ee?"name":"hex"}:!1}function se(J){var ee,ne;return J=J||{level:"AA",size:"small"},ee=(J.level||"AA").toUpperCase(),ne=(J.size||"small").toLowerCase(),ee!=="AA"&&ee!=="AAA"&&(ee="AA"),ne!=="small"&&ne!=="large"&&(ne="small"),{level:ee,size:ne}}wt.exports?wt.exports=O:!(ce=function(){return O}.call(nt,re,nt,wt),ce!==void 0&&(wt.exports=ce))})(Math)},bT9E:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return $});var ce=re("VTBJ");function $(D,Z){var B=Object(ce.a)({},D);return Array.isArray(Z)&&Z.forEach(function(M){delete B[M]}),B}},c5Ni:function(wt,nt,re){},dejd:function(wt,nt,re){},dmUQ:function(wt,nt,re){"use strict";var ce=re("Ff2n"),$=re("rePB"),D=re("1OyB"),Z=re("vuIU"),B=re("Ji7U"),M=re("md7G"),G=re("foSv"),W=re("q1tI"),_=re.n(W),O=re("TSYQ"),y=re.n(O),A=re("4IlW");function R(l,a){var C=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(T){return Object.getOwnPropertyDescriptor(l,T).enumerable})),C.push.apply(C,m)}return C}function k(l){for(var a=1;a<arguments.length;a++){var C=arguments[a]!=null?arguments[a]:{};a%2?R(Object(C),!0).forEach(function(m){Object($.a)(l,m,C[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(C)):R(Object(C)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(C,m))})}return l}function x(l){var a=E();return function(){var m=Object(G.a)(l),T;if(a){var U=Object(G.a)(this).constructor;T=Reflect.construct(m,arguments,U)}else T=m.apply(this,arguments);return Object(M.a)(this,T)}}function E(){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(l){return!1}}function h(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,S=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},w=function(a,C){return C===a||typeof C=="number"&&typeof a=="number"&&isNaN(C)&&isNaN(a)},b=function(l){Object(B.a)(C,l);var a=x(C);function C(m){var T;Object(D.a)(this,C),T=a.call(this,m),T.onKeyDown=function(F){var V=T.props,P=V.onKeyDown,I=V.onPressEnter;if(F.keyCode===A.a.UP){var X=T.getRatio(F);T.up(F,X,null),T.stop()}else if(F.keyCode===A.a.DOWN){var oe=T.getRatio(F);T.down(F,oe,null),T.stop()}else F.keyCode===A.a.ENTER&&I&&I(F);if(T.recordCursorPosition(),T.lastKeyCode=F.keyCode,P){for(var pe=arguments.length,ve=new Array(pe>1?pe-1:0),Le=1;Le<pe;Le++)ve[Le-1]=arguments[Le];P.apply(void 0,[F].concat(ve))}},T.onKeyUp=function(F){var V=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),V){for(var P=arguments.length,I=new Array(P>1?P-1:0),X=1;X<P;X++)I[X-1]=arguments[X];V.apply(void 0,[F].concat(I))}},T.onChange=function(F){var V=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(F)),T.setState({inputValue:T.rawInput}),V(T.toNumber(T.rawInput))},T.onMouseUp=function(){var F=T.props.onMouseUp;T.recordCursorPosition(),F&&F.apply(void 0,arguments)},T.onFocus=function(){var F;T.setState({focused:!0}),(F=T.props).onFocus.apply(F,arguments)},T.onBlur=function(){var F=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var V=T.getCurrentValidValue(T.state.inputValue),P=T.setValue(V,h);if(F){var I=T.input.value,X=T.getInputDisplayValue({focus:!1,value:P});T.input.value=X&&Number(X),F.apply(void 0,arguments),T.input.value=I}},T.getRatio=function(F){var V=1;return F.metaKey||F.ctrlKey?V=.1:F.shiftKey&&(V=10),V},T.getFullNum=function(F){return isNaN(F)?F:/e/i.test(String(F))?Number(F).toFixed(18).replace(/\.?0+$/,""):F},T.getPrecision=function(F){if(p(T.props.precision))return T.props.precision;var V=String(F);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},T.getInputDisplayValue=function(F){var V=F||T.state,P=V.focused,I=V.inputValue,X=V.value,oe;P?oe=I:oe=T.toPrecisionAsStep(X),oe==null&&(oe="");var pe=T.formatWrapper(oe);return p(T.props.decimalSeparator)&&(pe=pe.toString().replace(".",T.props.decimalSeparator)),pe},T.recordCursorPosition=function(){try{T.cursorStart=T.input.selectionStart,T.cursorEnd=T.input.selectionEnd,T.currentValue=T.input.value,T.cursorBefore=T.input.value.substring(0,T.cursorStart),T.cursorAfter=T.input.value.substring(T.cursorEnd)}catch(F){}},T.restoreByAfter=function(F){if(F===void 0)return!1;var V=T.input.value,P=V.lastIndexOf(F);if(P===-1)return!1;var I=T.cursorBefore.length;return T.lastKeyCode===A.a.DELETE&&T.cursorBefore.charAt(I-1)===F[0]?(T.fixCaret(I,I),!0):P+F.length===V.length?(T.fixCaret(P,P),!0):!1},T.partRestoreByAfter=function(F){return F===void 0?!1:Array.prototype.some.call(F,function(V,P){var I=F.substring(P);return T.restoreByAfter(I)})},T.isNotCompleteNumber=function(F){return isNaN(F)||F===""||F===null||F&&F.toString().indexOf(".")===F.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(F,V,P){T.pressingUpOrDown=!0,T.step("down",F,V,P)},T.up=function(F,V,P){T.pressingUpOrDown=!0,T.step("up",F,V,P)},T.saveInput=function(F){T.input=F};var U=m.value;U===void 0&&(U=m.defaultValue),T.state={focused:m.autoFocus};var j=T.getValidValue(T.toNumber(U));return T.state=k(k({},T.state),{},{inputValue:T.toPrecisionAsStep(j),value:j}),T}return Object(Z.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var U=this.props,j=U.value,F=U.onChange,V=U.max,P=U.min,I=this.state.focused;if(T){if(!w(T.value,j)||!w(T.max,V)||!w(T.min,P)){var X=I?j:this.getValidValue(j),oe;this.pressingUpOrDown?oe=X:this.inputting?oe=this.rawInput:oe=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:oe})}var pe="value"in this.props?j:this.state.value;"max"in this.props&&T.max!==V&&typeof pe=="number"&&pe>V&&F&&F(V),"min"in this.props&&T.min!==P&&typeof pe=="number"&&pe<P&&F&&F(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===A.a.BACKSPACE?ve=this.cursorStart-1:this.lastKeyCode===A.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 A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Le){}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(T){var U=T;return U===""?U="":this.isNotCompleteNumber(parseFloat(U))?U=this.state.value:U=this.getValidValue(U),this.toNumber(U)}},{key:"getValueFromEvent",value:function(T){var U=T.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(U=U.replace(this.props.decimalSeparator,".")),U}},{key:"getValidValue",value:function(T){var U=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,F=parseFloat(T);return isNaN(F)?T:(F<U&&(F=U),F>j&&(F=j),F)}},{key:"setValue",value:function(T,U){var j=this.props.precision,F=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),V=this.state.value,P=V===void 0?null:V,I=this.state.inputValue,X=I===void 0?null:I,oe=typeof F=="number"?F.toFixed(j):"".concat(F),pe=F!==P||oe!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},U)):this.setState({value:F,inputValue:this.toPrecisionAsStep(T)},U),pe&&this.props.onChange(F),F}},{key:"getMaxPrecision",value:function(T){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,F=j.precision,V=j.step;if(p(F))return F;var P=this.getPrecision(U),I=this.getPrecision(V),X=this.getPrecision(T);return T?Math.max(X,P+I):P+I}},{key:"getPrecisionFactor",value:function(T){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(T,U);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(T){return this.props.formatter?this.props.formatter(T):T}},{key:"toPrecisionAsStep",value:function(T){if(this.isNotCompleteNumber(T)||T==="")return T;var U=Math.abs(this.getMaxPrecision(T));return isNaN(U)?T.toString():Number(T).toFixed(U)}},{key:"toNumber",value:function(T){var U=this.props.precision,j=this.state.focused,F=T&&T.length>16&&j;return this.isNotCompleteNumber(T)||F?T:p(U)?Math.round(T*Math.pow(10,U))/Math.pow(10,U):Number(T)}},{key:"upStep",value:function(T,U){var j=this.props.step,F=this.getPrecisionFactor(T,U),V=Math.abs(this.getMaxPrecision(T,U)),P=((F*T+F*j*U)/F).toFixed(V);return this.toNumber(P)}},{key:"downStep",value:function(T,U){var j=this.props.step,F=this.getPrecisionFactor(T,U),V=Math.abs(this.getMaxPrecision(T,U)),P=((F*T-F*j*U)/F).toFixed(V);return this.toNumber(P)}},{key:"step",value:function(T,U){var j=this,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),U&&(U.persist(),U.preventDefault());var P=this.props;if(P.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var X=this["".concat(T,"Step")](I,F),oe=X>P.max||X<P.min;if(X>P.max?X=P.max:X<P.min&&(X=P.min),this.setValue(X,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),oe)return;this.autoStepTimer=setTimeout(function(){j[T](U,F,!0)},V?d:S)}},{key:"fixCaret",value:function(T,U){if(T===void 0||U===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,F=this.input.selectionEnd;(T!==j||U!==F)&&this.input.setSelectionRange(T,U)}catch(V){}}},{key:"render",value:function(){var T,U=this.props,j=U.prefixCls,F=U.disabled,V=U.readOnly,P=U.useTouch,I=U.autoComplete,X=U.upHandler,oe=U.downHandler,pe=U.className,ve=U.max,Le=U.min,ke=U.style,he=U.title,ae=U.onMouseEnter,ue=U.onMouseLeave,ie=U.onMouseOver,se=U.onMouseOut,J=U.required,ee=U.onClick,ne=U.tabIndex,fe=U.type,Ae=U.placeholder,ge=U.id,Oe=U.inputMode,Pe=U.pattern,je=U.step,Ge=U.maxLength,He=U.autoFocus,Fe=U.name,qe=U.onPaste,De=U.onInput,Ie=Object(ce.a)(U,["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"]),Be=this.state,ze=Be.value,Ke=Be.focused,Ve=y()(j,(T={},Object($.a)(T,pe,!!pe),Object($.a)(T,"".concat(j,"-disabled"),F),Object($.a)(T,"".concat(j,"-focused"),Ke),T)),Re={};Object.keys(Ie).forEach(function(Ee){(Ee.substr(0,5)==="data-"||Ee.substr(0,5)==="aria-"||Ee==="role")&&(Re[Ee]=Ie[Ee])});var tt=!V&&!F,it=this.getInputDisplayValue(null),Me=(ze||ze===0)&&(isNaN(ze)||Number(ze)>=ve),We=(ze||ze===0)&&(isNaN(ze)||Number(ze)<=Le),xe=Me||F||V,ye=We||F||V,Ce=y()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object($.a)({},"".concat(j,"-handler-up-disabled"),xe)),le=y()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object($.a)({},"".concat(j,"-handler-down-disabled"),ye)),de=P?{onTouchStart:xe?h:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?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 _.a.createElement("div",{className:Ve,style:ke,title:he,onMouseEnter:ae,onMouseLeave:ue,onMouseOver:ie,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(j,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:Ce}),X||_.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),_.a.createElement("span",Object.assign({unselectable:"on"},me,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:le}),oe||_.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),_.a.createElement("div",{className:"".concat(j,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Le,"aria-valuemax":ve,"aria-valuenow":ze,required:J,type:fe,placeholder:Ae,onPaste:qe,onClick:ee,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:ne,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:tt?this.onKeyDown:h,onKeyUp:tt?this.onKeyUp:h,autoFocus:He,maxLength:Ge,readOnly:V,disabled:F,max:ve,min:Le,step:je,name:Fe,title:he,id:ge,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(it),pattern:Pe,inputMode:Oe,onInput:De},Re))))}}]),C}(_.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:u,required:!1,autoComplete:"off"};var s=b,f=nt.a=s},fAei:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return d.a});var ce=re("rePB"),$=re("VTBJ"),D=re("KQm4"),Z=re("1OyB"),B=re("vuIU"),M=re("Ji7U"),G=re("LK+K"),W=re("q1tI"),_=re("4IlW"),O=re("Kwbf"),y=re("TSYQ"),A=re.n(y),R=re("sboe"),k=re("OZM5"),x=re("815F"),E=re("ODXe"),h=re("Ff2n"),o=re("+nKL"),u=re("8XRh"),d=re("WaYH"),S=function(Le,ke){var he=Le.className,ae=Le.style,ue=Le.motion,ie=Le.motionNodes,se=Le.motionType,J=Le.onMotionStart,ee=Le.onMotionEnd,ne=Le.active,fe=Le.treeNodeRequiredProps,Ae=Object(h.a)(Le,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),ge=W.useState(!0),Oe=Object(E.a)(ge,2),Pe=Oe[0],je=Oe[1],Ge=W.useContext(R.a),He=Ge.prefixCls,Fe=W.useRef(!1),qe=function(){Fe.current||ee(),Fe.current=!0};return Object(W.useEffect)(function(){ie&&se==="hide"&&Pe&&je(!1)},[ie]),Object(W.useEffect)(function(){return ie&&J(),function(){ie&&qe()}},[]),ie?W.createElement(u.default,Object.assign({ref:ke,visible:Pe},ue,{motionAppear:se==="show",onAppearEnd:qe,onLeaveEnd:qe}),function(De,Ie){var Be=De.className,ze=De.style;return W.createElement("div",{ref:Ie,className:A()("".concat(He,"-treenode-motion"),Be),style:ze},ie.map(function(Ke){var Ve=Ke.data,Re=Ve.key,tt=Object(h.a)(Ve,["key"]),it=Ke.isStart,Me=Ke.isEnd;delete tt.children;var We=Object(x.f)(Re,fe);return W.createElement(d.a,Object.assign({},tt,We,{active:ne,data:Ke.data,key:Re,isStart:it,isEnd:Me}))}))}):W.createElement(d.a,Object.assign({domRef:ke,className:he,style:ae},Ae,{active:ne}))};S.displayName="MotionTreeNode";var v=W.forwardRef(S),p=v;function w(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ke=ve.length,he=Le.length;if(Math.abs(ke-he)!==1)return{add:!1,key:null};function ae(ue,ie){var se=new Map;ue.forEach(function(ee){se.set(ee,!0)});var J=ie.filter(function(ee){return!se.has(ee)});return J.length===1?J[0]:null}return ke<he?{add:!0,key:ae(ve,Le)}:{add:!1,key:ae(Le,ve)}}function b(ve,Le,ke){var he=ve.findIndex(function(se){var J=se.data;return J.key===ke}),ae=ve[he+1],ue=Le.findIndex(function(se){var J=se.data;return J.key===ke});if(ae){var ie=Le.findIndex(function(se){var J=se.data;return J.key===ae.data.key});return Le.slice(ue+1,ie)}return Le.slice(ue+1)}var s={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},f=function(){},l="RC_TREE_MOTION_".concat(Math.random()),a={key:l},C={key:l,level:0,index:0,pos:"0",node:a},m={parent:null,children:[],pos:C.pos,data:a,isStart:[],isEnd:[]};function T(ve,Le,ke,he){return Le===!1||!ke?ve:ve.slice(0,Math.ceil(ke/he)+1)}function U(ve){var Le=ve.data.key,ke=ve.pos;return Object(x.e)(Le,ke)}function j(ve){for(var Le=String(ve.data.key),ke=ve;ke.parent;)ke=ke.parent,Le="".concat(ke.data.key," > ").concat(Le);return Le}var F=function(Le,ke){var he=Le.prefixCls,ae=Le.data,ue=Le.selectable,ie=Le.checkable,se=Le.expandedKeys,J=Le.selectedKeys,ee=Le.checkedKeys,ne=Le.loadedKeys,fe=Le.loadingKeys,Ae=Le.halfCheckedKeys,ge=Le.keyEntities,Oe=Le.disabled,Pe=Le.dragging,je=Le.dragOverNodeKey,Ge=Le.dropPosition,He=Le.motion,Fe=Le.height,qe=Le.itemHeight,De=Le.virtual,Ie=Le.focusable,Be=Le.activeItem,ze=Le.focused,Ke=Le.tabIndex,Ve=Le.onKeyDown,Re=Le.onFocus,tt=Le.onBlur,it=Le.onActiveChange,Me=Le.onListChangeStart,We=Le.onListChangeEnd,xe=Object(h.a)(Le,["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=W.useRef(null);W.useImperativeHandle(ke,function(){return{scrollTo:function(Jt){ye.current.scrollTo(Jt)}}});var Ce=W.useState(se),le=Object(E.a)(Ce,2),de=le[0],me=le[1],Ee=W.useState(ae),we=Object(E.a)(Ee,2),Ue=we[0],Ze=we[1],at=W.useState(ae),vt=Object(E.a)(at,2),mt=vt[0],Ct=vt[1],Tt=W.useState([]),ut=Object(E.a)(Tt,2),Rt=ut[0],kt=ut[1],zt=W.useState(null),Nt=Object(E.a)(zt,2),Et=Nt[0],_t=Nt[1];function Kt(){Ze(ae),Ct(ae),kt([]),_t(null),We()}W.useEffect(function(){me(se);var jt=w(de,se);if(jt.key!==null)if(jt.add){var Jt=Ue.findIndex(function(or){var xr=or.data.key;return xr===jt.key}),ar=T(b(Ue,ae,jt.key),De,Fe,qe),cr=Ue.slice();cr.splice(Jt+1,0,m),Ct(cr),kt(ar),_t("show")}else{var Er=ae.findIndex(function(or){var xr=or.data.key;return xr===jt.key}),Ot=T(b(ae,Ue,jt.key),De,Fe,qe),ft=ae.slice();ft.splice(Er+1,0,m),Ct(ft),kt(Ot),_t("hide")}else Ue!==ae&&(Ze(ae),Ct(ae))},[se,ae]),W.useEffect(function(){Pe||Kt()},[Pe]);var dt=He?mt:ae,Zt={expandedKeys:se,selectedKeys:J,loadedKeys:ne,loadingKeys:fe,checkedKeys:ee,halfCheckedKeys:Ae,dragOverNodeKey:je,dropPosition:Ge,keyEntities:ge};return W.createElement(W.Fragment,null,ze&&Be&&W.createElement("span",{style:s,"aria-live":"assertive"},j(Be)),W.createElement("div",{role:"tree"},W.createElement("input",{style:s,disabled:Ie===!1||Oe,tabIndex:Ie!==!1?Ke:null,onKeyDown:Ve,onFocus:Re,onBlur:tt,value:"",onChange:f})),W.createElement(o.a,Object.assign({},xe,{data:dt,itemKey:U,height:Fe,fullHeight:!1,virtual:De,itemHeight:qe,prefixCls:"".concat(he,"-list"),ref:ye}),function(jt){var Jt=jt.pos,ar=jt.data,cr=ar.key,Er=Object(h.a)(ar,["key"]),Ot=jt.isStart,ft=jt.isEnd,or=Object(x.e)(cr,Jt);delete Er.children;var xr=Object(x.f)(or,Zt);return W.createElement(p,Object.assign({},Er,xr,{active:Be&&cr===Be.data.key,pos:Jt,data:jt.data,isStart:Ot,isEnd:ft,motion:He,motionNodes:cr===l?Rt:null,motionType:Et,onMotionStart:Me,onMotionEnd:Kt,treeNodeRequiredProps:Zt,onMouseMove:function(){it(null)}}))}))},V=W.forwardRef(F);V.displayName="NodeList";var P=V,I=re("NvD2"),X=function(ve){Object(M.a)(ke,ve);var Le=Object(G.a)(ke);function ke(){var he;return Object(Z.a)(this,ke),he=Le.apply(this,arguments),he.destroyed=!1,he.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},he.listRef=W.createRef(),he.onNodeDragStart=function(ae,ue){var ie=he.state,se=ie.expandedKeys,J=ie.keyEntities,ee=he.props.onDragStart,ne=ue.props.eventKey;he.dragNode=ue;var fe=Object(k.b)(se,ne);he.setState({dragging:!0,dragNodesKeys:Object(k.g)(ne,J)}),he.setExpandedKeys(fe),ee&&ee({event:ae,node:Object(x.b)(ue.props)})},he.onNodeDragEnter=function(ae,ue){var ie=he.state,se=ie.expandedKeys,J=ie.keyEntities,ee=ie.dragNodesKeys,ne=he.props.onDragEnter,fe=ue.props,Ae=fe.pos,ge=fe.eventKey;if(!he.dragNode||ee.indexOf(ge)!==-1)return;var Oe=Object(k.c)(ae,ue);if(he.dragNode.props.eventKey===ge&&Oe===0){he.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){he.setState({dragOverNodeKey:ge,dropPosition:Oe}),he.delayedDragEnterLogic||(he.delayedDragEnterLogic={}),Object.keys(he.delayedDragEnterLogic).forEach(function(Pe){clearTimeout(he.delayedDragEnterLogic[Pe])}),he.delayedDragEnterLogic[Ae]=window.setTimeout(function(){if(!he.state.dragging)return;var Pe=Object(D.a)(se),je=J[ge];je&&(je.children||[]).length&&(Pe=Object(k.a)(se,ge)),"expandedKeys"in he.props||he.setExpandedKeys(Pe),ne&&ne({event:ae,node:Object(x.b)(ue.props),expandedKeys:Pe})},400)},0)},he.onNodeDragOver=function(ae,ue){var ie=he.state.dragNodesKeys,se=he.props.onDragOver,J=ue.props.eventKey;if(ie.indexOf(J)!==-1)return;if(he.dragNode&&J===he.state.dragOverNodeKey){var ee=Object(k.c)(ae,ue);if(ee===he.state.dropPosition)return;he.setState({dropPosition:ee})}se&&se({event:ae,node:Object(x.b)(ue.props)})},he.onNodeDragLeave=function(ae,ue){var ie=he.props.onDragLeave;he.setState({dragOverNodeKey:""}),ie&&ie({event:ae,node:Object(x.b)(ue.props)})},he.onNodeDragEnd=function(ae,ue){var ie=he.props.onDragEnd;he.setState({dragOverNodeKey:""}),he.cleanDragState(),ie&&ie({event:ae,node:Object(x.b)(ue.props)}),he.dragNode=null},he.onNodeDrop=function(ae,ue){var ie=he.state,se=ie.dragNodesKeys,J=se===void 0?[]:se,ee=ie.dropPosition,ne=he.props.onDrop,fe=ue.props,Ae=fe.eventKey,ge=fe.pos;if(he.setState({dragOverNodeKey:""}),he.cleanDragState(),J.indexOf(Ae)!==-1){Object(O.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Oe=Object(k.k)(ge),Pe={event:ae,node:Object(x.b)(ue.props),dragNode:he.dragNode?Object(x.b)(he.dragNode.props):null,dragNodesKeys:J.slice(),dropPosition:ee+Number(Oe[Oe.length-1]),dropToGap:!1};ee!==0&&(Pe.dropToGap=!0),ne&&ne(Pe),he.dragNode=null},he.cleanDragState=function(){var ae=he.state.dragging;ae&&he.setState({dragging:!1})},he.onNodeClick=function(ae,ue){var ie=he.props.onClick;ie&&ie(ae,ue)},he.onNodeDoubleClick=function(ae,ue){var ie=he.props.onDoubleClick;ie&&ie(ae,ue)},he.onNodeSelect=function(ae,ue){var ie=he.state.selectedKeys,se=he.state.keyEntities,J=he.props,ee=J.onSelect,ne=J.multiple,fe=ue.selected,Ae=ue.key,ge=!fe;ge?ne?ie=Object(k.a)(ie,Ae):ie=[Ae]:ie=Object(k.b)(ie,Ae);var Oe=ie.map(function(Pe){var je=se[Pe];return je?je.node:null}).filter(function(Pe){return Pe});he.setUncontrolledState({selectedKeys:ie}),ee&&ee(ie,{event:"select",selected:ge,node:ue,selectedNodes:Oe,nativeEvent:ae.nativeEvent})},he.onNodeCheck=function(ae,ue,ie){var se=he.state,J=se.keyEntities,ee=se.checkedKeys,ne=se.halfCheckedKeys,fe=he.props,Ae=fe.checkStrictly,ge=fe.onCheck,Oe=ue.key,Pe,je={event:"check",node:ue,checked:ie,nativeEvent:ae.nativeEvent};if(Ae){var Ge=ie?Object(k.a)(ee,Oe):Object(k.b)(ee,Oe),He=Object(k.b)(ne,Oe);Pe={checked:Ge,halfChecked:He},je.checkedNodes=Ge.map(function(ze){return J[ze]}).filter(function(ze){return ze}).map(function(ze){return ze.node}),he.setUncontrolledState({checkedKeys:Ge})}else{var Fe=Object(I.a)([].concat(Object(D.a)(ee),[Oe]),!0,J),qe=Fe.checkedKeys,De=Fe.halfCheckedKeys;if(!ie){var Ie=new Set(qe);Ie.delete(Oe);var Be=Object(I.a)(Array.from(Ie),{checked:!1,halfCheckedKeys:De},J);qe=Be.checkedKeys,De=Be.halfCheckedKeys}Pe=qe,je.checkedNodes=[],je.checkedNodesPositions=[],je.halfCheckedKeys=De,qe.forEach(function(ze){var Ke=J[ze];if(!Ke)return;var Ve=Ke.node,Re=Ke.pos;je.checkedNodes.push(Ve),je.checkedNodesPositions.push({node:Ve,pos:Re})}),he.setUncontrolledState({checkedKeys:qe},!1,{halfCheckedKeys:De})}ge&&ge(Pe,je)},he.onNodeLoad=function(ae){return new Promise(function(ue){he.setState(function(ie){var se=ie.loadedKeys,J=se===void 0?[]:se,ee=ie.loadingKeys,ne=ee===void 0?[]:ee,fe=he.props,Ae=fe.loadData,ge=fe.onLoad,Oe=ae.key;if(!Ae||J.indexOf(Oe)!==-1||ne.indexOf(Oe)!==-1)return{};var Pe=Ae(ae);return Pe.then(function(){var je=he.state,Ge=je.loadedKeys,He=je.loadingKeys,Fe=Object(k.a)(Ge,Oe),qe=Object(k.b)(He,Oe);ge&&ge(Fe,{event:"load",node:ae}),he.setUncontrolledState({loadedKeys:Fe}),he.setState({loadingKeys:qe}),ue()}),{loadingKeys:Object(k.a)(ne,Oe)}})})},he.onNodeMouseEnter=function(ae,ue){var ie=he.props.onMouseEnter;ie&&ie({event:ae,node:ue})},he.onNodeMouseLeave=function(ae,ue){var ie=he.props.onMouseLeave;ie&&ie({event:ae,node:ue})},he.onNodeContextMenu=function(ae,ue){var ie=he.props.onRightClick;ie&&(ae.preventDefault(),ie({event:ae,node:ue}))},he.onFocus=function(){var ae=he.props.onFocus;he.setState({focused:!0}),ae&&ae.apply(void 0,arguments)},he.onBlur=function(){var ae=he.props.onBlur;he.setState({focused:!1}),he.onActiveChange(null),ae&&ae.apply(void 0,arguments)},he.getTreeNodeRequiredProps=function(){var ae=he.state,ue=ae.expandedKeys,ie=ae.selectedKeys,se=ae.loadedKeys,J=ae.loadingKeys,ee=ae.checkedKeys,ne=ae.halfCheckedKeys,fe=ae.dragOverNodeKey,Ae=ae.dropPosition,ge=ae.keyEntities;return{expandedKeys:ue||[],selectedKeys:ie||[],loadedKeys:se||[],loadingKeys:J||[],checkedKeys:ee||[],halfCheckedKeys:ne||[],dragOverNodeKey:fe,dropPosition:Ae,keyEntities:ge}},he.setExpandedKeys=function(ae){var ue=he.state.treeData,ie=Object(x.d)(ue,ae);he.setUncontrolledState({expandedKeys:ae,flattenNodes:ie},!0)},he.onNodeExpand=function(ae,ue){var ie=he.state.expandedKeys,se=he.state.listChanging,J=he.props,ee=J.onExpand,ne=J.loadData,fe=ue.key,Ae=ue.expanded;if(se)return;var ge=ie.indexOf(fe),Oe=!Ae;if(Object(O.a)(Ae&&ge!==-1||!Ae&&ge===-1,"Expand state not sync with index check"),Oe?ie=Object(k.a)(ie,fe):ie=Object(k.b)(ie,fe),he.setExpandedKeys(ie),ee&&ee(ie,{node:ue,expanded:Oe,nativeEvent:ae.nativeEvent}),Oe&&ne){var Pe=he.onNodeLoad(ue);Pe&&Pe.then(function(){var je=Object(x.d)(he.state.treeData,ie);he.setUncontrolledState({flattenNodes:je})})}},he.onListChangeStart=function(){he.setUncontrolledState({listChanging:!0})},he.onListChangeEnd=function(){setTimeout(function(){he.setUncontrolledState({listChanging:!1})})},he.onActiveChange=function(ae){var ue=he.state.activeKey,ie=he.props.onActiveChange;if(ue===ae)return;he.setState({activeKey:ae}),ae!==null&&he.scrollTo({key:ae}),ie&&ie(ae)},he.getActiveItem=function(){var ae=he.state,ue=ae.activeKey,ie=ae.flattenNodes;return ue===null?null:ie.find(function(se){var J=se.data.key;return J===ue})||null},he.offsetActiveKey=function(ae){var ue=he.state,ie=ue.flattenNodes,se=ue.activeKey,J=ie.findIndex(function(fe){var Ae=fe.data.key;return Ae===se});J===-1&&ae<0&&(J=ie.length),J=(J+ae+ie.length)%ie.length;var ee=ie[J];if(ee){var ne=ee.data.key;he.onActiveChange(ne)}else he.onActiveChange(null)},he.onKeyDown=function(ae){var ue=he.state,ie=ue.activeKey,se=ue.expandedKeys,J=ue.checkedKeys,ee=he.props,ne=ee.onKeyDown,fe=ee.checkable,Ae=ee.selectable;switch(ae.which){case _.a.UP:{he.offsetActiveKey(-1),ae.preventDefault();break}case _.a.DOWN:{he.offsetActiveKey(1),ae.preventDefault();break}}var ge=he.getActiveItem();if(ge&&ge.data){var Oe=he.getTreeNodeRequiredProps(),Pe=ge.data.isLeaf===!1||!!(ge.data.children||[]).length,je=Object(x.b)(Object($.a)(Object($.a)({},Object(x.f)(ie,Oe)),{},{data:ge.data,active:!0}));switch(ae.which){case _.a.LEFT:{Pe&&se.includes(ie)?he.onNodeExpand({},je):ge.parent&&he.onActiveChange(ge.parent.data.key),ae.preventDefault();break}case _.a.RIGHT:{Pe&&!se.includes(ie)?he.onNodeExpand({},je):ge.children&&ge.children.length&&he.onActiveChange(ge.children[0].data.key),ae.preventDefault();break}case _.a.ENTER:case _.a.SPACE:{fe&&!je.disabled&&je.checkable!==!1&&!je.disableCheckbox?he.onNodeCheck({},je,!J.includes(ie)):!fe&&Ae&&!je.disabled&&je.selectable!==!1&&he.onNodeSelect({},je);break}}}ne&&ne(ae)},he.setUncontrolledState=function(ae){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(he.destroyed)return;var se=!1,J=!0,ee={};Object.keys(ae).forEach(function(ne){if(ne in he.props){J=!1;return}se=!0,ee[ne]=ae[ne]}),se&&(!ue||J)&&he.setState(Object($.a)(Object($.a)({},ee),ie))},he.scrollTo=function(ae){he.listRef.current.scrollTo(ae)},he}return Object(B.a)(ke,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ae,ue=this.state,ie=ue.focused,se=ue.flattenNodes,J=ue.keyEntities,ee=ue.dragging,ne=ue.activeKey,fe=this.props,Ae=fe.prefixCls,ge=fe.className,Oe=fe.style,Pe=fe.showLine,je=fe.focusable,Ge=fe.tabIndex,He=Ge===void 0?0:Ge,Fe=fe.selectable,qe=fe.showIcon,De=fe.icon,Ie=fe.switcherIcon,Be=fe.draggable,ze=fe.checkable,Ke=fe.checkStrictly,Ve=fe.disabled,Re=fe.motion,tt=fe.loadData,it=fe.filterTreeNode,Me=fe.height,We=fe.itemHeight,xe=fe.virtual,ye=fe.titleRender,Ce=fe.onContextMenu,le=Object(k.f)(this.props);return W.createElement(R.a.Provider,{value:{prefixCls:Ae,selectable:Fe,showIcon:qe,icon:De,switcherIcon:Ie,draggable:Be,checkable:ze,checkStrictly:Ke,disabled:Ve,keyEntities:J,loadData:tt,filterTreeNode:it,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}},W.createElement("div",{className:A()(Ae,ge,(ae={},Object(ce.a)(ae,"".concat(Ae,"-show-line"),Pe),Object(ce.a)(ae,"".concat(Ae,"-focused"),ie),Object(ce.a)(ae,"".concat(Ae,"-active-focused"),ne!==null),ae))},W.createElement(P,Object.assign({ref:this.listRef,prefixCls:Ae,style:Oe,data:se,disabled:Ve,selectable:Fe,checkable:!!ze,motion:Re,dragging:ee,height:Me,itemHeight:We,virtual:xe,focusable:je,focused:ie,tabIndex:He,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:Ce},this.getTreeNodeRequiredProps(),le))))}}],[{key:"getDerivedStateFromProps",value:function(ae,ue){var ie=ue.prevProps,se={prevProps:ae};function J(De){return!ie&&De in ae||ie&&ie[De]!==ae[De]}var ee;if(J("treeData")?ee=ae.treeData:J("children")&&(Object(O.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),ee=Object(x.c)(ae.children)),ee){se.treeData=ee;var ne=Object(x.a)(ee);se.keyEntities=Object($.a)(Object(ce.a)({},l,C),ne.keyEntities)}var fe=se.keyEntities||ue.keyEntities;if(J("expandedKeys")||ie&&J("autoExpandParent"))se.expandedKeys=ae.autoExpandParent||!ie&&ae.defaultExpandParent?Object(k.e)(ae.expandedKeys,fe):ae.expandedKeys;else if(!ie&&ae.defaultExpandAll){var Ae=Object($.a)({},fe);delete Ae[l],se.expandedKeys=Object.keys(Ae).map(function(De){return Ae[De].key})}else!ie&&ae.defaultExpandedKeys&&(se.expandedKeys=ae.autoExpandParent||ae.defaultExpandParent?Object(k.e)(ae.defaultExpandedKeys,fe):ae.defaultExpandedKeys);if(se.expandedKeys||delete se.expandedKeys,ee||se.expandedKeys){var ge=Object(x.d)(ee||ue.treeData,se.expandedKeys||ue.expandedKeys);se.flattenNodes=ge}if(ae.selectable&&(J("selectedKeys")?se.selectedKeys=Object(k.d)(ae.selectedKeys,ae):!ie&&ae.defaultSelectedKeys&&(se.selectedKeys=Object(k.d)(ae.defaultSelectedKeys,ae))),ae.checkable){var Oe;if(J("checkedKeys")?Oe=Object(k.j)(ae.checkedKeys)||{}:!ie&&ae.defaultCheckedKeys?Oe=Object(k.j)(ae.defaultCheckedKeys)||{}:ee&&(Oe=Object(k.j)(ae.checkedKeys)||{checkedKeys:ue.checkedKeys,halfCheckedKeys:ue.halfCheckedKeys}),Oe){var Pe=Oe,je=Pe.checkedKeys,Ge=je===void 0?[]:je,He=Pe.halfCheckedKeys,Fe=He===void 0?[]:He;if(!ae.checkStrictly){var qe=Object(I.a)(Ge,!0,fe);Ge=qe.checkedKeys,Fe=qe.halfCheckedKeys}se.checkedKeys=Ge,se.halfCheckedKeys=Fe}}return J("loadedKeys")&&(se.loadedKeys=ae.loadedKeys),se}}]),ke}(W.Component);X.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:[]},X.TreeNode=d.a;var oe=X,pe=nt.b=oe},gJ3r:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return ce});var ce=[{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(wt,nt,re){"use strict";re.d(nt,"a",function(){return T});var ce=re("q1tI"),$=re.n(ce),D=re("TSYQ"),Z=re.n(D),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(F){var V=F.map(function(){return Object(ce.useRef)()}),P=Object(ce.useRef)();return Object(ce.useEffect)(function(){var I=Date.now(),X=!1;Object.keys(V).forEach(function(oe){var pe=V[oe].current;if(!pe)return;X=!0;var ve=pe.style;ve.transitionDuration=".3s, .3s, .3s, .06s",P.current&&I-P.current<100&&(ve.transitionDuration="0s, 0s")}),X&&(P.current=Date.now())}),[V]};function G(){return G=Object.assign||function(j){for(var F=1;F<arguments.length;F++){var V=arguments[F];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(j[P]=V[P])}return j},G.apply(this,arguments)}function W(j,F){return R(j)||A(j,F)||O(j,F)||_()}function _(){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 O(j,F){if(!j)return;if(typeof j=="string")return y(j,F);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 y(j,F)}function y(j,F){(F==null||F>j.length)&&(F=j.length);for(var V=0,P=new Array(F);V<F;V++)P[V]=j[V];return P}function A(j,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],P=!0,I=!1,X=void 0;try{for(var oe=j[Symbol.iterator](),pe;!(P=(pe=oe.next()).done)&&!(V.push(pe.value),F&&V.length===F);P=!0);}catch(ve){I=!0,X=ve}finally{try{!P&&oe.return!=null&&oe.return()}finally{if(I)throw X}}return V}function R(j){if(Array.isArray(j))return j}function k(j,F){if(j==null)return{};var V=x(j,F),P,I;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(j);for(I=0;I<X.length;I++){if(P=X[I],F.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function x(j,F){if(j==null)return{};var V={},P=Object.keys(j),I,X;for(X=0;X<P.length;X++){if(I=P[X],F.indexOf(I)>=0)continue;V[I]=j[I]}return V}var E=function(F){var V=F.className,P=F.percent,I=F.prefixCls,X=F.strokeColor,oe=F.strokeLinecap,pe=F.strokeWidth,ve=F.style,Le=F.trailColor,ke=F.trailWidth,he=F.transition,ae=k(F,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ae.gapPosition;var ue=Array.isArray(P)?P:[P],ie=Array.isArray(X)?X:[X],se=M(ue),J=W(se,1),ee=J[0],ne=pe/2,fe=100-pe/2,Ae="M ".concat(oe==="round"?ne:0,",").concat(ne,`
L `).concat(oe==="round"?fe:100,",").concat(ne),ge="0 0 100 ".concat(pe),Oe=0;return $.a.createElement("svg",G({className:Z()("".concat(I,"-line"),V),viewBox:ge,preserveAspectRatio:"none",style:ve},ae),$.a.createElement("path",{className:"".concat(I,"-line-trail"),d:Ae,strokeLinecap:oe,stroke:Le,strokeWidth:ke||pe,fillOpacity:"0"}),ue.map(function(Pe,je){var Ge={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Oe,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},He=ie[je]||ie[ie.length-1];return Oe+=Pe,$.a.createElement("path",{key:je,className:"".concat(I,"-line-path"),d:Ae,strokeLinecap:oe,stroke:He,strokeWidth:pe,fillOpacity:"0",ref:ee[je],style:Ge})}))};E.defaultProps=B;var h=E;function o(){return o=Object.assign||function(j){for(var F=1;F<arguments.length;F++){var V=arguments[F];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(j[P]=V[P])}return j},o.apply(this,arguments)}function u(j,F){return w(j)||p(j,F)||S(j,F)||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,F){if(!j)return;if(typeof j=="string")return v(j,F);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 v(j,F)}function v(j,F){(F==null||F>j.length)&&(F=j.length);for(var V=0,P=new Array(F);V<F;V++)P[V]=j[V];return P}function p(j,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],P=!0,I=!1,X=void 0;try{for(var oe=j[Symbol.iterator](),pe;!(P=(pe=oe.next()).done)&&!(V.push(pe.value),F&&V.length===F);P=!0);}catch(ve){I=!0,X=ve}finally{try{!P&&oe.return!=null&&oe.return()}finally{if(I)throw X}}return V}function w(j){if(Array.isArray(j))return j}function b(j,F){if(j==null)return{};var V=s(j,F),P,I;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(j);for(I=0;I<X.length;I++){if(P=X[I],F.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function s(j,F){if(j==null)return{};var V={},P=Object.keys(j),I,X;for(X=0;X<P.length;X++){if(I=P[X],F.indexOf(I)>=0)continue;V[I]=j[I]}return V}var f=0;function l(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function C(j,F,V,P){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,oe=50-P/2,pe=0,ve=-oe,Le=0,ke=-2*oe;switch(X){case"left":pe=-oe,ve=0,Le=2*oe,ke=0;break;case"right":pe=oe,ve=0,Le=-2*oe,ke=0;break;case"bottom":ve=oe,ke=2*oe;break;default:}var he="M 50,50 m ".concat(pe,",").concat(ve,`
a `).concat(oe,",").concat(oe," 0 1 1 ").concat(Le,",").concat(-ke,`
a `).concat(oe,",").concat(oe," 0 1 1 ").concat(-Le,",").concat(ke),ae=Math.PI*2*oe,ue={stroke:V,strokeDasharray:"".concat(F/100*(ae-I),"px ").concat(ae,"px"),strokeDashoffset:"-".concat(I/2+j/100*(ae-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:ue}}var m=function(F){var V=F.prefixCls,P=F.strokeWidth,I=F.trailWidth,X=F.gapDegree,oe=F.gapPosition,pe=F.trailColor,ve=F.strokeLinecap,Le=F.style,ke=F.className,he=F.strokeColor,ae=F.percent,ue=b(F,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(ce.useMemo)(function(){return f+=1,f},[]),se=C(0,100,pe,P,X,oe),J=se.pathString,ee=se.pathStyle,ne=a(ae),fe=a(he),Ae=fe.find(function(Ge){return Object.prototype.toString.call(Ge)==="[object Object]"}),ge=M(ne),Oe=u(ge,1),Pe=Oe[0],je=function(){var He=0;return ne.map(function(Fe,qe){var De=fe[qe]||fe[fe.length-1],Ie=Object.prototype.toString.call(De)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ie,")"):"",Be=C(He,Fe,De,P,X,oe);return He+=Fe,$.a.createElement("path",{key:qe,className:"".concat(V,"-circle-path"),d:Be.pathString,stroke:Ie,strokeLinecap:ve,strokeWidth:P,opacity:Fe===0?0:1,fillOpacity:"0",style:Be.pathStyle,ref:Pe[qe]})})};return $.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),ke),viewBox:"0 0 100 100",style:Le},ue),Ae&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Ge,He){return l(Ge)-l(He)}).map(function(Ge,He){return $.a.createElement("stop",{key:He,offset:Ge,stopColor:Ae[Ge]})}))),$.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:J,stroke:pe,strokeLinecap:ve,strokeWidth:I||P,fillOpacity:"0",style:ee}),je().reverse())};m.defaultProps=B;var T=m,U={Line:h,Circle:T}},hxT0:function(wt,nt,re){wt.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(wt,nt,re){},lZu9:function(wt,nt,re){(function(ce){ce(re("VrN/"),re("1eCo"),re("8EBN"))})(function(ce){"use strict";ce.defineMode("markdown",function($,D){var Z=ce.getMode($,"text/html"),B=Z.name=="null";function M(P){if(ce.findModeByName){var I=ce.findModeByName(P);I&&(P=I.mime||I.mimes[0])}var X=ce.getMode($,P);return X.name=="null"?null:X}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var G={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var W in G)G.hasOwnProperty(W)&&D.tokenTypeOverrides[W]&&(G[W]=D.tokenTypeOverrides[W]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,k=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\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 u(P,I,X){return I.f=I.inline=X,X(P,I)}function d(P,I,X){return I.f=I.block=X,X(P,I)}function S(P){return!P||!/\S/.test(P.string)}function v(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 I=B;if(!I){var X=ce.innerMode(Z,P.htmlState);I=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}I&&(P.f=l,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,I){var X=P.column()===I.indentation,oe=S(I.prevLine.stream),pe=I.indentedCode,ve=I.prevLine.hr,Le=I.list!==!1,ke=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var he=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,Le)){for(I.list=null;he<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=he-I.listStack[I.listStack.length-1])}var ae=!oe&&!ve&&!I.prevLine.header&&(!Le||!pe)&&!I.prevLine.fencedCodeEnd,ue=(I.list===!1||ve||oe)&&I.indentation<=ke&&P.match(_),ie=null;if(I.indentationDiff>=4&&(pe||I.prevLine.fencedCodeEnd||I.prevLine.header||oe))return P.skipToEnd(),I.indentedCode=!0,G.code;if(P.eatSpace())return null;if(X&&I.indentation<=ke&&(ie=P.match(A))&&ie[1].length<=6)return I.quote=0,I.header=ie[1].length,I.thisLine.header=!0,D.highlightFormatting&&(I.formatting="header"),I.f=I.inline,s(I);if(I.indentation<=ke&&P.eat(">"))return I.quote=X?1:I.quote+1,D.highlightFormatting&&(I.formatting="quote"),P.eatSpace(),s(I);if(!ue&&!I.setext&&X&&I.indentation<=ke&&(ie=P.match(O))){var se=ie[1]?"ol":"ul";return I.indentation=he+P.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,D.taskLists&&P.match(y,!1)&&(I.taskList=!0),I.f=I.inline,D.highlightFormatting&&(I.formatting=["list","list-"+se]),s(I)}else{if(X&&I.indentation<=ke&&(ie=P.match(x,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ie[1]+"+ *$"),I.localMode=D.fencedCodeBlockHighlighting&&M(ie[2]||D.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=ce.startState(I.localMode)),I.f=I.block=b,D.highlightFormatting&&(I.formatting="code-block"),I.code=-1,s(I);if(I.setext||(!ae||!Le)&&!I.quote&&I.list===!1&&!I.code&&!ue&&!E.test(P.string)&&(ie=P.lookAhead(1))&&(ie=ie.match(R)))return I.setext?(I.header=I.setext,I.setext=0,P.skipToEnd(),D.highlightFormatting&&(I.formatting="header")):(I.header=ie[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,s(I);if(ue)return P.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,G.hr;if(P.peek()==="[")return u(P,I,U)}return u(P,I,I.inline)}function w(P,I){var X=Z.token(P,I.htmlState);if(!B){var oe=ce.innerMode(Z,I.htmlState);(oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText||I.md_inside&&P.current().indexOf(">")>-1)&&(I.f=l,I.block=p,I.htmlState=null)}return X}function b(P,I){var X=I.listStack[I.listStack.length-1]||0,oe=I.indentation<X,pe=X+3;if(I.fencedEndRE&&I.indentation<=pe&&(oe||P.match(I.fencedEndRE))){D.highlightFormatting&&(I.formatting="code-block");var ve;return oe||(ve=s(I)),I.localMode=I.localState=null,I.block=p,I.f=l,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,oe?d(P,I,I.block):ve}else return I.localMode?I.localMode.token(P,I.localState):(P.skipToEnd(),G.code)}function s(P){var I=[];if(P.formatting){I.push(G.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var X=0;X<P.formatting.length;X++)I.push(G.formatting+"-"+P.formatting[X]),P.formatting[X]==="header"&&I.push(G.formatting+"-"+P.formatting[X]+"-"+P.header),P.formatting[X]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(G.formatting+"-"+P.formatting[X]+"-"+P.quote):I.push("error"))}if(P.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(P.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(P.linkHref?I.push(G.linkHref,"url"):(P.strong&&I.push(G.strong),P.em&&I.push(G.em),P.strikethrough&&I.push(G.strikethrough),P.emoji&&I.push(G.emoji),P.linkText&&I.push(G.linkText),P.code&&I.push(G.code),P.image&&I.push(G.image),P.imageAltText&&I.push(G.imageAltText,"link"),P.imageMarker&&I.push(G.imageMarker)),P.header&&I.push(G.header,G.header+"-"+P.header),P.quote&&(I.push(G.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(G.quote+"-"+P.quote):I.push(G.quote+"-"+D.maxBlockquoteDepth)),P.list!==!1){var oe=(P.listStack.length-1)%3;oe?oe===1?I.push(G.list2):I.push(G.list3):I.push(G.list1)}return P.trailingSpaceNewLine?I.push("trailing-space-new-line"):P.trailingSpace&&I.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function f(P,I){return P.match(k,!0)?s(I):void 0}function l(P,I){var X=I.text(P,I);if(typeof X!="undefined")return X;if(I.list)return I.list=null,s(I);if(I.taskList){var oe=P.match(y,!0)[1]===" ";return oe?I.taskOpen=!0:I.taskClosed=!0,D.highlightFormatting&&(I.formatting="task"),I.taskList=!1,s(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&P.match(/^#+$/,!0))return D.highlightFormatting&&(I.formatting="header"),s(I);var pe=P.next();if(I.linkTitle){I.linkTitle=!1;var ve=pe;pe==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Le="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(P.match(new RegExp(Le),!0))return G.linkHref}if(pe==="`"){var ke=I.formatting;D.highlightFormatting&&(I.formatting="code"),P.eatWhile("`");var he=P.current().length;if(I.code==0&&(!I.quote||he==1))return I.code=he,s(I);if(he==I.code){var ae=s(I);return I.code=0,ae}else return I.formatting=ke,s(I)}else if(I.code)return s(I);if(pe==="\\"&&(P.next(),D.highlightFormatting)){var ue=s(I),ie=G.formatting+"-escape";return ue?ue+" "+ie:ie}if(pe==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,D.highlightFormatting&&(I.formatting="image"),s(I);if(pe==="["&&I.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,D.highlightFormatting&&(I.formatting="image"),s(I);if(pe==="]"&&I.imageAltText){D.highlightFormatting&&(I.formatting="image");var ue=s(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=C,ue}if(pe==="["&&!I.image)return I.linkText&&P.match(/^.*?\]/)||(I.linkText=!0,D.highlightFormatting&&(I.formatting="link")),s(I);if(pe==="]"&&I.linkText){D.highlightFormatting&&(I.formatting="link");var ue=s(I);return I.linkText=!1,I.inline=I.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?C:l,ue}if(pe==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var ue=s(I);return ue?ue+=" ":ue="",ue+G.linkInline}if(pe==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,D.highlightFormatting&&(I.formatting="link");var ue=s(I);return ue?ue+=" ":ue="",ue+G.linkEmail}if(D.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)&&(I.md_inside=!0)}return P.backUp(1),I.htmlState=ce.startState(Z),d(P,I,w)}if(D.xml&&pe==="<"&&P.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var ee=1,ne=P.pos==1?" ":P.string.charAt(P.pos-2);ee<3&&P.eat(pe);)ee++;var fe=P.peek()||" ",Ae=!/\s/.test(fe)&&(!h.test(fe)||/\s/.test(ne)||h.test(ne)),ge=!/\s/.test(ne)&&(!h.test(ne)||/\s/.test(fe)||h.test(fe)),Oe=null,Pe=null;if(ee%2&&(!I.em&&Ae&&(pe==="*"||!ge||h.test(ne))?Oe=!0:I.em==pe&&ge&&(pe==="*"||!Ae||h.test(fe))&&(Oe=!1)),ee>1&&(!I.strong&&Ae&&(pe==="*"||!ge||h.test(ne))?Pe=!0:I.strong==pe&&ge&&(pe==="*"||!Ae||h.test(fe))&&(Pe=!1)),Pe!=null||Oe!=null){D.highlightFormatting&&(I.formatting=Oe==null?"strong":Pe==null?"em":"strong em"),Oe===!0&&(I.em=pe),Pe===!0&&(I.strong=pe);var ae=s(I);return Oe===!1&&(I.em=!1),Pe===!1&&(I.strong=!1),ae}}else if(pe===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return s(I);P.backUp(1)}if(D.strikethrough){if(pe==="~"&&P.eatWhile(pe)){if(I.strikethrough){D.highlightFormatting&&(I.formatting="strikethrough");var ae=s(I);return I.strikethrough=!1,ae}else if(P.match(/^[^\s]/,!1))return I.strikethrough=!0,D.highlightFormatting&&(I.formatting="strikethrough"),s(I)}else if(pe===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return s(I);P.backUp(2)}}if(D.emoji&&pe===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,D.highlightFormatting&&(I.formatting="emoji");var je=s(I);return I.emoji=!1,je}return pe===" "&&(P.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),s(I)}function a(P,I){var X=P.next();if(X===">"){I.f=I.inline=l,D.highlightFormatting&&(I.formatting="link");var oe=s(I);return oe?oe+=" ":oe="",oe+G.linkInline}return P.match(/^[^>]+/,!0),G.linkInline}function C(P,I){if(P.eatSpace())return null;var X=P.next();return X==="("||X==="["?(I.f=I.inline=T(X==="("?")":"]"),D.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,s(I)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(P){return function(I,X){var oe=I.next();if(oe===P){X.f=X.inline=l,D.highlightFormatting&&(X.formatting="link-string");var pe=s(X);return X.linkHref=!1,pe}return I.match(m[P]),X.linkHref=!0,s(X)}}function U(P,I){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=j,P.next(),D.highlightFormatting&&(I.formatting="link"),I.linkText=!0,s(I)):u(P,I,l)}function j(P,I){if(P.match(/^\]:/,!0)){I.f=I.inline=F,D.highlightFormatting&&(I.formatting="link");var X=s(I);return I.linkText=!1,X}return P.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function F(P,I){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?I.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=l,G.linkHref+" url")}var V={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:l,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&&ce.copyState(Z,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?ce.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,I){if(I.formatting=!1,P!=I.thisLine.stream){if(I.header=0,I.hr=!1,P.match(/^\s*$/,!0))return v(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:P},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=w)){var X=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=X,I.indentationDiff=null,X>0)return null}}return I.f(P,I)},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,I,X){return P.block==w&&Z.indent?Z.indent(P.htmlState,I,X):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,I,X):ce.Pass},blankLine:v,getType:s,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ce.defineMIME("text/markdown","markdown"),ce.defineMIME("text/x-markdown","markdown")})},osHv:function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";var $=ce.Pos;function D(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",B=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+Z+"]["+B+"]*)","g");function G(h,o,u,d){this.line=o,this.ch=u,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 W(h,o){var u=h.cm.getTokenTypeAt($(h.line,o));return u&&/\btag\b/.test(u)}function _(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function O(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function y(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(_(h))continue;return}if(!W(h,o+1)){h.ch=o+1;continue}var u=h.text.lastIndexOf("/",o),d=u>-1&&!/\S/.test(h.text.slice(u+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function A(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(O(h))continue;return}if(!W(h,o+1)){h.ch=o;continue}M.lastIndex=o,h.ch=o;var u=M.exec(h.text);if(u&&u.index==o)return u}}function R(h){for(;;){M.lastIndex=h.ch;var o=M.exec(h.text);if(!o){if(_(h))continue;return}if(!W(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function k(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(O(h))continue;return}if(!W(h,o+1)){h.ch=o;continue}var u=h.text.lastIndexOf("/",o),d=u>-1&&!/\S/.test(h.text.slice(u+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function x(h,o){for(var u=[];;){var d=R(h),S,v=h.line,p=h.ch-(d?d[0].length:0);if(!d||!(S=y(h)))return;if(S=="selfClose")continue;if(d[1]){for(var w=u.length-1;w>=0;--w)if(u[w]==d[2]){u.length=w;break}if(w<0&&(!o||o==d[2]))return{tag:d[2],from:$(v,p),to:$(h.line,h.ch)}}else u.push(d[2])}}function E(h,o){for(var u=[];;){var d=k(h);if(!d)return;if(d=="selfClose"){A(h);continue}var S=h.line,v=h.ch,p=A(h);if(!p)return;if(p[1])u.push(p[2]);else{for(var w=u.length-1;w>=0;--w)if(u[w]==p[2]){u.length=w;break}if(w<0&&(!o||o==p[2]))return{tag:p[2],from:$(h.line,h.ch),to:$(S,v)}}}}ce.registerHelper("fold","xml",function(h,o){for(var u=new G(h,o.line,0);;){var d=R(u);if(!d||u.line!=o.line)return;var S=y(u);if(!S)return;if(!d[1]&&S!="selfClose"){var v=$(u.line,u.ch),p=x(u,d[2]);return p&&D(p.from,v)>0?{from:v,to:p.from}:null}}}),ce.findMatchingTag=function(h,o,u){var d=new G(h,o.line,o.ch,u);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var S=y(d),v=S&&$(d.line,d.ch),p=S&&A(d);if(!S||!p||D(d,o)>0)return;var w={from:$(d.line,d.ch),to:v,tag:p[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:p[1]?{open:E(d,p[2]),close:w,at:"close"}:(d=new G(h,v.line,v.ch,u),{open:w,close:x(d,p[2]),at:"open"})},ce.findEnclosingTag=function(h,o,u,d){for(var S=new G(h,o.line,o.ch,u);;){var v=E(S,d);if(!v)break;var p=new G(h,o.line,o.ch,u),w=x(p,v.tag);if(w)return{open:v,close:w}}},ce.scanForClosingTag=function(h,o,u,d){var S=new G(h,o.line,o.ch,d?{from:0,to:d}:null);return x(S,u)}})},p5ED:function(wt,nt,re){"use strict";var ce=re("+L6B"),$=re("2/Rp"),D=re("5Dmo"),Z=re("3S7+"),B=re("k1fw"),M=re("9og8"),G=re("tJVT"),W=re("WmNS"),_=re.n(W),O=re("q1tI"),y=re.n(O),A=re("vHTk"),R=re.n(A),k=re("yEEn"),x=re("ZW9T"),E=re("1vsH"),h=re("V0Rq"),o=re("m3rI");nt.a=function(u){var d,S,v,p,w,b,s,f=u.editOffice,l=f===void 0?"view":f,a=u.data,C=u.theme,m=u.type,T=u.filename,U=u.monacoEditor,j=u.className,F=u.style,V=u.close,P=u.onClose,I=u.hasMask,X=u.disabledDownload,oe=Object(O.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),pe=Object(G.a)(oe,2),ve=pe[0],Le=pe[1],ke=Object(O.useState)(""),he=Object(G.a)(ke,2),ae=he[0],ue=he[1],ie=Object(O.useState)(),se=Object(G.a)(ie,2),J=se[0],ee=se[1],ne=window.ENV==="build"?"/react/build":"",fe=o.a.PROXY_SERVER||location.origin,Ae,ge=1024*1024,Oe=10*ge,Pe=Object(O.useRef)();(d=a)!==null&&d!==void 0&&d.startsWith("/api")&&m!=="txt"&&(a=o.a.API_SERVER+a),m==="office"&&(Ae=Object(E.U)(a).filesize,Ae>Oe&&(m="other")),T&&U&&(U.filename=T),Object(O.useEffect)(function(){var Fe,qe,De=(Fe=document.cookie)===null||Fe===void 0||((qe=Fe.replace(/\s/g,""))===null||qe===void 0)?void 0:qe.split(";");De==null||De.map(function(Ie){var Be=Ie.split("=");Be[0]==="_educoder_session"&&ue(Be[1])})},[]),Object(O.useEffect)(function(){m==="office"&&je()},[m,a]);var je=function(){var Fe=Object(M.a)(_.a.mark(function qe(){var De,Ie,Be;return _.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return console.log("data:",a),De=a,a.startsWith("http")||(De=location.origin+De),Ie=new URL(De).pathname.split("/").pop(),Ke.next=6,Object(h.V)({attachment_id:Ie});case 6:Be=Ke.sent,ee(Be);case 8:case"end":return Ke.stop()}},qe)}));return function(){return Fe.apply(this,arguments)}}(),Ge=function(){if(a.startsWith("http")||a.startsWith("blob:")){He();return}Object(E.z)(T||"educoder",a,T)},He=function(){Object(E.x)(T||"educoder",decodeURIComponent(a))};return y.a.createElement("div",{style:Object(B.a)({},F||{}),className:"".concat(I&&R.a.bgBlack," ").concat(m?R.a.wrp:"hide")},V&&y.a.createElement("div",{className:R.a.close,ref:Pe},!X&&y.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Pe.current}},y.a.createElement("span",{onClick:He},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Pe.current}},y.a.createElement("span",{className:"",onClick:P},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(R.a[j]," ").concat(j," ").concat(R.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&y.a.createElement(x.b,U)),m==="audio"&&y.a.createElement("audio",{src:"".concat(((S=a)===null||S===void 0?void 0:S.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&y.a.createElement(y.a.Fragment,null,((p=a)===null||p===void 0?void 0:p.indexOf("http"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&J&&y.a.createElement("iframe",{src:"".concat(ne,"/office.html?key=").concat(J.key,"&url=").concat(fe+J.url,"&callbackUrl=").concat(fe+J.callbackUrl,"&fileType=").concat(J.fileType,"&title=").concat(J.title,"&model=").concat(l,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!X)}),m==="html"&&y.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&y.a.createElement("iframe",{src:"".concat(ne,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!X)}),m==="image"&&y.a.createElement("img",{src:"".concat(((w=a)===null||w===void 0?void 0:w.indexOf("http://"))>-1||((b=a)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(s=a)!==null&&s!==void 0&&s.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&y.a.createElement("div",null,y.a.createElement($.a,{type:"primary",size:"large",onClick:Ge},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&y.a.createElement($.a,{type:"primary",size:"large",onClick:Ge},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(wt,nt,re){},rUJ1:function(wt,nt){const re=/[&<>"']/,ce=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=b=>Z[b];function M(b,s){if(s){if(re.test(b))return b.replace(ce,B)}else if($.test(b))return b.replace(D,B);return b}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(b){return b.replace(G,(s,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 _=/(^|[^\[])\^/g;function O(b,s){b=b.source||b,s=s||"";const f={replace:(l,a)=>(a=a.source||a,a=a.replace(_,"$1"),b=b.replace(l,a),f),getRegex:()=>new RegExp(b,s)};return f}const y=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,s,f){if(b){let l;try{l=decodeURIComponent(W(f)).replace(y,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}s&&!A.test(f)&&(f=o(s,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(l){return null}return f}const k={},x=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,s){k[" "+b]||(x.test(b)?k[" "+b]=b+"/":k[" "+b]=v(b,"/",!0)),b=k[" "+b];const f=b.indexOf(":")===-1;return s.substring(0,2)==="//"?f?s:b.replace(E,"$1")+s:s.charAt(0)==="/"?f?s:b.replace(h,"$1")+s:b+s}const u={exec:function(){}};function d(b){let s=1,f,l;for(;s<arguments.length;s++){f=arguments[s];for(l in f)Object.prototype.hasOwnProperty.call(f,l)&&(b[l]=f[l])}return b}function S(b,s){const f=b.replace(/\|/g,(C,m,T)=>{let U=!1,j=m;for(;--j>=0&&T[j]==="\\";)U=!U;return U?"|":" |"}),l=f.split(/ \|/);let a=0;if(l.length>s)l.splice(s);else for(;l.length<s;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function v(b,s,f){const l=b.length;if(l===0)return"";let a=0;for(;a<l;){const C=b.charAt(l-a-1);if(C===s&&!f)a++;else if(C!==s&&f)a++;else break}return b.substr(0,l-a)}function p(b,s){if(b.indexOf(s[1])===-1)return-1;const f=b.length;let l=0,a=0;for(;a<f;a++)if(b[a]==="\\")a++;else if(b[a]===s[0])l++;else if(b[a]===s[1]&&(l--,l<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")}wt.exports={escape:M,unescape:W,edit:O,cleanUrl:R,resolveUrl:o,noopTest:u,merge:d,splitCells:S,rtrim:v,findClosingBracket:p,checkSanitizeDeprecation:w}},sboe:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return D});var ce=re("q1tI"),$=re.n(ce),D=ce.createContext(null)},uK0f:function(wt,nt,re){(function(ce,$){wt.exports=$()})(this,function(){"use strict";function ce($,D,Z){Z=Z||{},Z.childrenKeyName=Z.childrenKeyName||"children";var B=$||[],M=[],G=0;do{var W=B.filter(function(_){return D(_,G)})[0];if(!W)break;M.push(W),B=W[Z.childrenKeyName]||[],G+=1}while(B.length>0);return M}return ce})},ulZh:function(wt,nt,re){typeof window!="undefined"&&function($,D){wt.exports=D()}(this,function(){return function(ce){var $={};function D(Z){if($[Z])return $[Z].exports;var B=$[Z]={i:Z,l:!1,exports:{}};return ce[Z].call(B.exports,B,B.exports,D),B.l=!0,B.exports}return D.m=ce,D.c=$,D.d=function(Z,B,M){D.o(Z,B)||Object.defineProperty(Z,B,{enumerable:!0,get:M})},D.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},D.t=function(Z,B){if(B&1&&(Z=D(Z)),B&8)return Z;if(B&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var M=Object.create(null);if(D.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:Z}),B&2&&typeof Z!="string")for(var G in Z)D.d(M,G,function(W){return Z[W]}.bind(null,G));return M},D.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return D.d(B,"a",B),B},D.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,$,D){"use strict";var Z=Object.prototype.hasOwnProperty,B="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(B=!1));function G(y,A,R){this.fn=y,this.context=A,this.once=R||!1}function W(y,A,R,k,x){if(typeof R!="function")throw new TypeError("The listener must be a function");var E=new G(R,k||y,x),h=B?B+A:A;return y._events[h]?y._events[h].fn?y._events[h]=[y._events[h],E]:y._events[h].push(E):(y._events[h]=E,y._eventsCount++),y}function _(y,A){--y._eventsCount===0?y._events=new M:delete y._events[A]}function O(){this._events=new M,this._eventsCount=0}O.prototype.eventNames=function(){var A=[],R,k;if(this._eventsCount===0)return A;for(k in R=this._events)Z.call(R,k)&&A.push(B?k.slice(1):k);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(R)):A},O.prototype.listeners=function(A){var R=B?B+A:A,k=this._events[R];if(!k)return[];if(k.fn)return[k.fn];for(var x=0,E=k.length,h=new Array(E);x<E;x++)h[x]=k[x].fn;return h},O.prototype.listenerCount=function(A){var R=B?B+A:A,k=this._events[R];return k?k.fn?1:k.length:0},O.prototype.emit=function(A,R,k,x,E,h){var o=B?B+A:A;if(!this._events[o])return!1;var u=this._events[o],d=arguments.length,S,v;if(u.fn){u.once&&this.removeListener(A,u.fn,void 0,!0);switch(d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,R),!0;case 3:return u.fn.call(u.context,R,k),!0;case 4:return u.fn.call(u.context,R,k,x),!0;case 5:return u.fn.call(u.context,R,k,x,E),!0;case 6:return u.fn.call(u.context,R,k,x,E,h),!0}for(v=1,S=new Array(d-1);v<d;v++)S[v-1]=arguments[v];u.fn.apply(u.context,S)}else{var p=u.length,w;for(v=0;v<p;v++){u[v].once&&this.removeListener(A,u[v].fn,void 0,!0);switch(d){case 1:u[v].fn.call(u[v].context);break;case 2:u[v].fn.call(u[v].context,R);break;case 3:u[v].fn.call(u[v].context,R,k);break;case 4:u[v].fn.call(u[v].context,R,k,x);break;default:if(!S)for(w=1,S=new Array(d-1);w<d;w++)S[w-1]=arguments[w];u[v].fn.apply(u[v].context,S)}}}return!0},O.prototype.on=function(A,R,k){return W(this,A,R,k,!1)},O.prototype.once=function(A,R,k){return W(this,A,R,k,!0)},O.prototype.removeListener=function(A,R,k,x){var E=B?B+A:A;if(!this._events[E])return this;if(!R)return _(this,E),this;var h=this._events[E];if(h.fn)h.fn===R&&(!x||h.once)&&(!k||h.context===k)&&_(this,E);else{for(var o=0,u=[],d=h.length;o<d;o++)(h[o].fn!==R||x&&!h[o].once||k&&h[o].context!==k)&&u.push(h[o]);u.length?this._events[E]=u.length===1?u[0]:u:_(this,E)}return this},O.prototype.removeAllListeners=function(A){var R;return A?(R=B?B+A:A,this._events[R]&&_(this,R)):(this._events=new M,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=B,O.EventEmitter=O,ce.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,$,D){(function(Z){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(O,y,A){if(A=A||{},O=O.trim(),y=y.trim(),!y){if(!A.alwaysNormalize)return O;var R=_.parseURL(O);if(!R)throw new Error("Error trying to parse base URL.");return R.path=_.normalizePath(R.path),_.buildURLFromParts(R)}var k=_.parseURL(y);if(!k)throw new Error("Error trying to parse relative URL.");if(k.scheme)return A.alwaysNormalize?(k.path=_.normalizePath(k.path),_.buildURLFromParts(k)):y;var x=_.parseURL(O);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var E=M.exec(x.path);x.netLoc=E[1],x.path=E[2]}x.netLoc&&!x.path&&(x.path="/");var h={scheme:x.scheme,netLoc:k.netLoc,path:null,params:k.params,query:k.query,fragment:k.fragment};if(!k.netLoc&&(h.netLoc=x.netLoc,k.path[0]!=="/"))if(!k.path)h.path=x.path,k.params||(h.params=x.params,k.query||(h.query=x.query));else{var o=x.path,u=o.substring(0,o.lastIndexOf("/")+1)+k.path;h.path=_.normalizePath(u)}return h.path===null&&(h.path=A.alwaysNormalize?_.normalizePath(k.path):k.path),_.buildURLFromParts(h)},parseURL:function(O){var y=B.exec(O);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(G,"");O.length!==(O=O.replace(W,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};ce.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,$,D){function Z(A){var R={};function k(E){if(R[E])return R[E].exports;var h=R[E]={i:E,l:!1,exports:{}};return A[E].call(h.exports,h,h.exports,k),h.l=!0,h.exports}k.m=A,k.c=R,k.i=function(E){return E},k.d=function(E,h,o){k.o(E,h)||Object.defineProperty(E,h,{configurable:!1,enumerable:!0,get:o})},k.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},k.n=function(E){var h=E&&E.__esModule?function(){return E.default}:function(){return E};return k.d(h,"a",h),h},k.o=function(E,h){return Object.prototype.hasOwnProperty.call(E,h)},k.p="/",k.oe=function(E){throw console.error(E),E};var x=k(k.s=ENTRY_MODULE);return x.default||x}var B="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function G(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(A){return!isNaN(1*A)}function _(A,R,k){var x={};x[k]=[];var E=R.toString(),h=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return x;for(var o=h[1],u=new RegExp("(\\\\n|\\W)"+G(o)+M,"g"),d;d=u.exec(E);){if(d[3]==="dll-reference")continue;x[k].push(d[3])}for(u=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+M,"g");d=u.exec(E);)A[d[2]]||(x[k].push(d[1]),A[d[2]]=D(d[1]).m),x[d[2]]=x[d[2]]||[],x[d[2]].push(d[4]);for(var S=Object.keys(x),v=0;v<S.length;v++)for(var p=0;p<x[S[v]].length;p++)W(x[S[v]][p])&&(x[S[v]][p]=1*x[S[v]][p]);return x}function O(A){var R=Object.keys(A);return R.reduce(function(k,x){return k||A[x].length>0},!1)}function y(A,R){for(var k={main:[R]},x={main:[]},E={main:{}};O(k);)for(var h=Object.keys(k),o=0;o<h.length;o++){var u=h[o],d=k[u],S=d.pop();if(E[u]=E[u]||{},E[u][S]||!A[u][S])continue;E[u][S]=!0,x[u]=x[u]||[],x[u].push(S);for(var v=_(A,A[u][S],u),p=Object.keys(v),w=0;w<p.length;w++)k[p[w]]=k[p[w]]||[],k[p[w]]=k[p[w]].concat(v[p[w]])}return x}ce.exports=function(A,R){R=R||{};var k={main:D.m},x=R.all?{main:Object.keys(k.main)}:y(k,A),E="";Object.keys(x).filter(function(S){return S!=="main"}).forEach(function(S){for(var v=0;x[S][v];)v++;x[S].push(v),k[S][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+S+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+x[S].map(function(p){return""+JSON.stringify(p)+": "+k[S][p].toString()}).join(",")+`});
`}),E=E+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+x.main.map(function(S){return""+JSON.stringify(S)+": "+k.main[S].toString()}).join(",")+"}))(self);";var h=new window.Blob([E],{type:"text/javascript"});if(R.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(h),d=new window.Worker(u);return d.objectURL=u,d}},"./src/config.ts":function(ce,$,D){"use strict";D.r($),D.d($,"hlsDefaultConfig",function(){return w}),D.d($,"mergeConfig",function(){return s}),D.d($,"enableStreamingMode",function(){return f});var Z=D("./src/controller/abr-controller.ts"),B=D("./src/controller/audio-stream-controller.ts"),M=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),W=D("./src/controller/subtitle-track-controller.ts"),_=D("./src/controller/buffer-controller.ts"),O=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),R=D("./src/controller/eme-controller.ts"),k=D("./src/controller/cmcd-controller.ts"),x=D("./src/utils/xhr-loader.ts"),E=D("./src/utils/fetch-loader.ts"),h=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),u=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var C=arguments[a];for(var m in C)Object.prototype.hasOwnProperty.call(C,m)&&(l[m]=C[m])}return l},d.apply(this,arguments)}function S(l,a){var C=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(T){return Object.getOwnPropertyDescriptor(l,T).enumerable})),C.push.apply(C,m)}return C}function v(l){for(var a=1;a<arguments.length;a++){var C=arguments[a]!=null?arguments[a]:{};a%2?S(Object(C),!0).forEach(function(m){p(l,m,C[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(C)):S(Object(C)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(C,m))})}return l}function p(l,a,C){return a in l?Object.defineProperty(l,a,{value:C,enumerable:!0,configurable:!0,writable:!0}):l[a]=C,l}var w=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:_.default,capLevelController:y.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:W.default,timelineController:O.TimelineController,audioStreamController:B.default,audioTrackController:M.default,emeController:R.default,cmcdController:k.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 s(l,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({},l,a)}function f(l){var a=l.loader;if(a!==E.default&&a!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var C=Object(E.fetchSupported)();C&&(l.loader=E.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/ewma-bandwidth-estimator.ts"),M=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/errors.ts"),_=D("./src/types/loader.ts"),O=D("./src/utils/logger.ts");function y(k,x){for(var E=0;E<x.length;E++){var h=x[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function A(k,x,E){return x&&y(k.prototype,x),E&&y(k,E),k}var R=function(){function k(E){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=E;var h=E.config;this.bwEstimator=new B.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var x=k.prototype;return x.registerListeners=function(){var h=this.hls;h.on(M.Events.FRAG_LOADING,this.onFragLoading,this),h.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(M.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var h=this.hls;h.off(M.Events.FRAG_LOADING,this.onFragLoading,this),h.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(M.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 u=o.frag;if(u.type===_.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=u,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(h,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,u=this.hls,d=u.autoLevelEnabled,S=u.config,v=u.media;if(!h||!v)return;var p=o?o.stats:h.stats,w=o?o.duration:h.duration;if(p.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||v.paused||!v.playbackRate||!v.readyState)return;var b=performance.now()-p.loading.start,s=Math.abs(v.playbackRate);if(b<=500*w/s)return;var f=u.levels,l=u.minAutoLevel,a=f[h.level],C=p.total||Math.max(p.loaded,Math.round(w*a.maxBitrate/8)),m=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),T=(C-p.loaded)/m,U=v.currentTime,j=(G.BufferHelper.bufferInfo(v,U,S.maxBufferHole).end-U)/s;if(j>=2*w/s||T<=j)return;var F=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>l;V--){var P=f[V].maxBitrate;if(F=w*P/(8*.8*m),F<j)break}if(F>=T)return;var I=this.bwEstimator.getEstimate();O.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)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+T.toFixed(3)+` s
Estimated load time for the next fragment: `+F.toFixed(3)+` s
Time to underbuffer: `+j.toFixed(3)+" s"),u.nextLoadLevel=V,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),u.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:p})},x.onFragLoaded=function(h,o){var u=o.frag,d=o.part;if(u.type===_.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(u.sn)){var S=d?d.stats:u.stats,v=d?d.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[u.level],w=(p.loaded?p.loaded.bytes:0)+S.loaded,b=(p.loaded?p.loaded.duration:0)+v;p.loaded={bytes:w,duration:b},p.realBitrate=Math.round(8*w/b)}if(u.bitrateTest){var s={stats:S,frag:u,part:d,id:u.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,s),u.bitrateTest=!1}}},x.onFragBuffered=function(h,o){var u=o.frag,d=o.part,S=d?d.stats:u.stats;if(S.aborted)return;if(u.type!==_.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var v=S.parsing.end-S.loading.start;this.bwEstimator.sample(v,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},x.onError=function(h,o){switch(o.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.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,u=this.hls,d=u.maxAutoLevel,S=u.config,v=u.minAutoLevel,p=u.media,w=o?o.duration:h?h.duration:0,b=p?p.currentTime:0,s=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,l=(G.BufferHelper.bufferInfo(p,b,S.maxBufferHole).end-b)/s,a=this.findBestLevel(f,v,d,l,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,m=S.abrBandWidthFactor,T=S.abrBandWidthUpFactor;if(!l){var U=this.bitrateTestDelay;if(U){var j=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;C=j-U,O.logger.trace("bitrate test took "+Math.round(1e3*U)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),m=T=1}}return a=this.findBestLevel(f,v,d,l+C,m,T),Math.max(a,0)},x.findBestLevel=function(h,o,u,d,S,v){for(var p,w=this.fragCurrent,b=this.partCurrent,s=this.lastLoadedFragLevel,f=this.hls.levels,l=f[s],a=!!(l!=null&&(p=l.details)!==null&&p!==void 0&&p.live),C=l==null?void 0:l.codecSet,m=b?b.duration:w?w.duration:0,T=u;T>=o;T--){var U=f[T];if(!U||C&&U.codecSet!==C)continue;var j=U.details,F=(b?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||m,V=void 0;T<=s?V=S*h:V=v*h;var P=f[T].maxBitrate,I=P*F/V;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(V)+"/"+P+"/"+F+"/"+d+"/"+I),V>P&&(!I||a&&!this.bitrateTestDelay||I<d))return T}return-1},A(k,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var u=this.getNextABRAutoLevel();return h!==-1&&(u=Math.min(h,u)),u},set:function(h){this._nextAutoLevel=h}}]),k}();$.default=R},"./src/controller/audio-stream-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),M=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-tracker.ts"),_=D("./src/types/level.ts"),O=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),R=D("./src/demux/transmuxer-interface.ts"),k=D("./src/types/transmuxer.ts"),x=D("./src/controller/fragment-finders.ts"),E=D("./src/utils/discontinuities.ts"),h=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var s=arguments[b];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(w[f]=s[f])}return w},u.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,l){return f.__proto__=l,f},S(w,b)}var v=100,p=function(w){d(b,w);function b(f,l){var a;return a=w.call(this,f,l,"[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 s=b.prototype;return s.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},s._registerListeners=function(){var l=this.hls;l.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(M.Events.ERROR,this.onError,this),l.on(M.Events.BUFFER_RESET,this.onBufferReset,this),l.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s._unregisterListeners=function(){var l=this.hls;l.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(M.Events.ERROR,this.onError,this),l.off(M.Events.BUFFER_RESET,this.onBufferReset,this),l.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s.onInitPtsFound=function(l,a){var C=a.frag,m=a.id,T=a.initPTS;if(m==="main"){var U=C.cc;this.initPTS[C.cc]=T,this.log("InitPTS for cc: "+U+" found from main: "+T),this.videoTrackCC=U,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},s.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=B.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},s.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var l,a=this.levels,C=this.trackId,m=a==null||((l=a[C])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var T,U=performance.now(),j=this.retryDate;(!j||U>=j||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var V=F.frag,P=F.part,I=F.cache,X=F.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var oe=I.flush(),pe={frag:V,part:P,payload:oe,networkDetails:null};this._handleFragmentLoadProgress(pe),X&&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(),Le=G.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),ke=Object(x.fragmentWithinToleranceTest)(Le.end,this.config.maxFragLookUpTolerance,V);ke<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Le.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},s.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},s.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,C=a.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},s.doTickIdle=function(){var l,a,C=this.hls,m=this.levels,T=this.media,U=this.trackId,j=C.config;if(!m||!m[U])return;if(!T&&(this.startFragRequested||!j.startFragPrefetch))return;var F=m[U],V=F.details;if(!V||V.live&&this.levelLastLoaded!==U||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(P===null)return;var I=P.len,X=this.getMaxBufferLength(),oe=this.audioSwitch;if(I>=X&&!oe)return;if(!oe&&this._streamEnded(P,V)){C.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var pe=V.fragments,ve=pe[0].start,Le=P.end;if(oe){var ke=this.getLoadPosition();Le=ke,V.PTSKnown&&ke<ve&&((P.end>ve||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=ve+.05))}var he=this.getNextFragment(Le,V);if(!he){this.bufferFlushed=!0;return}((l=he.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,V):this.loadFragment(he,V,Le)},s.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},s.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},s.onAudioTracksUpdated=function(l,a){var C=a.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(m){return new _.Level(m)})},s.onAudioTrackSwitching=function(l,a){var C=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(v):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},s.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},s.onLevelLoaded=function(l,a){this.mainDetails=a.details},s.onAudioTrackLoaded=function(l,a){var C,m=this.levels,T=a.details,U=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+U);return}this.log("Track "+U+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var j=m[U],F=0;if(T.live||(C=j.details)!==null&&C!==void 0&&C.live){var V=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!V)return;!j.details&&T.hasProgramDateTime&&V.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(T,V),F=T.fragments[0].start):F=this.alignPlaylists(T,j.details)}j.details=T,this.levelLastLoaded=U,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(j.details,F),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=B.State.IDLE),this.tick()},s._handleFragmentLoadProgress=function(l){var a,C=l.frag,m=l.part,T=l.payload,U=this.config,j=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var V=F[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 I=U.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new R.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var oe=this.initPTS[C.cc],pe=(a=C.initSegment)===null||a===void 0?void 0:a.data;if(oe!==void 0){var ve=!1,Le=m?m.index:-1,ke=Le!==-1,he=new k.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,T.byteLength,Le,ke);X.push(T,pe,I,"",C,m,P.totalduration,ve,he,oe)}else{o.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+j);var ae=this.waitingData=this.waitingData||{frag:C,part:m,cache:new A.default,complete:!1},ue=ae.cache;ue.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},s._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},s.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},s.onBufferCreated=function(l,a){var C=a.tracks.audio;C&&(this.mediaBuffer=C.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},s.onFragBuffered=function(l,a){var C=a.frag,m=a.part;if(C.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(m?" p: "+m.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,m)},s.onError=function(l,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(O.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=a.fatal?B.State.ERROR:B.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===B.State.PARSING||this.state===B.State.PARSED)){var C=!0,m=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);m&&m.len>.5&&(C=!this.reduceMaxBufferLength(m.len)),C&&(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}},s.onBufferFlushed=function(l,a){var C=a.type;C===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},s._handleTransmuxComplete=function(l){var a,C="audio",m=this.hls,T=l.remuxResult,U=l.chunkMeta,j=this.getCurrentContext(U);if(!j){this.warn("The loading context changed while buffering fragment "+U.sn+" of level "+U.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(U.level);return}var F=j.frag,V=j.part,P=T.audio,I=T.text,X=T.id3,oe=T.initSegment;if(this.fragContextChanged(F))return;if(this.state=B.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),oe!=null&&oe.tracks&&(this._bufferInitSegment(oe.tracks,F,U),m.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:C,tracks:oe.tracks})),P){var pe=P.startPTS,ve=P.endPTS,Le=P.startDTS,ke=P.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ve,startDTS:Le,endDTS:ke}),F.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,pe,ve,Le,ke),this.bufferFragmentData(P,F,V,U)}if(X!=null&&(a=X.samples)!==null&&a!==void 0&&a.length){var he=u({frag:F,id:C},X);m.trigger(M.Events.FRAG_PARSING_METADATA,he)}if(I){var ae=u({frag:F,id:C},I);m.trigger(M.Events.FRAG_PARSING_USERDATA,ae)}},s._bufferInitSegment=function(l,a,C){if(this.state!==B.State.PARSING)return;l.video&&delete l.video;var m=l.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,l);var T=m.initSegment;if(T!=null&&T.byteLength){var U={type:"audio",frag:a,part:null,chunkMeta:C,parent:a.type,data:T};this.hls.trigger(M.Events.BUFFER_APPENDING,U)}this.tick()},s.loadFragment=function(l,a,C){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===W.FragmentState.NOT_LOADED||m===W.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,C)))},s.completeAudioSwitch=function(){var l=this.hls,a=this.media,C=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:C})},b}(B.default);$.default=p},"./src/controller/audio-track-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),M=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function W(R,k){for(var x=0;x<k.length;x++){var E=k[x];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(R,E.key,E)}}function _(R,k,x){return k&&W(R.prototype,k),x&&W(R,x),R}function O(R,k){R.prototype=Object.create(k.prototype),R.prototype.constructor=R,y(R,k)}function y(R,k){return y=Object.setPrototypeOf||function(E,h){return E.__proto__=h,E},y(R,k)}var A=function(R){O(k,R);function k(E){var h;return h=R.call(this,E,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var x=k.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,R.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 u=o.id,d=o.details,S=this.tracksInGroup[u];if(!S){this.warn("Invalid audio track id "+u);return}var v=S.details;S.details=o.details,this.log("audioTrack "+u+" loaded ["+d.startSN+"-"+d.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,v))},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 u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var d=this.tracks.filter(function(v){return!u||v.groupId===u});this.selectDefaultTrack&&!d.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var S={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},x.onError=function(h,o){if(R.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===G.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 u=o[this.trackId];this.log("Now switching to audio-track index "+h);var d=o[h],S=d.id,v=d.groupId,p=v===void 0?"":v,w=d.name,b=d.type,s=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:s}),d.details&&!d.details.live)return;var f=this.switchParams(d.url,u==null?void 0:u.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,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(h){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var d=o[u];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 u=o.id,d=o.groupId,S=o.url;if(h)try{S=h.addDirectives(S)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:S,id:u,groupId:d,deliveryDirectives:h||null})}},_(k,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),k}(M.default);$.default=A},"./src/controller/base-playlist-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return _});var Z=D("./src/polyfills/number.ts"),B=D("./src/types/level.ts"),M=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),_=function(){function O(A,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,R+":"),this.warn=G.logger.warn.bind(G.logger,R+":"),this.hls=A}var y=O.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(R,k){k.fatal&&k.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(R,k){var x=k==null?void 0:k.renditionReports;if(x)for(var E=0;E<x.length;E++){var h=x[E],o=""+h.URI;if(o===R.substr(-o.length)){var u=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(k&&this.hls.config.lowLatencyMode){var S=Math.min(k.age-k.partTarget,k.targetduration);d!==void 0&&S>k.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(u))return new B.HlsUrlParameters(u,Object(Z.isFiniteNumber)(d)?d:void 0,B.HlsSkip.No)}}},y.loadPlaylist=function(R){},y.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},y.playlistLoaded=function(R,k,x){var E=this,h=k.details,o=k.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-u,h.live||x!=null&&x.live){if(h.reloaded(x),x&&this.log("live playlist "+R+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),x&&h.fragments.length>0&&Object(M.mergeDetails)(x,h),!this.canLoad||!h.live)return;var d,S=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var p=this.hls.config.lowLatencyMode,w=h.lastPartSn,b=h.endSN,s=h.lastPartIndex,f=s!==-1,l=w===b,a=p?0:s;f?(S=l?b+1:w,v=l?a:s+1):S=b+1;var C=h.age,m=C+h.ageHeader,T=Math.min(m-h.partTarget,h.targetduration*1.5);if(T>0){if(x&&T>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+T+" with playlist age: "+h.age),T=0;else{var U=Math.floor(T/h.targetduration);if(S+=U,v!==void 0){var j=Math.round(T%h.targetduration/h.partTarget);v+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+T+" skip sn "+U+" to part "+v)}h.tuneInGoal=T}if(d=this.getDeliveryDirectives(h,k.deliveryDirectives,S,v),p||!l){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,k.deliveryDirectives,S,v);var F=Object(M.computeReloadInterval)(h,o);S!==void 0&&h.canBlockReload&&(F-=h.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},F)}else this.clearTimer()},y.getDeliveryDirectives=function(R,k,x,E){var h=Object(B.getSkipValue)(R,x);return k!=null&&k.skip&&R.deltaUpdateFailed&&(x=k.msn,E=k.part,h=B.HlsSkip.No),new B.HlsUrlParameters(x,E,h)},y.retryLoadingOrFail=function(R){var k=this,x=this.hls.config,E=this.retryCount<x.levelLoadingMaxRetry;if(E){var h;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(h=R.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return k.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return E},O}()},"./src/controller/base-stream-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"State",function(){return b}),D.d($,"default",function(){return s});var Z=D("./src/polyfills/number.ts"),B=D("./src/task-loop.ts"),M=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts"),_=D("./src/events.ts"),O=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/discontinuities.ts"),k=D("./src/controller/fragment-finders.ts"),x=D("./src/controller/level-helper.ts"),E=D("./src/loader/fragment-loader.ts"),h=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),u=D("./src/types/loader.ts");function d(f,l){for(var a=0;a<l.length;a++){var C=l[a];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(f,C.key,C)}}function S(f,l,a){return l&&d(f.prototype,l),a&&d(f,a),f}function v(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function p(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,w(f,l)}function w(f,l){return w=Object.setPrototypeOf||function(C,m){return C.__proto__=m,C},w(f,l)}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"},s=function(f){p(l,f);function l(C,m,T){var U;return U=f.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=b.STOPPED,U.media=void 0,U.mediaBuffer=void 0,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=T,U.log=W.logger.log.bind(W.logger,T+":"),U.warn=W.logger.warn.bind(W.logger,T+":"),U.hls=C,U.fragmentLoader=new E.default(C.config),U.fragmentTracker=m,U.config=C.config,U.decrypter=new h.default(C,C.config),C.on(_.Events.KEY_LOADED,U.onKeyLoaded,v(U)),U}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,T){var U=this.fragCurrent,j=this.fragmentTracker;if(!T.live&&U&&U.sn===T.endSN&&!m.nextStart){var F=j.getState(U);return F===M.FragmentState.PARTIAL||F===M.FragmentState.OK}return!1},a.onMediaAttached=function(m,T){var U=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),U.addEventListener("seeking",this.onvseeking),U.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(j.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.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 m=this.config,T=this.fragCurrent,U=this.media,j=this.mediaBuffer,F=this.state,V=U?U.currentTime:0,P=G.BufferHelper.bufferInfo(j||U,V,m.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+F),F===b.ENDED)this.resetLoadingState();else if(T&&!P.len){var I=m.maxFragLookUpTolerance,X=T.start-I,oe=T.start+T.duration+I,pe=V>oe;(V<X||pe)&&(pe&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}U&&(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(m,T){if(this.state!==b.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var U=this.levels[T.frag.level].details;U&&this.loadFragment(T.frag,U,T.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(_.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(m,T){this.log("Loading key for "+m.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(_.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,T,U){this._loadFragForPlayback(m,T,U)},a._loadFragForPlayback=function(m,T,U){var j=this,F=function(P){if(j.fragContextChanged(m)){j.warn("Fragment "+m.sn+(P.part?" p: "+P.part.index:"")+" of level "+m.level+" was dropped during download."),j.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,j._handleFragmentLoadProgress(P)};this._doFragLoad(m,T,U,F).then(function(V){if(!V)return;j.fragLoadError=0;var P=j.state;if(j.fragContextChanged(m)){(P===b.FRAG_LOADING||P===b.BACKTRACKING||!j.fragCurrent&&P===b.PARSING)&&(j.fragmentTracker.removeFragment(m),j.state=b.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+m.sn+" of level "+m.level),j.hls.trigger(_.Events.FRAG_LOADED,V),j.state===b.BACKTRACKING)){j.fragmentTracker.backtrack(m,V),j.resetFragmentLoading(m);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,T,U){if(U===void 0&&(U=null),!(m-T))return;var j={startOffset:m,endOffset:T,type:U};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(m){var T=this;this._doFragLoad(m).then(function(U){if(!U||T.fragContextChanged(m)||!T.levels)throw new Error("init load aborted");return U}).then(function(U){var j=T.hls,F=U.payload,V=m.decryptdata;if(F&&F.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var P=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(F),V.key.buffer,V.iv.buffer).then(function(I){var X=self.performance.now();return j.trigger(_.Events.FRAG_DECRYPTED,{frag:m,payload:I,stats:{tstart:P,tdecrypt:X}}),U.payload=I,U})}return U}).then(function(U){var j=T.fragCurrent,F=T.hls,V=T.levels;if(!V)throw new Error("init load aborted, missing levels");var P=V[m.level].details;console.assert(P,"Level details are defined when init segment is loaded");var I=m.stats;T.state=b.IDLE,T.fragLoadError=0,m.data=new Uint8Array(U.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),U.frag===j&&F.trigger(_.Events.FRAG_BUFFERED,{stats:I,frag:j,part:null,id:m.type}),T.tick()}).catch(function(U){T.warn(U),T.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var T=this.fragCurrent;return!m||!T||m.level!==T.level||m.sn!==T.sn||m.urlId!==T.urlId},a.fragBufferedComplete=function(m,T){var U=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(G.BufferHelper.getBuffered(U))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var T=this.transmuxer;if(!T)return;var U=m.frag,j=m.part,F=m.partsLoaded,V=!F||F.length===0||F.some(function(I){return!I}),P=new y.ChunkMetadata(U.level,U.sn,U.stats.chunkCount+1,0,j?j.index:-1,!V);T.flush(P)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,T,U,j){var F=this;if(U===void 0&&(U=null),!this.levels)throw new Error("frag load aborted, missing levels");if(U=Math.max(m.start,U||0),this.config.lowLatencyMode&&T){var V=T.partList;if(V&&j){U>m.end&&T.fragmentHint&&(m=T.fragmentHint);var P=this.getNextPart(V,m,U);if(P>-1){var I=V[P];return this.log("Loading part sn: "+m.sn+" p: "+I.index+" cc: "+m.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+P+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(U.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=b.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:m,part:V[P],targetBufferTime:U}),this.doFragPartsLoad(m,V,P,j).catch(function(X){return F.handleFragLoadError(X)})}else if(!m.url||this.loadedEndOfParts(V,U))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(U.toFixed(3))),Object(Z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:m,targetBufferTime:U}),this.fragmentLoader.load(m,j).catch(function(X){return F.handleFragLoadError(X)})},a.doFragPartsLoad=function(m,T,U,j){var F=this;return new Promise(function(V,P){var I=[],X=function oe(pe){var ve=T[pe];F.fragmentLoader.loadPart(m,ve,j).then(function(Le){I[ve.index]=Le;var ke=Le.part;F.hls.trigger(_.Events.FRAG_LOADED,Le);var he=T[pe+1];if(he&&he.fragment===m)oe(pe+1);else return V({frag:m,part:ke,partsLoaded:I})}).catch(P)};X(U)})},a.handleFragLoadError=function(m){var T=m.data;return T&&T.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(_.Events.ERROR,T),null},a._handleTransmuxerFlush=function(m){var T=this.getCurrentContext(m);if(!T||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var U=T.frag,j=T.part,F=T.level,V=self.performance.now();U.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(U,j,F,m.partial)},a.getCurrentContext=function(m){var T=this.levels,U=m.level,j=m.sn,F=m.part;if(!T||!T[U])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+U+". The current chunk will not be buffered."),null;var V=T[U],P=F>-1?Object(x.getPartWith)(V,j,F):null,I=P?P.fragment:Object(x.getFragmentWithSN)(V,j,this.fragCurrent);return I?{frag:I,part:P,level:V}:null},a.bufferFragmentData=function(m,T,U,j){if(!m||this.state!==b.PARSING)return;var F=m.data1,V=m.data2,P=F;if(F&&V&&(P=Object(A.appendUint8Array)(F,V)),!P||!P.length)return;var I={type:m.type,frag:T,part:U,chunkMeta:j,parent:T.type,data:P};this.hls.trigger(_.Events.BUFFER_APPENDING,I),m.dropped&&m.independent&&!U&&this.flushBufferGap(T)},a.flushBufferGap=function(m){var T=this.media;if(!T)return;if(!G.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,m.start);return}var U=T.currentTime,j=G.BufferHelper.bufferInfo(T,U,0),F=m.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),P=Math.max(Math.min(m.start-V,j.end-V),U+V);m.start-P>V&&this.flushMainBuffer(P,m.start)},a.getFwdBufferInfo=function(m,T){var U=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var F=G.BufferHelper.bufferInfo(m,j,U.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,T);if(V&&F.nextStart<V.end)return G.BufferHelper.bufferInfo(m,j,Math.max(F.nextStart,U.maxBufferHole))}return F},a.getMaxBufferLength=function(m){var T=this.config,U;return m?U=Math.max(8*T.maxBufferSize/m,T.maxBufferLength):U=T.maxBufferLength,Math.min(U,T.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var T=this.config,U=m||T.maxBufferLength;return T.maxMaxBufferLength>=U?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,T){var U,j,F=T.fragments,V=F.length;if(!V)return null;var P=this.config,I=F[0].start,X;if(T.live){var oe=P.initialLiveManifestSize;if(V<oe)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+oe+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(T,F),this.startPosition=X?this.hls.liveSyncPosition||X.start:m)}else m<=I&&(X=F[0]);if(!X){var pe=P.lowLatencyMode?T.partEnd:T.fragmentEnd;X=this.getFragmentAtPosition(m,pe,T)}return(U=X)!==null&&U!==void 0&&U.initSegment&&!((j=X)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},a.getNextPart=function(m,T,U){for(var j=-1,F=!1,V=!0,P=0,I=m.length;P<I;P++){var X=m[P];if(V=V&&!X.independent,j>-1&&U<X.start)break;var oe=X.loaded;!oe&&(F||X.independent||V)&&X.fragment===T&&(j=P),F=oe}return j},a.loadedEndOfParts=function(m,T){var U=m[m.length-1];return U&&T>U.start&&U.loaded},a.getInitialLiveFragment=function(m,T){var U=this.fragPrevious,j=null;if(U){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+U.programDateTime),j=Object(k.findFragmentByPDT)(T,U.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var F=U.sn+1;if(F>=m.startSN&&F<=m.endSN){var V=T[F-m.startSN];U.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(k.findFragWithCC)(T,U.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?m.fragmentEnd:m.edge,m))}return j},a.getFragmentAtPosition=function(m,T,U){var j=this.config,F=this.fragPrevious,V=U.fragments,P=U.endSN,I=U.fragmentHint,X=j.maxFragLookUpTolerance,oe=!!(j.lowLatencyMode&&U.partList&&I);oe&&I&&!this.bitrateTest&&(V=V.concat(I),P=I.sn);var pe;if(m<T){var ve=m>T-X?0:X;pe=Object(k.findFragmentByPTS)(F,V,m,ve)}else pe=V[V.length-1];if(pe){var Le=pe.sn-U.startSN,ke=F&&pe.level===F.level,he=V[Le+1],ae=this.fragmentTracker.getState(pe);if(ae===M.FragmentState.BACKTRACKED){pe=null;for(var ue=Le;V[ue]&&this.fragmentTracker.getState(V[ue])===M.FragmentState.BACKTRACKED;)F?pe=V[ue--]:pe=V[--ue];pe||(pe=he)}else F&&pe.sn===F.sn&&!oe&&(ke&&(pe.sn<P&&this.fragmentTracker.getState(he)!==M.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+he.sn),pe=he):pe=null))}return pe},a.synchronizeToLiveEdge=function(m){var T=this.config,U=this.media;if(!U)return;var j=this.hls.liveSyncPosition,F=U.currentTime,V=m.fragments[0].start,P=m.edge,I=F>=V-T.maxFragLookUpTolerance&&F<=P;if(j!==null&&U.duration>j&&(F<j||!I)){var X=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*m.targetduration;(!I&&U.readyState<4||F<P-X)&&(this.loadedmetadata||(this.nextLoadPosition=j),U.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+j.toFixed(3)),U.currentTime=j))}},a.alignPlaylists=function(m,T){var U=this.levels,j=this.levelLastLoaded,F=this.fragPrevious,V=j!==null?U[j]:null,P=m.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var I=m.fragments[0].start,X=!T,oe=m.alignedSliding&&Object(Z.isFiniteNumber)(I);if(X||!oe&&!I){Object(R.alignStream)(F,V,m);var pe=m.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+m.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+P),pe}return I},a.waitForCdnTuneIn=function(m){var T=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*T)},a.setStartPosition=function(m,T){var U=this.startPosition;if(U<T&&(U=-1),U===-1||this.lastCurrentTime===-1){var j=m.startTimeOffset;Object(Z.isFiniteNumber)(j)?(U=T+j,j<0&&(U+=m.totalduration),U=Math.min(Math.max(T,U),T+m.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+U),this.startPosition=U):m.live?U=this.hls.liveSyncPosition||T:this.startPosition=U=0,this.lastCurrentTime=U}this.nextLoadPosition=U},a.getLoadPosition=function(){var m=this.media,T=0;return this.loadedmetadata&&m?T=m.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},a.handleFragLoadAborted=function(m,T){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(T?" part"+T.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,T){if(T.fatal)return;var U=T.frag;if(!U||U.type!==m)return;var j=this.fragCurrent;console.assert(j&&U.sn===j.sn&&U.level===j.level&&U.urlId===j.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(U.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+U.sn+" of "+m+" "+U.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(W.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,T,U){if(!m)return;var j=G.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(T,j,U),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[m].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,T,U,j){var F=this,V=U.details;console.assert(!!V,"level.details must be defined");var P=Object.keys(m.elementaryStreams).reduce(function(I,X){var oe=m.elementaryStreams[X];if(oe){var pe=oe.endPTS-oe.startPTS;if(pe<=0)return F.warn("Could not parse fragment "+m.sn+" "+X+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),I||!1;var ve=j?0:Object(x.updateFragPTSDTS)(V,m,oe.startPTS,oe.endPTS,oe.startDTS,oe.endDTS);return F.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:V,level:U,drift:ve,type:X,frag:m,start:oe.startPTS,end:oe.endPTS}),!0}return I},!1);P?(this.state=b.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:m,part:T})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(l,[{key:"state",get:function(){return this._state},set:function(m){var T=this._state;T!==m&&(this._state=m,this.log(T+"->"+m))}}]),l}(B.default)},"./src/controller/buffer-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),M=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),W=D("./src/utils/buffer-helper.ts"),_=D("./src/utils/mediasource-helper.ts"),O=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),A=Object(_.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,k=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 u=o.hls,d=o.media,S=o.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),u.trigger(B.Events.MEDIA_ATTACHED,{media:d})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var E=x.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var o=this.hls;o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(B.Events.BUFFER_RESET,this.onBufferReset,this),o.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(B.Events.BUFFER_EOS,this.onBufferEos,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(B.Events.FRAG_PARSED,this.onFragParsed,this),o.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(B.Events.BUFFER_RESET,this.onBufferReset,this),o.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(B.Events.BUFFER_EOS,this.onBufferEos,this),o.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(B.Events.FRAG_PARSED,this.onFragParsed,this),o.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,u){var d=2;(u.audio&&!u.video||!u.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,u){var d=this.media=u.media;if(d&&A){var S=this.mediaSource=new A;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}},E.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,d=this._objectUrl;if(u){if(M.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(S){M.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):M.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(B.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var d=o.sourceBuffer[u];try{d&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[u]=void 0)}catch(S){M.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",S)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,u){var d=this,S=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(v){if(S){var p=d.tracks[v];if(p&&typeof p.buffer.changeType=="function"){var w=u[v],b=w.codec,s=w.levelCodec,f=w.container,l=(p.levelCodec||p.codec).replace(R,"$1"),a=(s||b).replace(R,"$1");if(l!==a){var C=f+";codecs="+(s||b);d.appendChangeType(v,C)}}}else d.pendingTracks[v]=u[v]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,u){var d=this,S=this.operationQueue,v={execute:function(){var w=d.sourceBuffer[o];w&&(M.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),w.changeType(u)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){M.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(v,o)},E.onBufferAppending=function(o,u){var d=this,S=this.hls,v=this.operationQueue,p=this.tracks,w=u.data,b=u.type,s=u.frag,f=u.part,l=u.chunkMeta,a=l.buffering[b],C=self.performance.now();a.start=C;var m=s.stats.buffering,T=f?f.stats.buffering:null;m.start===0&&(m.start=C),T&&T.start===0&&(T.start=C);var U=p.audio,j=b==="audio"&&l.id===1&&(U==null?void 0:U.container)==="audio/mpeg",F={execute:function(){if(a.executeStart=self.performance.now(),j){var P=d.sourceBuffer[b];if(P){var I=s.start-P.timestampOffset;Math.abs(I)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+s.start+" (delta: "+I+") sn: "+s.sn+")"),P.timestampOffset=s.start)}}d.appendExecutor(w,b)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,m.first===0&&(m.first=P),T&&T.first===0&&(T.first=P);var I=d.sourceBuffer,X={};for(var oe in I)X[oe]=W.BufferHelper.getBuffered(I[oe]);d.appendError=0,d.hls.trigger(B.Events.BUFFER_APPENDED,{type:b,frag:s,part:f,chunkMeta:l,parent:s.type,timeRanges:X})},onError:function(P){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",P);var I={type:G.ErrorTypes.MEDIA_ERROR,parent:s.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=G.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,I.details=G.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>S.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),S.trigger(B.Events.ERROR,I)}};v.append(F,b)},E.onBufferFlushing=function(o,u){var d=this,S=this.operationQueue,v=function(w){return{execute:d.removeExecutor.bind(d,w,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(B.Events.BUFFER_FLUSHED,{type:w})},onError:function(s){M.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",s)}}};u.type?S.append(v(u.type),u.type):this.getSourceBufferTypes().forEach(function(p){S.append(v(p),p)})},E.onFragParsed=function(o,u){var d=this,S=u.frag,v=u.part,p=[],w=v?v.elementaryStreams:S.elementaryStreams;w[O.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(w[O.ElementaryStreamTypes.AUDIO]&&p.push("audio"),w[O.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var f=self.performance.now();S.stats.buffering.end=f,v&&(v.stats.buffering.end=f);var l=v?v.stats:S.stats;d.hls.trigger(B.Events.FRAG_BUFFERED,{frag:S,part:v,stats:l,id:S.type})};p.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,p)},E.onFragChanged=function(o,u){this.flushBackBuffer()},E.onBufferEos=function(o,u){var d=this,S=this.getSourceBufferTypes().reduce(function(v,p){var w=d.sourceBuffer[p];return(!u.type||u.type===p)&&(w&&!w.ended&&(w.ended=!0,M.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),v&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var v=d.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},E.onLevelUpdated=function(o,u){var d=u.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,u=this.details,d=this.media,S=this.sourceBuffer;if(!d||u===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var p=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(p)||p<0)return;var w=d.currentTime,b=u.levelTargetDuration,s=Math.max(p,b),f=Math.floor(w/b)*b-s;v.forEach(function(l){var a=S[l];if(a){var C=W.BufferHelper.getBuffered(a);C.length>0&&f>C.start(0)&&(o.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),u.live&&o.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:l}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,d=this.media,S=this.mediaSource,v=o.fragments[0].start+o.totalduration,p=d.duration,w=Object(Z.isFiniteNumber)(S.duration)?S.duration:0;o.live&&u.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(v>w&&v>p||!Object(Z.isFiniteNumber)(p))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),S.duration=v)},E.updateSeekableRange=function(o){var u=this.mediaSource,d=o.fragments,S=d.length;if(S&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var v=Math.max(0,d[0].start),p=Math.max(v,v+o.totalduration);u.setLiveSeekableRange(v,p)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,d=this.pendingTracks,S=Object.keys(d).length;if(S&&!o||S===2){this.createSourceBuffers(d),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(p){u.executeNext(p)})}},E.createSourceBuffers=function(o){var u=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var v in o)if(!u[v]){var p=o[v];if(!p)throw Error("source buffer exists for track "+v+", however track does not");var w=p.levelCodec||p.codec,b=p.container+";codecs="+w;M.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var s=u[v]=d.addSourceBuffer(b),f=v;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[v]={buffer:s,codec:w,container:p.container,levelCodec:p.levelCodec,id:p.id},S++}catch(l){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}S&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var u=this.operationQueue,d=u.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var u=this.operationQueue,d=u.current(o);d.onComplete(),u.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,u){M.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(u)},E.removeExecutor=function(o,u,d){var S=this.media,v=this.mediaSource,p=this.operationQueue,w=this.sourceBuffer,b=w[o];if(!S||!v||!b){M.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var s=Object(Z.isFiniteNumber)(S.duration)?S.duration:Infinity,f=Object(Z.isFiniteNumber)(v.duration)?v.duration:Infinity,l=Math.max(0,u),a=Math.min(d,s,f);a>l?(M.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):p.shiftAndExecuteNext(o)},E.appendExecutor=function(o,u){var d=this.operationQueue,S=this.sourceBuffer,v=S[u];if(!v){M.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(u);return}v.ended=!1,console.assert(!v.updating,u+" sourceBuffer must not be updating"),v.appendBuffer(o)},E.blockBuffers=function(o,u){var d=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,v=u.map(function(p){return S.appendBlocker(p)});Promise.all(v).then(function(){o(),u.forEach(function(p){var w=d.sourceBuffer[p];(!w||!w.updating)&&S.shiftAndExecuteNext(p)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,u,d){var S=this.sourceBuffer[o];if(!S)return;var v=d.bind(this,o);this.listeners[o].push({event:u,listener:v}),S.addEventListener(u,v)},E.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(d){u.removeEventListener(d.event,d.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return B});var Z=D("./src/utils/logger.ts"),B=function(){function M(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var G=M.prototype;return G.append=function(_,O){var y=this.queues[O];y.push(_),y.length===1&&this.buffers[O]&&this.executeNext(O)},G.insertAbort=function(_,O){var y=this.queues[O];y.unshift(_),this.executeNext(O)},G.appendBlocker=function(_){var O,y=new Promise(function(R){O=R}),A={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,_),y},G.executeNext=function(_){var O=this.buffers,y=this.queues,A=O[_],R=y[_];if(R.length){var k=R[0];try{k.execute()}catch(x){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),k.onError(x),(!A||!A.updating)&&(R.shift(),this.executeNext(_))}}},G.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},G.current=function(_){return this.queues[_][0]},M}()},"./src/controller/cap-level-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts");function B(W,_){for(var O=0;O<_.length;O++){var y=_[O];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(W,y.key,y)}}function M(W,_,O){return _&&B(W.prototype,_),O&&B(W,O),W}var G=function(){function W(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=W.prototype;return _.setStreamController=function(y){this.streamController=y},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var y=this.hls;y.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var y=this.hls;y.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(y,A){W.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},_.onMediaAttaching=function(y,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},_.onManifestParsed=function(y,A){var R=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,R.config.capLevelToPlayerSize&&A.video&&this.startCapping()},_.onBufferCodecs=function(y,A){var R=this.hls;R.config.capLevelToPlayerSize&&A.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(y.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},_.getMaxLevel=function(y){var A=this,R=this.hls.levels;if(!R.length)return-1;var k=R.filter(function(x,E){return W.isLevelAllowed(E,A.restrictedLevels)&&E<=y});return this.clientRect=null,W.getMaxLevelByMediaSize(k,this.mediaWidth,this.mediaHeight)},_.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()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,A={width:0,height:0};if(y){var R=y.getBoundingClientRect();A.width=R.width,A.height=R.height,!A.width&&!A.height&&(A.width=R.right-R.left||y.width||0,A.height=R.bottom-R.top||y.height||0)}return this.clientRect=A,A},W.isLevelAllowed=function(y,A){return A===void 0&&(A=[]),A.indexOf(y)===-1},W.getMaxLevelByMediaSize=function(y,A,R){if(!y||!y.length)return-1;for(var k=function(u,d){return d?u.width!==d.width||u.height!==d.height:!0},x=y.length-1,E=0;E<y.length;E+=1){var h=y[E];if((h.width>=A||h.height>=R)&&k(h,y[E+1])){x=E;break}}return x},M(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(A){}return y}}]),W}();$.default=G},"./src/controller/cmcd-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return k});var Z=D("./src/events.ts"),B=D("./src/types/cmcd.ts"),M=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function W(x,E){for(var h=0;h<E.length;h++){var o=E[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function _(x,E,h){return E&&W(x.prototype,E),h&&W(x,h),x}function O(x,E){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=y(x))||E&&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 y(x,E){if(!x)return;if(typeof x=="string")return A(x,E);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 A(x,E)}function A(x,E){(E==null||E>x.length)&&(E=x.length);for(var h=0,o=new Array(E);h<E;h++)o[h]=x[h];return o}function R(){return R=Object.assign||function(x){for(var E=1;E<arguments.length;E++){var h=arguments[E];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(x[o]=h[o])}return x},R.apply(this,arguments)}var k=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:B.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){G.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(S){try{var v=S.frag,p=o.hls.levels[v.level],w=o.getObjectType(v),b={d:v.duration*1e3,ot:w};(w===B.CMCDObjectType.VIDEO||w===B.CMCDObjectType.AUDIO||w==B.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=o.getTopBandwidth(w),b.bl=o.getBufferLength(w)),o.apply(S,b)}catch(s){G.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=h;var u=this.config=h.config,d=u.cmcd;d!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||x.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=x.prototype;return E.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)},E.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()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,u){var d,S;this.audioBuffer=(d=u.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(S=u.tracks.video)===null||S===void 0?void 0:S.buffer},E.createData=function(){var o;return{v:B.CMCDVersion,sf:B.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}},E.apply=function(o,u){u===void 0&&(u={}),R(u,this.createData());var d=u.ot===B.CMCDObjectType.INIT||u.ot===B.CMCDObjectType.VIDEO||u.ot===B.CMCDObjectType.MUXED;if(this.starved&&d&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var S=x.toHeaders(u);if(!Object.keys(S).length)return;o.headers||(o.headers={}),R(o.headers,S)}else{var v=x.toQuery(u);if(!v)return;o.url=x.appendQueryToUri(o.url,v)}},E.getObjectType=function(o){var u=o.type;return u==="subtitle"?B.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?B.CMCDObjectType.INIT:u==="audio"?B.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(o){for(var u=0,d=o===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=O(d),v;!(v=S()).done;){var p=v.value;p.bitrate>u&&(u=p.bitrate)}return u>0?u:NaN},E.getBufferLength=function(o){var u=this.hls.media,d=o===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!u)return NaN;var S=M.BufferHelper.bufferInfo(d,u.currentTime,this.config.maxBufferHole);return S.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(w,b,s){u(w),this.loader.load(w,b,s)},_(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(w,b,s){u(w),this.loader.load(w,b,s)},_(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),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},x.serialize=function(o){for(var u=[],d=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},S=function(j){return Math.round(j)},v=function(j){return S(j/100)*100},p=function(j){return encodeURIComponent(j)},w={br:S,d:S,bl:v,dl:v,mtp:v,nor:p,rtp:v,tb:S},b=Object.keys(o||{}).sort(),s=O(b),f;!(f=s()).done;){var l=f.value,a=o[l];if(!d(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var C=w[l];C&&(a=C(a));var m=typeof a,T=void 0;l==="ot"||l==="sf"||l==="st"?T=l+"="+a:m==="boolean"?T=l:m==="number"?T=l+"="+a:T=l+"="+JSON.stringify(a),u.push(T)}return u.join(",")},x.toHeaders=function(o){for(var u=Object.keys(o),d={},S=["Object","Request","Session","Status"],v=[{},{},{},{}],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=u;w<b.length;w++){var s=b[w],f=p[s]!=null?p[s]:1;v[f][s]=o[s]}for(var l=0;l<v.length;l++){var a=x.serialize(v[l]);a&&(d["CMCD-"+S[l]]=a)}return d},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,u){if(!u)return o;var d=o.includes("?")?"&":"?";return""+o+d+u},x}()},"./src/controller/eme-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function W(k,x){for(var E=0;E<x.length;E++){var h=x[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function _(k,x,E){return x&&W(k.prototype,x),E&&W(k,E),k}var O=3,y=function(x,E,h){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:h.audioRobustness||""})}),E.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:h.videoRobustness||""})}),[o]},A=function(x,E,h,o){switch(x){case G.KeySystems.WIDEVINE:return y(E,h,o);default:throw new Error("Unknown key-system: "+x)}},R=function(){function k(E){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=E,this._config=E.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=k.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 G.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,u){var d=this,S=A(h,o,u,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,S);this.mediaKeysPromise=v.then(function(p){return d._onMediaKeySystemAccessObtained(h,p)}),v.catch(function(p){M.logger.error('Failed to obtain key-system "'+h+'" access:',p)})},x._onMediaKeySystemAccessObtained=function(h,o){var u=this;M.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(v){return d.mediaKeys=v,M.logger.log('Media-keys created for key-system "'+h+'"'),u._onMediaKeysCreated(),v});return S.catch(function(v){M.logger.error("Failed to create media-keys:",v)}),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;M.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(u){o._onKeySessionMessage(h,u.message)},!1)},x._onKeySessionMessage=function(h,o){M.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){M.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),h.update(u)})},x.onMediaEncrypted=function(h){var o=this;if(M.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(u).catch(u)},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){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(h,o){var u=this,d=this._mediaKeysList[0];if(!d){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var S=d.mediaKeysSession;if(!S){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,S.generateRequest(h,o).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(v){M.logger.error("Error generating key-session request:",v),u.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(h,o,u){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,u);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,d,h),S=void 0}catch(v){M.logger.error(v)}try{d.readyState||d.open("POST",h,!0),S&&S.call(this.hls,d,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return d},x._onLicenseRequestReadyStageChange=function(h,o,u,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var S=h.response,v=this._licenseResponseCallback;if(v)try{S=v.call(this.hls,h,o)}catch(w){M.logger.error(w)}d(S)}else{if(M.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=O-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(u,d)}break}},x._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},x._requestLicense=function(h,o){M.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(u.mediaKeySystemDomain),S=this._createLicenseXhr(d,h,o);M.logger.log("Sending license request to URL: "+d);var v=this._generateLicenseRequestChallenge(u,h);S.send(v)}catch(p){M.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.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(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var u=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(G.KeySystems.WIDEVINE,u,d)},_(k,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),k}();$.default=R},"./src/controller/fps-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),M=function(){function G(_){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=_,this.registerListeners()}var W=G.prototype;return W.setStreamController=function(O){this.streamController=O},W.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(O,y){var A=this.hls.config;if(A.capLevelOnFPSDrop){var R=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(O,y,A){var R=performance.now();if(y){if(this.lastTime){var k=R-this.lastTime,x=A-this.lastDroppedFrames,E=y-this.lastDecodedFrames,h=1e3*x/k,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:x,currentDecoded:E,totalDroppedFrames:A}),h>0&&x>o.config.fpsDroppedMonitoringThreshold*E){var u=o.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=A,this.lastDecodedFrames=y}},W.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var y=O.getVideoPlaybackQuality();this.checkFPS(O,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},G}();$.default=M},"./src/controller/fragment-finders.ts":function(ce,$,D){"use strict";D.r($),D.d($,"findFragmentByPDT",function(){return M}),D.d($,"findFragmentByPTS",function(){return G}),D.d($,"fragmentWithinToleranceTest",function(){return W}),D.d($,"pdtWithinToleranceTest",function(){return _}),D.d($,"findFragWithCC",function(){return O});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/binary-search.ts");function M(y,A,R){if(A===null||!Array.isArray(y)||!y.length||!Object(Z.isFiniteNumber)(A))return null;var k=y[0].programDateTime;if(A<(k||0))return null;var x=y[y.length-1].endProgramDateTime;if(A>=(x||0))return null;R=R||0;for(var E=0;E<y.length;++E){var h=y[E];if(_(A,R,h))return h}return null}function G(y,A,R,k){R===void 0&&(R=0),k===void 0&&(k=0);var x=null;if(y?x=A[y.sn-A[0].sn+1]||null:R===0&&A[0].start===0&&(x=A[0]),x&&W(R,k,x)===0)return x;var E=B.default.search(A,W.bind(null,R,k));return E||x}function W(y,A,R){y===void 0&&(y=0),A===void 0&&(A=0);var k=Math.min(A,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-k<=y?1:R.start-k>y&&R.start?-1:0}function _(y,A,R){var k=Math.min(A,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,x=R.endProgramDateTime||0;return x-k>y}function O(y,A){return B.default.search(y,function(R){return R.cc<A?1:R.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,$,D){"use strict";D.r($),D.d($,"FragmentState",function(){return M}),D.d($,"FragmentTracker",function(){return G});var Z=D("./src/events.ts"),B=D("./src/types/loader.ts"),M;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(M||(M={}));var G=function(){function O(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var y=O.prototype;return y._registerListeners=function(){var R=this.hls;R.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var R=this.hls;R.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(R,k){if(k===B.PlaylistLevelType.MAIN){var x=this.activeFragment,E=this.activeParts;if(!x)return null;if(E)for(var h=E.length;h--;){var o=E[h],u=o?o.end:x.appendedPTS;if(o.start<=R&&u!==void 0&&R<=u)return h>9&&(this.activeParts=E.slice(h-9)),o}else if(x.start<=R&&x.appendedPTS!==void 0&&R<=x.appendedPTS)return x}return this.getBufferedFrag(R,k)},y.getBufferedFrag=function(R,k){for(var x=this.fragments,E=Object.keys(x),h=E.length;h--;){var o=x[E[h]];if((o==null?void 0:o.body.type)===k&&o.buffered){var u=o.body;if(u.start<=R&&R<=u.end)return u}}return null},y.detectEvictedFragments=function(R,k,x){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(!o.buffered){o.body.type===x&&E.removeFragment(o.body);return}var u=o.range[R];if(!u)return;u.time.some(function(d){var S=!E.isTimeBuffered(d.startPTS,d.endPTS,k);return S&&E.removeFragment(o.body),S})})},y.detectPartialFragments=function(R){var k=this,x=this.timeRanges,E=R.frag,h=R.part;if(!x||E.sn==="initSegment")return;var o=_(E),u=this.fragments[o];if(!u)return;Object.keys(x).forEach(function(d){var S=E.elementaryStreams[d];if(!S)return;var v=x[d],p=h!==null||S.partial===!0;u.range[d]=k.getBufferedTimes(E,h,p,v)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(R){var k=_(R),x=this.fragments[k];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},y.getBufferedTimes=function(R,k,x,E){for(var h={time:[],partial:x},o=k?k.start:R.start,u=k?k.end:R.end,d=R.minEndPTS||u,S=R.maxStartPTS||o,v=0;v<E.length;v++){var p=E.start(v)-this.bufferPadding,w=E.end(v)+this.bufferPadding;if(S>=p&&d<=w){h.time.push({startPTS:Math.max(o,E.start(v)),endPTS:Math.min(u,E.end(v))});break}else if(o<w&&u>p)h.partial=!0,h.time.push({startPTS:Math.max(o,E.start(v)),endPTS:Math.min(u,E.end(v))});else if(u<=p)break}return h},y.getPartialFragment=function(R){var k=null,x,E,h,o=0,u=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(S){var v=d[S];if(!v)return;W(v)&&(E=v.body.start-u,h=v.body.end+u,R>=E&&R<=h&&(x=Math.min(R-E,h-R),o<=x&&(k=v.body,o=x)))}),k},y.getState=function(R){var k=_(R),x=this.fragments[k];return x?x.buffered?W(x)?M.PARTIAL:M.OK:x.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},y.backtrack=function(R,k){var x=_(R),E=this.fragments[x];if(!E||E.backtrack)return null;var h=E.backtrack=k||E.loaded;return E.loaded=null,h},y.getBacktrackData=function(R){var k=_(R),x=this.fragments[k];if(x){var E,h=x.backtrack;if(h!=null&&(E=h.payload)!==null&&E!==void 0&&E.byteLength)return h;this.removeFragment(R)}return null},y.isTimeBuffered=function(R,k,x){for(var E,h,o=0;o<x.length;o++){if(E=x.start(o)-this.bufferPadding,h=x.end(o)+this.bufferPadding,R>=E&&k<=h)return!0;if(k<=E)return!1}return!1},y.onFragLoaded=function(R,k){var x=k.frag,E=k.part;if(x.sn==="initSegment"||x.bitrateTest||E)return;var h=_(x);this.fragments[h]={body:x,loaded:k,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(R,k){var x=this,E=k.frag,h=k.part,o=k.timeRanges;if(E.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=E,h){var u=this.activeParts;u||(this.activeParts=u=[]),u.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 v=0;v<S.length;v++)E.appendedPTS=Math.max(S.end(v),E.appendedPTS||0)})},y.onFragBuffered=function(R,k){this.detectPartialFragments(k)},y.hasFragment=function(R){var k=_(R);return!!this.fragments[k]},y.removeFragmentsInRange=function(R,k,x){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(o.buffered){var u=o.body;u.type===x&&u.start<k&&u.end>R&&E.removeFragment(u)}})},y.removeFragment=function(R){var k=_(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[k]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function W(O){var y,A;return O.buffered&&(((y=O.range.video)===null||y===void 0?void 0:y.partial)||((A=O.range.audio)===null||A===void 0?void 0:A.partial))}function _(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"STALL_MINIMUM_DURATION_MS",function(){return W}),D.d($,"MAX_START_GAP_JUMP",function(){return _}),D.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),D.d($,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d($,"default",function(){return A});var Z=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),M=D("./src/events.ts"),G=D("./src/utils/logger.ts"),W=250,_=2,O=.1,y=.05,A=function(){function R(x,E,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=E,this.fragmentTracker=h,this.hls=o}var k=R.prototype;return k.destroy=function(){this.hls=this.fragmentTracker=this.media=null},k.poll=function(E){var h=this.config,o=this.media,u=this.stalled,d=o.currentTime,S=o.seeking,v=this.seeking&&!S,p=!this.seeking&&S;if(this.seeking=S,d!==E){if(this.moved=!0,u!==null){if(this.stallReported){var w=self.performance.now()-u;G.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var b=Z.BufferHelper.bufferInfo(o,d,0),s=b.len>0,f=b.nextStart||0;if(!s&&!f)return;if(S){var l=b.len>_,a=!f||f-d>_&&!this.fragmentTracker.getPartialFragment(d);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,m=Math.max(f,b.start||0)-d,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=T==null||((C=T.details)===null||C===void 0)?void 0:C.live,j=U?T.details.targetduration*2:_;if(m>0&&m<=j){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(u===null){this.stalled=F;return}var V=F-u;!S&&V>=W&&this._reportStall(b.len);var P=Z.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(P,V)},k._tryFixBufferStall=function(E,h){var o=this.config,u=this.fragmentTracker,d=this.media,S=d.currentTime,v=u.getPartialFragment(S);if(v){var p=this._trySkipBufferHole(v);if(p)return}E.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},k._reportStall=function(E){var h=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),h.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},k._trySkipBufferHole=function(E){for(var h=this.config,o=this.hls,u=this.media,d=u.currentTime,S=0,v=Z.BufferHelper.getBuffered(u),p=0;p<v.length;p++){var w=v.start(p);if(d+h.maxBufferHole>=S&&d<w){var b=Math.max(w+y,u.currentTime+O);return G.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,E&&o.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:E}),b}S=v.end(p)}return 0},k._tryNudgeBuffer=function(){var E=this.config,h=this.hls,o=this.media,u=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var S=u+d*E.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+u+" to "+S),o.currentTime=S,h.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+E.nudgeMaxRetry+" nudges"),h.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),M=D("./src/demux/id3.ts"),G=.25,W=function(){function _(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var O=_.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var A=this.hls;A.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var A=this.hls;A.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(A,R){this.media=R.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(A){if(!this.media)return;for(var R=0;R<A.length;R++){var k=A[R];if(k.kind==="metadata"&&k.label==="id3")return Object(B.sendAddTrackEvent)(k,this.media),k}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(A,R){if(!this.media)return;var k=R.frag,x=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<x.length;h++){var o=M.getID3Frames(x[h].data);if(o){var u=x[h].pts,d=h<x.length-1?x[h+1].pts:k.end,S=d-u;S<=0&&(d=u+G);for(var v=0;v<o.length;v++){var p=o[v];if(!M.isTimeStampFrame(p)){var w=new E(u,d,"");w.value=p,this.id3Track.addCue(w)}}}}},O.onBufferFlushing=function(A,R){var k=R.startOffset,x=R.endOffset,E=R.type;if(!E||E==="audio"){var h=this.id3Track;h&&Object(B.removeCuesInRange)(h,k,x)}},_}();$.default=W},"./src/controller/latency-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return _});var Z=D("./src/errors.ts"),B=D("./src/events.ts"),M=D("./src/utils/logger.ts");function G(O,y){for(var A=0;A<y.length;A++){var R=y[A];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(O,R.key,R)}}function W(O,y,A){return y&&G(O.prototype,y),A&&G(O,A),O}var _=function(){function O(A){var R=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 R.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var y=O.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},y.onMediaAttached=function(R,k){this.media=k.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(R,k){var x=k.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(R,k){if(k.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var R=this.media,k=this.levelDetails;if(!R||!k)return;this.currentTime=R.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var E=this.config,h=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!h||o===1)return;var u=this.targetLatency;if(u===null)return;var d=x-u,S=Math.min(this.maxLatency,u+k.targetduration),v=d<S;if(k.live&&v&&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;R.playbackRate=Math.min(p,Math.max(1,w))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},y.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},y.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},W(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,k=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:k?R.liveMaxLatencyDurationCount*k.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var k=R.holdBack,x=R.partHoldBack,E=R.targetduration,h=this.config,o=h.liveSyncDuration,u=h.liveSyncDurationCount,d=h.lowLatencyMode,S=this.hls.userConfig,v=d&&x||k;(S.liveSyncDuration||S.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:u*E);var p=E,w=1;return v+Math.min(this.stallCount*w,p)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),k=this.targetLatency,x=this.levelDetails;if(R===null||k===null||x===null)return null;var E=x.edge,h=R-k-this.edgeStalled,o=E-x.totalduration,u=E-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,h),u)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var k=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-k,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,k=this.levelDetails;if(!R||!k)return 0;var x=R.buffered.length;return x?R.buffered.end(x-1):k.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return h});var Z=D("./src/types/level.ts"),B=D("./src/events.ts"),M=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),W=D("./src/controller/level-helper.ts"),_=D("./src/controller/base-playlist-controller.ts"),O=D("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var d=arguments[u];for(var S in d)Object.prototype.hasOwnProperty.call(d,S)&&(o[S]=d[S])}return o},y.apply(this,arguments)}function A(o,u){for(var d=0;d<u.length;d++){var S=u[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,u,d){return u&&A(o.prototype,u),d&&A(o,d),o}function k(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,x(o,u)}function x(o,u){return x=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},x(o,u)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){k(u,o);function u(S){var v;return v=o.call(this,S,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var d=u.prototype;return d._registerListeners=function(){var v=this.hls;v.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(B.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var v=this.hls;v.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(B.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 v=this._levels;v.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(v,p){var w=[],b=[],s=[],f,l={},a,C=!1,m=!1,T=!1;if(p.levels.forEach(function(V){var P=V.attrs;C=C||!!(V.width&&V.height),m=m||!!V.videoCodec,T=T||!!V.audioCodec,E&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var I=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=l[I],a?a.url.push(V.url):(a=new Z.Level(V),l[I]=a,w.push(a)),P&&(P.AUDIO&&Object(W.addGroupId)(a,"audio",P.AUDIO),P.SUBTITLES&&Object(W.addGroupId)(a,"text",P.SUBTITLES))}),(C||m)&&T&&(w=w.filter(function(V){var P=V.videoCodec,I=V.width,X=V.height;return!!P||!!(I&&X)})),w=w.filter(function(V){var P=V.audioCodec,I=V.videoCodec;return(!P||Object(G.isCodecSupportedInMp4)(P,"audio"))&&(!I||Object(G.isCodecSupportedInMp4)(I,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(b)),p.subtitles&&(s=p.subtitles,Object(W.assignTrackIdsByGroup)(s)),w.length>0){f=w[0].bitrate,w.sort(function(V,P){return V.bitrate-P.bitrate}),this._levels=w;for(var U=0;U<w.length;U++)if(w[U].bitrate===f){this._firstLevel=U,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+f);break}var j=T&&!m,F={levels:w,audioTracks:b,subtitleTracks:s,firstLevel:this._firstLevel,stats:p.stats,audio:T,video:m,altAudio:!j&&b.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(v,p){if(o.prototype.onError.call(this,v,p),p.fatal)return;var w=p.context,b=this._levels[this.currentLevelIndex];if(w&&(w.type===O.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&w.groupId===b.audioGroupIds[b.urlId]||w.type===O.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&w.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var s=!1,f=!0,l;switch(p.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=p.frag.level)):l=p.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(f=!1),l=w.level),s=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:l=p.level,s=!0;break}l!==void 0&&this.recoverLevel(p,l,s,f)},d.recoverLevel=function(v,p,w,b){var s=v.details,f=this._levels[p];if(f.loadError++,w){var l=this.retryLoadingOrFail(v);if(l)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=f.url.length;if(a>1&&f.loadError<a)v.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var C=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(s+": switch to "+C),v.levelRetry=!0,this.hls.nextAutoLevel=C)}}},d.redundantFailover=function(v){var p=this._levels[v],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(s){s.urlId=b}),this.level=v}},d.onFragLoaded=function(v,p){var w=p.frag;if(w!==void 0&&w.type===O.PlaylistLevelType.MAIN){var b=this._levels[w.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(v,p){var w,b=p.level,s=p.details,f=this._levels[b];if(!f){var l;this.warn("Invalid level index "+b),(l=p.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(s.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&&(s.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(v,p){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var b=-1,s=this.hls.audioTracks[p.id].groupId,f=0;f<w.audioGroupIds.length;f++)if(w.audioGroupIds[f]===s){b=f;break}b!==w.urlId&&(w.urlId=b,this.startLoad())}},d.loadPlaylist=function(v){var p=this.currentLevelIndex,w=this._levels[p];if(this.canLoad&&w&&w.url.length>0){var b=w.urlId,s=w.url[b];if(v)try{s=v.addDirectives(s)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+p+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+b+" "+s),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:s,level:p,id:b,deliveryDirectives:v||null})}},d.removeLevel=function(v,p){var w=function(f,l){return l!==p},b=this._levels.filter(function(s,f){return f!==v?!0:s.url.length>1&&p!==void 0?(s.url=s.url.filter(w),s.audioGroupIds&&(s.audioGroupIds=s.audioGroupIds.filter(w)),s.textGroupIds&&(s.textGroupIds=s.textGroupIds.filter(w)),s.urlId=0,!0):!1}).map(function(s,f){var l=s.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=f}),s});this._levels=b,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:b})},R(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var p,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===v&&(p=w[v])!==null&&p!==void 0&&p.details)return;if(v<0||v>=w.length){var b=v<0;if(this.hls.trigger(B.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:b,reason:"invalid level idx"}),b)return;v=Math.min(v,w.length-1)}this.clearTimer();var s=this.currentLevelIndex,f=w[s],l=w[v];this.log("switching to level "+v+" from "+s),this.currentLevelIndex=v;var a=y({},l,{level:v,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,a);var C=l.details;if(!C||C.live){var m=this.switchParams(l.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),u}(_.default)},"./src/controller/level-helper.ts":function(ce,$,D){"use strict";D.r($),D.d($,"addGroupId",function(){return M}),D.d($,"assignTrackIdsByGroup",function(){return G}),D.d($,"updatePTS",function(){return W}),D.d($,"updateFragPTSDTS",function(){return O}),D.d($,"mergeDetails",function(){return y}),D.d($,"mapPartIntersection",function(){return A}),D.d($,"mapFragmentIntersection",function(){return R}),D.d($,"adjustSliding",function(){return k}),D.d($,"addSliding",function(){return x}),D.d($,"computeReloadInterval",function(){return E}),D.d($,"getFragmentWithSN",function(){return h}),D.d($,"getPartWith",function(){return o});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts");function M(u,d,S){switch(d){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(S);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(S);break}}function G(u){var d={};u.forEach(function(S){var v=S.groupId||"";S.id=d[v]=d[v]||0,d[v]++})}function W(u,d,S){var v=u[d],p=u[S];_(v,p)}function _(u,d){var S=d.startPTS;if(Object(Z.isFiniteNumber)(S)){var v=0,p;d.sn>u.sn?(v=S-u.start,p=u):(v=u.start-S,p=d),p.duration!==v&&(p.duration=v)}else if(d.sn>u.sn){var w=u.cc===d.cc;w&&u.minEndPTS?d.start=u.start+(u.minEndPTS-u.start):d.start=u.start+u.duration}else d.start=Math.max(u.start-d.duration,0)}function O(u,d,S,v,p,w){var b=v-S;b<=0&&(B.logger.warn("Fragment should have a positive duration",d),v=S+d.duration,w=p+d.duration);var s=S,f=v,l=d.startPTS,a=d.endPTS;if(Object(Z.isFiniteNumber)(l)){var C=Math.abs(l-S);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(C,d.deltaPTS):d.deltaPTS=C,s=Math.max(S,l),S=Math.min(S,l),p=Math.min(p,d.startDTS),f=Math.min(v,a),v=Math.max(v,a),w=Math.max(w,d.endDTS)}d.duration=v-S;var m=S-d.start;d.appendedPTS=v,d.start=d.startPTS=S,d.maxStartPTS=s,d.startDTS=p,d.endPTS=v,d.minEndPTS=f,d.endDTS=w;var T=d.sn;if(!u||T<u.startSN||T>u.endSN)return 0;var U,j=T-u.startSN,F=u.fragments;for(F[j]=d,U=j;U>0;U--)_(F[U],F[U-1]);for(U=j;U<F.length-1;U++)_(F[U],F[U+1]);return u.fragmentHint&&_(F[F.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function y(u,d){for(var S=null,v=u.fragments,p=v.length-1;p>=0;p--){var w=v[p].initSegment;if(w){S=w;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,s;if(R(u,d,function(U,j){U.relurl&&(b=U.cc-j.cc),Object(Z.isFiniteNumber)(U.startPTS)&&Object(Z.isFiniteNumber)(U.endPTS)&&(j.start=j.startPTS=U.startPTS,j.startDTS=U.startDTS,j.appendedPTS=U.appendedPTS,j.maxStartPTS=U.maxStartPTS,j.endPTS=U.endPTS,j.endDTS=U.endDTS,j.minEndPTS=U.minEndPTS,j.duration=U.endPTS-U.startPTS,j.duration&&(s=j),d.PTSKnown=d.alignedSliding=!0),j.elementaryStreams=U.elementaryStreams,j.loader=U.loader,j.stats=U.stats,j.urlId=U.urlId,U.initSegment&&(j.initSegment=U.initSegment,S=U.initSegment)}),S){var f=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;f.forEach(function(U){var j;(!U.initSegment||U.initSegment.relurl===((j=S)===null||j===void 0?void 0:j.relurl))&&(U.initSegment=S)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(U){return!U}),d.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=d.skippedSegments;l--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<a.length;C++)a[C].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(u.partList,d.partList,function(U,j){j.elementaryStreams=U.elementaryStreams,j.stats=U.stats}),s?O(d,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):k(u,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=u.driftStartTime,d.driftStart=u.driftStart;var m=d.advancedDateTime;if(d.advanced&&m){var T=d.edge;d.driftStart||(d.driftStartTime=m,d.driftStart=T),d.driftEndTime=m,d.driftEnd=T}else d.driftEndTime=u.driftEndTime,d.driftEnd=u.driftEnd,d.advancedDateTime=u.advancedDateTime}function A(u,d,S){if(u&&d)for(var v=0,p=0,w=u.length;p<=w;p++){var b=u[p],s=d[p+v];b&&s&&b.index===s.index&&b.fragment.sn===s.fragment.sn?S(b,s):v--}}function R(u,d,S){for(var v=d.skippedSegments,p=Math.max(u.startSN,d.startSN)-d.startSN,w=(u.fragmentHint?1:0)+(v?d.endSN:Math.min(u.endSN,d.endSN))-d.startSN,b=d.startSN-u.startSN,s=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=p;l<=w;l++){var a=f[b+l],C=s[l];v&&!C&&l<v&&(C=d.fragments[l]=a),a&&C&&S(a,C)}}function k(u,d){var S=d.startSN+d.skippedSegments-u.startSN,v=u.fragments;if(S<0||S>=v.length)return;x(d,v[S].start)}function x(u,d){if(d){for(var S=u.fragments,v=u.skippedSegments;v<S.length;v++)S[v].start+=d;u.fragmentHint&&(u.fragmentHint.start+=d)}}function E(u,d){var S=1e3*u.levelTargetDuration,v=S/2,p=u.age,w=p>0&&p<S*3,b=d.loading.end-d.loading.start,s,f=u.availabilityDelay;if(u.updated===!1)if(w){var l=333*u.misses;s=Math.max(Math.min(v,b*2),l),u.availabilityDelay=(u.availabilityDelay||0)+s}else s=v;else w?(f=Math.min(f||S/2,p),u.availabilityDelay=f,s=f+S-p):s=S-b;return Math.round(s)}function h(u,d,S){if(!u||!u.details)return null;var v=u.details,p=v.fragments[d-v.startSN];return p||(p=v.fragmentHint,p&&p.sn===d?p:d<v.startSN&&S&&S.sn===d?S:null)}function o(u,d,S){if(!u||!u.details)return null;var v=u.details.partList;if(v)for(var p=v.length;p--;){var w=v[p];if(w.index===S&&w.fragment.sn===d)return w}return null}},"./src/controller/stream-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return v});var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),M=D("./src/is-supported.ts"),G=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),R=D("./src/types/transmuxer.ts"),k=D("./src/controller/gap-controller.ts"),x=D("./src/errors.ts"),E=D("./src/utils/logger.ts");function h(p,w){for(var b=0;b<w.length;b++){var s=w[b];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}function o(p,w,b){return w&&h(p.prototype,w),b&&h(p,b),p}function u(p,w){p.prototype=Object.create(w.prototype),p.prototype.constructor=p,d(p,w)}function d(p,w){return d=Object.setPrototypeOf||function(s,f){return s.__proto__=f,s},d(p,w)}var S=100,v=function(p){u(w,p);function w(s,f){var l;return l=p.call(this,s,f,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var b=w.prototype;return b._registerListeners=function(){var f=this.hls;f.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(G.Events.ERROR,this.onError,this),f.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var f=this.hls;f.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(G.Events.ERROR,this.onError,this),f.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(f){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=a.startLevel;C===-1&&(a.config.testBandwidth?(C=0,this.bitrateTest=!0):C=a.nextAutoLevel),this.level=a.nextLoadLevel=C,this.loadedmetadata=!1}l>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),f=l),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var f,l=this.levels,a=this.level,C=l==null||((f=l[a])===null||f===void 0)?void 0:f.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var m,T=self.performance.now(),U=this.retryDate;(!U||T>=U||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var f,l,a=this.hls,C=this.levelLastLoaded,m=this.levels,T=this.media,U=a.config,j=a.nextLoadLevel;if(C===null||!T&&(this.startFragRequested||!U.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[j])return;var F=m[j];this.level=a.nextLoadLevel=j;var V=F.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=B.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,O.PlaylistLevelType.MAIN);if(P===null)return;var I=P.len,X=this.getMaxBufferLength(F.maxBitrate);if(I>=X)return;if(this._streamEnded(P,V)){var oe={};this.altAudio&&(oe.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,oe),this.state=B.State.ENDED;return}var pe=P.end,ve=this.getNextFragment(pe,V);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Le=ve.sn-V.startSN;Le>1&&(ve=V.fragments[Le-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===_.FragmentState.OK&&this.nextLoadPosition>pe){var ke=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,ke,O.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"&&!((l=ve.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ve,V):this.loadFragment(ve,V,pe)},b.loadFragment=function(f,l,a){var C,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===_.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(f);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else m=_.FragmentState.NOT_LOADED}m===_.FragmentState.NOT_LOADED||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,l,a)):m===_.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(f){var l=this.fragmentTracker.getAppendedFrag(f,O.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,O.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,l=this.media;if(l!=null&&l.readyState){var a,C=this.getAppendedFrag(l.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!l.paused&&f){var m=this.hls.nextLoadLevel,T=f[m],U=this.fragLastKbps;U&&this.fragCurrent?a=this.fragCurrent.duration*T.maxBitrate/(1e3*U)+1:a=0}else a=0;var j=this.getBufferedFrag(l.currentTime+a);if(j){var F=this.followingBufferedFrag(j);if(F){this.abortCurrentFrag();var V=F.maxStartPTS?F.maxStartPTS:F.start,P=F.duration,I=Math.max(j.end,V+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(f,l){p.prototype.flushMainBuffer.call(this,f,l,this.altAudio?"video":null)},b.onMediaAttached=function(f,l){p.prototype.onMediaAttached.call(this,f,l);var a=l.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 k.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,l=f?f.currentTime:null;Object(Z.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(f,l){var a=!1,C=!1,m;l.levels.forEach(function(T){m=T.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=a&&C&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(f,l){var a=this.levels;if(!a||this.state!==B.State.IDLE)return;var C=a[l.level];(!C.details||C.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(C.details))&&(this.state=B.State.WAITING_LEVEL)},b.onLevelLoaded=function(f,l){var a,C=this.levels,m=l.level,T=l.details,U=T.totalduration;if(!C){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+U);var j=this.fragCurrent;j&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==l.level&&j.loader&&(this.state=B.State.IDLE,j.loader.abort()));var F=C[m],V=0;if(T.live||(a=F.details)!==null&&a!==void 0&&a.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;V=this.alignPlaylists(T,F.details)}if(F.details=T,this.levelLastLoaded=m,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:T,level:m}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=B.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,V),this.tick()},b._handleFragmentLoadProgress=function(f){var l,a=f.frag,C=f.part,m=f.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var U=T[a.level],j=U.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var F=U.videoCodec,V=j.PTSKnown||!j.live,P=(l=a.initSegment)===null||l===void 0?void 0:l.data,I=this._getAudioCodec(U),X=this.transmuxer=this.transmuxer||new A.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),oe=C?C.index:-1,pe=oe!==-1,ve=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,oe,pe),Le=this.initPTS[a.cc];X.push(m,P,I,F,a,C,j.totalduration,V,ve,Le)},b.onAudioTrackSwitching=function(f,l){var a=this.altAudio,C=!!l.url,m=l.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var U=this.hls;a&&U.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),U.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(f,l){var a=l.id,C=!!this.hls.audioTracks[a].url;if(C){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=C,this.tick()},b.onBufferCreated=function(f,l){var a=l.tracks,C,m,T=!1;for(var U in a){var j=a[U];if(j.id==="main"){if(m=U,C=j,U==="video"){var F=a[U];F&&(this.videoBuffer=F.buffer)}}else T=!0}T&&C?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(f,l){var a=l.frag,C=l.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(C?" p: "+C.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var m=C?C.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,C)},b.onError=function(f,l){switch(l.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(O.PlaylistLevelType.MAIN,l);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=B.State.ERROR):!l.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var a=!0,C=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);C&&C.len>.5&&(a=!this.reduceMaxBufferLength(C.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,l=this.gapController;if(!f||!l||!f.readyState)return;var a=W.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(f,l){var a=l.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,a,O.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(f,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var f=this.media,l=f.currentTime,a=this.startPosition;if(a>=0&&l<a){if(f.seeking){E.logger.log("could not seek to "+a+", already seeking at "+l);return}var C=W.BufferHelper.getBuffered(f),m=C.length?C.start(0):0,T=m-a;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+T+" to match buffer start"),a+=T,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),f.currentTime=a}},b._getAudioCodec=function(f){var l=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},b._loadBitrateTestFrag=function(f){var l=this;this._doFragLoad(f).then(function(a){var C=l.hls;if(!a||C.nextLoadLevel||l.fragContextChanged(f))return;l.fragLoadError=0,l.state=B.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),C.trigger(G.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(f){var l,a="main",C=this.hls,m=f.remuxResult,T=f.chunkMeta,U=this.getCurrentContext(T);if(!U){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var j=U.frag,F=U.part,V=U.level,P=m.video,I=m.text,X=m.id3,oe=m.initSegment,pe=this.altAudio?void 0:m.audio;if(this.fragContextChanged(j))return;if(this.state=B.State.PARSING,oe){oe.tracks&&(this._bufferInitSegment(V,oe.tracks,j,T),C.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:a,tracks:oe.tracks}));var ve=oe.initPTS,Le=oe.timescale;Object(Z.isFiniteNumber)(ve)&&(this.initPTS[j.cc]=ve,C.trigger(G.Events.INIT_PTS_FOUND,{frag:j,id:a,initPTS:ve,timescale:Le}))}if(P&&m.independent!==!1){if(V.details){var ke=P.startPTS,he=P.endPTS,ae=P.startDTS,ue=P.endDTS;if(F)F.elementaryStreams[P.type]={startPTS:ke,endPTS:he,startDTS:ae,endDTS:ue};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<ke){this.backtrack(j);return}j.setElementaryStreamInfo(P.type,j.start,he,j.start,ue,!0)}j.setElementaryStreamInfo(P.type,ke,he,ae,ue),this.bufferFragmentData(P,j,F,T)}}else if(m.independent===!1){this.backtrack(j);return}if(pe){var se=pe.startPTS,J=pe.endPTS,ee=pe.startDTS,ne=pe.endDTS;F&&(F.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:J,startDTS:ee,endDTS:ne}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,se,J,ee,ne),this.bufferFragmentData(pe,j,F,T)}if(X!=null&&(l=X.samples)!==null&&l!==void 0&&l.length){var fe={frag:j,id:a,samples:X.samples};C.trigger(G.Events.FRAG_PARSING_METADATA,fe)}if(I){var Ae={frag:j,id:a,samples:I.samples};C.trigger(G.Events.FRAG_PARSING_USERDATA,Ae)}},b._bufferInitSegment=function(f,l,a,C){var m=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var T=l.audio,U=l.video,j=l.audiovideo;if(T){var F=f.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),T.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(F="mp4a.40.5")),V.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),f.audioCodec&&f.audioCodec!==F&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+F+'"'),T.levelCodec=F,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(f.audioCodec||"")+"/"+T.codec+"]")}U&&(U.levelCodec=f.videoCodec,U.id="main",this.log("Init video buffer, container:"+U.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+U.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(P){var I=l[P],X=I.initSegment;X!=null&&X.byteLength&&m.hls.trigger(G.Events.BUFFER_APPENDING,{type:P,data:X,frag:a,part:null,chunkMeta:C,parent:a.type})}),this.tick()},b.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var l=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,l?this.resetFragmentLoading(f):this.state=B.State.BACKTRACKING},b.checkFragmentChanged=function(){var f=this.media,l=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(W.BufferHelper.isBuffered(f,a)?l=this.getAppendedFrag(a):W.BufferHelper.isBuffered(f,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var C=this.fragPlaying,m=l.level;(!C||l.sn!==C.sn||C.level!==m||l.urlId!==C.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:l}),(!C||C.level!==m)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},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 l=this.getAppendedFrag(f.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var l=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"SubtitleStreamController",function(){return u});var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),M=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),W=D("./src/utils/discontinuities.ts"),_=D("./src/controller/level-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),R=D("./src/types/level.ts");function k(d,S){for(var v=0;v<S.length;v++){var p=S[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(d,p.key,p)}}function x(d,S,v){return S&&k(d.prototype,S),v&&k(d,v),d}function E(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,u=function(d){E(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 v=S.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._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)},v._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)},v.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(w,b){this.mainDetails=b.details},v.onSubtitleFragProcessed=function(w,b){var s=b.frag,f=b.success;if(this.fragPrevious=s,this.state=y.State.IDLE,!f)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,C=s.start,m=0;m<l.length;m++)if(C>=l[m].start&&C<=l[m].end){a=l[m];break}var T=s.start+s.duration;a?a.end=T:(a={start:C,end:T},l.push(a)),this.fragmentTracker.fragBuffered(s)},v.onBufferFlushing=function(w,b){var s=b.startOffset,f=b.endOffset;if(s===0&&f!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var C=a[l].details,m=C.targetduration,T=f-m;if(T<=0)return;b.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(U){for(var j=0;j<U.length;){if(U[j].end<=T){U.shift();continue}else if(U[j].start<T)U[j].start=T;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(s,T,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(w,b){var s,f=b.frag;if(!f||f.type!==A.PlaylistLevelType.SUBTITLE)return;(s=this.fragCurrent)!==null&&s!==void 0&&s.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},v.onSubtitleTracksUpdated=function(w,b){var s=this,f=b.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(l){return new R.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){s.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(w,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(w,b){var s,f=b.details,l=b.id,a=this.currentTrackId,C=this.levels;if(!C.length)return;var m=C[a];if(l>=C.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(s=m.details)!==null&&s!==void 0&&s.live){var T=this.mainDetails;if(f.deltaUpdateFailed||!T)return;var U=T.fragments[0];if(!m.details)f.hasProgramDateTime&&T.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(f,T):U&&Object(_.addSliding)(f,U.start);else{var j=this.alignPlaylists(f,m.details);j===0&&U&&Object(_.addSliding)(f,U.start)}}if(m.details=f,this.levelLastLoaded=l,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var F=Object(G.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(w){var b=w.frag,s=w.payload,f=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(s&&s.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(s),f.key.buffer,f.iv.buffer).then(function(C){var m=performance.now();l.trigger(Z.Events.FRAG_DECRYPTED,{frag:b,payload:C,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var w,b=this.currentTrackId,s=this.levels;if(!s.length||!s[b]||!s[b].details)return;var f=s[b].details,l=f.targetduration,a=this.config,C=this.media,m=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-l,a.maxBufferHole),T=m.end,U=m.len,j=this.getMaxBufferLength()+l;if(U>j)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var F=f.fragments,V=F.length,P=f.edge,I,X=this.fragPrevious;if(T<P){var oe=a.maxFragLookUpTolerance;X&&f.hasProgramDateTime&&(I=Object(G.findFragmentByPDT)(F,X.endProgramDateTime,oe)),I||(I=Object(G.findFragmentByPTS)(X,F,T,oe),!I&&X&&X.start<F[0].start&&(I=F[0]))}else I=F[V-1];(w=I)!==null&&w!==void 0&&w.encrypted?(B.logger.log("Loading key for "+I.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===O.FragmentState.NOT_LOADED&&this.loadFragment(I,f,T)}},v.loadFragment=function(w,b,s){this.fragCurrent=w,d.prototype.loadFragment.call(this,w,b,s)},x(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(y.default)},"./src/controller/subtitle-track-controller.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),M=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function W(k,x){for(var E=0;E<x.length;E++){var h=x[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function _(k,x,E){return x&&W(k.prototype,x),E&&W(k,E),k}function O(k,x){k.prototype=Object.create(x.prototype),k.prototype.constructor=k,y(k,x)}function y(k,x){return y=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},y(k,x)}var A=function(k){O(x,k);function x(h){var o;return o=k.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 E=x.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,k.prototype.destroy.call(this)},E.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)},E.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)},E.onMediaAttached=function(o,u){if(this.media=u.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)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.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=R(this.media.textTracks);o.forEach(function(u){Object(B.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},E.onSubtitleTrackLoaded=function(o,u){var d=u.id,S=u.details,v=this.trackId,p=this.tracksInGroup[v];if(!p){this.warn("Invalid subtitle track id "+d);return}var w=p.details;p.details=u.details,this.log("subtitle track "+d+" loaded ["+S.startSN+"-"+S.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,u,w))},E.onLevelLoading=function(o,u){this.switchLevel(u.level)},E.onLevelSwitching=function(o,u){this.switchLevel(u.level)},E.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var d=u.textGroupIds[u.urlId];if(this.groupId!==d){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=v;var p=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=d;var w={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,w),p!==-1&&this.setSubtitleTrack(p,S)}},E.findTrackId=function(o){for(var u=this.tracksInGroup,d=0;d<u.length;d++){var S=u[d];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},E.onError=function(o,u){if(k.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},E.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var d=u.id,S=u.groupId,v=u.url;if(o)try{v=o.addDirectives(v)}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:v,id:d,groupId:S,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var u=this,d=this.media,S=this.subtitleDisplay,v=this.trackId;if(!d)return;var p=R(d.textTracks),w=p.filter(function(f){return f.groupId===u.groupId});if(o===-1)[].slice.call(p).forEach(function(f){f.mode="disabled"});else{var b=w[v];b&&(b.mode="disabled")}var s=w[o];s&&(s.mode=S?"showing":"hidden")},E.setSubtitleTrack=function(o,u){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 v=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var p=v.id,w=v.groupId,b=w===void 0?"":w,s=v.name,f=v.type,l=v.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:s,type:f,url:l});var a=this.switchParams(v.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=R(this.media.textTracks),d=0;d<u.length;d++)if(u[d].mode==="hidden")o=d;else if(u[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},_(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),x}(M.default);function R(k){for(var x=[],E=0;E<k.length;E++){var h=k[E];h.kind==="subtitles"&&h.label&&x.push(k[E])}return x}$.default=A},"./src/controller/timeline-controller.ts":function(ce,$,D){"use strict";D.r($),D.d($,"TimelineController",function(){return R});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),M=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),W=D("./src/utils/webvtt-parser.ts"),_=D("./src/utils/texttrack-utils.ts"),O=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),R=function(){function h(u){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=E(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 G.default(this,"textTrack1"),S=new G.default(this,"textTrack2"),v=new G.default(this,"textTrack3"),p=new G.default(this,"textTrack4");this.cea608Parser1=new M.default(1,d,S),this.cea608Parser2=new M.default(3,v,p)}u.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(B.Events.FRAG_LOADING,this.onFragLoading,this),u.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(B.Events.FRAG_LOADING,this.onFragLoading,this),d.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,S,v,p,w){for(var b=!1,s=w.length;s--;){var f=w[s],l=x(f[0],f[1],S,v);if(l>=0&&(f[0]=Math.min(f[0],S),f[1]=Math.max(f[1],v),b=!0,l/(v-S)>.5))return}if(b||w.push([S,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,S,v,p)}else{var C=this.Cues.newCue(null,S,v,p);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:C,track:d})}},o.onInitPtsFound=function(d,S){var v=this,p=S.frag,w=S.id,b=S.initPTS,s=S.timescale,f=this.unparsedVttFrags;w==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=s),f.length&&(this.unparsedVttFrags=[],f.forEach(function(l){v.onFragLoaded(B.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(d){var S=this.media;if(S)for(var v=0;v<S.textTracks.length;v++){var p=S.textTracks[v];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,v=this.captionsTracks,p=this.media,w=S[d],b=w.label,s=w.languageCode,f=this.getExistingTrack(d);if(f)v[d]=f,Object(_.clearCurrentCues)(v[d]),Object(_.sendAddTrackEvent)(v[d],p);else{var l=this.createTextTrack("captions",b,s);l&&(l[d]=!0,v[d]=l)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var S=this.captionsProperties[d];if(!S)return;var v=S.label,p={_id:d,label:v,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[d]=p,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(d,S,v){var p=this.media;return p?p.addTextTrack(d,S,v):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(_.clearCurrentCues)(d[S]),delete d[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),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 v=0;v<S.length;v++)Object(_.clearCurrentCues)(S[v])},o.onSubtitleTracksUpdated=function(d,S){var v=this;this.textTracks=[];var p=S.subtitleTracks||[],w=p.some(function(l){return l.textCodec===O.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 s=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var C;if(a<s.length){for(var m=null,T=0;T<s.length;T++)if(k(s[T],l)){m=s[T];break}m&&(C=m)}C?Object(_.clearCurrentCues)(C):(C=v.createTextTrack("subtitles",l.name,l.lang),C&&(C.mode="disabled")),C&&(C.groupId=l.groupId,v.textTracks.push(C))})}else if(!b&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(d,S){var v=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],s=v.captionsProperties[b];if(!s)return;s.label=p.name,p.lang&&(s.languageCode=p.lang),s.media=p})},o.onFragLoading=function(d,S){var v=this.cea608Parser1,p=this.cea608Parser2,w=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(v&&p))return;if(S.frag.type===y.PlaylistLevelType.MAIN){var s,f,l=S.frag.sn,a=(s=S==null||((f=S.part)===null||f===void 0)?void 0:f.index)!=null?s:-1;l===w+1||l===w&&a===b+1||(v.reset(),p.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(d,S){var v=S.frag,p=S.payload,w=this.initPTS,b=this.unparsedVttFrags;if(v.type===y.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Z.isFiniteNumber)(w[v.cc])){b.push(S),w.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var s=v.decryptdata;if(s==null||s.key==null||s.method!=="AES-128"){var f=this.tracks[v.level],l=this.vttCCs;l[v.cc]||(l[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),f&&f.textCodec===O.IMSC1_CODEC?this._parseIMSC1(v,p):this._parseVTTs(v,p,l)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,S){var v=this,p=this.hls;Object(O.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(w){v._appendCues(w,d.level),p.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(w){A.logger.log("Failed to parse IMSC1: "+w),p.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:w})})},o._parseVTTs=function(d,S,v){var p=this,w=this.hls;Object(W.parseWebVTT)(S,this.initPTS[d.cc],this.timescale[d.cc],v,d.cc,d.start,function(b){p._appendCues(b,d.level),w.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){p._fallbackToIMSC1(d,S),A.logger.log("Failed to parse VTT cue: "+b),w.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,S){var v=this,p=this.tracks[d.level];p.textCodec||Object(O.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(){p.textCodec=O.IMSC1_CODEC,v._parseIMSC1(d,S)},function(){p.textCodec="wvtt"})},o._appendCues=function(d,S){var v=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[S];if(p.mode==="disabled")return;d.forEach(function(s){return Object(_.addCueToTrack)(p,s)})}else{var w=this.tracks[S],b=w.default?"default":"subtitles"+S;v.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,S){var v=S.frag;if(v.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(B.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,S){var v=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(v&&p))return;for(var w=0;w<S.samples.length;w++){var b=S.samples[w].bytes;if(b){var s=this.extractCea608Data(b);v.addData(S.samples[w].pts,s[0]),p.addData(S.samples[w].pts,s[1])}}},o.onBufferFlushing=function(d,S){var v=S.startOffset,p=S.endOffset,w=S.endOffsetSubtitles,b=S.type,s=this.media;if(!s||s.currentTime<p)return;if(!b||b==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(_.removeCuesInRange)(f[a],v,p)})}if(this.config.renderTextTracksNatively&&(v===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(_.removeCuesInRange)(l[a],v,w)})}},o.extractCea608Data=function(d){for(var S=d[0]&31,v=2,p=[[],[]],w=0;w<S;w++){var b=d[v++],s=127&d[v++],f=127&d[v++],l=(4&b)!==0,a=3&b;if(s===0&&f===0)continue;l&&((a===0||a===1)&&(p[a].push(s),p[a].push(f)))}return p},h}();function k(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function x(h,o,u,d){return Math.min(o,d)-Math.max(h,u)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return Z});var Z=function(){function B(G,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=W}var M=B.prototype;return M.decrypt=function(W,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,W)},B}()},"./src/crypt/aes-decryptor.ts":function(ce,$,D){"use strict";D.r($),D.d($,"removePadding",function(){return B}),D.d($,"default",function(){return M});var Z=D("./src/utils/typed-array.ts");function B(G){var W=G.byteLength,_=W&&new DataView(G.buffer).getUint8(W-1);return _?Object(Z.sliceUint8)(G,0,W-_):G}var M=function(){function G(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var W=G.prototype;return W.uint8ArrayToUint32Array_=function(O){for(var y=new DataView(O),A=new Uint32Array(4),R=0;R<4;R++)A[R]=y.getUint32(R*4);return A},W.initTable=function(){var O=this.sBox,y=this.invSBox,A=this.subMix,R=A[0],k=A[1],x=A[2],E=A[3],h=this.invSubMix,o=h[0],u=h[1],d=h[2],S=h[3],v=new Uint32Array(256),p=0,w=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){var s=w^w<<1^w<<2^w<<3^w<<4;s=s>>>8^s&255^99,O[p]=s,y[s]=p;var f=v[p],l=v[f],a=v[l],C=v[s]*257^s*16843008;R[p]=C<<24|C>>>8,k[p]=C<<16|C>>>16,x[p]=C<<8|C>>>24,E[p]=C,C=a*16843009^l*65537^f*257^p*16843008,o[s]=C<<24|C>>>8,u[s]=C<<16|C>>>16,d[s]=C<<8|C>>>24,S[s]=C,p?(p=f^v[v[v[a^f]]],w^=v[v[w]]):p=w=1}},W.expandKey=function(O){for(var y=this.uint8ArrayToUint32Array_(O),A=!0,R=0;R<y.length&&A;)A=y[R]===this.key[R],R++;if(A)return;this.key=y;var k=this.keySize=y.length;if(k!==4&&k!==6&&k!==8)throw new Error("Invalid aes key size="+k);var x=this.ksRows=(k+6+1)*4,E,h,o=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),d=this.sBox,S=this.rcon,v=this.invSubMix,p=v[0],w=v[1],b=v[2],s=v[3],f,l;for(E=0;E<x;E++){if(E<k){f=o[E]=y[E];continue}l=f,E%k===0?(l=l<<8|l>>>24,l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[l&255],l^=S[E/k|0]<<24):k>6&&E%k===4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[l&255]),o[E]=f=(o[E-k]^l)>>>0}for(h=0;h<x;h++)E=x-h,h&3?l=o[E]:l=o[E-4],h<4||E<=4?u[h]=l:u[h]=p[d[l>>>24]]^w[d[l>>>16&255]]^b[d[l>>>8&255]]^s[d[l&255]],u[h]=u[h]>>>0},W.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},W.decrypt=function(O,y,A){for(var R=this.keySize+6,k=this.invKeySchedule,x=this.invSBox,E=this.invSubMix,h=E[0],o=E[1],u=E[2],d=E[3],S=this.uint8ArrayToUint32Array_(A),v=S[0],p=S[1],w=S[2],b=S[3],s=new Int32Array(O),f=new Int32Array(s.length),l,a,C,m,T,U,j,F,V,P,I,X,oe,pe,ve=this.networkToHostOrderSwap;y<s.length;){for(V=ve(s[y]),P=ve(s[y+1]),I=ve(s[y+2]),X=ve(s[y+3]),T=V^k[0],U=X^k[1],j=I^k[2],F=P^k[3],oe=4,pe=1;pe<R;pe++)l=h[T>>>24]^o[U>>16&255]^u[j>>8&255]^d[F&255]^k[oe],a=h[U>>>24]^o[j>>16&255]^u[F>>8&255]^d[T&255]^k[oe+1],C=h[j>>>24]^o[F>>16&255]^u[T>>8&255]^d[U&255]^k[oe+2],m=h[F>>>24]^o[T>>16&255]^u[U>>8&255]^d[j&255]^k[oe+3],T=l,U=a,j=C,F=m,oe=oe+4;l=x[T>>>24]<<24^x[U>>16&255]<<16^x[j>>8&255]<<8^x[F&255]^k[oe],a=x[U>>>24]<<24^x[j>>16&255]<<16^x[F>>8&255]<<8^x[T&255]^k[oe+1],C=x[j>>>24]<<24^x[F>>16&255]<<16^x[T>>8&255]<<8^x[U&255]^k[oe+2],m=x[F>>>24]<<24^x[T>>16&255]<<16^x[U>>8&255]<<8^x[j&255]^k[oe+3],f[y]=ve(l^v),f[y+1]=ve(m^p),f[y+2]=ve(C^w),f[y+3]=ve(a^b),v=V,p=P,w=I,b=X,y=y+4}return f.buffer},G}()},"./src/crypt/decrypter.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return y});var Z=D("./src/crypt/aes-crypto.ts"),B=D("./src/crypt/fast-aes-key.ts"),M=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/typed-array.ts"),O=16,y=function(){function A(k,x,E){var h=E===void 0?{}:E,o=h.removePKCS7Padding,u=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=k,this.config=x,this.removePKCS7Padding=u,u)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=A.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var E=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(E):E},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(x,E,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),E,h);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),E,h).then(o)},R.softwareDecrypt=function(x,E,h){var o=this.currentIV,u=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(x=Object(W.appendUint8Array)(d,x),this.remainderData=null);var S=this.getValidChunk(x);if(!S.length)return null;o&&(h=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new M.default),v.expandKey(E);var p=u;return this.currentResult=v.decrypt(S.buffer,0,h),this.currentIV=Object(_.sliceUint8)(S,-16).buffer,p||null},R.webCryptoDecrypt=function(x,E,h){var o=this,u=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new B.default(u,E)),this.fastAesKey.expandKey().then(function(d){if(!u)return Promise.reject(new Error("web crypto not initialized"));var S=new Z.default(u,h);return S.decrypt(x.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,x,E,h)})},R.onWebCryptoError=function(x,E,h,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,h,o)},R.getValidChunk=function(x){var E=x,h=x.length-x.length%O;return h!==x.length&&(E=Object(_.sliceUint8)(x,0,h),this.remainderData=Object(_.sliceUint8)(x,h)),E},R.logOnce=function(x){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return Z});var Z=function(){function B(G,W){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=W}var M=B.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/adts.ts"),M=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function W(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,_(y,A)}function _(y,A){return _=Object.setPrototypeOf||function(k,x){return k.__proto__=x,k},_(y,A)}var O=function(y){W(A,y);function A(k,x){var E;return E=y.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=k,E.config=x,E}var R=A.prototype;return R.resetInitSegment=function(x,E,h){y.prototype.resetInitSegment.call(this,x,E,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}},A.probe=function(x){if(!x)return!1;for(var E=G.getID3Data(x,0)||[],h=E.length,o=x.length;h<o;h++)if(B.probe(x,h))return M.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(x,E){return B.canParse(x,E)},R.appendFrame=function(x,E,h){B.initTrackConfig(x,this.observer,E,h,x.manifestCodec);var o=B.appendFrame(x,E,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Z.default);O.minProbeByteLength=9,$.default=O},"./src/demux/adts.ts":function(ce,$,D){"use strict";D.r($),D.d($,"getAudioConfig",function(){return G}),D.d($,"isHeaderPattern",function(){return W}),D.d($,"getHeaderLength",function(){return _}),D.d($,"getFullFrameLength",function(){return O}),D.d($,"canGetFrameLength",function(){return y}),D.d($,"isHeader",function(){return A}),D.d($,"canParse",function(){return R}),D.d($,"probe",function(){return k}),D.d($,"initTrackConfig",function(){return x}),D.d($,"getFrameDuration",function(){return E}),D.d($,"parseFrameHeader",function(){return h}),D.d($,"appendFrame",function(){return o});var Z=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),M=D("./src/events.ts");function G(u,d,S,v){var p,w,b,s,f=navigator.userAgent.toLowerCase(),l=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((d[S+2]&192)>>>6)+1;var C=(d[S+2]&60)>>>2;if(C>a.length-1){u.trigger(M.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return b=(d[S+2]&1)<<2,b|=(d[S+3]&192)>>>6,Z.logger.log("manifest codec:"+v+", ADTS type:"+p+", samplingIndex:"+C),/firefox/i.test(f)?C>=6?(p=5,s=new Array(4),w=C-3):(p=2,s=new Array(2),w=C):f.indexOf("android")!==-1?(p=2,s=new Array(2),w=C):(p=5,s=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&C>=6?w=C-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(C>=6&&b===1||/vivaldi/i.test(f))||!v&&b===1)&&(p=2,s=new Array(2)),w=C)),s[0]=p<<3,s[0]|=(C&14)>>1,s[1]|=(C&1)<<7,s[1]|=b<<3,p===5&&(s[1]|=(w&14)>>1,s[2]=(w&1)<<7,s[2]|=2<<2,s[3]=0),{config:s,samplerate:a[C],channelCount:b,codec:"mp4a.40."+p,manifestCodec:l}}function W(u,d){return u[d]===255&&(u[d+1]&246)===240}function _(u,d){return u[d+1]&1?7:9}function O(u,d){return(u[d+3]&3)<<11|u[d+4]<<3|(u[d+5]&224)>>>5}function y(u,d){return d+5<u.length}function A(u,d){return d+1<u.length&&W(u,d)}function R(u,d){return y(u,d)&&W(u,d)&&O(u,d)<=u.length-d}function k(u,d){if(A(u,d)){var S=_(u,d);if(d+S>=u.length)return!1;var v=O(u,d);if(v<=S)return!1;var p=d+v;return p===u.length||A(u,p)}return!1}function x(u,d,S,v,p){if(!u.samplerate){var w=G(d,S,v,p);if(!w)return;u.config=w.config,u.samplerate=w.samplerate,u.channelCount=w.channelCount,u.codec=w.codec,u.manifestCodec=w.manifestCodec,Z.logger.log("parsed codec:"+u.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function E(u){return 1024*9e4/u}function h(u,d,S,v,p){var w=_(u,d),b=O(u,d);if(b-=w,b>0){var s=S+v*p;return{headerLength:w,frameLength:b,stamp:s}}}function o(u,d,S,v,p){var w=E(u.samplerate),b=h(d,S,v,p,w);if(b){var s=b.frameLength,f=b.headerLength,l=b.stamp,a=f+s,C=Math.max(0,S+a-d.length),m;C?(m=new Uint8Array(a-f),m.set(d.subarray(S+f,d.length),0)):m=d.subarray(S+f,S+a);var T={unit:m,pts:l};return C||u.samples.push(T),{sample:T,length:a,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(ce,$,D){"use strict";D.r($),D.d($,"initPTSFn",function(){return O});var Z=D("./src/polyfills/number.ts"),B=D("./src/demux/id3.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),W=D("./src/utils/typed-array.ts"),_=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=y.prototype;return A.resetInitSegment=function(k,x,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(k,x){return!1},A.appendFrame=function(k,x,E){},A.demux=function(k,x){this.cachedData&&(k=Object(G.appendUint8Array)(this.cachedData,k),this.cachedData=null);var E=B.getID3Data(k,0),h=E?E.length:0,o,u,d=this._audioTrack,S=this._id3Track,v=E?B.getTimeStamp(E):void 0,p=k.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(v,x)),E&&E.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),u=this.initPTS;h<p;){if(this.canParse(k,h)){var w=this.appendFrame(d,k,h);w?(this.frameIndex++,u=w.sample.pts,h+=w.length,o=h):h=p}else B.canParse(k,h)?(E=B.getID3Data(k,h),S.samples.push({pts:u,dts:u,data:E}),h+=E.length,o=h):h++;if(h===p&&o!==p){var b=Object(W.sliceUint8)(k,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(M.dummyTrack)(),id3Track:S,textTrack:Object(M.dummyTrack)()}},A.demuxSampleAes=function(k,x,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(k){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},A.destroy=function(){},y}(),O=function(A,R){return Object(Z.isFiniteNumber)(A)?A*90:R*9e4};$.default=_},"./src/demux/chunk-cache.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return Z});var Z=function(){function M(){this.chunks=[],this.dataLength=0}var G=M.prototype;return G.push=function(_){this.chunks.push(_),this.dataLength+=_.length},G.flush=function(){var _=this.chunks,O=this.dataLength,y;if(_.length)_.length===1?y=_[0]:y=B(_,O);else return new Uint8Array(0);return this.reset(),y},G.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function B(M,G){for(var W=new Uint8Array(G),_=0,O=0;O<M.length;O++){var y=M[O];W.set(y,_),_+=y.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(ce,$,D){"use strict";D.r($),D.d($,"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(ce,$,D){"use strict";D.r($);var Z=D("./src/utils/logger.ts"),B=function(){function M(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var G=M.prototype;return G.loadWord=function(){var _=this.data,O=this.bytesAvailable,y=_.byteLength-O,A=new Uint8Array(4),R=Math.min(4,O);if(R===0)throw new Error("no bytes available");A.set(_.subarray(y,y+R)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},G.skipBits=function(_){var O;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,O=_>>3,_-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},G.readBits=function(_){var O=Math.min(this.bitsAvailable,_),y=this.word>>>32-O;return _>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=_-O,O>0&&this.bitsAvailable?y<<O|this.readBits(O):y},G.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},G.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(_){for(var O=8,y=8,A,R=0;R<_;R++)y!==0&&(A=this.readEG(),y=(O+A+256)%256),O=y===0?O:y},G.readSPS=function(){var _=0,O=0,y=0,A=0,R,k,x,E=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),d=this.skipBits.bind(this),S=this.skipEG.bind(this),v=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);E();var w=E();if(h(5),d(3),E(),v(),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),v(),v(),d(1),u())for(k=b!==3?8:12,x=0;x<k;x++)u()&&(x<6?p(16):p(64))}v();var s=o();if(s===0)o();else if(s===1)for(d(1),S(),S(),R=o(),x=0;x<R;x++)S();v(),d(1);var f=o(),l=o(),a=h(1);a===0&&d(1),d(1),u()&&(_=o(),O=o(),y=o(),A=o());var C=[1,1];if(u()&&u()){var m=E();switch(m){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((f+1)*16-_*2-O*2),height:(2-a)*(l+1)*16-(a?2:4)*(y+A),pixelRatio:C}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();$.default=B},"./src/demux/id3.ts":function(ce,$,D){"use strict";D.r($),D.d($,"isHeader",function(){return Z}),D.d($,"isFooter",function(){return B}),D.d($,"getID3Data",function(){return M}),D.d($,"canParse",function(){return W}),D.d($,"getTimeStamp",function(){return _}),D.d($,"isTimeStampFrame",function(){return O}),D.d($,"getID3Frames",function(){return A}),D.d($,"decodeFrame",function(){return R}),D.d($,"utf8ArrayToStr",function(){return o}),D.d($,"testables",function(){return u});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)))},B=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)))},M=function(p,w){for(var b=w,s=0;Z(p,w);){s+=10;var f=G(p,w+6);s+=f,B(p,w+10)&&(s+=10),w+=s}return s>0?p.subarray(b,b+s):void 0},G=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},W=function(p,w){return Z(p,w)&&G(p,w+6)+10<=p.length-w},_=function(p){for(var w=A(p),b=0;b<w.length;b++){var s=w[b];if(O(s))return h(s)}return},O=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},y=function(p){var w=String.fromCharCode(p[0],p[1],p[2],p[3]),b=G(p,4),s=10;return{type:w,size:b,data:p.subarray(s,s+b)}},A=function(p){for(var w=0,b=[];Z(p,w);){var s=G(p,w+6);w+=10;for(var f=w+s;w+8<f;){var l=y(p.subarray(w)),a=R(l);a&&b.push(a),w+=l.size+10}B(p,w)&&(w+=10)}return b},R=function(p){return p.type==="PRIV"?k(p):p.type[0]==="W"?E(p):x(p)},k=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 s=o(p.data.subarray(w));return{key:p.type,info:b,data:s}}var f=o(p.data.subarray(1));return{key:p.type,data:f}},E=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 s=o(p.data.subarray(w));return{key:p.type,info:b,data:s}}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,s=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return s/=45,b&&(s+=4772185884e-2),Math.round(s)}return},o=function(p,w){w===void 0&&(w=!1);var b=S();if(b){var s=b.decode(p);if(w){var f=s.indexOf("\0");return f!==-1?s.substring(0,f):s}return s.replace(/\0/g,"")}for(var l=p.length,a,C,m,T="",U=0;U<l;){if(a=p[U++],a===0&&w)return T;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:T+=String.fromCharCode(a);break;case 12:case 13:C=p[U++],T+=String.fromCharCode((a&31)<<6|C&63);break;case 14:C=p[U++],m=p[U++],T+=String.fromCharCode((a&15)<<12|(C&63)<<6|(m&63)<<0);break;default:}}return T},u={decodeTextFrame:x},d;function S(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/id3.ts"),M=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function W(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,_(y,A)}function _(y,A){return _=Object.setPrototypeOf||function(k,x){return k.__proto__=x,k},_(y,A)}var O=function(y){W(A,y);function A(){return y.apply(this,arguments)||this}var R=A.prototype;return R.resetInitSegment=function(x,E,h){y.prototype.resetInitSegment.call(this,x,E,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}},A.probe=function(x){if(!x)return!1;for(var E=B.getID3Data(x,0)||[],h=E.length,o=x.length;h<o;h++)if(G.probe(x,h))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(x,E){return G.canParse(x,E)},R.appendFrame=function(x,E,h){return this.initPTS===null?void 0:G.appendFrame(x,E,h,this.initPTS,this.frameIndex)},A}(Z.default);O.minProbeByteLength=4,$.default=O},"./src/demux/mp4demuxer.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/demux/dummy-demuxed-track.ts"),M=function(){function G(_,O){this.remainderData=null,this.config=void 0,this.config=O}var W=G.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},G.probe=function(O){return Object(Z.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},W.demux=function(O){var y=O,A=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Z.appendUint8Array)(this.remainderData,O));var R=Object(Z.segmentValidRange)(y);this.remainderData=R.remainder,A.samples=R.valid||new Uint8Array}else A.samples=y;return{audioTrack:Object(B.dummyTrack)(),avcTrack:A,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},W.flush=function(){var O=Object(B.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:O,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},W.demuxSampleAes=function(O,y,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},G}();M.minProbeByteLength=1024,$.default=M},"./src/demux/mpegaudio.ts":function(ce,$,D){"use strict";D.r($),D.d($,"appendFrame",function(){return _}),D.d($,"parseHeader",function(){return O}),D.d($,"isHeaderPattern",function(){return y}),D.d($,"isHeader",function(){return A}),D.d($,"canParse",function(){return R}),D.d($,"probe",function(){return k});var Z=null,B=[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],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],W=[0,1,1,4];function _(x,E,h,o,u){if(h+24>E.length)return;var d=O(E,h);if(d&&h+d.frameLength<=E.length){var S=d.samplesPerFrame*9e4/d.sampleRate,v=o+u*S,p={unit:E.subarray(h,h+d.frameLength),pts:v,dts:v};return x.config=[],x.channelCount=d.channelCount,x.samplerate=d.sampleRate,x.samples.push(p),{sample:p,length:d.frameLength,missing:0}}}function O(x,E){var h=x[E+1]>>3&3,o=x[E+1]>>1&3,u=x[E+2]>>4&15,d=x[E+2]>>2&3;if(h!==1&&u!==0&&u!==15&&d!==3){var S=x[E+2]>>1&1,v=x[E+3]>>6,p=h===3?3-o:o===3?3:4,w=B[p*14+u-1]*1e3,b=h===3?0:h===2?1:2,s=M[b*3+d],f=v===3?1:2,l=G[h][o],a=W[o],C=l*8*a,m=Math.floor(l*w/s+S)*a;if(Z===null){var T=navigator.userAgent||"",U=T.match(/Chrome\/(\d+)/i);Z=U?parseInt(U[1]):0}var j=!!Z&&Z<=87;return j&&o===2&&w>=224e3&&v===0&&(x[E+3]=x[E+3]|128),{sampleRate:s,channelCount:f,frameLength:m,samplesPerFrame:C}}}function y(x,E){return x[E]===255&&(x[E+1]&224)===224&&(x[E+1]&6)!==0}function A(x,E){return E+1<x.length&&y(x,E)}function R(x,E){var h=4;return y(x,E)&&h<=x.length-E}function k(x,E){if(E+1<x.length&&y(x,E)){var h=4,o=O(x,E),u=h;o!=null&&o.frameLength&&(u=o.frameLength);var d=E+u;return d===x.length||A(x,d)}return!1}},"./src/demux/sample-aes.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/crypt/decrypter.ts"),B=D("./src/demux/tsdemuxer.ts"),M=function(){function G(_,O,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Z.default(_,O,{removePKCS7Padding:!1})}var W=G.prototype;return W.decryptBuffer=function(O,y){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,y)},W.decryptAacSample=function(O,y,A,R){var k=O[y].unit,x=k.subarray(16,k.length-k.length%16),E=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),h=this;this.decryptBuffer(E,function(o){var u=new Uint8Array(o);k.set(u,16),R||h.decryptAacSamples(O,y+1,A)})},W.decryptAacSamples=function(O,y,A){for(;;y++){if(y>=O.length){A();return}if(O[y].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(O,y,A,R),!R)return}},W.getAvcEncryptedData=function(O){for(var y=Math.floor((O.length-48)/160)*16+16,A=new Int8Array(y),R=0,k=32;k<=O.length-16;k+=160,R+=16)A.set(O.subarray(k,k+16),R);return A},W.getAvcDecryptedUnit=function(O,y){for(var A=new Uint8Array(y),R=0,k=32;k<=O.length-16;k+=160,R+=16)O.set(A.subarray(R,R+16),k);return O},W.decryptAvcSample=function(O,y,A,R,k,x){var E=Object(B.discardEPB)(k.data),h=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(h.buffer,function(u){k.data=o.getAvcDecryptedUnit(E,u),x||o.decryptAvcSamples(O,y,A+1,R)})},W.decryptAvcSamples=function(O,y,A,R){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,A=0){if(y>=O.length){R();return}for(var k=O[y].units;!(A>=k.length);A++){var x=k[A];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(O,y,A,R,x,E),!E)return}}},G}();$.default=M},"./src/demux/transmuxer-interface.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return k});var Z=D("./node_modules/webworkify-webpack/index.js"),B=D.n(Z),M=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),W=D("./src/utils/logger.ts"),_=D("./src/errors.ts"),O=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),A=D.n(y),R=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},k=function(){function x(h,o,u,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=u,this.onFlush=d;var v=h.config,p=function(l,a){a=a||{},a.frag=S.frag,a.id=S.id,h.trigger(l,a)};this.observer=new y.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,p),this.observer.on(M.Events.ERROR,p);var w={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var s;try{s=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(f){h.trigger(M.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},s.postMessage({cmd:"init",typeSupported:w,vendor:b,id:o,config:JSON.stringify(v)})}catch(f){W.logger.warn("Error in worker:",f),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),s&&self.URL.revokeObjectURL(s.objectURL),this.transmuxer=new G.default(this.observer,w,v,b,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,w,v,b,o)}var E=x.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,u,d,S,v,p,w,b,s,f){var l=this;s.transmuxing.start=self.performance.now();var a=this.transmuxer,C=this.worker,m=p?p.start:v.start,T=v.decryptdata,U=this.frag,j=!(U&&v.cc===U.cc),F=!(U&&s.level===U.level),V=U?s.sn-U.sn:-1,P=this.part?s.part-this.part.index:1,I=!F&&(V===1||V===0&&P===1),X=self.performance.now();(F||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=X),p&&(P||!I)&&(p.stats.parsing.start=X);var oe=new G.TransmuxState(j,I,b,F,m);if(!I||j){W.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+s.sn+" p: "+s.part+" level: "+s.level+" id: "+s.id+`
discontinuity: `+j+`
trackSwitch: `+F+`
contiguous: `+I+`
accurateTimeOffset: `+b+`
timeOffset: `+m);var pe=new G.TransmuxConfig(d,S,u,w,f);this.configureTransmuxer(pe)}if(this.frag=v,this.part=p,C)C.postMessage({cmd:"demux",data:o,decryptdata:T,chunkMeta:s,state:oe},o instanceof ArrayBuffer?[o]:[]);else if(a){var ve=a.push(o,T,s,oe);Object(G.isPromise)(ve)?ve.then(function(Le){l.handleTransmuxComplete(Le)}):this.handleTransmuxComplete(ve)}},E.flush=function(o){var u=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 v=d.flush(o);Object(G.isPromise)(v)?v.then(function(p){u.handleFlushResult(p,o)}):this.handleFlushResult(v,o)}},E.handleFlushResult=function(o,u){var d=this;o.forEach(function(S){d.handleTransmuxComplete(S)}),this.onFlush(u)},E.onWorkerMessage=function(o){var u=o.data,d=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,d.trigger(u.event,u.data);break}}},E.configureTransmuxer=function(o){var u=this.worker,d=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return _});var Z=D("./src/demux/transmuxer.ts"),B=D("./src/events.ts"),M=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),W=D.n(G);function _(k){var x=new G.EventEmitter,E=function(o,u){k.postMessage({event:o,data:u})};x.on(B.Events.FRAG_DECRYPTED,E),x.on(B.Events.ERROR,E),k.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);k.transmuxer=new Z.default(x,o.typeSupported,u,o.vendor,o.id),Object(M.enableLogs)(u.debug),E("init",null);break}case"configure":{k.transmuxer.configure(o.config);break}case"demux":{var d=k.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(d)?d.then(function(p){O(k,p)}):O(k,d);break}case"flush":{var S=o.chunkMeta,v=k.transmuxer.flush(S);Object(Z.isPromise)(v)?v.then(function(p){A(k,p,S)}):A(k,v,S);break}default:break}})}function O(k,x){if(R(x.remuxResult))return;var E=[],h=x.remuxResult,o=h.audio,u=h.video;o&&y(E,o),u&&y(E,u),k.postMessage({event:"transmuxComplete",data:x},E)}function y(k,x){x.data1&&k.push(x.data1.buffer),x.data2&&k.push(x.data2.buffer)}function A(k,x,E){x.forEach(function(h){O(k,h)}),k.postMessage({event:"flush",data:E})}function R(k){return!k.audio&&!k.video&&!k.text&&!k.id3&&!k.initSegment}},"./src/demux/transmuxer.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return u}),D.d($,"isPromise",function(){return v}),D.d($,"TransmuxConfig",function(){return p}),D.d($,"TransmuxState",function(){return w});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),W=D("./src/demux/mp4demuxer.ts"),_=D("./src/demux/tsdemuxer.ts"),O=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),R=D("./src/demux/chunk-cache.ts"),k=D("./src/utils/mp4-tools.ts"),x=D("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(b){x.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var h=[{demux:_.default,remux:y.default},{demux:W.default,remux:A.default},{demux:G.default,remux:y.default},{demux:O.default,remux:y.default}],o=1024;h.forEach(function(b){var s=b.demux;o=Math.max(o,s.minProbeByteLength)});var u=function(){function b(f,l,a,C,m){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 R.default,this.observer=f,this.typeSupported=l,this.config=a,this.vendor=C,this.id=m}var s=b.prototype;return s.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},s.push=function(l,a,C,m){var T=this,U=C.transmuxing;U.executeStart=E();var j=new Uint8Array(l),F=this.cache,V=this.config,P=this.currentTransmuxState,I=this.transmuxConfig;m&&(this.currentTransmuxState=m);var X=d(j,a);if(X&&X.method==="AES-128"){var oe=this.getDecrypter();if(V.enableSoftwareAES){var pe=oe.softwareDecrypt(j,X.key.buffer,X.iv.buffer);if(!pe)return U.executeEnd=E(),S(C);j=new Uint8Array(pe)}else return this.decryptionPromise=oe.webCryptoDecrypt(j,X.key.buffer,X.iv.buffer).then(function(Oe){var Pe=T.push(Oe,null,C);return T.decryptionPromise=null,Pe}),this.decryptionPromise}var ve=m||P,Le=ve.contiguous,ke=ve.discontinuity,he=ve.trackSwitch,ae=ve.accurateTimeOffset,ue=ve.timeOffset,ie=I.audioCodec,se=I.videoCodec,J=I.defaultInitPts,ee=I.duration,ne=I.initSegmentData;if((ke||he)&&this.resetInitSegment(ne,ie,se,ee),ke&&this.resetInitialTimestamp(J),Le||this.resetContiguity(),this.needsProbing(j,ke,he)){if(F.dataLength){var fe=F.flush();j=Object(k.appendUint8Array)(fe,j)}this.configureTransmuxer(j,I)}var Ae=this.transmux(j,X,ue,ae,C),ge=this.currentTransmuxState;return ge.contiguous=!0,ge.discontinuity=!1,ge.trackSwitch=!1,U.executeEnd=E(),Ae},s.flush=function(l){var a=this,C=l.transmuxing;C.executeStart=E();var m=this.decrypter,T=this.cache,U=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(l)});var F=[],V=U.timeOffset;if(m){var P=m.flush();P&&F.push(this.push(P,null,l))}var I=T.dataLength;T.reset();var X=this.demuxer,oe=this.remuxer;if(!X||!oe)return I>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=E(),[S(l)];var pe=X.flush(V);return v(pe)?pe.then(function(ve){return a.flushRemux(F,ve,l),F}):(this.flushRemux(F,pe,l),F)},s.flushRemux=function(l,a,C){var m=a.audioTrack,T=a.avcTrack,U=a.id3Track,j=a.textTrack,F=this.currentTransmuxState,V=F.accurateTimeOffset,P=F.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var I=this.remuxer.remux(m,T,U,j,P,V,!0,this.id);l.push({remuxResult:I,chunkMeta:C}),C.transmuxing.executeEnd=E()},s.resetInitialTimestamp=function(l){var a=this.demuxer,C=this.remuxer;if(!a||!C)return;a.resetTimeStamp(l),C.resetTimeStamp(l)},s.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},s.resetInitSegment=function(l,a,C,m){var T=this.demuxer,U=this.remuxer;if(!T||!U)return;T.resetInitSegment(a,C,m),U.resetInitSegment(l,a,C)},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(l,a,C,m,T){var U;return a&&a.method==="SAMPLE-AES"?U=this.transmuxSampleAes(l,a,C,m,T):U=this.transmuxUnencrypted(l,C,m,T),U},s.transmuxUnencrypted=function(l,a,C,m){var T=this.demuxer.demux(l,a,!1,!this.config.progressive),U=T.audioTrack,j=T.avcTrack,F=T.id3Track,V=T.textTrack,P=this.remuxer.remux(U,j,F,V,a,C,!1,this.id);return{remuxResult:P,chunkMeta:m}},s.transmuxSampleAes=function(l,a,C,m,T){var U=this;return this.demuxer.demuxSampleAes(l,a,C).then(function(j){var F=U.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,C,m,!1,U.id);return{remuxResult:F,chunkMeta:T}})},s.configureTransmuxer=function(l,a){for(var C=this.config,m=this.observer,T=this.typeSupported,U=this.vendor,j=a.audioCodec,F=a.defaultInitPts,V=a.duration,P=a.initSegmentData,I=a.videoCodec,X,oe=0,pe=h.length;oe<pe;oe++)if(h[oe].demux.probe(l)){X=h[oe];break}X||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:W.default,remux:A.default});var ve=this.demuxer,Le=this.remuxer,ke=X.remux,he=X.demux;(!Le||!(Le instanceof ke))&&(this.remuxer=new ke(m,C,T,U)),(!ve||!(ve instanceof he))&&(this.demuxer=new he(m,C,T),this.probe=he.probe),this.resetInitSegment(P,j,I,V),this.resetInitialTimestamp(F)},s.needsProbing=function(l,a,C){return!this.demuxer||!this.remuxer||a||C},s.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new M.default(this.observer,this.config)),l},b}();function d(b,s){var f=null;return b.byteLength>0&&s!=null&&s.key!=null&&s.iv!==null&&s.method!=null&&(f=s),f}var S=function(s){return{remuxResult:{},chunkMeta:s}};function v(b){return"then"in b&&b.then instanceof Function}var p=function(s,f,l,a,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=s,this.videoCodec=f,this.initSegmentData=l,this.duration=a,this.defaultInitPts=C},w=function(s,f,l,a,C){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=s,this.contiguous=f,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=C}},"./src/demux/tsdemuxer.ts":function(ce,$,D){"use strict";D.r($),D.d($,"discardEPB",function(){return S});var Z=D("./src/demux/adts.ts"),B=D("./src/demux/mpegaudio.ts"),M=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),W=D("./src/demux/sample-aes.ts"),_=D("./src/events.ts"),O=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},k=function(){function v(w,b,s){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=s}v.probe=function(b){var s=v.syncOffset(b);return s<0?!1:(s&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+s+", junk ahead ?"),!0)},v.syncOffset=function(b){for(var s=Math.min(1e3,b.length-3*188),f=0;f<s;){if(b[f]===71&&b[f+188]===71&&b[f+2*188]===71)return f;f++}return-1},v.createTrack=function(b,s){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?s:void 0}};var p=v.prototype;return p.resetInitSegment=function(b,s,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",f),this._audioTrack=v.createTrack("audio",f),this._id3Track=v.createTrack("id3",f),this._txtTrack=v.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=s,this._duration=f},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,s=this._avcTrack,f=this._id3Track;b&&(b.pesData=null),s&&(s.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,s,f,l){f===void 0&&(f=!1),l===void 0&&(l=!1),f||(this.sampleAes=null);var a,C=this._avcTrack,m=this._audioTrack,T=this._id3Track,U=C.pid,j=C.pesData,F=m.pid,V=T.pid,P=m.pesData,I=T.pesData,X=!1,oe=this.pmtParsed,pe=this._pmtId,ve=b.length;if(this.remainderData&&(b=Object(O.appendUint8Array)(this.remainderData,b),ve=b.length,this.remainderData=null),ve<188&&!l)return this.remainderData=b,{audioTrack:m,avcTrack:C,id3Track:T,textTrack:this._txtTrack};var Le=Math.max(0,v.syncOffset(b));ve-=(ve+Le)%188,ve<b.byteLength&&!l&&(this.remainderData=new Uint8Array(b.buffer,ve,b.buffer.byteLength-ve));for(var ke=Le;ke<ve;ke+=188)if(b[ke]===71){var he=!!(b[ke+1]&64),ae=((b[ke+1]&31)<<8)+b[ke+2],ue=(b[ke+3]&48)>>4,ie=void 0;if(ue>1){if(ie=ke+5+b[ke+4],ie===ke+188)continue}else ie=ke+4;switch(ae){case U:he&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(b.subarray(ie,ke+188)),j.size+=ke+188-ie);break;case F:he&&(P&&(a=o(P))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(b.subarray(ie,ke+188)),P.size+=ke+188-ie);break;case V:he&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(b.subarray(ie,ke+188)),I.size+=ke+188-ie);break;case 0:he&&(ie+=b[ie]+1),pe=this._pmtId=E(b,ie);break;case pe:{he&&(ie+=b[ie]+1);var se=h(b,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);U=se.avc,U>0&&(C.pid=U),F=se.audio,F>0&&(m.pid=F,m.isAAC=se.isAAC),V=se.id3,V>0&&(T.pid=V),X&&!oe&&(y.logger.log("reparse from beginning"),X=!1,ke=Le-188),oe=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=j,m.pesData=P,T.pesData=I;var J={audioTrack:m,avcTrack:C,id3Track:T,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},p.flush=function(){var b=this.remainderData;this.remainderData=null;var s;return b?s=this.demux(b,-1,!1,!0):s={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(s),this.sampleAes?this.decrypt(s,this.sampleAes):s},p.extractRemainingSamples=function(b){var s=b.audioTrack,f=b.avcTrack,l=b.id3Track,a=f.pesData,C=s.pesData,m=l.pesData,T;a&&(T=o(a))?(this.parseAVCPES(T,!0),f.pesData=null):f.pesData=a,C&&(T=o(C))?(s.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),s.pesData=null):(C!=null&&C.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),s.pesData=C),m&&(T=o(m))?(this.parseID3PES(T),l.pesData=null):l.pesData=m},p.demuxSampleAes=function(b,s,f){var l=this.demux(b,f,!0,!this.config.progressive),a=this.sampleAes=new W.default(this.observer,this.config,s);return this.decrypt(l,a)},p.decrypt=function(b,s){return new Promise(function(f){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?s.decryptAacSamples(l.samples,0,function(){a.samples?s.decryptAvcSamples(a.samples,0,0,function(){f(b)}):f(b)}):a.samples&&s.decryptAvcSamples(a.samples,0,0,function(){f(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,s){var f=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),C=!1,m=this.avcSample,T,U=!1;b.data=null,m&&a.length&&!l.audFound&&(u(m,l),m=this.avcSample=x(!1,b.pts,b.dts,"")),a.forEach(function(j){switch(j.type){case 1:{T=!0,m||(m=f.avcSample=x(!0,b.pts,b.dts,"")),C&&(m.debug+="NDR "),m.frame=!0;var F=j.data;if(U&&F.length>4){var V=new M.default(F).readSliceType();(V===2||V===4||V===7||V===9)&&(m.key=!0)}break}case 5:T=!0,m||(m=f.avcSample=x(!0,b.pts,b.dts,"")),C&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{T=!0,C&&m&&(m.debug+="SEI ");var P=new M.default(S(j.data));P.readUByte();for(var I=0,X=0,oe=!1,pe=0;!oe&&P.bytesAvailable>1;){I=0;do pe=P.readUByte(),I+=pe;while(pe===255);X=0;do pe=P.readUByte(),X+=pe;while(pe===255);if(I===4&&P.bytesAvailable!==0){oe=!0;var ve=P.readUByte();if(ve===181){var Le=P.readUShort();if(Le===49){var ke=P.readUInt();if(ke===1195456820){var he=P.readUByte();if(he===3){for(var ae=P.readUByte(),ue=P.readUByte(),ie=31&ae,se=[ae,ue],J=0;J<ie;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(I===5&&P.bytesAvailable!==0){if(oe=!0,X>16){for(var ee=[],ne=0;ne<16;ne++)ee.push(P.readUByte().toString(16)),(ne===3||ne===5||ne===7||ne===9)&&ee.push("-");for(var fe=X-16,Ae=new Uint8Array(fe),ge=0;ge<fe;ge++)Ae[ge]=P.readUByte();d(f._txtTrack.samples,{pts:b.pts,payloadType:I,uuid:ee.join(""),userData:Object(G.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(X<P.bytesAvailable)for(var Oe=0;Oe<X;Oe++)P.readUByte()}break}case 7:if(T=!0,U=!0,C&&m&&(m.debug+="SPS "),!l.sps){var Pe=new M.default(j.data),je=Pe.readSPS();l.width=je.width,l.height=je.height,l.pixelRatio=je.pixelRatio,l.sps=[j.data],l.duration=f._duration;for(var Ge=j.data.subarray(1,4),He="avc1.",Fe=0;Fe<3;Fe++){var qe=Ge[Fe].toString(16);qe.length<2&&(qe="0"+qe),He+=qe}l.codec=He}break;case 8:T=!0,C&&m&&(m.debug+="PPS "),l.pps||(l.pps=[j.data]);break;case 9:T=!1,l.audFound=!0,m&&u(m,l),m=f.avcSample=x(!1,b.pts,b.dts,C?"AUD ":"");break;case 12:T=!1;break;default:T=!1,m&&(m.debug+="unknown NAL "+j.type+" ");break}if(m&&T){var De=m.units;De.push(j)}}),s&&m&&(u(m,l),this.avcSample=null)},p.getLastNalUnit=function(){var b,s=this.avcSample,f;if(!s||s.units.length===0){var l=this._avcTrack.samples;s=l[l.length-1]}if((b=s)!==null&&b!==void 0&&b.units){var a=s.units;f=a[a.length-1]}return f},p.parseAVCNALu=function(b){var s=b.byteLength,f=this._avcTrack,l=f.naluState||0,a=l,C=[],m=0,T,U,j,F=-1,V=0;for(l===-1&&(F=0,V=b[0]&31,l=0,m=1);m<s;){if(T=b[m++],!l){l=T?0:1;continue}if(l===1){l=T?0:2;continue}if(!T)l=3;else if(T===1){if(F>=0){var P={data:b.subarray(F,m-l-1),type:V};C.push(P)}else{var I=this.getLastNalUnit();if(I&&(a&&m<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),U=m-l-1,U>0)){var X=new Uint8Array(I.data.byteLength+U);X.set(I.data,0),X.set(b.subarray(0,U),I.data.byteLength),I.data=X,I.state=0}}m<s?(j=b[m]&31,F=m,V=j,l=0):l=-1}else l=0}if(F>=0&&l>=0){var oe={data:b.subarray(F,s),type:V,state:l};C.push(oe)}if(C.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=l,C},p.parseAACPES=function(b){var s=0,f=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var C=l.sample.unit.byteLength,m=Math.min(l.missing,C),T=C-m;l.sample.unit.set(a.subarray(0,m),T),f.samples.push(l.sample),s=l.missing}var U,j;for(U=s,j=a.length;U<j-1&&!Z.isHeader(a,U);U++);if(U!==s){var F,V;if(U<j-1?(F="AAC PES did not start with ADTS header,offset:"+U,V=!1):(F="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+F),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:F}),V)return}Z.initTrackConfig(f,this.observer,a,U,this.audioCodec);var P;if(b.pts!==void 0)P=b.pts;else if(l){var I=Z.getFrameDuration(f.samplerate);P=l.sample.pts+I}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;U<j;)if(Z.isHeader(a,U)){if(U+5<j){var oe=Z.appendFrame(f,a,U,P,X);if(oe)if(oe.missing)this.aacOverFlow=oe;else{U+=oe.length,X++;continue}}break}else U++},p.parseMPEGPES=function(b){var s=b.data,f=s.length,l=0,a=0,C=b.pts;if(C===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(B.isHeader(s,a)){var m=B.appendFrame(this._audioTrack,s,a,C,l);if(m)a+=m.length,l++;else break}else a++},p.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},v}();k.minProbeByteLength=188;function x(v,p,w,b){return{key:v,frame:!1,pts:p,dts:w,units:[],debug:b,length:0}}function E(v,p){return(v[p+10]&31)<<8|v[p+11]}function h(v,p,w,b){var s={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(v[p+1]&15)<<8|v[p+2],l=p+3+f-4,a=(v[p+10]&15)<<8|v[p+11];for(p+=12+a;p<l;){var C=(v[p+1]&31)<<8|v[p+2];switch(v[p]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:s.audio===-1&&(s.audio=C);break;case 21:s.id3===-1&&(s.id3=C);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:s.avc===-1&&(s.avc=C);break;case 3:case 4:w?s.audio===-1&&(s.audio=C,s.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((v[p+3]&15)<<8|v[p+4])+5}return s}function o(v){var p=0,w,b,s,f,l,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var C=new Uint8Array(a[0].length+a[1].length);C.set(a[0]),C.set(a[1],a[0].length),a[0]=C,a.splice(1,1)}w=a[0];var m=(w[0]<<16)+(w[1]<<8)+w[2];if(m===1){if(b=(w[4]<<8)+w[5],b&&b>v.size-6)return null;var T=w[7];T&192&&(f=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,T&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,f-l>60*9e4&&(y.logger.warn(Math.round((f-l)/9e4)+"s delta between PTS and DTS, align them"),f=l)):l=f),s=w[8];var U=s+9;if(v.size<=U)return null;v.size-=U;for(var j=new Uint8Array(v.size),F=0,V=a.length;F<V;F++){w=a[F];var P=w.byteLength;if(U)if(U>P){U-=P;continue}else w=w.subarray(U),P-=U,U=0;j.set(w,p),p+=P}return b&&(b-=s+3),{data:j,pts:f,dts:l,len:b}}return null}function u(v,p){if(v.units.length&&v.frame){if(v.pts===void 0){var w=p.samples,b=w.length;if(b){var s=w[b-1];v.pts=s.pts,v.dts=s.dts}else{p.dropped++;return}}p.samples.push(v)}v.debug.length&&y.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function d(v,p){var w=v.length;if(w>0){if(p.pts>=v[w-1].pts)v.push(p);else for(var b=w-1;b>=0;b--)if(p.pts<v[b].pts){v.splice(b,0,p);break}}else v.push(p)}function S(v){for(var p=v.byteLength,w=[],b=1;b<p-2;)v[b]===0&&v[b+1]===0&&v[b+2]===3?(w.push(b+2),b+=2):b++;if(w.length===0)return v;var s=p-w.length,f=new Uint8Array(s),l=0;for(b=0;b<s;l++,b++)l===w[0]&&(l++,w.shift()),f[b]=v[l];return f}$.default=k},"./src/errors.ts":function(ce,$,D){"use strict";D.r($),D.d($,"ErrorTypes",function(){return Z}),D.d($,"ErrorDetails",function(){return B});var Z;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(Z||(Z={}));var B;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(ce,$,D){"use strict";D.r($),D.d($,"Events",function(){return Z});var Z;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return v});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z),M=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),W=D("./src/controller/id3-track-controller.ts"),_=D("./src/controller/latency-controller.ts"),O=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),R=D("./src/is-supported.ts"),k=D("./src/utils/logger.ts"),x=D("./src/config.ts"),E=D("./node_modules/eventemitter3/index.js"),h=D.n(E),o=D("./src/events.ts"),u=D("./src/errors.ts");function d(p,w){for(var b=0;b<w.length;b++){var s=w[b];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}function S(p,w,b){return w&&d(p.prototype,w),b&&d(p,b),p}var v=function(){p.isSupported=function(){return Object(R.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 E.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 s=this.config=Object(x.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(k.enableLogs)(s.debug),this._autoLevelCapping=-1,s.progressive&&Object(x.enableStreamingMode)(s);var f=s.abrController,l=s.bufferController,a=s.capLevelController,C=s.fpsController,m=this.abrController=new f(this),T=this.bufferController=new l(this),U=this.capLevelController=new a(this),j=new C(this),F=new M.default(this),V=new G.default(this),P=new W.default(this),I=this.levelController=new O.default(this),X=new y.FragmentTracker(this),oe=this.streamController=new A.default(this,X);U.setStreamController(oe),j.setStreamController(oe);var pe=[I,oe];this.networkControllers=pe;var ve=[F,V,m,T,U,j,P,X];this.audioTrackController=this.createController(s.audioTrackController,null,pe),this.createController(s.audioStreamController,X,pe),this.subtitleTrackController=this.createController(s.subtitleTrackController,null,pe),this.createController(s.subtitleStreamController,X,pe),this.createController(s.timelineController,null,ve),this.emeController=this.createController(s.emeController,null,ve),this.cmcdController=this.createController(s.cmcdController,null,ve),this.latencyController=this.createController(_.default,null,ve),this.coreComponents=ve}var w=p.prototype;return w.createController=function(s,f,l){if(s){var a=f?new s(this,f):new s(this);return l&&l.push(a),a}return null},w.on=function(s,f,l){l===void 0&&(l=this),this._emitter.on(s,f,l)},w.once=function(s,f,l){l===void 0&&(l=this),this._emitter.once(s,f,l)},w.removeAllListeners=function(s){this._emitter.removeAllListeners(s)},w.off=function(s,f,l,a){l===void 0&&(l=this),this._emitter.off(s,f,l,a)},w.listeners=function(s){return this._emitter.listeners(s)},w.emit=function(s,f,l){return this._emitter.emit(s,f,l)},w.trigger=function(s,f){if(this.config.debug)return this.emit(s,s,f);try{return this.emit(s,s,f)}catch(l){k.logger.error("An internal error happened while handling event "+s+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:s,error:l})}return!1},w.listenerCount=function(s){return this._emitter.listenerCount(s)},w.destroy=function(){k.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(s){return s.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(s){return s.destroy()}),this.coreComponents.length=0},w.attachMedia=function(s){k.logger.log("attachMedia"),this._media=s,this.trigger(o.Events.MEDIA_ATTACHING,{media:s})},w.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(s){this.stopLoad();var f=this.media,l=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,s,{alwaysNormalize:!0});k.logger.log("loadSource:"+a),f&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:s})},w.startLoad=function(s){s===void 0&&(s=-1),k.logger.log("startLoad("+s+")"),this.networkControllers.forEach(function(f){f.startLoad(s)})},w.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(s){s.stopLoad()})},w.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){k.logger.log("recoverMediaError");var s=this._media;this.detachMedia(),s&&this.attachMedia(s)},w.removeLevel=function(s,f){f===void 0&&(f=0),this.levelController.removeLevel(s,f)},S(p,[{key:"levels",get:function(){var s=this.levelController.levels;return s||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(s){k.logger.log("set currentLevel:"+s),this.loadLevel=s,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(s){k.logger.log("set nextLevel:"+s),this.levelController.manualLevel=s,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(s){k.logger.log("set loadLevel:"+s),this.levelController.manualLevel=s}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(s){this.levelController.nextLoadLevel=s}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(s){k.logger.log("set firstLevel:"+s),this.levelController.firstLevel=s}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(s){k.logger.log("set startLevel:"+s),s!==-1&&(s=Math.max(s,this.minAutoLevel)),this.levelController.startLevel=s}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(s){var f=!!s;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(s){this._autoLevelCapping!==s&&(k.logger.log("set autoLevelCapping:"+s),this._autoLevelCapping=s)}},{key:"bandwidthEstimate",get:function(){var s=this.abrController.bwEstimator;return s?s.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var s=this.levels,f=this.config.minAutoBitrate;if(!s)return 0;for(var l=s.length,a=0;a<l;a++)if(s[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var s=this.levels,f=this.autoLevelCapping,l;return f===-1&&s&&s.length?l=s.length-1:l=f,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(s){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,s)}},{key:"audioTracks",get:function(){var s=this.audioTrackController;return s?s.audioTracks:[]}},{key:"audioTrack",get:function(){var s=this.audioTrackController;return s?s.audioTrack:-1},set:function(s){var f=this.audioTrackController;f&&(f.audioTrack=s)}},{key:"subtitleTracks",get:function(){var s=this.subtitleTrackController;return s?s.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var s=this.subtitleTrackController;return s?s.subtitleTrack:-1},set:function(s){var f=this.subtitleTrackController;f&&(f.subtitleTrack=s)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var s=this.subtitleTrackController;return s?s.subtitleDisplay:!1},set:function(s){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=s)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(s){this.config.lowLatencyMode=s}},{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 u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:x.hlsDefaultConfig},set:function(s){p.defaultConfig=s}}]),p}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ce,$,D){"use strict";D.r($),D.d($,"isSupported",function(){return M}),D.d($,"changeTypeSupported",function(){return G});var Z=D("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var W=Object(Z.getMediaSource)();if(!W)return!1;var _=B(),O=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!O&&!!y}function G(){var W,_=B();return typeof(_==null||((W=_.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return k}),D.d($,"LoadError",function(){return E});var Z=D("./src/polyfills/number.ts"),B=D("./src/errors.ts");function M(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,y(h,o)}function G(h){var o=typeof Map=="function"?new Map:void 0;return G=function(d){if(d===null||!O(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 W(d,arguments,A(this).constructor)}return S.prototype=Object.create(d.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),y(S,d)},G(h)}function W(h,o,u){return _()?W=Reflect.construct:W=function(S,v,p){var w=[null];w.push.apply(w,v);var b=Function.bind.apply(S,w),s=new b;return p&&y(s,p.prototype),s},W.apply(null,arguments)}function _(){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 O(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function y(h,o){return y=Object.setPrototypeOf||function(d,S){return d.__proto__=S,d},y(h,o)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},A(h)}var R=Math.pow(2,17),k=function(){function h(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}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 v=this,p=d.url;if(!p)return Promise.reject(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.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,s=w.loader;return new Promise(function(f,l){v.loader&&v.loader.destroy();var a=v.loader=d.loader=b?new b(w):new s(w),C=x(d),m={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:R};d.stats=a.stats,a.load(C,m,{onSuccess:function(U,j,F,V){v.resetLoader(d,a),f({frag:d,part:null,payload:U.data,networkDetails:V})},onError:function(U,j,F){v.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:U,networkDetails:F}))},onAbort:function(U,j,F){v.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:F}))},onTimeout:function(U,j,F){v.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:F}))},onProgress:function(U,j,F,V){S&&S({frag:d,part:null,payload:F,networkDetails:V})}})})},o.loadPart=function(d,S,v){var p=this;this.abort();var w=this.config,b=w.fLoader,s=w.loader;return new Promise(function(f,l){p.loader&&p.loader.destroy();var a=p.loader=d.loader=b?new b(w):new s(w),C=x(d,S),m={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:R};S.stats=a.stats,a.load(C,m,{onSuccess:function(U,j,F,V){p.resetLoader(d,a),p.updateStatsFromPart(d,S);var P={frag:d,part:S,payload:U.data,networkDetails:V};v(P),f(P)},onError:function(U,j,F){p.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:S,response:U,networkDetails:F}))},onAbort:function(U,j,F){d.stats.aborted=S.stats.aborted,p.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:S,networkDetails:F}))},onTimeout:function(U,j,F){p.resetLoader(d,a),l(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:S,networkDetails:F}))}})})},o.updateStatsFromPart=function(d,S){var v=d.stats,p=S.stats,w=p.total;if(v.loaded+=p.loaded,w){var b=Math.round(d.duration/S.duration),s=Math.min(Math.round(v.loaded/w),b),f=b-s,l=f*Math.round(v.loaded/s);v.total=v.loaded+l}else v.total=Math.max(v.loaded,v.total);var a=v.loading,C=p.loading;a.start?a.first+=C.first-C.start:(a.start=C.start,a.first=C.first),a.end=C.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 u=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},S=u.byteRangeStartOffset,v=u.byteRangeEndOffset;return Object(Z.isFiniteNumber)(S)&&Object(Z.isFiniteNumber)(v)&&(d.rangeStart=S,d.rangeEnd=v),d}var E=function(h){M(o,h);function o(u){for(var d,S=arguments.length,v=new Array(S>1?S-1:0),p=1;p<S;p++)v[p-1]=arguments[p];return d=h.call.apply(h,[this].concat(v))||this,d.data=void 0,d.data=u,d}return o}(G(Error))},"./src/loader/fragment.ts":function(ce,$,D){"use strict";D.r($),D.d($,"ElementaryStreamTypes",function(){return k}),D.d($,"BaseSegment",function(){return x}),D.d($,"Fragment",function(){return E}),D.d($,"Part",function(){return h});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(B),G=D("./src/utils/logger.ts"),W=D("./src/loader/level-key.ts"),_=D("./src/loader/load-stats.ts");function O(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,y(o,u)}function y(o,u){return y=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},y(o,u)}function A(o,u){for(var d=0;d<u.length;d++){var S=u[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,u,d){return u&&A(o.prototype,u),d&&A(o,d),o}var k;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(k||(k={}));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[k.AUDIO]=null,S[k.VIDEO]=null,S[k.AUDIOVIDEO]=null,S),this.baseurl=d}var u=o.prototype;return u.setByteRange=function(S,v){var p=S.split("@",2),w=[];p.length===1?w[0]=v?v.byteRangeEndOffset:0:w[0]=parseInt(p[1]),w[1]=parseInt(p[0])+w[0],this._byteRange=w},R(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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),E=function(o){O(u,o);function u(S,v){var p;return p=o.call(this,v)||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 _.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=S,p}var d=u.prototype;return d.createInitializationVector=function(v){for(var p=new Uint8Array(16),w=12;w<16;w++)p[w]=v>>8*(15-w)&255;return p},d.setDecryptDataFromLevelKey=function(v,p){var w=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(w=W.LevelKey.fromURI(v.uri),w.method=v.method,w.iv=this.createInitializationVector(p),w.keyFormat="identity"),w},d.setElementaryStreamInfo=function(v,p,w,b,s,f){f===void 0&&(f=!1);var l=this.elementaryStreams,a=l[v];if(!a){l[v]={startPTS:p,endPTS:w,startDTS:b,endDTS:s,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,s)},d.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[k.AUDIO]=null,v[k.VIDEO]=null,v[k.AUDIOVIDEO]=null},R(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var v=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),u}(x),h=function(o){O(u,o);function u(d,S,v,p,w){var b;b=o.call(this,v)||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 _.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 s=d.enumeratedString("BYTERANGE");return s&&b.setByteRange(s,w),w&&(b.fragOffset=w.fragOffset+w.duration),b}return R(u,[{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)}}]),u}(x)},"./src/loader/key-loader.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return G});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),G=function(){function W(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var _=W.prototype;return _._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var A=this.loaders[y];A&&A.destroy()}this.loaders={}},_.onKeyLoading=function(y,A){var R=A.frag,k=R.type,x=this.loaders[k];if(!R.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=R.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(x&&(M.logger.warn("abort previous key loader for type:"+k),x.abort()),!E){M.logger.warn("key uri is falsy");return}var o=h.loader,u=R.loader=this.loaders[k]=new o(h);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:R,responseType:"arraybuffer"},S={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(d,S,v)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:R}))},_.loadsuccess=function(y,A,R){var k=R.frag;if(!k.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=k.decryptdata.key=new Uint8Array(y.data),k.loader=null,delete this.loaders[k.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:k})},_.loaderror=function(y,A){var R=A.frag,k=R.loader;k&&k.abort(),delete this.loaders[R.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:y})},_.loadtimeout=function(y,A){var R=A.frag,k=R.loader;k&&k.abort(),delete this.loaders[R.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},W}()},"./src/loader/level-details.ts":function(ce,$,D){"use strict";D.r($),D.d($,"LevelDetails",function(){return W});var Z=D("./src/polyfills/number.ts");function B(_,O){for(var y=0;y<O.length;y++){var A=O[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function M(_,O,y){return O&&B(_.prototype,O),y&&B(_,y),_}var G=10,W=function(){function _(y){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=y}var O=_.prototype;return O.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-A.lastPartSn,k=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!k||!!R,this.advanced=this.endSN>A.endSN||R>0||R===0&&k>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},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||G}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var R=this.driftEnd-this.driftStart;return R*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(ce,$,D){"use strict";D.r($),D.d($,"LevelKey",function(){return W});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z);function M(_,O){for(var y=0;y<O.length;y++){var A=O[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function G(_,O,y){return O&&M(_.prototype,O),y&&M(_,y),_}var W=function(){_.fromURL=function(y,A){return new _(y,A)},_.fromURI=function(y){return new _(y)};function _(O,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(Z.buildAbsoluteURL)(O,y,{alwaysNormalize:!0}):this._uri=O}return G(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(ce,$,D){"use strict";D.r($),D.d($,"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(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return u});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(B),G=D("./src/loader/fragment.ts"),W=D("./src/loader/level-details.ts"),_=D("./src/loader/level-key.ts"),O=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,k=/#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"),E=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,s;return h.test((b=(s=B.parseURL(w))===null||s===void 0?void 0:s.path)!=null?b:"")}var u=function(){function w(){}return w.findGroup=function(s,f){for(var l=0;l<s.length;l++){var a=s[l];if(a.id===f)return a}},w.convertAVC1ToAVCOTI=function(s){var f=s.split(".");if(f.length>2){var l=f.shift()+".";return l+=parseInt(f.shift()).toString(16),l+=("000"+parseInt(f.shift()).toString(16)).substr(-4),l}return s},w.resolve=function(s,f){return B.buildAbsoluteURL(f,s,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(s,f){var l=[],a={},C=!1;R.lastIndex=0;for(var m;(m=R.exec(s))!=null;)if(m[1]){var T=new O.AttrList(m[1]),U={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:w.resolve(m[2],f)},j=T.decimalResolution("RESOLUTION");j&&(U.width=j.width,U.height=j.height),d((T.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),U),U.videoCodec&&U.videoCodec.indexOf("avc1")!==-1&&(U.videoCodec=w.convertAVC1ToAVCOTI(U.videoCodec)),l.push(U)}else if(m[3]){var F=new O.AttrList(m[3]);F["DATA-ID"]&&(C=!0,a[F["DATA-ID"]]=F)}return{levels:l,sessionData:C?a:null}},w.parseMasterPlaylistMedia=function(s,f,l,a){a===void 0&&(a=[]);var C,m=[],T=0;for(k.lastIndex=0;(C=k.exec(s))!==null;){var U=new O.AttrList(C[1]);if(U.TYPE===l){var j={attrs:U,bitrate:0,id:T++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:l,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?w.resolve(U.URI,f):""};if(a.length){var F=w.findGroup(a,j.groupId)||a[0];S(j,F,"audioCodec"),S(j,F,"textCodec")}m.push(j)}}return m},w.parseLevelPlaylist=function(s,f,l,a,C){var m=new W.LevelDetails(f),T=m.fragments,U=null,j=0,F=0,V=0,P=0,I=null,X=new G.Fragment(a,f),oe,pe,ve,Le=-1,ke=!1;for(x.lastIndex=0,m.m3u8=s;(oe=x.exec(s))!==null;){ke&&(ke=!1,X=new G.Fragment(a,f),X.start=V,X.sn=j,X.cc=P,X.level=l,U&&(X.initSegment=U,X.rawProgramDateTime=U.rawProgramDateTime));var he=oe[1];if(he){X.duration=parseFloat(he);var ae=(" "+oe[2]).slice(1);X.title=ae||null,X.tagList.push(ae?["INF",he,ae]:["INF",he])}else if(oe[3])Object(Z.isFiniteNumber)(X.duration)&&(X.start=V,ve&&(X.levelkey=ve),X.sn=j,X.level=l,X.cc=P,X.urlId=C,T.push(X),X.relurl=(" "+oe[3]).slice(1),p(X,I),I=X,V+=X.duration,j++,F=0,ke=!0);else if(oe[4]){var ue=(" "+oe[4]).slice(1);I?X.setByteRange(ue,I):X.setByteRange(ue)}else if(oe[5])X.rawProgramDateTime=(" "+oe[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Le===-1&&(Le=T.length);else{if(oe=oe[0].match(E),!oe){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<oe.length&&!(typeof oe[pe]!="undefined");pe++);var ie=(" "+oe[pe]).slice(1),se=(" "+oe[pe+1]).slice(1),J=oe[pe+2]?(" "+oe[pe+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":m.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":j=m.startSN=parseInt(se);break;case"SKIP":{var ee=new O.AttrList(se),ne=ee.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ne)){m.skippedSegments=ne;for(var fe=ne;fe--;)T.unshift(null);j+=ne}var Ae=ee.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(m.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(se);break;case"VERSION":m.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(se||J)&&X.tagList.push(J?[se,J]:[se]);break;case"DIS":P++;case"GAP":X.tagList.push([ie]);break;case"BITRATE":X.tagList.push([ie,se]);break;case"DISCONTINUITY-SEQ":P=parseInt(se);break;case"KEY":{var ge,Oe=new O.AttrList(se),Pe=Oe.enumeratedString("METHOD"),je=Oe.URI,Ge=Oe.hexadecimalInteger("IV"),He=Oe.enumeratedString("KEYFORMATVERSIONS"),Fe=Oe.enumeratedString("KEYID"),qe=(ge=Oe.enumeratedString("KEYFORMAT"))!=null?ge:"identity",De=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(De.indexOf(qe)>-1){y.logger.warn("Keyformat "+qe+" is not supported from the manifest");continue}else if(qe!=="identity")continue;Pe&&(ve=_.LevelKey.fromURL(f,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(ve.method=Pe,ve.keyFormat=qe,Fe&&(ve.keyID=Fe),He&&(ve.keyFormatVersions=He),ve.iv=Ge));break}case"START":{var Ie=new O.AttrList(se),Be=Ie.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(Be)&&(m.startTimeOffset=Be);break}case"MAP":{var ze=new O.AttrList(se);X.relurl=ze.URI,ze.BYTERANGE&&X.setByteRange(ze.BYTERANGE),X.level=l,X.sn="initSegment",ve&&(X.levelkey=ve),X.initSegment=null,U=X,ke=!0;break}case"SERVER-CONTROL":{var Ke=new O.AttrList(se);m.canBlockReload=Ke.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Ke.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Ke.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Ke.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Ke.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ve=new O.AttrList(se);m.partTarget=Ve.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=m.partList;Re||(Re=m.partList=[]);var tt=F>0?Re[Re.length-1]:void 0,it=F++,Me=new G.Part(new O.AttrList(se),X,f,it,tt);Re.push(Me),X.duration+=Me.duration;break}case"PRELOAD-HINT":{var We=new O.AttrList(se);m.preloadHint=We;break}case"RENDITION-REPORT":{var xe=new O.AttrList(se);m.renditionReports=m.renditionReports||[],m.renditionReports.push(xe);break}default:y.logger.warn("line parsed but not handled: "+oe);break}}}I&&!I.relurl?(T.pop(),V-=I.duration,m.partList&&(m.fragmentHint=I)):m.partList&&(p(X,I),X.cc=P,m.fragmentHint=X);var ye=T.length,Ce=T[0],le=T[ye-1];if(V+=m.skippedSegments*m.targetduration,V>0&&ye&&le){m.averagetargetduration=V/ye;var de=le.sn;m.endSN=de!=="initSegment"?de:0,Ce&&(m.startCC=Ce.cc,Ce.initSegment||m.fragments.every(function(me){return me.relurl&&o(me.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new G.Fragment(a,f),X.relurl=le.relurl,X.level=l,X.sn="initSegment",Ce.initSegment=X,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(V+=m.fragmentHint.duration),m.totalduration=V,m.endCC=P,Le>0&&v(T,Le),m},w}();function d(w,b){["video","audio","text"].forEach(function(s){var f=w.filter(function(a){return Object(A.isCodecType)(a,s)});if(f.length){var l=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[s+"Codec"]=l.length>0?l[0]:f[0],w=w.filter(function(a){return f.indexOf(a)===-1})}}),b.unknownCodecs=w}function S(w,b,s){var f=b[s];f&&(w[s]=f)}function v(w,b){for(var s=w[b],f=b;f--;){var l=w[f];if(!l)return;l.programDateTime=s.programDateTime-l.duration*1e3,s=l}}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(ce,$,D){"use strict";D.r($);var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),M=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),_=D("./src/loader/m3u8-parser.ts"),O=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function A(x){var E=x.type;switch(E){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function R(x,E){var h=x.url;return(h===void 0||h.indexOf("data:")===0)&&(h=E.url),h}var k=function(){function x(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var E=x.prototype;return E.registerListeners=function(){var o=this.hls;o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(o){var u=this.hls.config,d=u.pLoader,S=u.loader,v=d||S,p=new v(u);return o.loader=p,this.loaders[o.type]=p,p},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,u){var d=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,u){var d=u.id,S=u.level,v=u.url,p=u.deliveryDirectives;this.load({id:d,groupId:null,level:S,responseType:"text",type:O.PlaylistContextType.LEVEL,url:v,deliveryDirectives:p})},E.onAudioTrackLoading=function(o,u){var d=u.id,S=u.groupId,v=u.url,p=u.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:p})},E.onSubtitleTrackLoading=function(o,u){var d=u.id,S=u.groupId,v=u.url,p=u.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:p})},E.load=function(o){var u,d=this.hls.config,S=this.getInternalLoader(o);if(S){var v=S.context;if(v&&v.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var p,w,b,s;switch(o.type){case O.PlaylistContextType.MANIFEST:p=d.manifestLoadingMaxRetry,w=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,s=d.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:p=0,w=d.levelLoadingTimeOut;break;default:p=d.levelLoadingMaxRetry,w=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,s=d.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var f;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var l=f.partTarget,a=f.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var C={timeout:w,maxRetry:p,retryDelay:b,maxRetryDelay:s,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,C,m)},E.loadsuccess=function(o,u,d,S){if(S===void 0&&(S=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,u,d,S);return}this.resetInternalLoader(d.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",S);return}u.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,d,S):this.handleMasterPlaylist(o,u,d,S)},E.loaderror=function(o,u,d){d===void 0&&(d=null),this.handleNetworkError(u,d,!1,o)},E.loadtimeout=function(o,u,d){d===void 0&&(d=null),this.handleNetworkError(u,d,!0)},E.handleMasterPlaylist=function(o,u,d,S){var v=this.hls,p=o.data,w=R(o,d),b=_.default.parseMasterPlaylist(p,w),s=b.levels,f=b.sessionData;if(!s.length){this.handleManifestParsingError(o,d,"no level found in manifest",S);return}var l=s.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=s.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),C=_.default.parseMasterPlaylistMedia(p,w,"AUDIO",l),m=_.default.parseMasterPlaylistMedia(p,w,"SUBTITLES",a),T=_.default.parseMasterPlaylistMedia(p,w,"CLOSED-CAPTIONS");if(C.length){var U=C.some(function(j){return!j.url});!U&&s[0].audioCodec&&!s[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}v.trigger(B.Events.MANIFEST_LOADED,{levels:s,audioTracks:C,subtitles:m,captions:T,url:w,stats:u,networkDetails:S,sessionData:f})},E.handleTrackOrLevelPlaylist=function(o,u,d,S){var v=this.hls,p=d.id,w=d.level,b=d.type,s=R(o,d),f=Object(Z.isFiniteNumber)(p)?p:0,l=Object(Z.isFiniteNumber)(w)?w:f,a=A(d),C=_.default.parseLevelPlaylist(o.data,s,l,a,f);if(!C.fragments.length){v.trigger(B.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:s,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===O.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:C,name:"",url:s};v.trigger(B.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:s,stats:u,networkDetails:S,sessionData:null})}if(u.parsing.end=performance.now(),C.needSidxRanges){var T,U=(T=C.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:U,isSidxRequest:!0,type:b,level:w,levelDetails:C,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=C,this.handlePlaylistLoaded(o,u,d,S)},E.handleSidxRequest=function(o,u){var d=Object(W.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var S=d.references,v=u.levelDetails;S.forEach(function(p,w){var b=p.info,s=v.fragments[w];s.byteRange.length===0&&s.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),s.initSegment&&s.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,u,d,S){this.hls.trigger(B.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:u,networkDetails:S})},E.handleNetworkError=function(o,u,d,S){d===void 0&&(d=!1),G.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 v=M.ErrorDetails.UNKNOWN,p=!1,w=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:v=d?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case O.PlaylistContextType.LEVEL:v=d?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case O.PlaylistContextType.AUDIO_TRACK:v=d?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:v=d?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}w&&this.resetInternalLoader(o.type);var b={type:M.ErrorTypes.NETWORK_ERROR,details:v,fatal:p,url:o.url,loader:w,context:o,networkDetails:u};S&&(b.response=S),this.hls.trigger(B.Events.ERROR,b)},E.handlePlaylistLoaded=function(o,u,d,S){var v=d.type,p=d.level,w=d.id,b=d.groupId,s=d.loader,f=d.levelDetails,l=d.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",S);return}if(!s)return;f.live&&(s.getCacheAge&&(f.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(v){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:f,level:p||0,id:w||0,stats:u,networkDetails:S,deliveryDirectives:l});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:u,networkDetails:S,deliveryDirectives:l});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:u,networkDetails:S,deliveryDirectives:l});break}},x}();$.default=k},"./src/polyfills/number.ts":function(ce,$,D){"use strict";D.r($),D.d($,"isFiniteNumber",function(){return Z}),D.d($,"MAX_SAFE_INTEGER",function(){return B});var Z=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,$,D){"use strict";D.r($);var Z=function(){function B(){}return B.getSilentFrame=function(G,W){switch(G){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(W===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(W===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},B}();$.default=Z},"./src/remux/mp4-generator.ts":function(ce,$,D){"use strict";D.r($);var Z=Math.pow(2,32)-1,B=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var W;for(W in M.types)M.types.hasOwnProperty(W)&&(M.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var _=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]),O=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]);M.HDLR_TYPES={video:_,audio:O};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=A,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),k=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,R,x,R,k),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,y))},M.box=function(W){for(var _=8,O=arguments.length,y=new Array(O>1?O-1:0),A=1;A<O;A++)y[A-1]=arguments[A];for(var R=y.length,k=R;R--;)_+=y[R].byteLength;var x=new Uint8Array(_);for(x[0]=_>>24&255,x[1]=_>>16&255,x[2]=_>>8&255,x[3]=_&255,x.set(W,4),R=0,_=8;R<k;R++)x.set(y[R],_),_+=y[R].byteLength;return x},M.hdlr=function(W){return M.box(M.types.hdlr,M.HDLR_TYPES[W])},M.mdat=function(W){return M.box(M.types.mdat,W)},M.mdhd=function(W,_){_*=W;var O=Math.floor(_/(Z+1)),y=Math.floor(_%(Z+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},M.mdia=function(W){return M.box(M.types.mdia,M.mdhd(W.timescale,W.duration),M.hdlr(W.type),M.minf(W))},M.mfhd=function(W){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},M.minf=function(W){return W.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(W)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(W))},M.moof=function(W,_,O){return M.box(M.types.moof,M.mfhd(W),M.traf(O,_))},M.moov=function(W){for(var _=W.length,O=[];_--;)O[_]=M.trak(W[_]);return M.box.apply(null,[M.types.moov,M.mvhd(W[0].timescale,W[0].duration)].concat(O).concat(M.mvex(W)))},M.mvex=function(W){for(var _=W.length,O=[];_--;)O[_]=M.trex(W[_]);return M.box.apply(null,[M.types.mvex].concat(O))},M.mvhd=function(W,_){_*=W;var O=Math.floor(_/(Z+1)),y=Math.floor(_%(Z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,y>>24,y>>16&255,y>>8&255,y&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 M.box(M.types.mvhd,A)},M.sdtp=function(W){var _=W.samples||[],O=new Uint8Array(4+_.length),y,A;for(y=0;y<_.length;y++)A=_[y].flags,O[y+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return M.box(M.types.sdtp,O)},M.stbl=function(W){return M.box(M.types.stbl,M.stsd(W),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(W){var _=[],O=[],y,A,R;for(y=0;y<W.sps.length;y++)A=W.sps[y],R=A.byteLength,_.push(R>>>8&255),_.push(R&255),_=_.concat(Array.prototype.slice.call(A));for(y=0;y<W.pps.length;y++)A=W.pps[y],R=A.byteLength,O.push(R>>>8&255),O.push(R&255),O=O.concat(Array.prototype.slice.call(A));var k=M.box(M.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|W.sps.length].concat(_).concat([W.pps.length]).concat(O))),x=W.width,E=W.height,h=W.pixelRatio[0],o=W.pixelRatio[1];return M.box(M.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,E>>8&255,E&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]),k,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},M.esds=function(W){var _=W.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(W.config).concat([6,1,2]))},M.mp4a=function(W){var _=W.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),M.box(M.types.esds,M.esds(W)))},M.mp3=function(W){var _=W.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},M.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(W)):M.box(M.types.stsd,M.STSD,M.mp4a(W)):M.box(M.types.stsd,M.STSD,M.avc1(W))},M.tkhd=function(W){var _=W.id,O=W.duration*W.timescale,y=W.width,A=W.height,R=Math.floor(O/(Z+1)),k=Math.floor(O%(Z+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,k>>24,k>>16&255,k>>8&255,k&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,y>>8&255,y&255,0,0,A>>8&255,A&255,0,0]))},M.traf=function(W,_){var O=M.sdtp(W),y=W.id,A=Math.floor(_/(Z+1)),R=Math.floor(_%(Z+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,R>>24,R>>16&255,R>>8&255,R&255])),M.trun(W,O.length+16+20+8+16+8+8),O)},M.trak=function(W){return W.duration=W.duration||4294967295,M.box(M.types.trak,M.tkhd(W),M.mdia(W))},M.trex=function(W){var _=W.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(W,_){var O=W.samples||[],y=O.length,A=12+16*y,R=new Uint8Array(A),k,x,E,h,o,u;for(_+=8+A,R.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),k=0;k<y;k++)x=O[k],E=x.duration,h=x.size,o=x.flags,u=x.cts,R.set([E>>>24&255,E>>>16&255,E>>>8&255,E&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,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*k);return M.box(M.types.trun,R)},M.initSegment=function(W){M.types||M.init();var _=M.moov(W),O=new Uint8Array(M.FTYP.byteLength+_.byteLength);return O.set(M.FTYP),O.set(_,M.FTYP.byteLength),O},M}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,$.default=B},"./src/remux/mp4-remuxer.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return u}),D.d($,"normalizePts",function(){return d});var Z=D("./src/polyfills/number.ts"),B=D("./src/remux/aac-helper.ts"),M=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),W=D("./src/errors.ts"),_=D("./src/utils/logger.ts"),O=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var s=arguments[b];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(w[f]=s[f])}return w},A.apply(this,arguments)}var R=10*1e3,k=1024,x=1152,E=null,h=null,o=!1,u=function(){function w(s,f,l,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=s,this.config=f,this.typeSupported=l,this.ISGenerated=!1,E===null){var C=navigator.userAgent||"",m=C.match(/Chrome\/(\d+)/i);E=m?parseInt(m[1]):0}if(h===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);h=T?parseInt(T[1]):0}o=!!E&&E<75||!!h&&h<600}var b=w.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},b.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(f){var l=!1,a=f.reduce(function(C,m){var T=m.pts-C;return T<-4294967296?(l=!0,d(C,m.pts)):T>0?C:m.pts},f[0].pts);return l&&_.logger.debug("PTS rollover detected"),a},b.remux=function(f,l,a,C,m,T,U,j){var F,V,P,I,X,oe,pe=m,ve=m,Le=f.pid>-1,ke=l.pid>-1,he=l.samples.length,ae=f.samples.length>0,ue=he>1,ie=(!Le||ae)&&(!ke||ue)||this.ISGenerated||U;if(ie){this.ISGenerated||(P=this.generateIS(f,l,m));var se=this.isVideoContiguous,J=-1;if(ue&&(J=S(l.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(oe=!0,J>0){_.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+he+" video samples due to a missing keyframe");var ee=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,ve+=(l.samples[0].pts-ee)/(l.timescale||9e4)}else J===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),oe=!1);if(this.ISGenerated){if(ae&&ue){var ne=this.getVideoStartPts(l.samples),fe=d(f.samples[0].pts,ne)-ne,Ae=fe/l.inputTimeScale;pe+=Math.max(0,Ae),ve+=Math.max(0,-Ae)}if(ae){if(f.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(f,l,m)),V=this.remuxAudio(f,pe,this.isAudioContiguous,T,ke||ue||j===O.PlaylistLevelType.AUDIO?ve:void 0),ue){var ge=V?V.endPTS-V.startPTS:0;l.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(f,l,m)),F=this.remuxVideo(l,ve,se,ge)}}else ue&&(F=this.remuxVideo(l,ve,se,0));F&&(F.firstKeyFrame=J,F.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(X=this.remuxID3(a,m)),C.samples.length&&(I=this.remuxText(C,m))),{audio:V,video:F,initSegment:P,independent:oe,text:I,id3:X}},b.generateIS=function(f,l,a){var C=f.samples,m=l.samples,T=this.typeSupported,U={},j=!Object(Z.isFiniteNumber)(this._initPTS),F="audio/mp4",V,P,I;if(j&&(V=P=Infinity),f.config&&C.length&&(f.timescale=f.samplerate,f.isAAC||(T.mpeg?(F="audio/mpeg",f.codec=""):T.mp3&&(f.codec="mp3")),U.audio={id:"audio",container:F,codec:f.codec,initSegment:!f.isAAC&&T.mpeg?new Uint8Array(0):M.default.initSegment([f]),metadata:{channelCount:f.channelCount}},j&&(I=f.inputTimeScale,V=P=C[0].pts-Math.round(I*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,U.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:M.default.initSegment([l]),metadata:{width:l.width,height:l.height}},j)){I=l.inputTimeScale;var X=this.getVideoStartPts(m),oe=Math.round(I*a);P=Math.min(P,d(m[0].dts,X)-oe),V=Math.min(V,X-oe)}if(Object.keys(U).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=P),{tracks:U,initPTS:V,timescale:I}},b.remuxVideo=function(f,l,a,C){var m=f.inputTimeScale,T=f.samples,U=[],j=T.length,F=this._initPTS,V=this.nextAvcDts,P=8,I,X,oe,pe=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Le=0,ke=!1;if(!a||V===null){var he=l*m,ae=T[0].pts-d(T[0].dts,T[0].pts);V=he-ae}for(var ue=0;ue<j;ue++){var ie=T[ue];if(ie.pts=d(ie.pts-F,V),ie.dts=d(ie.dts-F,V),ie.dts>ie.pts){var se=9e4*.2;Le=Math.max(Math.min(Le,ie.pts-ie.dts),-1*se)}ie.dts<T[ue>0?ue-1:ue].dts&&(ke=!0)}ke&&T.sort(function(Ct,Tt){var ut=Ct.dts-Tt.dts,Rt=Ct.pts-Tt.pts;return ut||Rt}),X=T[0].dts,oe=T[T.length-1].dts;var J=Math.round((oe-X)/(j-1));if(Le<0){if(Le<J*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ee=Le,ne=0;ne<j;ne++)T[ne].dts=ee=Math.max(ee,T[ne].pts-J),T[ne].pts=Math.max(ee,T[ne].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Le,!0)+" ms to overcome this issue");for(var fe=0;fe<j;fe++)T[fe].dts=T[fe].dts+Le}X=T[0].dts}if(a){var Ae=X-V,ge=Ae>J,Oe=Ae<-1;if(ge||Oe){ge?_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),X=V;var Pe=T[0].pts-Ae;T[0].dts=X,T[0].pts=Pe,_.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(y.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Ae,!0)+" ms")}}o&&(X=Math.max(0,X));for(var je=0,Ge=0,He=0;He<j;He++){for(var Fe=T[He],qe=Fe.units,De=qe.length,Ie=0,Be=0;Be<De;Be++)Ie+=qe[Be].data.length;Ge+=Ie,je+=De,Fe.length=Ie,Fe.dts=Math.max(Fe.dts,X),Fe.pts=Math.max(Fe.pts,Fe.dts,0),pe=Math.min(Fe.pts,pe),ve=Math.max(Fe.pts,ve)}oe=T[j-1].dts;var ze=Ge+4*je+8,Ke;try{Ke=new Uint8Array(ze)}catch(Ct){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ze,reason:"fail allocating video mdat "+ze});return}var Ve=new DataView(Ke.buffer);Ve.setUint32(0,ze),Ke.set(M.default.types.mdat,4);for(var Re=0;Re<j;Re++){for(var tt=T[Re],it=tt.units,Me=0,We=0,xe=it.length;We<xe;We++){var ye=it[We],Ce=ye.data,le=ye.data.byteLength;Ve.setUint32(P,le),P+=4,Ke.set(Ce,P),P+=le,Me+=4+le}if(Re<j-1)I=T[Re+1].dts-tt.dts;else{var de=this.config,me=tt.dts-T[Re>0?Re-1:Re].dts;if(de.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ee=Math.floor(de.maxBufferHole*m),we=(C?pe+C*m:this.nextAudioPts)-tt.pts;we>Ee?(I=we-me,I<0&&(I=me),_.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=me}else I=me}var Ue=Math.round(tt.pts-tt.dts);U.push(new v(tt.key,I,Me,Ue))}if(U.length&&E&&E<70){var Ze=U[0].flags;Ze.dependsOn=2,Ze.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=oe+I,this.isVideoContiguous=!0;var at=M.default.moof(f.sequenceNumber++,X,A({},f,{samples:U})),vt="video",mt={data1:at,data2:Ke,startPTS:pe/m,endPTS:(ve+I)/m,startDTS:X/m,endDTS:V/m,type:vt,hasAudio:!1,hasVideo:!0,nb:U.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Ke.length,"MDAT length must not be zero"),mt},b.remuxAudio=function(f,l,a,C,m){var T=f.inputTimeScale,U=f.samplerate?f.samplerate:T,j=T/U,F=f.isAAC?k:x,V=F*j,P=this._initPTS,I=!f.isAAC&&this.typeSupported.mpeg,X=[],oe=f.samples,pe=I?0:8,ve=this.nextAudioPts||-1,Le=l*T;if(this.isAudioContiguous=a=a||oe.length&&ve>0&&(C&&Math.abs(Le-ve)<9e3||Math.abs(d(oe[0].pts-P,Le)-ve)<20*V),oe.forEach(function(Ce){Ce.pts=d(Ce.pts-P,Le)}),!a||ve<0){if(oe=oe.filter(function(Ce){return Ce.pts>=0}),!oe.length)return;m===0?ve=0:C?ve=Math.max(0,Le):ve=oe[0].pts}if(f.isAAC)for(var ke=m!==void 0,he=this.config.maxAudioFramesDrift,ae=0,ue=ve;ae<oe.length;ae++){var ie=oe[ae],se=ie.pts,J=se-ue,ee=Math.abs(1e3*J/T);if(J<=-he*V&&ke)ae===0&&(_.logger.warn("Audio frame @ "+(se/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/T)+" ms."),this.nextAudioPts=ve=ue=se);else if(J>=he*V&&ee<R&&ke){var ne=Math.round(J/V);ue=se-ne*V,ue<0&&(ne--,ue+=V),ae===0&&(this.nextAudioPts=ve=ue),_.logger.warn("[mp4-remuxer]: Injecting "+ne+" audio frame @ "+(ue/T).toFixed(3)+"s due to "+Math.round(1e3*J/T)+" ms gap.");for(var fe=0;fe<ne;fe++){var Ae=Math.max(ue,0),ge=B.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);ge||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=ie.unit.subarray()),oe.splice(ae,0,{unit:ge,pts:Ae}),ue+=V,ae++}}ie.pts=ue,ue+=V}for(var Oe=null,Pe=null,je,Ge=0,He=oe.length;He--;)Ge+=oe[He].unit.byteLength;for(var Fe=0,qe=oe.length;Fe<qe;Fe++){var De=oe[Fe],Ie=De.unit,Be=De.pts;if(Pe!==null){var ze=X[Fe-1];ze.duration=Math.round((Be-Pe)/j)}else if(a&&f.isAAC&&(Be=ve),Oe=Be,Ge>0){Ge+=pe;try{je=new Uint8Array(Ge)}catch(Ce){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ge,reason:"fail allocating audio mdat "+Ge});return}if(!I){var Ke=new DataView(je.buffer);Ke.setUint32(0,Ge),je.set(M.default.types.mdat,4)}}else return;je.set(Ie,pe);var Ve=Ie.byteLength;pe+=Ve,X.push(new v(!0,F,Ve,0)),Pe=Be}var Re=X.length;if(!Re)return;var tt=X[X.length-1];this.nextAudioPts=ve=Pe+j*tt.duration;var it=I?new Uint8Array(0):M.default.moof(f.sequenceNumber++,Oe/j,A({},f,{samples:X}));f.samples=[];var Me=Oe/T,We=ve/T,xe="audio",ye={data1:it,data2:je,startPTS:Me,endPTS:We,startDTS:Me,endDTS:We,type:xe,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ye},b.remuxEmptyAudio=function(f,l,a,C){var m=f.inputTimeScale,T=f.samplerate?f.samplerate:m,U=m/T,j=this.nextAudioPts,F=(j!==null?j:C.startDTS*m)+this._initDTS,V=C.endDTS*m+this._initDTS,P=U*k,I=Math.ceil((V-F)/P),X=B.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var oe=[],pe=0;pe<I;pe++){var ve=F+pe*P;oe.push({unit:X,pts:ve,dts:ve})}return f.samples=oe,this.remuxAudio(f,l,a,!1)},b.remuxID3=function(f,l){var a=f.samples.length;if(!a)return;for(var C=f.inputTimeScale,m=this._initPTS,T=this._initDTS,U=0;U<a;U++){var j=f.samples[U];j.pts=d(j.pts-m,l*C)/C,j.dts=d(j.dts-T,l*C)/C}var F=f.samples;return f.samples=[],{samples:F}},b.remuxText=function(f,l){var a=f.samples.length;if(!a)return;for(var C=f.inputTimeScale,m=this._initPTS,T=0;T<a;T++){var U=f.samples[T];U.pts=d(U.pts-m,l*C)/C}f.samples.sort(function(F,V){return F.pts-V.pts});var j=f.samples;return f.samples=[],{samples:j}},w}();function d(w,b){var s;if(b===null)return w;for(b<w?s=-8589934592:s=8589934592;Math.abs(w-b)>4294967296;)w+=s;return w}function S(w){for(var b=0;b<w.length;b++)if(w[b].key)return b;return-1}var v=function(b,s,f,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=f,this.cts=l,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(ce,$,D){"use strict";D.r($);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),W=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=y.prototype;return A.destroy=function(){},A.resetTimeStamp=function(k){this.initPTS=k,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(k,x,E){this.audioCodec=x,this.videoCodec=E,this.generateInitSegment(k),this.emitInitSegment=!0},A.generateInitSegment=function(k){var x=this.audioCodec,E=this.videoCodec;if(!k||!k.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(B.parseInitSegment)(k);x||(x=O(h.audio,M.ElementaryStreamTypes.AUDIO)),E||(E=O(h.video,M.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:x+","+E,initSegment:k,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:x,initSegment:k,id:"audio"}:h.video?o.video={container:"video/mp4",codec:E,initSegment:k,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(k,x,E,h,o){var u=this.initPTS,d=this.lastEndDTS,S={audio:void 0,video:void 0,text:h,id3:E,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var v=x.samples;if(!v||!v.length)return S;var p={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(v),w=this.initData),!w||!w.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(u)||(this.initPTS=p.initPTS=u=_(w,v,d));var b=Object(B.getDuration)(v,w),s=d,f=b+s;Object(B.offsetStartDTS)(w,v,u),b>0?this.lastEndDTS=f:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,C="";l&&(C+="audio"),a&&(C+="video");var m={data1:v,startPTS:s,startDTS:s,endPTS:f,endDTS:f,type:C,hasAudio:l,hasVideo:a,nb:1,dropped:0};return S.audio=m.type==="audio"?m:void 0,S.video=m.type!=="audio"?m:void 0,S.text=h,S.id3=E,S.initSegment=p,S},y}(),_=function(A,R,k){return Object(B.getStartDTS)(A,R)-k};function O(y,A){var R=y==null?void 0:y.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||A===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=W},"./src/task-loop.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return Z});var Z=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=B.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ce,$,D){"use strict";D.r($),D.d($,"CMCDVersion",function(){return Z}),D.d($,"CMCDObjectType",function(){return B}),D.d($,"CMCDStreamingFormat",function(){return M}),D.d($,"CMCDStreamType",function(){return G});var Z=1,B;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(B||(B={}));var M;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(M||(M={}));var G;(function(W){W.VOD="v",W.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(ce,$,D){"use strict";D.r($),D.d($,"HlsSkip",function(){return M}),D.d($,"getSkipValue",function(){return G}),D.d($,"HlsUrlParameters",function(){return W}),D.d($,"Level",function(){return _});function Z(O,y){for(var A=0;A<y.length;A++){var R=y[A];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(O,R.key,R)}}function B(O,y,A){return y&&Z(O.prototype,y),A&&Z(O,A),O}var M;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(M||(M={}));function G(O,y){var A=O.canSkipUntil,R=O.canSkipDateRanges,k=O.endSN,x=y!==void 0?y-k:0;return A&&x<A?R?M.v2:M.Yes:M.No}var W=function(){function O(A,R,k){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=R,this.skip=k}var y=O.prototype;return y.addDirectives=function(R){var k=new self.URL(R);return this.msn!==void 0&&k.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&k.searchParams.set("_HLS_part",this.part.toString()),this.skip&&k.searchParams.set("_HLS_skip",this.skip),k.toString()},O}(),_=function(){function O(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return B(O,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var R=A%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),O}()},"./src/types/loader.ts":function(ce,$,D){"use strict";D.r($),D.d($,"PlaylistContextType",function(){return Z}),D.d($,"PlaylistLevelType",function(){return B});var Z;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var B;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(ce,$,D){"use strict";D.r($),D.d($,"ChunkMetadata",function(){return Z});var Z=function(G,W,_,O,y,A){O===void 0&&(O=0),y===void 0&&(y=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=G,this.sn=W,this.id=_,this.size=O,this.part=y,this.partial=A};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,$,D){"use strict";D.r($),D.d($,"AttrList",function(){return M});var Z=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function G(_){typeof _=="string"&&(_=G.parseAttrList(_));for(var O in _)_.hasOwnProperty(O)&&(this[O]=_[O])}var W=G.prototype;return W.decimalInteger=function(O){var y=parseInt(this[O],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.hexadecimalInteger=function(O){if(this[O]){var y=(this[O]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var A=new Uint8Array(y.length/2),R=0;R<y.length/2;R++)A[R]=parseInt(y.slice(R*2,R*2+2),16);return A}else return null},W.hexadecimalIntegerAsNumber=function(O){var y=parseInt(this[O],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.decimalFloatingPoint=function(O){return parseFloat(this[O])},W.optionalFloat=function(O,y){var A=this[O];return A?parseFloat(A):y},W.enumeratedString=function(O){return this[O]},W.bool=function(O){return this[O]==="YES"},W.decimalResolution=function(O){var y=Z.exec(this[O]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},G.parseAttrList=function(O){var y,A={},R='"';for(B.lastIndex=0;(y=B.exec(O))!==null;){var k=y[2];k.indexOf(R)===0&&k.lastIndexOf(R)===k.length-1&&(k=k.slice(1,-1)),A[y[1]]=k}return A},G}()},"./src/utils/binary-search.ts":function(ce,$,D){"use strict";D.r($);var Z={search:function(M,G){for(var W=0,_=M.length-1,O=null,y=null;W<=_;){O=(W+_)/2|0,y=M[O];var A=G(y);if(A>0)W=O+1;else if(A<0)_=O-1;else return y}return null}};$.default=Z},"./src/utils/buffer-helper.ts":function(ce,$,D){"use strict";D.r($),D.d($,"BufferHelper",function(){return M});var Z=D("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function G(){}return G.isBuffered=function(_,O){try{if(_){for(var y=G.getBuffered(_),A=0;A<y.length;A++)if(O>=y.start(A)&&O<=y.end(A))return!0}}catch(R){}return!1},G.bufferInfo=function(_,O,y){try{if(_){var A=G.getBuffered(_),R=[],k;for(k=0;k<A.length;k++)R.push({start:A.start(k),end:A.end(k)});return this.bufferedInfo(R,O,y)}}catch(x){}return{len:0,start:O,end:O,nextStart:void 0}},G.bufferedInfo=function(_,O,y){O=Math.max(0,O),_.sort(function(p,w){var b=p.start-w.start;return b||w.end-p.end});var A=[];if(y)for(var R=0;R<_.length;R++){var k=A.length;if(k){var x=A[k-1].end;_[R].start-x<y?_[R].end>x&&(A[k-1].end=_[R].end):A.push(_[R])}else A.push(_[R])}else A=_;for(var E=0,h,o=O,u=O,d=0;d<A.length;d++){var S=A[d].start,v=A[d].end;if(O+y>=S&&O<v)o=S,u=v,E=u-O;else if(O+y<S){h=S;break}}return{len:E,start:o||0,end:u||0,nextStart:h}},G.getBuffered=function(_){try{return _.buffered}catch(O){return Z.logger.log("failed to get media.buffered",O),B}},G}()},"./src/utils/cea-608-parser.ts":function(ce,$,D){"use strict";D.r($),D.d($,"Row",function(){return u}),D.d($,"CaptionScreen",function(){return d});var Z=D("./src/utils/logger.ts"),B={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},M=function(f){var l=f;return B.hasOwnProperty(f)&&(l=B[f]),String.fromCharCode(l)},G=15,W=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],k;(function(s){s[s.ERROR=0]="ERROR",s[s.TEXT=1]="TEXT",s[s.WARNING=2]="WARNING",s[s.INFO=2]="INFO",s[s.DEBUG=3]="DEBUG",s[s.DATA=3]="DATA"})(k||(k={}));var x=function(){function s(){this.time=null,this.verboseLevel=k.ERROR}var f=s.prototype;return f.log=function(a,C){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+C)},s}(),E=function(f){for(var l=[],a=0;a<f.length;a++)l.push(f[a].toString(16));return l},h=function(){function s(l,a,C,m,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=C||!1,this.background=m||"black",this.flash=T||!1}var f=s.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 C=["foreground","underline","italics","background","flash"],m=0;m<C.length;m++){var T=C[m];a.hasOwnProperty(T)&&(this[T]=a[T])}},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},s}(),o=function(){function s(l,a,C,m,T,U){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new h(a,C,m,T,U)}var f=s.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,C){this.uchar=a,this.penState.copy(C)},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()},s}(),u=function(){function s(l){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<W;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new h}var f=s.prototype;return f.equals=function(a){for(var C=!0,m=0;m<W;m++)if(!this.chars[m].equals(a.chars[m])){C=!1;break}return C},f.copy=function(a){for(var C=0;C<W;C++)this.chars[C].copy(a.chars[C])},f.isEmpty=function(){for(var a=!0,C=0;C<W;C++)if(!this.chars[C].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(k.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(k.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},f.moveCursor=function(a){var C=this.pos+a;if(a>1)for(var m=this.pos+1;m<C+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(C)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var C=M(a);if(this.pos>=W){this.logger.log(k.ERROR,"Cannot insert "+a.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var C;for(C=a;C<W;C++)this.chars[C].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=[],C=!0,m=0;m<W;m++){var T=this.chars[m].uchar;T!==" "&&(C=!1),a.push(T)}return C?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var C=this.chars[this.pos];C.setPenState(this.currPenState)},s}(),d=function(){function s(l){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<G;a++)this.rows.push(new u(l));this.logger=l,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=s.prototype;return f.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},f.equals=function(a){for(var C=!0,m=0;m<G;m++)if(!this.rows[m].equals(a.rows[m])){C=!1;break}return C},f.copy=function(a){for(var C=0;C<G;C++)this.rows[C].copy(a.rows[C])},f.isEmpty=function(){for(var a=!0,C=0;C<G;C++)if(!this.rows[C].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 C=this.rows[this.currRow];C.insertChar(a)},f.setPen=function(a){var C=this.rows[this.currRow];C.setPenStyles(a)},f.moveCursor=function(a){var C=this.rows[this.currRow];C.moveCursor(a)},f.setCursor=function(a){this.logger.log(k.INFO,"setCursor: "+a);var C=this.rows[this.currRow];C.setCursor(a)},f.setPAC=function(a){this.logger.log(k.INFO,"pacData = "+JSON.stringify(a));var C=a.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var m=0;m<G;m++)this.rows[m].clear();var T=this.currRow+1-this.nrRollUpRows,U=this.lastOutputScreen;if(U){var j=U.rows[T].cueStartTime,F=this.logger.time;if(j&&F!==null&&j<F)for(var V=0;V<this.nrRollUpRows;V++)this.rows[C-this.nrRollUpRows+V+1].copy(U.rows[T+V])}}this.currRow=C;var P=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,X=Math.max(I-1,0);P.setCursor(a.indent),a.color=P.chars[X].penState.foreground}var oe={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(oe)},f.setBkgData=function(a){this.logger.log(k.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(k.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(k.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(a,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(k.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var C=[],m="",T=-1,U=0;U<G;U++){var j=this.rows[U].getTextString();j&&(T=U+1,a?C.push("Row "+T+": '"+j+"'"):C.push(j.trim()))}return C.length>0&&(a?m="["+C.join(" | ")+"]":m=C.join(`
`)),m},f.getTextAndFormat=function(){return this.rows},s}(),S=function(){function s(l,a,C){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(C),this.nonDisplayedMemory=new d(C),this.lastOutputScreen=new d(C),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}var f=s.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[G-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(k.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 C=0;C<a.length;C++)this.writeScreen.insertChar(a[C]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(k.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(k.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(k.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(k.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(k.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(k.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(k.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(k.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(k.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(k.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(k.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(k.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(k.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(k.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(k.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(k.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var C={flash:!1};if(C.underline=a%2===1,C.italics=a>=46,C.italics)C.foreground="white";else{var m=Math.floor(a/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=T[m]}this.logger.log(k.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),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))},s}(),v=function(){function s(l,a,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new x;this.channels=[null,new S(l,a,m),new S(l+1,C,m)],this.cmdHistory=b(),this.logger=m}var f=s.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,C){this.channels[a].setHandler(C)},f.addData=function(a,C){var m,T,U,j=!1;this.logger.time=a;for(var F=0;F<C.length;F+=2){if(T=C[F]&127,U=C[F+1]&127,T===0&&U===0)continue;if(this.logger.log(k.DATA,"["+E([C[F],C[F+1]])+"] -> ("+E([T,U])+")"),m=this.parseCmd(T,U),m||(m=this.parseMidrow(T,U)),m||(m=this.parsePAC(T,U)),m||(m=this.parseBackgroundAttributes(T,U)),!m&&(j=this.parseChars(T,U),j)){var V=this.currentChannel;if(V&&V>0){var P=this.channels[V];P.insertChars(j)}else this.logger.log(k.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!j&&this.logger.log(k.WARNING,"Couldn't parse cleaned data "+E([T,U])+" orig: "+E([C[F],C[F+1]]))}},f.parseCmd=function(a,C){var m=this.cmdHistory,T=(a===20||a===28||a===21||a===29)&&C>=32&&C<=47,U=(a===23||a===31)&&C>=33&&C<=35;if(!(T||U))return!1;if(w(a,C,m))return p(null,null,m),this.logger.log(k.DEBUG,"Repeated command ("+E([a,C])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,F=this.channels[j];return a===20||a===21||a===28||a===29?C===32?F.ccRCL():C===33?F.ccBS():C===34?F.ccAOF():C===35?F.ccAON():C===36?F.ccDER():C===37?F.ccRU(2):C===38?F.ccRU(3):C===39?F.ccRU(4):C===40?F.ccFON():C===41?F.ccRDC():C===42?F.ccTR():C===43?F.ccRTD():C===44?F.ccEDM():C===45?F.ccCR():C===46?F.ccENM():C===47&&F.ccEOC():F.ccTO(C-32),p(a,C,m),this.currentChannel=j,!0},f.parseMidrow=function(a,C){var m=0;if((a===17||a===25)&&C>=32&&C<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(k.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[m];return T?(T.ccMIDROW(C),this.logger.log(k.DEBUG,"MIDROW ("+E([a,C])+")"),!0):!1}return!1},f.parsePAC=function(a,C){var m,T=this.cmdHistory,U=(a>=17&&a<=23||a>=25&&a<=31)&&C>=64&&C<=127,j=(a===16||a===24)&&C>=64&&C<=95;if(!(U||j))return!1;if(w(a,C,T))return p(null,null,T),!0;var F=a<=23?1:2;C>=64&&C<=95?m=F===1?_[a]:y[a]:m=F===1?O[a]:A[a];var V=this.channels[F];return V?(V.setPAC(this.interpretPAC(m,C)),p(a,C,T),this.currentChannel=F,!0):!1},f.interpretPAC=function(a,C){var m,T={color:null,italics:!1,indent:null,underline:!1,row:a};return C>95?m=C-96:m=C-64,T.underline=(m&1)===1,m<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((m-16)/2)*4,T},f.parseChars=function(a,C){var m,T=null,U=null;if(a>=25?(m=2,U=a-8):(m=1,U=a),U>=17&&U<=19){var j;U===17?j=C+80:U===18?j=C+112:j=C+144,this.logger.log(k.INFO,"Special char '"+M(j)+"' in channel "+m),T=[j]}else a>=32&&a<=127&&(T=C===0?[a]:[a,C]);if(T){var F=E(T);this.logger.log(k.DEBUG,"Char codes = "+F.join(",")),p(a,C,this.cmdHistory)}return T},f.parseBackgroundAttributes=function(a,C){var m=(a===16||a===24)&&C>=32&&C<=47,T=(a===23||a===31)&&C>=45&&C<=47;if(!(m||T))return!1;var U,j={};a===16||a===24?(U=Math.floor((C-32)/2),j.background=R[U],C%2===1&&(j.background=j.background+"_semi")):C===45?j.background="transparent":(j.foreground="black",C===47&&(j.underline=!0));var F=a<=23?1:2,V=this.channels[F];return V.setBkgData(j),p(a,C,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var C=this.channels[a];C&&C.reset()}this.cmdHistory=b()},f.cueSplitAtTime=function(a){for(var C=0;C<this.channels.length;C++){var m=this.channels[C];m&&m.cueSplitAtTime(a)}},s}();function p(s,f,l){l.a=s,l.b=f}function w(s,f,l){return l.a===s&&l.b===f}function b(){return{a:null,b:null}}$.default=v},"./src/utils/codecs.ts":function(ce,$,D){"use strict";D.r($),D.d($,"isCodecType",function(){return B}),D.d($,"isCodecSupportedInMp4",function(){return M});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 B(G,W){var _=Z[W];return!!_&&_[G.slice(0,4)]===!0}function M(G,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/utils/vttparser.ts"),B=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),G=/\s/,W={newCue:function(O,y,A,R){for(var k=[],x,E,h,o,u,d=self.VTTCue||self.TextTrackCue,S=0;S<R.rows.length;S++)if(x=R.rows[S],h=!0,o=0,u="",!x.isEmpty()){for(var v=0;v<x.chars.length;v++)G.test(x.chars[v].uchar)&&h?o++:(u+=x.chars[v].uchar,h=!1);x.cueStartTime=y,y===A&&(A+=1e-4),o>=16?o--:o++;var p=Object(Z.fixLineBreaks)(u.trim()),w=Object(B.generateCueId)(y,A,p);(!O||!O.cues||!O.cues.getCueById(w))&&(E=new d(y,A,p),E.id=w,E.line=S+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),k.push(E))}return O&&k.length&&(k.sort(function(b,s){return b.line==="auto"||s.line==="auto"?0:b.line>8&&s.line>8?s.line-b.line:b.line-s.line}),k.forEach(function(b){return Object(M.addCueToTrack)(O,b)})),k}};$.default=W},"./src/utils/discontinuities.ts":function(ce,$,D){"use strict";D.r($),D.d($,"findFirstFragWithCC",function(){return G}),D.d($,"shouldAlignOnDiscontinuities",function(){return W}),D.d($,"findDiscontinuousReferenceFrag",function(){return _}),D.d($,"adjustSlidingStart",function(){return y}),D.d($,"alignStream",function(){return A}),D.d($,"alignPDT",function(){return k}),D.d($,"alignFragmentByPDTDelta",function(){return x}),D.d($,"alignMediaPlaylistByPDT",function(){return E});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function G(h,o){for(var u=null,d=0,S=h.length;d<S;d++){var v=h[d];if(v&&v.cc===o){u=v;break}}return u}function W(h,o,u){return!!(o.details&&(u.endCC>u.startCC||h&&h.cc<u.startCC))}function _(h,o){var u=h.fragments,d=o.fragments;if(!d.length||!u.length){B.logger.log("No fragments to align");return}var S=G(u,d[0].cc);if(!S||S&&!S.startPTS){B.logger.log("No frag in previous level to align on");return}return S}function O(h,o){if(h){var u=h.start+o;h.start=h.startPTS=u,h.endPTS=u+h.duration}}function y(h,o){for(var u=o.fragments,d=0,S=u.length;d<S;d++)O(u[d],h);o.fragmentHint&&O(o.fragmentHint,h),o.alignedSliding=!0}function A(h,o,u){if(!o)return;R(h,u,o),!u.alignedSliding&&o.details&&k(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(M.adjustSliding)(o.details,u)}function R(h,o,u){if(W(h,u,o)){var d=_(u.details,o);d&&Object(Z.isFiniteNumber)(d.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(d.start,o))}}function k(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,S=(d-u)/1e3+o.fragments[0].start;S&&Object(Z.isFiniteNumber)(S)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(d-u)+"ms, sliding:"+S.toFixed(3)+" "+h.url+" "),y(S,h))}function x(h,o){var u=h.programDateTime;if(!u)return;var d=(u-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function E(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,d=o.fragments[0].start,S=u-d*1e3;h.fragments.forEach(function(v){x(v,S)}),h.fragmentHint&&x(h.fragmentHint,S),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/utils/ewma.ts"),B=function(){function M(W,_,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(W),this.fast_=new Z.default(_)}var G=M.prototype;return G.update=function(_,O){var y=this.slow_,A=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new Z.default(_,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new Z.default(O,A.getEstimate(),A.getTotalWeight()))},G.sample=function(_,O){_=Math.max(_,this.minDelayMs_);var y=8*O,A=_/1e3,R=y/A;this.fast_.sample(A,R),this.slow_.sample(A,R)},G.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},M}();$.default=B},"./src/utils/ewma.ts":function(ce,$,D){"use strict";D.r($);var Z=function(){function B(G,W,_){W===void 0&&(W=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=W,this.totalWeight_=_}var M=B.prototype;return M.sample=function(W,_){var O=Math.pow(this.alpha_,W);this.estimate_=_*(1-O)+O*this.estimate_,this.totalWeight_+=W},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},B}();$.default=Z},"./src/utils/fetch-loader.ts":function(ce,$,D){"use strict";D.r($),D.d($,"fetchSupported",function(){return x});var Z=D("./src/polyfills/number.ts"),B=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function G(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,A(d,S)}function W(d){var S=typeof Map=="function"?new Map:void 0;return W=function(p){if(p===null||!y(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 _(p,arguments,R(this).constructor)}return w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,p)},W(d)}function _(d,S,v){return O()?_=Reflect.construct:_=function(w,b,s){var f=[null];f.push.apply(f,b);var l=Function.bind.apply(w,f),a=new l;return s&&A(a,s.prototype),a},_.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function y(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,S){return A=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},A(d,S)}function R(d){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},R(d)}function k(){return k=Object.assign||function(d){for(var S=1;S<arguments.length;S++){var v=arguments[S];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(d[p]=v[p])}return d},k.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 E=function(){function d(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||o,this.controller=new self.AbortController,this.stats=new B.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 s=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var l=h(p,this.controller.signal),a=b.onProgress,C=p.responseType==="arraybuffer",m=C?"byteLength":"length";this.context=p,this.config=w,this.callbacks=b,this.request=this.fetchSetup(p,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){s.abortInternal(),b.onTimeout(f,p,s.response)},w.timeout),self.fetch(this.request).then(function(T){if(s.response=s.loader=T,!T.ok){var U=T.status,j=T.statusText;throw new u(j||"fetch, bad network response",U,T)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(T.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(w.highWaterMark)?s.loadProgressively(T,f,p,w.highWaterMark,a):C?T.arrayBuffer():T.text()}).then(function(T){var U=s.response;self.clearTimeout(s.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=T[m];var j={url:U.url,data:T};a&&!Object(Z.isFiniteNumber)(w.highWaterMark)&&a(f,p,T,U),b.onSuccess(j,f,p,U)}).catch(function(T){if(self.clearTimeout(s.requestTimeout),f.aborted)return;var U=T.code||0;b.onError({code:U,text:T.message},p,T.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,s,f){s===void 0&&(s=0);var l=new M.default,a=p.body.getReader(),C=function m(){return a.read().then(function(T){if(T.done)return l.dataLength&&f(w,b,l.flush(),p),Promise.resolve(new ArrayBuffer(0));var U=T.value,j=U.length;return w.loaded+=j,j<s||l.dataLength?(l.push(U),l.dataLength>=s&&f(w,b,l.flush(),p)):f(w,b,U,p),m()}).catch(function(){return Promise.reject()})};return C()},d}();function h(d,S){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(k({},d.headers))};return d.rangeEnd&&v.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),v}function o(d,S){return new self.Request(d.url,S)}var u=function(d){G(S,d);function S(v,p,w){var b;return b=d.call(this,v)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=w,b}return S}(W(Error));$.default=E},"./src/utils/imsc1-ttml-parser.ts":function(ce,$,D){"use strict";D.r($),D.d($,"IMSC1_CODEC",function(){return y}),D.d($,"parseIMSC1",function(){return x});var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/vttparser.ts"),M=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),_=D("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(s){for(var f=1;f<arguments.length;f++){var l=arguments[f];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(s[a]=l[a])}return s},O.apply(this,arguments)}var y="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,k={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(s,f,l,a,C){var m=Object(Z.findBox)(new Uint8Array(s),["mdat"]);if(m.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var T=m[0],U=Object(G.utf8ArrayToStr)(new Uint8Array(s,T.start,T.end-T.start)),j=Object(W.toTimescaleFromScale)(f,1,l);try{a(E(U,j))}catch(F){C(F)}}function E(s,f){var l=new DOMParser,a=l.parseFromString(s,"text/xml"),C=a.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(m).reduce(function(P,I){return P[I]=C.getAttribute("ttp:"+I)||m[I],P},{}),U=C.getAttribute("xml:space")!=="preserve",j=o(h(C,"styling","style")),F=o(h(C,"layout","region")),V=h(C,"body","[begin]");return[].map.call(V,function(P){var I=u(P,U);if(!I||!P.hasAttribute("begin"))return null;var X=p(P.getAttribute("begin"),T),oe=p(P.getAttribute("dur"),T),pe=p(P.getAttribute("end"),T);if(X===null)throw v(P);if(pe===null){if(oe===null)throw v(P);pe=X+oe}var ve=new M.default(X-f,pe-f,I);ve.id=Object(_.generateCueId)(ve.startTime,ve.endTime,ve.text);var Le=F[P.getAttribute("region")],ke=j[P.getAttribute("style")];ve.position=10,ve.size=80;var he=d(Le,ke),ae=he.textAlign;if(ae){var ue=k[ae];ue&&(ve.lineAlign=ue),ve.align=ae}return O(ve,he),ve}).filter(function(P){return P!==null})}function h(s,f,l){var a=s.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(s){return s.reduce(function(f,l){var a=l.getAttribute("xml:id");return a&&(f[a]=l),f},{})}function u(s,f){return[].slice.call(s.childNodes).reduce(function(l,a,C){var m;return a.nodeName==="br"&&C?l+`
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,f):f?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function d(s,f){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(C,m){var T=S(f,l,m)||S(s,l,m);return T&&(C[m]=T),C},{})}function S(s,f,l){return s.hasAttributeNS(f,l)?s.getAttributeNS(f,l):null}function v(s){return new Error("Could not parse ttml timestamp "+s)}function p(s,f){if(!s)return null;var l=Object(B.parseTimeStamp)(s);return l===null&&(A.test(s)?l=w(s,f):R.test(s)&&(l=b(s,f))),l}function w(s,f){var l=A.exec(s),a=(l[4]|0)+(l[5]|0)/f.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/f.frameRate}function b(s,f){var l=R.exec(s),a=Number(l[1]),C=l[2];switch(C){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(ce,$,D){"use strict";D.r($),D.d($,"enableLogs",function(){return _}),D.d($,"logger",function(){return O});var Z=function(){},B={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},M=B;function G(y){var A=self.console[y];return A?A.bind(self.console,"["+y+"] >"):Z}function W(y){for(var A=arguments.length,R=new Array(A>1?A-1:0),k=1;k<A;k++)R[k-1]=arguments[k];R.forEach(function(x){M[x]=y[x]?y[x].bind(y):G(x)})}function _(y){if(self.console&&y===!0||typeof y=="object"){W(y,"debug","log","info","warn","error");try{M.log()}catch(A){M=B}}else M=B}var O=M},"./src/utils/mediakeys-helper.ts":function(ce,$,D){"use strict";D.r($),D.d($,"KeySystems",function(){return Z}),D.d($,"requestMediaKeySystemAccess",function(){return B});var Z;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,$,D){"use strict";D.r($),D.d($,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,$,D){"use strict";D.r($),D.d($,"bin2str",function(){return W}),D.d($,"readUint16",function(){return _}),D.d($,"readUint32",function(){return O}),D.d($,"writeUint32",function(){return y}),D.d($,"findBox",function(){return A}),D.d($,"parseSegmentIndex",function(){return R}),D.d($,"parseInitSegment",function(){return k}),D.d($,"getStartDTS",function(){return x}),D.d($,"getDuration",function(){return E}),D.d($,"computeRawDurationFromSamples",function(){return h}),D.d($,"offsetStartDTS",function(){return o}),D.d($,"segmentValidRange",function(){return u}),D.d($,"appendUint8Array",function(){return d});var Z=D("./src/utils/typed-array.ts"),B=D("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,G=[].push;function W(S){return String.fromCharCode.apply(null,S)}function _(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<8|S[v+1];return p<0?65536+p:p}function O(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<24|S[v+1]<<16|S[v+2]<<8|S[v+3];return p<0?4294967296+p:p}function y(S,v,p){"data"in S&&(v+=S.start,S=S.data),S[v]=p>>24,S[v+1]=p>>16&255,S[v+2]=p>>8&255,S[v+3]=p&255}function A(S,v){var p=[];if(!v.length)return p;var w,b,s;"data"in S?(w=S.data,b=S.start,s=S.end):(w=S,b=0,s=w.byteLength);for(var f=b;f<s;){var l=O(w,f),a=W(w.subarray(f+4,f+8)),C=l>1?f+l:s;if(a===v[0])if(v.length===1)p.push({data:w,start:f+8,end:C});else{var m=A({data:w,start:f+8,end:C},v.slice(1));m.length&&G.apply(p,m)}f=C}return p}function R(S){var v=A(S,["moov"]),p=v[0],w=p?p.end:null,b=A(S,["sidx"]);if(!b||!b[0])return null;var s=[],f=b[0],l=f.data[0],a=l===0?8:16,C=O(f,a);a+=4;var m=0,T=0;l===0?a+=8:a+=16,a+=2;var U=f.end+T,j=_(f,a);a+=2;for(var F=0;F<j;F++){var V=a,P=O(f,V);V+=4;var I=P&2147483647,X=(P&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var oe=O(f,V);V+=4,s.push({referenceSize:I,subsegmentDuration:oe,info:{duration:oe/C,start:U,end:U+I-1}}),U+=I,V+=4,a=V}return{earliestPresentationTime:m,timescale:C,version:l,referencesCount:j,references:s,moovEndOffset:w}}function k(S){for(var v=[],p=A(S,["moov","trak"]),w=0;w<p.length;w++){var b=p[w],s=A(b,["tkhd"])[0];if(s){var f=s.data[s.start],l=f===0?12:20,a=O(s,l),C=A(b,["mdia","mdhd"])[0];if(C){f=C.data[C.start],l=f===0?12:20;var m=O(C,l),T=A(b,["mdia","hdlr"])[0];if(T){var U=W(T.data.subarray(T.start+8,T.start+12)),j={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[U];if(j){var F=A(b,["mdia","minf","stbl","stsd"])[0],V=void 0;F&&(V=W(F.data.subarray(F.start+12,F.start+16))),v[a]={timescale:m,type:j},v[j]={timescale:m,id:a,codec:V}}}}}}var P=A(S,["moov","mvex","trex"]);return P.forEach(function(I){var X=O(I,4),oe=v[X];oe&&(oe.default={duration:O(I,12),flags:O(I,20)})}),v}function x(S,v){return A(v,["moof","traf"]).reduce(function(p,w){var b=A(w,["tfdt"])[0],s=b.data[b.start],f=A(w,["tfhd"]).reduce(function(l,a){var C=O(a,4),m=S[C];if(m){var T=O(b,4);s===1&&(T*=Math.pow(2,32),T+=O(b,8));var U=m.timescale||9e4,j=T/U;if(isFinite(j)&&(l===null||j<l))return j}return l},null);return f!==null&&isFinite(f)&&(p===null||f<p)?f:p},null)||0}function E(S,v){for(var p=0,w=0,b=0,s=A(S,["moof","traf"]),f=0;f<s.length;f++){var l=s[f],a=A(l,["tfhd"])[0],C=O(a,4),m=v[C];if(!m)continue;var T=m.default,U=O(a,0)|(T==null?void 0:T.flags),j=T==null?void 0:T.duration;U&8&&(U&2?j=O(a,12):j=O(a,8));for(var F=m.timescale||9e4,V=A(l,["trun"]),P=0;P<V.length;P++){if(j){var I=O(V[P],4);p=j*I}else p=h(V[P]);m.type===B.ElementaryStreamTypes.VIDEO?w+=p/F:m.type===B.ElementaryStreamTypes.AUDIO&&(b+=p/F)}}if(w===0&&b===0){var X=R(S);if(X!=null&&X.references)return X.references.reduce(function(oe,pe){return oe+pe.info.duration||0},0)}return w||b}function h(S){var v=O(S,0),p=8;v&1&&(p+=4),v&4&&(p+=4);for(var w=0,b=O(S,4),s=0;s<b;s++){if(v&256){var f=O(S,p);w+=f,p+=4}v&512&&(p+=4),v&1024&&(p+=4),v&2048&&(p+=4)}return w}function o(S,v,p){A(v,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(b){var s=O(b,4),f=S[s];if(!f)return;var l=f.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var C=a.data[a.start],m=O(a,4);if(C===0)y(a,4,m-p*l);else{m*=Math.pow(2,32),m+=O(a,8),m-=p*l,m=Math.max(m,0);var T=Math.floor(m/(M+1)),U=Math.floor(m%(M+1));y(a,4,T),y(a,8,U)}})})})}function u(S){var v={valid:null,remainder:null},p=A(S,["moof"]);if(p){if(p.length<2)return v.remainder=S,v}else return v;var w=p[p.length-1];return v.valid=Object(Z.sliceUint8)(S,0,w.start-8),v.remainder=Object(Z.sliceUint8)(S,w.start-8),v}function d(S,v){var p=new Uint8Array(S.length+v.length);return p.set(S),p.set(v,S.length),p}},"./src/utils/output-filter.ts":function(ce,$,D){"use strict";D.r($),D.d($,"default",function(){return Z});var Z=function(){function B(G,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=W}var M=B.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(W,_,O){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=_,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ce,$,D){"use strict";D.r($),D.d($,"sendAddTrackEvent",function(){return B}),D.d($,"addCueToTrack",function(){return M}),D.d($,"clearCurrentCues",function(){return G}),D.d($,"removeCuesInRange",function(){return W}),D.d($,"getCuesInRange",function(){return O});var Z=D("./src/utils/logger.ts");function B(y,A){var R;try{R=new Event("addtrack")}catch(k){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=y,A.dispatchEvent(R)}function M(y,A){var R=y.mode;if(R==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(A.id))try{if(y.addCue(A),!y.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(x){Z.logger.debug("[texttrack-utils]: "+x);var k=new self.TextTrackCue(A.startTime,A.endTime,A.text);k.id=A.id,y.addCue(k)}R==="disabled"&&(y.mode=R)}function G(y){var A=y.mode;if(A==="disabled"&&(y.mode="hidden"),y.cues)for(var R=y.cues.length;R--;)y.removeCue(y.cues[R]);A==="disabled"&&(y.mode=A)}function W(y,A,R){var k=y.mode;if(k==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var x=O(y.cues,A,R),E=0;E<x.length;E++)y.removeCue(x[E]);k==="disabled"&&(y.mode=k)}function _(y,A){if(A<y[0].startTime)return 0;var R=y.length-1;if(A>y[R].endTime)return-1;for(var k=0,x=R;k<=x;){var E=Math.floor((x+k)/2);if(A<y[E].startTime)x=E-1;else if(A>y[E].startTime&&k<R)k=E+1;else return E}return y[k].startTime-A<A-y[x].startTime?k:x}function O(y,A,R){var k=[],x=_(y,A);if(x>-1)for(var E=x,h=y.length;E<h;E++){var o=y[E];if(o.startTime>=A&&o.endTime<=R)k.push(o);else if(o.startTime>R)return k}return k}},"./src/utils/time-ranges.ts":function(ce,$,D){"use strict";D.r($);var Z={toString:function(M){for(var G="",W=M.length,_=0;_<W;_++)G+="["+M.start(_).toFixed(3)+","+M.end(_).toFixed(3)+"]";return G}};$.default=Z},"./src/utils/timescale-conversion.ts":function(ce,$,D){"use strict";D.r($),D.d($,"toTimescaleFromBase",function(){return B}),D.d($,"toTimescaleFromScale",function(){return M}),D.d($,"toMsFromMpegTsClock",function(){return G}),D.d($,"toMpegTsClockFromTimescale",function(){return W});var Z=9e4;function B(_,O,y,A){y===void 0&&(y=1),A===void 0&&(A=!1);var R=_*O*y;return A?Math.round(R):R}function M(_,O,y,A){return y===void 0&&(y=1),A===void 0&&(A=!1),B(_,O,1/y,A)}function G(_,O){return O===void 0&&(O=!1),B(_,1e3,1/Z,O)}function W(_,O){return O===void 0&&(O=1),B(_,Z,1/O)}},"./src/utils/typed-array.ts":function(ce,$,D){"use strict";D.r($),D.d($,"sliceUint8",function(){return Z});function Z(B,M,G){return Uint8Array.prototype.slice?B.slice(M,G):new Uint8Array(Array.prototype.slice.call(B,M,G))}},"./src/utils/vttcue.ts":function(ce,$,D){"use strict";D.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],B=["start","middle","end","left","right"];function M(y,A){if(typeof A!="string")return!1;if(!Array.isArray(y))return!1;var R=A.toLowerCase();return~y.indexOf(R)?R:!1}function G(y){return M(Z,y)}function W(y){return M(B,y)}function _(y){for(var A=arguments.length,R=new Array(A>1?A-1:0),k=1;k<A;k++)R[k-1]=arguments[k];for(var x=1;x<arguments.length;x++){var E=arguments[x];for(var h in E)y[h]=E[h]}return y}function O(y,A,R){var k=this,x={enumerable:!0};k.hasBeenReset=!1;var E="",h=!1,o=y,u=A,d=R,S=null,v="",p=!0,w="auto",b="start",s=50,f="middle",l=50,a="middle";Object.defineProperty(k,"id",_({},x,{get:function(){return E},set:function(m){E=""+m}})),Object.defineProperty(k,"pauseOnExit",_({},x,{get:function(){return h},set:function(m){h=!!m}})),Object.defineProperty(k,"startTime",_({},x,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"endTime",_({},x,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"text",_({},x,{get:function(){return d},set:function(m){d=""+m,this.hasBeenReset=!0}})),Object.defineProperty(k,"region",_({},x,{get:function(){return S},set:function(m){S=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"vertical",_({},x,{get:function(){return v},set:function(m){var T=G(m);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=T,this.hasBeenReset=!0}})),Object.defineProperty(k,"snapToLines",_({},x,{get:function(){return p},set:function(m){p=!!m,this.hasBeenReset=!0}})),Object.defineProperty(k,"line",_({},x,{get:function(){return w},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"lineAlign",_({},x,{get:function(){return b},set:function(m){var T=W(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");b=T,this.hasBeenReset=!0}})),Object.defineProperty(k,"position",_({},x,{get:function(){return s},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"positionAlign",_({},x,{get:function(){return f},set:function(m){var T=W(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");f=T,this.hasBeenReset=!0}})),Object.defineProperty(k,"size",_({},x,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"align",_({},x,{get:function(){return a},set:function(m){var T=W(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");a=T,this.hasBeenReset=!0}})),k.displayState=void 0}return O.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(ce,$,D){"use strict";D.r($),D.d($,"parseTimeStamp",function(){return M}),D.d($,"fixLineBreaks",function(){return A}),D.d($,"VTTParser",function(){return R});var Z=D("./src/utils/vttcue.ts"),B=function(){function k(){}var x=k.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))},k}();function M(k){function x(h,o,u,d){return(h|0)*3600+(o|0)*60+(u|0)+parseFloat(d||0)}var E=k.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?x(E[2],E[3],0,E[4]):x(E[1],E[2],E[3],E[4]):null}var G=function(){function k(){this.values=Object.create(null)}var x=k.prototype;return x.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},x.get=function(h,o,u){return u?this.has(h)?this.values[h]:o[u]:this.has(h)?this.values[h]:o},x.has=function(h){return h in this.values},x.alt=function(h,o,u){for(var d=0;d<u.length;++d)if(o===u[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 u=parseFloat(o);if(u>=0&&u<=100)return this.set(h,u),!0}return!1},k}();function W(k,x,E,h){var o=h?k.split(h):[k];for(var u in o){if(typeof o[u]!="string")continue;var d=o[u].split(E);if(d.length!==2)continue;var S=d[0],v=d[1];x(S,v)}}var _=new Z.default(0,0,""),O=_.align==="middle"?"middle":"center";function y(k,x,E){var h=k;function o(){var S=M(k);if(S===null)throw new Error("Malformed timestamp: "+h);return k=k.replace(/^[^\sa-zA-Z-]+/,""),S}function u(S,v){var p=new G;W(S,function(s,f){var l;switch(s){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===f){p.set(s,E[a].region);break}break;case"vertical":p.alt(s,f,["rl","lr"]);break;case"line":l=f.split(","),p.integer(s,l[0]),p.percent(s,l[0])&&p.set("snapToLines",!1),p.alt(s,l[0],["auto"]),l.length===2&&p.alt("lineAlign",l[1],["start",O,"end"]);break;case"position":l=f.split(","),p.percent(s,l[0]),l.length===2&&p.alt("positionAlign",l[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":p.percent(s,f);break;case"align":p.alt(s,f,["start",O,"end","left","right"]);break}},/:/,/\s/),v.region=p.get("region",null),v.vertical=p.get("vertical","");var w=p.get("line","auto");w==="auto"&&_.line===-1&&(w=-1),v.line=w,v.lineAlign=p.get("lineAlign","start"),v.snapToLines=p.get("snapToLines",!0),v.size=p.get("size",100),v.align=p.get("align",O);var b=p.get("position","auto");b==="auto"&&_.position===50&&(b=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=b}function d(){k=k.replace(/^\s+/,"")}if(d(),x.startTime=o(),d(),k.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);k=k.substr(3),d(),x.endTime=o(),d(),u(k,x)}function A(k){return k.replace(/<br(?: \/)?>/gi,`
`)}var R=function(){function k(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=k.prototype;return x.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function u(){var b=o.buffer,s=0;for(b=A(b);s<b.length&&b[s]!=="\r"&&b[s]!==`
`;)++s;var f=b.substr(0,s);return b[s]==="\r"&&++s,b[s]===`
`&&++s,o.buffer=b.substr(s),f}function d(b){W(b,function(s,f){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=u();var v=S.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[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=u();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{y(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},k}()},"./src/utils/webvtt-parser.ts":function(ce,$,D){"use strict";D.r($),D.d($,"generateCueId",function(){return R}),D.d($,"parseWebVTT",function(){return x});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/vttparser.ts"),M=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),W=D("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,O=function(h,o,u){return u===void 0&&(u=0),h.substr(u,o.length)===o},y=function(h){var o=parseInt(h.substr(-3)),u=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)(u)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*u,o+=60*1e3*d,o+=60*60*1e3*S,o},A=function(h){for(var o=5381,u=h.length;u;)o=o*33^h.charCodeAt(--u);return(o>>>0).toString()};function R(E,h,o){return A(E.toString())+A(h.toString())+A(o)}var k=function(h,o,u){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(;(v=S)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=d.start-S.start,d.new=!1,d=S,S=h[d.prevCC]}h.presentationOffset=u};function x(E,h,o,u,d,S,v,p){var w=new B.VTTParser,b=Object(M.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(_,`
`).split(`
`),s=[],f=Object(G.toMpegTsClockFromTimescale)(h,o),l="00:00.000",a=0,C=0,m,T=!0,U=!1;w.oncue=function(j){var F=u[d],V=u.ccOffset,P=(a-f)/9e4;if(F!=null&&F.new&&(C!==void 0?V=u.ccOffset=F.start:k(u,d,P)),P&&(V=P-u.presentationOffset),U){var I=j.endTime-j.startTime,X=Object(W.normalizePts)((j.startTime+V-C)*9e4,S*9e4)/9e4;j.startTime=X,j.endTime=X+I}var oe=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(oe)),j.id||(j.id=R(j.startTime,j.endTime,oe)),j.endTime>0&&s.push(j)},w.onparsingerror=function(j){m=j},w.onflush=function(){if(m){p(m);return}v(s)},b.forEach(function(j){if(T)if(O(j,"X-TIMESTAMP-MAP=")){T=!1,U=!0,j.substr(16).split(",").forEach(function(F){O(F,"LOCAL:")?l=F.substr(6):O(F,"MPEGTS:")&&(a=parseInt(F.substr(7)))});try{C=y(l)/1e3}catch(F){U=!1,m=F}return}else j===""&&(T=!1);w.parse(j+`
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(ce,$,D){"use strict";D.r($);var Z=D("./src/utils/logger.ts"),B=D("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,G=function(){function W(O){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=O?O.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var _=W.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},_.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(y,A,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=A,this.callbacks=R,this.retryDelay=A.retryDelay,this.loadInternal()},_.loadInternal=function(){var y=this.config,A=this.context;if(!y)return;var R=this.loader=new self.XMLHttpRequest,k=this.stats;k.loading.first=0,k.loaded=0;var x=this.xhrSetup;try{if(x)try{x(R,A.url)}catch(o){R.open("GET",A.url,!0),x(R,A.url)}R.readyState||R.open("GET",A.url,!0);var E=this.context.headers;if(E)for(var h in E)R.setRequestHeader(h,E[h])}catch(o){this.callbacks.onError({code:R.status,text:o.message},A,R);return}A.rangeEnd&&R.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),R.send()},_.readystatechange=function(){var y=this.context,A=this.loader,R=this.stats;if(!y||!A)return;var k=A.readyState,x=this.config;if(R.aborted)return;if(k>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),k===4){A.onreadystatechange=null,A.onprogress=null;var E=A.status;if(E>=200&&E<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var h,o;if(y.responseType==="arraybuffer"?(h=A.response,o=h.byteLength):(h=A.responseText,o=h.length),R.loaded=R.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(R,y,h,A),!this.callbacks)return;var d={url:A.responseURL,data:h};this.callbacks.onSuccess(d,R,y,A)}else R.retry>=x.maxRetry||E>=400&&E<499?(Z.logger.error(E+" while loading "+y.url),this.callbacks.onError({code:E,text:A.statusText},y,A)):(Z.logger.warn(E+" while loading "+y.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),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},_.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(y){var A=this.stats;A.loaded=y.loaded,y.lengthComputable&&(A.total=y.total)},_.getCacheAge=function(){var y=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");y=A?parseFloat(A):null}return y},W}();$.default=G}}).default})},vHTk:function(wt,nt,re){wt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);