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

366 lines
926 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[185,6,7,8,11],{"+NIl":function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";fe.defineMode("stex",function(Z,_){"use strict";function Q(L,A){L.cmdState.push(A)}function U(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function D(L){var A=L.cmdState.pop();A&&A.closeBracket()}function G(L){for(var A=L.cmdState,w=A.length-1;w>=0;w--){var d=A[w];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function H(L,A,w){return function(){this.name=L,this.bracketNo=0,this.style=A,this.styles=w,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var F={};F.importmodule=H("importmodule","tag",["string","builtin"]),F.documentclass=H("documentclass","tag",["","atom"]),F.usepackage=H("usepackage","tag",["atom"]),F.begin=H("begin","tag",["atom"]),F.end=H("end","tag",["atom"]),F.label=H("label","tag",["atom"]),F.ref=H("ref","tag",["atom"]),F.eqref=H("eqref","tag",["atom"]),F.cite=H("cite","tag",["atom"]),F.bibitem=H("bibitem","tag",["atom"]),F.Bibitem=H("Bibitem","tag",["atom"]),F.RBibitem=H("RBibitem","tag",["atom"]),F.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(L,A){L.f=A}function y(L,A){var w;if(L.match(/^\\[a-zA-Z@]+/)){var d=L.current().slice(1);return w=F.hasOwnProperty(d)?F[d]:F.DEFAULT,w=new w,Q(A,w),O(A,I),w.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return O(A,function(l,u){return T(l,u,"\\]")}),"keyword";if(L.match("\\("))return O(A,function(l,u){return T(l,u,"\\)")}),"keyword";if(L.match("$$"))return O(A,function(l,u){return T(l,u,"$$")}),"keyword";if(L.match("$"))return O(A,function(l,u){return T(l,u,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(w=U(A),w)w.closeBracket(o),O(A,I);else return"error";return"bracket"}else return o=="{"||o=="["?(w=F.DEFAULT,w=new w,Q(A,w),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),w=G(A),w.name=="begin"&&(w.argument=L.current()),w.styleIdentifier())}function T(L,A,w){if(L.eatSpace())return null;if(w&&L.match(w))return O(A,y),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=L.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(L.skipToEnd(),"comment"):"error"}function I(L,A){var w=L.peek(),d;return w=="{"||w=="["?(d=U(A),d.openBracket(w),L.eat(w),O(A,y),"bracket"):/[ \t\r]/.test(w)?(L.eat(w),null):(O(A,y),D(A),y(L,A))}return{startState:function(){var L=_.inMathMode?function(A,w){return T(A,w)}:y;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,A){return A.f(L,A)},blankLine:function(L){L.f=y,L.cmdState.length=0},lineComment:"%"}}),fe.defineMIME("text/x-stex","stex"),fe.defineMIME("text/x-latex","stex")})},"19Vz":function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){fe.defineOption("placeholder","",function(H,F,O){var y=O&&O!=fe.Init;if(F&&!y)H.on("blur",U),H.on("change",D),H.on("swapDoc",D),fe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){Q(H)}),D(H);else if(!F&&y){H.off("blur",U),H.off("change",D),H.off("swapDoc",D),fe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var T=H.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}F&&!H.hasFocus()&&U(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function _(H){Z(H);var F=H.state.placeholder=document.createElement("pre");F.style.cssText="height: 0; overflow: visible",F.style.direction=H.getOption("direction"),F.className="CodeMirror-placeholder CodeMirror-line-like";var O=H.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),F.appendChild(O),H.display.lineSpace.insertBefore(F,H.display.lineSpace.firstChild)}function Q(H){setTimeout(function(){var F=!1,O=H.getInputField();O.nodeName=="TEXTAREA"?F=!O.value:H.lineCount()==1&&(F=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),F?_(H):Z(H)},20)}function U(H){G(H)&&_(H)}function D(H){var F=H.getWrapperElement(),O=G(H);F.className=F.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?_(H):Z(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";var Z={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},_={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};fe.defineMode("xml",function(Q,U){var D=Q.indentUnit,G={},H=U.htmlMode?Z:_;for(var F in H)G[F]=H[F];for(var F in U)G[F]=U[F];var O,y;function T(a,b){function m(W){return b.tokenize=W,W(a,b)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(A("atom","]]>")):null:a.match("--")?m(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(w(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=A("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",b.tokenize=I,"tag bracket");if(E=="&"){var B;return a.eat("#")?a.eat("x")?B=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):B=a.eatWhile(/[\d]/)&&a.eat(";"):B=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),B?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function I(a,b){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return b.tokenize=T,O=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return O="equals",null;if(m=="<"){b.tokenize=T,b.state=u,b.tagName=b.tagStart=null;var E=b.tokenize(a,b);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(b.tokenize=L(m),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var b=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=I;break}return"string"};return b.isInAttribute=!0,b}function A(a,b){return function(m,E){for(;!m.eol();){if(m.match(b)){E.tokenize=T;break}m.next()}return a}}function w(a){return function(b,m){for(var E;(E=b.next())!=null;){if(E=="<")return m.tokenize=w(a+1),m.tokenize(b,m);if(E==">")if(a==1){m.tokenize=T;break}else return m.tokenize=w(a-1),m.tokenize(b,m)}return"meta"}}function d(a,b,m){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=m,(G.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,b){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!G.contextGrabbers.hasOwnProperty(m)||!G.contextGrabbers[m].hasOwnProperty(b))return;o(a)}}function u(a,b,m){return a=="openTag"?(m.tagStart=b.column(),C):a=="closeTag"?v:u}function C(a,b,m){return a=="word"?(m.tagName=b.current(),y="tag",x):G.allowMissingTagName&&a=="endTag"?(y="tag bracket",x(a,b,m)):(y="error",C)}function v(a,b,m){if(a=="word"){var E=b.current();return m.context&&m.context.tagName!=E&&G.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||G.matchClosing===!1?(y="tag",g):(y="tag error",k)}else return G.allowMissingTagName&&a=="endTag"?(y="tag bracket",g(a,b,m)):(y="error",k)}function g(a,b,m){return a!="endTag"?(y="error",g):(o(m),u)}function k(a,b,m){return y="error",g(a,b,m)}function x(a,b,m){if(a=="word")return y="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,B=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(E)?l(m,E):(l(m,E),m.context=new d(m,E,B==m.indented)),u}return y="error",x}function f(a,b,m){return a=="equals"?p:(G.allowMissing||(y="error"),x(a,b,m))}function p(a,b,m){return a=="string"?h:a=="word"&&G.allowUnquoted?(y="string",x):(y="error",x(a,b,m))}function h(a,b,m){return a=="string"?h:x(a,b,m)}return{startState:function(a){var b={tokenize:T,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;O=null;var m=b.tokenize(a,b);return(m||O)&&m!="comment"&&(y=null,b.state=b.state(O||m,a,b),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,b,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+D;if(E&&E.noIndent)return fe.Pass;if(a.tokenize!=I&&a.tokenize!=T)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+D*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var B=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(B&&B[1])for(;E;)if(E.tagName==B[2]){E=E.prev;break}else if(G.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(B)for(;E;){var W=G.contextGrabbers[E.tagName];if(W&&W.hasOwnProperty(B[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+D:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],m=a.context;m;m=m.prev)m.tagName&&b.push(m.tagName);return b.reverse()}}}),fe.defineMIME("text/xml","xml"),fe.defineMIME("application/xml","xml"),fe.mimeModes.hasOwnProperty("text/html")||fe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(ft,it,pe){"use strict";var fe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function _(){if(!fe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fe(Z)}var Q=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(I){return typeof I=="string"&&Q.test(I)}for(var D=U,G=[],H=0;H<256;++H)G.push((H+256).toString(16).substr(1));function F(I){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(G[I[L+0]]+G[I[L+1]]+G[I[L+2]]+G[I[L+3]]+"-"+G[I[L+4]]+G[I[L+5]]+"-"+G[I[L+6]]+G[I[L+7]]+"-"+G[I[L+8]]+G[I[L+9]]+"-"+G[I[L+10]]+G[I[L+11]]+G[I[L+12]]+G[I[L+13]]+G[I[L+14]]+G[I[L+15]]).toLowerCase();if(!D(A))throw TypeError("Stringified UUID is invalid");return A}var O=F;function y(I,L,A){I=I||{};var w=I.random||(I.rng||_)();if(w[6]=w[6]&15|64,w[8]=w[8]&63|128,L){A=A||0;for(var d=0;d<16;++d)L[A+d]=w[d];return L}return O(w)}var T=it.a=y},"7ahc":function(ft,it,pe){"use strict";pe.d(it,"a",function(){return C});var fe=pe("k1fw"),Z=pe("0Owb"),_=pe("+L6B"),Q=pe("2/Rp"),U=pe("y8nQ"),D=pe("Vl3Y"),G=pe("tJVT"),H=pe("OaEy"),F=pe("2fM7"),O=pe("q1tI"),y=pe.n(O),T=pe("VrN/"),I=pe.n(T),L=pe("p77/"),A=pe.n(L),w=pe("c5Ni"),d=pe.n(w),o=F.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={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"]};it.b=function(v){var g=v.callback,k=v.onCancel,x=Object(O.useState)("python"),f=Object(G.a)(x,2),p=f[0],h=f[1];function a(m){h(u[m][1])}function b(m){g(m)}return y.a.createElement(D.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),y.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(F.a,{onChange:a},Object.keys(u).map(function(m){return y.a.createElement(o,{key:m,value:m},u[m][0])}))),y.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(C,{mode:p})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Q.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function C(v){var g=v.value,k=v.onChange,x=v.mode,f=v.options,p=f===void 0?{}:f,h=Object(O.useRef)(),a=Object(O.useState)(),b=Object(G.a)(a,2),m=b[0],E=b[1];return Object(O.useEffect)(function(){if(m){function B(W){var K=W.getValue();k&&k(K)}return m.on("change",B),function(){m.off("change",B)}}},[m,k]),Object(O.useEffect)(function(){m&&m.setOption("mode",x)},[m,x]),Object(O.useEffect)(function(){m&&((g!==m.getValue()||g==="")&&setTimeout(function(){m.setValue(g||" ")},300))},[m,g]),Object(O.useEffect)(function(){if(h.current&&!m){var B=I.a.fromTextArea(h.current,Object(fe.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));E(B)}},[h.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:h}))}},"8EBN":function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";fe.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 Z=0;Z<fe.modeInfo.length;Z++){var _=fe.modeInfo[Z];_.mimes&&(_.mime=_.mimes[0])}fe.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.mime==Q)return D;if(D.mimes){for(var G=0;G<D.mimes.length;G++)if(D.mimes[G]==Q)return D}}if(/\+xml$/.test(Q))return fe.findModeByMIME("application/xml");if(/\+json$/.test(Q))return fe.findModeByMIME("application/json")},fe.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.ext){for(var G=0;G<D.ext.length;G++)if(D.ext[G]==Q)return D}}},fe.findModeByFileName=function(Q){for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.file&&D.file.test(Q))return D}var G=Q.lastIndexOf("."),H=G>-1&&Q.substring(G+1,Q.length);if(H)return fe.findModeByExtension(H)},fe.findModeByName=function(Q){Q=Q.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.name.toLowerCase()==Q)return D;if(D.alias){for(var G=0;G<D.alias.length;G++)if(D.alias[G].toLowerCase()==Q)return D}}}})},"8hTe":function(ft,it,pe){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,it,pe){"use strict";var fe=pe("DYRE"),Z=pe("zeV3"),_=pe("+L6B"),Q=pe("2/Rp"),U=pe("k1fw"),D=pe("9og8"),G=pe("tJVT"),H=pe("WmNS"),F=pe.n(H),O=pe("q1tI"),y=pe.n(O),T=pe("vg9a"),I=pe("DlQD"),L=pe.n(I),A=pe("rUJ1");function w(oe,q){var ee=oe.match(/^(\s+)(?:```)/);if(ee===null)return q;var ne=ee[1];return q.split(`
`).map(function(le){var te=le.match(/^\s+/);if(te===null)return le;var ie=Object(G.a)(te,1),ue=ie[0];return ue.length>=ne.length?le.slice(ne.length):le}).join(`
`)}var d=[],o=["<ul>"],l=new L.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){d.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(oe,q,ee,ne){if(q>=oe.length||oe[q].level<=ee)return q;var le=oe[q];ne.push("<li><a href='#"+le.anchor+"'>"+le.text+"</a>"),q++;var te=[];return q=g(oe,q,le.level,te),te.length>0&&(ne.push("<ul>"),te.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),q=g(oe,q,ee,ne),q}function k(){return g(d,0,0,o),o.push("</ul>"),o.join("")}var x={heading:function(q){var ee=u.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ne=ee[0],le=w(ne,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ie=h(),ue=le;le=ie,a[ie]={type:"block",expression:ue}}return{type:"code",raw:ne,lang:te,text:le}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,h=function(){return"__special_katext_id_".concat(p++,"__")},a={};function b(){return a}function m(){p=0,a={}}function E(oe){return oe=oe.replace(f,function(q,ee){var ne=h();return a[ne]={type:"inline",expression:ee},ne}),oe}var B=l.listitem;l.listitem=function(oe){return B(E(oe))};var W=l.paragraph;l.paragraph=function(oe){return W(E(oe))};var K=l.tablecell;l.tablecell=function(oe,q){return K(E(oe),q)},l.code=function(oe,q,ee){var ne=(q||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(oe,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(ee?oe:Object(A.escape)(oe,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ee?oe:Object(A.escape)(oe,!0))+"</code></pre>"},l.heading=function(oe,q,ee){var ne=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ne,level:q,text:oe}),"<h"+q+' id="'+ne+'">'+oe+"</h"+q+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:x,renderer:l});var V=L.a,M=pe("SJMd"),P=pe("ulZh"),$=pe.n(P),ae=pe("m3rI"),he=pe("Oy/b"),me=pe("p5ED"),De=pe("ErOA"),xe=pe("STEk");/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ke=function(oe,q){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ne){ee.__proto__=ne}||function(ee,ne){for(var le in ne)Object.prototype.hasOwnProperty.call(ne,le)&&(ee[le]=ne[le])})(oe,q)};function Te(oe,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=oe}ke(oe,q),oe.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function Se(oe,q,ee,ne){return new(ee||(ee=Promise))(function(le,te){function ie(ve){try{de(ne.next(ve))}catch(Ee){te(Ee)}}function ue(ve){try{de(ne.throw(ve))}catch(Ee){te(Ee)}}function de(ve){var Ee;ve.done?le(ve.value):(Ee=ve.value,Ee instanceof ee?Ee:new ee(function(Me){Me(Ee)})).then(ie,ue)}de((ne=ne.apply(oe,q||[])).next())})}function ye(oe,q){var ee,ne,le,te,ie={label:0,sent:function(){if(1&le[0])throw le[1];return le[1]},trys:[],ops:[]};return te={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function ue(de){return function(ve){return function(Ee){if(ee)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ee=1,ne&&(le=2&Ee[0]?ne.return:Ee[0]?ne.throw||((le=ne.return)&&le.call(ne),0):ne.next)&&!(le=le.call(ne,Ee[1])).done)return le;switch(ne=0,le&&(Ee=[2&Ee[0],le.value]),Ee[0]){case 0:case 1:le=Ee;break;case 4:return ie.label++,{value:Ee[1],done:!1};case 5:ie.label++,ne=Ee[1],Ee=[0];continue;case 7:Ee=ie.ops.pop(),ie.trys.pop();continue;default:if(!(le=ie.trys,(le=le.length>0&&le[le.length-1])||Ee[0]!==6&&Ee[0]!==2)){ie=0;continue}if(Ee[0]===3&&(!le||Ee[1]>le[0]&&Ee[1]<le[3])){ie.label=Ee[1];break}if(Ee[0]===6&&ie.label<le[1]){ie.label=le[1],le=Ee;break}if(le&&ie.label<le[2]){ie.label=le[2],ie.ops.push(Ee);break}le[2]&&ie.ops.pop(),ie.trys.pop();continue}Ee=q.call(oe,ie)}catch(Me){Ee=[6,Me],ne=0}finally{ee=le=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([de,ve])}}}var z=function(){function oe(){}return oe.addKey=function(q){oe.key=q},Object.defineProperty(oe,"isLicensed",{get:function(){return!!oe.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(oe.key)},enumerable:!1,configurable:!0}),oe}(),s=function(){function oe(){}return oe.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},oe.setAttributes=function(q,ee){for(var ne=0,le=ee;ne<le.length;ne++){var te=le[ne],ie=te[0],ue=te[1];q.setAttribute(ie,ue)}},oe.createRect=function(q,ee,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","rect");return le.setAttribute("width",q.toString()),le.setAttribute("height",ee.toString()),ne&&oe.setAttributes(le,ne),le},oe.createLine=function(q,ee,ne,le,te){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",q.toString()),ie.setAttribute("y1",ee.toString()),ie.setAttribute("x2",ne.toString()),ie.setAttribute("y2",le.toString()),te&&oe.setAttributes(ie,te),ie},oe.createPolygon=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ne.setAttribute("points",q),ee&&oe.setAttributes(ne,ee),ne},oe.createCircle=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","circle");return ne.setAttribute("cx",(q/2).toString()),ne.setAttribute("cy",(q/2).toString()),ne.setAttribute("r",q.toString()),ee&&oe.setAttributes(ne,ee),ne},oe.createEllipse=function(q,ee,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return le.setAttribute("cx",(q/2).toString()),le.setAttribute("cy",(ee/2).toString()),le.setAttribute("rx",(q/2).toString()),le.setAttribute("ry",(ee/2).toString()),ne&&oe.setAttributes(le,ne),le},oe.createGroup=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","g");return q&&oe.setAttributes(ee,q),ee},oe.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},oe.createMarker=function(q,ee,ne,le,te,ie,ue){var de=document.createElementNS("http://www.w3.org/2000/svg","marker");return oe.setAttributes(de,[["id",q],["orient",ee],["markerWidth",ne.toString()],["markerHeight",le.toString()],["refX",te.toString()],["refY",ie.toString()]]),de.appendChild(ue),de},oe.createText=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","text");return ee.setAttribute("x","0"),ee.setAttribute("y","0"),q&&oe.setAttributes(ee,q),ee},oe.createTSpan=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ne.textContent=q,ee&&oe.setAttributes(ne,ee),ne},oe.createImage=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","image");return q&&oe.setAttributes(ee,q),ee},oe.createPoint=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ne.x=q,ne.y=ee,ne},oe.createPath=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","path");return ne.setAttribute("d",q),ee&&oe.setAttributes(ne,ee),ne},oe.createElement=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg",q);return ee&&oe.setAttributes(ne,ee),ne},oe.getHollowRectanglePath=function(q,ee,ne,le,te,ie,ue,de){return"M"+q+","+ee+"V"+(ee+le)+"H"+(q+ne)+"V"+ee+"H"+te+"V"+ie+"H"+(te+ue)+"V"+(ie+de)+"H"+te+"V"+ee+"Z"},oe}(),c=function(){function oe(q){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+q+"_"}return Object.defineProperty(oe.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(oe.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(oe.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),oe.prototype.addClass=function(q){return this.styleSheet===void 0&&this.addStyleSheet(),q.name=""+this.classNamePrefix+q.localName,this.classes.push(q),this.styleSheet.sheet.insertRule("."+q.name+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length),q},oe.prototype.addRule=function(q){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(q),this.styleSheet.sheet.insertRule(q.selector+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length)},oe.prototype.addStyleSheet=function(){var q;this.styleSheet=document.createElement("style"),((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).appendChild(this.styleSheet),this.addRule(new R("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new R("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new R("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Y("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Y("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},oe.prototype.removeStyleSheet=function(){var q;this.styleSheet&&(((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},oe}(),R=function(oe,q){this.selector=oe,this.style=q},Y=function(oe,q){this.localName=oe,this.style=q},N=function(){function oe(){this.blocks=[],this.display=""}return oe.prototype.addButtonBlock=function(q){q.className=this.blockClassName,q.buttonClassName=this.buttonClassName,q.buttonColorsClassName=this.buttonColorsClassName,q.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(q)},oe.prototype.addElementBlock=function(q){q.className===void 0&&(q.className=this.blockClassName),this.blocks.push(q)},oe.prototype.getUI=function(){var q=document.createElement("div");return q.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,q.style.display=this.display,this.blocks.forEach(function(ee){return q.appendChild(ee.getUI())}),q},oe}(),se=function(){function oe(){}return oe.prototype.getUI=function(){var q=document.createElement("div");if(q.className=this.className,this.minWidth!==void 0&&(q.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":q.style.justifyContent="flex-start";break;case"center":q.style.justifyContent="center";break;case"end":q.style.justifyContent="flex-end"}return q.style.whiteSpace="nowrap",q},oe}(),be=function(oe){function q(){var ee=oe!==null&&oe.apply(this,arguments)||this;return ee.buttons=[],ee}return Te(q,oe),q.prototype.addButton=function(ee){ee.className=this.buttonClassName,ee.colorsClassName=this.buttonColorsClassName,ee.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(ee)},q.prototype.getUI=function(){var ee=oe.prototype.getUI.call(this);return this.buttons.forEach(function(ne){return ee.appendChild(ne.getUI())}),ee},q}(se),Ae=function(){function oe(q,ee){this._isActive=!1,this._isHidden=!1,this._icon=q,this.title=ee,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(oe.prototype,"icon",{get:function(){return this._icon},set:function(q){this._icon=q,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isActive",{get:function(){return this._isActive},set:function(q){this._isActive=q,this.adjustClassName()},enumerable:!1,configurable:!0}),oe.prototype.getUI=function(){var q=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return q.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},oe.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,"")))},oe.prototype.hide=function(){this._isHidden=!0},oe}(),Oe=function(oe){function q(){var ee=oe!==null&&oe.apply(this,arguments)||this;return ee.elements=[],ee}return Te(q,oe),q.prototype.addElement=function(ee){this.elements.push(ee)},q.prototype.getUI=function(){var ee=oe.prototype.getUI.call(this);return this.elements.forEach(function(ne){return ee.appendChild(ne)}),ee},q}(se),Le=function(){function oe(q,ee){this.horizontal=q,this.vertical=ee}return Object.defineProperty(oe.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),oe.prototype.getVerticalLength=function(q){return q/this.ratio},oe.prototype.getHorizontalLength=function(q){return q*this.ratio},oe}(),_e=function(){function oe(){}return oe.getIcon=function(q,ee){if(q>0&&ee>0){var ne=new Le(q,ee),le=ne.ratio>=1?20:ne.getHorizontalLength(20),te=ne.ratio<1?20:ne.getVerticalLength(20),ie=document.createElementNS("http://www.w3.org/2000/svg","svg");ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),ie.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ie);var ue=s.createDefs();ie.appendChild(ue);var de=s.createElement("clipPath",[["id","text-bg-clip"]]);ue.appendChild(de);var ve=s.createPath(s.getHollowRectanglePath((24-le)/2,(24-te)/2,le,te,(24-le)/2+2,(24-te)/2+2,le-4,te-4));ie.appendChild(ve);var Ee=s.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(s.createTSpan(q+":"+ee)),ie.appendChild(Ee);var Me=Ee.getBBox();s.setAttributes(Ee,[["x",((24-Me.width)/2).toString()],["y",((24-Me.height)/2-Me.y).toString()]]);var Be=s.createPath(s.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Me.width))/2,(24-Math.ceil(Me.height))/2,Math.ceil(Me.width),Math.ceil(Me.height)));return de.appendChild(Be),s.setAttributes(ve,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ie),ie.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>'},oe}(),Pe=function(oe){function q(ee,ne,le){var te=oe.call(this,ee,ne)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=le,te}return Te(q,oe),q.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ne){ne.className=ee.className,ne.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ne.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(Ae),He=function(){function oe(q,ee){this.GRIP_SIZE=10,this.color=q,this.fillColor=ee,this.visual=s.createGroup(),this.visual.appendChild(s.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(s.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return oe.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},oe.prototype.setCenter=function(q,ee){this.visual.childNodes.forEach(function(ne){return s.setAttributes(ne,[["cx",q.toString()],["cy",ee.toString()]])})},oe}(),Ge=function(){function oe(q,ee,ne,le){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=ee,this.margin=ne,this.container=le,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(oe.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&s.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),oe.prototype.open=function(){var q=this;this.cropShadeElement=s.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=s.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;ee<this.numberOfGridLines;ee++)this.horizontalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ne){return q.gridContainer.appendChild(ne)}),this.verticalGridLines.forEach(function(ne){return q.gridContainer.appendChild(ne)}),this.cropRectElement=s.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new He(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},oe.prototype.setCropRectangle=function(q){this.cropRect=q;var ee=Object.assign({},this.cropRect);this.zoomFactor!==1&&(ee.width=this.cropRect.width*this.zoomFactor,ee.height=this.cropRect.height*this.zoomFactor,ee.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-ee.width/2,ee.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),s.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var ne=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ie){var ue=ee.y+ne*(ie+1);s.setAttributes(te,[["x1",""+ee.x],["y1",""+ue],["x2",""+(ee.x+ee.width)],["y2",""+ue]])});var le=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ie){var ue=ee.x+le*(ie+1);s.setAttributes(te,[["x1",""+ue],["y1",""+ee.y],["x2",""+ue],["y2",""+(ee.y+ee.height)]])}),s.setAttributes(this.cropShadeElement,[["d",s.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},oe.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)},oe.prototype.clientToLocalCoordinates=function(q,ee){var ne=this.container.getBoundingClientRect();return{x:q-ne.left+this.margin,y:ee-ne.top+this.margin}},oe.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},oe.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(ee)}q.preventDefault()},oe.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},oe.prototype.move=function(q){var ee=q.x-this.previousPoint.x,ne=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ne=-ne/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ne),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},oe.prototype.resize=function(q){var ee=Object.assign({},this.cropRect),ne=q.x-this.previousPoint.x,le=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+ne<this.margin&&(ne=this.margin-ee.x),ee.x+=ne,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+ne>this.canvasWidth*this.zoomFactor&&(ne=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ne}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ne),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=le,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=le}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=q,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},oe.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,ne=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ne/this.canvasWidth<le/this.canvasHeight?this.cropRect.width=ne:this.cropRect.height=le,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=q-this.cropRect.width/2,this.cropRect.y=ee-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)}},oe.prototype.getRescaledRect=function(q,ee,ne,le,te,ie){var ue=ne/q,de=le/ee;return{x:(te.x-ie)*ue+ie,y:(te.y-ie)*de+ie,width:te.width*ue,height:te.height*de}},oe.prototype.scaleCanvas=function(q,ee){var ne=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ne),this.setCropRectangle(ne)},oe}(),Xe=function(){function oe(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(oe.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),oe.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},oe.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},oe.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},oe.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},oe.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();s.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},oe.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},oe.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ne=1;ne<=this.width/5+10;ne++){var le=ne%5==0?this.height/3:this.height/6;ee+="h4v"+-le+"h1v"+le}ee+="v1H0Z",this.scaleShape=s.createPath(ee);var te=s.createTransform();this.scaleShape.transform.baseVal.appendItem(te),q.appendChild(this.scaleShape),this.angleLabelElement=s.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=s.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ie=s.createTSpan("");return ie.innerHTML="&deg;",this.angleLabelElement.appendChild(ie),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},oe}(),ze=function(){function oe(){this.naturalSize=!1,this.imageType="image/png"}return oe.prototype.rasterize=function(q,ee,ne,le,te,ie,ue){var de=this;return new Promise(function(ve){var Ee=document.createElement("canvas");Ee.width=q.width.baseVal.value-2*le,Ee.height=q.height.baseVal.value-2*le;var Me=1,Be=1;de.naturalSize===!0?(Me=ee.naturalWidth/(q.width.baseVal.value-2*le)/ie,Be=ee.naturalHeight/(q.height.baseVal.value-2*le)/ue,Ee.width=ee.naturalWidth/ie,Ee.height=ee.naturalHeight/ue):de.width!==void 0&&de.height!==void 0&&(Me=de.width/ne.width,Be=de.height/ne.height,Ee.width*=Me,Ee.height*=Be);var Ye=Ee.getContext("2d");Ye.translate(Ee.width/2,Ee.height/2),Ye.rotate(te*Math.PI/180),Ye.scale(ie,ue),Ye.translate(-Ee.width/2,-Ee.height/2),Ye.drawImage(ee,0,0,Ee.width,Ee.height);var We=document.createElement("canvas");We.width=ne.width*Me,We.height=ne.height*Be,We.getContext("2d").putImageData(Ye.getImageData((ne.x-le)*Me,(ne.y-le)*Be,ne.width*Me,ne.height*Be),0,0),ve(We.toDataURL(de.imageType,de.imageQuality))})},oe}(),ot=function(){function oe(q){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=oe.instanceCounter++,this.styles=new c(this.instanceNo),this.target=q,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(oe.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),oe.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},oe.prototype.show=function(){this.showUI(),this.open()},oe.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},oe.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},oe.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},oe.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},oe.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},oe.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},oe.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ne=ee+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/q;this.resize(ee,ne)}},oe.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},oe.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",s.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},oe.prototype.resize=function(q,ee){this.imageWidth=Math.round(q),this.imageHeight=Math.round(ee),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()},oe.prototype.setEditingTarget=function(){var q=document.createElement("canvas");q.width=this.target.naturalWidth,q.height=this.target.naturalHeight,q.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var ee=q.toDataURL();s.setAttributes(this.editingTarget,[["href",ee]]),this.setEditingTargetSize()},oe.prototype.setTopLeft=function(){var q=this.target.getBoundingClientRect(),ee=this.editorCanvas.getBoundingClientRect();this.left=q.left-ee.left-this.CANVAS_MARGIN,this.top=q.top-ee.top-this.CANVAS_MARGIN},oe.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=s.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=s.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=s.createGroup(),this.editingTargetRotationScaleContainer=s.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var q=s.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(q);var ee=s.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(ee),this.editingTargetContainer=s.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)},oe.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},oe.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=s.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ge(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()},oe.prototype.zoomToCrop=function(){if(this.cropRect){var q=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,ee=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=q+"px "+ee+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-q+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-ee+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},oe.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)},oe.prototype.cropRectChanged=function(q){this.cropRect=q,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},oe.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},oe.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"},oe.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},oe.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var q=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,ee=this.target.offsetTop>q+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"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},oe.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},oe.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new N,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 ee=new be;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var ne=[];this.aspectRatios.forEach(function(Be){var Ye=new Ae(_e.getIcon(Be.horizontal,Be.vertical),Be.horizontal===0&&Be.vertical===0?"FREE":Be.horizontal+":"+Be.vertical);Ye.onClick=function(){return q.ratioButtonClicked(Be)},ne.push(Ye)}),this.aspectRatioButton=new Pe(_e.getIcon(0,0),"Aspect ratio",ne),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var le=new Ae('<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");le.isActive=this.isGridVisible,le.onClick=function(){q.isGridVisible=!q.isGridVisible,le.isActive=q.isGridVisible},ee.addButton(le);var te=new Ae('<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(te.isActive=this.zoomToCropEnabled,te.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,te.isActive=q.zoomToCropEnabled},ee.addButton(te),!z.isLicensed){var ie=new Oe;this.topToolbar.addElementBlock(ie);var ue=document.createElement("div");ue.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var de=document.createElement("a");de.style.color="currentColor",de.href="https://markerjs.com/products/cropro",de.target="_blank",de.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>',ue.appendChild(de),ie.addElement(ue)}var ve=new be;ve.minWidth=3*this.toolbarHeight+"px",ve.contentAlign="end",this.topToolbar.addButtonBlock(ve);var Ee=new Ae('<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");Ee.onClick=this.startRenderAndClose,ve.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Me=new Ae('<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");Me.onClick=this.close,ve.addButton(Me),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},oe.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new N,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 ee=new be;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var ne=new Ae('<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");ne.onClick=this.rotateLeftButtonClicked,ee.addButton(ne);var le=new Ae('<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");le.onClick=this.rotateRightButtonClicked,ee.addButton(le);var te=new Oe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new Xe("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(ve){q.rotateBy(ve),q.straightener.angle=q.rotationAngle},te.addElement(this.straightener.getUI());var ie=new be;ie.minWidth=2*this.toolbarHeight+"px",ie.contentAlign="end",this.bottomToolbar.addButtonBlock(ie);var ue=new Ae('<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");ue.onClick=this.flipHorizontallyButtonClicked,ie.addButton(ue);var de=new Ae('<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");de.onClick=this.flipVerticallyButtonClicked,ie.addButton(de)},oe.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},oe.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=_e.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},oe.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Le(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},oe.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},oe.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},oe.prototype.restoreState=function(q){if(q){var ee=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},oe.prototype.clientToLocalCoordinates=function(q,ee){var ne=this.cropImage.getBoundingClientRect();return{x:q-ne.left,y:ee-ne.top}},oe.prototype.onWindowResize=function(){this.positionUI()},oe.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},oe.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},oe.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},oe.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},oe.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},oe.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var ne=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ne.width,this.imageHeight/ne.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},oe.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},oe.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},oe.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},oe.prototype.startRenderAndClose=function(){return Se(this,void 0,void 0,function(){var q,ee;return ye(this,function(ne){switch(ne.label){case 0:return[4,this.render()];case 1:return q=ne.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(le){return le(q,ee)}),this.close(!0),[2]}})})},oe.prototype.render=function(){return Se(this,void 0,void 0,function(){var q;return ye(this,function(ee){switch(ee.label){case 0:return(q=new ze).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),s.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return ee.sent(),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,ee.sent()]}})})},oe.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Y("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 Y("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Y("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Y("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*q)+`px;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Y("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Y("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new R("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new R("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Y("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 Y("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Y("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 Y("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Y("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},oe.instanceCounter=0,oe}(),$e=pe("8hTe"),Je=pe.n($e),Re=/<pre[^>]*>/g;function rt(oe){var q=document.createElement("div");return q.innerHTML=oe,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var qe=it.a=function(oe){var q=oe.value,ee=q===void 0?"":q,ne=oe.edit,le=ne===void 0?!1:ne,te=oe.className,ie=oe.showTextOnly,ue=oe.showLines,de=oe.replaces,ve=oe.zoomImg,Ee=oe.hasMask,Me=oe.style,Be=Me===void 0?{}:Me,Ye=oe.stylesPrev,We=Ye===void 0?{}:Ye,pt=String(ee),nt=Object(O.useRef)(),tt=Object(O.useRef)(),Tt=Object(O.useState)(""),bt=Object(G.a)(Tt,2),xt=bt[0],kt=bt[1],Et=Object(O.useState)("office"),qt=Object(G.a)(Et,2),Tr=qt[0],Yt=qt[1],gr=function(){var wt=new ot(tt.current);wt.displayMode="popup",wt.addRenderEventListener(function(){var Zt=Object(D.a)(F.a.mark(function gt(mt){var Lt;return F.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return nt.current.style.display="none",Ut.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mt}});case 3:Lt=Ut.sent,Lt!=null&&Lt.id&&de(tt.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Lt==null?void 0:Lt.id,"?type=").concat(Lt.content_type));case 5:case"end":return Ut.stop()}},gt)}));return function(gt){return Zt.apply(this,arguments)}}()),wt.show()},fr=function(){var wt=new xe.a(tt.current);wt.settings.displayMode="popup",wt.addEventListener("render",function(){var Zt=Object(D.a)(F.a.mark(function gt(mt){var Lt;return F.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(nt.current.style.display="none",!tt.current){Ut.next=6;break}return Ut.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mt.dataUrl}});case 4:Lt=Ut.sent,Lt!=null&&Lt.id&&de(tt.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Lt==null?void 0:Lt.id,"?type=").concat(Lt.content_type));case 6:case"end":return Ut.stop()}},gt)}));return function(gt){return Zt.apply(this,arguments)}}()),wt.show(),window.markerArea=wt},zr=Object(O.useMemo)(function(){nt.current&&(nt.current.style.zIndex=-1);try{var Ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,wt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Zt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;pt=pt.replace(Ze,"("+ae.a.API_SERVER+"/api/attachments/").replace(wt,'"'+ae.a.API_SERVER+"/api/attachments/").replace(Zt,'"'+ae.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(vr){}var gt=V(pt),mt=b();if(pt.match(/\[TOC\]/)&&(gt=gt.replace("<p>[TOC]</p>",k()),C()),gt=gt.replace(/(__special_katext_id_\d+__)/g,function(vr,Ut){var Fe=mt[Ut],ht=Fe.type,ri=Fe.expression;return Object(he.renderToString)(rt(ri)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),gt=gt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ie){var Lt=document.createElement("div");return Lt.innerHTML=gt,Lt.innerText}return setTimeout(function(){return ti()},500),gt},[pt]),$t=Object(O.useRef)();v.WebkitLineClamp=ue,ue&&(Be=Object(U.a)(Object(U.a)({},Be),v));function Nr(Ze){var wt=Ze.target;if(wt.tagName.toUpperCase()==="IMG"){if(ve){var Zt=wt.getAttribute("src");kt(Zt),Yt("image")}}else if(wt.tagName.toUpperCase()==="A"){var gt=wt.getAttribute("href");if(gt.indexOf("office")>-1)Ze.preventDefault(),kt(gt),Yt("office");else if(gt.indexOf("application/pdf")>-1)Ze.preventDefault(),kt(gt),Yt("pdf");else if(gt.indexOf("text/html")>-1)Ze.preventDefault(),kt(gt),Yt("html");else if(gt.startsWith("#")){Ze.preventDefault();var mt=document.getElementById(gt.replace("#",""));mt&&mt.scrollIntoView(!0)}}}var ti=function(){var wt,Zt=(wt=$t.current)===null||wt===void 0?void 0:wt.querySelectorAll("video");Zt==null||Zt.forEach(function(gt){if(gt.oncontextmenu=function(){return!1},gt.src.indexOf(".m3u8")>-1&&!gt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var mt=new $.a;mt.loadSource(gt.src),mt.attachMedia(gt)}}})};Object(O.useEffect)(function(){if($t.current&&zr&&(zr.match(Re)&&window.PR.prettyPrint()),$t.current)return $t.current.addEventListener("click",Nr),function(){$t.current.removeEventListener("click",Nr),m(),C()}},[zr,$t.current,Nr]);var Pt=function(wt){if(!le)return;wt.target.nodeName==="IMG"?(nt.current.style.zIndex=1,nt.current.style.display="flex",nt.current.style.width=wt.target.clientWidth+"px",nt.current.style.height=wt.target.clientHeight+"px",nt.current.style.top=wt.target.offsetTop+"px",nt.current.style.left=wt.target.offsetLeft+"px",tt.current.src=wt.target.getAttribute("src")):nt.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:$t,style:Object(U.a)({},Be),className:"".concat(te||""," markdown-body ").concat(Je.a.mdBody),onMouseOver:Pt,dangerouslySetInnerHTML:{__html:zr}}),y.a.createElement("div",{ref:nt,className:Je.a.button},y.a.createElement(Z.a,null,y.a.createElement(Q.a,{onClick:function(){return gr()}},"\u88C1\u526A"),y.a.createElement(Q.a,{onClick:function(){return fr()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:tt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(me.a,{close:!0,data:xt,type:xt!=null&&xt.length?Tr:"",style:Object(U.a)({},We),onClose:function(){return kt("")}}))}},"9VGf":function(ft,it,pe){"use strict";pe.d(it,"a",function(){return _});var fe=pe("q1tI"),Z=pe.n(fe);function _(Q,U){var D=Object(fe.useRef)();Object(fe.useEffect)(function(){D.current=Q}),Object(fe.useEffect)(function(){function G(){D.current()}if(U!==null){var H=setInterval(G,U);return function(){return clearInterval(H)}}},[U])}},"9ivq":function(ft,it,pe){},Bd2K:function(ft,it,pe){(function(fe){fe(pe("VrN/"),pe("osHv"))})(function(fe){fe.defineOption("autoCloseTags",!1,function(F,O,y){if(y!=fe.Init&&y&&F.removeKeyMap("autoCloseTags"),!O)return;var T={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(T["'/'"]=function(I){return D(I)}),(typeof O!="object"||O.whenOpening!==!1)&&(T["'>'"]=function(I){return Q(I)}),F.addKeyMap(T)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],_=["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 Q(F){if(F.getOption("disableInput"))return fe.Pass;for(var O=F.listSelections(),y=[],T=F.getOption("autoCloseTags"),I=0;I<O.length;I++){if(!O[I].empty())return fe.Pass;var L=O[I].head,A=F.getTokenAt(L),w=fe.innerMode(F.getMode(),A.state),d=w.state,o=w.mode.xmlCurrentTag&&w.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return fe.Pass;var u=w.mode.configuration=="html",C=typeof T=="object"&&T.dontCloseTags||u&&Z,v=typeof T=="object"&&T.indentTags||u&&_;A.end>L.ch&&(l=l.slice(0,l.length-A.end+L.ch));var g=l.toLowerCase();if(!l||A.type=="string"&&(A.end!=L.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==L.ch-A.start-1||C&&G(C,g)>-1||H(F,w.mode.xmlCurrentContext&&w.mode.xmlCurrentContext(d)||[],l,L,!0))return fe.Pass;var k=typeof T=="object"&&T.emptyTags;if(k&&G(k,l)>-1){y[I]={text:"/>",newPos:fe.Pos(L.line,L.ch+2)};continue}var x=v&&G(v,g)>-1;y[I]={indent:x,text:">"+(x?`
`:"")+"</"+l+">",newPos:x?fe.Pos(L.line+1,0):fe.Pos(L.line,L.ch+1)}}for(var f=typeof T=="object"&&T.dontIndentOnAutoClose,I=O.length-1;I>=0;I--){var p=y[I];F.replaceRange(p.text,O[I].head,O[I].anchor,"+insert");var h=F.listSelections().slice(0);h[I]={head:p.newPos,anchor:p.newPos},F.setSelections(h),!f&&p.indent&&(F.indentLine(p.newPos.line,null,!0),F.indentLine(p.newPos.line+1,null,!0))}}function U(F,O){for(var y=F.listSelections(),T=[],I=O?"/":"</",L=F.getOption("autoCloseTags"),A=typeof L=="object"&&L.dontIndentOnSlash,w=0;w<y.length;w++){if(!y[w].empty())return fe.Pass;var d=y[w].head,o=F.getTokenAt(d),l=fe.innerMode(F.getMode(),o.state),u=l.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return fe.Pass;var C,v=l.mode.name!="xml"&&F.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")C=I+"script";else if(v&&l.mode.name=="css")C=I+"style";else{var g=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!g||g.length&&H(F,g,g[g.length-1],d))return fe.Pass;C=I+g[g.length-1]}F.getLine(d.line).charAt(o.end)!=">"&&(C+=">"),T[w]=C}if(F.replaceSelections(T),y=F.listSelections(),!A)for(var w=0;w<y.length;w++)(w==y.length-1||y[w].head.line<y[w+1].head.line)&&F.indentLine(y[w].head.line)}function D(F){return F.getOption("disableInput")?fe.Pass:U(F,!0)}fe.commands.closeTag=function(F){return U(F)};function G(F,O){if(F.indexOf)return F.indexOf(O);for(var y=0,T=F.length;y<T;++y)if(F[y]==O)return y;return-1}function H(F,O,y,T,I){if(!fe.scanForClosingTag)return!1;var L=Math.min(F.lastLine()+1,T.line+500),A=fe.scanForClosingTag(F,T,null,L);if(!A||A.tag!=y)return!1;for(var w=I?1:0,d=O.length-1;d>=0&&O[d]==y;d--)++w;T=A.to;for(var d=1;d<w;d++){var o=fe.scanForClosingTag(F,T,null,L);if(!o||o.tag!=y)return!1;T=o.to}return!0}})},BjJ7:function(ft,it,pe){"use strict";pe.d(it,"d",function(){return Z}),pe.d(it,"c",function(){return _}),pe.d(it,"e",function(){return Q}),pe.d(it,"b",function(){return U}),pe.d(it,"a",function(){return G});var fe=pe("m3rI");function Z(H){var F=!0;if(H.length>0){for(var O=0;O<H.length;O++)if(H[O].compile_success==0||!H[O].compile_success){F=!1;break}}else F=!1;return F}function _(H){for(var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],y=0;y<H.length;y++){var T=H[y],I=F?"".concat(F,"/").concat(T.name):"".concat(T.name);O.push({title:T.name,isLeaf:!(T.type==="tree"),key:I})}return O}function Q(H,F,O){for(var y=0;y<H.length;y++){var T=H[y];if(T.key===F){T.children=O;break}T.children&&Q(T.children,F,O)}return H}function U(H,F,O){var y;return function(){var T=this,I=arguments,L=function(){y=null,O||H.apply(T,I)},A=O&&!y;clearTimeout(y),y=setTimeout(L,F),A&&H.apply(T,I)}}var D=!0,G=fe.a.API_SERVER},"C+DQ":function(ft,it,pe){},DlQD:function(ft,it,pe){(function(fe,Z){ft.exports=Z()})(this,function(){"use strict";function fe(ee,ne){for(var le=0;le<ne.length;le++){var te=ne[le];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ee,te.key,te)}}function Z(ee,ne,le){return ne&&fe(ee.prototype,ne),le&&fe(ee,le),ee}function _(ee,ne){if(!ee)return;if(typeof ee=="string")return Q(ee,ne);var le=Object.prototype.toString.call(ee).slice(8,-1);if(le==="Object"&&ee.constructor&&(le=ee.constructor.name),le==="Map"||le==="Set")return Array.from(ee);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return Q(ee,ne)}function Q(ee,ne){(ne==null||ne>ee.length)&&(ne=ee.length);for(var le=0,te=new Array(ne);le<ne;le++)te[le]=ee[le];return te}function U(ee,ne){var le;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(le=_(ee))||ne&&ee&&typeof ee.length=="number"){le&&(ee=le);var te=0;return function(){return te>=ee.length?{done:!0}:{done:!1,value:ee[te++]}}}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 le=ee[Symbol.iterator](),le.next.bind(le)}function D(ee,ne){return ne={exports:{}},ee(ne,ne.exports),ne.exports}var G=D(function(ee){function ne(){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 le(te){ee.exports.defaults=te}ee.exports={defaults:ne(),getDefaults:ne,changeDefaults:le}}),H=G.defaults,F=G.getDefaults,O=G.changeDefaults,y=/[&<>"']/,T=/[&<>"']/g,I=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},w=function(ne){return A[ne]};function d(ee,ne){if(ne){if(y.test(ee))return ee.replace(T,w)}else if(I.test(ee))return ee.replace(L,w);return ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ee){return ee.replace(o,function(ne,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(ee,ne){ee=ee.source||ee,ne=ne||"";var le={replace:function(ie,ue){return ue=ue.source||ue,ue=ue.replace(u,"$1"),ee=ee.replace(ie,ue),le},getRegex:function(){return new RegExp(ee,ne)}};return le}var v=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(ee,ne,le){if(ee){var te;try{te=decodeURIComponent(l(le)).replace(v,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ne&&!g.test(le)&&(le=a(ne,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ie){return null}return le}var x={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ee,ne){x[" "+ee]||(f.test(ee)?x[" "+ee]=ee+"/":x[" "+ee]=B(ee,"/",!0)),ee=x[" "+ee];var le=ee.indexOf(":")===-1;return ne.substring(0,2)==="//"?le?ne:ee.replace(p,"$1")+ne:ne.charAt(0)==="/"?le?ne:ee.replace(h,"$1")+ne:ee+ne}var b={exec:function(){}};function m(ee){for(var ne=1,le,te;ne<arguments.length;ne++){le=arguments[ne];for(te in le)Object.prototype.hasOwnProperty.call(le,te)&&(ee[te]=le[te])}return ee}function E(ee,ne){var le=ee.replace(/\|/g,function(ue,de,ve){for(var Ee=!1,Me=de;--Me>=0&&ve[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=le.split(/ \|/),ie=0;if(te.length>ne)te.splice(ne);else for(;te.length<ne;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function B(ee,ne,le){var te=ee.length;if(te===0)return"";for(var ie=0;ie<te;){var ue=ee.charAt(te-ie-1);if(ue===ne&&!le)ie++;else if(ue!==ne&&le)ie++;else break}return ee.substr(0,te-ie)}function W(ee,ne){if(ee.indexOf(ne[1])===-1)return-1;for(var le=ee.length,te=0,ie=0;ie<le;ie++)if(ee[ie]==="\\")ie++;else if(ee[ie]===ne[0])te++;else if(ee[ie]===ne[1]&&(te--,te<0))return ie;return-1}function K(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:d,unescape:l,edit:C,cleanUrl:k,resolveUrl:a,noopTest:b,merge:m,splitCells:E,rtrim:B,findClosingBracket:W,checkSanitizeDeprecation:K},M=G.defaults,P=V.rtrim,$=V.splitCells,ae=V.escape,he=V.findClosingBracket;function me(ee,ne,le){var te=ne.href,ie=ne.title?ae(ne.title):null,ue=ee[1].replace(/\\([\[\]])/g,"$1");return ee[0].charAt(0)!=="!"?{type:"link",raw:le,href:te,title:ie,text:ue}:{type:"image",raw:le,href:te,title:ie,text:ae(ue)}}function De(ee,ne){var le=ee.match(/^(\s+)(?:```)/);if(le===null)return ne;var te=le[1];return ne.split(`
`).map(function(ie){var ue=ie.match(/^\s+/);if(ue===null)return ie;var de=ue[0];return de.length>=te.length?ie.slice(te.length):ie}).join(`
`)}var xe=function(){function ee(le){this.options=le||M}var ne=ee.prototype;return ne.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},ne.code=function(te,ie){var ue=this.rules.block.code.exec(te);if(ue){var de=ie[ie.length-1];if(de&&de.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var ve=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?ve:P(ve,`
`)}}},ne.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var ue=ie[0],de=De(ue,ie[3]||"");return{type:"code",raw:ue,lang:ie[2]?ie[2].trim():ie[2],text:de}}},ne.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ne.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var ue={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(ue.header.length===ue.align.length){var de=ue.align.length,ve;for(ve=0;ve<de;ve++)/^ *-+: *$/.test(ue.align[ve])?ue.align[ve]="right":/^ *:-+: *$/.test(ue.align[ve])?ue.align[ve]="center":/^ *:-+ *$/.test(ue.align[ve])?ue.align[ve]="left":ue.align[ve]=null;for(de=ue.cells.length,ve=0;ve<de;ve++)ue.cells[ve]=$(ue.cells[ve],ue.header.length);return ue}}},ne.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},ne.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var ue=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ue}}},ne.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var ue=ie[0],de=ie[2],ve=de.length>1,Ee=de[de.length-1]===")",Me={type:"list",raw:ue,ordered:ve,start:ve?+de.slice(0,-1):"",loose:!1,items:[]},Be=ie[0].match(this.rules.block.item),Ye=!1,We,pt,nt,tt,Tt,bt,xt,kt=Be.length,Et=0;Et<kt;Et++)We=Be[Et],ue=We,pt=We.length,We=We.replace(/^ *([*+-]|\d+[.)]) */,""),~We.indexOf(`
`)&&(pt-=We.length,We=this.options.pedantic?We.replace(/^ {1,4}/gm,""):We.replace(new RegExp("^ {1,"+pt+"}","gm"),"")),Et!==kt-1&&(nt=this.rules.block.bullet.exec(Be[Et+1])[0],(ve?nt.length===1||!Ee&&nt[nt.length-1]===")":nt.length>1||this.options.smartLists&&nt!==de)&&(tt=Be.slice(Et+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-tt.length),Et=kt-1)),Tt=Ye||/\n\n(?!\s*$)/.test(We),Et!==kt-1&&(Ye=We.charAt(We.length-1)===`
`,Tt||(Tt=Ye)),Tt&&(Me.loose=!0),bt=/^\[[ xX]\] /.test(We),xt=void 0,bt&&(xt=We[1]!==" ",We=We.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:ue,task:bt,checked:xt,loose:Tt,text:We});return Me}},ne.html=function(te){var ie=this.rules.block.html.exec(te);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ae(ie[0]):ie[0]}},ne.def=function(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ue=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:ie[0],href:ie[2],title:ie[3]}}},ne.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var ue={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(ue.header.length===ue.align.length){ue.raw=ie[0];var de=ue.align.length,ve;for(ve=0;ve<de;ve++)/^ *-+: *$/.test(ue.align[ve])?ue.align[ve]="right":/^ *:-+: *$/.test(ue.align[ve])?ue.align[ve]="center":/^ *:-+ *$/.test(ue.align[ve])?ue.align[ve]="left":ue.align[ve]=null;for(de=ue.cells.length,ve=0;ve<de;ve++)ue.cells[ve]=$(ue.cells[ve].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ne.lheading=function(te){var ie=this.rules.block.lheading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ne.paragraph=function(te){var ie=this.rules.block.paragraph.exec(te);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
`?ie[1].slice(0,-1):ie[1]}},ne.text=function(te,ie){var ue=this.rules.block.text.exec(te);if(ue){var de=ie[ie.length-1];return de&&de.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},ne.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ae(ie[1])}},ne.tag=function(te,ie,ue){var de=this.rules.inline.tag.exec(te);if(de)return!ie&&/^<a /i.test(de[0])?ie=!0:ie&&/^<\/a>/i.test(de[0])&&(ie=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ie,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ae(de[0]):de[0]}},ne.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var ue=he(ie[2],"()");if(ue>-1){var de=ie[0].indexOf("!")===0?5:4,ve=de+ie[1].length+ue;ie[2]=ie[2].substring(0,ue),ie[0]=ie[0].substring(0,ve).trim(),ie[3]=""}var Ee=ie[2],Me="";if(this.options.pedantic){var Be=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);Be?(Ee=Be[1],Me=Be[3]):Me=""}else Me=ie[3]?ie[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var Ye=me(ie,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},ie[0]);return Ye}},ne.reflink=function(te,ie){var ue;if((ue=this.rules.inline.reflink.exec(te))||(ue=this.rules.inline.nolink.exec(te))){var de=(ue[2]||ue[1]).replace(/\s+/g," ");if(de=ie[de.toLowerCase()],!de||!de.href){var ve=ue[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Ee=me(ue,de,ue[0]);return Ee}},ne.strong=function(te,ie,ue){ue===void 0&&(ue="");var de=this.rules.inline.strong.start.exec(te);if(de&&(!de[1]||de[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ve=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Ee;(de=ve.exec(ie))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ie.slice(0,de.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ne.em=function(te,ie,ue){ue===void 0&&(ue="");var de=this.rules.inline.em.start.exec(te);if(de&&(!de[1]||de[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ve=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Ee;(de=ve.exec(ie))!=null;)if(Ee=this.rules.inline.em.middle.exec(ie.slice(0,de.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ne.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var ue=ie[2].replace(/\n/g," "),de=/[^ ]/.test(ue),ve=ue.startsWith(" ")&&ue.endsWith(" ");return de&&ve&&(ue=ue.substring(1,ue.length-1)),ue=ae(ue,!0),{type:"codespan",raw:ie[0],text:ue}}},ne.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},ne.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ne.autolink=function(te,ie){var ue=this.rules.inline.autolink.exec(te);if(ue){var de,ve;return ue[2]==="@"?(de=ae(this.options.mangle?ie(ue[1]):ue[1]),ve="mailto:"+de):(de=ae(ue[1]),ve=de),{type:"link",raw:ue[0],text:de,href:ve,tokens:[{type:"text",raw:de,text:de}]}}},ne.url=function(te,ie){var ue;if(ue=this.rules.inline.url.exec(te)){var de,ve;if(ue[2]==="@")de=ae(this.options.mangle?ie(ue[0]):ue[0]),ve="mailto:"+de;else{var Ee;do Ee=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Ee!==ue[0]);de=ae(ue[0]),ue[1]==="www."?ve="http://"+de:ve=de}return{type:"link",raw:ue[0],text:de,href:ve,tokens:[{type:"text",raw:de,text:de}]}}},ne.inlineText=function(te,ie,ue){var de=this.rules.inline.text.exec(te);if(de){var ve;return ie?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ae(de[0]):de[0]:ve=ae(this.options.smartypants?ue(de[0]):de[0]),{type:"text",raw:de[0],text:ve}}},ee}(),ke=V.noopTest,Te=V.edit,Se=V.merge,ye={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:ke,table:ke,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ye._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ye._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ye.def=Te(ye.def).replace("label",ye._label).replace("title",ye._title).getRegex(),ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,ye.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ye.item=Te(ye.item,"gm").replace(/bull/g,ye.bullet).getRegex(),ye.list=Te(ye.list).replace(/bull/g,ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ye.def.source+")").getRegex(),ye._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",ye._comment=/<!--(?!-?>)[\s\S]*?-->/,ye.html=Te(ye.html,"i").replace("comment",ye._comment).replace("tag",ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye.paragraph=Te(ye._paragraph).replace("hr",ye.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",ye._tag).getRegex(),ye.blockquote=Te(ye.blockquote).replace("paragraph",ye.paragraph).getRegex(),ye.normal=Se({},ye),ye.gfm=Se({},ye.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*|$)"}),ye.gfm.nptable=Te(ye.gfm.nptable).replace("hr",ye.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",ye._tag).getRegex(),ye.gfm.table=Te(ye.gfm.table).replace("hr",ye.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",ye._tag).getRegex(),ye.pedantic=Se({},ye.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye._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:ke,paragraph:Te(ye.normal._paragraph).replace("hr",ye.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ke,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:ke,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",z.punctuation=Te(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=Te(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=Te(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=Te(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=Te(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=Te(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=Te(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=Te(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=Te(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=Te(z._blockSkip,"g").getRegex(),z.overlapSkip=Te(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._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])?)+(?![-_])/,z.autolink=Te(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=Te(z.tag).replace("comment",ye._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=Te(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=Te(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=Te(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=Se({},z),z.pedantic=Se({},z.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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=Se({},z.normal,{escape:Te(z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),z.gfm.url=Te(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=Se({},z.gfm,{br:Te(z.br).replace("{2,}","*").getRegex(),text:Te(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var s={block:ye,inline:z},c=G.defaults,R=s.block,Y=s.inline;function N(ee){return ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function se(ee){var ne="",le,te,ie=ee.length;for(le=0;le<ie;le++)te=ee.charCodeAt(le),Math.random()>.5&&(te="x"+te.toString(16)),ne+="&#"+te+";";return ne}var be=function(){function ee(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||c,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:R.normal,inline:Y.normal};this.options.pedantic?(te.block=R.pedantic,te.inline=Y.pedantic):this.options.gfm&&(te.block=R.gfm,this.options.breaks?te.inline=Y.breaks:te.inline=Y.gfm),this.tokenizer.rules=te}ee.lex=function(te,ie){var ue=new ee(ie);return ue.lex(te)};var ne=ee.prototype;return ne.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ne.blockTokens=function(te,ie,ue){ie===void 0&&(ie=[]),ue===void 0&&(ue=!0),te=te.replace(/^ +$/gm,"");for(var de,ve,Ee,Me;te;){if(de=this.tokenizer.space(te)){te=te.substring(de.raw.length),de.type&&ie.push(de);continue}if(de=this.tokenizer.code(te,ie)){te=te.substring(de.raw.length),de.type?ie.push(de):(Me=ie[ie.length-1],Me.raw+=`
`+de.raw,Me.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.heading(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.nptable(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.hr(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.blockquote(te)){te=te.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],ue),ie.push(de);continue}if(de=this.tokenizer.list(te)){for(te=te.substring(de.raw.length),Ee=de.items.length,ve=0;ve<Ee;ve++)de.items[ve].tokens=this.blockTokens(de.items[ve].text,[],!1);ie.push(de);continue}if(de=this.tokenizer.html(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(ue&&(de=this.tokenizer.def(te))){te=te.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.lheading(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(ue&&(de=this.tokenizer.paragraph(te))){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.text(te,ie)){te=te.substring(de.raw.length),de.type?ie.push(de):(Me=ie[ie.length-1],Me.raw+=`
`+de.raw,Me.text+=`
`+de.text);continue}if(te){var Be="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Be);break}else throw new Error(Be)}}return ie},ne.inline=function(te){var ie,ue,de,ve,Ee,Me,Be=te.length;for(ie=0;ie<Be;ie++){Me=te[ie];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},ve=Me.header.length,ue=0;ue<ve;ue++)Me.tokens.header[ue]=[],this.inlineTokens(Me.header[ue],Me.tokens.header[ue]);for(ve=Me.cells.length,ue=0;ue<ve;ue++)for(Ee=Me.cells[ue],Me.tokens.cells[ue]=[],de=0;de<Ee.length;de++)Me.tokens.cells[ue][de]=[],this.inlineTokens(Ee[de],Me.tokens.cells[ue][de]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(ve=Me.items.length,ue=0;ue<ve;ue++)this.inline(Me.items[ue].tokens);break}}}return te},ne.inlineTokens=function(te,ie,ue,de,ve){ie===void 0&&(ie=[]),ue===void 0&&(ue=!1),de===void 0&&(de=!1),ve===void 0&&(ve="");var Ee,Me=te,Be;if(this.tokens.links){var Ye=Object.keys(this.tokens.links);if(Ye.length>0)for(;(Be=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)Ye.includes(Be[0].slice(Be[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Be=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ee=this.tokenizer.escape(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.tag(te,ue,de)){te=te.substring(Ee.raw.length),ue=Ee.inLink,de=Ee.inRawBlock,ie.push(Ee);continue}if(Ee=this.tokenizer.link(te)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,de)),ie.push(Ee);continue}if(Ee=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,de)),ie.push(Ee);continue}if(Ee=this.tokenizer.strong(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.em(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.codespan(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.br(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.del(te)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.autolink(te,se)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(!ue&&(Ee=this.tokenizer.url(te,se))){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.inlineText(te,de,N)){te=te.substring(Ee.raw.length),ve=Ee.raw.slice(-1),ie.push(Ee);continue}if(te){var We="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return ie},Z(ee,null,[{key:"rules",get:function(){return{block:R,inline:Y}}}]),ee}(),Ae=G.defaults,Oe=V.cleanUrl,Le=V.escape,_e=function(){function ee(le){this.options=le||Ae}var ne=ee.prototype;return ne.code=function(te,ie,ue){var de=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(te,de);ve!=null&&ve!==te&&(ue=!0,te=ve)}return de?'<pre><code class="'+this.options.langPrefix+Le(de,!0)+'">'+(ue?te:Le(te,!0))+`</code></pre>
`:"<pre><code>"+(ue?te:Le(te,!0))+`</code></pre>
`},ne.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},ne.html=function(te){return te},ne.heading=function(te,ie,ue,de){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+de.slug(ue)+'">'+te+"</h"+ie+`>
`:"<h"+ie+">"+te+"</h"+ie+`>
`},ne.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ne.list=function(te,ie,ue){var de=ie?"ol":"ul",ve=ie&&ue!==1?' start="'+ue+'"':"";return"<"+de+ve+`>
`+te+"</"+de+`>
`},ne.listitem=function(te){return"<li>"+te+`</li>
`},ne.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ne.paragraph=function(te){return"<p>"+te+`</p>
`},ne.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ie+`</table>
`},ne.tablerow=function(te){return`<tr>
`+te+`</tr>
`},ne.tablecell=function(te,ie){var ue=ie.header?"th":"td",de=ie.align?"<"+ue+' align="'+ie.align+'">':"<"+ue+">";return de+te+"</"+ue+`>
`},ne.strong=function(te){return"<strong>"+te+"</strong>"},ne.em=function(te){return"<em>"+te+"</em>"},ne.codespan=function(te){return"<code>"+te+"</code>"},ne.br=function(){return this.options.xhtml?"<br/>":"<br>"},ne.del=function(te){return"<del>"+te+"</del>"},ne.link=function(te,ie,ue){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var de='<a href="'+Le(te)+'"';return ie&&(de+=' title="'+ie+'"'),de+=">"+ue+"</a>",de},ne.image=function(te,ie,ue){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var de='<img src="'+te+'" alt="'+ue+'"';return ie&&(de+=' title="'+ie+'"'),de+=this.options.xhtml?"/>":">",de},ne.text=function(te){return te},ee}(),Pe=function(){function ee(){}var ne=ee.prototype;return ne.strong=function(te){return te},ne.em=function(te){return te},ne.codespan=function(te){return te},ne.del=function(te){return te},ne.html=function(te){return te},ne.text=function(te){return te},ne.link=function(te,ie,ue){return""+ue},ne.image=function(te,ie,ue){return""+ue},ne.br=function(){return""},ee}(),He=function(){function ee(){this.seen={}}var ne=ee.prototype;return ne.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ue=ie;do this.seen[ue]++,ie=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ee}(),Ge=G.defaults,Xe=V.unescape,ze=function(){function ee(le){this.options=le||Ge,this.options.renderer=this.options.renderer||new _e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new He}ee.parse=function(te,ie){var ue=new ee(ie);return ue.parse(te)};var ne=ee.prototype;return ne.parse=function(te,ie){ie===void 0&&(ie=!0);var ue="",de,ve,Ee,Me,Be,Ye,We,pt,nt,tt,Tt,bt,xt,kt,Et,qt,Tr,Yt,gr=te.length;for(de=0;de<gr;de++){tt=te[de];switch(tt.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(tt.tokens),tt.depth,Xe(this.parseInline(tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(tt.text,tt.lang,tt.escaped);continue}case"table":{for(pt="",We="",Me=tt.header.length,ve=0;ve<Me;ve++)We+=this.renderer.tablecell(this.parseInline(tt.tokens.header[ve]),{header:!0,align:tt.align[ve]});for(pt+=this.renderer.tablerow(We),nt="",Me=tt.cells.length,ve=0;ve<Me;ve++){for(Ye=tt.tokens.cells[ve],We="",Be=Ye.length,Ee=0;Ee<Be;Ee++)We+=this.renderer.tablecell(this.parseInline(Ye[Ee]),{header:!1,align:tt.align[Ee]});nt+=this.renderer.tablerow(We)}ue+=this.renderer.table(pt,nt);continue}case"blockquote":{nt=this.parse(tt.tokens),ue+=this.renderer.blockquote(nt);continue}case"list":{for(Tt=tt.ordered,bt=tt.start,xt=tt.loose,Me=tt.items.length,nt="",ve=0;ve<Me;ve++)Et=tt.items[ve],qt=Et.checked,Tr=Et.task,kt="",Et.task&&(Yt=this.renderer.checkbox(qt),xt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=Yt+" "+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=Yt+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:Yt}):kt+=Yt),kt+=this.parse(Et.tokens,xt),nt+=this.renderer.listitem(kt,Tr,qt);ue+=this.renderer.list(nt,Tt,bt);continue}case"html":{ue+=this.renderer.html(tt.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(tt.tokens));continue}case"text":{for(nt=tt.tokens?this.parseInline(tt.tokens):tt.text;de+1<gr&&te[de+1].type==="text";)tt=te[++de],nt+=`
`+(tt.tokens?this.parseInline(tt.tokens):tt.text);ue+=ie?this.renderer.paragraph(nt):nt;continue}default:{var fr='Token with "'+tt.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return ue},ne.parseInline=function(te,ie){ie=ie||this.renderer;var ue="",de,ve,Ee=te.length;for(de=0;de<Ee;de++){ve=te[de];switch(ve.type){case"escape":{ue+=ie.text(ve.text);break}case"html":{ue+=ie.html(ve.text);break}case"link":{ue+=ie.link(ve.href,ve.title,this.parseInline(ve.tokens,ie));break}case"image":{ue+=ie.image(ve.href,ve.title,ve.text);break}case"strong":{ue+=ie.strong(this.parseInline(ve.tokens,ie));break}case"em":{ue+=ie.em(this.parseInline(ve.tokens,ie));break}case"codespan":{ue+=ie.codespan(ve.text);break}case"br":{ue+=ie.br();break}case"del":{ue+=ie.del(this.parseInline(ve.tokens,ie));break}case"text":{ue+=ie.text(ve.text);break}default:{var Me='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return ue},ee}(),ot=V.merge,$e=V.checkSanitizeDeprecation,Je=V.escape,Re=G.getDefaults,rt=G.changeDefaults,qe=G.defaults;function oe(ee,ne,le){if(typeof ee=="undefined"||ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ee)+", string expected");if(typeof ne=="function"&&(le=ne,ne=null),ne=ot({},oe.defaults,ne||{}),$e(ne),le){var te=ne.highlight,ie;try{ie=be.lex(ee,ne)}catch(Ee){return le(Ee)}var ue=function(Me){var Be;if(!Me)try{Be=ze.parse(ie,ne)}catch(Ye){Me=Ye}return ne.highlight=te,Me?le(Me):le(null,Be)};if(!te||te.length<3)return ue();if(delete ne.highlight,!ie.length)return ue();var de=0;oe.walkTokens(ie,function(Ee){Ee.type==="code"&&(de++,setTimeout(function(){te(Ee.text,Ee.lang,function(Me,Be){if(Me)return ue(Me);Be!=null&&Be!==Ee.text&&(Ee.text=Be,Ee.escaped=!0),de--,de===0&&ue()})},0))}),de===0&&ue();return}try{var ve=be.lex(ee,ne);return ne.walkTokens&&oe.walkTokens(ve,ne.walkTokens),ze.parse(ve,ne)}catch(Ee){if(Ee.message+=`
Please report this to https://github.com/markedjs/marked.`,ne.silent)return"<p>An error occurred:</p><pre>"+Je(Ee.message+"",!0)+"</pre>";throw Ee}}oe.options=oe.setOptions=function(ee){return ot(oe.defaults,ee),rt(oe.defaults),oe},oe.getDefaults=Re,oe.defaults=qe,oe.use=function(ee){var ne=ot({},ee);if(ee.renderer&&function(){var te=oe.defaults.renderer||new _e,ie=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,Be=new Array(Me),Ye=0;Ye<Me;Ye++)Be[Ye]=arguments[Ye];var We=ee.renderer[ve].apply(te,Be);return We===!1&&(We=Ee.apply(te,Be)),We}};for(var ue in ee.renderer)ie(ue);ne.renderer=te}(),ee.tokenizer&&function(){var te=oe.defaults.tokenizer||new xe,ie=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,Be=new Array(Me),Ye=0;Ye<Me;Ye++)Be[Ye]=arguments[Ye];var We=ee.tokenizer[ve].apply(te,Be);return We===!1&&(We=Ee.apply(te,Be)),We}};for(var ue in ee.tokenizer)ie(ue);ne.tokenizer=te}(),ee.walkTokens){var le=oe.defaults.walkTokens;ne.walkTokens=function(te){ee.walkTokens(te),le&&le(te)}}oe.setOptions(ne)},oe.walkTokens=function(ee,ne){for(var le=U(ee),te;!(te=le()).done;){var ie=te.value;ne(ie);switch(ie.type){case"table":{for(var ue=U(ie.tokens.header),de;!(de=ue()).done;){var ve=de.value;oe.walkTokens(ve,ne)}for(var Ee=U(ie.tokens.cells),Me;!(Me=Ee()).done;)for(var Be=Me.value,Ye=U(Be),We;!(We=Ye()).done;){var pt=We.value;oe.walkTokens(pt,ne)}break}case"list":{oe.walkTokens(ie.items,ne);break}default:ie.tokens&&oe.walkTokens(ie.tokens,ne)}}},oe.Parser=ze,oe.parser=ze.parse,oe.Renderer=_e,oe.TextRenderer=Pe,oe.Lexer=be,oe.lexer=be.lex,oe.Tokenizer=xe,oe.Slugger=He,oe.parse=oe;var q=oe;return q})},ELLl:function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},_=fe.Pos;fe.defineOption("autoCloseBrackets",!1,function(A,w,d){d&&d!=fe.Init&&(A.removeKeyMap(U),A.state.closeBrackets=null),w&&(D(Q(w,"pairs")),A.state.closeBrackets=w,A.addKeyMap(U))});function Q(A,w){return w=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[w]!=null?A[w]:Z[w]}var U={Backspace:F,Enter:O};function D(A){for(var w=0;w<A.length;w++){var d=A.charAt(w),o="'"+d+"'";U[o]||(U[o]=G(d))}}D(Z.pairs+"`");function G(A){return function(w){return T(w,A)}}function H(A){var w=A.state.closeBrackets;if(!w||w.override)return w;var d=A.getModeAt(A.getCursor());return d.closeBrackets||w}function F(A){var w=H(A);if(!w||A.getOption("disableInput"))return fe.Pass;for(var d=Q(w,"pairs"),o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var u=I(A,o[l].head);if(!u||d.indexOf(u)%2!=0)return fe.Pass}for(var l=o.length-1;l>=0;l--){var C=o[l].head;A.replaceRange("",_(C.line,C.ch-1),_(C.line,C.ch+1),"+delete")}}function O(A){var w=H(A),d=w&&Q(w,"explode");if(!d||A.getOption("disableInput"))return fe.Pass;for(var o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var u=I(A,o[l].head);if(!u||d.indexOf(u)%2!=0)return fe.Pass}A.operation(function(){var C=A.lineSeparator()||`
`;A.replaceSelection(C+C,null),A.execCommand("goCharLeft"),o=A.listSelections();for(var v=0;v<o.length;v++){var g=o[v].head.line;A.indentLine(g,null,!0),A.indentLine(g+1,null,!0)}})}function y(A){var w=fe.cmpPos(A.anchor,A.head)>0;return{anchor:new _(A.anchor.line,A.anchor.ch+(w?-1:1)),head:new _(A.head.line,A.head.ch+(w?1:-1))}}function T(A,w){var d=H(A);if(!d||A.getOption("disableInput"))return fe.Pass;var o=Q(d,"pairs"),l=o.indexOf(w);if(l==-1)return fe.Pass;for(var u=Q(d,"closeBefore"),C=Q(d,"triples"),v=o.charAt(l+1)==w,g=A.listSelections(),k=l%2==0,x,f=0;f<g.length;f++){var p=g[f],h=p.head,a,b=A.getRange(h,_(h.line,h.ch+1));if(k&&!p.empty())a="surround";else if((v||!k)&&b==w)v&&L(A,h)?a="both":C.indexOf(w)>=0&&A.getRange(h,_(h.line,h.ch+3))==w+w+w?a="skipThree":a="skip";else if(v&&h.ch>1&&C.indexOf(w)>=0&&A.getRange(_(h.line,h.ch-2),h)==w+w){if(h.ch>2&&/\bstring/.test(A.getTokenTypeAt(_(h.line,h.ch-2))))return fe.Pass;a="addFour"}else if(v){var m=h.ch==0?" ":A.getRange(_(h.line,h.ch-1),h);if(!fe.isWordChar(b)&&m!=w&&!fe.isWordChar(m))a="both";else return fe.Pass}else if(k&&(b.length===0||/\s/.test(b)||u.indexOf(b)>-1))a="both";else return fe.Pass;if(!x)x=a;else if(x!=a)return fe.Pass}var E=l%2?o.charAt(l-1):w,B=l%2?w:o.charAt(l+1);A.operation(function(){if(x=="skip")A.execCommand("goCharRight");else if(x=="skipThree")for(var W=0;W<3;W++)A.execCommand("goCharRight");else if(x=="surround"){for(var K=A.getSelections(),W=0;W<K.length;W++)K[W]=E+K[W]+B;A.replaceSelections(K,"around"),K=A.listSelections().slice();for(var W=0;W<K.length;W++)K[W]=y(K[W]);A.setSelections(K)}else x=="both"?(A.replaceSelection(E+B,null),A.triggerElectric(E+B),A.execCommand("goCharLeft")):x=="addFour"&&(A.replaceSelection(E+E+E+E,"before"),A.execCommand("goCharRight"))})}function I(A,w){var d=A.getRange(_(w.line,w.ch-1),_(w.line,w.ch+1));return d.length==2?d:null}function L(A,w){var d=A.getTokenAt(_(w.line,w.ch+1));return/\bstring/.test(d.type)&&d.start==w.ch&&(w.ch==0||!/\bstring/.test(A.getTokenTypeAt(w)))}})},GfqC:function(ft,it,pe){"use strict";var fe=pe("q1tI"),Z=pe.n(fe),_=pe("TSYQ"),Q=pe.n(_);function U(V,M){var P="cannot "+V.method+" "+V.action+" "+M.status+"'",$=new Error(P);return $.status=M.status,$.method=V.method,$.url=V.action,$}function D(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(P){return M}}function G(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(he){he.total>0&&(he.percent=he.loaded/he.total*100),V.onProgress(he)});var P=new FormData;V.data&&Object.keys(V.data).forEach(function(ae){var he=V.data[ae];if(Array.isArray(he)){he.forEach(function(me){P.append(ae+"[]",me)});return}P.append(ae,V.data[ae])}),V.file instanceof Blob?P.append(V.filename,V.file,V.file.name):P.append(V.filename,V.file),M.onerror=function(he){V.onError(he)},M.onload=function(){return M.status<200||M.status>=300?V.onError(U(V,M),D(M)):V.onSuccess(D(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ae){$[ae]!==null&&M.setRequestHeader(ae,$[ae])}),M.send(P),{abort:function(){M.abort()}}}var H=+new Date,F=0;function O(){return"rc-upload-"+H+"-"+ ++F}function y(V,M){return V.indexOf(M,V.length-M.length)!==-1}var T=function(V,M){if(V&&M){var P=Array.isArray(M)?M:M.split(","),$=V.name||"",ae=V.type||"",he=ae.replace(/\/.*$/,"");return P.some(function(me){var De=me.trim();return De.charAt(0)==="."?y($.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?he===De.replace(/\/.*$/,""):ae===De})}return!0};function I(V,M){var P=V.createReader(),$=[];function ae(){P.readEntries(function(he){var me=Array.prototype.slice.apply(he);$=$.concat(me);var De=!me.length;De?M($):ae()})}ae()}var L=function(M,P,$){var ae=function he(me,De){De=De||"",me.isFile?me.file(function(xe){$(xe)&&(me.fullPath&&!xe.webkitRelativePath&&(Object.defineProperties(xe,{webkitRelativePath:{writable:!0}}),xe.webkitRelativePath=me.fullPath.replace(/^\//,""),Object.defineProperties(xe,{webkitRelativePath:{writable:!1}})),P([xe]))}):me.isDirectory&&I(me,function(xe){xe.forEach(function(ke){he(ke,""+De+me.name+"/")})})};M.forEach(function(he){ae(he.webkitGetAsEntry())})},A=L,w=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var P=arguments[M];for(var $ in P)Object.prototype.hasOwnProperty.call(P,$)&&(V[$]=P[$])}return V},d=function(){function V(M,P){var $=[],ae=!0,he=!1,me=void 0;try{for(var De=M[Symbol.iterator](),xe;!(ae=(xe=De.next()).done)&&!($.push(xe.value),P&&$.length===P);ae=!0);}catch(ke){he=!0,me=ke}finally{try{!ae&&De.return&&De.return()}finally{if(he)throw me}}return $}return function(M,P){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(M,P){for(var $=0;$<P.length;$++){var ae=P[$];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,P,$){return P&&V(M.prototype,P),$&&V(M,$),M}}();function l(V,M,P){return M in V?Object.defineProperty(V,M,{value:P,enumerable:!0,configurable:!0,writable:!0}):V[M]=P,V}function u(V,M){var P={};for(var $ in V){if(M.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;P[$]=V[$]}return P}function C(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function v(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function g(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var k=function(M){return Object.keys(M).reduce(function(P,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(P[$]=M[$]),P},{})},x=function(V){g(M,V);function M(){var P,$,ae,he;C(this,M);for(var me=arguments.length,De=Array(me),xe=0;xe<me;xe++)De[xe]=arguments[xe];return he=($=(ae=v(this,(P=M.__proto__||Object.getPrototypeOf(M)).call.apply(P,[this].concat(De))),ae),ae.state={uid:O()},ae.reqs={},ae.onChange=function(ke){var Te=ke.target.files;ae.uploadFiles(Te),ae.reset()},ae.onClick=function(ke){var Te=ae.fileInput;if(!Te)return;var Se=ae.props,ye=Se.children,z=Se.onClick;ye&&ye.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),z&&z(ke)},ae.onKeyDown=function(ke){ke.key==="Enter"&&ae.onClick()},ae.onFileDrop=function(ke){var Te=ae.props.multiple;if(ke.preventDefault(),ke.type==="dragover")return;if(ae.props.directory)A(Array.prototype.slice.call(ke.dataTransfer.items),ae.uploadFiles,function(ye){return T(ye,ae.props.accept)});else{var Se=Array.prototype.slice.call(ke.dataTransfer.files).filter(function(ye){return T(ye,ae.props.accept)});Te===!1&&(Se=Se.slice(0,1)),ae.uploadFiles(Se)}},ae.uploadFiles=function(ke){var Te=Array.prototype.slice.call(ke);Te.map(function(Se){return Se.uid=O(),Se}).forEach(function(Se){ae.upload(Se,Te)})},ae.saveFileInput=function(ke){ae.fileInput=ke},$),v(ae,he)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ae){var he=this,me=this.props;if(!me.beforeUpload)return setTimeout(function(){return he.post($)},0);var De=me.beforeUpload($,ae);De&&De.then?De.then(function(xe){var ke=Object.prototype.toString.call(xe);return ke==="[object File]"||ke==="[object Blob]"?he.post(xe):he.post($)}).catch(function(xe){console.log(xe)}):De!==!1&&setTimeout(function(){return he.post($)},0);return}},{key:"post",value:function($){var ae=this;if(!this._isMounted)return;var he=this.props,me=he.onStart,De=he.onProgress,xe=he.transformFile,ke=xe===void 0?function(Te){return Te}:xe;new Promise(function(Te){var Se=he.action;return typeof Se=="function"&&(Se=Se($)),Te(Se)}).then(function(Te){var Se=$.uid,ye=he.customRequest||G,z=Promise.resolve(ke($)).then(function(s){var c=he.data;return typeof c=="function"&&(c=c(s)),Promise.all([s,c])}).catch(function(s){console.error(s)});z.then(function(s){var c=d(s,2),R=c[0],Y=c[1],N={action:Te,filename:he.name,data:Y,file:R,headers:he.headers,withCredentials:he.withCredentials,method:he.method||"post",onProgress:De?function(se){De(se,$)}:null,onSuccess:function(be,Ae){delete ae.reqs[Se],he.onSuccess(be,$,Ae)},onError:function(be,Ae){delete ae.reqs[Se],he.onError(be,Ae,$)}};me($),ae.reqs[Se]=ye(N)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function($){var ae=this.reqs;if($){var he=$;$&&$.uid&&(he=$.uid),ae[he]&&ae[he].abort&&ae[he].abort(),delete ae[he]}else Object.keys(ae).forEach(function(me){ae[me]&&ae[me].abort&&ae[me].abort(),delete ae[me]})}},{key:"render",value:function(){var $,ae=this.props,he=ae.component,me=ae.prefixCls,De=ae.className,xe=ae.disabled,ke=ae.id,Te=ae.style,Se=ae.multiple,ye=ae.accept,z=ae.children,s=ae.directory,c=ae.openFileDialogOnClick,R=ae.onMouseEnter,Y=ae.onMouseLeave,N=u(ae,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),se=Q()(($={},l($,me,!0),l($,me+"-disabled",xe),l($,De,De),$)),be=xe?{}:{onClick:c?this.onClick:function(){},onKeyDown:c?this.onKeyDown:function(){},onMouseEnter:R,onMouseLeave:Y,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(he,w({},be,{className:se,role:"button",style:Te}),Z.a.createElement("input",w({},k(N),{id:ke,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ye,directory:s?"directory":null,webkitdirectory:s?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),z)}}]),M}(fe.Component),f=x,p=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var P=arguments[M];for(var $ in P)Object.prototype.hasOwnProperty.call(P,$)&&(V[$]=P[$])}return V},h=function(){function V(M,P){for(var $=0;$<P.length;$++){var ae=P[$];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,P,$){return P&&V(M.prototype,P),$&&V(M,$),M}}();function a(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function b(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function E(){}var B=function(V){m(M,V);function M(){var P,$,ae,he;a(this,M);for(var me=arguments.length,De=Array(me),xe=0;xe<me;xe++)De[xe]=arguments[xe];return he=($=(ae=b(this,(P=M.__proto__||Object.getPrototypeOf(M)).call.apply(P,[this].concat(De))),ae),ae.saveUploader=function(ke){ae.uploader=ke},$),b(ae,he)}return h(M,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Z.a.createElement(f,p({},this.props,{ref:this.saveUploader}))}}]),M}(fe.Component);B.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var W=B,K=it.a=W},HmJG:function(ft,it,pe){},LdHM:function(ft,it,pe){"use strict";pe.d(it,"b",function(){return u}),pe.d(it,"a",function(){return v});var fe=pe("1OyB"),Z=pe("vuIU"),_=pe("Ji7U"),Q=pe("LK+K"),U=pe("q1tI"),D=pe("rePB"),G=pe("Ff2n"),H=pe("ODXe"),F=pe("4IlW"),O=pe("bX4T"),y=pe("YrtM"),T=pe("TSYQ"),I=pe.n(T),L=pe("+nKL"),A=pe("8OUc"),w=function($,ae){var he=$.prefixCls,me=$.id,De=$.flattenOptions,xe=$.childrenAsData,ke=$.values,Te=$.searchValue,Se=$.multiple,ye=$.defaultActiveFirstOption,z=$.height,s=$.itemHeight,c=$.notFoundContent,R=$.open,Y=$.menuItemSelectedIcon,N=$.virtual,se=$.onSelect,be=$.onToggleOpen,Ae=$.onActiveValue,Oe=$.onScroll,Le=$.onMouseEnter,_e="".concat(he,"-item"),Pe=Object(y.a)(function(){return De},[R,De],function(q,ee){return ee[0]&&q[1]!==ee[1]}),He=U.useRef(null),Ge=function(ee){ee.preventDefault()},Xe=function(ee){He.current&&He.current.scrollTo({index:ee})},ze=function(ee){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=Pe.length,te=0;te<le;te+=1){var ie=(ee+te*ne+le)%le,ue=Pe[ie],de=ue.group,ve=ue.data;if(!de&&!ve.disabled)return ie}return-1},ot=U.useState(function(){return ze(0)}),$e=Object(H.a)(ot,2),Je=$e[0],Re=$e[1],rt=function(ee){Re(ee);var ne=Pe[ee];if(!ne){Ae(null,-1);return}Ae(ne.data.value,ee)};U.useEffect(function(){rt(ye!==!1?ze(0):-1)},[Pe.length,Te]),U.useEffect(function(){var q=setTimeout(function(){if(!Se&&R&&ke.size===1){var ee=Array.from(ke)[0],ne=Pe.findIndex(function(le){var te=le.data;return te.value===ee});rt(ne),Xe(ne)}});return function(){return clearTimeout(q)}},[R]);var qe=function(ee){ee!==void 0&&se(ee,{selected:!ke.has(ee)}),Se||be(!1)};if(U.useImperativeHandle(ae,function(){return{onKeyDown:function(ee){var ne=ee.which;switch(ne){case F.a.UP:case F.a.DOWN:{var le=0;if(ne===F.a.UP?le=-1:ne===F.a.DOWN&&(le=1),le!==0){var te=ze(Je+le,le);Xe(te),rt(te)}break}case F.a.ENTER:{var ie=Pe[Je];ie&&!ie.data.disabled?qe(ie.data.value):qe(void 0),R&&ee.preventDefault();break}case F.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(ee){Xe(ee)}}}),Pe.length===0)return U.createElement("div",{role:"listbox",id:"".concat(me,"_list"),className:"".concat(_e,"-empty"),onMouseDown:Ge},c);function oe(q){var ee=Pe[q];if(!ee)return null;var ne=ee.data||{},le=ne.value,te=ne.label,ie=ne.children,ue=Object(O.a)(ne,!0),de=xe?ie:te;return ee?U.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},ue,{key:q,role:"option",id:"".concat(me,"_list_").concat(q),"aria-selected":ke.has(le)}),le):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(me,"_list"),style:{height:0,width:0,overflow:"hidden"}},oe(Je-1),oe(Je),oe(Je+1)),U.createElement(L.a,{itemKey:"key",ref:He,data:Pe,height:z,itemHeight:s,fullHeight:!1,onMouseDown:Ge,onScroll:Oe,virtual:N,onMouseEnter:Le},function(q,ee){var ne,le=q.group,te=q.groupOption,ie=q.data,ue=ie.label,de=ie.key;if(le)return U.createElement("div",{className:I()(_e,"".concat(_e,"-group"))},ue!==void 0?ue:de);var ve=ie.disabled,Ee=ie.value,Me=ie.title,Be=ie.children,Ye=ie.style,We=ie.className,pt=Object(G.a)(ie,["disabled","value","title","children","style","className"]),nt=ke.has(Ee),tt="".concat(_e,"-option"),Tt=I()(_e,tt,We,(ne={},Object(D.a)(ne,"".concat(tt,"-grouped"),te),Object(D.a)(ne,"".concat(tt,"-active"),Je===ee&&!ve),Object(D.a)(ne,"".concat(tt,"-disabled"),ve),Object(D.a)(ne,"".concat(tt,"-selected"),nt),ne)),bt=xe?Be:ue,xt=!Y||typeof Y=="function"||nt;return U.createElement("div",Object.assign({},pt,{"aria-selected":nt,className:Tt,title:Me,onMouseMove:function(){if(Je===ee||ve)return;rt(ee)},onClick:function(){ve||qe(Ee)},style:Ye}),U.createElement("div",{className:"".concat(tt,"-content")},bt||Ee),U.isValidElement(Y)||nt,xt&&U.createElement(A.a,{className:"".concat(_e,"-option-state"),customizeIcon:Y,customizeIconProps:{isSelected:nt}},nt?"\u2713":null))}))},d=U.forwardRef(w);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var u=l,C=function(){return null};C.isSelectOptGroup=!0;var v=C,g=pe("VTBJ"),k=pe("Zm9Q");function x(P){var $=P.key,ae=P.props,he=ae.children,me=ae.value,De=Object(G.a)(ae,["children","value"]);return Object(g.a)({key:$,value:me!==void 0?me:$,children:he},De)}function f(P){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(P).map(function(ae,he){if(!U.isValidElement(ae)||!ae.type)return null;var me=ae.type.isSelectOptGroup,De=ae.key,xe=ae.props,ke=xe.children,Te=Object(G.a)(xe,["children"]);return $||!me?x(ae):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(De===null?he:De,"__"),label:De},Te),{},{options:f(ke)})}).filter(function(ae){return ae})}var p=pe("2Qr1"),h=pe("qNPg"),a=pe("U8pU"),b=pe("Kwbf"),m=pe("WKfj");function E(P){var $=P.mode,ae=P.options,he=P.children,me=P.backfill,De=P.allowClear,xe=P.placeholder,ke=P.getInputElement,Te=P.showSearch,Se=P.onSearch,ye=P.defaultOpen,z=P.autoFocus,s=P.labelInValue,c=P.value,R=P.inputValue,Y=P.optionLabelProp,N=$==="multiple"||$==="tags",se=Te!==void 0?Te:N||$==="combobox",be=ae||f(he);if(Object(b.a)($!=="tags"||be.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Ae=be.some(function(_e){return _e.options?_e.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in _e?_e.value:_e.key)=="number"});Object(b.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)($!=="combobox"||!Y,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)($==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(b.a)($==="combobox"||!ke,"`getInputElement` only work with `combobox` mode."),Object(b.b)($!=="combobox"||!ke||!De||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!se&&$!=="combobox"&&$!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ye||z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),c!=null){var Oe=Object(m.d)(c);Object(b.a)(!s||Oe.every(function(_e){return Object(a.a)(_e)==="object"&&("key"in _e||"value"in _e)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!N||Array.isArray(c),"`value` should be array when `mode` is `multiple` or `tags`")}if(he){var Le=null;Object(k.a)(he).some(function(_e){if(!U.isValidElement(_e)||!_e.type)return!1;var Pe=_e.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var He=Object(k.a)(_e.props.children).every(function(Ge){return!U.isValidElement(Ge)||!_e.type||Ge.type.isSelectOption?!0:(Le=Ge.type,!1)});return!He}return Le=Pe,!0}),Le&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Le.displayName||Le.name||Le,"`.")),Object(b.a)(R===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=E,W=Object(h.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:B,fillOptionsWithMissingValue:p.a}),K=function(P){Object(_.a)(ae,P);var $=Object(Q.a)(ae);function ae(){var he;return Object(fe.a)(this,ae),he=$.apply(this,arguments),he.selectRef=U.createRef(),he.focus=function(){he.selectRef.current.focus()},he.blur=function(){he.selectRef.current.blur()},he}return Object(Z.a)(ae,[{key:"render",value:function(){return U.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ae}(U.Component);K.Option=u,K.OptGroup=v;var V=K,M=it.c=V},M8RZ:function(ft,it,pe){"use strict";pe.d(it,"a",function(){return F});var fe=pe("fWQN"),Z=pe("mtLc"),_=pe("yKVA"),Q=pe("879j"),U=pe("q1tI"),D=pe.n(U),G=pe("i8i4"),H=pe.n(G),F=function(O){Object(_.a)(T,O);var y=Object(Q.a)(T);function T(I){var L;Object(fe.a)(this,T),L=y.call(this,I);var A=window.document;return L.node=A.createElement("div"),A.body.appendChild(L.node),L}return Object(Z.a)(T,[{key:"render",value:function(){var L=this.props.children;return Object(G.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(D.a.Component)},Ot1p:function(ft,it,pe){"use strict";var fe=pe("2qtc"),Z=pe("kLXV"),_=pe("rAM+"),Q=pe("miYZ"),U=pe("tsqr"),D=pe("9og8"),G=pe("tJVT"),H=pe("jrin"),F=pe("WmNS"),O=pe.n(F),y=pe("q1tI"),T=pe.n(y),I=pe("VrN/"),L=pe.n(I),A=pe("bdgK"),w=pe("p77/"),d=pe("Bd2K"),o=pe("ELLl"),l=pe("19Vz"),u=pe("lZu9"),C=pe("+NIl"),v=pe("kSUc"),g=pe("9Bee"),k=function(ve){var Ee=ve.value,Me=Ee===void 0?"":Ee,Be=ve.className,Ye=ve.showTextOnly,We=ve.showLines,pt=ve.style,nt=pt===void 0?{}:pt,tt=Object(y.useMemo)(function(){return""},[Me]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:tt}}))},x=pe("0Owb"),f=pe("dejd"),p=pe("C+DQ"),h=pe("1vsH"),a=pe("m3rI"),b=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ve){var Ee=ve.onActionCallback,Me=ve.title,Be=ve.icon,Ye=ve.actionName,We=ve.className,pt=We===void 0?"":We,nt=ve.children;function tt(){Ee(Ye)}return T.a.createElement("a",{title:Me,className:pt,onClick:tt},T.a.createElement("i",{className:"md-iconfont ".concat(Be)}),nt)}var E=function(ve){var Ee=ve.watch,Me=ve.showNullButton,Be=ve.onActionCallback,Ye=ve.fullScreen,We=ve.insertTemp,pt=ve.hidetoolBar,nt=ve.uuid,tt=ve.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.F)("_educoder_session"),"&key=").concat(nt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Tt=[].concat(b,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!pt&&Tt.map(function(bt,xt){return T.a.createElement("li",{key:xt},bt.actionName?T.a.createElement(m,Object(x.a)({},bt,{onActionCallback:Be})):T.a.createElement("span",{className:"v-line"}))}),Me?T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Be},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,We&&T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(We),onActionCallback:Be},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(m,{icon:"".concat(Ye?"icon-shrink":"icon-enlarge"),title:Ye?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Be})))},B=pe("M8RZ"),W=pe("+L6B"),K=pe("2/Rp"),V=pe("y8nQ"),M=pe("Vl3Y"),P=pe("5NDa"),$=pe("5rEg"),ae={labelCol:{span:4},wrapperCol:{span:20}},he=function(ve){var Ee=ve.callback,Me=ve.onCancel;function Be(Ye){Ee(Ye)}return T.a.createElement(M.a,Object(x.a)({},ae,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Be}),T.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement($.a,null)),T.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement($.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},me=pe("7ahc"),De=pe("HmJG"),xe=pe("BjJ7"),ke=M.a.useForm,Te={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},ye=function(ve){var Ee=ve.callback,Me=ve.onCancel,Be=ke(),Ye=Object(G.a)(Be,1),We=Ye[0];function pt(Tt){Ee(Tt)}function nt(Tt,bt){if(Tt.status===-1){U.b.error(Tt.message);return}We.setFieldsValue({src:"/api/attachments/".concat(Tt.id),type:bt.type})}function tt(Tt){var bt=Tt.target.files[0];s(bt,nt)}return T.a.createElement(M.a,Object(x.a)({form:We},Se,{className:"upload-image-panel",onFinish:pt}),T.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement($.a,{style:Te})),T.a.createElement(z,{onFileChange:tt}))),T.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement($.a,{style:{width:264}})),T.a.createElement(M.a.Item,{style:{textAlign:"right"}},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function z(ve){var Ee=ve.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:Ee}))}function s(ve,Ee){if(!ve)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",ve),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var Be=new window.XMLHttpRequest;Be.withCredentials=!0,Be.addEventListener("load",function(Ye){Ee(JSON.parse(Ye.target.responseText),ve)},!1),Be.addEventListener("error",function(Ye){console.error(Ye)},!1),Be.open("POST","".concat(xe.a,"/api/attachments.json")),Be.send(Me)}var c=pe("giR+"),R=pe("fyUT"),Y=pe("7Kak"),N=pe("9yH6"),se=N.a.Group,be={margin:"0 8px"},Ae=function(ve){var Ee=ve.callback,Me=ve.onCancel;function Be(Ye){Ee(Ye)}return T.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Be},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:be},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:be},"\u884C\u6570"),T.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(R.a,null)),T.a.createElement("span",{style:be},"\u5217\u6570"),T.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(R.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(M.a.Item,{name:"align"},T.a.createElement(se,null,T.a.createElement(N.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(N.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(N.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(N.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Oe=pe("ErOA"),Le=pe("7Cbv"),_e="link",Pe="upload-image",He="code-block",Ge="add-table",Xe="------------",ze={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},ot=pe("9VGf"),$e,Je;function Re(){}var rt=0,qe=1e4,oe="\u2581",q=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ee(ve){return/^\d+$/.test(ve)?"".concat(ve,"px"):ve}var ne=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ne?"Cmd":"Ctrl",te=["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"],ie=($e={},Object(H.a)($e,le+"-B","bold"),Object(H.a)($e,le+"-I","italic"),$e),ue=(Je={},Object(H.a)(Je,_e,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Je,He,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Je,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Je,Ge,"\u6DFB\u52A0\u8868\u683C"),Je),de=it.a=function(ve){var Ee=ve.defaultValue,Me=Ee===void 0?"":Ee,Be=ve.onChange,Ye=ve.width,We=Ye===void 0?"100%":Ye,pt=ve.height,nt=pt===void 0?400:pt,tt=ve.miniToolbar,Tt=tt===void 0?!1:tt,bt=ve.isFocus,xt=bt===void 0?!1:bt,kt=ve.watch,Et=ve.insertTemp,qt=ve.mode,Tr=qt===void 0?"markdown":qt,Yt=ve.id,gr=Yt===void 0?"markdown-editor-id":Yt,fr=ve.showResizeBar,zr=fr===void 0?!1:fr,$t=ve.noStorage,Nr=$t===void 0?!1:$t,ti=ve.showNullButton,Pt=ti===void 0?!1:ti,Ze=ve.hidetoolBar,wt=Ze===void 0?!1:Ze,Zt=ve.fullScreen,gt=Zt===void 0?!1:Zt,mt=ve.onBlur,Lt=ve.onCMBeforeChange,vr=ve.onFullScreen,Ut=ve.className,Fe=Ut===void 0?"":Ut,ht=ve.disablePaste,ri=ht===void 0?!1:ht,bi=ve.placeholder,xi=bi===void 0?"":bi,ii=ve.values,Ei=ii===void 0?"":ii,ct=Object(y.useState)(null),kn=Object(G.a)(ct,2),Ue=kn[0],Si=kn[1],Er=Object(y.useState)(Me),Ki=Object(G.a)(Er,2),ni=Ki[0],Cr=Ki[1],Vi=Object(y.useState)(kt),Xi=Object(G.a)(Vi,2),wr=Xi[0],Yi=Xi[1],Ln=Object(y.useState)(gt),$i=Object(G.a)(Ln,2),Ar=$i[0],Dn=$i[1],aa=Object(y.useState)(""),Zi=Object(G.a)(aa,2),ir=Zi[0],Kr=Zi[1],oa=Object(y.useState)(0),ai=Object(G.a)(oa,2),kr=ai[0],Ji=ai[1],sa=Object(y.useState)(nt),Rn=Object(G.a)(sa,2),On=Rn[0],Ti=Rn[1],_n=Object(y.useState)(!1),Mn=Object(G.a)(_n,2),la=Mn[0],Ci=Mn[1],oi=Object(y.useRef)(Object(Le.a)()),si=Object(y.useRef)(!1),wi=Object(y.useRef)(),Br=Object(y.useRef)(),Fr=Object(y.useRef)(),Ur=Object(y.useRef)(),Ai=Object(y.useRef)(),Pn=function(){var at=Object(D.a)(O.a.mark(function dt(){var lt,yt;return O.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return _t.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:yt=_t.sent,yt!=null&&(lt=yt.attachments)!==null&&lt!==void 0&&lt.length&&(console.log("cm:",Ue,Br),yt.attachments.map(function(Ct){Ct.content_type.indexOf("image")>-1?Ue.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):Ct.content_type.indexOf("video")>-1?Ue.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ct.content_type.indexOf("pdf")>-1?Ue.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,'&disposition=inline" target="_blank">').concat(Ct.name,"</a>")):Ue.replaceSelection("[".concat(Ct.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}));case 4:case"end":return _t.stop()}},dt)}));return function(){return at.apply(this,arguments)}}();Object(y.useEffect)(function(){Cr(Ei),Ue==null||Ue.setValue(Ei)},[Ei]),Object(y.useEffect)(function(){vr==null||vr(Ar)},[Ar]),Object(y.useEffect)(function(){if(Br.current){var at=L.a.fromTextArea(Br.current,{mode:Tr,lineNumbers:!Tt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});xt&&at.focus();function dt(lt,yt){if(ri){yt.preventDefault();return}var At=yt.clipboardData;if(At){var _t=At.types.toString(),Ct=At.items;if(_t==="Files"||At.types.indexOf("Files")>-1){if(yt.preventDefault(),Tr=="stex")return;try{var Ht,or=Ct[1];((Ht=Ct[0])===null||Ht===void 0?void 0:Ht.kind)==="file"&&(or=Ct[0]);var St=or.getAsFile(),jr=St.name.split(".").pop();s(St,function(Dt){if(Dt.id){var sr,er,Sr;(St==null||((sr=St.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(Dt.id,"?type=").concat(Dt.content_type,")")):(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(St==null||((Sr=St.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):te.includes(jr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})}catch(Dt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",dt),at.on("dragleave",function(lt,yt){Fr.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(lt,yt){Fr.current.classList.add("mouse-hover-md")}),at.on("drop",function(lt,yt){Fr.current.classList.add("mouse-hover-md");var At;if(At=yt.dataTransfer.files,At.length>0){yt.preventDefault(),yt.stopPropagation();for(var _t=function(or){var St=At[or],jr=St.name.split(".").pop();s(St,function(Dt){if(Dt.id){var sr,er,Sr;(St==null||((sr=St.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(Dt.id,"?type=").concat(Dt.content_type,")")):(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(St==null||((Sr=St.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):te.includes(jr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})},Ct=0;Ct<At.length;Ct++)_t(Ct)}}),Si(at),function(){at.off("paste",dt)}}},[]);var yr=Object(y.useCallback)(function(){if(Fr.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[On,Fr,Ar]);Object(y.useEffect)(function(){function at(){var lt=new A.default(function(yt){var At=Object(_.a)(yt),_t;try{for(At.s();!(_t=At.n()).done;){var Ct=_t.value;(Ct.target.offsetHeight>0||Ct.target.offsetWidth>0)&&(yr(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(Ht){At.e(Ht)}finally{At.f()}});return lt.observe(Br.current.parentElement),lt}if(Ue){var dt=at();return function(){dt.unobserve(Br.current.parentElement)}}},[Ue,yr]),Object(y.useEffect)(function(){if(Ue){for(var at=[],dt=function(){var Ct=yt[lt];At=Object(G.a)(Ct,2);var Ht=At[0],or=At[1],St=Object(H.a)({},Ht,function(){In(or)});at.push(St),Ue.addKeyMap(St)},lt=0,yt=Object.entries(ie);lt<yt.length;lt++){var At;dt()}return wi.current=setInterval(function(){si.current&&Pn()},4e3),function(){clearInterval(wi.current);var _t=Object(_.a)(at),Ct;try{for(_t.s();!(Ct=_t.n()).done;){var Ht=Ct.value;Ue.removeKeyMap(Ht)}}catch(or){_t.e(or)}finally{_t.f()}}}},[Ue]),Object(y.useEffect)(function(){gt!==Ar&&Dn(gt)},[gt]),Object(ot.a)(function(){if(!Nr&&kr>0){var at=new Date().getTime(),dt=window.sessionStorage.getItem(gr);at>=kr+qe&&(!dt||dt!==ni)&&(window.sessionStorage.setItem(gr,ni),Ci(!0))}},qe),Object(y.useEffect)(function(){Yi(kt)},[Ue,kt]),Object(y.useEffect)(function(){Ue&&(xt&&Ue.focus())},[Ue,xt]),Object(y.useEffect)(function(){if(wr&&Ue){var at=Ue.getScrollerElement();function dt(lt){var yt=lt.target;if(Ai.current){var At=yt.scrollTop/yt.scrollHeight;Ai.current.scrollTop=Ai.current.scrollHeight*At}}return at.addEventListener("scroll",dt),function(){at.removeEventListener("scroll",dt)}}},[Ue,wr]),Object(y.useEffect)(function(){if(Ue&&Lt){function at(dt,lt){Lt(dt,lt)}return Ue.on("beforeChange",at),function(){Ue.off("beforeChange",at)}}},[Ue,Lt]),Object(y.useEffect)(function(){if(Ue&&mt){function at(){mt(Ue.getValue())}return Ue.on("blur",at),function(){Ue.off("blur",at)}}},[Ue,mt]),Object(y.useEffect)(function(){if(Ue){function at(dt){var lt=dt.getValue();Cr(lt),Ji(new Date().getTime()),dt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Be&&Be(lt)}return Ue.on("change",at),function(){Ue.off("change",at)}}},[Ue,Be]),Object(y.useEffect)(function(){Ue&&(Me==null?(Ue.setValue(""),Cr("")):Me!==Ue.getValue()&&(Ue.setValue(Me),Cr(Me),Ue.setCursor(Ue.lineCount(),0)))},[Ue,Me]);var In=Object(y.useCallback)(function(at){var dt=Ue.getCursor(),lt=Ue.getSelection(),yt=lt.split(`
`);switch(at){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(dt.line,dt.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(dt.line,dt.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(dt.line,dt.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(dt.line,dt.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(dt.line+1,lt.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`<br/>
`),Ue.focus();case"list-ul":return lt===""?Ue.replaceSelection("- "+lt):Ue.replaceSelection(yt.map(function(At){return At===""?"":"- ".concat(At)}).join(`
`)),Ue.focus();case"list-ol":return lt===""?Ue.replaceSelection("1. "+lt):Ue.replaceSelection(yt.map(function(At,_t){return At===""?"":"".concat(_t+1,". ").concat(At)}).join(`
`)),Ue.focus();case"add-null-ch":return lt===""&&Ue.setCursor(dt.line,dt.ch+1),Ue.replaceSelection(oe),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(dt.line,dt.ch),Ue.replaceSelection(q),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return Yi(!wr),Ue.focus();case"trigger-full-screen":return Dn(!Ar),Ue.focus();case _e:Kr(_e);return;case He:Kr(He);return;case Pe:Kr(Pe);return;case Ge:Kr(Ge);return;default:throw new Error}},[Ue,wr,Ar]),ki=Object(y.useCallback)(function(at){Kr("");switch(ir){case _e:var dt=at.title,lt=at.link;return Ue.replaceSelection("[".concat(dt,"](").concat(lt,")")),Ue.focus();case He:var yt=at.language,At=at.content;return Ue.replaceSelection(["```"+yt,At,"```"].join(`
`)),Ue.focus();case Pe:var _t=at.src,Ct=at.alt;return Ct?Ue.replaceSelection("![ ".concat(Ct," ]( ").concat(_t,' "').concat(Ct,'" )')):Ue.replaceSelection("![,](".concat(_t,")")),Ue.focus();case Ge:for(var Ht=at.row,or=at.col,St=at.align,jr=`
`,Dt=0;Dt<Ht;Dt++){for(var sr=[],er=[],Sr=0;Sr<or;Sr++)Dt===1&&er.push(ze[St]),sr.push(" ");Dt===1&&(jr+="| ".concat(er.join(" | "),` |
`)),jr+="| ".concat(sr.join(or===1?"":" | "),` |
`)}return Ue.replaceSelection(jr+`
`),Ue.focus();default:throw new Error}},[Ue,ir]),Qi=Object(y.useMemo)(function(){switch(ir){case _e:return T.a.createElement(he,{callback:ki,onCancel:Vr});case He:return T.a.createElement(me.b,{callback:ki,onCancel:Vr});case Pe:return T.a.createElement(ye,{callback:ki,onCancel:Vr});case Ge:return T.a.createElement(Ae,{callback:ki,onCancel:Vr});default:return null}},[ir]);function Vr(){Kr("")}Object(y.useEffect)(function(){if(Ur.current){var at=Ur.current,dt=!1,lt=0;function yt(Ct){dt=!0,lt=Ct.pageY}function At(){dt=!1}function _t(Ct){if(dt){var Ht=Ct.pageY-lt;Ht<0&&(Ht=0),Ht>300&&(Ht=300);var or=nt+Ht+"px";Ti(or)}}return at.addEventListener("mousedown",yt),document.addEventListener("mousemove",_t),document.addEventListener("mouseup",At),function(){at.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",At)}}},[Ue,Ur]),Object(y.useEffect)(function(){Ti(nt)},[nt]);var _r=ee(We),qi=ee(On),Lr={width:_r,height:qi},en=Object(y.useMemo)(function(){if(kr){var at=new Date(kr),dt=at.getHours(),lt=at.getMinutes(),yt=at.getSeconds();return dt=dt<10?"0"+dt:dt,lt=lt<10?"0"+lt:lt,yt=yt<10?"0"+yt:yt,"".concat(dt,":").concat(lt,":").concat(yt)}return 0},[kr]);function Nn(){window.sessionStorage.removeItem(gr),Ci(!1),Ji(0)}function li(){Ci(!1),Ji(0),Ue.setValue(window.sessionStorage.getItem(gr))}function ua(at,dt){var lt=Ue.getValue();lt=lt.replace(at,dt),Cr(lt),Ue==null||Ue.setValue(lt)}return T.a.createElement(y.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Fr},T.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(wr?"on-preview":""," ").concat(Tt?"mini":""," ").concat(Ar?"full-screen":""),style:Lr},T.a.createElement(E,{insertTemp:Et,watch:wr,fullScreen:Ar,showNullButton:Pt,onActionCallback:In,hidetoolBar:wt,uuid:oi.current,setOpenPhones:function(){si.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:Br,placeholder:xi})),wr?T.a.createElement("div",{ref:Ai,className:"preview-container"},Tr==="stex"&&T.a.createElement(k,{value:ni}),Tr!=="stex"&&T.a.createElement(g.a,{edit:!0,value:ni,replaces:ua})):null))),zr?T.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,T.a.createElement(B.a,null,ue[ir]?T.a.createElement(Z.a,{centered:!0,title:ue[ir],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Qi):null))}},SJMd:function(ft,it){/**
* @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 pe,fe,Z,_=!1,Q,U;window.PR_SHOULD_USE_CONTINUATION=!0;var D,G;(function(){var H=window,F=["break,continue,do,else,for,if,return,while"],O=[F,"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"],T=[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"],I=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[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"],A="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",w=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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=[F,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[F,"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"],u=[F,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[T,L,I,w,d,o,l,u],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",k="kwd",x="com",f="typ",p="lit",h="pun",a="pln",b="tag",m="dec",E="src",B="atn",W="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(se){for(var be=0,Ae=!1,Oe=!1,Le=0,_e=se.length;Le<_e;++Le){var Pe=se[Le];if(Pe.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,Oe=!1;break}}var He={b:8,t:9,n:10,v:11,f:12,r:13};function Ge(Je){var Re=Je.charCodeAt(0);if(Re!==92)return Re;var rt=Je.charAt(1);return Re=He[rt],Re||("0"<=rt&&rt<="7"?parseInt(Je.substring(1),8):rt==="u"||rt==="x"?parseInt(Je.substring(2),16):Je.charCodeAt(1))}function Xe(Je){if(Je<32)return(Je<16?"\\x0":"\\x")+Je.toString(16);var Re=String.fromCharCode(Je);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function ze(Je){var Re=Je.substring(1,Je.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")),rt=[],qe=Re[0]==="^",oe=["["];qe&&oe.push("^");for(var q=qe?1:0,ee=Re.length;q<ee;++q){var ne=Re[q];if(/\\[bdsw]/i.test(ne))oe.push(ne);else{var le=Ge(ne),te;q+2<ee&&Re[q+1]==="-"?(te=Ge(Re[q+2]),q+=2):te=le,rt.push([le,te]),te<65||le>122||(te<65||le>90||rt.push([Math.max(65,le)|32,Math.min(te,90)|32]),te<97||le>122||rt.push([Math.max(97,le)&~32,Math.min(te,122)&~32]))}}rt.sort(function(ve,Ee){return ve[0]-Ee[0]||Ee[1]-ve[1]});for(var ie=[],ue=[],q=0;q<rt.length;++q){var de=rt[q];de[0]<=ue[1]+1?ue[1]=Math.max(ue[1],de[1]):ie.push(ue=de)}for(var q=0;q<ie.length;++q){var de=ie[q];oe.push(Xe(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&oe.push("-"),oe.push(Xe(de[1])))}return oe.push("]"),oe.join("")}function ot(Je){for(var Re=Je.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")),rt=Re.length,qe=[],oe=0,q=0;oe<rt;++oe){var ee=Re[oe];if(ee==="(")++q;else if(ee.charAt(0)==="\\"){var ne=+ee.substring(1);ne&&(ne<=q?qe[ne]=-1:Re[oe]=Xe(ne))}}for(var oe=1;oe<qe.length;++oe)qe[oe]===-1&&(qe[oe]=++be);for(var oe=0,q=0;oe<rt;++oe){var ee=Re[oe];if(ee==="(")++q,qe[q]||(Re[oe]="(?:");else if(ee.charAt(0)==="\\"){var ne=+ee.substring(1);ne&&ne<=q&&(Re[oe]="\\"+qe[ne])}}for(var oe=0;oe<rt;++oe)Re[oe]==="^"&&Re[oe+1]!=="^"&&(Re[oe]="");if(Je.ignoreCase&&Ae)for(var oe=0;oe<rt;++oe){var ee=Re[oe],le=ee.charAt(0);ee.length>=2&&le==="["?Re[oe]=ze(ee):le!=="\\"&&(Re[oe]=ee.replace(/[a-zA-Z]/g,function(ue){var de=ue.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return Re.join("")}for(var $e=[],Le=0,_e=se.length;Le<_e;++Le){var Pe=se[Le];if(Pe.global||Pe.multiline)throw new Error(""+Pe);$e.push("(?:"+ot(Pe)+")")}return new RegExp($e.join("|"),Oe?"gi":"g")}function P(se,be){var Ae=/(?:^|\s)nocode(?:\s|$)/,Oe=[],Le=0,_e=[],Pe=0;function He(Ge){var Xe=Ge.nodeType;if(Xe==1){if(Ae.test(Ge.className))return;for(var ze=Ge.firstChild;ze;ze=ze.nextSibling)He(ze);var ot=Ge.nodeName.toLowerCase();(ot==="br"||ot==="li")&&(Oe[Pe]=`
`,_e[Pe<<1]=Le++,_e[Pe++<<1|1]=Ge)}else if(Xe==3||Xe==4){var $e=Ge.nodeValue;$e.length&&(be?$e=$e.replace(/\r\n?/g,`
`):$e=$e.replace(/[ \t\r\n]+/g," "),Oe[Pe]=$e,_e[Pe<<1]=Le,Le+=$e.length,_e[Pe++<<1|1]=Ge)}}return He(se),{sourceCode:Oe.join("").replace(/\n$/,""),spans:_e}}function $(se,be,Ae,Oe,Le){if(!Ae)return;var _e={sourceNode:se,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:be,decorations:null};Oe(_e),Le.push.apply(Le,_e.decorations)}var ae=/\S/;function he(se){for(var be=void 0,Ae=se.firstChild;Ae;Ae=Ae.nextSibling){var Oe=Ae.nodeType;be=Oe===1?be?se:Ae:Oe===3&&ae.test(Ae.nodeValue)?se:be}return be===se?void 0:be}function me(se,be){var Ae={},Oe;(function(){for(var Pe=se.concat(be),He=[],Ge={},Xe=0,ze=Pe.length;Xe<ze;++Xe){var ot=Pe[Xe],$e=ot[3];if($e)for(var Je=$e.length;--Je>=0;)Ae[$e.charAt(Je)]=ot;var Re=ot[1],rt=""+Re;Ge.hasOwnProperty(rt)||(He.push(Re),Ge[rt]=null)}He.push(/[\0-\uffff]/),Oe=M(He)})();var Le=be.length,_e=function(Pe){for(var He=Pe.sourceCode,Ge=Pe.basePos,Xe=Pe.sourceNode,ze=[Ge,a],ot=0,$e=He.match(Oe)||[],Je={},Re=0,rt=$e.length;Re<rt;++Re){var qe=$e[Re],oe=Je[qe],q=void 0,ee;if(typeof oe=="string")ee=!1;else{var ne=Ae[qe.charAt(0)];if(ne)q=qe.match(ne[1]),oe=ne[0];else{for(var le=0;le<Le;++le)if(ne=be[le],q=qe.match(ne[1]),q){oe=ne[0];break}q||(oe=a)}ee=oe.length>=5&&oe.substring(0,5)==="lang-",ee&&!(q&&typeof q[1]=="string")&&(ee=!1,oe=E),ee||(Je[qe]=oe)}var te=ot;if(ot+=qe.length,!ee)ze.push(Ge+te,oe);else{var ie=q[1],ue=qe.indexOf(ie),de=ue+ie.length;q[2]&&(de=qe.length-q[2].length,ue=de-ie.length);var ve=oe.substring(5);$(Xe,Ge+te,qe.substring(0,ue),_e,ze),$(Xe,Ge+te+ue,ie,z(ve,ie),ze),$(Xe,Ge+te+de,qe.substring(de),_e,ze)}}Pe.decorations=ze};return _e}function De(se){var be=[],Ae=[];se.tripleQuotedStrings?be.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):se.multiLineStrings?be.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),se.verbatimStrings&&Ae.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=se.hashComments;Oe&&(se.cStyleComments?(Oe>1?be.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([x,/^#[^\r\n]*/,null,"#"])),se.cStyleComments&&(Ae.push([x,/^\/\/[^\r\n]*/,null]),Ae.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Le=se.regexLiterals;if(Le){var _e=Le>1?"":`
\r`,Pe=_e?".":"[\\S\\s]",He="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+V+"("+He+")")])}var Ge=se.types;Ge&&Ae.push([f,Ge]);var Xe=(""+se.keywords).replace(/^ | $/g,"");Xe.length&&Ae.push([k,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([a,/^\s+/,null,` \r
\xA0`]);var ze="^.[^\\s\\w.$@'\"`/\\\\]*";return se.regexLiterals&&(ze+="(?!s*/)"),Ae.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[h,new RegExp(ze),null]),me(be,Ae)}var xe=De({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ke(se,be,Ae){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,Le=/\r\n?|\n/,_e=se.ownerDocument,Pe=_e.createElement("li");se.firstChild;)Pe.appendChild(se.firstChild);var He=[Pe];function Ge(Re){var rt=Re.nodeType;if(rt==1&&!Oe.test(Re.className))if(Re.nodeName==="br")Xe(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var qe=Re.firstChild;qe;qe=qe.nextSibling)Ge(qe);else if((rt==3||rt==4)&&Ae){var oe=Re.nodeValue,q=oe.match(Le);if(q){var ee=oe.substring(0,q.index);Re.nodeValue=ee;var ne=oe.substring(q.index+q[0].length);if(ne){var le=Re.parentNode;le.insertBefore(_e.createTextNode(ne),Re.nextSibling)}Xe(Re),ee||Re.parentNode.removeChild(Re)}}}function Xe(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function rt(q,ee){var ne=ee?q.cloneNode(!1):q,le=q.parentNode;if(le){var te=rt(le,1),ie=q.nextSibling;te.appendChild(ne);for(var ue=ie;ue;ue=ie)ie=ue.nextSibling,te.appendChild(ue)}return ne}for(var qe=rt(Re.nextSibling,0),oe;(oe=qe.parentNode)&&oe.nodeType===1;)qe=oe;He.push(qe)}for(var ze=0;ze<He.length;++ze)Ge(He[ze]);be===(be|0)&&He[0].setAttribute("value",be);var ot=_e.createElement("ol");ot.className="linenums";for(var $e=Math.max(0,be-1|0)||0,ze=0,Je=He.length;ze<Je;++ze)Pe=He[ze],Pe.className="L"+(ze+$e)%10,Pe.firstChild||Pe.appendChild(_e.createTextNode("\xA0")),ot.appendChild(Pe);se.appendChild(ot)}function Te(se){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var Ae=/\n/g,Oe=se.sourceCode,Le=Oe.length,_e=0,Pe=se.spans,He=Pe.length,Ge=0,Xe=se.decorations,ze=Xe.length,ot=0;Xe[ze]=Le;var $e,Je;for(Je=$e=0;Je<ze;)Xe[Je]!==Xe[Je+2]?(Xe[$e++]=Xe[Je++],Xe[$e++]=Xe[Je++]):Je+=2;for(ze=$e,Je=$e=0;Je<ze;){for(var Re=Xe[Je],rt=Xe[Je+1],qe=Je+2;qe+2<=ze&&Xe[qe+1]===rt;)qe+=2;Xe[$e++]=Re,Xe[$e++]=rt,Je=qe}ze=Xe.length=$e;var oe=se.sourceNode,q="";oe&&(q=oe.style.display,oe.style.display="none");try{for(var ee=null;Ge<He;){var ne=Pe[Ge],le=Pe[Ge+2]||Le,te=Xe[ot+2]||Le,qe=Math.min(le,te),ie=Pe[Ge+1],ue;if(ie.nodeType!==1&&(ue=Oe.substring(_e,qe))){be&&(ue=ue.replace(Ae,"\r")),ie.nodeValue=ue;var de=ie.ownerDocument,ve=de.createElement("span");ve.className=Xe[ot+1];var Ee=ie.parentNode;Ee.replaceChild(ve,ie),ve.appendChild(ie),_e<le&&(Pe[Ge+1]=ie=de.createTextNode(Oe.substring(qe,le)),Ee.insertBefore(ie,ve.nextSibling))}_e=qe,_e>=le&&(Ge+=2),_e>=te&&(ot+=2)}}finally{oe&&(oe.style.display=q)}}var Se={};function ye(se,be){for(var Ae=be.length;--Ae>=0;){var Oe=be[Ae];Se.hasOwnProperty(Oe)?H.console&&console.warn("cannot override language handler %s",Oe):Se[Oe]=se}}function z(se,be){return se&&Se.hasOwnProperty(se)||(se=/^\s*</.test(be)?"default-markup":"default-code"),Se[se]}ye(xe,["default-code"]),ye(me([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ye(me([[a,/^[\s]+/,null,` \r
`],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[B,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ye(me([],[[W,/^[\s\S]+/]]),["uq.val"]),ye(De({keywords:T,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ye(De({keywords:"null,true,false"}),["json"]),ye(De({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ye(De({keywords:I,cStyleComments:!0}),["java"]),ye(De({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(De({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(De({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(De({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(De({keywords:w,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(De({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ye(me([],[[g,/^[\s\S]+/]]),["regex"]);function s(se){var be=se.langExtension;try{var Ae=P(se.sourceNode,se.pre),Oe=Ae.sourceCode;se.sourceCode=Oe,se.spans=Ae.spans,se.basePos=0,z(be,Oe)(se),Te(se)}catch(Le){H.console&&console.log(Le&&Le.stack||Le)}}function c(se,be,Ae){var Oe=Ae||!1,Le=be||null,_e=document.createElement("div");_e.innerHTML="<pre>"+se+"</pre>",_e=_e.firstChild,Oe&&ke(_e,Oe,!0);var Pe={langExtension:Le,numberLines:Oe,sourceNode:_e,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return s(Pe),_e.innerHTML}function R(se,be){var Ae=be||document.body,Oe=Ae.ownerDocument||document;function Le(ne){return Ae.getElementsByTagName(ne)}for(var _e=[Le("pre"),Le("code"),Le("xmp")],Pe=[],He=0;He<_e.length;++He)for(var Ge=0,Xe=_e[He].length;Ge<Xe;++Ge)Pe.push(_e[He][Ge]);_e=null;var ze=Date;ze.now||(ze={now:function(){return+new Date}});var ot=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,Je=/\bprettyprint\b/,Re=/\bprettyprinted\b/,rt=/pre|xmp/i,qe=/^code$/i,oe=/^(?:pre|code|xmp)$/i,q={};function ee(){for(var ne=H.PR_SHOULD_USE_CONTINUATION?ze.now()+250:Infinity;ot<Pe.length&&ze.now()<ne;ot++){for(var le=Pe[ot],te=q,ie=le;ie=ie.previousSibling;){var ue=ie.nodeType,de=(ue===7||ue===8)&&ie.nodeValue;if(de?!/^\??prettify\b/.test(de):ue!==3||/\S/.test(ie.nodeValue))break;if(de){te={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(kt,Et,qt){te[Et]=qt});break}}var ve=le.className;if((te!==q||Je.test(ve))&&!Re.test(ve)){for(var Ee=!1,Me=le.parentNode;Me;Me=Me.parentNode){var Be=Me.tagName;if(oe.test(Be)&&Me.className&&Je.test(Me.className)){Ee=!0;break}}if(!Ee){le.className+=" prettyprinted";var Ye=te.lang;if(!Ye){Ye=ve.match($e);var We;!Ye&&(We=he(le))&&qe.test(We.tagName)&&(Ye=We.className.match($e)),Ye&&(Ye=Ye[1])}var pt;if(rt.test(le.tagName))pt=1;else{var nt=le.currentStyle,tt=Oe.defaultView,Tt=nt?nt.whiteSpace:tt&&tt.getComputedStyle?tt.getComputedStyle(le,null).getPropertyValue("white-space"):0;pt=Tt&&Tt.substring(0,3)==="pre"}var bt=te.linenums;(bt=bt==="true"||+bt)||(bt=ve.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&ke(le,bt,pt);var xt={langExtension:Ye,sourceNode:le,numberLines:bt,pre:pt,sourceCode:null,basePos:null,spans:null,decorations:null};s(xt)}}}ot<Pe.length?H.setTimeout(ee,250):typeof se=="function"&&se()}ee()}var Y=H.PR={createSimpleLexer:me,registerLangHandler:ye,sourceDecorator:De,PR_ATTRIB_NAME:B,PR_ATTRIB_VALUE:W,PR_COMMENT:x,PR_DECLARATION:m,PR_KEYWORD:k,PR_LITERAL:p,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:h,PR_SOURCE:E,PR_STRING:g,PR_TAG:b,PR_TYPE:f,prettyPrintOne:_?H.prettyPrintOne=c:D=c,prettyPrint:G=_?H.prettyPrint=R:G=R},N=H.define;typeof N=="function"&&N.amd&&N("google-code-prettify",[],function(){return Y})})()},STEk:function(ft,it,pe){"use strict";pe.d(it,"a",function(){return ye});/*! *****************************************************************************
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 fe=function(z,s){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,R){c.__proto__=R}||function(c,R){for(var Y in R)Object.prototype.hasOwnProperty.call(R,Y)&&(c[Y]=R[Y])})(z,s)};function Z(z,s){function c(){this.constructor=z}fe(z,s),z.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function _(z,s,c,R){return new(c||(c=Promise))(function(Y,N){function se(Oe){try{Ae(R.next(Oe))}catch(Le){N(Le)}}function be(Oe){try{Ae(R.throw(Oe))}catch(Le){N(Le)}}function Ae(Oe){var Le;Oe.done?Y(Oe.value):(Le=Oe.value,Le instanceof c?Le:new c(function(_e){_e(Le)})).then(se,be)}Ae((R=R.apply(z,s||[])).next())})}function Q(z,s){var c,R,Y,N,se={label:0,sent:function(){if(1&Y[0])throw Y[1];return Y[1]},trys:[],ops:[]};return N={next:be(0),throw:be(1),return:be(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function be(Ae){return function(Oe){return function(Le){if(c)throw new TypeError("Generator is already executing.");for(;se;)try{if(c=1,R&&(Y=2&Le[0]?R.return:Le[0]?R.throw||((Y=R.return)&&Y.call(R),0):R.next)&&!(Y=Y.call(R,Le[1])).done)return Y;switch(R=0,Y&&(Le=[2&Le[0],Y.value]),Le[0]){case 0:case 1:Y=Le;break;case 4:return se.label++,{value:Le[1],done:!1};case 5:se.label++,R=Le[1],Le=[0];continue;case 7:Le=se.ops.pop(),se.trys.pop();continue;default:if(!(Y=se.trys,(Y=Y.length>0&&Y[Y.length-1])||Le[0]!==6&&Le[0]!==2)){se=0;continue}if(Le[0]===3&&(!Y||Le[1]>Y[0]&&Le[1]<Y[3])){se.label=Le[1];break}if(Le[0]===6&&se.label<Y[1]){se.label=Y[1],Y=Le;break}if(Y&&se.label<Y[2]){se.label=Y[2],se.ops.push(Le);break}Y[2]&&se.ops.pop(),se.trys.pop();continue}Le=s.call(z,se)}catch(_e){Le=[6,_e],R=0}finally{c=Y=0}if(5&Le[0])throw Le[1];return{value:Le[0]?Le[1]:void 0,done:!0}}([Ae,Oe])}}}function U(){for(var z=0,s=0,c=arguments.length;s<c;s++)z+=arguments[s].length;var R=Array(z),Y=0;for(s=0;s<c;s++)for(var N=arguments[s],se=0,be=N.length;se<be;se++,Y++)R[Y]=N[se];return R}var D=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,c){for(var R=0,Y=c;R<Y.length;R++){var N=Y[R],se=N[0],be=N[1];s.setAttribute(se,be)}},z.createRect=function(s,c,R){var Y=document.createElementNS("http://www.w3.org/2000/svg","rect");return Y.setAttribute("width",s.toString()),Y.setAttribute("height",c.toString()),R&&z.setAttributes(Y,R),Y},z.createLine=function(s,c,R,Y,N){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",s.toString()),se.setAttribute("y1",c.toString()),se.setAttribute("x2",R.toString()),se.setAttribute("y2",Y.toString()),N&&z.setAttributes(se,N),se},z.createPolygon=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",s),c&&z.setAttributes(R,c),R},z.createCircle=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(s/2).toString()),R.setAttribute("cy",(s/2).toString()),R.setAttribute("r",s.toString()),c&&z.setAttributes(R,c),R},z.createEllipse=function(s,c,R){var Y=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Y.setAttribute("cx",(s/2).toString()),Y.setAttribute("cy",(c/2).toString()),Y.setAttribute("rx",(s/2).toString()),Y.setAttribute("ry",(c/2).toString()),R&&z.setAttributes(Y,R),Y},z.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(c,s),c},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,c,R,Y,N,se,be){var Ae=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Ae,[["id",s],["orient",c],["markerWidth",R.toString()],["markerHeight",Y.toString()],["refX",N.toString()],["refY",se.toString()]]),Ae.appendChild(be),Ae},z.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&z.setAttributes(c,s),c},z.createTSpan=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=s,c&&z.setAttributes(R,c),R},z.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(c,s),c},z.createPoint=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=s,R.y=c,R},z.createPath=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",s),c&&z.setAttributes(R,c),R},z}(),G=function(){function z(){}return z.addKey=function(s){z.key=s},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}(),H=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,c,R){var Y=this;return new Promise(function(N){var se=R!==void 0?R:document.createElement("canvas");s===null&&(Y.markersOnly=!0,Y.naturalSize=!1);var be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("width",c.width.baseVal.valueAsString),be.setAttribute("height",c.height.baseVal.valueAsString),be.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),be.innerHTML=c.innerHTML,Y.naturalSize===!0?(be.width.baseVal.value=s.naturalWidth,be.height.baseVal.value=s.naturalHeight):Y.width!==void 0&&Y.height!==void 0&&(be.width.baseVal.value=Y.width,be.height.baseVal.value=Y.height),se.width=be.width.baseVal.value,se.height=be.height.baseVal.value;var Ae=be.outerHTML,Oe=se.getContext("2d");Y.markersOnly!==!0&&Oe.drawImage(s,0,0,se.width,se.height);var Le=window.URL,_e=new Image(se.width,se.height);_e.setAttribute("crossOrigin","anonymous");var Pe=new Blob([Ae],{type:"image/svg+xml"}),He=Le.createObjectURL(Pe);_e.onload=function(){Oe.drawImage(_e,0,0),Le.revokeObjectURL(He);var Ge=se.toDataURL(Y.imageType,Y.imageQuality);N(Ge)},_e.src=He})},z}(),F=function(){},O=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}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(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new y("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new T("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new T("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),y=function(z,s){this.selector=z,this.style=s},T=function(z,s){this.localName=z,this.style=s},I=function(){function z(s,c,R,Y,N){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=c,this.markerItems=R,this.uiStyleSettings=Y,this.styles=N,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(s){var c=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var R=document.createElement("div");R.className=this.toolbarBlockStyleClass.name,R.style.whiteSpace="nowrap",this.uiContainer.appendChild(R),this.addActionButton(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(N){var se=document.createElement("div");se.className=""+c.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",N.typeName),se.innerHTML=N.icon,se.addEventListener("click",function(){c.markerToolbarButtonClicked(se,N)}),c.buttons.push(se),c.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 Y=document.createElement("div");Y.className=this.toolbarBlockStyleClass.name,Y.style.whiteSpace="nowrap",Y.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Y),this.addActionButton(Y,'<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(Y,'<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(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c<this.markerButtons.length;c++)c<s||c===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},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 s=this;this.buttons.forEach(function(c){c.className=c.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,c,R){var Y=this,N=document.createElement("div");switch(N.className=""+this.toolbarButtonStyleClass.name,N.innerHTML=c,N.setAttribute("data-action",R),N.addEventListener("click",function(){Y.actionToolbarButtonClicked(N,R)}),R){case"select":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":N.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":N.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":N.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(N),this.buttons.push(N)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new T("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 T("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new T("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new T("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 T("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new T("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new T("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,c){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(R){return R.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},z.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(R){return/delete|notes/.test(R.getAttribute("data-action"))}).forEach(function(R){c.currentMarker===void 0?(R.style.fillOpacity="0.4",R.style.pointerEvents="none"):(R.style.fillOpacity="1",R.style.pointerEvents="all")})},z}(),L=function(){function z(s,c,R,Y){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=R,this.styles=Y,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new T("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 T("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new T("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new T("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new T("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 T("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new T("toolbox_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.toolboxButtonStyleColorsClass=this.styles.addClass(new T("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var c,R,Y=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(N){var se;N.uiStyleSettings=Y.uiStyleSettings;var be=document.createElement("div");be.className=Y.toolboxButtonStyleClass.name+" "+((se=Y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:Y.toolboxButtonStyleColorsClass.name),be.innerHTML=N.icon,be.title=N.title,be.addEventListener("click",function(){Y.panelButtonClick(N)}),Y.panelButtons.push(be),Y.buttonRow.appendChild(be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var c=this,R=-1;if(s!==this.activePanel){R=this.panels.indexOf(s),this.panelRow.innerHTML="";var Y=s.getUi();Y.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Y),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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(N,se){var be,Ae;N.className=c.toolboxButtonStyleClass.name+" "+(se===R?""+((be=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&be!==void 0?be:c.toolboxActiveButtonStyleColorsClass.name):""+((Ae=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ae!==void 0?Ae:c.toolboxButtonStyleColorsClass.name))})},z}(),A=function(z,s){this.title=z,this.icon=s},w=function(z){function s(c,R,Y,N){var se=z.call(this,c,N||'<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=R,se.currentColor=Y,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.whiteSpace="nowrap",this.colors.forEach(function(Y){var N=c.getColorBox(Y);R.appendChild(N),c.colorBoxes.push(N)}),R},s.prototype.getColorBox=function(c){var R=this,Y=this.uiStyleSettings.toolbarHeight/4,N=this.uiStyleSettings.toolbarHeight-Y,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=N-2+"px",se.style.height=N-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=(N+2)/2+"px",se.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){R.setCurrentColor(c,se)});var be=document.createElement("div");return be.style.display="inline-block",be.style.width=N-2+"px",be.style.height=N-2+"px",be.style.backgroundColor=c,be.style.borderRadius=N/2+"px",c==="transparent"&&(be.style.fill=this.uiStyleSettings.toolboxAccentColor,be.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(be),se},s.prototype.setCurrentColor=function(c,R){var Y=this;this.currentColor=c,this.colorBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(A),d=function(){function z(s,c,R){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=R,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(s){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(s,c){},z.prototype.dblClick=function(s,c){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,c){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),o=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),l=function(){function z(){this.GRIP_SIZE=10,this.visual=D.createGroup(),this.visual.appendChild(D.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(D.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),u=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},z}(),C=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.left=0,N.top=0,N.width=0,N.height=0,N.defaultSize={x:50,y:20},N.offsetX=0,N.offsetY=0,N.rotationAngle=0,N.CB_DISTANCE=10,N._suppressMarkerCreateEvent=!1,N.container.transform.baseVal.appendItem(D.createTransform()),N.setupControlBox(),N}return Z(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var R=D.createTransform();this._visual.transform.baseVal.appendItem(R)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!z.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Y=this.unrotatePoint(c);if(this.manipulationStartX=Y.x,this.manipulationStartY=Y.y,this.offsetX=Y.x-this.left,this.offsetY=Y.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(R),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R)){this.activeGrip=this.rotatorGrip;var N=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=N.x-this.width/2,this.top=N.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"},s.prototype.pointerUp=function(c){var R=this.state;z.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",R==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var R=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(R.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(R.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(R):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var R=this.manipulationStartLeft,Y=this.manipulationStartWidth,N=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:R=this.manipulationStartLeft+c.x-this.manipulationStartX,Y=this.manipulationStartWidth+this.manipulationStartLeft-R;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Y=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:N=this.manipulationStartTop+c.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-N;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+c.y-this.manipulationStartY}Y>=0?(this.left=R,this.width=Y):(this.left=R+Y,this.width=-Y),se>=0?(this.top=N,this.height=se):(this.top=N+se,this.height=-se),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var R=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*R,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var R=this.container.getCTM(),Y=D.createPoint(c.x,c.y);return{x:(Y=Y.matrixTransform(R)).x,y:Y.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var R=this.container.getCTM();R=R.inverse();var Y=D.createPoint(c.x,c.y);return{x:(Y=Y.matrixTransform(R)).x,y:Y.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.createGroup();var c=D.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=D.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=D.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 o,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,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()},s.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()},s.prototype.createGrip=function(){var c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,R=-c/2,Y=R,N=(this.width+this.CB_DISTANCE)/2-c/2,se=(this.height+this.CB_DISTANCE)/2-c/2,be=this.height+this.CB_DISTANCE-c/2,Ae=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,R,Y),this.positionGrip(this.controlGrips.topCenter.visual,N,Y),this.positionGrip(this.controlGrips.topRight.visual,Ae,Y),this.positionGrip(this.controlGrips.centerLeft.visual,R,se),this.positionGrip(this.controlGrips.centerRight.visual,Ae,se),this.positionGrip(this.controlGrips.bottomLeft.visual,R,be),this.positionGrip(this.controlGrips.bottomCenter.visual,N,be),this.positionGrip(this.controlGrips.bottomRight.visual,Ae,be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,N,Y-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,R,Y){var N=c.transform.baseVal.getItem(0);N.setTranslate(R,Y),c.transform.baseVal.replaceItem(N,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:u.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:u.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var R=c;this.left=R.left,this.top=R.top,this.width=R.width,this.height=R.height,this.rotationAngle=R.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,R.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,R.containerTransformMatrix))},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R);var Y=this.rotatePoint({x:this.left,y:this.top}),N=this.unrotatePoint({x:Y.x*c,y:Y.y*R});this.left=N.x,this.top=N.y,this.width=this.width*c,this.height=this.height*R,this.adjustControlBox()},s}(d),v=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.createVisual=N.createVisual.bind(N),N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.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)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){z.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.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))},s.prototype.restoreState=function(c){var R=c;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.setSize()},s.title="Rectangle marker",s}(C),g=function(z){function s(c,R,Y,N){var se=z.call(this,c,N||'<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=R,se.currentWidth=Y,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.widths.forEach(function(Y){var N=document.createElement("div");N.style.display="flex",N.style.flexGrow="2",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=Y===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentWidth(Y,N)}),R.appendChild(N);var se=document.createElement("div");se.innerText=Y.toString(),se.style.marginRight="5px",N.appendChild(se);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.display="flex",be.style.alignItems="center";var Ae=document.createElement("hr");Ae.style.minWidth="20px",Ae.style.border="0px",Ae.style.borderTop=Y+"px solid "+c.uiStyleSettings.toolboxColor,Ae.style.flexGrow="2",be.appendChild(Ae),N.appendChild(be),c.widthBoxes.push(N)}),R},s.prototype.setCurrentWidth=function(c,R){var Y=this;this.currentWidth=c,this.widthBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(A),k=function(z){function s(c,R,Y,N){var se=z.call(this,c,N||'<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=R,se.currentStyle=Y,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.styles.forEach(function(Y){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/c.styles.length-5+"%",N.style.borderColor=Y===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentStyle(Y,N)}),R.appendChild(N);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var be=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Y!==""?'stroke-dasharray="'+Y+'"':"")+` />
</svg>`;se.innerHTML=be,N.appendChild(se),c.styleBoxes.push(N)}),R},s.prototype.setCurrentStyle=function(c,R){var Y=this;this.currentStyle=c,this.styleBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(A),x=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.strokeColor=Y.defaultColor,N.strokeWidth=Y.defaultStrokeWidth,N.strokeDasharray=Y.defaultStrokeDasharray,N.strokePanel=new w("Line color",Y.defaultColorSet,Y.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new g("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(v),f=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},p=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.x1=0,N.y1=0,N.x2=0,N.y2=0,N.defaultLength=50,N.manipulationStartX=0,N.manipulationStartY=0,N.manipulationStartX1=0,N.manipulationStartY1=0,N.manipulationStartX2=0,N.manipulationStartY2=0,N.setupControlBox(),N}return Z(s,z),s.prototype.ownsTarget=function(c){return!!z.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.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(R)?this.activeGrip=this.grip1:this.grip2.ownsTarget(R)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var R=this.state;z.prototype.pointerUp.call(this,c),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(c),this._state="select",R==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,R,Y){var N=c.transform.baseVal.getItem(0);N.setTranslate(R,Y),c.transform.baseVal.replaceItem(N,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var R=c;this.x1=R.x1,this.y1=R.y1,this.x2=R.x2,this.y2=R.y2},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.x1=this.x1*c,this.y1=this.y1*R,this.x2=this.x2*c,this.y2=this.y2*R,this.adjustVisual(),this.adjustControlBox()},s}(d),h=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.strokeColor=Y.defaultColor,N.strokeWidth=Y.defaultStrokeWidth,N.strokeDasharray=Y.defaultStrokeDasharray,N.strokePanel=new w("Line color",Y.defaultColorSet,Y.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new g("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.selectorLine=D.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=D.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)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()),D.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var R=c;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(p),a=function(z){function s(c,R,Y,N){var se=z.call(this,c,N||'<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=R,se.currentFont=Y,se.setCurrentFont=se.setCurrentFont.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.flexGrow="2",this.fonts.forEach(function(Y){var N=document.createElement("div");N.style.display="inline-block",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/c.fonts.length-5+"%",N.style.borderColor=Y===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentFont(Y,N)}),R.appendChild(N);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=Y,se.style.overflow="hidden";var be=document.createElement("div");be.style.whiteSpace="nowrap",be.style.overflow="hidden",be.style.textOverflow="ellipsis",be.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(be),N.appendChild(se),c.fontBoxes.push(N)}),R},s.prototype.setCurrentFont=function(c,R){var Y=this;this.currentFont=c,this.fontBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(A),b=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.color="transparent",N.padding=5,N.DEFAULT_TEXT="your text here",N.text=N.DEFAULT_TEXT,N.isMoved=!1,N.color=Y.defaultColor,N.fontFamily=Y.defaultFontFamily,N.defaultSize={x:100,y:30},N.setColor=N.setColor.bind(N),N.setFont=N.setFont.bind(N),N.renderText=N.renderText.bind(N),N.sizeText=N.sizeText.bind(N),N.textEditDivClicked=N.textEditDivClicked.bind(N),N.showTextEditor=N.showTextEditor.bind(N),N.setSize=N.setSize.bind(N),N.positionTextEditor=N.positionTextEditor.bind(N),N.colorPanel=new w("Color",Y.defaultColorSet,Y.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.fontFamilyPanel=new a("Font",Y.defaultFontFamilies,Y.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N}return Z(s,z),s.prototype.ownsTarget=function(c){if(z.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var R=!1;return this.textElement.childNodes.forEach(function(Y){Y===c&&(R=!0)}),R},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.bgRectangle=D.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=D.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=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(R){c.textElement.appendChild(D.createTSpan(R.trim()===""?" ":R.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),R=1;if(c.width>0&&c.height>0){var Y=(1*this.width-this.width*this.padding*2/100)/c.width,N=(1*this.height-this.height*this.padding*2/100)/c.height;R=Math.min(Y,N)}return R},s.prototype.getTextPosition=function(c){var R=this.textElement.getBBox(),Y=0,N=0;return R.width>0&&R.height>0&&(Y=(this.width-R.width*c)/2,N=this.height/2-R.height*c/2),{x:Y,y:N}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),R=this.getTextScale(),Y=this.getTextPosition(R);Y.y-=c.y*R,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Y.x+"px, "+Y.y+"px) scale("+R+", "+R+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Y.x,Y.y),this.textElement.transform.baseVal.getItem(1).setScale(R,R))},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var R=this.state;R==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,c),this.setSize(),(R==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=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(R){R.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var R=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&R>.9;)R-=.1,c.textEditor.style.fontSize=Math.max(R,.9)+"em"}),this.textEditor.addEventListener("keyup",function(R){R.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(R){if(R.clipboardData){var Y=R.clipboardData.getData("text"),N=window.getSelection();if(!N.rangeCount)return!1;N.deleteFromDocument(),N.getRangeAt(0).insertNode(document.createTextNode(Y)),R.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),R=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Y=this.textElement.getBBox(),N={x:Y.width*c,y:Y.height*c};R.x-=N.x/2,R.y-=N.y/2,this.textEditor.style.top=R.y+"px",this.textEditor.style.left=R.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-R.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(c,R){z.prototype.dblClick.call(this,c,R),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&D.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&D.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.color=R.color,this.fontFamily=R.fontFamily,this.padding=R.padding,this.text=R.text,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(C),m=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.color="transparent",N.lineWidth=3,N.drawing=!1,N.pixelRatio=1,N.color=Y.defaultColor,N.lineWidth=Y.defaultStrokeWidth,N.pixelRatio=Y.freehandPixelRatio,N.setColor=N.setColor.bind(N),N.addCanvas=N.addCanvas.bind(N),N.finishCreation=N.finishCreation.bind(N),N.setLineWidth=N.setLineWidth.bind(N),N.colorPanel=new w("Color",Y.defaultColorSet,Y.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.lineWidthPanel=new g("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),N.lineWidthPanel.onWidthChanged=N.setLineWidth,N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.drawingImage=D.createImage(),this.visual.appendChild(this.drawingImage);var c=D.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,R){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(c.x,c.y),this.drawing=!0):z.prototype.pointerDown.call(this,c,R)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,c)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),R=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Y=R[0],N=R[1],se=R[2],be=R[3],Ae=!1,Oe=0;Oe<this.canvasElement.height;Oe++)for(var Le=0;Le<this.canvasElement.width;Le++)c.data[Oe*this.canvasElement.width*4+4*Le+3]>0&&(Ae=!0,Oe<N&&(N=Oe),Le<Y&&(Y=Le),Oe>be&&(be=Oe),Le>se&&(se=Le));if(Ae){this.left=Y/this.pixelRatio,this.top=N/this.pixelRatio,this.width=(se-Y)/this.pixelRatio,this.height=(be-N)/this.pixelRatio;var _e=document.createElement("canvas");_e.width=se-Y,_e.height=be-N,_e.getContext("2d").putImageData(this.canvasContext.getImageData(Y,N,se-Y,be-N),0,0),this.drawingImgUrl=_e.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),z.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(C),E=function(z){function s(c,R,Y){var N=z.call(this,c,Y||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return N.typeBoxes=[],N.currentType=R,N.setCurrentType=N.setCurrentType.bind(N),N}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2";for(var Y=function(be){var Ae="both";switch(be){case 0:Ae="both";break;case 1:Ae="start";break;case 2:Ae="end";break;case 3:Ae="none"}var Oe=document.createElement("div");if(Oe.style.display="flex",Oe.style.flexGrow="2",Oe.style.alignItems="center",Oe.style.justifyContent="space-between",Oe.style.padding="5px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderColor=Ae===N.currentType?N.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){c.setCurrentType(Ae,Oe)}),R.appendChild(Oe),Ae==="both"||Ae==="start"){var Le=document.createElement("div");Le.style.display="flex",Le.style.alignItems="center",Le.style.minHeight="20px",Le.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Le.style.marginLeft="5px",Oe.appendChild(Le)}var _e=document.createElement("div");_e.style.display="flex",_e.style.alignItems="center",_e.style.minHeight="20px",_e.style.flexGrow="2";var Pe=document.createElement("hr");if(Pe.style.minWidth="20px",Pe.style.border="0px",Pe.style.borderTop="3px solid "+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee"),Pe.style.flexGrow="2",_e.appendChild(Pe),Oe.appendChild(_e),Ae==="both"||Ae==="end"){var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,He.style.marginRight="5px",Oe.appendChild(He)}N.typeBoxes.push(Oe)},N=this,se=0;se<4;se++)Y(se);return R},s.prototype.setCurrentType=function(c,R){var Y=this;this.currentType=c,this.typeBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings!==void 0?Y.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(A),B=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.arrowType="end",N.arrowBaseHeight=10,N.arrowBaseWidth=10,N.getArrowPoints=N.getArrowPoints.bind(N),N.setArrowType=N.setArrowType.bind(N),N.arrowTypePanel=new E("Arrow type","end"),N.arrowTypePanel.onArrowTypeChanged=N.setArrowType,N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,R){var Y=this.arrowBaseWidth+2*this.strokeWidth,N=this.arrowBaseHeight+2*this.strokeWidth;return c-Y/2+","+(R+N/2)+" "+c+","+(R-N/2)+" "+(c+Y/2)+","+(R+N/2)},s.prototype.createTips=function(){this.arrow1=D.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=D.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="creating"&&this.createTips()},s.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",D.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),D.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.arrow1.transform.baseVal.getItem(0);R.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(R,0);var Y=this.arrow2.transform.baseVal.getItem(0);Y.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Y,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var R=c;this.arrowType=R.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(h),W=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.fillColor=Y.defaultFillColor,N.strokeWidth=0,N.fillPanel=new w("Color",Y.defaultColorSet,Y.defaultFillColor),N.fillPanel.onColorChanged=N.setFillColor,N}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(v),K=function(z){function s(c,R,Y,N){var se=z.call(this,c,N||'<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=R,se.currentOpacity=Y,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",R.style.justifyContent="space-between",this.opacities.forEach(function(Y){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="center",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=Y===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentOpacity(Y,N)}),R.appendChild(N);var se=document.createElement("div");se.innerText=100*Y+"%",N.appendChild(se),c.opacityBoxes.push(N)}),R},s.prototype.setCurrentOpacity=function(c,R){var Y=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(N){N.style.borderColor=N===R?Y.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(A),V=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.setOpacity=N.setOpacity.bind(N),N.fillColor=Y.defaultHighlightColor,N.strokeWidth=0,N.opacity=Y.defaultHighlightOpacity,N.fillPanel=new w("Color",Y.defaultColorSet,N.fillColor),N.fillPanel.onColorChanged=N.setFillColor,N.opacityPanel=new K("Opacity",Y.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Z(s,z),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(W),M='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',P=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.bgColor="transparent",N.tipPosition={x:0,y:0},N.tipBase1Position={x:0,y:0},N.tipBase2Position={x:0,y:0},N.tipMoving=!1,N.color=Y.defaultStrokeColor,N.bgColor=Y.defaultFillColor,N.fontFamily=Y.defaultFontFamily,N.defaultSize={x:100,y:30},N.setBgColor=N.setBgColor.bind(N),N.getTipPoints=N.getTipPoints.bind(N),N.positionTip=N.positionTip.bind(N),N.setTipPoints=N.setTipPoints.bind(N),N.colorPanel=new w("Text color",Y.defaultColorSet,N.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>'),N.colorPanel.onColorChanged=N.setColor,N.bgColorPanel=new w("Fill color",Y.defaultColorSet,N.bgColor,M),N.bgColorPanel.onColorChanged=N.setBgColor,N.fontFamilyPanel=new a("Font",Y.defaultFontFamilies,Y.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N.tipGrip=new l,N.tipGrip.visual.transform.baseVal.appendItem(D.createTransform()),N.controlBox.appendChild(N.tipGrip.visual),N}return Z(s,z),s.prototype.ownsTarget=function(c){return z.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){D.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=D.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,R){this.state==="new"&&z.prototype.pointerDown.call(this,c,R),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(R)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,c,R)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,c);else{var R=this.state==="creating";z.prototype.pointerUp.call(this,c),this.setTipPoints(R),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var R=this.unrotatePoint(c);this.tipPosition={x:R.x-this.manipulationStartLeft,y:R.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(D.setAttributes(this.bgRectangle,[["fill",c]]),D.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},s.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},s.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var R=Math.min(this.height/2,15),Y=this.height/5;c&&(this.tipPosition={x:R+Y/2,y:this.height+20});var N=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Y=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:0},this.tipBase2Position={x:R+Y,y:0}):(this.tipBase1Position={x:0,y:R},this.tipBase2Position={x:0,y:R+Y}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Y=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Y,y:0},this.tipBase2Position={x:this.width-R,y:0}):(this.tipBase1Position={x:this.width,y:R},this.tipBase2Position={x:this.width,y:R+Y}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?N<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Y=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Y,y:this.height},this.tipBase2Position={x:this.width-R,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-R-Y},this.tipBase2Position={x:this.width,y:this.height-R}):N<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Y=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:this.height},this.tipBase2Position={x:R+Y,y:this.height}):(this.tipBase1Position={x:0,y:this.height-R},this.tipBase2Position={x:0,y:this.height-R-Y})},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.positionTip()},s.prototype.positionTip=function(){D.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.bgColor=R.bgColor,this.tipPosition=R.tipPosition,z.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*R},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(b),$=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.strokeColor=Y.defaultColor,N.strokeWidth=Y.defaultStrokeWidth,N.strokeDasharray=Y.defaultStrokeDasharray,N.fillColor=Y.defaultFillColor,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.setOpacity=N.setOpacity.bind(N),N.createVisual=N.createVisual.bind(N),N.strokePanel=new w("Line color",U(Y.defaultColorSet,["transparent"]),Y.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.fillPanel=new w("Fill color",U(Y.defaultColorSet,["transparent"]),N.fillColor,M),N.fillPanel.onColorChanged=N.setFillColor,N.strokeWidthPanel=new g("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N.opacityPanel=new K("Opacity",Y.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.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)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),D.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(c){z.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){z.prototype.scale.call(this,c,R),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(C),ae=function(z){function s(c,R,Y){return z.call(this,c,R,Y)||this}return Z(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=D.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(D.createTransform()),this.visual.appendChild(this.tip1),this.tip2=D.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(D.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(D.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()]]),D.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.tip1.transform.baseVal.getItem(0);R.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(R,0);var Y=this.tip2.transform.baseVal.getItem(0);Y.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Y,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(h),he=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.strokePanel.colors=Y.defaultColorSet,N.fillColor="transparent",N}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}($),me=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(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},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 s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),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}(),De=function(z){function s(c,R,Y){var N=z.call(this,c,R,Y)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.curveX=0,N.curveY=0,N.manipulationStartCurveX=0,N.manipulationStartCurveY=0,N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.positionGrips=N.positionGrips.bind(N),N.addControlGrips=N.addControlGrips.bind(N),N.adjustVisual=N.adjustVisual.bind(N),N.setupControlBox=N.setupControlBox.bind(N),N.resize=N.resize.bind(N),N.strokeColor=Y.defaultColor,N.strokeWidth=Y.defaultStrokeWidth,N.strokeDasharray=Y.defaultStrokeDasharray,N.strokePanel=new w("Line color",Y.defaultColorSet,Y.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new g("Line width",Y.defaultStrokeWidths,Y.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",Y.defaultStrokeDasharrays,Y.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.selectorCurve=D.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=D.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)},s.prototype.pointerDown=function(c,R){z.prototype.pointerDown.call(this,c,R),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(R)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),D.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=D.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=D.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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()))},s.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),z.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,R){this.curveX=this.curveX*c,this.curveY=this.curveY*R,z.prototype.scale.call(this,c,R)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var R=c;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.curveX=R.curveX,this.curveY=R.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(p),xe=function(){function z(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),ke=function(z){function s(c,R,Y){var N=z.call(this,c,!1)||this;return N.dataUrl=R,N.state=Y,N}return Z(s,z),s}(xe),Te=function(z){function s(c,R,Y){Y===void 0&&(Y=!1);var N=z.call(this,c,Y)||this;return N.marker=R,N}return Z(s,z),s}(xe),Se=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(s,c){this[s].push(c)},z.prototype.removeEventListener=function(s,c){var R=this[s].indexOf(c);R>-1&&this[s].splice(R,1)},z}(),ye=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new f,this._isOpen=!1,this.undoRedoManager=new me,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 Se,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new O(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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[x,m,B,b,he,$,V,P,ae,W,h,De]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[x,m,B,b,$,V,P]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[x,m,B,b,V]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(R){if(typeof R=="string"){var Y=c.ALL_MARKER_TYPES.find(function(N){return N.typeName===R});Y!==void 0&&c._availableMarkerTypes.push(Y)}else c._availableMarkerTypes.push(R)})},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(s){this._zoomLevel=s,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(),G.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&F.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=F.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new xe(s))})},z.prototype.render=function(){return _(this,void 0,void 0,function(){var s;return Q(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new H).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},z.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var R=!1;s||this.eventListeners.beforeclose.forEach(function(Y){var N=new xe(c,!0);Y(N),N.defaultPrevented&&(R=!0)}),R||(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(Y){return Y(new xe(c))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,c=[],R=0;R<arguments.length;R++)c[R]=arguments[R];(s=this._availableMarkerTypes).push.apply(s,c)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(c){s(c.dataUrl,c.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,R=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(c,R)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,c){this._isResizing=!0;var R=s/this.imageWidth,Y=c/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),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(R,Y),this._isResizing=!1},z.prototype.scaleMarkers=function(s,c){var R,Y=this;this._currentMarker&&this._currentMarker instanceof b?this._currentMarker.scale(s,c):(R=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(N){N!==Y._currentMarker&&N.scale(s,c)}),R!==void 0&&this.setCurrentMarker(R)},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 s=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left,this.top=s.top-c.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 s,c=[],R=0;R<arguments.length;R++)c[R]=arguments[R];this.defs=D.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,c)},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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 I(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 L(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(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.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(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){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 s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Y){var N=new Te(s,s._currentMarker,!0);Y(N),N.defaultPrevented&&(c=!0)}),!c){var R=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(Y){return Y(new Te(s,R))})}}},z.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var be=new Te(s,void 0,!0);se(be),be.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var R=function(se){var be=Y.markers[se];Y.setCurrentMarker(Y.markers[se]),Y._currentMarker.dispose(),Y.markerImage.removeChild(Y._currentMarker.container),Y.markers.splice(Y.markers.indexOf(Y._currentMarker),1),Y.eventListeners.markerdelete.forEach(function(Ae){return Ae(new Te(s,be))})},Y=this,N=this.markers.length-1;N>=0;N--)R(N);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",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 s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),R=this.undoRedoManager.getLastUndoStep();if(!R||R.width===c.width&&R.height===c.height){var Y=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),Y<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(N){return N(new xe(s))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(N){return N(new xe(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new xe(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new xe(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return _(this,void 0,void 0,function(){var s,c,R=this;return Q(this,function(Y){switch(Y.label){case 0:return[4,this.render()];case 1:return s=Y.sent(),c=this.getState(),this.eventListeners.render.forEach(function(N){return N(new ke(R,s,c))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(R){return c.markers.push(R.getState())}),c},z.prototype.restoreState=function(s){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(R){var Y=c._availableMarkerTypes.find(function(se){return se.typeName===R.typeName});if(Y!==void 0){var N=c.addNewMarker(Y);N.restoreState(R),c.markers.push(N)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(R){return R(new xe(c))})},z.prototype.addNewMarker=function(s){var c=D.createGroup();return this.markerImage.appendChild(c),new s(c,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var c,R=this;(c=typeof s=="string"?this._availableMarkerTypes.find(function(Y){return Y.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),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(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Y){return Y(new Te(R,R._currentMarker))}))},z.prototype.markerCreated=function(s){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof m&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(m):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(R){return R(new Te(c,c._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var c=this;this.eventListeners.markerchange.forEach(function(R){return R(new Te(c,s))})},z.prototype.setCurrentMarker=function(s){var c=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(R){return R(new Te(c,c._currentMarker))})),this._currentMarker=s,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(R){return R(new Te(c,c._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var c=this.markers.find(function(R){return R.ownsTarget(s.target)});c!==void 0?(this.setCurrentMarker(c),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(R){return R.ownsTarget(s.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,c){var R=this.markerImage.getBoundingClientRect();return{x:(s-R.left)/this.zoomLevel,y:(c-R.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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(s){G.addKey(s)},z.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},z.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new xe(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new xe(s))}))},z.instanceCounter=0,z}()},"VrN/":function(ft,it,pe){(function(fe,Z){ft.exports=Z()})(this,function(){"use strict";var fe=navigator.userAgent,Z=navigator.platform,_=/gecko\/\d/i.test(fe),Q=/MSIE \d/.test(fe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe),D=/Edge\/(\d+)/.exec(fe),G=Q||U||D,H=G&&(Q?document.documentMode||6:+(D||U)[1]),F=!D&&/WebKit\//.test(fe),O=F&&/Qt\/\d+\.\d+/.test(fe),y=!D&&/Chrome\//.test(fe),T=/Opera\//.test(fe),I=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fe),A=/PhantomJS/.test(fe),w=!D&&/AppleWebKit/.test(fe)&&/Mobile\/\w+/.test(fe),d=/Android/.test(fe),o=w||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fe),l=w||/Mac/.test(Z),u=/\bCrOS\b/.test(fe),C=/win/i.test(Z),v=T&&fe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(T=!1,F=!0);var g=l&&(O||T&&(v==null||v<12.11)),k=_||G&&H>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var i=e.className,r=x(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return p(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)n.appendChild(t[S]);return n}function b(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var m;document.createRange?m=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:m=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function B(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function W(e,t){var i=e.className;x(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!x(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};w?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,j=n||0;;){var X=e.indexOf(" ",S);if(X<0||X>=t)return j+(t-S);j+=X-S,j+=i-j%i,S=X+1}}var ae=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ae.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ae.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function he(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var me=50,De={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},ke={origin:"*mouse"},Te={origin:"+move"};function Se(e,t,i){for(var r=0,n=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var j=S-r;if(S==e.length||n+j>=t)return r+Math.min(j,t-n);if(n+=S-r,n+=i-n%i,r=S+1,n>=t)return r}}var ye=[""];function z(e){for(;ye.length<=e;)ye.push(s(ye)+" ");return ye[e]}function s(e){return e[e.length-1]}function c(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function R(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Y(){}function N(e,t){var i;return Object.create?i=Object.create(e):(Y.prototype=e,i=new Y),t&&P(t,i),i}var se=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||se.test(e))}function Ae(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Le=/[\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 _e(e){return e.charCodeAt(0)>=768&&Le.test(e)}function Pe(e,t,i){for(;(i<0?t>0:t<e.length)&&_e(e.charAt(t));)t+=i;return t}function He(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,S=r<0?Math.ceil(n):Math.floor(n);if(S==t)return e(S)?t:i;e(S)?i=S:t=S+r}}function Ge(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,S=0;S<e.length;++S){var j=e[S];(j.from<i&&j.to>t||t==i&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,i),j.level==1?"rtl":"ltr",S),n=!0)}n||r(t,i,"ltr")}var Xe=null;function ze(e,t,i){var r;Xe=null;for(var n=0;n<e.length;++n){var S=e[n];if(S.from<t&&S.to>t)return n;S.to==t&&(S.from!=S.to&&i=="before"?r=n:Xe=n),S.from==t&&(S.from!=S.to&&i!="before"?r=n:Xe=n)}return r!=null?r:Xe}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,S=/[LRr]/,j=/[Lb1n]/,X=/[1n]/;function J(re,ce,ge){this.level=re,this.from=ce,this.to=ge}return function(re,ce){var ge=ce=="ltr"?"L":"R";if(re.length==0||ce=="ltr"&&!r.test(re))return!1;for(var we=re.length,Ce=[],Ie=0;Ie<we;++Ie)Ce.push(i(re.charCodeAt(Ie)));for(var Ne=0,je=ge;Ne<we;++Ne){var Ke=Ce[Ne];Ke=="m"?Ce[Ne]=je:je=Ke}for(var Qe=0,Ve=ge;Qe<we;++Qe){var et=Ce[Qe];et=="1"&&Ve=="r"?Ce[Qe]="n":S.test(et)&&(Ve=et,et=="r"&&(Ce[Qe]="R"))}for(var ut=1,st=Ce[0];ut<we-1;++ut){var vt=Ce[ut];vt=="+"&&st=="1"&&Ce[ut+1]=="1"?Ce[ut]="1":vt==","&&st==Ce[ut+1]&&(st=="1"||st=="n")&&(Ce[ut]=st),st=vt}for(var Mt=0;Mt<we;++Mt){var Vt=Ce[Mt];if(Vt==",")Ce[Mt]="N";else if(Vt=="%"){var Nt=void 0;for(Nt=Mt+1;Nt<we&&Ce[Nt]=="%";++Nt);for(var mr=Mt&&Ce[Mt-1]=="!"||Nt<we&&Ce[Nt]=="1"?"1":"N",hr=Mt;hr<Nt;++hr)Ce[hr]=mr;Mt=Nt-1}}for(var jt=0,dr=ge;jt<we;++jt){var Qt=Ce[jt];dr=="L"&&Qt=="1"?Ce[jt]="L":S.test(Qt)&&(dr=Qt)}for(var Gt=0;Gt<we;++Gt)if(n.test(Ce[Gt])){var Wt=void 0;for(Wt=Gt+1;Wt<we&&n.test(Ce[Wt]);++Wt);for(var Bt=(Gt?Ce[Gt-1]:ge)=="L",cr=(Wt<we?Ce[Wt]:ge)=="L",Gi=Bt==cr?Bt?"L":"R":ge,ei=Gt;ei<Wt;++ei)Ce[ei]=Gi;Gt=Wt-1}for(var rr=[],Ir,Xt=0;Xt<we;)if(j.test(Ce[Xt])){var Va=Xt;for(++Xt;Xt<we&&j.test(Ce[Xt]);++Xt);rr.push(new J(0,Va,Xt))}else{var Gr=Xt,vi=rr.length,yi=ce=="rtl"?1:0;for(++Xt;Xt<we&&Ce[Xt]!="L";++Xt);for(var ar=Gr;ar<Xt;)if(X.test(Ce[ar])){Gr<ar&&(rr.splice(vi,0,new J(1,Gr,ar)),vi+=yi);var zi=ar;for(++ar;ar<Xt&&X.test(Ce[ar]);++ar);rr.splice(vi,0,new J(2,zi,ar)),vi+=yi,Gr=ar}else++ar;Gr<Xt&&rr.splice(vi,0,new J(1,Gr,Xt))}return ce=="ltr"&&(rr[0].level==1&&(Ir=re.match(/^\s+/))&&(rr[0].from=Ir[0].length,rr.unshift(new J(0,0,Ir[0].length))),s(rr).level==1&&(Ir=re.match(/\s+$/))&&(s(rr).to-=Ir[0].length,rr.push(new J(0,we-Ir[0].length,we)))),ce=="rtl"?rr.reverse():rr}}();function $e(e,t){var i=e.order;return i==null&&(i=e.order=ot(e.text,t)),i}var Je=[],Re=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Je).concat(i)}};function rt(e,t){return e._handlers&&e._handlers[t]||Je}function qe(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var S=he(n,i);S>-1&&(r[t]=n.slice(0,S).concat(n.slice(S+1)))}}}function oe(e,t){var i=rt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function q(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),oe(e,i||t.type,e,t),ue(t)||t.codemirrorIgnore}function ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)he(i,t[r])==-1&&i.push(t[r])}function ne(e,t){return rt(e,t).length>0}function le(e){e.prototype.on=function(t,i){Re(this,t,i)},e.prototype.off=function(t,i){qe(this,t,i)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){te(e),ie(e)}function ve(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(G&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Be;function Ye(e){if(Be==null){var t=a("span","\u200B");h(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Be=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&H<8))}var i=Be?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var We;function pt(e){if(We!=null)return We;var t=h(e,document.createTextNode("A\u062EA")),i=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return p(e),!i||i.left==i.right?!1:We=r.right-i.right<3}var nt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var S=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),j=S.indexOf("\r");j!=-1?(i.push(S.slice(0,j)),t+=j+1):(i.push(S),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},tt=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Tt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function xt(e){if(bt!=null)return bt;var t=h(e,a("span","x")),i=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(i.left-r.left)>1}var kt={},Et={};function qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}function Tr(e,t){Et[e]=t}function Yt(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=N(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=Yt(t);var i=kt[t.name];if(!i)return gr(e,"text/plain");var r=i(e,t);if(fr.hasOwnProperty(t.name)){var n=fr[t.name];for(var S in n){if(!n.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=n[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var fr={};function zr(e,t){var i=fr.hasOwnProperty(e)?fr[e]:fr[e]={};P(t,i)}function $t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Nr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function ti(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(j){return i?j.toLowerCase():j},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],S=n.chunkSize();if(t<S){i=n;break}t-=S}return i.lines[t]}function wt(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(S){var j=S.text;n==i.line&&(j=j.slice(0,i.ch)),n==t.line&&(j=j.slice(t.ch)),r.push(j),++n}),r}function Zt(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function gt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function mt(e){if(e.parent==null)return null;for(var t=e.parent,i=he(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Lt(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],S=n.height;if(t<S){e=n;continue e}t-=S,i+=n.chunkSize()}return i}while(!e.lines);for(var j=0;j<e.lines.length;++j){var X=e.lines[j],J=X.height;if(t<J)break;t-=J}return i+j}function vr(e,t){return t>=e.first&&t<e.first+e.size}function Ut(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Fe))return new Fe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function ht(e,t){return e.line-t.line||e.ch-t.ch}function ri(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function bi(e){return Fe(e.line,e.ch)}function xi(e,t){return ht(e,t)<0?t:e}function ii(e,t){return ht(e,t)<0?e:t}function Ei(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ct(e,t){if(t.line<e.first)return Fe(e.first,0);var i=e.first+e.size-1;return t.line>i?Fe(i,Ze(e,i).text.length):kn(t,Ze(e,t.line).text.length)}function kn(e,t){var i=e.ch;return i==null||i>t?Fe(e.line,t):i<0?Fe(e.line,0):e}function Ue(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=ct(e,t[r]);return i}var Si=function(e,t){this.state=e,this.lookAhead=t},Er=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Er.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Er.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}},Er.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Er.fromSaved=function(e,t,i){return t instanceof Si?new Er(e,$t(e.mode,t.state),i,t.lookAhead):new Er(e,$t(e.mode,t),i)},Er.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Si(t,this.maxLookAhead):t};function Ki(e,t,i,r){var n=[e.state.modeGen],S={};Ar(e,t.text,e.doc.mode,i,function(re,ce){return n.push(re,ce)},S,r);for(var j=i.state,X=function(re){i.baseTokens=n;var ce=e.state.overlays[re],ge=1,we=0;i.state=!0,Ar(e,t.text,ce.mode,i,function(Ce,Ie){for(var Ne=ge;we<Ce;){var je=n[ge];je>Ce&&n.splice(ge,1,Ce,n[ge+1],je),ge+=2,we=Math.min(Ce,je)}if(!Ie)return;if(ce.opaque)n.splice(Ne,ge-Ne,Ce,"overlay "+Ie),ge=Ne+2;else for(;Ne<ge;Ne+=2){var Ke=n[Ne+1];n[Ne+1]=(Ke?Ke+" ":"")+"overlay "+Ie}},S),i.state=j,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)X(J);return{styles:n,classes:S.bgClass||S.textClass?S:null}}function ni(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Cr(e,mt(t)),n=t.text.length>e.options.maxHighlightLength&&$t(e.doc.mode,r.state),S=Ki(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Cr(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Er(r,!0,t);var S=Dn(e,t,i),j=S>r.first&&Ze(r,S-1).stateAfter,X=j?Er.fromSaved(r,j,S):new Er(r,ti(r.mode),S);return r.iter(S,t,function(J){Vi(e,J.text,X);var re=X.line;J.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&re<n.viewTo?X.save():null,X.nextLine()}),i&&(r.modeFrontier=X.line),X}function Vi(e,t,i,r){var n=e.doc.mode,S=new Pt(t,e.options.tabSize,i);for(S.start=S.pos=r||0,t==""&&Xi(n,i.state);!S.eol();)wr(n,S,i.state),S.start=S.pos}function Xi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Nr(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function wr(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Nr(e,i).mode);var S=e.token(t,i);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yi=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Ln(e,t,i,r){var n=e.doc,S=n.mode,j;t=ct(n,t);var X=Ze(n,t.line),J=Cr(e,t.line,i),re=new Pt(X.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,j=wr(S,re,J.state),r&&ce.push(new Yi(re,j,$t(n.mode,J.state)));return r?ce:new Yi(re,j,J.state)}function $i(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Ar(e,t,i,r,n,S,j){var X=i.flattenSpans;X==null&&(X=e.options.flattenSpans);var J=0,re=null,ce=new Pt(t,e.options.tabSize,r),ge,we=e.options.addModeClass&&[null];for(t==""&&$i(Xi(i,r.state),S);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(X=!1,j&&Vi(e,t,r,ce.pos),ce.pos=t.length,ge=null):ge=$i(wr(i,ce,r.state,we),S),we){var Ce=we[0].name;Ce&&(ge="m-"+(ge?Ce+" "+ge:Ce))}if(!X||re!=ge){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,re);re=ge}ce.start=ce.pos}for(;J<ce.pos;){var Ie=Math.min(ce.pos,J+5e3);n(Ie,re),J=Ie}}function Dn(e,t,i){for(var r,n,S=e.doc,j=i?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>j;--X){if(X<=S.first)return S.first;var J=Ze(S,X-1),re=J.stateAfter;if(re&&(!i||X+(re instanceof Si?re.lookAhead:0)<=S.modeFrontier))return X;var ce=$(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=X-1,r=ce)}return n}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=Ze(e,r).stateAfter;if(n&&(!(n instanceof Si)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Zi=!1,ir=!1;function Kr(){Zi=!0}function oa(){ir=!0}function ai(e,t,i){this.marker=e,this.from=t,this.to=i}function kr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Ji(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Rn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],j=S.marker,X=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);if(X||S.from==t&&j.type=="bookmark"&&(!i||!S.marker.insertLeft)){var J=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new ai(j,S.from,J?null:S.to))}}return r}function On(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],j=S.marker,X=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);if(X||S.from==t&&j.type=="bookmark"&&(!i||S.marker.insertLeft)){var J=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new ai(j,J?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Ti(e,t){if(t.full)return null;var i=vr(e,t.from.line)&&Ze(e,t.from.line).markedSpans,r=vr(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,S=t.to.ch,j=ht(t.from,t.to)==0,X=Rn(i,n,j),J=On(r,S,j),re=t.text.length==1,ce=s(t.text).length+(re?n:0);if(X)for(var ge=0;ge<X.length;++ge){var we=X[ge];if(we.to==null){var Ce=kr(J,we.marker);Ce?re&&(we.to=Ce.to==null?null:Ce.to+ce):we.to=n}}if(J)for(var Ie=0;Ie<J.length;++Ie){var Ne=J[Ie];if(Ne.to!=null&&(Ne.to+=ce),Ne.from==null){var je=kr(X,Ne.marker);je||(Ne.from=ce,re&&(X||(X=[])).push(Ne))}else Ne.from+=ce,re&&(X||(X=[])).push(Ne)}X&&(X=_n(X)),J&&J!=X&&(J=_n(J));var Ke=[X];if(!re){var Qe=t.text.length-2,Ve;if(Qe>0&&X)for(var et=0;et<X.length;++et)X[et].to==null&&(Ve||(Ve=[])).push(new ai(X[et].marker,null,null));for(var ut=0;ut<Qe;++ut)Ke.push(Ve);Ke.push(J)}return Ke}function _n(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Mn(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ce){if(Ce.markedSpans)for(var Ie=0;Ie<Ce.markedSpans.length;++Ie){var Ne=Ce.markedSpans[Ie].marker;Ne.readOnly&&(!r||he(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var n=[{from:t,to:i}],S=0;S<r.length;++S)for(var j=r[S],X=j.find(0),J=0;J<n.length;++J){var re=n[J];if(ht(re.to,X.from)<0||ht(re.from,X.to)>0)continue;var ce=[J,1],ge=ht(re.from,X.from),we=ht(re.to,X.to);(ge<0||!j.inclusiveLeft&&!ge)&&ce.push({from:re.from,to:X.from}),(we>0||!j.inclusiveRight&&!we)&&ce.push({from:X.to,to:re.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function la(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Ci(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function oi(e){return e.inclusiveLeft?-1:0}function si(e){return e.inclusiveRight?1:0}function wi(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),S=ht(r.from,n.from)||oi(e)-oi(t);if(S)return-S;var j=ht(r.to,n.to)||si(e)-si(t);return j||t.id-e.id}function Br(e,t){var i=ir&&e.markedSpans,r;if(i)for(var n=void 0,S=0;S<i.length;++S)n=i[S],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||wi(r,n.marker)<0)&&(r=n.marker);return r}function Fr(e){return Br(e,!0)}function Ur(e){return Br(e,!1)}function Ai(e,t){var i=ir&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var S=i[n];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||wi(r,S.marker)<0)&&(r=S.marker)}return r}function Pn(e,t,i,r,n){var S=Ze(e,t),j=ir&&S.markedSpans;if(j)for(var X=0;X<j.length;++X){var J=j[X];if(!J.marker.collapsed)continue;var re=J.marker.find(0),ce=ht(re.from,i)||oi(J.marker)-oi(n),ge=ht(re.to,r)||si(J.marker)-si(n);if(ce>=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?ht(re.to,i)>=0:ht(re.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?ht(re.from,r)<=0:ht(re.from,r)<0))return!0}}function yr(e){for(var t;t=Fr(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function ki(e){for(var t,i;t=Ur(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Qi(e,t){var i=Ze(e,t),r=yr(i);return i==r?t:mt(r)}function Vr(e,t){if(t>e.lastLine())return t;var i=Ze(e,t),r;if(!_r(e,i))return t;for(;r=Ur(i);)i=r.find(1,!0).line;return mt(i)+1}function _r(e,t){var i=ir&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qi(e,t,r))return!0}}function qi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return qi(e,r.line,kr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,S=0;S<t.markedSpans.length;++S)if(n=t.markedSpans[S],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&qi(e,t,n))return!0}function Lr(e){e=yr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var S=i.parent;S;i=S,S=i.parent)for(var j=0;j<S.children.length;++j){var X=S.children[j];if(X==i)break;t+=X.height}return t}function en(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Fr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ur(r);){var S=i.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Nn(e){var t=e.display,i=e.doc;t.maxLine=Ze(i,i.first),t.maxLineLength=en(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=en(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var li=function(e,t,i){this.text=e,Ci(this,t),this.height=i?i(this):1};li.prototype.lineNo=function(){return mt(this)},le(li);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Ci(e,i);var n=r?r(e):1;n!=e.height&&gt(e,n)}function at(e){e.parent=null,la(e)}var dt={},lt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?lt:dt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function At(e,t){var i=b("span",null,null,F?"padding-right: .1px":null),r={pre:b("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var S=n?t.rest[n-1]:t.line,j=void 0;r.pos=0,r.addToken=Ct,pt(e.display.measure)&&(j=$e(S,e.doc.direction))&&(r.addToken=or(r.addToken,j)),r.map=[];var X=t!=e.display.externalMeasured&&mt(S);jr(S,r,ni(e,S,X)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=K(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=K(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ye(e.display.measure))),n==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(F){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(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 Ct(e,t,i,r,n,S,j){if(!t)return;var X=e.splitSpaces?Ht(t,e.trailingSpace):t,J=e.cm.state.specialChars,re=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,ce),G&&H<9&&(re=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var we=J.exec(t),Ce=we?we.index-ge:t.length-ge;if(Ce){var Ie=document.createTextNode(X.slice(ge,ge+Ce));G&&H<9?ce.appendChild(a("span",[Ie])):ce.appendChild(Ie),e.map.push(e.pos,e.pos+Ce,Ie),e.col+=Ce,e.pos+=Ce}if(!we)break;ge+=Ce+1;var Ne=void 0;if(we[0]==" "){var je=e.cm.options.tabSize,Ke=je-e.col%je;Ne=ce.appendChild(a("span",z(Ke),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Ke}else we[0]=="\r"||we[0]==`
`?(Ne=ce.appendChild(a("span",we[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",we[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(we[0]),Ne.setAttribute("cm-text",we[0]),G&&H<9?ce.appendChild(a("span",[Ne])):ce.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,i||r||n||re||S||j){var Qe=i||"";r&&(Qe+=r),n&&(Qe+=n);var Ve=a("span",[ce],Qe,S);if(j)for(var et in j)j.hasOwnProperty(et)&&et!="style"&&et!="class"&&Ve.setAttribute(et,j[et]);return e.content.appendChild(Ve)}e.content.appendChild(ce)}function Ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var S=e.charAt(n);S==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(S="\xA0"),r+=S,i=S==" "}return r}function or(e,t){return function(i,r,n,S,j,X,J){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,ce=re+r.length;;){for(var ge=void 0,we=0;we<t.length&&!(ge=t[we],ge.to>re&&ge.from<=re);we++);if(ge.to>=ce)return e(i,r,n,S,j,X,J);e(i,r.slice(0,ge.to-re),n,S,null,X,J),S=null,r=r.slice(ge.to-re),re=ge.to}}}function St(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function jr(e,t,i){var r=e.markedSpans,n=e.text,S=0;if(!r){for(var j=1;j<i.length;j+=2)t.addToken(t,n.slice(S,S=i[j]),yt(i[j+1],t.cm.options));return}for(var X=n.length,J=0,re=1,ce="",ge,we,Ce=0,Ie,Ne,je,Ke,Qe;;){if(Ce==J){Ie=Ne=je=we="",Qe=null,Ke=null,Ce=Infinity;for(var Ve=[],et=void 0,ut=0;ut<r.length;++ut){var st=r[ut],vt=st.marker;if(vt.type=="bookmark"&&st.from==J&&vt.widgetNode)Ve.push(vt);else if(st.from<=J&&(st.to==null||st.to>J||vt.collapsed&&st.to==J&&st.from==J)){if(st.to!=null&&st.to!=J&&Ce>st.to&&(Ce=st.to,Ne=""),vt.className&&(Ie+=" "+vt.className),vt.css&&(we=(we?we+";":"")+vt.css),vt.startStyle&&st.from==J&&(je+=" "+vt.startStyle),vt.endStyle&&st.to==Ce&&(et||(et=[])).push(vt.endStyle,st.to),vt.title&&((Qe||(Qe={})).title=vt.title),vt.attributes)for(var Mt in vt.attributes)(Qe||(Qe={}))[Mt]=vt.attributes[Mt];vt.collapsed&&(!Ke||wi(Ke.marker,vt)<0)&&(Ke=st)}else st.from>J&&Ce>st.from&&(Ce=st.from)}if(et)for(var Vt=0;Vt<et.length;Vt+=2)et[Vt+1]==Ce&&(Ne+=" "+et[Vt]);if(!Ke||Ke.from==J)for(var Nt=0;Nt<Ve.length;++Nt)St(t,0,Ve[Nt]);if(Ke&&(Ke.from||0)==J){if(St(t,(Ke.to==null?X+1:Ke.to)-J,Ke.marker,Ke.from==null),Ke.to==null)return;Ke.to==J&&(Ke=!1)}}if(J>=X)break;for(var mr=Math.min(X,Ce);;){if(ce){var hr=J+ce.length;if(!Ke){var jt=hr>mr?ce.slice(0,mr-J):ce;t.addToken(t,jt,ge?ge+Ie:Ie,je,J+jt.length==Ce?Ne:"",we,Qe)}if(hr>=mr){ce=ce.slice(mr-J),J=mr;break}J=hr,je=""}ce=n.slice(S,S=i[re++]),ge=yt(i[re++],t.cm.options)}}}function Dt(e,t,i){this.line=t,this.rest=ki(t),this.size=this.rest?mt(s(this.rest))-i+1:1,this.node=this.text=null,this.hidden=_r(e,t)}function sr(e,t,i){for(var r=[],n,S=t;S<i;S=n){var j=new Dt(e.doc,Ze(e.doc,S),S);n=S+j.size,r.push(j)}return r}var er=null;function Sr(e){er?er.ops.push(e):e.ownsGroup=er={ops:[e],delayedCallbacks:[]}}function Rs(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Os(e,t){var i=e.ownsGroup;if(!i)return;try{Rs(i)}finally{er=null,t(i)}}var tn=null;function Jt(e,t){var i=rt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;er?n=er.delayedCallbacks:tn?n=tn:(n=tn=[],setTimeout(_s,0));for(var S=function(X){n.push(function(){return i[X].apply(null,r)})},j=0;j<i.length;++j)S(j)}function _s(){var e=tn;tn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,i,r){for(var n=0;n<t.changes.length;n++){var S=t.changes[n];S=="text"?Ps(e,t):S=="gutter"?Za(e,t,i,r):S=="class"?ha(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function rn(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&&H<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=rn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):At(e,t)}function Ps(e,t){var i=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):i&&(t.text.className=i)}function ha(e,t){Ms(e,t),t.line.wrapClass?rn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Za(e,t,i,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 n=rn(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),n.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var j=rn(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),j.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",Ut(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var J=0;J<e.display.gutterSpecs.length;++J){var re=e.display.gutterSpecs[J].className,ce=S.hasOwnProperty(re)&&S[re];ce&&X.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),n=t.node.firstChild,S=void 0;n;n=S)S=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Ja(e,t,i)}function Ns(e,t,i,r){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Za(e,t,i,r),Ja(e,t,r),t.node}function Ja(e,t,i){if(Qa(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,i,!1)}function Qa(e,t,i,r,n){if(!t.widgets)return;for(var S=rn(i),j=0,X=t.widgets;j<X.length;++j){var J=X[j],re=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Bs(J,re,i,r),e.display.input.setUneditable(re),n&&J.above?S.insertBefore(re,i.gutter||i.text):S.appendChild(re),Jt(J,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function nn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Wr(e,t){for(var i=ve(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Bn(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Mr(e){return me-e.display.nativeBarWidth}function ui(e){return e.display.scroller.clientWidth-Mr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Mr(e)-e.display.barHeight}function Fs(e,t,i){var r=e.options.lineWrapping,n=r&&ui(e);if(!t.measure.heights||r&&t.measure.width!=n){var S=t.measure.heights=[];if(r){t.measure.width=n;for(var j=t.text.firstChild.getClientRects(),X=0;X<j.length-1;X++){var J=j[X],re=j[X+1];Math.abs(J.bottom-re.bottom)>2&&S.push((J.bottom+re.top)/2-i.top)}}S.push(i.bottom-i.top)}}function eo(e,t,i){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 n=0;n<e.rest.length;n++)if(mt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=yr(t);var i=mt(t),r=e.display.externalMeasured=new Dt(e.doc,t,i);r.lineN=i;var n=r.built=At(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Pr(e,Li(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ci(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Li(e,t){var i=mt(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=eo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Pr(e,t,i,r,n){t.before&&(i=-1);var S=i+(r||""),j;return t.cache.hasOwnProperty(S)?j=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,i,r),j.bogus||(t.cache[S]=j)),{left:j.left,right:j.right,top:n?j.rtop:j.top,bottom:n?j.rbottom:j.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,S,j,X,J,re=0;re<e.length;re+=3)if(X=e[re],J=e[re+1],t<X?(n=0,S=1,j="left"):t<J?(n=t-X,S=n+1):(re==e.length-3||t==J&&e[re+3]>t)&&(S=J-X,n=S-1,t>=J&&(j="right")),n!=null){if(r=e[re+2],X==J&&i==(r.insertLeft?"left":"right")&&(j=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],j="left";if(i=="right"&&n==J-X)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],j="right";break}return{node:r,start:n,end:S,collapse:j,coverStart:X,coverEnd:J}}function js(e,t){var i=ro;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=io(t.map,i,r),S=n.node,j=n.start,X=n.end,J=n.collapse,re;if(S.nodeType==3){for(var ce=0;ce<4;ce++){for(;j&&_e(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+X<n.coverEnd&&_e(t.line.text.charAt(n.coverStart+X));)++X;if(G&&H<9&&j==0&&X==n.coverEnd-n.coverStart?re=S.parentNode.getBoundingClientRect():re=js(m(S,j,X).getClientRects(),r),re.left||re.right||j==0)break;X=j,j=j-1,J="right"}G&&H<11&&(re=Hs(e.display.measure,re))}else{j>0&&(J=r="right");var ge;e.options.lineWrapping&&(ge=S.getClientRects()).length>1?re=ge[r=="right"?ge.length-1:0]:re=S.getBoundingClientRect()}if(G&&H<9&&!j&&(!re||!re.left&&!re.right)){var we=S.parentNode.getClientRects()[0];we?re={left:we.left,right:we.left+Ri(e.display),top:we.top,bottom:we.bottom}:re=ro}for(var Ce=re.top-t.rect.top,Ie=re.bottom-t.rect.top,Ne=(Ce+Ie)/2,je=t.view.measure.heights,Ke=0;Ke<je.length-1&&!(Ne<je[Ke]);Ke++);var Qe=Ke?je[Ke-1]:0,Ve=je[Ke],et={left:(J=="right"?re.right:re.left)-t.rect.left,right:(J=="left"?re.left:re.right)-t.rect.left,top:Qe,bottom:Ve};return!re.left&&!re.right&&(et.bogus=!0),e.options.singleCursorHeightPerLine||(et.rtop=Ce,et.rbottom=Ie),et}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!xt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function no(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function an(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=nn(e.widgets[i]));return t}function Fn(e,t,i,r,n){if(!n){var S=pa(t);i.top+=S,i.bottom+=S}if(r=="line")return i;r||(r="local");var j=Lr(t);if(r=="local"?j+=Bn(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();j+=X.top+(r=="window"?0:so());var J=X.left+(r=="window"?0:oo());i.left+=J,i.right+=J}return i.top+=j,i.bottom+=j,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var S=e.display.sizer.getBoundingClientRect();r+=S.left,n+=S.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:n-j.top}}function ma(e,t,i,r,n){return r||(r=Ze(e.doc,t.line)),Fn(e,r,to(e,r,t.ch,n),i)}function Dr(e,t,i,r,n,S){r=r||Ze(e.doc,t.line),n||(n=Li(e,r));function j(Ie,Ne){var je=Pr(e,n,Ie,Ne?"right":"left",S);return Ne?je.left=je.right:je.right=je.left,Fn(e,r,je,i)}var X=$e(r,e.doc.direction),J=t.ch,re=t.sticky;if(J>=r.text.length?(J=r.text.length,re="before"):J<=0&&(J=0,re="after"),!X)return j(re=="before"?J-1:J,re=="before");function ce(Ie,Ne,je){var Ke=X[Ne],Qe=Ke.level==1;return j(je?Ie-1:Ie,Qe!=je)}var ge=ze(X,J,re),we=Xe,Ce=ce(J,ge,re=="before");return we!=null&&(Ce.other=ce(J,we,re!="before")),Ce}function uo(e,t){var i=0;t=ct(e.doc,t),e.options.lineWrapping||(i=Ri(e.display)*t.ch);var r=Ze(e.doc,t.line),n=Lr(r)+Bn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var S=Fe(e,t,i);return S.xRel=n,r&&(S.outside=r),S}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=Lt(r,i),S=r.first+r.size-1;if(n>S)return ga(r.first+r.size-1,Ze(r,S).text.length,null,1,1);t<0&&(t=0);for(var j=Ze(r,n);;){var X=Gs(e,j,n,t,i),J=Ai(j,X.ch+(X.xRel>0||X.outside>0?1:0));if(!J)return X;var re=J.find(1);if(re.line==n)return re;j=Ze(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,S=He(function(j){return Pr(e,i,j-1).bottom<=r},n,0);return n=He(function(j){return Pr(e,i,j).top>r},S,n),{begin:S,end:n}}function co(e,t,i,r){i||(i=Li(e,t));var n=Fn(e,t,Pr(e,i,r),"line").top;return ho(e,t,i,n)}function ya(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Lr(t);var S=Li(e,t),j=pa(t),X=0,J=t.text.length,re=!0,ce=$e(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,S,ce,r,n);re=ge.level!=1,X=re?ge.from:ge.to-1,J=re?ge.to:ge.from-1}var we=null,Ce=null,Ie=He(function(ut){var st=Pr(e,S,ut);return st.top+=j,st.bottom+=j,ya(st,r,n,!1)?(st.top<=n&&st.left<=r&&(we=ut,Ce=st),!0):!1},X,J),Ne,je,Ke=!1;if(Ce){var Qe=r-Ce.left<Ce.right-r,Ve=Qe==re;Ie=we+(Ve?0:1),je=Ve?"after":"before",Ne=Qe?Ce.left:Ce.right}else{!re&&(Ie==J||Ie==X)&&Ie++,je=Ie==0?"after":Ie==t.text.length?"before":Pr(e,S,Ie-(re?1:0)).bottom+j<=n==re?"after":"before";var et=Dr(e,Fe(i,Ie,je),"line",t,S);Ne=et.left,Ke=n<et.top?-1:n>=et.bottom?1:0}return Ie=Pe(t.text,Ie,1),ga(i,Ie,je,Ke,r-Ne)}function zs(e,t,i,r,n,S,j){var X=He(function(ge){var we=n[ge],Ce=we.level!=1;return ya(Dr(e,Fe(i,Ce?we.to:we.from,Ce?"before":"after"),"line",t,r),S,j,!0)},0,n.length-1),J=n[X];if(X>0){var re=J.level!=1,ce=Dr(e,Fe(i,re?J.from:J.to,re?"after":"before"),"line",t,r);ya(ce,S,j,!0)&&ce.top>j&&(J=n[X-1])}return J}function Ks(e,t,i,r,n,S,j){var X=ho(e,t,r,j),J=X.begin,re=X.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var ce=null,ge=null,we=0;we<n.length;we++){var Ce=n[we];if(Ce.from>=re||Ce.to<=J)continue;var Ie=Ce.level!=1,Ne=Pr(e,r,Ie?Math.min(re,Ce.to)-1:Math.max(J,Ce.from)).right,je=Ne<S?S-Ne+1e9:Ne-S;(!ce||ge>je)&&(ce=Ce,ge=je)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>re&&(ce={from:ce.from,to:re,level:ce.level}),ce}var hi;function Di(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hi==null){hi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hi.appendChild(document.createTextNode("x")),hi.appendChild(a("br"));hi.appendChild(document.createTextNode("x"))}h(e.measure,hi);var i=hi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),p(e.measure),i||1}function Ri(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,S=t.gutters.firstChild,j=0;S;S=S.nextSibling,++j){var X=e.display.gutterSpecs[j].className;i[X]=S.offsetLeft+S.clientLeft+n,r[X]=S.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Di(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ri(e.display)-3);return function(n){if(_r(e.doc,n))return 0;var S=0;if(n.widgets)for(var j=0;j<n.widgets.length;j++)n.widgets[j].height&&(S+=n.widgets[j].height);return i?S+(Math.ceil(n.text.length/r)||1)*t:S+t}}function Ea(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&gt(r,n)})}function di(e,t,i,r){var n=e.display;if(!i&&ve(t).getAttribute("cm-not-content")=="true")return null;var S,j,X=n.lineSpace.getBoundingClientRect();try{S=t.clientX-X.left,j=t.clientY-X.top}catch(ge){return null}var J=va(e,S,j),re;if(r&&J.xRel>0&&(re=Ze(e.doc,J.line).text).length==J.ch){var ce=$(re,re.length,e.options.tabSize)-re.length;J=Fe(J.line,Math.max(0,Math.round((S-qa(e.display).left)/Ri(e.display))-ce))}return J}function ci(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function lr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)ir&&Qi(e.doc,t)<n.viewTo&&Yr(e);else if(i<=n.viewFrom)ir&&Vr(e.doc,i+r)>n.viewFrom?Yr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Yr(e);else if(t<=n.viewFrom){var S=Un(e,i,i+r,1);S?(n.view=n.view.slice(S.index),n.viewFrom=S.lineN,n.viewTo+=r):Yr(e)}else if(i>=n.viewTo){var j=Un(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):Yr(e)}else{var X=Un(e,t,t,-1),J=Un(e,i,i+r,1);X&&J?(n.view=n.view.slice(0,X.index).concat(sr(e,X.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Yr(e)}var re=n.externalMeasured;re&&(i<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(n.externalMeasured=null))}function Xr(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[ci(e,t)];if(S.node==null)return;var j=S.changes||(S.changes=[]);he(j,i)==-1&&j.push(i)}function Yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,i,r){var n=ci(e,t),S,j=e.display.view;if(!ir||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var X=e.display.viewFrom,J=0;J<n;J++)X+=j[J].size;if(X!=t){if(r>0){if(n==j.length-1)return null;S=X+j[n].size-t,n++}else S=X-t;t+=S,i+=S}for(;Qi(e.doc,i)!=i;){if(n==(r<0?0:j.length-1))return null;i+=r*j[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=sr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=sr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ci(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(sr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ci(e,i)))),r.viewTo=i}function po(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function on(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),j=0;j<i.sel.ranges.length;j++){if(!t&&j==i.sel.primIndex)continue;var X=i.sel.ranges[j];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var J=X.empty();(J||e.options.showCursorWhenSelecting)&&go(e,X.head,n),J||Xs(e,X,S)}return r}function go(e,t,i){var r=Dr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function jn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,S=document.createDocumentFragment(),j=qa(e.display),X=j.left,J=Math.max(r.sizerWidth,ui(e)-r.sizer.offsetLeft)-j.right,re=n.direction=="ltr";function ce(Ve,et,ut,st){et<0&&(et=0),et=Math.round(et),st=Math.round(st),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
top: `+et+"px; width: "+(ut==null?J-Ve:ut)+`px;
height: `+(st-et)+"px"))}function ge(Ve,et,ut){var st=Ze(n,Ve),vt=st.text.length,Mt,Vt;function Nt(jt,dr){return ma(e,Fe(Ve,jt),"div",st,dr)}function mr(jt,dr,Qt){var Gt=co(e,st,null,jt),Wt=dr=="ltr"==(Qt=="after")?"left":"right",Bt=Qt=="after"?Gt.begin:Gt.end-(/\s/.test(st.text.charAt(Gt.end-1))?2:1);return Nt(Bt,Wt)[Wt]}var hr=$e(st,n.direction);return Ge(hr,et||0,ut==null?vt:ut,function(jt,dr,Qt,Gt){var Wt=Qt=="ltr",Bt=Nt(jt,Wt?"left":"right"),cr=Nt(dr-1,Wt?"right":"left"),Gi=et==null&&jt==0,ei=ut==null&&dr==vt,rr=Gt==0,Ir=!hr||Gt==hr.length-1;if(cr.top-Bt.top<=3){var Xt=(re?Gi:ei)&&rr,Va=(re?ei:Gi)&&Ir,Gr=Xt?X:(Wt?Bt:cr).left,vi=Va?J:(Wt?cr:Bt).right;ce(Gr,Bt.top,vi-Gr,Bt.bottom)}else{var yi,ar,zi,Xa;Wt?(yi=re&&Gi&&rr?X:Bt.left,ar=re?J:mr(jt,Qt,"before"),zi=re?X:mr(dr,Qt,"after"),Xa=re&&ei&&Ir?J:cr.right):(yi=re?mr(jt,Qt,"before"):X,ar=!re&&Gi&&rr?J:Bt.right,zi=!re&&ei&&Ir?X:cr.left,Xa=re?mr(dr,Qt,"after"):J),ce(yi,Bt.top,ar-yi,Bt.bottom),Bt.bottom<cr.top&&ce(X,Bt.bottom,null,cr.top),ce(zi,cr.top,Xa-zi,cr.bottom)}(!Mt||jn(Bt,Mt)<0)&&(Mt=Bt),jn(cr,Mt)<0&&(Mt=cr),(!Vt||jn(Bt,Vt)<0)&&(Vt=Bt),jn(cr,Vt)<0&&(Vt=cr)}),{start:Mt,end:Vt}}var we=t.from(),Ce=t.to();if(we.line==Ce.line)ge(we.line,we.ch,Ce.ch);else{var Ie=Ze(n,we.line),Ne=Ze(n,Ce.line),je=yr(Ie)==yr(Ne),Ke=ge(we.line,we.ch,je?Ie.text.length+1:null).end,Qe=ge(Ce.line,je?0:null,Ce.ch).start;je&&(Ke.top<Qe.top-2?(ce(Ke.right,Ke.top,null,Ke.bottom),ce(X,Qe.top,Qe.left,Qe.bottom)):ce(Ke.right,Ke.top,Qe.left-Ke.right,Ke.bottom)),Ke.bottom<Qe.top&&ce(X,Ke.bottom,null,Qe.top)}i.appendChild(S)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Oi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(oe(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),F&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Oi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(oe(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],S=e.options.lineWrapping,j=void 0,X=0;if(n.hidden)continue;if(G&&H<8){var J=n.node.offsetTop+n.node.offsetHeight;j=J-i,i=J}else{var re=n.node.getBoundingClientRect();j=re.bottom-re.top,!S&&n.text.firstChild&&(X=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var ce=n.line.height-j;if((ce>.005||ce<-.005)&&(gt(n.line,j),bo(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)bo(n.rest[ge]);if(X>e.display.sizerWidth){var we=Math.ceil(X/Ri(e.display));we>e.display.maxLineLength&&(e.display.maxLineLength=we,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Hn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Bn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,S=Lt(t,r),j=Lt(t,n);if(i&&i.ensure){var X=i.ensure.from.line,J=i.ensure.to.line;X<S?(S=X,j=Lt(t,Lr(Ze(t,X))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=j&&(S=Lt(t,Lr(Ze(t,J))-e.wrapper.clientHeight),j=J)}return{from:S,to:Math.max(j,S+1)}}function Ys(e,t){if(q(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!A){var S=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Bn(e.display))+`px;
height: `+(t.bottom-t.top+Mr(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(n),e.display.lineSpace.removeChild(S)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var j=!1,X=Dr(e,t),J=!i||i==t?X:Dr(e,i);n={left:Math.min(X.left,J.left),top:Math.min(X.top,J.top)-r,right:Math.max(X.left,J.left),bottom:Math.max(X.bottom,J.bottom)+r};var re=Ca(e,n),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(j=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(j=!0)),!j)break}return n}function Zs(e,t){var i=Ca(e,t);i.scrollTop!=null&&ln(e,i.scrollTop),i.scrollLeft!=null&&fi(e,i.scrollLeft)}function Ca(e,t){var i=e.display,r=Di(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,S=ca(e),j={};t.bottom-t.top>S&&(t.bottom=t.top+S);var X=e.doc.height+da(i),J=t.top<r,re=t.bottom>X-r;if(t.top<n)j.scrollTop=J?0:t.top;else if(t.bottom>n+S){var ce=Math.min(t.top,(re?X:t.bottom)-S);ce!=n&&(j.scrollTop=ce)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,we=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ce=ui(e)-i.gutters.offsetWidth,Ie=t.right-t.left>Ce;return Ie&&(t.right=t.left+Ce),t.left<10?j.scrollLeft=0:t.left<we?j.scrollLeft=Math.max(0,t.left+ge-(Ie?0:10)):t.right>Ce+we-3&&(j.scrollLeft=t.right+(Ie?0:10)-Ce),j}function wa(e,t){if(t==null)return;Gn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _i(e){Gn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sn(e,t,i){(t!=null||i!=null)&&Gn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Gn(e),e.curOp.scrollToPos=t}function Gn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);xo(e,i,r,t.margin)}}function xo(e,t,i,r){var n=Ca(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});sn(e,n.scrollLeft,n.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;_||ka(e,{top:t}),Eo(e,t,!0),_&&ka(e),dn(e,100)}function Eo(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+da(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?i:0,docHeight:r,scrollHeight:r+Mr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var pi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Re(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Re(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"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:i?r:0,bottom:t?r:0}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ae,this.disableVert=new ae},pi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),S=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hn=function(){};hn.prototype.update=function(){return{bottom:0,right:0}},hn.prototype.setScrollLeft=function(){},hn.prototype.setScrollTop=function(){},hn.prototype.clear=function(){};function Mi(e,t){t||(t=un(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Wn(e),So(e,un(e)),i=e.display.barWidth,r=e.display.barHeight}function So(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var To={native:pi,null:hn};function Co(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new To[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,i){i=="horizontal"?fi(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function mi(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},Sr(e.curOp)}function gi(e){var t=e.curOp;t&&Os(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var S=0;S<t.length;S++)il(t[S]);for(var j=0;j<t.length;j++)nl(t[j])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Nn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new zn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Wn(t),e.barMeasure=un(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Mr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-ui(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==B();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Mi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&vo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,ct(r,e.scrollToPos.from),ct(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var S=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(S)for(var X=0;X<S.length;++X)S[X].lines.length||oe(S[X],"hide");if(j)for(var J=0;J<j.length;++J)j[J].lines.length&&oe(j[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function pr(e,t){if(e.curOp)return t();mi(e);try{return t()}finally{gi(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mi(e);try{return t.apply(e,arguments)}finally{gi(e)}}}function nr(e){return function(){if(this.curOp)return e.apply(this,arguments);mi(this);try{return e.apply(this,arguments)}finally{gi(this)}}}function Kt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mi(t);try{return e.apply(this,arguments)}finally{gi(t)}}}function dn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Cr(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var j=S.styles,X=S.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,J=Ki(e,S,r,!0);X&&(r.state=X),S.styles=J.styles;var re=S.styleClasses,ce=J.classes;ce?S.styleClasses=ce:re&&(S.styleClasses=null);for(var ge=!j||j.length!=S.styles.length||re!=ce&&(!re||!ce||re.bgClass!=ce.bgClass||re.textClass!=ce.textClass),we=0;!ge&&we<j.length;++we)ge=j[we]!=S.styles[we];ge&&n.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&Vi(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return dn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&pr(e,function(){for(var S=0;S<n.length;S++)Xr(e,n[S],"text")})}var zn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Hn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ui(e),this.force=i,this.dims=ba(e),this.events=[]};zn.prototype.signal=function(e,t){ne(e,t)&&this.events.push(arguments)},zn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)oe.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=Mr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Mr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=B();if(!t||!E(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==B())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Yr(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&po(e)==0)return!1;ko(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<S&&S-i.viewFrom<20&&(S=Math.max(r.first,i.viewFrom)),i.viewTo>j&&i.viewTo-j<20&&(j=Math.min(n,i.viewTo)),ir&&(S=Qi(e.doc,S),j=Vr(e.doc,j));var X=S!=i.viewFrom||j!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,S,j),i.viewOffset=Lr(Ze(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=po(e);if(!X&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),p(i.cursorDiv),p(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,X&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,dn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+da(e.display)-ca(e),i.top)}),t.visible=Hn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hn(e.display,e.doc,i));if(!Aa(e,t))break;Wn(e);var n=un(e);on(e),Mi(e,n),Da(e,n),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 ka(e,t){var i=new zn(e,t);if(Aa(e,i)){Wn(e),wo(e,i);var r=un(e);on(e),Mi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,S=r.lineDiv,j=S.firstChild;function X(Ie){var Ne=Ie.nextSibling;return F&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Ne}for(var J=r.view,re=r.viewFrom,ce=0;ce<J.length;ce++){var ge=J[ce];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=S){var we=Ns(e,ge,re,i);S.insertBefore(we,j)}else{for(;j!=ge.node;)j=X(j);var Ce=n&&t!=null&&t<=re&&ge.lineNumber;ge.changes&&(he(ge.changes,"gutter")>-1&&(Ce=!1),Ya(e,ge,re,i)),Ce&&(p(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(Ut(e.options,re)))),j=ge.node.nextSibling}re+=ge.size}for(;j;)j=X(j)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Mr(e)+"px"}function Ao(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,S=r+"px",j=0;j<i.length;j++)if(!i[j].hidden){e.options.fixedGutter&&(i[j].gutter&&(i[j].gutter.style.left=S),i[j].gutterBackground&&(i[j].gutterBackground.style.left=S));var X=i[j].alignable;if(X)for(var J=0;J<X.length;J++)X[J].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Ut(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=n.firstChild.offsetWidth,j=n.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var S=e[n],j=null;if(typeof S!="string"&&(j=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:S,style:j})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Lo(e){var t=e.gutters,i=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],S=n.className,j=n.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+S));j&&(X.style.cssText=j),S=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function cn(e){Lo(e.display),lr(e),Ao(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=b("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=b("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var S=b("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[S],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!F&&!(_&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Ra(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var Kn=0,br=null;G?br=-.53:_?br=15:y?br=-.7:I&&(br=-1/3);function Do(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Do(e);return t.x*=br,t.y*=br,t}function Ro(e,t){var i=Do(t),r=i.x,n=i.y,S=e.display,j=S.scroller,X=j.scrollWidth>j.clientWidth,J=j.scrollHeight>j.clientHeight;if(!(r&&X||n&&J))return;if(n&&l&&F){e:for(var re=t.target,ce=S.view;re!=j;re=re.parentNode)for(var ge=0;ge<ce.length;ge++)if(ce[ge].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!_&&!T&&br!=null){n&&J&&ln(e,Math.max(0,j.scrollTop+n*br)),fi(e,Math.max(0,j.scrollLeft+r*br)),(!n||n&&J)&&te(t),S.wheelStartX=null;return}if(n&&br!=null){var we=n*br,Ce=e.doc.scrollTop,Ie=Ce+S.wrapper.clientHeight;we<0?Ce=Math.max(0,Ce+we-50):Ie=Math.min(e.doc.height,Ie+we+50),ka(e,{top:Ce,bottom:Ie})}Kn<20&&(S.wheelStartX==null?(S.wheelStartX=j.scrollLeft,S.wheelStartY=j.scrollTop,S.wheelDX=r,S.wheelDY=n,setTimeout(function(){if(S.wheelStartX==null)return;var Ne=j.scrollLeft-S.wheelStartX,je=j.scrollTop-S.wheelStartY,Ke=je&&S.wheelDY&&je/S.wheelDY||Ne&&S.wheelDX&&Ne/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!Ke)return;br=(br*Kn+Ke)/(Kn+1),++Kn},200)):(S.wheelDX+=r,S.wheelDY+=n))}var xr=function(e,t){this.ranges=e,this.primIndex=t};xr.prototype.primary=function(){return this.ranges[this.primIndex]},xr.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 i=this.ranges[t],r=e.ranges[t];if(!ri(i.anchor,r.anchor)||!ri(i.head,r.head))return!1}return!0},xr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Rt(bi(this.ranges[t].anchor),bi(this.ranges[t].head));return new xr(e,this.primIndex)},xr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},xr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return i}return-1};var Rt=function(e,t){this.anchor=e,this.head=t};Rt.prototype.from=function(){return ii(this.anchor,this.head)},Rt.prototype.to=function(){return xi(this.anchor,this.head)},Rt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Rr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(we,Ce){return ht(we.from(),Ce.from())}),i=he(t,n);for(var S=1;S<t.length;S++){var j=t[S],X=t[S-1],J=ht(X.to(),j.from());if(r&&!j.empty()?J>0:J>=0){var re=ii(X.from(),j.from()),ce=xi(X.to(),j.to()),ge=X.empty()?j.from()==j.head:X.from()==X.head;S<=i&&--i,t.splice(--S,2,new Rt(ge?ce:re,ge?re:ce))}}return new xr(t,i)}function $r(e,t){return new xr([new Rt(e,t||e)],0)}function Zr(e){return e.text?Fe(e.from.line+e.text.length-1,s(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Oo(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Zr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Zr(t).ch-t.to.ch),Fe(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Rt(Oo(n.anchor,t),Oo(n.head,t)))}return Rr(e.cm,i,e.sel.primIndex)}function _o(e,t,i){return e.line==t.line?Fe(i.line,e.ch-t.ch+i.ch):Fe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Fe(e.first,0),S=n,j=0;j<t.length;j++){var X=t[j],J=_o(X.from,n,S),re=_o(Zr(X),n,S);if(n=X.to,S=re,i=="around"){var ce=e.sel.ranges[j],ge=ht(ce.head,ce.anchor)<0;r[j]=new Rt(ge?re:J,ge?J:re)}else r[j]=new Rt(J,J)}return new xr(r,e.sel.primIndex)}function _a(e){e.doc.mode=gr(e.options,e.doc.modeOption),fn(e)}function fn(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,dn(e,100),e.state.modeGen++,e.curOp&&lr(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&s(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(Qe){return i?i[Qe]:null}function S(Qe,Ve,et){ua(Qe,Ve,et,r),Jt(Qe,"change",Qe,t)}function j(Qe,Ve){for(var et=[],ut=Qe;ut<Ve;++ut)et.push(new li(re[ut],n(ut),r));return et}var X=t.from,J=t.to,re=t.text,ce=Ze(e,X.line),ge=Ze(e,J.line),we=s(re),Ce=n(re.length-1),Ie=J.line-X.line;if(t.full)e.insert(0,j(0,re.length)),e.remove(re.length,e.size-re.length);else if(Mo(e,t)){var Ne=j(0,re.length-1);S(ge,ge.text,Ce),Ie&&e.remove(X.line,Ie),Ne.length&&e.insert(X.line,Ne)}else if(ce==ge)if(re.length==1)S(ce,ce.text.slice(0,X.ch)+we+ce.text.slice(J.ch),Ce);else{var je=j(1,re.length-1);je.push(new li(we+ce.text.slice(J.ch),Ce,r)),S(ce,ce.text.slice(0,X.ch)+re[0],n(0)),e.insert(X.line+1,je)}else if(re.length==1)S(ce,ce.text.slice(0,X.ch)+re[0]+ge.text.slice(J.ch),n(0)),e.remove(X.line+1,Ie);else{S(ce,ce.text.slice(0,X.ch)+re[0],n(0)),S(ge,we+ge.text.slice(J.ch),Ce);var Ke=j(1,re.length-1);Ie>1&&e.remove(X.line+1,Ie-1),e.insert(X.line+1,Ke)}Jt(e,"change",e,t)}function Jr(e,t,i){function r(n,S,j){if(n.linked)for(var X=0;X<n.linked.length;++X){var J=n.linked[X];if(J.doc==S)continue;var re=j&&J.sharedHist;if(i&&!re)continue;t(J.doc,re),r(J.doc,n,re)}}r(e,null,!0)}function Po(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),_a(e),Io(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,lr(e)}function Io(e){(e.doc.direction=="rtl"?W:f)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){pr(e,function(){Io(e),lr(e)})}function Vn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Pa(e,t){var i={from:bi(t.from),to:Zr(t),text:wt(e,t.from,t.to)};return Fo(e,i,t.from.line,t.to.line+1),Jr(e,function(r){return Fo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=s(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),s(e.done);if(e.done.length&&!s(e.done).ranges)return s(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),s(e.done)}function Bo(e,t,i,r){var n=e.history;n.undone.length=0;var S=+new Date,j,X;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(n,n.lastOp==r)))X=s(j.changes),ht(t.from,t.to)==0&&ht(t.from,X.to)==0?X.to=Zr(t):j.changes.push(Pa(e,t));else{var J=s(n.done);for((!J||!J.ranges)&&Xn(e.sel,n.done),j={changes:[Pa(e,t)],generation:n.generation},n.done.push(j);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=S,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,X||oe(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,S=r&&r.origin;i==n.lastSelOp||S&&n.lastSelOrigin==S&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==S||ml(e,S,s(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=S,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Xn(e,t){var i=s(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Fo(e,t,i,r){var n=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((n||(n=t["spans_"+e.id]={}))[S]=j.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Uo(e,t){var i=yl(e,t),r=Ti(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var S=i[n],j=r[n];if(S&&j){e:for(var X=0;X<j.length;++X){for(var J=j[X],re=0;re<S.length;++re)if(S[re].marker==J.marker)continue e;S.push(J)}}else j&&(i[n]=j)}return i}function Pi(e,t,i){for(var r=[],n=0;n<e.length;++n){var S=e[n];if(S.ranges){r.push(i?xr.prototype.deepCopy.call(S):S);continue}var j=S.changes,X=[];r.push({changes:X});for(var J=0;J<j.length;++J){var re=j[J],ce=void 0;if(X.push({from:re.from,to:re.to,text:re.text}),t)for(var ge in re)(ce=ge.match(/^spans_(\d+)$/))&&(he(t,Number(ce[1]))>-1&&(s(X)[ge]=re[ge],delete re[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var S=ht(t,n)<0;S!=ht(i,n)<0?(n=t,t=i):S!=ht(t,i)<0&&(t=i)}return new Rt(n,t)}else return new Rt(i||t,t)}function Yn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),tr(e,new xr([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Ia(e.sel.ranges[S],t[S],null,n);var j=Rr(e.cm,r,e.sel.primIndex);tr(e,j,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,tr(e,Rr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){tr(e,$r(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var S=0;S<n.length;S++)this.ranges[S]=new Rt(ct(e,n[S].anchor),ct(e,n[S].head))},origin:i&&i.origin};return oe(e,"beforeSelectionChange",e,r),e.cm&&oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Rr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=s(r);n&&n.ranges?(r[r.length-1]=t,$n(e,t,i)):tr(e,t,i)}function tr(e,t,i){$n(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function $n(e,t,i){(ne(e,"beforeSelectionChange")||e.cm&&ne(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&_i(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ee(e.cm)),Jt(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,S=0;S<t.ranges.length;S++){var j=t.ranges[S],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],J=Zn(e,j.anchor,X&&X.anchor,i,r),re=Zn(e,j.head,X&&X.head,i,r);(n||J!=j.anchor||re!=j.head)&&(n||(n=t.ranges.slice(0,S)),n[S]=new Rt(J,re))}return n?Rr(e.cm,n,t.primIndex):t}function Ii(e,t,i,r,n){var S=Ze(e,t.line);if(S.markedSpans)for(var j=0;j<S.markedSpans.length;++j){var X=S.markedSpans[j],J=X.marker,re="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if((X.from==null||(re?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(ce?X.to>=t.ch:X.to>t.ch))){if(n&&(oe(J,"beforeCursorEnter"),J.explicitlyCleared))if(S.markedSpans){--j;continue}else break;if(!J.atomic)continue;if(i){var ge=J.find(r<0?1:-1),we=void 0;if((r<0?ce:re)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?S:null)),ge&&ge.line==t.line&&(we=ht(ge,i))&&(r<0?we<0:we>0))return Ii(e,ge,t,r,n)}var Ce=J.find(r<0?-1:1);return(r<0?re:ce)&&(Ce=Vo(e,Ce,r,Ce.line==t.line?S:null)),Ce?Ii(e,Ce,t,r,n):null}}return t}function Zn(e,t,i,r,n){var S=r||1,j=Ii(e,t,i,S,n)||!n&&Ii(e,t,i,S,!0)||Ii(e,t,i,-S,n)||!n&&Ii(e,t,i,-S,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ct(e,Fe(t.line-1)):null:i>0&&t.ch==(r||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+i)}function Xo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),xe)}function Yo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,S,j,X){n&&(r.from=ct(e,n)),S&&(r.to=ct(e,S)),j&&(r.text=j),X!==void 0&&(r.origin=X)}),oe(e,"beforeChange",e,r),e.cm&&oe(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 Ni(e,t,i){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Ni)(e,t,i);if(e.cm.state.suppressEdits)return}if((ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Zi&&!i&&Mn(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)$o(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var i=Oa(e,t);Bo(e,t,i,e.cm?e.cm.curOp.id:NaN),pn(e,t,i,Ti(e,t));var r=[];Jr(e,function(n,S){!S&&he(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),pn(n,t,null,Ti(n,t))})}function Jn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,S,j=e.sel,X=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,re=0;re<X.length&&!(S=X[re],i?S.ranges&&!S.equals(e.sel):!S.ranges);re++);if(re==X.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(S=X.pop(),S.ranges){if(Xn(S,J),i&&!S.equals(e.sel)){tr(e,S,{clearRedo:!1});return}j=S}else if(r){X.push(S);return}else break;var ce=[];Xn(j,J),J.push({changes:ce,generation:n.generation}),n.generation=S.generation||++n.maxGeneration;for(var ge=ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"),we=function(Ne){var je=S.changes[Ne];if(je.origin=t,ge&&!Yo(e,je,!1))return X.length=0,{};ce.push(Pa(e,je));var Ke=Ne?Oa(e,je):s(X);pn(e,je,Ke,Uo(e,je)),!Ne&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Zr(je)});var Qe=[];Jr(e,function(Ve,et){!et&&he(Qe,Ve.history)==-1&&(qo(Ve.history,je),Qe.push(Ve.history)),pn(Ve,je,null,Uo(Ve,je))})},Ce=S.changes.length-1;Ce>=0;--Ce){var Ie=we(Ce);if(Ie)return Ie.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new xr(c(e.sel.ranges,function(n){return new Rt(Fe(n.anchor.line+t,n.anchor.ch),Fe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){lr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Xr(e.cm,r,"gutter")}}function pn(e,t,i,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,pn)(e,t,i,r);if(t.to.line<e.first){Zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Zo(e,n),t={from:Fe(e.first,0),to:Fe(t.to.line+n,t.to.ch),text:[s(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Fe(S,Ze(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wt(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),$n(e,i,xe),e.cantEdit&&Zn(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,S=t.from,j=t.to,X=!1,J=S.line;e.options.lineWrapping||(J=mt(yr(Ze(r,S.line))),r.iter(J,j.line+1,function(Ce){if(Ce==n.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ee(e),Ma(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(J,S.line+t.text.length,function(Ce){var Ie=en(Ce);Ie>n.maxLineLength&&(n.maxLine=Ce,n.maxLineLength=Ie,n.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),aa(r,S.line),dn(e,400);var re=t.text.length-(j.line-S.line)-1;t.full?lr(e):S.line==j.line&&t.text.length==1&&!Mo(e.doc,t)?Xr(e,S.line,"text"):lr(e,S.line,j.line+1,re);var ce=ne(e,"changes"),ge=ne(e,"change");if(ge||ce){var we={from:S,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&Jt(e,"change",e,we),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function Bi(e,t,i,r,n){var S;r||(r=i),ht(r,i)<0&&(S=[r,i],i=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:i,to:r,text:t,origin:n})}function Jo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,i,r){for(var n=0;n<e.length;++n){var S=e[n],j=!0;if(S.ranges){S.copied||(S=e[n]=S.deepCopy(),S.copied=!0);for(var X=0;X<S.ranges.length;X++)Jo(S.ranges[X].anchor,t,i,r),Jo(S.ranges[X].head,t,i,r);continue}for(var J=0;J<S.changes.length;++J){var re=S.changes[J];if(i<re.from.line)re.from=Fe(re.from.line+r,re.from.ch),re.to=Fe(re.to.line+r,re.to.ch);else if(t<=re.to.line){j=!1;break}}j||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function mn(e,t,i,r){var n=t,S=t;return typeof t=="number"?S=Ze(e,Ei(e,t)):n=mt(t),n==null?null:(r(S,n)&&e.cm&&Xr(e.cm,n,i),S)}function gn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}gn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,at(n),Jt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function vn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}vn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var S=Math.min(t,n-e),j=r.height;if(r.removeInner(e,S),this.height-=j-r.height,n==S&&(this.children.splice(i--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gn))){var X=[];this.collapse(X),this.children=[new gn(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<=S){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var j=n.lines.length%25+25,X=j;X<n.lines.length;){var J=new gn(n.lines.slice(X,X+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,j),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new vn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=he(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new vn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<S){var j=Math.min(t,S-e);if(n.iterN(e,j,i))return!0;if((t-=j)==0)break;e=0}else e-=S}}};var yn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};yn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=mt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var S=nn(this);gt(i,Math.max(0,i.height-S)),e&&(pr(e,function(){es(e,i,-S),Xr(e,r,"widget")}),Jt(e,"lineWidgetCleared",e,this,r))},yn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=nn(this)-t;if(!n)return;_r(this.doc,r)||gt(r,r.height+n),i&&pr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),Jt(i,"lineWidgetChanged",i,e,mt(r))})},le(yn);function es(e,t,i){Lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function El(e,t,i,r){var n=new yn(e,i,r),S=e.cm;return S&&n.noHScroll&&(S.display.alignWidgets=!0),mn(e,t,"widget",function(j){var X=j.widgets||(j.widgets=[]);if(n.insertAt==null?X.push(n):X.splice(Math.min(X.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,S&&!_r(e,j)){var J=Lr(j)<e.scrollTop;gt(j,j.height+nn(n)),J&&wa(S,n.height),S.curOp.forceUpdate=!0}return!0}),S&&Jt(S,"lineWidgetAdded",S,n,typeof t=="number"?t:mt(t)),n}var ts=0,Qr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Qr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mi(e),ne(this,"clear")){var i=this.find();i&&Jt(this,"clear",i.from,i.to)}for(var r=null,n=null,S=0;S<this.lines.length;++S){var j=this.lines[S],X=kr(j.markedSpans,this);e&&!this.collapsed?Xr(e,mt(j),"text"):e&&(X.to!=null&&(n=mt(j)),X.from!=null&&(r=mt(j))),j.markedSpans=Ji(j.markedSpans,X),X.from==null&&this.collapsed&&!_r(this.doc,j)&&e&&gt(j,Di(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var re=yr(this.lines[J]),ce=en(re);ce>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&lr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&Jt(e,"markerCleared",e,this,r,n),t&&gi(e),this.parent&&this.parent.clear()},Qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var S=this.lines[n],j=kr(S.markedSpans,this);if(j.from!=null&&(i=Fe(t?S:mt(S),j.from),e==-1))return i;if(j.to!=null&&(r=Fe(t?S:mt(S),j.to),e==1))return r}return i&&{from:i,to:r}},Qr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;pr(r,function(){var n=t.line,S=mt(t.line),j=fa(r,S);if(j&&(no(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_r(i.doc,n)&&i.height!=null){var X=i.height;i.height=null;var J=nn(i)-X;J&&gt(n,n.height+J)}Jt(r,"markerChanged",r,e)})},Qr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||he(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Qr.prototype.detachLine=function(e){if(this.lines.splice(he(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},le(Qr);function Fi(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return zt(e.cm,Fi)(e,t,i,r,n);var S=new Qr(e,n),j=ht(t,i);if(r&&P(r,S,!1),j>0||j==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=b("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Pn(e,t.line,t,i,S)||t.line!=i.line&&Pn(e,i.line,t,i,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}S.addToHistory&&Bo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var X=t.line,J=e.cm,re;if(e.iter(X,i.line+1,function(ge){J&&S.collapsed&&!J.options.lineWrapping&&yr(ge)==J.display.maxLine&&(re=!0),S.collapsed&&X!=t.line&&gt(ge,0),sa(ge,new ai(S,X==t.line?t.ch:null,X==i.line?i.ch:null)),++X}),S.collapsed&&e.iter(t.line,i.line+1,function(ge){_r(e,ge)&&gt(ge,0)}),S.clearOnEnter&&Re(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++ts,S.atomic=!0),J){if(re&&(J.curOp.updateMaxLine=!0),S.collapsed)lr(J,t.line,i.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ce=t.line;ce<=i.line;ce++)Xr(J,ce,"text");S.atomic&&zo(J.doc),Jt(J,"markerAdded",J,S)}return S}var bn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};bn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Jt(this,"clear")},bn.prototype.find=function(e,t){return this.primary.find(e,t)},le(bn);function Sl(e,t,i,r,n){r=P(r),r.shared=!1;var S=[Fi(e,t,i,r,n)],j=S[0],X=r.widgetNode;return Jr(e,function(J){X&&(r.widgetNode=X.cloneNode(!0)),S.push(Fi(J,ct(J,t),ct(J,i),r,n));for(var re=0;re<J.linked.length;++re)if(J.linked[re].isParent)return;j=s(S)}),new bn(S,j)}function rs(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),S=e.clipPos(n.from),j=e.clipPos(n.to);if(ht(S,j)){var X=Fi(e,S,j,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],S=[n.primary.doc];Jr(n.primary.doc,function(J){return S.push(J)});for(var j=0;j<n.markers.length;j++){var X=n.markers[j];he(S,X.doc)==-1&&(X.parent=null,n.markers.splice(j--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,ur=function(e,t,i,r,n){if(!(this instanceof ur))return new ur(e,t,i,r,n);i==null&&(i=0),vn.call(this,[new gn([new li("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var S=Fe(i,0);this.sel=$r(S),this.history=new Vn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:S,to:S,text:e}),tr(this,$r(S),xe)};ur.prototype=N(vn.prototype,{constructor:ur,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Zt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Kt(function(e){var t=Fe(this.first,0),i=this.first+this.size-1;Ni(this,{from:t,to:Fe(i,Ze(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&sn(this.cm,0,0),tr(this,$r(t),xe)}),replaceRange:function(e,t,i,r){t=ct(this,t),i=i?ct(this,i):t,Bi(this,e,t,i,r)},getRange:function(e,t,i){var r=wt(this,ct(this,e),ct(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(vr(this,e))return Ze(this,e)},getLineNumber:function(e){return mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),yr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ct(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Kt(function(e,t,i){Wo(this,ct(this,typeof e=="number"?Fe(e,t||0):e),null,i)}),setSelection:Kt(function(e,t,i){Wo(this,ct(this,e),ct(this,t||e),i)}),extendSelection:Kt(function(e,t,i){Yn(this,ct(this,e),t&&ct(this,t),i)}),extendSelections:Kt(function(e,t){jo(this,Ue(this,e),t)}),extendSelectionsBy:Kt(function(e,t){var i=c(this.sel.ranges,e);jo(this,Ue(this,i),t)}),setSelections:Kt(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Rt(ct(this,e[n].anchor),ct(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),tr(this,Rr(this.cm,r,t),i)}),addSelection:Kt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Rt(ct(this,e),ct(this,t||e))),tr(this,Rr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=wt(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=wt(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:Kt(function(e,t,i){for(var r=[],n=this.sel,S=0;S<n.ranges.length;S++){var j=n.ranges[S];r[S]={from:j.from(),to:j.to(),text:this.splitLines(e[S]),origin:i}}for(var X=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)Ni(this,r[J]);X?Ho(this,X):this.cm&&_i(this.cm)}),undo:Kt(function(){Jn(this,"undo")}),redo:Kt(function(){Jn(this,"redo")}),undoSelection:Kt(function(){Jn(this,"undo",!0)}),redoSelection:Kt(function(){Jn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Vn(this.history.maxGeneration),Jr(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:Pi(this.history.done),undone:Pi(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=Pi(e.done.slice(0),null,!0),t.undone=Pi(e.undone.slice(0),null,!0)},setGutterMarker:Kt(function(e,t,i){return mn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Oe(n)&&(r.gutterMarkers=null),!0})}),clearGutter:Kt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&mn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Oe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!vr(this,e))return null;if(t=e,e=Ze(this,e),!e)return null}else if(t=mt(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:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(x(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[n];if(S)if(i==null)r[n]=null;else{var j=S.match(x(i));if(!j)return!1;var X=j.index+j[0].length;r[n]=S.slice(0,j.index)+(!j.index||X==S.length?"":" ")+S.slice(X)||null}else return!1;return!0})}),addLineWidget:Kt(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Fi(this,ct(this,e),ct(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ct(this,e),Fi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ct(this,e);var t=[],i=Ze(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ct(this,e),t=ct(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(S){var j=S.markedSpans;if(j)for(var X=0;X<j.length;X++){var J=j[X];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var S=n.text.length+r;if(S>e)return t=e,!0;e-=S,++i}),ct(this,Fe(i,t))},indexFromPos:function(e){e=ct(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new ur(Zt(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new ur(Zt(this,t,i),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}],Tl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof It&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Cl(rs(this));break}if(e.history==this.history){var r=[e.id];Jr(e,function(n){return r.push(n.id)},!0),e.history=new Vn(null),e.history.done=Pi(this.history.done,r),e.history.undone=Pi(this.history.undone,r)}},iterLinkedDocs:function(e){Jr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):nt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Kt(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)})}),ur.prototype.eachLine=ur.prototype.iter;var is=0;function Al(e){var t=this;if(ns(t),q(t,e)||Wr(t.display,e))return;te(e),G&&(is=+new Date);var i=di(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,S=Array(n),j=0,X=function(){++j==n&&zt(t,function(){i=ct(t.doc,i);var Ce={from:i,to:i,text:t.doc.splitLines(S.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ni(t.doc,Ce),Ho(t.doc,$r(ct(t.doc,i),ct(t.doc,Zr(Ce))))})()},J=function(Ce,Ie){if(t.options.allowDropFileTypes&&he(t.options.allowDropFileTypes,Ce.type)==-1){X();return}var Ne=new FileReader;Ne.onerror=function(){return X()},Ne.onload=function(){var je=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){X();return}S[Ie]=je,X()},Ne.readAsText(Ce)},re=0;re<r.length;re++)J(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),$n(t.doc,$r(i,i)),ge)for(var we=0;we<ge.length;++we)Bi(t.doc,"",ge[we].anchor,ge[we].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ce){}}}function kl(e,t){if(G&&(!e.state.draggingText||+new Date-is<100)){de(t);return}if(q(e,t)||Wr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!I){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),T&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=di(e,t);if(!i)return;var r=document.createDocumentFragment();go(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var S=0;S<i.length;S++)e(i[S])})}var os=!1;function Dl(){if(os)return;Rl(),os=!0}function Rl(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Ol)},100))}),Re(window,"blur",function(){return as(Oi)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qr={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"},xn=0;xn<10;xn++)qr[xn+48]=qr[xn+96]=String(xn);for(var Qn=65;Qn<=90;Qn++)qr[Qn]=String.fromCharCode(Qn);for(var En=1;En<=12;En++)qr[En+111]=qr[En+63235]="F"+En;var Hr={};Hr.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"},Hr.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"},Hr.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"},Hr.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"]},Hr.default=l?Hr.macDefault:Hr.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,S,j=0;j<t.length-1;j++){var X=t[j];if(/^(cmd|meta|m)$/i.test(X))S=!0;else if(/^a(lt)?$/i.test(X))i=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))n=!0;else throw new Error("Unrecognized modifier name: "+X)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ml(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=c(i.split(" "),_l),S=0;S<n.length;S++){var j=void 0,X=void 0;S==n.length-1?(X=n.join(" "),j=r):(X=n.slice(0,S+1).join(" "),j="...");var J=t[X];if(!J)t[X]=j;else if(J!=j)throw new Error("Inconsistent bindings for "+X)}delete e[i]}for(var re in t)e[re]=t[re];return e}function Ui(e,t,i,r){t=qn(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ui(e,t.fallthrough,i,r);for(var S=0;S<t.fallthrough.length;S++){var j=Ui(e,t.fallthrough[S],i,r);if(j)return j}}}function ss(e){var t=typeof e=="string"?e:qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(T&&e.keyCode==34&&e.char)return!1;var i=qr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function qn(e){return typeof e=="string"?Hr[e]:e}function ji(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var S=t(i[n]);r.length&&ht(S.from,s(r).to)<=0;){var j=r.pop();if(ht(j.from,S.from)<0){S.from=j.from;break}}r.push(S)}pr(e,function(){for(var X=r.length-1;X>=0;X--)Bi(e.doc,"",r[X].from,r[X].to,"+delete");_i(e)})}function Ba(e,t,i){var r=Pe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ba(e,t.ch,i);return r==null?null:new Fe(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var S=$e(i,t.doc.direction);if(S){var j=n<0?s(S):S[0],X=n<0==(j.level==1),J=X?"after":"before",re;if(j.level>0||t.doc.direction=="rtl"){var ce=Li(t,i);re=n<0?i.text.length-1:0;var ge=Pr(t,ce,re).top;re=He(function(we){return Pr(t,ce,we).top==ge},n<0==(j.level==1)?j.from:j.to-1,re),J=="before"&&(re=Ba(i,re,1))}else re=n<0?j.to:j.from;return new Fe(r,re,J)}}return new Fe(r,n<0?i.text.length:0,n<0?"before":"after")}function Pl(e,t,i,r){var n=$e(t,e.doc.direction);if(!n)return Fa(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var S=ze(n,i.ch,i.sticky),j=n[S];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>i.ch:j.from<i.ch))return Fa(t,i,r);var X=function(Ke,Qe){return Ba(t,Ke instanceof Fe?Ke.ch:Ke,Qe)},J,re=function(Ke){return e.options.lineWrapping?(J=J||Li(e,t),co(e,t,J,Ke)):{begin:0,end:t.text.length}},ce=re(i.sticky=="before"?X(i,-1):i.ch);if(e.doc.direction=="rtl"||j.level==1){var ge=j.level==1==r<0,we=X(i,ge?1:-1);if(we!=null&&(ge?we<=j.to&&we<=ce.end:we>=j.from&&we>=ce.begin)){var Ce=ge?"before":"after";return new Fe(i.line,we,Ce)}}var Ie=function(Ke,Qe,Ve){for(var et=function(Mt,Vt){return Vt?new Fe(i.line,X(Mt,1),"before"):new Fe(i.line,Mt,"after")};Ke>=0&&Ke<n.length;Ke+=Qe){var ut=n[Ke],st=Qe>0==(ut.level!=1),vt=st?Ve.begin:X(Ve.end,-1);if(ut.from<=vt&&vt<ut.to)return et(vt,st);if(vt=st?ut.from:X(ut.to,-1),Ve.begin<=vt&&vt<Ve.end)return et(vt,st)}},Ne=Ie(S+r,r,ce);if(Ne)return Ne;var je=r>0?ce.end:X(ce.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ne=Ie(r>0?0:n.length-1,r,re(je)),Ne)?Ne:null}var Sn={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return ji(e,function(t){if(t.empty()){var i=Ze(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ji(e,function(t){return{from:Fe(t.from().line,0),to:ct(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return ji(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ds(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 i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ds(e,t.head):r},Te)},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=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var S=i[n].from(),j=$(e.getLine(S.line),S.ch,r);t.push(z(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return pr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,S=Ze(e.doc,n.line).text;if(S){if(n.ch==S.length&&(n=new Fe(n.line,n.ch-1)),n.ch>0)n=new Fe(n.line,n.ch+1),e.replaceRange(S.charAt(n.ch-1)+S.charAt(n.ch-2),Fe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=Ze(e.doc,n.line-1).text;j&&(n=new Fe(n.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(n.line-1,j.length-1),n,"+transpose"))}}i.push(new Rt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return pr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);_i(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var i=Ze(e.doc,t),r=yr(i);return r!=i&&(t=mt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=Ze(e.doc,t),r=In(i);return r!=i&&(t=mt(r)),Ua(!0,e,i,t,-1)}function ds(e,t){var i=hs(e,t.line),r=Ze(e.doc,i.line),n=$e(r,e.doc.direction);if(!n||n[0].level==0){var S=Math.max(i.ch,r.text.search(/\S/)),j=t.line==i.line&&t.ch<=S&&t.ch;return Fe(i.line,j?0:S,i.sticky)}return i}function ea(e,t,i){if(typeof t=="string"&&(t=Sn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=De}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=Ui(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&Ui(t,e.options.extraKeys,i,e)||Ui(t,e.options.keyMap,i,e)}var Bl=new ae;function Tn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),cs(e,n+" "+t,i,r))return!0}return cs(e,t,i,r)}function cs(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Jt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(te(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Tn(e,"Shift-"+i,t,function(r){return ea(e,r,!0)})||Tn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Tn(e,i,t,function(r){return ea(e,r)}):!1}function Fl(e,t,i){return Tn(e,"'"+i+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=B(),q(t,e))return;G&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);T&&(ja=r?i:null,!r&&i==88&&!Tt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),_&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),qe(document,"keyup",i),qe(document,"mouseover",i))}Re(document,"keyup",i),Re(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),q(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Wr(t.display,e)||q(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(T&&i==ja){ja=null,te(e);return}if(T&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Fl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,i){this.time=e,this.pos=t,this.button=i};Wa.prototype.compare=function(e,t,i){return this.time+jl>e&&ht(t,this.pos)==0&&i==this.button};var Cn,wn;function Wl(e,t){var i=+new Date;return wn&&wn.compare(i,e,t)?(Cn=wn=null,"triple"):Cn&&Cn.compare(i,e,t)?(wn=new Wa(i,e,t),Cn=null,"double"):(Cn=new Wa(i,e,t),wn=null,"single")}function vs(e){var t=this,i=t.display;if(q(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Wr(i,e)){F||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=di(t,e),n=Ee(e),S=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,S,e))return;n==1?r?zl(t,r,S,e):ve(e)==i.scroller&&te(e):n==2?(r&&Yn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(k?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Tn(e,ls(S,n),n,function(j){if(typeof j=="string"&&(j=Sn[j]),!j)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=j(e,i)!=De}finally{e.state.suppressEdits=!1}return X})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var S=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(M(vo,e),0):e.curOp.focus=B();var n=Gl(e,i,r),S=e.doc.sel,j;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(j=S.contains(t))>-1&&(ht((j=S.ranges[j]).from(),t)<0||t.xRel>0)&&(ht(j.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,S=!1,j=zt(e,function(re){F&&(n.scroller.draggable=!1),e.state.draggingText=!1,qe(n.wrapper.ownerDocument,"mouseup",j),qe(n.wrapper.ownerDocument,"mousemove",X),qe(n.scroller,"dragstart",J),qe(n.scroller,"drop",j),S||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),F&&!I||G&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),X=function(re){S=S||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},J=function(){return S=!0};F&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Re(n.wrapper.ownerDocument,"mouseup",j),Re(n.wrapper.ownerDocument,"mousemove",X),Re(n.scroller,"dragstart",J),Re(n.scroller,"drop",j),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Rt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Rt(Fe(t.line,0),ct(e.doc,Fe(t.line+1,0)));var r=i(e,t);return new Rt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,S=e.doc;te(t);var j,X,J=S.sel,re=J.ranges;if(r.addNew&&!r.extend?(X=S.sel.contains(i),X>-1?j=re[X]:j=new Rt(i,i)):(j=S.sel.primary(),X=S.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new Rt(i,i)),i=di(e,t,!0,!0),X=-1;else{var ce=ys(e,i,r.unit);r.extend?j=Ia(j,ce.anchor,ce.head,r.extend):j=ce}r.addNew?X==-1?(X=re.length,tr(S,Rr(e,re.concat([j]),X),{scroll:!1,origin:"*mouse"})):re.length>1&&re[X].empty()&&r.unit=="char"&&!r.extend?(tr(S,Rr(e,re.slice(0,X).concat(re.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),J=S.sel):Na(S,X,j,ke):(X=0,tr(S,new xr([j],0),ke),J=S.sel);var ge=i;function we(Ve){if(ht(ge,Ve)==0)return;if(ge=Ve,r.unit=="rectangle"){for(var et=[],ut=e.options.tabSize,st=$(Ze(S,i.line).text,i.ch,ut),vt=$(Ze(S,Ve.line).text,Ve.ch,ut),Mt=Math.min(st,vt),Vt=Math.max(st,vt),Nt=Math.min(i.line,Ve.line),mr=Math.min(e.lastLine(),Math.max(i.line,Ve.line));Nt<=mr;Nt++){var hr=Ze(S,Nt).text,jt=Se(hr,Mt,ut);Mt==Vt?et.push(new Rt(Fe(Nt,jt),Fe(Nt,jt))):hr.length>jt&&et.push(new Rt(Fe(Nt,jt),Fe(Nt,Se(hr,Vt,ut))))}et.length||et.push(new Rt(i,i)),tr(S,Rr(e,J.ranges.slice(0,X).concat(et),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var dr=j,Qt=ys(e,Ve,r.unit),Gt=dr.anchor,Wt;ht(Qt.anchor,Gt)>0?(Wt=Qt.head,Gt=ii(dr.from(),Qt.anchor)):(Wt=Qt.anchor,Gt=xi(dr.to(),Qt.head));var Bt=J.ranges.slice(0);Bt[X]=Xl(e,new Rt(ct(S,Gt),Wt)),tr(S,Rr(e,Bt,X),ke)}}var Ce=n.wrapper.getBoundingClientRect(),Ie=0;function Ne(Ve){var et=++Ie,ut=di(e,Ve,!0,r.unit=="rectangle");if(!ut)return;if(ht(ut,ge)!=0){e.curOp.focus=B(),we(ut);var st=Hn(n,S);(ut.line>=st.to||ut.line<st.from)&&setTimeout(zt(e,function(){Ie==et&&Ne(Ve)}),150)}else{var vt=Ve.clientY<Ce.top?-20:Ve.clientY>Ce.bottom?20:0;vt&&setTimeout(zt(e,function(){if(Ie!=et)return;n.scroller.scrollTop+=vt,Ne(Ve)}),50)}}function je(Ve){e.state.selectingText=!1,Ie=Infinity,Ve&&(te(Ve),n.input.focus()),qe(n.wrapper.ownerDocument,"mousemove",Ke),qe(n.wrapper.ownerDocument,"mouseup",Qe),S.history.lastSelOrigin=null}var Ke=zt(e,function(Ve){Ve.buttons===0||!Ee(Ve)?je(Ve):Ne(Ve)}),Qe=zt(e,je);e.state.selectingText=Qe,Re(n.wrapper.ownerDocument,"mousemove",Ke),Re(n.wrapper.ownerDocument,"mouseup",Qe)}function Xl(e,t){var i=t.anchor,r=t.head,n=Ze(e.doc,i.line);if(ht(i,r)==0&&i.sticky==r.sticky)return t;var S=$e(n);if(!S)return t;var j=ze(S,i.ch,i.sticky),X=S[j];if(X.from!=i.ch&&X.to!=i.ch)return t;var J=j+(X.from==i.ch==(X.level!=1)?0:1);if(J==0||J==S.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=ze(S,r.ch,r.sticky),ge=ce-j||(r.ch-i.ch)*(X.level==1?-1:1);ce==J-1||ce==J?re=ge<0:re=ge>0}var we=S[J+(re?-1:0)],Ce=re==(we.level==1),Ie=Ce?we.from:we.to,Ne=Ce?"after":"before";return i.ch==Ie&&i.sticky==Ne?t:new Rt(new Fe(i.line,Ie,Ne),r)}function bs(e,t,i,r){var n,S;if(t.touches)n=t.touches[0].clientX,S=t.touches[0].clientY;else try{n=t.clientX,S=t.clientY}catch(we){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var j=e.display,X=j.lineDiv.getBoundingClientRect();if(S>X.bottom||!ne(e,i))return ue(t);S-=X.top-j.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var re=j.gutters.childNodes[J];if(re&&re.getBoundingClientRect().right>=n){var ce=Lt(e.doc,S),ge=e.display.gutterSpecs[J];return oe(e,i,e,ce,ge.className,t),ue(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Wr(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ne(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Wi={toString:function(){return"CodeMirror.Init"}},Ss={},ta={};function $l(e){var t=e.optionHandlers;function i(r,n,S,j){e.defaults[r]=n,S&&(t[r]=j?function(X,J,re){re!=Wi&&S(X,J,re)}:S)}e.defineOption=i,e.Init=Wi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,_a(r)},!0),i("indentUnit",2,_a,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){fn(r),an(r),lr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var S=[],j=r.doc.first;r.doc.iter(function(J){for(var re=0;;){var ce=J.text.indexOf(n,re);if(ce==-1)break;re=ce+n.length,S.push(Fe(j,ce))}j++});for(var X=S.length-1;X>=0;X--)Bi(r.doc,n,S[X],Fe(S[X].line,S[X].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,S){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),S!=Wi&&r.refresh()}),i("specialCharPlaceholder",_t,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!C),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),cn(r)},!0),i("keyMap","default",function(r,n,S){var j=qn(n),X=S!=Wi&&qn(S);X&&X.detach&&X.detach(r,j),j.attach&&j.attach(r,X||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?xa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Mi(r)},!0),i("scrollbarStyle","native",function(r){Co(r),Mi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Ra(r.options.gutters,n),cn(r)},!0),i("firstLineNumber",1,cn,!0),i("lineNumberFormatter",function(r){return r},cn,!0),i("showCursorWhenSelecting",!1,on,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,on,!0),i("singleCursorHeightPerLine",!0,on,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,fn,!0),i("addModeClass",!1,fn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,fn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=Wi;if(!t!=!r){var n=e.display.dragFunctions,S=t?Re:qe;S(e.display.scroller,"dragstart",n.start),S(e.display.scroller,"dragenter",n.enter),S(e.display.scroller,"dragover",n.over),S(e.display.scroller,"dragleave",n.leave),S(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Ea(e),lr(e),an(e),setTimeout(function(){return Mi(e)},100)}function It(e,t){var i=this;if(!(this instanceof It))return new It(e,t);this.options=t=t?P(t):{},P(Ss,t,!1);var r=t.value;typeof r=="string"?r=new ur(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new It.inputStyles[t.inputStyle](this),S=this.display=new hl(e,r,n,t);S.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Co(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 ae,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),G&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),Dl(),mi(this),this.curOp.forceUpdate=!0,Po(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Oi(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Wi);ko(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ga.length;++X)Ga[X](this);gi(this),F&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}It.defaults=Ss,It.optionHandlers=ta;function Ql(e){var t=e.display;Re(t.scroller,"mousedown",zt(e,vs)),G&&H<11?Re(t.scroller,"dblclick",zt(e,function(J){if(q(e,J))return;var re=di(e,J);if(!re||Ha(e,J)||Wr(e.display,J))return;te(J);var ce=e.findWordAt(re);Yn(e.doc,ce.anchor,ce.head)})):Re(t.scroller,"dblclick",function(J){return q(e,J)||te(J)}),Re(t.scroller,"contextmenu",function(J){return xs(e,J)}),Re(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||xs(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(J){if(J.touches.length!=1)return!1;var re=J.touches[0];return re.radiusX<=1&&re.radiusY<=1}function j(J,re){if(re.left==null)return!0;var ce=re.left-J.left,ge=re.top-J.top;return ce*ce+ge*ge>20*20}Re(t.scroller,"touchstart",function(J){if(!q(e,J)&&!S(J)&&!Ha(e,J)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Re(t.scroller,"touchend",function(J){var re=t.activeTouch;if(re&&!Wr(t,J)&&re.left!=null&&!re.moved&&new Date-re.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!re.prev||j(re,re.prev)?ge=new Rt(ce,ce):!re.prev.prev||j(re,re.prev.prev)?ge=e.findWordAt(ce):ge=new Rt(Fe(ce.line,0),ct(e.doc,Fe(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(J)}n()}),Re(t.scroller,"touchcancel",n),Re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),oe(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(J){return Ro(e,J)}),Re(t.scroller,"DOMMouseScroll",function(J){return Ro(e,J)}),Re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){q(e,J)||de(J)},over:function(J){q(e,J)||(Ll(e,J),de(J))},start:function(J){return kl(e,J)},drop:zt(e,Al),leave:function(J){q(e,J)||ns(e)}};var X=t.input.getField();Re(X,"keyup",function(J){return ms.call(e,J)}),Re(X,"keydown",zt(e,ps)),Re(X,"keypress",zt(e,gs)),Re(X,"focus",function(J){return Ta(e,J)}),Re(X,"blur",function(J){return Oi(e,J)})}var Ga=[];It.defineInitHook=function(e){return Ga.push(e)};function An(e,t,i,r){var n=e.doc,S;i==null&&(i="add"),i=="smart"&&(n.mode.indent?S=Cr(e,t).state:i="prev");var j=e.options.tabSize,X=Ze(n,t),J=$(X.text,null,j);X.stateAfter&&(X.stateAfter=null);var re=X.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(X.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(S,X.text.slice(re.length),X.text),ce==De||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=$(Ze(n,t-1).text,null,j):ce=0:i=="add"?ce=J+e.options.indentUnit:i=="subtract"?ce=J-e.options.indentUnit:typeof i=="number"&&(ce=J+i),ce=Math.max(0,ce);var ge="",we=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(ce/j);Ce;--Ce)we+=j,ge+=" ";if(we<ce&&(ge+=z(ce-we)),ge!=re)return Bi(n,ge,Fe(t,0),Fe(t,re.length),"+input"),X.stateAfter=null,!0;for(var Ie=0;Ie<n.sel.ranges.length;Ie++){var Ne=n.sel.ranges[Ie];if(Ne.head.line==t&&Ne.head.ch<re.length){var je=Fe(t,re.length);Na(n,Ie,new Rt(je,je));break}}}var Or=null;function ra(e){Or=e}function za(e,t,i,r,n){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var j=+new Date-200,X=n=="paste"||e.state.pasteIncoming>j,J=nt(t),re=null;if(X&&r.ranges.length>1)if(Or&&Or.text.join(`
`)==t){if(r.ranges.length%Or.text.length==0){re=[];for(var ce=0;ce<Or.text.length;ce++)re.push(S.splitLines(Or.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=c(J,function(Ke){return[Ke]}));for(var ge=e.curOp.updateInput,we=r.ranges.length-1;we>=0;we--){var Ce=r.ranges[we],Ie=Ce.from(),Ne=Ce.to();Ce.empty()&&(i&&i>0?Ie=Fe(Ie.line,Ie.ch-i):e.state.overwrite&&!X?Ne=Fe(Ne.line,Math.min(Ze(S,Ne.line).text.length,Ne.ch+s(J).length)):X&&Or&&Or.lineWise&&Or.text.join(`
`)==J.join(`
`)&&(Ie=Ne=Fe(Ie.line,0)));var je={from:Ie,to:Ne,text:re?re[we%re.length]:J,origin:n||(X?"paste":e.state.cutIncoming>j?"cut":"+input")};Ni(e.doc,je),Jt(e,"inputRead",e,je)}t&&!X&&Cs(e,t),_i(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ts(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&pr(t,function(){return za(t,i,0,null,"paste")}),!0}function Cs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var S=e.getModeAt(n.head),j=!1;if(S.electricChars){for(var X=0;X<S.electricChars.length;X++)if(t.indexOf(S.electricChars.charAt(X))>-1){j=An(e,n.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(Ze(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=An(e,n.head.line,"smart")));j&&Jt(e,"electricInput",e,n.head.line)}}function ws(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,S={anchor:Fe(n,0),head:Fe(n+1,0)};i.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:i}}function As(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){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 F?e.style.width="1000px":e.setAttribute("wrap","off"),w&&(e.style.border="1px solid black"),As(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var S=this.options,j=S[r];if(S[r]==n&&r!="mode")return;S[r]=n,t.hasOwnProperty(r)&&zt(this,t[r])(this,n,j),oe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](qn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,S=0;S<n.length;++S)if(n[S]==r||n[S].name==r)return n.splice(S,1),!0},addOverlay:nr(function(r,n){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");R(this.state.overlays,{mode:S,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,lr(this)}),removeOverlay:nr(function(r){for(var n=this.state.overlays,S=0;S<n.length;++S){var j=n[S].modeSpec;if(j==r||typeof r=="string"&&j.name==r){n.splice(S,1),this.state.modeGen++,lr(this);return}}}),indentLine:nr(function(r,n,S){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),vr(this.doc,r)&&An(this,r,n,S)}),indentSelection:nr(function(r){for(var n=this.doc.sel.ranges,S=-1,j=0;j<n.length;j++){var X=n[j];if(X.empty())X.head.line>S&&(An(this,X.head.line,r,!0),S=X.head.line,j==this.doc.sel.primIndex&&_i(this));else{var J=X.from(),re=X.to(),ce=Math.max(S,J.line);S=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ge=ce;ge<S;++ge)An(this,ge,r);var we=this.doc.sel.ranges;J.ch==0&&n.length==we.length&&we[j].from().ch>0&&Na(this.doc,j,new Rt(J,we[j].to()),xe)}}}),getTokenAt:function(r,n){return Ln(this,r,n)},getLineTokens:function(r,n){return Ln(this,Fe(r),n,!0)},getTokenTypeAt:function(r){r=ct(this.doc,r);var n=ni(this,Ze(this.doc,r.line)),S=0,j=(n.length-1)/2,X=r.ch,J;if(X==0)J=n[2];else for(;;){var re=S+j>>1;if((re?n[re*2-1]:0)>=X)j=re;else if(n[re*2+1]<X)S=re+1;else{J=n[re*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var S=[];if(!i.hasOwnProperty(n))return S;var j=i[n],X=this.getModeAt(r);if(typeof X[n]=="string")j[X[n]]&&S.push(j[X[n]]);else if(X[n])for(var J=0;J<X[n].length;J++){var re=j[X[n][J]];re&&S.push(re)}else X.helperType&&j[X.helperType]?S.push(j[X.helperType]):j[X.name]&&S.push(j[X.name]);for(var ce=0;ce<j._global.length;ce++){var ge=j._global[ce];ge.pred(X,this)&&he(S,ge.val)==-1&&S.push(ge.val)}return S},getStateAfter:function(r,n){var S=this.doc;return r=Ei(S,r==null?S.first+S.size-1:r),Cr(this,r+1,n).state},cursorCoords:function(r,n){var S,j=this.doc.sel.primary();return r==null?S=j.head:typeof r=="object"?S=ct(this.doc,r):S=r?j.from():j.to(),Dr(this,S,n||"page")},charCoords:function(r,n){return ma(this,ct(this.doc,r),n||"page")},coordsChar:function(r,n){return r=lo(this,r,n||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,n){return r=lo(this,{top:r,left:0},n||"page").top,Lt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,S){var j=!1,X;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,j=!0),X=Ze(this.doc,r)}else X=r;return Fn(this,X,{top:0,left:0},n||"page",S||j).top+(j?this.doc.height-Lr(X):0)},defaultTextHeight:function(){return Di(this.display)},defaultCharWidth:function(){return Ri(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,S,j,X){var J=this.display;r=Dr(this,ct(this.doc,r));var re=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),j=="over")re=r.top;else if(j=="above"||j=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),we=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(j=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(re=r.bottom),ce+n.offsetWidth>we&&(ce=we-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",X=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(X=="left"?ce=0:X=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),S&&Zs(this,{left:ce,top:re,right:ce+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:nr(ps),triggerOnKeyPress:nr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:nr(vs),execCommand:function(r){if(Sn.hasOwnProperty(r))return Sn[r].call(null,this)},triggerElectric:nr(function(r){Cs(this,r)}),findPosH:function(r,n,S,j){var X=1;n<0&&(X=-1,n=-n);for(var J=ct(this.doc,r),re=0;re<n&&!(J=Ka(this.doc,J,X,S,j),J.hitSide);++re);return J},moveH:nr(function(r,n){var S=this;this.extendSelectionsBy(function(j){return S.display.shift||S.doc.extend||j.empty()?Ka(S.doc,j.head,r,n,S.options.rtlMoveVisually):r<0?j.from():j.to()},Te)}),deleteH:nr(function(r,n){var S=this.doc.sel,j=this.doc;S.somethingSelected()?j.replaceSelection("",null,"+delete"):ji(this,function(X){var J=Ka(j,X.head,r,n,!1);return r<0?{from:J,to:X.head}:{from:X.head,to:J}})}),findPosV:function(r,n,S,j){var X=1,J=j;n<0&&(X=-1,n=-n);for(var re=ct(this.doc,r),ce=0;ce<n;++ce){var ge=Dr(this,re,"div");if(J==null?J=ge.left:ge.left=J,re=Ls(this,ge,X,S),re.hitSide)break}return re},moveV:nr(function(r,n){var S=this,j=this.doc,X=[],J=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var ge=Dr(S,ce.head,"div");ce.goalColumn!=null&&(ge.left=ce.goalColumn),X.push(ge.left);var we=Ls(S,ge,r,n);return n=="page"&&ce==j.sel.primary()&&wa(S,ma(S,we,"div").top-ge.top),we},Te),X.length)for(var re=0;re<j.sel.ranges.length;re++)j.sel.ranges[re].goalColumn=X[re]}),findWordAt:function(r){var n=this.doc,S=Ze(n,r.line).text,j=r.ch,X=r.ch;if(S){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||X==S.length)&&j?--j:++X;for(var re=S.charAt(j),ce=Ae(re,J)?function(ge){return Ae(ge,J)}:/\s/.test(re)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Ae(ge)};j>0&&ce(S.charAt(j-1));)--j;for(;X<S.length&&ce(S.charAt(X));)++X}return new Rt(Fe(r.line,j),Fe(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==B()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:nr(function(r,n){sn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Mr(this)-this.display.barHeight,width:r.scrollWidth-Mr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:ui(this)}},scrollIntoView:nr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):xo(this,r.from,r.to,r.margin)}),setSize:nr(function(r,n){var S=this,j=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=j(r)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&ao(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(J){if(J.widgets){for(var re=0;re<J.widgets.length;re++)if(J.widgets[re].noHScroll){Xr(S,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,oe(this,"refresh",this)}),operation:function(r){return pr(this,r)},startOperation:function(){return mi(this)},endOperation:function(){return gi(this)},refresh:nr(function(){var r=this.display.cachedTextHeight;lr(this),this.curOp.forceUpdate=!0,an(this),sn(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Di(this.display))>.5||this.options.lineWrapping)&&Ea(this),oe(this,"refresh",this)}),swapDoc:nr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Po(this,r),an(this),this.display.input.reset(),sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Jt(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[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}},le(e),e.registerHelper=function(r,n,S){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=S},e.registerGlobalHelper=function(r,n,S,j){e.registerHelper(r,n,j),i[r]._global.push({pred:S,val:j})}}function Ka(e,t,i,r,n){var S=t,j=i,X=Ze(e,t.line),J=n&&e.direction=="rtl"?-i:i;function re(){var Qe=t.line+J;return Qe<e.first||Qe>=e.first+e.size?!1:(t=new Fe(Qe,t.ch,t.sticky),X=Ze(e,Qe))}function ce(Qe){var Ve;if(r=="codepoint"){var et=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(et)?Ve=null:Ve=new Fe(t.line,Math.max(0,Math.min(X.text.length,t.ch+i*(et>=55296&&et<56320?2:1))),-i)}else n?Ve=Pl(e.cm,X,t,i):Ve=Fa(X,t,i);if(Ve==null)if(!Qe&&re())t=Ua(n,e.cm,X,t.line,J);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var ge=null,we=r=="group",Ce=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(i<0&&!ce(!Ie));Ie=!1){var Ne=X.text.charAt(t.ch)||`
`,je=Ae(Ne,Ce)?"w":we&&Ne==`
`?"n":!we||/\s/.test(Ne)?null:"p";if(we&&!Ie&&!je&&(je="s"),ge&&ge!=je){i<0&&(i=1,ce(),t.sticky="after");break}if(je&&(ge=je),i>0&&!ce(!Ie))break}var Ke=Zn(e,t,S,j,!0);return ri(S,Ke)&&(Ke.hitSide=!0),Ke}function Ls(e,t,i,r){var n=e.doc,S=t.left,j;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(X-.5*Di(e.display),3);j=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(j=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,S,j),!re.outside);){if(i<0?j<=0:j>=n.height){re.hitSide=!0;break}j+=i*5}return re}var Ot=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ae,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ot.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;As(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(X){for(var J=X.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Re(n,"paste",function(X){if(!S(X)||q(r,X)||Ts(X,r))return;H<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),Re(n,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Re(n,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Re(n,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Re(n,"touchstart",function(){return i.forceCompositionEnd()}),Re(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(X){if(!S(X)||q(r,X))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=ws(r);ra({lineWise:!0,text:J.text}),X.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var re=Or.text.join(`
`);if(X.clipboardData.setData("Text",re),X.clipboardData.getData("Text")==re){X.preventDefault();return}}var ce=ks(),ge=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),ge.value=Or.text.join(`
`);var we=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(ce),we.focus(),we==n&&i.showPrimarySelection()},50)}Re(n,"copy",j),Re(n,"cut",j)},Ot.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ot.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ot.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ot.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ot.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var S=ia(t,e.anchorNode,e.anchorOffset),j=ia(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&j&&!j.bad&&ht(ii(S,j),r)==0&&ht(xi(S,j),n)==0)return;var X=t.display.view,J=r.line>=t.display.viewFrom&&Ds(t,r)||{node:X[0].measure.map[2],offset:0},re=n.line<t.display.viewTo&&Ds(t,n);if(!re){var ce=X[X.length-1].measure,ge=ce.maps?ce.maps[ce.maps.length-1]:ce.map;re={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!re){e.removeAllRanges();return}var we=e.rangeCount&&e.getRangeAt(0),Ce;try{Ce=m(J.node,J.offset,re.offset,re.node)}catch(Ie){}Ce&&(!_&&t.state.focused?(e.collapse(J.node,J.offset),Ce.collapsed||(e.removeAllRanges(),e.addRange(Ce))):(e.removeAllRanges(),e.addRange(Ce)),we&&e.anchorNode==null?e.addRange(we):_&&this.startGracePeriod()),this.rememberSelection()},Ot.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)},Ot.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Ot.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ot.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},Ot.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ot.prototype.blur=function(){this.div.blur()},Ot.prototype.getField=function(){return this.div},Ot.prototype.supportsTouch=function(){return!0},Ot.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():pr(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)},Ot.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ot.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&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 i=ia(t,e.anchorNode,e.anchorOffset),r=ia(t,e.focusNode,e.focusOffset);i&&r&&pr(t,function(){tr(t.doc,$r(i,r),xe),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ot.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,Ze(e.doc,r.line-1).length)),n.ch==Ze(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Fe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var S,j,X;r.line==t.viewFrom||(S=ci(e,r.line))==0?(j=mt(t.view[0].line),X=t.view[0].node):(j=mt(t.view[S].line),X=t.view[S-1].node.nextSibling);var J=ci(e,n.line),re,ce;if(J==t.view.length-1?(re=t.viewTo-1,ce=t.lineDiv.lastChild):(re=mt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!X)return!1;for(var ge=e.doc.splitLines(tu(e,X,ce,j,re)),we=wt(e.doc,Fe(j,0),Fe(re,Ze(e.doc,re).text.length));ge.length>1&&we.length>1;)if(s(ge)==s(we))ge.pop(),we.pop(),re--;else if(ge[0]==we[0])ge.shift(),we.shift(),j++;else break;for(var Ce=0,Ie=0,Ne=ge[0],je=we[0],Ke=Math.min(Ne.length,je.length);Ce<Ke&&Ne.charCodeAt(Ce)==je.charCodeAt(Ce);)++Ce;for(var Qe=s(ge),Ve=s(we),et=Math.min(Qe.length-(ge.length==1?Ce:0),Ve.length-(we.length==1?Ce:0));Ie<et&&Qe.charCodeAt(Qe.length-Ie-1)==Ve.charCodeAt(Ve.length-Ie-1);)++Ie;if(ge.length==1&&we.length==1&&j==r.line)for(;Ce&&Ce>r.ch&&Qe.charCodeAt(Qe.length-Ie-1)==Ve.charCodeAt(Ve.length-Ie-1);)Ce--,Ie++;ge[ge.length-1]=Qe.slice(0,Qe.length-Ie).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ce).replace(/\u200b+$/,"");var ut=Fe(j,Ce),st=Fe(re,we.length?s(we).length-Ie:0);if(ge.length>1||ge[0]||ht(ut,st))return Bi(e.doc,ge,ut,st,"+input"),!0},Ot.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ot.prototype.reset=function(){this.forceCompositionEnd()},Ot.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ot.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)},Ot.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&pr(this.cm,function(){return lr(e.cm)})},Ot.prototype.setUneditable=function(e){e.contentEditable="false"},Ot.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ot.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ot.prototype.onContextMenu=function(){},Ot.prototype.resetPosition=function(){},Ot.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=Ze(e.doc,t.line),n=eo(i,r,t.line),S=$e(r,e.doc.direction),j="left";if(S){var X=ze(S,t.ch);j=X%2?"right":"left"}var J=io(n.map,t.ch,j);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var S="",j=!1,X=e.doc.lineSeparator(),J=!1;function re(Ce){return function(Ie){return Ie.id==Ce}}function ce(){j&&(S+=X,J&&(S+=X),j=J=!1)}function ge(Ce){Ce&&(ce(),S+=Ce)}function we(Ce){if(Ce.nodeType==1){var Ie=Ce.getAttribute("cm-text");if(Ie){ge(Ie);return}var Ne=Ce.getAttribute("cm-marker"),je;if(Ne){var Ke=e.findMarks(Fe(r,0),Fe(n+1,0),re(+Ne));Ke.length&&(je=Ke[0].find(0))&&ge(wt(e.doc,je.from,je.to).join(X));return}if(Ce.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(Ce.nodeName);if(!/^br$/i.test(Ce.nodeName)&&Ce.textContent.length==0)return;Qe&&ce();for(var Ve=0;Ve<Ce.childNodes.length;Ve++)we(Ce.childNodes[Ve]);/^(pre|p)$/i.test(Ce.nodeName)&&(J=!0),Qe&&(j=!0)}else Ce.nodeType==3&&ge(Ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(we(t),t==i);)t=t.nextSibling,J=!1;return S}function ia(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Hi(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,i=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 n=0;n<e.display.view.length;n++){var S=e.display.view[n];if(S.node==r)return ru(S,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!E(r,t))return Hi(Fe(mt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var S=e.rest?s(e.rest):e.line;return Hi(Fe(mt(S),S.text.length),n)}var j=t.nodeType==3?t:null,X=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,i&&(i=j.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var J=e.measure,re=J.maps;function ce(je,Ke,Qe){for(var Ve=-1;Ve<(re?re.length:0);Ve++)for(var et=Ve<0?J.map:re[Ve],ut=0;ut<et.length;ut+=3){var st=et[ut+2];if(st==je||st==Ke){var vt=mt(Ve<0?e.line:e.rest[Ve]),Mt=et[ut]+Qe;return(Qe<0||st!=je)&&(Mt=et[ut+(Qe?1:0)]),Fe(vt,Mt)}}}var ge=ce(j,X,i);if(ge)return Hi(ge,n);for(var we=X.nextSibling,Ce=j?j.nodeValue.length-i:0;we;we=we.nextSibling){if(ge=ce(we,we.firstChild,0),ge)return Hi(Fe(ge.line,ge.ch-Ce),n);Ce+=we.textContent.length}for(var Ie=X.previousSibling,Ne=i;Ie;Ie=Ie.previousSibling){if(ge=ce(Ie,Ie.firstChild,-1),ge)return Hi(Fe(ge.line,ge.ch+Ne),n);Ne+=Ie.textContent.length}}var Ft=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ae,this.hasSelection=!1,this.composing=null};Ft.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),w&&(n.style.width="0px"),Re(n,"input",function(){G&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Re(n,"paste",function(j){if(q(r,j)||Ts(j,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function S(j){if(q(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ws(r);ra({lineWise:!0,text:X.text}),j.type=="cut"?r.setSelections(X.ranges,null,xe):(i.prevInput="",n.value=X.text.join(`
`),V(n))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(n,"cut",S),Re(n,"copy",S),Re(e.scroller,"paste",function(j){if(Wr(e,j)||q(r,j))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var X=new Event("paste");X.clipboardData=j.clipboardData,n.dispatchEvent(X)}),Re(e.lineSpace,"selectstart",function(j){Wr(e,j)||te(j)}),Re(n,"compositionstart",function(){var j=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Re(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Ft.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},Ft.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Dr(e,i.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+j.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+j.left-S.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ft.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),G&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&H>=9&&(this.hasSelection=null))},Ft.prototype.getField=function(){return this.textarea},Ft.prototype.supportsTouch=function(){return!1},Ft.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ft.prototype.blur=function(){this.textarea.blur()},Ft.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ft.prototype.receivedFocus=function(){this.slowPoll()},Ft.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()})},Ft.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Ft.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||tt(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(G&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=n.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,X=Math.min(r.length,n.length);j<X&&r.charCodeAt(j)==n.charCodeAt(j);)++j;return pr(t,function(){za(t,n.slice(j),r.length-j,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ft.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ft.prototype.onKeyPress=function(){G&&H>=9&&(this.hasSelection=null),this.fastPoll()},Ft.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=di(i,e),j=r.scroller.scrollTop;if(!S||T)return;var X=i.options.resetSelectionOnContextMenu;X&&i.doc.sel.contains(S)==-1&&zt(i,tr)(i.doc,$r(S),xe);var J=n.style.cssText,re=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.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 ge;F&&(ge=window.scrollY),r.input.focus(),F&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ce,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function we(){if(n.selectionStart!=null){var Ne=i.somethingSelected(),je="\u200B"+(Ne?n.value:"");n.value="\u21DA",n.value=je,t.prevInput=Ne?"":"\u200B",n.selectionStart=1,n.selectionEnd=je.length,r.selForContextMenu=i.doc.sel}}function Ce(){if(t.contextMenuPending!=Ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=J,G&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),n.selectionStart!=null){(!G||G&&H<9)&&we();var Ne=0,je=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?zt(i,Xo)(i):Ne++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(G&&H>=9&&we(),k){de(e);var Ie=function(){qe(window,"mouseup",Ie),setTimeout(Ce,20)};Re(window,"mouseup",Ie)}else setTimeout(Ce,50)},Ft.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ft.prototype.setUneditable=function(){},Ft.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?P(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 i=B();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=X.getValue()}var n;if(e.form&&(Re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;n=S.submit;try{var j=S.submit=function(){r(),S.submit=n,S.submit(),S.submit=j}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var X=It(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return X}function nu(e){e.off=qe,e.on=Re,e.wheelEventPixels=dl,e.Doc=ur,e.splitLines=nt,e.countColumn=$,e.findColumn=Se,e.isWordChar=be,e.Pass=De,e.signal=oe,e.Line=li,e.changeEnd=Zr,e.scrollbarModel=To,e.Pos=Fe,e.cmpPos=ht,e.modes=kt,e.mimeModes=Et,e.resolveMode=Yt,e.getMode=gr,e.modeExtensions=fr,e.extendMode=zr,e.copyState=$t,e.startState=ti,e.innerMode=Nr,e.commands=Sn,e.keyMap=Hr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Ui,e.normalizeKeyMap=Ml,e.StringStream=Pt,e.SharedTextMarker=bn,e.TextMarker=Qr,e.LineWidget=yn,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=de,e.addClass=W,e.contains=E,e.rmClass=f,e.keyNames=qr}$l(It),ql(It);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in ur.prototype)ur.prototype.hasOwnProperty(na)&&he(au,na)<0&&(It.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(ur.prototype[na]));return le(ur),It.inputStyles={textarea:Ft,contenteditable:Ot},It.defineMode=function(e){!It.defaults.mode&&e!="null"&&(It.defaults.mode=e),qt.apply(this,arguments)},It.defineMIME=Tr,It.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),It.defineMIME("text/plain","null"),It.defineExtension=function(e,t){It.prototype[e]=t},It.defineDocExtension=function(e,t){ur.prototype[e]=t},It.fromTextArea=iu,nu(It),It.version="5.58.2",It})},Y1PL:function(ft,it,pe){"use strict";pe.r(it),pe.d(it,"ResizableTextArea",function(){return he});var fe=pe("wx14"),Z=pe("1OyB"),_=pe("vuIU"),Q=pe("Ji7U"),U=pe("LK+K"),D=pe("q1tI"),G=pe("VTBJ"),H=pe("rePB"),F=pe("Zm9Q"),O=pe("Kwbf"),y=pe("c+Xe"),T=pe("m+aA"),I=pe("bdgK"),L=new Map;function A(xe){xe.forEach(function(ke){var Te,Se=ke.target;(Te=L.get(Se))===null||Te===void 0||Te.forEach(function(ye){return ye(Se)})})}var w=new I.default(A),d=null,o=null;function l(xe,ke){L.has(xe)||(L.set(xe,new Set),w.observe(xe)),L.get(xe).add(ke)}function u(xe,ke){L.has(xe)&&(L.get(xe).delete(ke),L.get(xe).size||(w.unobserve(xe),L.delete(xe)))}var C=function(xe){Object(Q.a)(Te,xe);var ke=Object(U.a)(Te);function Te(){return Object(Z.a)(this,Te),ke.apply(this,arguments)}return Object(_.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(D.Component),v=D.createContext(null);function g(xe){var ke=xe.children,Te=xe.onBatchResize,Se=D.useRef(0),ye=D.useRef([]),z=D.useContext(v),s=D.useCallback(function(c,R,Y){Se.current+=1;var N=Se.current;ye.current.push({size:c,element:R,data:Y}),Promise.resolve().then(function(){N===Se.current&&(Te==null||Te(ye.current),ye.current=[])}),z==null||z(c,R,Y)},[Te,z]);return D.createElement(v.Provider,{value:s},ke)}function k(xe){var ke=xe.children,Te=xe.disabled,Se=D.useRef(null),ye=D.useRef(null),z=D.useContext(v),s=D.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),c=D.isValidElement(ke)&&Object(y.c)(ke),R=c?ke.ref:null,Y=D.useMemo(function(){return Object(y.a)(R,Se)},[R,Se]),N=D.useRef(xe);N.current=xe;var se=D.useCallback(function(be){var Ae=N.current,Oe=Ae.onResize,Le=Ae.data,_e=be.getBoundingClientRect(),Pe=_e.width,He=_e.height,Ge=be.offsetWidth,Xe=be.offsetHeight,ze=Math.floor(Pe),ot=Math.floor(He);if(s.current.width!==ze||s.current.height!==ot||s.current.offsetWidth!==Ge||s.current.offsetHeight!==Xe){var $e={width:ze,height:ot,offsetWidth:Ge,offsetHeight:Xe};s.current=$e;var Je=Ge===Math.round(Pe)?Pe:Ge,Re=Xe===Math.round(He)?He:Xe,rt=Object(G.a)(Object(G.a)({},$e),{},{offsetWidth:Je,offsetHeight:Re});z==null||z(rt,be,Le),Oe&&Promise.resolve().then(function(){Oe(rt,be)})}},[]);return D.useEffect(function(){var be=Object(T.a)(Se.current)||Object(T.a)(ye.current);return be&&!Te&&l(be,se),function(){return u(be,se)}},[Se.current,Te]),D.createElement(C,{ref:ye},c?D.cloneElement(ke,{ref:Y}):ke)}var x="rc-observer-key";function f(xe){var ke=xe.children,Te=Object(F.a)(ke);return Te.map(function(Se,ye){var z=(Se==null?void 0:Se.key)||"".concat(x,"-").concat(ye);return D.createElement(k,Object(fe.a)({},xe,{key:z}),Se)})}f.Collection=g;var p=f,h=pe("bT9E"),a=pe("TSYQ"),b=pe.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
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],B={},W;function K(xe){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(ke&&B[Te])return B[Te];var Se=window.getComputedStyle(xe),ye=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),z=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),s=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),c=E.map(function(Y){return"".concat(Y,":").concat(Se.getPropertyValue(Y))}).join(";"),R={sizingStyle:c,paddingSize:z,borderSize:s,boxSizing:ye};return ke&&Te&&(B[Te]=R),R}function V(xe){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),xe.getAttribute("wrap")?W.setAttribute("wrap",xe.getAttribute("wrap")):W.removeAttribute("wrap");var ye=K(xe,ke),z=ye.paddingSize,s=ye.borderSize,c=ye.boxSizing,R=ye.sizingStyle;W.setAttribute("style","".concat(R,";").concat(m)),W.value=xe.value||xe.placeholder||"";var Y=Number.MIN_SAFE_INTEGER,N=Number.MAX_SAFE_INTEGER,se=W.scrollHeight,be;if(c==="border-box"?se+=s:c==="content-box"&&(se-=z),Te!==null||Se!==null){W.value=" ";var Ae=W.scrollHeight-z;Te!==null&&(Y=Ae*Te,c==="border-box"&&(Y=Y+z+s),se=Math.max(Y,se)),Se!==null&&(N=Ae*Se,c==="border-box"&&(N=N+z+s),be=se>N?"":"hidden",se=Math.min(N,se))}return{height:se,minHeight:Y,maxHeight:N,overflowY:be,resize:"none"}}var M=pe("Gytx"),P=pe.n(M),$;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})($||($={}));var ae=function(xe){Object(Q.a)(Te,xe);var ke=Object(U.a)(Te);function Te(Se){var ye;return Object(Z.a)(this,Te),ye=ke.call(this,Se),ye.nextFrameActionId=void 0,ye.resizeFrameId=void 0,ye.textArea=void 0,ye.saveTextArea=function(z){ye.textArea=z},ye.handleResize=function(z){var s=ye.state.resizeStatus,c=ye.props,R=c.autoSize,Y=c.onResize;if(s!==$.NONE)return;typeof Y=="function"&&Y(z),R&&ye.resizeOnNextFrame()},ye.resizeOnNextFrame=function(){cancelAnimationFrame(ye.nextFrameActionId),ye.nextFrameActionId=requestAnimationFrame(ye.resizeTextarea)},ye.resizeTextarea=function(){var z=ye.props.autoSize;if(!z||!ye.textArea)return;var s=z.minRows,c=z.maxRows,R=V(ye.textArea,!1,s,c);ye.setState({textareaStyles:R,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ye.resizeFrameId),ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.RESIZED},function(){ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.NONE}),ye.fixFirefoxAutoScroll()})})})})},ye.renderTextArea=function(){var z=ye.props,s=z.prefixCls,c=s===void 0?"rc-textarea":s,R=z.autoSize,Y=z.onResize,N=z.className,se=z.disabled,be=ye.state,Ae=be.textareaStyles,Oe=be.resizeStatus,Le=Object(h.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=b()(c,N,Object(H.a)({},"".concat(c,"-disabled"),se));"value"in Le&&(Le.value=Le.value||"");var Pe=Object(G.a)(Object(G.a)(Object(G.a)({},ye.props.style),Ae),Oe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return D.createElement(p,{onResize:ye.handleResize,disabled:!(R||Y)},D.createElement("textarea",Object(fe.a)({},Le,{className:_e,style:Pe,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:$.NONE},ye}return Object(_.a)(Te,[{key:"componentDidUpdate",value:function(ye){(ye.value!==this.props.value||!P()(ye.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 ye=this.textArea.selectionStart,z=this.textArea.selectionEnd;this.textArea.setSelectionRange(ye,z)}}catch(s){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(D.Component),he=ae,me=function(xe){Object(Q.a)(Te,xe);var ke=Object(U.a)(Te);function Te(Se){var ye;Object(Z.a)(this,Te),ye=ke.call(this,Se),ye.resizableTextArea=void 0,ye.focus=function(){ye.resizableTextArea.textArea.focus()},ye.saveTextArea=function(s){ye.resizableTextArea=s},ye.handleChange=function(s){var c=ye.props.onChange;ye.setValue(s.target.value,function(){ye.resizableTextArea.resizeTextarea()}),c&&c(s)},ye.handleKeyDown=function(s){var c=ye.props,R=c.onPressEnter,Y=c.onKeyDown;s.keyCode===13&&R&&R(s),Y&&Y(s)};var z=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return ye.state={value:z},ye}return Object(_.a)(Te,[{key:"setValue",value:function(ye,z){"value"in this.props||this.setState({value:ye},z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return D.createElement(he,Object(fe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ye){return"value"in ye?{value:ye.value}:null}}]),Te}(D.Component),De=it.default=me},Zss7:function(ft,it,pe){var fe;(function(Z){var _=/^\s+/,Q=/\s+$/,U=0,D=Z.round,G=Z.min,H=Z.max,F=Z.random;function O(s,c){if(s=s||"",c=c||{},s instanceof O)return s;if(!(this instanceof O))return new O(s,c);var R=y(s);this._originalInput=s,this._r=R.r,this._g=R.g,this._b=R.b,this._a=R.a,this._roundA=D(100*this._a)/100,this._format=c.format||R.format,this._gradientType=c.gradientType,this._r<1&&(this._r=D(this._r)),this._g<1&&(this._g=D(this._g)),this._b<1&&(this._b=D(this._b)),this._ok=R.ok,this._tc_id=U++}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 s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),c,R,Y,N,se,be;return c=s.r/255,R=s.g/255,Y=s.b/255,c<=.03928?N=c/12.92:N=Z.pow((c+.055)/1.055,2.4),R<=.03928?se=R/12.92:se=Z.pow((R+.055)/1.055,2.4),Y<=.03928?be=Y/12.92:be=Z.pow((Y+.055)/1.055,2.4),.2126*N+.7152*se+.0722*be},setAlpha:function(s){return this._a=V(s),this._roundA=D(100*this._a)/100,this},toHsv:function(){var s=A(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=A(this._r,this._g,this._b),c=D(s.h*360),R=D(s.s*100),Y=D(s.v*100);return this._a==1?"hsv("+c+", "+R+"%, "+Y+"%)":"hsva("+c+", "+R+"%, "+Y+"%, "+this._roundA+")"},toHsl:function(){var s=I(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=I(this._r,this._g,this._b),c=D(s.h*360),R=D(s.s*100),Y=D(s.l*100);return this._a==1?"hsl("+c+", "+R+"%, "+Y+"%)":"hsla("+c+", "+R+"%, "+Y+"%, "+this._roundA+")"},toHex:function(s){return d(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return o(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:D(this._r),g:D(this._g),b:D(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+D(this._r)+", "+D(this._g)+", "+D(this._b)+")":"rgba("+D(this._r)+", "+D(this._g)+", "+D(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:D(M(this._r,255)*100)+"%",g:D(M(this._g,255)*100)+"%",b:D(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%)":"rgba("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:W[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var c="#"+l(this._r,this._g,this._b,this._a),R=c,Y=this._gradientType?"GradientType = 1, ":"";if(s){var N=O(s);R="#"+l(N._r,N._g,N._b,N._a)}return"progid:DXImageTransform.Microsoft.gradient("+Y+"startColorstr="+c+",endColorstr="+R+")"},toString:function(s){var c=!!s;s=s||this._format;var R=!1,Y=this._a<1&&this._a>=0,N=!c&&Y&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return N?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(R=this.toRgbString()),s==="prgb"&&(R=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(R=this.toHexString()),s==="hex3"&&(R=this.toHexString(!0)),s==="hex4"&&(R=this.toHex8String(!0)),s==="hex8"&&(R=this.toHex8String()),s==="name"&&(R=this.toName()),s==="hsl"&&(R=this.toHslString()),s==="hsv"&&(R=this.toHsvString()),R||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(s,c){var R=s.apply(null,[this].concat([].slice.call(c)));return this._r=R._r,this._g=R._g,this._b=R._b,this.setAlpha(R._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function(s,c){return s.apply(null,[this].concat([].slice.call(c)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},O.fromRatio=function(s,c){if(typeof s=="object"){var R={};for(var Y in s)s.hasOwnProperty(Y)&&(Y==="a"?R[Y]=s[Y]:R[Y]=De(s[Y]));s=R}return O(s,c)};function y(s){var c={r:0,g:0,b:0},R=1,Y=null,N=null,se=null,be=!1,Ae=!1;return typeof s=="string"&&(s=ye(s)),typeof s=="object"&&(Se(s.r)&&Se(s.g)&&Se(s.b)?(c=T(s.r,s.g,s.b),be=!0,Ae=String(s.r).substr(-1)==="%"?"prgb":"rgb"):Se(s.h)&&Se(s.s)&&Se(s.v)?(Y=De(s.s),N=De(s.v),c=w(s.h,Y,N),be=!0,Ae="hsv"):Se(s.h)&&Se(s.s)&&Se(s.l)&&(Y=De(s.s),se=De(s.l),c=L(s.h,Y,se),be=!0,Ae="hsl"),s.hasOwnProperty("a")&&(R=s.a)),R=V(R),{ok:be,format:s.format||Ae,r:G(255,H(c.r,0)),g:G(255,H(c.g,0)),b:G(255,H(c.b,0)),a:R}}function T(s,c,R){return{r:M(s,255)*255,g:M(c,255)*255,b:M(R,255)*255}}function I(s,c,R){s=M(s,255),c=M(c,255),R=M(R,255);var Y=H(s,c,R),N=G(s,c,R),se,be,Ae=(Y+N)/2;if(Y==N)se=be=0;else{var Oe=Y-N;be=Ae>.5?Oe/(2-Y-N):Oe/(Y+N);switch(Y){case s:se=(c-R)/Oe+(c<R?6:0);break;case c:se=(R-s)/Oe+2;break;case R:se=(s-c)/Oe+4;break}se/=6}return{h:se,s:be,l:Ae}}function L(s,c,R){var Y,N,se;s=M(s,360),c=M(c,100),R=M(R,100);function be(Le,_e,Pe){return Pe<0&&(Pe+=1),Pe>1&&(Pe-=1),Pe<1/6?Le+(_e-Le)*6*Pe:Pe<1/2?_e:Pe<2/3?Le+(_e-Le)*(2/3-Pe)*6:Le}if(c===0)Y=N=se=R;else{var Ae=R<.5?R*(1+c):R+c-R*c,Oe=2*R-Ae;Y=be(Oe,Ae,s+1/3),N=be(Oe,Ae,s),se=be(Oe,Ae,s-1/3)}return{r:Y*255,g:N*255,b:se*255}}function A(s,c,R){s=M(s,255),c=M(c,255),R=M(R,255);var Y=H(s,c,R),N=G(s,c,R),se,be,Ae=Y,Oe=Y-N;if(be=Y===0?0:Oe/Y,Y==N)se=0;else{switch(Y){case s:se=(c-R)/Oe+(c<R?6:0);break;case c:se=(R-s)/Oe+2;break;case R:se=(s-c)/Oe+4;break}se/=6}return{h:se,s:be,v:Ae}}function w(s,c,R){s=M(s,360)*6,c=M(c,100),R=M(R,100);var Y=Z.floor(s),N=s-Y,se=R*(1-c),be=R*(1-N*c),Ae=R*(1-(1-N)*c),Oe=Y%6,Le=[R,be,se,se,Ae,R][Oe],_e=[Ae,R,R,be,se,se][Oe],Pe=[se,se,Ae,R,R,be][Oe];return{r:Le*255,g:_e*255,b:Pe*255}}function d(s,c,R,Y){var N=[me(D(s).toString(16)),me(D(c).toString(16)),me(D(R).toString(16))];return Y&&N[0].charAt(0)==N[0].charAt(1)&&N[1].charAt(0)==N[1].charAt(1)&&N[2].charAt(0)==N[2].charAt(1)?N[0].charAt(0)+N[1].charAt(0)+N[2].charAt(0):N.join("")}function o(s,c,R,Y,N){var se=[me(D(s).toString(16)),me(D(c).toString(16)),me(D(R).toString(16)),me(xe(Y))];return N&&se[0].charAt(0)==se[0].charAt(1)&&se[1].charAt(0)==se[1].charAt(1)&&se[2].charAt(0)==se[2].charAt(1)&&se[3].charAt(0)==se[3].charAt(1)?se[0].charAt(0)+se[1].charAt(0)+se[2].charAt(0)+se[3].charAt(0):se.join("")}function l(s,c,R,Y){var N=[me(xe(Y)),me(D(s).toString(16)),me(D(c).toString(16)),me(D(R).toString(16))];return N.join("")}O.equals=function(s,c){return!s||!c?!1:O(s).toRgbString()==O(c).toRgbString()},O.random=function(){return O.fromRatio({r:F(),g:F(),b:F()})};function u(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.s-=c/100,R.s=P(R.s),O(R)}function C(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.s+=c/100,R.s=P(R.s),O(R)}function v(s){return O(s).desaturate(100)}function g(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.l+=c/100,R.l=P(R.l),O(R)}function k(s,c){c=c===0?0:c||10;var R=O(s).toRgb();return R.r=H(0,G(255,R.r-D(255*-(c/100)))),R.g=H(0,G(255,R.g-D(255*-(c/100)))),R.b=H(0,G(255,R.b-D(255*-(c/100)))),O(R)}function x(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.l-=c/100,R.l=P(R.l),O(R)}function f(s,c){var R=O(s).toHsl(),Y=(R.h+c)%360;return R.h=Y<0?360+Y:Y,O(R)}function p(s){var c=O(s).toHsl();return c.h=(c.h+180)%360,O(c)}function h(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+120)%360,s:c.s,l:c.l}),O({h:(R+240)%360,s:c.s,l:c.l})]}function a(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+90)%360,s:c.s,l:c.l}),O({h:(R+180)%360,s:c.s,l:c.l}),O({h:(R+270)%360,s:c.s,l:c.l})]}function b(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+72)%360,s:c.s,l:c.l}),O({h:(R+216)%360,s:c.s,l:c.l})]}function m(s,c,R){c=c||6,R=R||30;var Y=O(s).toHsl(),N=360/R,se=[O(s)];for(Y.h=(Y.h-(N*c>>1)+720)%360;--c;)Y.h=(Y.h+N)%360,se.push(O(Y));return se}function E(s,c){c=c||6;for(var R=O(s).toHsv(),Y=R.h,N=R.s,se=R.v,be=[],Ae=1/c;c--;)be.push(O({h:Y,s:N,v:se})),se=(se+Ae)%1;return be}O.mix=function(s,c,R){R=R===0?0:R||50;var Y=O(s).toRgb(),N=O(c).toRgb(),se=R/100,be={r:(N.r-Y.r)*se+Y.r,g:(N.g-Y.g)*se+Y.g,b:(N.b-Y.b)*se+Y.b,a:(N.a-Y.a)*se+Y.a};return O(be)},O.readability=function(s,c){var R=O(s),Y=O(c);return(Z.max(R.getLuminance(),Y.getLuminance())+.05)/(Z.min(R.getLuminance(),Y.getLuminance())+.05)},O.isReadable=function(s,c,R){var Y=O.readability(s,c),N,se;se=!1,N=z(R);switch(N.level+N.size){case"AAsmall":case"AAAlarge":se=Y>=4.5;break;case"AAlarge":se=Y>=3;break;case"AAAsmall":se=Y>=7;break}return se},O.mostReadable=function(s,c,R){var Y=null,N=0,se,be,Ae,Oe;R=R||{},be=R.includeFallbackColors,Ae=R.level,Oe=R.size;for(var Le=0;Le<c.length;Le++)se=O.readability(s,c[Le]),se>N&&(N=se,Y=O(c[Le]));return O.isReadable(s,Y,{level:Ae,size:Oe})||!be?Y:(R.includeFallbackColors=!1,O.mostReadable(s,["#fff","#000"],R))};var B=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"},W=O.hexNames=K(B);function K(s){var c={};for(var R in s)s.hasOwnProperty(R)&&(c[s[R]]=R);return c}function V(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function M(s,c){ae(s)&&(s="100%");var R=he(s);return s=G(c,H(0,parseFloat(s))),R&&(s=parseInt(s*c,10)/100),Z.abs(s-c)<1e-6?1:s%c/parseFloat(c)}function P(s){return G(1,H(0,s))}function $(s){return parseInt(s,16)}function ae(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function he(s){return typeof s=="string"&&s.indexOf("%")!=-1}function me(s){return s.length==1?"0"+s:""+s}function De(s){return s<=1&&(s=s*100+"%"),s}function xe(s){return Z.round(parseFloat(s)*255).toString(16)}function ke(s){return $(s)/255}var Te=function(){var s="[-\\+]?\\d+%?",c="[-\\+]?\\d*\\.\\d+%?",R="(?:"+c+")|(?:"+s+")",Y="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",N="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?";return{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+Y),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+Y),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+Y),hsva:new RegExp("hsva"+N),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 Se(s){return!!Te.CSS_UNIT.exec(s)}function ye(s){s=s.replace(_,"").replace(Q,"").toLowerCase();var c=!1;if(B[s])s=B[s],c=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var R;return(R=Te.rgb.exec(s))?{r:R[1],g:R[2],b:R[3]}:(R=Te.rgba.exec(s))?{r:R[1],g:R[2],b:R[3],a:R[4]}:(R=Te.hsl.exec(s))?{h:R[1],s:R[2],l:R[3]}:(R=Te.hsla.exec(s))?{h:R[1],s:R[2],l:R[3],a:R[4]}:(R=Te.hsv.exec(s))?{h:R[1],s:R[2],v:R[3]}:(R=Te.hsva.exec(s))?{h:R[1],s:R[2],v:R[3],a:R[4]}:(R=Te.hex8.exec(s))?{r:$(R[1]),g:$(R[2]),b:$(R[3]),a:ke(R[4]),format:c?"name":"hex8"}:(R=Te.hex6.exec(s))?{r:$(R[1]),g:$(R[2]),b:$(R[3]),format:c?"name":"hex"}:(R=Te.hex4.exec(s))?{r:$(R[1]+""+R[1]),g:$(R[2]+""+R[2]),b:$(R[3]+""+R[3]),a:ke(R[4]+""+R[4]),format:c?"name":"hex8"}:(R=Te.hex3.exec(s))?{r:$(R[1]+""+R[1]),g:$(R[2]+""+R[2]),b:$(R[3]+""+R[3]),format:c?"name":"hex"}:!1}function z(s){var c,R;return s=s||{level:"AA",size:"small"},c=(s.level||"AA").toUpperCase(),R=(s.size||"small").toLowerCase(),c!=="AA"&&c!=="AAA"&&(c="AA"),R!=="small"&&R!=="large"&&(R="small"),{level:c,size:R}}ft.exports?ft.exports=O:!(fe=function(){return O}.call(it,pe,it,ft),fe!==void 0&&(ft.exports=fe))})(Math)},bT9E:function(ft,it,pe){"use strict";pe.d(it,"a",function(){return Z});var fe=pe("VTBJ");function Z(_,Q){var U=Object(fe.a)({},_);return Array.isArray(Q)&&Q.forEach(function(D){delete U[D]}),U}},c5Ni:function(ft,it,pe){},dejd:function(ft,it,pe){},dmUQ:function(ft,it,pe){"use strict";var fe=pe("Ff2n"),Z=pe("rePB"),_=pe("1OyB"),Q=pe("vuIU"),U=pe("Ji7U"),D=pe("md7G"),G=pe("foSv"),H=pe("q1tI"),F=pe.n(H),O=pe("TSYQ"),y=pe.n(O),T=pe("4IlW");function I(h,a){var b=Object.keys(h);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(h);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(h,E).enumerable})),b.push.apply(b,m)}return b}function L(h){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?I(Object(b),!0).forEach(function(m){Object(Z.a)(h,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(b)):I(Object(b)).forEach(function(m){Object.defineProperty(h,m,Object.getOwnPropertyDescriptor(b,m))})}return h}function A(h){var a=w();return function(){var m=Object(G.a)(h),E;if(a){var B=Object(G.a)(this).constructor;E=Reflect.construct(m,arguments,B)}else E=m.apply(this,arguments);return Object(D.a)(this,E)}}function w(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(h){return!1}}function d(){}function o(h){h.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,C=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},k=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},x=function(h){Object(U.a)(b,h);var a=A(b);function b(m){var E;Object(_.a)(this,b),E=a.call(this,m),E.onKeyDown=function(K){var V=E.props,M=V.onKeyDown,P=V.onPressEnter;if(K.keyCode===T.a.UP){var $=E.getRatio(K);E.up(K,$,null),E.stop()}else if(K.keyCode===T.a.DOWN){var ae=E.getRatio(K);E.down(K,ae,null),E.stop()}else K.keyCode===T.a.ENTER&&P&&P(K);if(E.recordCursorPosition(),E.lastKeyCode=K.keyCode,M){for(var he=arguments.length,me=new Array(he>1?he-1:0),De=1;De<he;De++)me[De-1]=arguments[De];M.apply(void 0,[K].concat(me))}},E.onKeyUp=function(K){var V=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),V){for(var M=arguments.length,P=new Array(M>1?M-1:0),$=1;$<M;$++)P[$-1]=arguments[$];V.apply(void 0,[K].concat(P))}},E.onChange=function(K){var V=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(K)),E.setState({inputValue:E.rawInput}),V(E.toNumber(E.rawInput))},E.onMouseUp=function(){var K=E.props.onMouseUp;E.recordCursorPosition(),K&&K.apply(void 0,arguments)},E.onFocus=function(){var K;E.setState({focused:!0}),(K=E.props).onFocus.apply(K,arguments)},E.onBlur=function(){var K=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var V=E.getCurrentValidValue(E.state.inputValue),M=E.setValue(V,d);if(K){var P=E.input.value,$=E.getInputDisplayValue({focus:!1,value:M});E.input.value=$&&Number($),K.apply(void 0,arguments),E.input.value=P}},E.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},E.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},E.getPrecision=function(K){if(g(E.props.precision))return E.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},E.getInputDisplayValue=function(K){var V=K||E.state,M=V.focused,P=V.inputValue,$=V.value,ae;M?ae=P:ae=E.toPrecisionAsStep($),ae==null&&(ae="");var he=E.formatWrapper(ae);return g(E.props.decimalSeparator)&&(he=he.toString().replace(".",E.props.decimalSeparator)),he},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(K){}},E.restoreByAfter=function(K){if(K===void 0)return!1;var V=E.input.value,M=V.lastIndexOf(K);if(M===-1)return!1;var P=E.cursorBefore.length;return E.lastKeyCode===T.a.DELETE&&E.cursorBefore.charAt(P-1)===K[0]?(E.fixCaret(P,P),!0):M+K.length===V.length?(E.fixCaret(M,M),!0):!1},E.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,M){var P=K.substring(M);return E.restoreByAfter(P)})},E.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(K,V,M){E.pressingUpOrDown=!0,E.step("down",K,V,M)},E.up=function(K,V,M){E.pressingUpOrDown=!0,E.step("up",K,V,M)},E.saveInput=function(K){E.input=K};var B=m.value;B===void 0&&(B=m.defaultValue),E.state={focused:m.autoFocus};var W=E.getValidValue(E.toNumber(B));return E.state=L(L({},E.state),{},{inputValue:E.toPrecisionAsStep(W),value:W}),E}return Object(Q.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var B=this.props,W=B.value,K=B.onChange,V=B.max,M=B.min,P=this.state.focused;if(E){if(!k(E.value,W)||!k(E.max,V)||!k(E.min,M)){var $=P?W:this.getValidValue(W),ae;this.pressingUpOrDown?ae=$:this.inputting?ae=this.rawInput:ae=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ae})}var he="value"in this.props?W:this.state.value;"max"in this.props&&E.max!==V&&typeof he=="number"&&he>V&&K&&K(V),"min"in this.props&&E.min!==M&&typeof he=="number"&&he<M&&K&&K(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var me=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?me=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(me=this.cursorStart):me=this.input.value.length,this.fixCaret(me,me)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(De){}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(E){var B=E;return B===""?B="":this.isNotCompleteNumber(parseFloat(B))?B=this.state.value:B=this.getValidValue(B),this.toNumber(B)}},{key:"getValueFromEvent",value:function(E){var B=E.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(B=B.replace(this.props.decimalSeparator,".")),B}},{key:"getValidValue",value:function(E){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(E);return isNaN(K)?E:(K<B&&(K=B),K>W&&(K=W),K)}},{key:"setValue",value:function(E,B){var W=this.props.precision,K=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),V=this.state.value,M=V===void 0?null:V,P=this.state.inputValue,$=P===void 0?null:P,ae=typeof K=="number"?K.toFixed(W):"".concat(K),he=K!==M||ae!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},B)):this.setState({value:K,inputValue:this.toPrecisionAsStep(E)},B),he&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(E){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,K=W.precision,V=W.step;if(g(K))return K;var M=this.getPrecision(B),P=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,M+P):M+P}},{key:"getPrecisionFactor",value:function(E){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(E,B);return Math.pow(10,W)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var B=Math.abs(this.getMaxPrecision(E));return isNaN(B)?E.toString():Number(E).toFixed(B)}},{key:"toNumber",value:function(E){var B=this.props.precision,W=this.state.focused,K=E&&E.length>16&&W;return this.isNotCompleteNumber(E)||K?E:g(B)?Math.round(E*Math.pow(10,B))/Math.pow(10,B):Number(E)}},{key:"upStep",value:function(E,B){var W=this.props.step,K=this.getPrecisionFactor(E,B),V=Math.abs(this.getMaxPrecision(E,B)),M=((K*E+K*W*B)/K).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(E,B){var W=this.props.step,K=this.getPrecisionFactor(E,B),V=Math.abs(this.getMaxPrecision(E,B)),M=((K*E-K*W*B)/K).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(E,B){var W=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),B&&(B.persist(),B.preventDefault());var M=this.props;if(M.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var $=this["".concat(E,"Step")](P,K),ae=$>M.max||$<M.min;if($>M.max?$=M.max:$<M.min&&($=M.min),this.setValue($,null),this.setState({focused:!0},function(){W.pressingUpOrDown=!1}),ae)return;this.autoStepTimer=setTimeout(function(){W[E](B,K,!0)},V?u:C)}},{key:"fixCaret",value:function(E,B){if(E===void 0||B===void 0||!this.input||!this.input.value)return;try{var W=this.input.selectionStart,K=this.input.selectionEnd;(E!==W||B!==K)&&this.input.setSelectionRange(E,B)}catch(V){}}},{key:"render",value:function(){var E,B=this.props,W=B.prefixCls,K=B.disabled,V=B.readOnly,M=B.useTouch,P=B.autoComplete,$=B.upHandler,ae=B.downHandler,he=B.className,me=B.max,De=B.min,xe=B.style,ke=B.title,Te=B.onMouseEnter,Se=B.onMouseLeave,ye=B.onMouseOver,z=B.onMouseOut,s=B.required,c=B.onClick,R=B.tabIndex,Y=B.type,N=B.placeholder,se=B.id,be=B.inputMode,Ae=B.pattern,Oe=B.step,Le=B.maxLength,_e=B.autoFocus,Pe=B.name,He=B.onPaste,Ge=B.onInput,Xe=Object(fe.a)(B,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),ze=this.state,ot=ze.value,$e=ze.focused,Je=y()(W,(E={},Object(Z.a)(E,he,!!he),Object(Z.a)(E,"".concat(W,"-disabled"),K),Object(Z.a)(E,"".concat(W,"-focused"),$e),E)),Re={};Object.keys(Xe).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(Re[de]=Xe[de])});var rt=!V&&!K,qe=this.getInputDisplayValue(null),oe=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=me),q=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=De),ee=oe||K||V,ne=q||K||V,le=y()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object(Z.a)({},"".concat(W,"-handler-up-disabled"),ee)),te=y()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object(Z.a)({},"".concat(W,"-handler-down-disabled"),ne)),ie=M?{onTouchStart:ee?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=M?{onTouchStart:ne?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ne?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return F.a.createElement("div",{className:Je,style:xe,title:ke,onMouseEnter:Te,onMouseLeave:Se,onMouseOver:ye,onMouseOut:z,onFocus:function(){return null},onBlur:function(){return null}},F.a.createElement("div",{className:"".concat(W,"-handler-wrap")},F.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:le}),$||F.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:o})),F.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":ne,className:te}),ae||F.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:o}))),F.a.createElement("div",{className:"".concat(W,"-input-wrap")},F.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":De,"aria-valuemax":me,"aria-valuenow":ot,required:s,type:Y,placeholder:N,onPaste:He,onClick:c,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:R,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:rt?this.onKeyDown:d,onKeyUp:rt?this.onKeyUp:d,autoFocus:_e,maxLength:Le,readOnly:V,disabled:K,max:me,min:De,step:Oe,name:Pe,title:ke,id:se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:Ae,inputMode:be,onInput:Ge},Re))))}}]),b}(F.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var f=x,p=it.a=f},gkVt:function(ft,it,pe){"use strict";pe.r(it);var fe=pe("DZo9"),Z=pe("8z0m"),_=pe("+L6B"),Q=pe("2/Rp"),U=pe("miYZ"),D=pe("tsqr"),G=pe("9og8"),H=pe("tJVT"),F=pe("WmNS"),O=pe.n(F),y=pe("q1tI"),T=pe.n(y),I=pe("5NDa"),L=pe("5rEg"),A=pe("Ot1p"),w=pe("ErOA");function d(h){var a=h.setIscreate,b=h.init,m=h.UpdateItem,E=Object(y.useState)(""),B=Object(H.a)(E,2),W=B[0],K=B[1],V=Object(y.useState)(""),M=Object(H.a)(V,2),P=M[0],$=M[1];Object(y.useEffect)(function(){if(!m)return;K(m&&m.name),$(m&&m.description)},[m]);function ae(){return he.apply(this,arguments)}function he(){return he=Object(G.a)(O.a.mark(function xe(){var ke;return O.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:if(W){Se.next=3;break}return D.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),Se.abrupt("return");case 3:if(P){Se.next=6;break}return D.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),Se.abrupt("return");case 6:if(!m){Se.next=9;break}return me(),Se.abrupt("return");case 9:return Se.next=11,Object(w.a)("/api/hpc_courses.json",{method:"post",body:{name:W,description:P,container_type:window.location.pathname.split("/")[1]}});case 11:ke=Se.sent,ke&&(D.b.info("\u521B\u5EFA\u6210\u529F"),a(!1),b("add"));case 13:case"end":return Se.stop()}},xe)})),he.apply(this,arguments)}function me(){return De.apply(this,arguments)}function De(){return De=Object(G.a)(O.a.mark(function xe(){var ke;return O.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,Object(w.a)("/api/hpc_courses/".concat(m.id,".json"),{method:"put",body:{name:W,description:P,container_type:window.location.pathname.split("/")[1]}});case 2:ke=Se.sent,ke&&(D.b.info("\u7F16\u8F91\u6210\u529F"),a(!1),b(""));case 4:case"end":return Se.stop()}},xe)})),De.apply(this,arguments)}return T.a.createElement("div",null,T.a.createElement(L.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:W,maxLength:60,addonAfter:String(W.length)+"/60",onChange:function(ke){return K(ke.target.value)}}),T.a.createElement(A.a,{id:"courseContentMD",defaultValue:P,onChange:function(ke){return $(ke)}}),T.a.createElement("div",{className:"clearfix mt30 mb30"},T.a.createElement(Q.a,{type:"primary",onClick:function(){return ae()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),T.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return a(!1)}},"\u53D6\u6D88")))}var o=d,l=pe("9Bee");function u(h){var a=h.CourseItem,b=h.userId,m=h.init,E=h.ItemUpdate,B=h.setSee,W=h.UserInfo;function K(){return V.apply(this,arguments)}function V(){return V=Object(G.a)(O.a.mark(function P(){var $;return O.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(w.a)("/api/hpc_courses/".concat(a.id,".json"),{method:"delete"});case 2:$=he.sent,$&&(D.b.info("\u5220\u9664\u6210\u529F"),m("delete"),B(!1));case 4:case"end":return he.stop()}},P)})),V.apply(this,arguments)}function M(){E(a)}return T.a.createElement("div",null,b===299635||b===301458||W!=null&&W.admin||W!=null&&W.business?T.a.createElement("div",{style:{textAlign:"right"}},T.a.createElement(Q.a,{onClick:function(){return M()}},"\u7F16\u8F91"),T.a.createElement(Q.a,{onClick:function(){return K()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,T.a.createElement("h1",null,a==null?void 0:a.name),T.a.createElement(l.a,{value:a==null?void 0:a.description}))}var C=u,v=pe("9ivq"),g=pe("m3rI"),k=pe("Ty5D"),x=pe("9kvl");function f(h){var a,b,m,E,B,W,K,V,M,P=h.user,$=h.dispatch,ae=Object(y.useState)(1),he=Object(H.a)(ae,2),me=he[0],De=he[1],xe=Object(y.useState)(100),ke=Object(H.a)(xe,2),Te=ke[0],Se=ke[1],ye=Object(y.useState)([]),z=Object(H.a)(ye,2),s=z[0],c=z[1],R=Object(y.useState)(!1),Y=Object(H.a)(R,2),N=Y[0],se=Y[1],be=Object(y.useState)(!1),Ae=Object(H.a)(be,2),Oe=Ae[0],Le=Ae[1],_e=Object(y.useState)(""),Pe=Object(H.a)(_e,2),He=Pe[0],Ge=Pe[1],Xe=Object(y.useState)(""),ze=Object(H.a)(Xe,2),ot=ze[0],$e=ze[1],Je=Object(y.useState)(""),Re=Object(H.a)(Je,2),rt=Re[0],qe=Re[1],oe=Object(k.i)(),q=oe.itemname,ee=Object(y.useState)(""),ne=Object(H.a)(ee,2),le=ne[0],te=ne[1];Object(y.useEffect)(function(){$({type:"globalSetting/headerToggle",payload:!1}),me&&ie("")},[me]);function ie(Be){return ue.apply(this,arguments)}function ue(){return ue=Object(G.a)(O.a.mark(function Be(Ye){var We,pt,nt,tt,Tt;return O.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return xt.next=2,Object(w.a)("/api/hpc_courses.json",{method:"get",params:{page:me,per_page:Te,container_type:window.location.pathname.split("/")[1]}});case 2:if(We=xt.sent,!We){xt.next=24;break}if(pt=We.data.hpc_courses.length,c(We.data.hpc_courses),qe(We.data.file_url),$e(""),pt){xt.next=10;break}return xt.abrupt("return");case 10:if(le){xt.next=14;break}q?(Tt=0,We==null||((nt=We.data)===null||nt===void 0||((tt=nt.hpc_courses)===null||tt===void 0))||tt.map(function(kt,Et){var qt;(q==null?void 0:q.toLocaleLowerCase())===(kt==null||((qt=kt.name)===null||qt===void 0)?void 0:qt.toLocaleLowerCase())&&(Tt=Et)}),Ge(We.data.hpc_courses[Tt]),Le(!0),te(We.data.hpc_courses[Tt].id),(q==null?void 0:q.toLocaleLowerCase())==="resources"&&(Ge(We.data.hpc_courses.filter(function(kt){return kt.id===15})[0]),Le(!0),te(15))):(Ge(We.data.hpc_courses[0]),Le(!0),te(We.data.hpc_courses[0].id)),xt.next=24;break;case 14:if(!(Ye==="delete")){xt.next=23;break}if(!(pt===0)){xt.next=18;break}return Le(!1),xt.abrupt("return");case 18:Ge(We.data.hpc_courses[0]),Le(!0),te(We.data.hpc_courses[0].id),xt.next=24;break;case 23:Ye==="add"?(Ge(We.data.hpc_courses[pt-1]),Le(!0),te(We.data.hpc_courses[pt-1].id)):(Ge(We.data.hpc_courses.filter(function(kt){return kt.id===le})[0]),Le(!0),te(le));case 24:case"end":return xt.stop()}},Be)})),ue.apply(this,arguments)}function de(Be){se(!1),Le(!0),Ge(Be),te(Be.id)}function ve(Be){$e(Be),se(!0),Le(!1)}function Ee(){$e(""),se(!0),Le(!1)}var Me={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(Ye){var We=Ye.file.status;We!=="uploading",We==="done"?(D.b.success("".concat(Ye.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),ie("")):We==="error"&&D.b.error("".concat(Ye.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Ye){var We=Ye.size/1024/1024<150;return We||D.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),We}};return T.a.createElement("div",{style:{marginBottom:"40px"}},T.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(g.a.IMG_SERVER+"/".concat(rt),")")}}),T.a.createElement("img",{style:{width:"100%"},src:g.a.IMG_SERVER+"/".concat(rt)}),T.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},T.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},s&&s.map(function(Be,Ye){return T.a.createElement("p",{key:Ye,onClick:function(){return de(Be)},className:le===Be.id?"menuitemselect":"menuitem task-hide"},Be.name)}),(P==null||((a=P.userInfo)===null||a===void 0)?void 0:a.user_id)===299635||(P==null||((b=P.userInfo)===null||b===void 0)?void 0:b.user_id)===301458||P!=null&&(m=P.userInfo)!==null&&m!==void 0&&m.admin||P!=null&&(E=P.userInfo)!==null&&E!==void 0&&E.business?T.a.createElement("p",{onClick:function(){return Ee()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},T.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),T.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},N?T.a.createElement(o,{UpdateItem:ot,setIscreate:se,init:ie}):null,Oe?T.a.createElement(C,{UserInfo:P==null?void 0:P.userInfo,setSee:Le,userId:P==null||((B=P.userInfo)===null||B===void 0)?void 0:B.user_id,ItemUpdate:ve,CourseItem:He,init:ie}):null)),(P==null||((W=P.userInfo)===null||W===void 0)?void 0:W.user_id)===299635||(P==null||((K=P.userInfo)===null||K===void 0)?void 0:K.user_id)===301458||P!=null&&(V=P.userInfo)!==null&&V!==void 0&&V.admin||P!=null&&(M=P.userInfo)!==null&&M!==void 0&&M.business?T.a.createElement(Z.a,Me,T.a.createElement(Q.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var p=it.default=Object(x.a)(function(h){var a=h.user;return{user:a}})(f)},h78n:function(ft,it,pe){"use strict";pe.d(it,"a",function(){return E});var fe=pe("q1tI"),Z=pe.n(fe),_=pe("TSYQ"),Q=pe.n(_),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},D=function(K){var V=K.map(function(){return Object(fe.useRef)()}),M=Object(fe.useRef)();return Object(fe.useEffect)(function(){var P=Date.now(),$=!1;Object.keys(V).forEach(function(ae){var he=V[ae].current;if(!he)return;$=!0;var me=he.style;me.transitionDuration=".3s, .3s, .3s, .06s",M.current&&P-M.current<100&&(me.transitionDuration="0s, 0s")}),$&&(M.current=Date.now())}),[V]};function G(){return G=Object.assign||function(W){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(W[M]=V[M])}return W},G.apply(this,arguments)}function H(W,K){return I(W)||T(W,K)||O(W,K)||F()}function F(){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(W,K){if(!W)return;if(typeof W=="string")return y(W,K);var V=Object.prototype.toString.call(W).slice(8,-1);if(V==="Object"&&W.constructor&&(V=W.constructor.name),V==="Map"||V==="Set")return Array.from(W);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(W,K)}function y(W,K){(K==null||K>W.length)&&(K=W.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=W[V];return M}function T(W,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var V=[],M=!0,P=!1,$=void 0;try{for(var ae=W[Symbol.iterator](),he;!(M=(he=ae.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(me){P=!0,$=me}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(P)throw $}}return V}function I(W){if(Array.isArray(W))return W}function L(W,K){if(W==null)return{};var V=A(W,K),M,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(P=0;P<$.length;P++){if(M=$[P],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,M))continue;V[M]=W[M]}}return V}function A(W,K){if(W==null)return{};var V={},M=Object.keys(W),P,$;for($=0;$<M.length;$++){if(P=M[$],K.indexOf(P)>=0)continue;V[P]=W[P]}return V}var w=function(K){var V=K.className,M=K.percent,P=K.prefixCls,$=K.strokeColor,ae=K.strokeLinecap,he=K.strokeWidth,me=K.style,De=K.trailColor,xe=K.trailWidth,ke=K.transition,Te=L(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Se=Array.isArray(M)?M:[M],ye=Array.isArray($)?$:[$],z=D(Se),s=H(z,1),c=s[0],R=he/2,Y=100-he/2,N="M ".concat(ae==="round"?R:0,",").concat(R,`
L `).concat(ae==="round"?Y:100,",").concat(R),se="0 0 100 ".concat(he),be=0;return Z.a.createElement("svg",G({className:Q()("".concat(P,"-line"),V),viewBox:se,preserveAspectRatio:"none",style:me},Te),Z.a.createElement("path",{className:"".concat(P,"-line-trail"),d:N,strokeLinecap:ae,stroke:De,strokeWidth:xe||he,fillOpacity:"0"}),Se.map(function(Ae,Oe){var Le={strokeDasharray:"".concat(Ae,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:ke||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},_e=ye[Oe]||ye[ye.length-1];return be+=Ae,Z.a.createElement("path",{key:Oe,className:"".concat(P,"-line-path"),d:N,strokeLinecap:ae,stroke:_e,strokeWidth:he,fillOpacity:"0",ref:c[Oe],style:Le})}))};w.defaultProps=U;var d=w;function o(){return o=Object.assign||function(W){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(W[M]=V[M])}return W},o.apply(this,arguments)}function l(W,K){return k(W)||g(W,K)||C(W,K)||u()}function u(){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 C(W,K){if(!W)return;if(typeof W=="string")return v(W,K);var V=Object.prototype.toString.call(W).slice(8,-1);if(V==="Object"&&W.constructor&&(V=W.constructor.name),V==="Map"||V==="Set")return Array.from(W);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(W,K)}function v(W,K){(K==null||K>W.length)&&(K=W.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=W[V];return M}function g(W,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var V=[],M=!0,P=!1,$=void 0;try{for(var ae=W[Symbol.iterator](),he;!(M=(he=ae.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(me){P=!0,$=me}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(P)throw $}}return V}function k(W){if(Array.isArray(W))return W}function x(W,K){if(W==null)return{};var V=f(W,K),M,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(P=0;P<$.length;P++){if(M=$[P],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,M))continue;V[M]=W[M]}}return V}function f(W,K){if(W==null)return{};var V={},M=Object.keys(W),P,$;for($=0;$<M.length;$++){if(P=M[$],K.indexOf(P)>=0)continue;V[P]=W[P]}return V}var p=0;function h(W){return+W.replace("%","")}function a(W){return Array.isArray(W)?W:[W]}function b(W,K,V,M){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ae=50-M/2,he=0,me=-ae,De=0,xe=-2*ae;switch($){case"left":he=-ae,me=0,De=2*ae,xe=0;break;case"right":he=ae,me=0,De=-2*ae,xe=0;break;case"bottom":me=ae,xe=2*ae;break;default:}var ke="M 50,50 m ".concat(he,",").concat(me,`
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(De,",").concat(-xe,`
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(-De,",").concat(xe),Te=Math.PI*2*ae,Se={stroke:V,strokeDasharray:"".concat(K/100*(Te-P),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(P/2+W/100*(Te-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ke,pathStyle:Se}}var m=function(K){var V=K.prefixCls,M=K.strokeWidth,P=K.trailWidth,$=K.gapDegree,ae=K.gapPosition,he=K.trailColor,me=K.strokeLinecap,De=K.style,xe=K.className,ke=K.strokeColor,Te=K.percent,Se=x(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ye=Object(fe.useMemo)(function(){return p+=1,p},[]),z=b(0,100,he,M,$,ae),s=z.pathString,c=z.pathStyle,R=a(Te),Y=a(ke),N=Y.find(function(Le){return Object.prototype.toString.call(Le)==="[object Object]"}),se=D(R),be=l(se,1),Ae=be[0],Oe=function(){var _e=0;return R.map(function(Pe,He){var Ge=Y[He]||Y[Y.length-1],Xe=Object.prototype.toString.call(Ge)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ye,")"):"",ze=b(_e,Pe,Ge,M,$,ae);return _e+=Pe,Z.a.createElement("path",{key:He,className:"".concat(V,"-circle-path"),d:ze.pathString,stroke:Xe,strokeLinecap:me,strokeWidth:M,opacity:Pe===0?0:1,fillOpacity:"0",style:ze.pathStyle,ref:Ae[He]})})};return Z.a.createElement("svg",o({className:Q()("".concat(V,"-circle"),xe),viewBox:"0 0 100 100",style:De},Se),N&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ye),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(N).sort(function(Le,_e){return h(Le)-h(_e)}).map(function(Le,_e){return Z.a.createElement("stop",{key:_e,offset:Le,stopColor:N[Le]})}))),Z.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:s,stroke:he,strokeLinecap:me,strokeWidth:P||M,fillOpacity:"0",style:c}),Oe().reverse())};m.defaultProps=U;var E=m,B={Line:d,Circle:E}},kSUc:function(ft,it,pe){},lZu9:function(ft,it,pe){(function(fe){fe(pe("VrN/"),pe("1eCo"),pe("8EBN"))})(function(fe){"use strict";fe.defineMode("markdown",function(Z,_){var Q=fe.getMode(Z,"text/html"),U=Q.name=="null";function D(M){if(fe.findModeByName){var P=fe.findModeByName(M);P&&(M=P.mime||P.mimes[0])}var $=fe.getMode(Z,M);return $.name=="null"?null:$}_.highlightFormatting===void 0&&(_.highlightFormatting=!1),_.maxBlockquoteDepth===void 0&&(_.maxBlockquoteDepth=0),_.taskLists===void 0&&(_.taskLists=!1),_.strikethrough===void 0&&(_.strikethrough=!1),_.emoji===void 0&&(_.emoji=!1),_.fencedCodeBlockHighlighting===void 0&&(_.fencedCodeBlockHighlighting=!0),_.fencedCodeBlockDefaultMode===void 0&&(_.fencedCodeBlockDefaultMode="text/plain"),_.xml===void 0&&(_.xml=!0),_.tokenTypeOverrides===void 0&&(_.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 H in G)G.hasOwnProperty(H)&&_.tokenTypeOverrides[H]&&(G[H]=_.tokenTypeOverrides[H]);var F=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,T=_.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,I=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,w=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(M,P,$){return P.f=P.inline=$,$(M,P)}function u(M,P,$){return P.f=P.block=$,$(M,P)}function C(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==k){var P=U;if(!P){var $=fe.innerMode(Q,M.htmlState);P=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}P&&(M.f=h,M.block=g,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function g(M,P){var $=M.column()===P.indentation,ae=C(P.prevLine.stream),he=P.indentedCode,me=P.prevLine.hr,De=P.list!==!1,xe=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var ke=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,De)){for(P.list=null;ke<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=ke-P.listStack[P.listStack.length-1])}var Te=!ae&&!me&&!P.prevLine.header&&(!De||!he)&&!P.prevLine.fencedCodeEnd,Se=(P.list===!1||me||ae)&&P.indentation<=xe&&M.match(F),ye=null;if(P.indentationDiff>=4&&(he||P.prevLine.fencedCodeEnd||P.prevLine.header||ae))return M.skipToEnd(),P.indentedCode=!0,G.code;if(M.eatSpace())return null;if($&&P.indentation<=xe&&(ye=M.match(T))&&ye[1].length<=6)return P.quote=0,P.header=ye[1].length,P.thisLine.header=!0,_.highlightFormatting&&(P.formatting="header"),P.f=P.inline,f(P);if(P.indentation<=xe&&M.eat(">"))return P.quote=$?1:P.quote+1,_.highlightFormatting&&(P.formatting="quote"),M.eatSpace(),f(P);if(!Se&&!P.setext&&$&&P.indentation<=xe&&(ye=M.match(O))){var z=ye[1]?"ol":"ul";return P.indentation=ke+M.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,_.taskLists&&M.match(y,!1)&&(P.taskList=!0),P.f=P.inline,_.highlightFormatting&&(P.formatting=["list","list-"+z]),f(P)}else{if($&&P.indentation<=xe&&(ye=M.match(A,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ye[1]+"+ *$"),P.localMode=_.fencedCodeBlockHighlighting&&D(ye[2]||_.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=fe.startState(P.localMode)),P.f=P.block=x,_.highlightFormatting&&(P.formatting="code-block"),P.code=-1,f(P);if(P.setext||(!Te||!De)&&!P.quote&&P.list===!1&&!P.code&&!Se&&!w.test(M.string)&&(ye=M.lookAhead(1))&&(ye=ye.match(I)))return P.setext?(P.header=P.setext,P.setext=0,M.skipToEnd(),_.highlightFormatting&&(P.formatting="header")):(P.header=ye[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,f(P);if(Se)return M.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,G.hr;if(M.peek()==="[")return l(M,P,B)}return l(M,P,P.inline)}function k(M,P){var $=Q.token(M,P.htmlState);if(!U){var ae=fe.innerMode(Q,P.htmlState);(ae.mode.name=="xml"&&ae.state.tagStart===null&&!ae.state.context&&ae.state.tokenize.isInText||P.md_inside&&M.current().indexOf(">")>-1)&&(P.f=h,P.block=g,P.htmlState=null)}return $}function x(M,P){var $=P.listStack[P.listStack.length-1]||0,ae=P.indentation<$,he=$+3;if(P.fencedEndRE&&P.indentation<=he&&(ae||M.match(P.fencedEndRE))){_.highlightFormatting&&(P.formatting="code-block");var me;return ae||(me=f(P)),P.localMode=P.localState=null,P.block=g,P.f=h,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,ae?u(M,P,P.block):me}else return P.localMode?P.localMode.token(M,P.localState):(M.skipToEnd(),G.code)}function f(M){var P=[];if(M.formatting){P.push(G.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var $=0;$<M.formatting.length;$++)P.push(G.formatting+"-"+M.formatting[$]),M.formatting[$]==="header"&&P.push(G.formatting+"-"+M.formatting[$]+"-"+M.header),M.formatting[$]==="quote"&&(!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=M.quote?P.push(G.formatting+"-"+M.formatting[$]+"-"+M.quote):P.push("error"))}if(M.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(M.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(M.linkHref?P.push(G.linkHref,"url"):(M.strong&&P.push(G.strong),M.em&&P.push(G.em),M.strikethrough&&P.push(G.strikethrough),M.emoji&&P.push(G.emoji),M.linkText&&P.push(G.linkText),M.code&&P.push(G.code),M.image&&P.push(G.image),M.imageAltText&&P.push(G.imageAltText,"link"),M.imageMarker&&P.push(G.imageMarker)),M.header&&P.push(G.header,G.header+"-"+M.header),M.quote&&(P.push(G.quote),!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=M.quote?P.push(G.quote+"-"+M.quote):P.push(G.quote+"-"+_.maxBlockquoteDepth)),M.list!==!1){var ae=(M.listStack.length-1)%3;ae?ae===1?P.push(G.list2):P.push(G.list3):P.push(G.list1)}return M.trailingSpaceNewLine?P.push("trailing-space-new-line"):M.trailingSpace&&P.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function p(M,P){return M.match(L,!0)?f(P):void 0}function h(M,P){var $=P.text(M,P);if(typeof $!="undefined")return $;if(P.list)return P.list=null,f(P);if(P.taskList){var ae=M.match(y,!0)[1]===" ";return ae?P.taskOpen=!0:P.taskClosed=!0,_.highlightFormatting&&(P.formatting="task"),P.taskList=!1,f(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&M.match(/^#+$/,!0))return _.highlightFormatting&&(P.formatting="header"),f(P);var he=M.next();if(P.linkTitle){P.linkTitle=!1;var me=he;he==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var De="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(M.match(new RegExp(De),!0))return G.linkHref}if(he==="`"){var xe=P.formatting;_.highlightFormatting&&(P.formatting="code"),M.eatWhile("`");var ke=M.current().length;if(P.code==0&&(!P.quote||ke==1))return P.code=ke,f(P);if(ke==P.code){var Te=f(P);return P.code=0,Te}else return P.formatting=xe,f(P)}else if(P.code)return f(P);if(he==="\\"&&(M.next(),_.highlightFormatting)){var Se=f(P),ye=G.formatting+"-escape";return Se?Se+" "+ye:ye}if(he==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,_.highlightFormatting&&(P.formatting="image"),f(P);if(he==="["&&P.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,_.highlightFormatting&&(P.formatting="image"),f(P);if(he==="]"&&P.imageAltText){_.highlightFormatting&&(P.formatting="image");var Se=f(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=b,Se}if(he==="["&&!P.image)return P.linkText&&M.match(/^.*?\]/)||(P.linkText=!0,_.highlightFormatting&&(P.formatting="link")),f(P);if(he==="]"&&P.linkText){_.highlightFormatting&&(P.formatting="link");var Se=f(P);return P.linkText=!1,P.inline=P.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?b:h,Se}if(he==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,_.highlightFormatting&&(P.formatting="link");var Se=f(P);return Se?Se+=" ":Se="",Se+G.linkInline}if(he==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,_.highlightFormatting&&(P.formatting="link");var Se=f(P);return Se?Se+=" ":Se="",Se+G.linkEmail}if(_.xml&&he==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var z=M.string.indexOf(">",M.pos);if(z!=-1){var s=M.string.substring(M.start,z);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(s)&&(P.md_inside=!0)}return M.backUp(1),P.htmlState=fe.startState(Q),u(M,P,k)}if(_.xml&&he==="<"&&M.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(he==="*"||he==="_"){for(var c=1,R=M.pos==1?" ":M.string.charAt(M.pos-2);c<3&&M.eat(he);)c++;var Y=M.peek()||" ",N=!/\s/.test(Y)&&(!d.test(Y)||/\s/.test(R)||d.test(R)),se=!/\s/.test(R)&&(!d.test(R)||/\s/.test(Y)||d.test(Y)),be=null,Ae=null;if(c%2&&(!P.em&&N&&(he==="*"||!se||d.test(R))?be=!0:P.em==he&&se&&(he==="*"||!N||d.test(Y))&&(be=!1)),c>1&&(!P.strong&&N&&(he==="*"||!se||d.test(R))?Ae=!0:P.strong==he&&se&&(he==="*"||!N||d.test(Y))&&(Ae=!1)),Ae!=null||be!=null){_.highlightFormatting&&(P.formatting=be==null?"strong":Ae==null?"em":"strong em"),be===!0&&(P.em=he),Ae===!0&&(P.strong=he);var Te=f(P);return be===!1&&(P.em=!1),Ae===!1&&(P.strong=!1),Te}}else if(he===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return f(P);M.backUp(1)}if(_.strikethrough){if(he==="~"&&M.eatWhile(he)){if(P.strikethrough){_.highlightFormatting&&(P.formatting="strikethrough");var Te=f(P);return P.strikethrough=!1,Te}else if(M.match(/^[^\s]/,!1))return P.strikethrough=!0,_.highlightFormatting&&(P.formatting="strikethrough"),f(P)}else if(he===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return f(P);M.backUp(2)}}if(_.emoji&&he===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,_.highlightFormatting&&(P.formatting="emoji");var Oe=f(P);return P.emoji=!1,Oe}return he===" "&&(M.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),f(P)}function a(M,P){var $=M.next();if($===">"){P.f=P.inline=h,_.highlightFormatting&&(P.formatting="link");var ae=f(P);return ae?ae+=" ":ae="",ae+G.linkInline}return M.match(/^[^>]+/,!0),G.linkInline}function b(M,P){if(M.eatSpace())return null;var $=M.next();return $==="("||$==="["?(P.f=P.inline=E($==="("?")":"]"),_.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,f(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(M){return function(P,$){var ae=P.next();if(ae===M){$.f=$.inline=h,_.highlightFormatting&&($.formatting="link-string");var he=f($);return $.linkHref=!1,he}return P.match(m[M]),$.linkHref=!0,f($)}}function B(M,P){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=W,M.next(),_.highlightFormatting&&(P.formatting="link"),P.linkText=!0,f(P)):l(M,P,h)}function W(M,P){if(M.match(/^\]:/,!0)){P.f=P.inline=K,_.highlightFormatting&&(P.formatting="link");var $=f(P);return P.linkText=!1,$}return M.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(M,P){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?P.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=h,G.linkHref+" url")}var V={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&fe.copyState(Q,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?fe.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,P){if(P.formatting=!1,M!=P.thisLine.stream){if(P.header=0,P.hr=!1,M.match(/^\s*$/,!0))return v(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:M},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=k)){var $=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=$,P.indentationDiff=null,$>0)return null}}return P.f(M,P)},innerMode:function(M){return M.block==k?{state:M.htmlState,mode:Q}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,P,$){return M.block==k&&Q.indent?Q.indent(M.htmlState,P,$):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,P,$):fe.Pass},blankLine:v,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),fe.defineMIME("text/markdown","markdown"),fe.defineMIME("text/x-markdown","markdown")})},osHv:function(ft,it,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";var Z=fe.Pos;function _(d,o){return d.line-o.line||d.ch-o.ch}var Q="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",D=new RegExp("<(/?)(["+Q+"]["+U+"]*)","g");function G(d,o,l,u){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function H(d,o){var l=d.cm.getTokenTypeAt(Z(d.line,o));return l&&/\btag\b/.test(l)}function F(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function O(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(F(d))continue;return}if(!H(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function T(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(O(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}D.lastIndex=o,d.ch=o;var l=D.exec(d.text);if(l&&l.index==o)return l}}function I(d){for(;;){D.lastIndex=d.ch;var o=D.exec(d.text);if(!o){if(F(d))continue;return}if(!H(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function L(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(O(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function A(d,o){for(var l=[];;){var u=I(d),C,v=d.line,g=d.ch-(u?u[0].length:0);if(!u||!(C=y(d)))return;if(C=="selfClose")continue;if(u[1]){for(var k=l.length-1;k>=0;--k)if(l[k]==u[2]){l.length=k;break}if(k<0&&(!o||o==u[2]))return{tag:u[2],from:Z(v,g),to:Z(d.line,d.ch)}}else l.push(u[2])}}function w(d,o){for(var l=[];;){var u=L(d);if(!u)return;if(u=="selfClose"){T(d);continue}var C=d.line,v=d.ch,g=T(d);if(!g)return;if(g[1])l.push(g[2]);else{for(var k=l.length-1;k>=0;--k)if(l[k]==g[2]){l.length=k;break}if(k<0&&(!o||o==g[2]))return{tag:g[2],from:Z(d.line,d.ch),to:Z(C,v)}}}}fe.registerHelper("fold","xml",function(d,o){for(var l=new G(d,o.line,0);;){var u=I(l);if(!u||l.line!=o.line)return;var C=y(l);if(!C)return;if(!u[1]&&C!="selfClose"){var v=Z(l.line,l.ch),g=A(l,u[2]);return g&&_(g.from,v)>0?{from:v,to:g.from}:null}}}),fe.findMatchingTag=function(d,o,l){var u=new G(d,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=y(u),v=C&&Z(u.line,u.ch),g=C&&T(u);if(!C||!g||_(u,o)>0)return;var k={from:Z(u.line,u.ch),to:v,tag:g[2]};return C=="selfClose"?{open:k,close:null,at:"open"}:g[1]?{open:w(u,g[2]),close:k,at:"close"}:(u=new G(d,v.line,v.ch,l),{open:k,close:A(u,g[2]),at:"open"})},fe.findEnclosingTag=function(d,o,l,u){for(var C=new G(d,o.line,o.ch,l);;){var v=w(C,u);if(!v)break;var g=new G(d,o.line,o.ch,l),k=A(g,v.tag);if(k)return{open:v,close:k}}},fe.scanForClosingTag=function(d,o,l,u){var C=new G(d,o.line,o.ch,u?{from:0,to:u}:null);return A(C,l)}})},p5ED:function(ft,it,pe){"use strict";var fe=pe("+L6B"),Z=pe("2/Rp"),_=pe("5Dmo"),Q=pe("3S7+"),U=pe("k1fw"),D=pe("9og8"),G=pe("tJVT"),H=pe("WmNS"),F=pe.n(H),O=pe("q1tI"),y=pe.n(O),T=pe("vHTk"),I=pe.n(T),L=pe("yEEn"),A=pe("ZW9T"),w=pe("1vsH"),d=pe("V0Rq"),o=pe("m3rI");it.a=function(l){var u,C,v,g,k,x,f,p=l.editOffice,h=p===void 0?"view":p,a=l.data,b=l.theme,m=l.type,E=l.filename,B=l.monacoEditor,W=l.className,K=l.style,V=l.close,M=l.onClose,P=l.hasMask,$=l.disabledDownload,ae=Object(O.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),he=Object(G.a)(ae,2),me=he[0],De=he[1],xe=Object(O.useState)(""),ke=Object(G.a)(xe,2),Te=ke[0],Se=ke[1],ye=Object(O.useState)(),z=Object(G.a)(ye,2),s=z[0],c=z[1],R=window.ENV==="build"?"/react/build":"",Y=o.a.PROXY_SERVER||location.origin,N,se=1024*1024,be=10*se,Ae=Object(O.useRef)();(u=a)!==null&&u!==void 0&&u.startsWith("/api")&&m!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),m==="office"&&(N=Object(w.T)(a).filesize,N>be&&(m="other")),E&&B&&(B.filename=E),Object(O.useEffect)(function(){var Pe,He,Ge=(Pe=document.cookie)===null||Pe===void 0||((He=Pe.replace(/\s/g,""))===null||He===void 0)?void 0:He.split(";");Ge==null||Ge.map(function(Xe){var ze=Xe.split("=");ze[0]==="_educoder_session"&&Se(ze[1])})},[]),Object(O.useEffect)(function(){m==="office"&&Oe()},[m,a]);var Oe=function(){var Pe=Object(D.a)(F.a.mark(function He(){var Ge,Xe,ze;return F.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:return console.log("data:",a),Ge=a,a.startsWith("http")||(Ge=location.origin+Ge),Xe=new URL(Ge).pathname.split("/").pop(),$e.next=6,Object(d.V)({attachment_id:Xe});case 6:ze=$e.sent,c(ze);case 8:case"end":return $e.stop()}},He)}));return function(){return Pe.apply(this,arguments)}}(),Le=function(){if(a.startsWith("http")||a.startsWith("blob:")){_e();return}Object(w.z)(E||"educoder",a,E)},_e=function(){Object(w.x)(E||"educoder",decodeURIComponent(a))};return y.a.createElement("div",{style:Object(U.a)({},K||{}),className:"".concat(P&&I.a.bgBlack," ").concat(m?I.a.wrp:"hide")},V&&y.a.createElement("div",{className:I.a.close,ref:Ae},!$&&y.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Ae.current}},y.a.createElement("span",{onClick:_e},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Ae.current}},y.a.createElement("span",{className:"",onClick:M},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(I.a[W]," ").concat(W," ").concat(I.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&y.a.createElement(A.b,B)),m==="audio"&&y.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.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,((g=a)===null||g===void 0?void 0:g.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"&&s&&y.a.createElement("iframe",{src:"".concat(R,"/office.html?key=").concat(s.key,"&url=").concat(Y+s.url,"&callbackUrl=").concat(Y+s.callbackUrl,"&fileType=").concat(s.fileType,"&title=").concat(s.title,"&model=").concat(h,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),m==="html"&&y.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&y.a.createElement("iframe",{src:"".concat(R,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!$)}),m==="image"&&y.a.createElement("img",{src:"".concat(((k=a)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((x=a)===null||x===void 0?void 0:x.indexOf("https://"))>-1||(f=a)!==null&&f!==void 0&&f.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&y.a.createElement("div",null,y.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&y.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ft,it,pe){},rUJ1:function(ft,it){const pe=/[&<>"']/,fe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=x=>Q[x];function D(x,f){if(f){if(pe.test(x))return x.replace(fe,U)}else if(Z.test(x))return x.replace(_,U);return x}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(x){return x.replace(G,(f,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const F=/(^|[^\[])\^/g;function O(x,f){x=x.source||x,f=f||"";const p={replace:(h,a)=>(a=a.source||a,a=a.replace(F,"$1"),x=x.replace(h,a),p),getRegex:()=>new RegExp(x,f)};return p}const y=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function I(x,f,p){if(x){let h;try{h=decodeURIComponent(H(p)).replace(y,"").toLowerCase()}catch(a){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}f&&!T.test(p)&&(p=o(f,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(h){return null}return p}const L={},A=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,f){L[" "+x]||(A.test(x)?L[" "+x]=x+"/":L[" "+x]=v(x,"/",!0)),x=L[" "+x];const p=x.indexOf(":")===-1;return f.substring(0,2)==="//"?p?f:x.replace(w,"$1")+f:f.charAt(0)==="/"?p?f:x.replace(d,"$1")+f:x+f}const l={exec:function(){}};function u(x){let f=1,p,h;for(;f<arguments.length;f++){p=arguments[f];for(h in p)Object.prototype.hasOwnProperty.call(p,h)&&(x[h]=p[h])}return x}function C(x,f){const p=x.replace(/\|/g,(b,m,E)=>{let B=!1,W=m;for(;--W>=0&&E[W]==="\\";)B=!B;return B?"|":" |"}),h=p.split(/ \|/);let a=0;if(h.length>f)h.splice(f);else for(;h.length<f;)h.push("");for(;a<h.length;a++)h[a]=h[a].trim().replace(/\\\|/g,"|");return h}function v(x,f,p){const h=x.length;if(h===0)return"";let a=0;for(;a<h;){const b=x.charAt(h-a-1);if(b===f&&!p)a++;else if(b!==f&&p)a++;else break}return x.substr(0,h-a)}function g(x,f){if(x.indexOf(f[1])===-1)return-1;const p=x.length;let h=0,a=0;for(;a<p;a++)if(x[a]==="\\")a++;else if(x[a]===f[0])h++;else if(x[a]===f[1]&&(h--,h<0))return a;return-1}function k(x){x&&x.sanitize&&!x.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")}ft.exports={escape:D,unescape:H,edit:O,cleanUrl:I,resolveUrl:o,noopTest:l,merge:u,splitCells:C,rtrim:v,findClosingBracket:g,checkSanitizeDeprecation:k}},ulZh:function(ft,it,pe){typeof window!="undefined"&&function(Z,_){ft.exports=_()}(this,function(){return function(fe){var Z={};function _(Q){if(Z[Q])return Z[Q].exports;var U=Z[Q]={i:Q,l:!1,exports:{}};return fe[Q].call(U.exports,U,U.exports,_),U.l=!0,U.exports}return _.m=fe,_.c=Z,_.d=function(Q,U,D){_.o(Q,U)||Object.defineProperty(Q,U,{enumerable:!0,get:D})},_.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},_.t=function(Q,U){if(U&1&&(Q=_(Q)),U&8)return Q;if(U&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var D=Object.create(null);if(_.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:Q}),U&2&&typeof Q!="string")for(var G in Q)_.d(D,G,function(H){return Q[H]}.bind(null,G));return D},_.n=function(Q){var U=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return _.d(U,"a",U),U},_.o=function(Q,U){return Object.prototype.hasOwnProperty.call(Q,U)},_.p="/dist/",_(_.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(fe,Z,_){"use strict";var Q=Object.prototype.hasOwnProperty,U="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(U=!1));function G(y,T,I){this.fn=y,this.context=T,this.once=I||!1}function H(y,T,I,L,A){if(typeof I!="function")throw new TypeError("The listener must be a function");var w=new G(I,L||y,A),d=U?U+T:T;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],w]:y._events[d].push(w):(y._events[d]=w,y._eventsCount++),y}function F(y,T){--y._eventsCount===0?y._events=new D:delete y._events[T]}function O(){this._events=new D,this._eventsCount=0}O.prototype.eventNames=function(){var T=[],I,L;if(this._eventsCount===0)return T;for(L in I=this._events)Q.call(I,L)&&T.push(U?L.slice(1):L);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(I)):T},O.prototype.listeners=function(T){var I=U?U+T:T,L=this._events[I];if(!L)return[];if(L.fn)return[L.fn];for(var A=0,w=L.length,d=new Array(w);A<w;A++)d[A]=L[A].fn;return d},O.prototype.listenerCount=function(T){var I=U?U+T:T,L=this._events[I];return L?L.fn?1:L.length:0},O.prototype.emit=function(T,I,L,A,w,d){var o=U?U+T:T;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,C,v;if(l.fn){l.once&&this.removeListener(T,l.fn,void 0,!0);switch(u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,I),!0;case 3:return l.fn.call(l.context,I,L),!0;case 4:return l.fn.call(l.context,I,L,A),!0;case 5:return l.fn.call(l.context,I,L,A,w),!0;case 6:return l.fn.call(l.context,I,L,A,w,d),!0}for(v=1,C=new Array(u-1);v<u;v++)C[v-1]=arguments[v];l.fn.apply(l.context,C)}else{var g=l.length,k;for(v=0;v<g;v++){l[v].once&&this.removeListener(T,l[v].fn,void 0,!0);switch(u){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,I);break;case 3:l[v].fn.call(l[v].context,I,L);break;case 4:l[v].fn.call(l[v].context,I,L,A);break;default:if(!C)for(k=1,C=new Array(u-1);k<u;k++)C[k-1]=arguments[k];l[v].fn.apply(l[v].context,C)}}}return!0},O.prototype.on=function(T,I,L){return H(this,T,I,L,!1)},O.prototype.once=function(T,I,L){return H(this,T,I,L,!0)},O.prototype.removeListener=function(T,I,L,A){var w=U?U+T:T;if(!this._events[w])return this;if(!I)return F(this,w),this;var d=this._events[w];if(d.fn)d.fn===I&&(!A||d.once)&&(!L||d.context===L)&&F(this,w);else{for(var o=0,l=[],u=d.length;o<u;o++)(d[o].fn!==I||A&&!d[o].once||L&&d[o].context!==L)&&l.push(d[o]);l.length?this._events[w]=l.length===1?l[0]:l:F(this,w)}return this},O.prototype.removeAllListeners=function(T){var I;return T?(I=U?U+T:T,this._events[I]&&F(this,I)):(this._events=new D,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=U,O.EventEmitter=O,fe.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(fe,Z,_){(function(Q){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,F={buildAbsoluteURL:function(O,y,T){if(T=T||{},O=O.trim(),y=y.trim(),!y){if(!T.alwaysNormalize)return O;var I=F.parseURL(O);if(!I)throw new Error("Error trying to parse base URL.");return I.path=F.normalizePath(I.path),F.buildURLFromParts(I)}var L=F.parseURL(y);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return T.alwaysNormalize?(L.path=F.normalizePath(L.path),F.buildURLFromParts(L)):y;var A=F.parseURL(O);if(!A)throw new Error("Error trying to parse base URL.");if(!A.netLoc&&A.path&&A.path[0]!=="/"){var w=D.exec(A.path);A.netLoc=w[1],A.path=w[2]}A.netLoc&&!A.path&&(A.path="/");var d={scheme:A.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(d.netLoc=A.netLoc,L.path[0]!=="/"))if(!L.path)d.path=A.path,L.params||(d.params=A.params,L.query||(d.query=A.query));else{var o=A.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;d.path=F.normalizePath(l)}return d.path===null&&(d.path=T.alwaysNormalize?F.normalizePath(L.path):L.path),F.buildURLFromParts(d)},parseURL:function(O){var y=U.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(H,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};fe.exports=F})(this)},"./node_modules/webworkify-webpack/index.js":function(fe,Z,_){function Q(T){var I={};function L(w){if(I[w])return I[w].exports;var d=I[w]={i:w,l:!1,exports:{}};return T[w].call(d.exports,d,d.exports,L),d.l=!0,d.exports}L.m=T,L.c=I,L.i=function(w){return w},L.d=function(w,d,o){L.o(w,d)||Object.defineProperty(w,d,{configurable:!1,enumerable:!0,get:o})},L.r=function(w){Object.defineProperty(w,"__esModule",{value:!0})},L.n=function(w){var d=w&&w.__esModule?function(){return w.default}:function(){return w};return L.d(d,"a",d),d},L.o=function(w,d){return Object.prototype.hasOwnProperty.call(w,d)},L.p="/",L.oe=function(w){throw console.error(w),w};var A=L(L.s=ENTRY_MODULE);return A.default||A}var U="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function G(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(T){return!isNaN(1*T)}function F(T,I,L){var A={};A[L]=[];var w=I.toString(),d=w.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return A;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+G(o)+D,"g"),u;u=l.exec(w);){if(u[3]==="dll-reference")continue;A[L].push(u[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+D,"g");u=l.exec(w);)T[u[2]]||(A[L].push(u[1]),T[u[2]]=_(u[1]).m),A[u[2]]=A[u[2]]||[],A[u[2]].push(u[4]);for(var C=Object.keys(A),v=0;v<C.length;v++)for(var g=0;g<A[C[v]].length;g++)H(A[C[v]][g])&&(A[C[v]][g]=1*A[C[v]][g]);return A}function O(T){var I=Object.keys(T);return I.reduce(function(L,A){return L||T[A].length>0},!1)}function y(T,I){for(var L={main:[I]},A={main:[]},w={main:{}};O(L);)for(var d=Object.keys(L),o=0;o<d.length;o++){var l=d[o],u=L[l],C=u.pop();if(w[l]=w[l]||{},w[l][C]||!T[l][C])continue;w[l][C]=!0,A[l]=A[l]||[],A[l].push(C);for(var v=F(T,T[l][C],l),g=Object.keys(v),k=0;k<g.length;k++)L[g[k]]=L[g[k]]||[],L[g[k]]=L[g[k]].concat(v[g[k]])}return A}fe.exports=function(T,I){I=I||{};var L={main:_.m},A=I.all?{main:Object.keys(L.main)}:y(L,T),w="";Object.keys(A).filter(function(C){return C!=="main"}).forEach(function(C){for(var v=0;A[C][v];)v++;A[C].push(v),L[C][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",w=w+"var "+C+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+A[C].map(function(g){return""+JSON.stringify(g)+": "+L[C][g].toString()}).join(",")+`});
`}),w=w+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+A.main.map(function(C){return""+JSON.stringify(C)+": "+L.main[C].toString()}).join(",")+"}))(self);";var d=new window.Blob([w],{type:"text/javascript"});if(I.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"hlsDefaultConfig",function(){return k}),_.d(Z,"mergeConfig",function(){return f}),_.d(Z,"enableStreamingMode",function(){return p});var Q=_("./src/controller/abr-controller.ts"),U=_("./src/controller/audio-stream-controller.ts"),D=_("./src/controller/audio-track-controller.ts"),G=_("./src/controller/subtitle-stream-controller.ts"),H=_("./src/controller/subtitle-track-controller.ts"),F=_("./src/controller/buffer-controller.ts"),O=_("./src/controller/timeline-controller.ts"),y=_("./src/controller/cap-level-controller.ts"),T=_("./src/controller/fps-controller.ts"),I=_("./src/controller/eme-controller.ts"),L=_("./src/controller/cmcd-controller.ts"),A=_("./src/utils/xhr-loader.ts"),w=_("./src/utils/fetch-loader.ts"),d=_("./src/utils/cues.ts"),o=_("./src/utils/mediakeys-helper.ts"),l=_("./src/utils/logger.ts");function u(){return u=Object.assign||function(h){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(h[m]=b[m])}return h},u.apply(this,arguments)}function C(h,a){var b=Object.keys(h);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(h);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(h,E).enumerable})),b.push.apply(b,m)}return b}function v(h){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?C(Object(b),!0).forEach(function(m){g(h,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(b)):C(Object(b)).forEach(function(m){Object.defineProperty(h,m,Object.getOwnPropertyDescriptor(b,m))})}return h}function g(h,a,b){return a in h?Object.defineProperty(h,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):h[a]=b,h}var k=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:A.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:F.default,capLevelController:y.default,fpsController:T.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},x()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:H.default,timelineController:O.TimelineController,audioStreamController:U.default,audioTrackController:D.default,emeController:I.default,cmcdController:L.default});function x(){return{cueHandler:d.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 f(h,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 u({},h,a)}function p(h){var a=h.loader;if(a!==w.default&&a!==A.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var b=Object(w.fetchSupported)();b&&(h.loader=w.default,h.progressive=!0,h.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/ewma-bandwidth-estimator.ts"),D=_("./src/events.ts"),G=_("./src/utils/buffer-helper.ts"),H=_("./src/errors.ts"),F=_("./src/types/loader.ts"),O=_("./src/utils/logger.ts");function y(L,A){for(var w=0;w<A.length;w++){var d=A[w];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function T(L,A,w){return A&&y(L.prototype,A),w&&y(L,w),L}var I=function(){function L(w){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=w;var d=w.config;this.bwEstimator=new U.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var A=L.prototype;return A.registerListeners=function(){var d=this.hls;d.on(D.Events.FRAG_LOADING,this.onFragLoading,this),d.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(D.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var d=this.hls;d.off(D.Events.FRAG_LOADING,this.onFragLoading,this),d.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(D.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},A.onFragLoading=function(d,o){var l=o.frag;if(l.type===F.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},A.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},A._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,C=l.config,v=l.media;if(!d||!v)return;var g=o?o.stats:d.stats,k=o?o.duration:d.duration;if(g.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||v.paused||!v.playbackRate||!v.readyState)return;var x=performance.now()-g.loading.start,f=Math.abs(v.playbackRate);if(x<=500*k/f)return;var p=l.levels,h=l.minAutoLevel,a=p[d.level],b=g.total||Math.max(g.loaded,Math.round(k*a.maxBitrate/8)),m=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/x),E=(b-g.loaded)/m,B=v.currentTime,W=(G.BufferHelper.bufferInfo(v,B,C.maxBufferHole).end-B)/f;if(W>=2*k/f||E<=W)return;var K=Number.POSITIVE_INFINITY,V;for(V=d.level-1;V>h;V--){var M=p[V].maxBitrate;if(K=k*M/(8*.8*m),K<W)break}if(K>=E)return;var P=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Q.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+W.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(x,g.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:g})},A.onFragLoaded=function(d,o){var l=o.frag,u=o.part;if(l.type===F.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(l.sn)){var C=u?u.stats:l.stats,v=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[l.level],k=(g.loaded?g.loaded.bytes:0)+C.loaded,x=(g.loaded?g.loaded.duration:0)+v;g.loaded={bytes:k,duration:x},g.realBitrate=Math.round(8*k/x)}if(l.bitrateTest){var f={stats:C,frag:l,part:u,id:l.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},A.onFragBuffered=function(d,o){var l=o.frag,u=o.part,C=u?u.stats:l.stats;if(C.aborted)return;if(l.type!==F.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},A.onError=function(d,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,C=l.config,v=l.minAutoLevel,g=l.media,k=o?o.duration:d?d.duration:0,x=g?g.currentTime:0,f=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,h=(G.BufferHelper.bufferInfo(g,x,C.maxBufferHole).end-x)/f,a=this.findBestLevel(p,v,u,h,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=k?Math.min(k,C.maxStarvationDelay):C.maxStarvationDelay,m=C.abrBandWidthFactor,E=C.abrBandWidthUpFactor;if(!h){var B=this.bitrateTestDelay;if(B){var W=k?Math.min(k,C.maxLoadingDelay):C.maxLoadingDelay;b=W-B,O.logger.trace("bitrate test took "+Math.round(1e3*B)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),m=E=1}}return a=this.findBestLevel(p,v,u,h+b,m,E),Math.max(a,0)},A.findBestLevel=function(d,o,l,u,C,v){for(var g,k=this.fragCurrent,x=this.partCurrent,f=this.lastLoadedFragLevel,p=this.hls.levels,h=p[f],a=!!(h!=null&&(g=h.details)!==null&&g!==void 0&&g.live),b=h==null?void 0:h.codecSet,m=x?x.duration:k?k.duration:0,E=l;E>=o;E--){var B=p[E];if(!B||b&&B.codecSet!==b)continue;var W=B.details,K=(x?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||m,V=void 0;E<=f?V=C*d:V=v*d;var M=p[E].maxBitrate,P=M*K/V;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(V)+"/"+M+"/"+K+"/"+u+"/"+P),V>M&&(!P||a&&!this.bitrateTestDelay||P<u))return E}return-1},T(L,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),L}();Z.default=I},"./src/controller/audio-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),D=_("./src/events.ts"),G=_("./src/utils/buffer-helper.ts"),H=_("./src/controller/fragment-tracker.ts"),F=_("./src/types/level.ts"),O=_("./src/types/loader.ts"),y=_("./src/loader/fragment.ts"),T=_("./src/demux/chunk-cache.ts"),I=_("./src/demux/transmuxer-interface.ts"),L=_("./src/types/transmuxer.ts"),A=_("./src/controller/fragment-finders.ts"),w=_("./src/utils/discontinuities.ts"),d=_("./src/errors.ts"),o=_("./src/utils/logger.ts");function l(){return l=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(k[p]=f[p])}return k},l.apply(this,arguments)}function u(k,x){k.prototype=Object.create(x.prototype),k.prototype.constructor=k,C(k,x)}function C(k,x){return C=Object.setPrototypeOf||function(p,h){return p.__proto__=h,p},C(k,x)}var v=100,g=function(k){u(x,k);function x(p,h){var a;return a=k.call(this,p,h,"[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 f=x.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var h=this.hls;h.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(D.Events.ERROR,this.onError,this),h.on(D.Events.BUFFER_RESET,this.onBufferReset,this),h.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var h=this.hls;h.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(D.Events.ERROR,this.onError,this),h.off(D.Events.BUFFER_RESET,this.onBufferReset,this),h.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(h,a){var b=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var B=b.cc;this.initPTS[b.cc]=E,this.log("InitPTS for cc: "+B+" found from main: "+E),this.videoTrackCC=B,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},f.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var h,a=this.levels,b=this.trackId,m=a==null||((h=a[b])===null||h===void 0)?void 0:h.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var E,B=performance.now(),W=this.retryDate;(!W||B>=W||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,M=K.part,P=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ae=P.flush(),he={frag:V,part:M,payload:ae,networkDetails:null};this._handleFragmentLoadProgress(he),$&&k.prototype._handleFragmentLoadComplete.call(this,he)}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 me=this.getLoadPosition(),De=G.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),xe=Object(A.fragmentWithinToleranceTest)(De.end,this.config.maxFragLookUpTolerance,V);xe<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+De.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},f.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:h,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},f.doTickIdle=function(){var h,a,b=this.hls,m=this.levels,E=this.media,B=this.trackId,W=b.config;if(!m||!m[B])return;if(!E&&(this.startFragRequested||!W.startFragPrefetch))return;var K=m[B],V=K.details;if(!V||V.live&&this.levelLastLoaded!==B||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(M===null)return;var P=M.len,$=this.getMaxBufferLength(),ae=this.audioSwitch;if(P>=$&&!ae)return;if(!ae&&this._streamEnded(M,V)){b.trigger(D.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var he=V.fragments,me=he[0].start,De=M.end;if(ae){var xe=this.getLoadPosition();De=xe,V.PTSKnown&&xe<me&&((M.end>me||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=me+.05))}var ke=this.getNextFragment(De,V);if(!ke){this.bufferFlushed=!0;return}((h=ke.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((a=ke.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ke,V):this.loadFragment(ke,V,De)},f.getMaxBufferLength=function(){var h=k.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?h:Math.max(h,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(h,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(m){return new F.Level(m)})},f.onAudioTrackSwitching=function(h,a){var b=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(v):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(h,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(h,a){var b,m=this.levels,E=a.details,B=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+B);return}this.log("Track "+B+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var W=m[B],K=0;if(E.live||(b=W.details)!==null&&b!==void 0&&b.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!W.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(w.alignMediaPlaylistByPDT)(E,V),K=E.fragments[0].start):K=this.alignPlaylists(E,W.details)}W.details=E,this.levelLastLoaded=B,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(W.details,K),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=U.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(h){var a,b=h.frag,m=h.part,E=h.payload,B=this.config,W=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var V=K[W];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var P=B.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new I.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ae=this.initPTS[b.cc],he=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(ae!==void 0){var me=!1,De=m?m.index:-1,xe=De!==-1,ke=new L.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,E.byteLength,De,xe);$.push(E,he,P,"",b,m,M.totalduration,me,ke,ae)}else{o.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+W);var Te=this.waitingData=this.waitingData||{frag:b,part:m,cache:new T.default,complete:!1},Se=Te.cache;Se.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,h)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(h,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(h,a){var b=a.frag,m=a.part;if(b.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(m?" p: "+m.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,m)},f.onError=function(h,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var b=!0,m=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);m&&m.len>.5&&(b=!this.reduceMaxBufferLength(m.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(h,a){var b=a.type;b===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(h){var a,b="audio",m=this.hls,E=h.remuxResult,B=h.chunkMeta,W=this.getCurrentContext(B);if(!W){this.warn("The loading context changed while buffering fragment "+B.sn+" of level "+B.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(B.level);return}var K=W.frag,V=W.part,M=E.audio,P=E.text,$=E.id3,ae=E.initSegment;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ae!=null&&ae.tracks&&(this._bufferInitSegment(ae.tracks,K,B),m.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:b,tracks:ae.tracks})),M){var he=M.startPTS,me=M.endPTS,De=M.startDTS,xe=M.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:me,startDTS:De,endDTS:xe}),K.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,he,me,De,xe),this.bufferFragmentData(M,K,V,B)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var ke=l({frag:K,id:b},$);m.trigger(D.Events.FRAG_PARSING_METADATA,ke)}if(P){var Te=l({frag:K,id:b},P);m.trigger(D.Events.FRAG_PARSING_USERDATA,Te)}},f._bufferInitSegment=function(h,a,b){if(this.state!==U.State.PARSING)return;h.video&&delete h.video;var m=h.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(D.Events.BUFFER_CODECS,h);var E=m.initSegment;if(E!=null&&E.byteLength){var B={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:E};this.hls.trigger(D.Events.BUFFER_APPENDING,B)}this.tick()},f.loadFragment=function(h,a,b){var m=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||m===H.FragmentState.NOT_LOADED||m===H.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):a.live&&!Object(Q.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,h,a,b)))},f.completeAudioSwitch=function(){var h=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:b})},x}(U.default);Z.default=g},"./src/controller/audio-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/controller/base-playlist-controller.ts"),G=_("./src/types/loader.ts");function H(I,L){for(var A=0;A<L.length;A++){var w=L[A];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(I,w.key,w)}}function F(I,L,A){return L&&H(I.prototype,L),A&&H(I,A),I}function O(I,L){I.prototype=Object.create(L.prototype),I.prototype.constructor=I,y(I,L)}function y(I,L){return y=Object.setPrototypeOf||function(w,d){return w.__proto__=d,w},y(I,L)}var T=function(I){O(L,I);function L(w){var d;return d=I.call(this,w,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var A=L.prototype;return A.registerListeners=function(){var d=this.hls;d.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Q.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var d=this.hls;d.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Q.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,I.prototype.destroy.call(this)},A.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},A.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},A.onAudioTrackLoaded=function(d,o){var l=o.id,u=o.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var v=C.details;C.details=o.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,v))},A.onLevelLoading=function(d,o){this.switchLevel(o.level)},A.onLevelSwitching=function(d,o){this.switchLevel(o.level)},A.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!u.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var C={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},A.onError=function(d,o){if(I.prototype.onError.call(this,d,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)},A.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],C=u.id,v=u.groupId,g=v===void 0?"":v,k=u.name,x=u.type,f=u.url;if(this.trackId=d,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:g,name:k,type:x,url:f}),u.details&&!u.details.live)return;var p=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(p)},A.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},A.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,C=o.url;if(d)try{C=d.addDirectives(C)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:u,deliveryDirectives:d||null})}},F(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),L}(D.default);Z.default=T},"./src/controller/base-playlist-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return F});var Q=_("./src/polyfills/number.ts"),U=_("./src/types/level.ts"),D=_("./src/controller/level-helper.ts"),G=_("./src/utils/logger.ts"),H=_("./src/errors.ts"),F=function(){function O(T,I){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,I+":"),this.warn=G.logger.warn.bind(G.logger,I+":"),this.hls=T}var y=O.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(I,L){L.fatal&&L.type===H.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(I,L){var A=L==null?void 0:L.renditionReports;if(A)for(var w=0;w<A.length;w++){var d=A[w],o=""+d.URI;if(o===I.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var C=Math.min(L.age-L.partTarget,L.targetduration);u!==void 0&&C>L.partTarget&&(u+=1)}if(Object(Q.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(Q.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},y.loadPlaylist=function(I){},y.shouldLoadTrack=function(I){return this.canLoad&&I&&!!I.url&&(!I.details||I.details.live)},y.playlistLoaded=function(I,L,A){var w=this,d=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||A!=null&&A.live){if(d.reloaded(A),A&&this.log("live playlist "+I+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),A&&d.fragments.length>0&&Object(D.mergeDetails)(A,d),!this.canLoad||!d.live)return;var u,C=void 0,v=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var g=this.hls.config.lowLatencyMode,k=d.lastPartSn,x=d.endSN,f=d.lastPartIndex,p=f!==-1,h=k===x,a=g?0:f;p?(C=h?x+1:k,v=h?a:f+1):C=x+1;var b=d.age,m=b+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(A&&E>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var B=Math.floor(E/d.targetduration);if(C+=B,v!==void 0){var W=Math.round(E%d.targetduration/d.partTarget);v+=W}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+E+" skip sn "+B+" to part "+v)}d.tuneInGoal=E}if(u=this.getDeliveryDirectives(d,L.deliveryDirectives,C,v),g||!h){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,L.deliveryDirectives,C,v);var K=Object(D.computeReloadInterval)(d,o);C!==void 0&&d.canBlockReload&&(K-=d.partTarget||1),this.log("reload live playlist "+I+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return w.loadPlaylist(u)},K)}else this.clearTimer()},y.getDeliveryDirectives=function(I,L,A,w){var d=Object(U.getSkipValue)(I,A);return L!=null&&L.skip&&I.deltaUpdateFailed&&(A=L.msn,w=L.part,d=U.HlsSkip.No),new U.HlsUrlParameters(A,w,d)},y.retryLoadingOrFail=function(I){var L=this,A=this.hls.config,w=this.retryCount<A.levelLoadingMaxRetry;if(w){var d;if(this.retryCount++,I.details.indexOf("LoadTimeOut")>-1&&(d=I.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+I.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+I.details+'"')}}else this.warn('cannot recover from error "'+I.details+'"'),this.clearTimer(),I.fatal=!0;return w},O}()},"./src/controller/base-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"State",function(){return x}),_.d(Z,"default",function(){return f});var Q=_("./src/polyfills/number.ts"),U=_("./src/task-loop.ts"),D=_("./src/controller/fragment-tracker.ts"),G=_("./src/utils/buffer-helper.ts"),H=_("./src/utils/logger.ts"),F=_("./src/events.ts"),O=_("./src/errors.ts"),y=_("./src/types/transmuxer.ts"),T=_("./src/utils/mp4-tools.ts"),I=_("./src/utils/discontinuities.ts"),L=_("./src/controller/fragment-finders.ts"),A=_("./src/controller/level-helper.ts"),w=_("./src/loader/fragment-loader.ts"),d=_("./src/crypt/decrypter.ts"),o=_("./src/utils/time-ranges.ts"),l=_("./src/types/loader.ts");function u(p,h){for(var a=0;a<h.length;a++){var b=h[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(p,b.key,b)}}function C(p,h,a){return h&&u(p.prototype,h),a&&u(p,a),p}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function g(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,k(p,h)}function k(p,h){return k=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},k(p,h)}var x={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"},f=function(p){g(h,p);function h(b,m,E){var B;return B=p.call(this)||this,B.hls=void 0,B.fragPrevious=null,B.fragCurrent=null,B.fragmentTracker=void 0,B.transmuxer=null,B._state=x.STOPPED,B.media=void 0,B.mediaBuffer=void 0,B.config=void 0,B.bitrateTest=!1,B.lastCurrentTime=0,B.nextLoadPosition=0,B.startPosition=0,B.loadedmetadata=!1,B.fragLoadError=0,B.retryDate=0,B.levels=null,B.fragmentLoader=void 0,B.levelLastLoaded=null,B.startFragRequested=!1,B.decrypter=void 0,B.initPTS=[],B.onvseeking=null,B.onvended=null,B.logPrefix="",B.log=void 0,B.warn=void 0,B.logPrefix=E,B.log=H.logger.log.bind(H.logger,E+":"),B.warn=H.logger.warn.bind(H.logger,E+":"),B.hls=b,B.fragmentLoader=new w.default(b.config),B.fragmentTracker=m,B.config=b.config,B.decrypter=new d.default(b,b.config),b.on(F.Events.KEY_LOADED,B.onKeyLoaded,v(B)),B}var a=h.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=x.STOPPED},a._streamEnded=function(m,E){var B=this.fragCurrent,W=this.fragmentTracker;if(!E.live&&B&&B.sn===E.endSN&&!m.nextStart){var K=W.getState(B);return K===D.FragmentState.PARTIAL||K===D.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var B=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),B.addEventListener("seeking",this.onvseeking),B.addEventListener("ended",this.onvended);var W=this.config;this.levels&&W.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(W.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,E=this.fragCurrent,B=this.media,W=this.mediaBuffer,K=this.state,V=B?B.currentTime:0,M=G.BufferHelper.bufferInfo(W||B,V,m.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===x.ENDED)this.resetLoadingState();else if(E&&!M.len){var P=m.maxFragLookUpTolerance,$=E.start-P,ae=E.start+E.duration+P,he=V>ae;(V<$||he)&&(he&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}B&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,E){if(this.state!==x.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var B=this.levels[E.frag.level].details;B&&this.loadFragment(E.frag,B,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(F.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,p.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=x.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(F.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,B){this._loadFragForPlayback(m,E,B)},a._loadFragForPlayback=function(m,E,B){var W=this,K=function(M){if(W.fragContextChanged(m)){W.warn("Fragment "+m.sn+(M.part?" p: "+M.part.index:"")+" of level "+m.level+" was dropped during download."),W.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,W._handleFragmentLoadProgress(M)};this._doFragLoad(m,E,B,K).then(function(V){if(!V)return;W.fragLoadError=0;var M=W.state;if(W.fragContextChanged(m)){(M===x.FRAG_LOADING||M===x.BACKTRACKING||!W.fragCurrent&&M===x.PARSING)&&(W.fragmentTracker.removeFragment(m),W.state=x.IDLE);return}if("payload"in V&&(W.log("Loaded fragment "+m.sn+" of level "+m.level),W.hls.trigger(F.Events.FRAG_LOADED,V),W.state===x.BACKTRACKING)){W.fragmentTracker.backtrack(m,V),W.resetFragmentLoading(m);return}W._handleFragmentLoadComplete(V)}).catch(function(V){W.warn(V),W.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,B){if(B===void 0&&(B=null),!(m-E))return;var W={startOffset:m,endOffset:E,type:B};this.fragLoadError=0,this.hls.trigger(F.Events.BUFFER_FLUSHING,W)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(B){if(!B||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return B}).then(function(B){var W=E.hls,K=B.payload,V=m.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(P){var $=self.performance.now();return W.trigger(F.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:M,tdecrypt:$}}),B.payload=P,B})}return B}).then(function(B){var W=E.fragCurrent,K=E.hls,V=E.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[m.level].details;console.assert(M,"Level details are defined when init segment is loaded");var P=m.stats;E.state=x.IDLE,E.fragLoadError=0,m.data=new Uint8Array(B.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),B.frag===W&&K.trigger(F.Events.FRAG_BUFFERED,{stats:P,frag:W,part:null,id:m.type}),E.tick()}).catch(function(B){E.warn(B),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var B=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(G.BufferHelper.getBuffered(B))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var B=m.frag,W=m.part,K=m.partsLoaded,V=!K||K.length===0||K.some(function(P){return!P}),M=new y.ChunkMetadata(B.level,B.sn,B.stats.chunkCount+1,0,W?W.index:-1,!V);E.flush(M)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,B,W){var K=this;if(B===void 0&&(B=null),!this.levels)throw new Error("frag load aborted, missing levels");if(B=Math.max(m.start,B||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&W){B>m.end&&E.fragmentHint&&(m=E.fragmentHint);var M=this.getNextPart(V,m,B);if(M>-1){var P=V[M];return this.log("Loading part sn: "+m.sn+" p: "+P.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(B.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=x.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:m,part:V[M],targetBufferTime:B}),this.doFragPartsLoad(m,V,M,W).catch(function($){return K.handleFragLoadError($)})}else if(!m.url||this.loadedEndOfParts(V,B))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(B.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=x.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:m,targetBufferTime:B}),this.fragmentLoader.load(m,W).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(m,E,B,W){var K=this;return new Promise(function(V,M){var P=[],$=function ae(he){var me=E[he];K.fragmentLoader.loadPart(m,me,W).then(function(De){P[me.index]=De;var xe=De.part;K.hls.trigger(F.Events.FRAG_LOADED,De);var ke=E[he+1];if(ke&&ke.fragment===m)ae(he+1);else return V({frag:m,part:xe,partsLoaded:P})}).catch(M)};$(B)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(F.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var B=E.frag,W=E.part,K=E.level,V=self.performance.now();B.stats.parsing.end=V,W&&(W.stats.parsing.end=V),this.updateLevelTiming(B,W,K,m.partial)},a.getCurrentContext=function(m){var E=this.levels,B=m.level,W=m.sn,K=m.part;if(!E||!E[B])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+B+". The current chunk will not be buffered."),null;var V=E[B],M=K>-1?Object(A.getPartWith)(V,W,K):null,P=M?M.fragment:Object(A.getFragmentWithSN)(V,W,this.fragCurrent);return P?{frag:P,part:M,level:V}:null},a.bufferFragmentData=function(m,E,B,W){if(!m||this.state!==x.PARSING)return;var K=m.data1,V=m.data2,M=K;if(K&&V&&(M=Object(T.appendUint8Array)(K,V)),!M||!M.length)return;var P={type:m.type,frag:E,part:B,chunkMeta:W,parent:E.type,data:M};this.hls.trigger(F.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!B&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!G.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var B=E.currentTime,W=G.BufferHelper.bufferInfo(E,B,0),K=m.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),M=Math.max(Math.min(m.start-V,W.end-V),B+V);m.start-M>V&&this.flushMainBuffer(M,m.start)},a.getFwdBufferInfo=function(m,E){var B=this.config,W=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(W))return null;var K=G.BufferHelper.bufferInfo(m,W,B.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(W,E);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(m,W,Math.max(K.nextStart,B.maxBufferHole))}return K},a.getMaxBufferLength=function(m){var E=this.config,B;return m?B=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):B=E.maxBufferLength,Math.min(B,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,B=m||E.maxBufferLength;return E.maxMaxBufferLength>=B?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var B,W,K=E.fragments,V=K.length;if(!V)return null;var M=this.config,P=K[0].start,$;if(E.live){var ae=M.initialLiveManifestSize;if(V<ae)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ae+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(E,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:m)}else m<=P&&($=K[0]);if(!$){var he=M.lowLatencyMode?E.partEnd:E.fragmentEnd;$=this.getFragmentAtPosition(m,he,E)}return(B=$)!==null&&B!==void 0&&B.initSegment&&!((W=$)!==null&&W!==void 0&&W.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(m,E,B){for(var W=-1,K=!1,V=!0,M=0,P=m.length;M<P;M++){var $=m[M];if(V=V&&!$.independent,W>-1&&B<$.start)break;var ae=$.loaded;!ae&&(K||$.independent||V)&&$.fragment===E&&(W=M),K=ae}return W},a.loadedEndOfParts=function(m,E){var B=m[m.length-1];return B&&E>B.start&&B.loaded},a.getInitialLiveFragment=function(m,E){var B=this.fragPrevious,W=null;if(B){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+B.programDateTime),W=Object(L.findFragmentByPDT)(E,B.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var K=B.sn+1;if(K>=m.startSN&&K<=m.endSN){var V=E[K-m.startSN];B.cc===V.cc&&(W=V,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(L.findFragWithCC)(E,B.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(W=this.getFragmentAtPosition(M,this.bitrateTest?m.fragmentEnd:m.edge,m))}return W},a.getFragmentAtPosition=function(m,E,B){var W=this.config,K=this.fragPrevious,V=B.fragments,M=B.endSN,P=B.fragmentHint,$=W.maxFragLookUpTolerance,ae=!!(W.lowLatencyMode&&B.partList&&P);ae&&P&&!this.bitrateTest&&(V=V.concat(P),M=P.sn);var he;if(m<E){var me=m>E-$?0:$;he=Object(L.findFragmentByPTS)(K,V,m,me)}else he=V[V.length-1];if(he){var De=he.sn-B.startSN,xe=K&&he.level===K.level,ke=V[De+1],Te=this.fragmentTracker.getState(he);if(Te===D.FragmentState.BACKTRACKED){he=null;for(var Se=De;V[Se]&&this.fragmentTracker.getState(V[Se])===D.FragmentState.BACKTRACKED;)K?he=V[Se--]:he=V[--Se];he||(he=ke)}else K&&he.sn===K.sn&&!ae&&(xe&&(he.sn<M&&this.fragmentTracker.getState(ke)!==D.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+ke.sn),he=ke):he=null))}return he},a.synchronizeToLiveEdge=function(m){var E=this.config,B=this.media;if(!B)return;var W=this.hls.liveSyncPosition,K=B.currentTime,V=m.fragments[0].start,M=m.edge,P=K>=V-E.maxFragLookUpTolerance&&K<=M;if(W!==null&&B.duration>W&&(K<W||!P)){var $=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!P&&B.readyState<4||K<M-$)&&(this.loadedmetadata||(this.nextLoadPosition=W),B.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+W.toFixed(3)),B.currentTime=W))}},a.alignPlaylists=function(m,E){var B=this.levels,W=this.levelLastLoaded,K=this.fragPrevious,V=W!==null?B[W]:null,M=m.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var P=m.fragments[0].start,$=!E,ae=m.alignedSliding&&Object(Q.isFiniteNumber)(P);if($||!ae&&!P){Object(I.alignStream)(K,V,m);var he=m.fragments[0].start;return this.log("Live playlist sliding: "+he.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+M),he}return P},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var B=this.startPosition;if(B<E&&(B=-1),B===-1||this.lastCurrentTime===-1){var W=m.startTimeOffset;Object(Q.isFiniteNumber)(W)?(B=E+W,W<0&&(B+=m.totalduration),B=Math.min(Math.max(E,B),E+m.totalduration),this.log("Start time offset "+W+" found in playlist, adjust startPosition to "+B),this.startPosition=B):m.live?B=this.hls.liveSyncPosition||E:this.startPosition=B=0,this.lastCurrentTime=B}this.nextLoadPosition=B},a.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var B=E.frag;if(!B||B.type!==m)return;var W=this.fragCurrent;console.assert(W&&B.sn===W.sn&&B.level===W.level&&B.urlId===W.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(B.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+B.sn+" of "+m+" "+B.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(H.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(m,E,B){if(!m)return;var W=G.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,W,B),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,E,B,W){var K=this,V=B.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(m.elementaryStreams).reduce(function(P,$){var ae=m.elementaryStreams[$];if(ae){var he=ae.endPTS-ae.startPTS;if(he<=0)return K.warn("Could not parse fragment "+m.sn+" "+$+" duration reliably ("+he+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),P||!1;var me=W?0:Object(A.updateFragPTSDTS)(V,m,ae.startPTS,ae.endPTS,ae.startDTS,ae.endDTS);return K.hls.trigger(F.Events.LEVEL_PTS_UPDATED,{details:V,level:B,drift:me,type:$,frag:m,start:ae.startPTS,end:ae.endPTS}),!0}return P},!1);M?(this.state=x.PARSED,this.hls.trigger(F.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(h,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),h}(U.default)},"./src/controller/buffer-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var Q=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts"),G=_("./src/errors.ts"),H=_("./src/utils/buffer-helper.ts"),F=_("./src/utils/mediasource-helper.ts"),O=_("./src/loader/fragment.ts"),y=_("./src/controller/buffer-operation-queue.ts"),T=Object(F.getMediaSource)(),I=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function A(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,C=o.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){D.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){D.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var w=A.prototype;return w.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},w.destroy=function(){this.unregisterListeners(),this.details=null},w.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},w.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},w._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},w.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,D.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},w.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&T){var C=this.mediaSource=new T;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},w.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(D.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){D.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):D.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},w.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(C){D.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},w.onBufferCodecs=function(o,l){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(C){var g=u.tracks[v];if(g&&typeof g.buffer.changeType=="function"){var k=l[v],x=k.codec,f=k.levelCodec,p=k.container,h=(g.levelCodec||g.codec).replace(I,"$1"),a=(f||x).replace(I,"$1");if(h!==a){var b=p+";codecs="+(f||x);u.appendChangeType(v,b)}}}else u.pendingTracks[v]=l[v]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},w.appendChangeType=function(o,l){var u=this,C=this.operationQueue,v={execute:function(){var k=u.sourceBuffer[o];k&&(D.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),k.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(k){D.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",k)}};C.append(v,o)},w.onBufferAppending=function(o,l){var u=this,C=this.hls,v=this.operationQueue,g=this.tracks,k=l.data,x=l.type,f=l.frag,p=l.part,h=l.chunkMeta,a=h.buffering[x],b=self.performance.now();a.start=b;var m=f.stats.buffering,E=p?p.stats.buffering:null;m.start===0&&(m.start=b),E&&E.start===0&&(E.start=b);var B=g.audio,W=x==="audio"&&h.id===1&&(B==null?void 0:B.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),W){var M=u.sourceBuffer[x];if(M){var P=f.start-M.timestampOffset;Math.abs(P)>=.1&&(D.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+P+") sn: "+f.sn+")"),M.timestampOffset=f.start)}}u.appendExecutor(k,x)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,m.first===0&&(m.first=M),E&&E.first===0&&(E.first=M);var P=u.sourceBuffer,$={};for(var ae in P)$[ae]=H.BufferHelper.getBuffered(P[ae]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:f,part:p,chunkMeta:h,parent:f.type,timeRanges:$})},onError:function(M){D.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",M);var P={type:G.ErrorTypes.MEDIA_ERROR,parent:f.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=G.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,P.details=G.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),C.trigger(U.Events.ERROR,P)}};v.append(K,x)},w.onBufferFlushing=function(o,l){var u=this,C=this.operationQueue,v=function(k){return{execute:u.removeExecutor.bind(u,k,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:k})},onError:function(f){D.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",f)}}};l.type?C.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(g){C.append(v(g),g)})},w.onFragParsed=function(o,l){var u=this,C=l.frag,v=l.part,g=[],k=v?v.elementaryStreams:C.elementaryStreams;k[O.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(k[O.ElementaryStreamTypes.AUDIO]&&g.push("audio"),k[O.ElementaryStreamTypes.VIDEO]&&g.push("video"));var x=function(){var p=self.performance.now();C.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var h=v?v.stats:C.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,stats:h,id:C.type})};g.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(x,g)},w.onFragChanged=function(o,l){this.flushBackBuffer()},w.onBufferEos=function(o,l){var u=this,C=this.getSourceBufferTypes().reduce(function(v,g){var k=u.sourceBuffer[g];return(!l.type||l.type===g)&&(k&&!k.ended&&(k.ended=!0,D.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),v&&!!(!k||k.ended)},!0);C&&this.blockBuffers(function(){var v=u.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},w.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},w.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,C=this.sourceBuffer;if(!u||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var g=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Q.isFiniteNumber)(g)||g<0)return;var k=u.currentTime,x=l.levelTargetDuration,f=Math.max(g,x),p=Math.floor(k/x)*x-f;v.forEach(function(h){var a=C[h];if(a){var b=H.BufferHelper.getBuffered(a);b.length>0&&p>b.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),l.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:h}))}})},w.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,C=this.mediaSource,v=o.fragments[0].start+o.totalduration,g=u.duration,k=Object(Q.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(v>k&&v>g||!Object(Q.isFiniteNumber)(g))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},w.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,C=u.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,u[0].start),g=Math.max(v,v+o.totalduration);l.setLiveSeekableRange(v,g)}},w.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!o||C===2){this.createSourceBuffers(u),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.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(g){l.executeNext(g)})}},w.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var v in o)if(!l[v]){var g=o[v];if(!g)throw Error("source buffer exists for track "+v+", however track does not");var k=g.levelCodec||g.codec,x=g.container+";codecs="+k;D.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var f=l[v]=u.addSourceBuffer(x),p=v;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[v]={buffer:f,codec:k,container:g.container,levelCodec:g.levelCodec,id:g.id},C++}catch(h){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:x})}}C&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},w._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},w._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},w._onSBUpdateError=function(o,l){D.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},w.removeExecutor=function(o,l,u){var C=this.media,v=this.mediaSource,g=this.operationQueue,k=this.sourceBuffer,x=k[o];if(!C||!v||!x){D.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(o);return}var f=Object(Q.isFiniteNumber)(C.duration)?C.duration:Infinity,p=Object(Q.isFiniteNumber)(v.duration)?v.duration:Infinity,h=Math.max(0,l),a=Math.min(u,f,p);a>h?(D.logger.log("[buffer-controller]: Removing ["+h+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(h,a)):g.shiftAndExecuteNext(o)},w.appendExecutor=function(o,l){var u=this.operationQueue,C=this.sourceBuffer,v=C[l];if(!v){D.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(o)},w.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){D.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,v=l.map(function(g){return C.appendBlocker(g)});Promise.all(v).then(function(){o(),l.forEach(function(g){var k=u.sourceBuffer[g];(!k||!k.updating)&&C.shiftAndExecuteNext(g)})})},w.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},w.addBufferListener=function(o,l,u){var C=this.sourceBuffer[o];if(!C)return;var v=u.bind(this,o);this.listeners[o].push({event:l,listener:v}),C.addEventListener(l,v)},w.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return U});var Q=_("./src/utils/logger.ts"),U=function(){function D(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var G=D.prototype;return G.append=function(F,O){var y=this.queues[O];y.push(F),y.length===1&&this.buffers[O]&&this.executeNext(O)},G.insertAbort=function(F,O){var y=this.queues[O];y.unshift(F),this.executeNext(O)},G.appendBlocker=function(F){var O,y=new Promise(function(I){O=I}),T={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,F),y},G.executeNext=function(F){var O=this.buffers,y=this.queues,T=O[F],I=y[F];if(I.length){var L=I[0];try{L.execute()}catch(A){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(A),(!T||!T.updating)&&(I.shift(),this.executeNext(F))}}},G.shiftAndExecuteNext=function(F){this.queues[F].shift(),this.executeNext(F)},G.current=function(F){return this.queues[F][0]},D}()},"./src/controller/cap-level-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts");function U(H,F){for(var O=0;O<F.length;O++){var y=F[O];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(H,y.key,y)}}function D(H,F,O){return F&&U(H.prototype,F),O&&U(H,O),H}var G=function(){function H(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 F=H.prototype;return F.setStreamController=function(y){this.streamController=y},F.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},F.registerListeners=function(){var y=this.hls;y.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},F.unregisterListener=function(){var y=this.hls;y.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},F.onFpsDropLevelCapping=function(y,T){H.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},F.onMediaAttaching=function(y,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},F.onManifestParsed=function(y,T){var I=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,I.config.capLevelToPlayerSize&&T.video&&this.startCapping()},F.onBufferCodecs=function(y,T){var I=this.hls;I.config.capLevelToPlayerSize&&T.video&&this.startCapping()},F.onMediaDetaching=function(){this.stopCapping()},F.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(y.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},F.getMaxLevel=function(y){var T=this,I=this.hls.levels;if(!I.length)return-1;var L=I.filter(function(A,w){return H.isLevelAllowed(w,T.restrictedLevels)&&w<=y});return this.clientRect=null,H.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},F.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()},F.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},F.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,T={width:0,height:0};if(y){var I=y.getBoundingClientRect();T.width=I.width,T.height=I.height,!T.width&&!T.height&&(T.width=I.right-I.left||y.width||0,T.height=I.bottom-I.top||y.height||0)}return this.clientRect=T,T},H.isLevelAllowed=function(y,T){return T===void 0&&(T=[]),T.indexOf(y)===-1},H.getMaxLevelByMediaSize=function(y,T,I){if(!y||!y.length)return-1;for(var L=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},A=y.length-1,w=0;w<y.length;w+=1){var d=y[w];if((d.width>=T||d.height>=I)&&L(d,y[w+1])){A=w;break}}return A},D(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(T){}return y}}]),H}();Z.default=G},"./src/controller/cmcd-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var Q=_("./src/events.ts"),U=_("./src/types/cmcd.ts"),D=_("./src/utils/buffer-helper.ts"),G=_("./src/utils/logger.ts");function H(A,w){for(var d=0;d<w.length;d++){var o=w[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(A,o.key,o)}}function F(A,w,d){return w&&H(A.prototype,w),d&&H(A,d),A}function O(A,w){var d=typeof Symbol!="undefined"&&A[Symbol.iterator]||A["@@iterator"];if(d)return(d=d.call(A)).next.bind(d);if(Array.isArray(A)||(d=y(A))||w&&A&&typeof A.length=="number"){d&&(A=d);var o=0;return function(){return o>=A.length?{done:!0}:{done:!1,value:A[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(A,w){if(!A)return;if(typeof A=="string")return T(A,w);var d=Object.prototype.toString.call(A).slice(8,-1);if(d==="Object"&&A.constructor&&(d=A.constructor.name),d==="Map"||d==="Set")return Array.from(A);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return T(A,w)}function T(A,w){(w==null||w>A.length)&&(w=A.length);for(var d=0,o=new Array(w);d<w;d++)o[d]=A[d];return o}function I(){return I=Object.assign||function(A){for(var w=1;w<arguments.length;w++){var d=arguments[w];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(A[o]=d[o])}return A},I.apply(this,arguments)}var L=function(){function A(d){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(C){try{o.apply(C,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){G.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(C){try{var v=C.frag,g=o.hls.levels[v.level],k=o.getObjectType(v),x={d:v.duration*1e3,ot:k};(k===U.CMCDObjectType.VIDEO||k===U.CMCDObjectType.AUDIO||k==U.CMCDObjectType.MUXED)&&(x.br=g.bitrate/1e3,x.tb=o.getTopBandwidth(k),x.bl=o.getBufferLength(k)),o.apply(C,x)}catch(f){G.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=d;var l=this.config=d.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||A.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var w=A.prototype;return w.registerListeners=function(){var o=this.hls;o.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},w.unregisterListeners=function(){var o=this.hls;o.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},w.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},w.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},w.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},w.onBufferCreated=function(o,l){var u,C;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},w.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},w.apply=function(o,l){l===void 0&&(l={}),I(l,this.createData());var u=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=A.toHeaders(l);if(!Object.keys(C).length)return;o.headers||(o.headers={}),I(o.headers,C)}else{var v=A.toQuery(l);if(!v)return;o.url=A.appendQueryToUri(o.url,v)}},w.getObjectType=function(o){var l=o.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},w.getTopBandwidth=function(o){for(var l=0,u=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=O(u),v;!(v=C()).done;){var g=v.value;g.bitrate>l&&(l=g.bitrate)}return l>0?l:NaN},w.getBufferLength=function(o){var l=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var C=D.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return C.len*1e3},w.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function C(g){this.loader=void 0,this.loader=new u(g)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,x,f){l(k),this.loader.load(k,x,f)},F(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},w.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function C(g){this.loader=void 0,this.loader=new u(g)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,x,f){l(k),this.loader.load(k,x,f)},F(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},A.serialize=function(o){for(var l=[],u=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},C=function(W){return Math.round(W)},v=function(W){return C(W/100)*100},g=function(W){return encodeURIComponent(W)},k={br:C,d:C,bl:v,dl:v,mtp:v,nor:g,rtp:v,tb:C},x=Object.keys(o||{}).sort(),f=O(x),p;!(p=f()).done;){var h=p.value,a=o[h];if(!u(a))continue;if(h==="v"&&a===1)continue;if(h=="pr"&&a===1)continue;var b=k[h];b&&(a=b(a));var m=typeof a,E=void 0;h==="ot"||h==="sf"||h==="st"?E=h+"="+a:m==="boolean"?E=h:m==="number"?E=h+"="+a:E=h+"="+JSON.stringify(a),l.push(E)}return l.join(",")},A.toHeaders=function(o){for(var l=Object.keys(o),u={},C=["Object","Request","Session","Status"],v=[{},{},{},{}],g={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},k=0,x=l;k<x.length;k++){var f=x[k],p=g[f]!=null?g[f]:1;v[p][f]=o[f]}for(var h=0;h<v.length;h++){var a=A.serialize(v[h]);a&&(u["CMCD-"+C[h]]=a)}return u},A.toQuery=function(o){return"CMCD="+encodeURIComponent(A.serialize(o))},A.appendQueryToUri=function(o,l){if(!l)return o;var u=o.includes("?")?"&":"?";return""+o+u+l},A}()},"./src/controller/eme-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/utils/logger.ts"),G=_("./src/utils/mediakeys-helper.ts");function H(L,A){for(var w=0;w<A.length;w++){var d=A[w];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function F(L,A,w){return A&&H(L.prototype,A),w&&H(L,w),L}var O=3,y=function(A,w,d){var o={audioCapabilities:[],videoCapabilities:[]};return A.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),w.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},T=function(A,w,d,o){switch(A){case G.KeySystems.WIDEVINE:return y(w,d,o);default:throw new Error("Unknown key-system: "+A)}},I=function(){function L(w){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=w,this._config=w.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 A=L.prototype;return A.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},A._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A.getLicenseServerUrl=function(d){switch(d){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},A._attemptKeySystemAccess=function(d,o,l){var u=this,C=T(d,o,l,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(d,C);this.mediaKeysPromise=v.then(function(g){return u._onMediaKeySystemAccessObtained(d,g)}),v.catch(function(g){D.logger.error('Failed to obtain key-system "'+d+'" access:',g)})},A._onMediaKeySystemAccessObtained=function(d,o){var l=this;D.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return u.mediaKeys=v,D.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),v});return C.catch(function(v){D.logger.error("Failed to create media-keys:",v)}),C},A._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},A._onNewMediaKeySession=function(d){var o=this;D.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},A._onKeySessionMessage=function(d,o){D.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){D.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},A.onMediaEncrypted=function(d){var o=this;if(D.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},A._attemptSetMediaKeys=function(d){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){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}D.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},A._generateRequestWithPreferredKeySession=function(d,o){var l=this,u=this._mediaKeysList[0];if(!u){D.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){D.logger.warn("Key-Session already initialized but requested again");return}var C=u.mediaKeysSession;if(!C){D.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){D.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}D.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,C.generateRequest(d,o).then(function(){D.logger.debug("Key-session generation succeeded")}).catch(function(v){D.logger.error("Error generating key-session request:",v),l.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},A._createLicenseXhr=function(d,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,u,d),C=void 0}catch(v){D.logger.error(v)}try{u.readyState||u.open("POST",d,!0),C&&C.call(this.hls,u,d)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return u},A._onLicenseRequestReadyStageChange=function(d,o,l,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var C=d.response,v=this._licenseResponseCallback;if(v)try{C=v.call(this.hls,d,o)}catch(k){D.logger.error(k)}u(C)}else{if(D.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=O-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(l,u)}break}},A._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},A._requestLicense=function(d,o){D.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){D.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(u,d,o);D.logger.log("Sending license request to URL: "+u);var v=this._generateLicenseRequestChallenge(l,d);C.send(v)}catch(g){D.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,u)},F(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Z.default=I},"./src/controller/fps-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts"),U=_("./src/utils/logger.ts"),D=function(){function G(F){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=F,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(O){this.streamController=O},H.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(O,y){var T=this.hls.config;if(T.capLevelOnFPSDrop){var I=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=I,I&&typeof I.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(O,y,T){var I=performance.now();if(y){if(this.lastTime){var L=I-this.lastTime,A=T-this.lastDroppedFrames,w=y-this.lastDecodedFrames,d=1e3*A/L,o=this.hls;if(o.trigger(Q.Events.FPS_DROP,{currentDropped:A,currentDecoded:w,totalDroppedFrames:T}),d>0&&A>o.config.fpsDroppedMonitoringThreshold*w){var l=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=I,this.lastDroppedFrames=T,this.lastDecodedFrames=y}},H.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}();Z.default=D},"./src/controller/fragment-finders.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"findFragmentByPDT",function(){return D}),_.d(Z,"findFragmentByPTS",function(){return G}),_.d(Z,"fragmentWithinToleranceTest",function(){return H}),_.d(Z,"pdtWithinToleranceTest",function(){return F}),_.d(Z,"findFragWithCC",function(){return O});var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/binary-search.ts");function D(y,T,I){if(T===null||!Array.isArray(y)||!y.length||!Object(Q.isFiniteNumber)(T))return null;var L=y[0].programDateTime;if(T<(L||0))return null;var A=y[y.length-1].endProgramDateTime;if(T>=(A||0))return null;I=I||0;for(var w=0;w<y.length;++w){var d=y[w];if(F(T,I,d))return d}return null}function G(y,T,I,L){I===void 0&&(I=0),L===void 0&&(L=0);var A=null;if(y?A=T[y.sn-T[0].sn+1]||null:I===0&&T[0].start===0&&(A=T[0]),A&&H(I,L,A)===0)return A;var w=U.default.search(T,H.bind(null,I,L));return w||A}function H(y,T,I){y===void 0&&(y=0),T===void 0&&(T=0);var L=Math.min(T,I.duration+(I.deltaPTS?I.deltaPTS:0));return I.start+I.duration-L<=y?1:I.start-L>y&&I.start?-1:0}function F(y,T,I){var L=Math.min(T,I.duration+(I.deltaPTS?I.deltaPTS:0))*1e3,A=I.endProgramDateTime||0;return A-L>y}function O(y,T){return U.default.search(y,function(I){return I.cc<T?1:I.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"FragmentState",function(){return D}),_.d(Z,"FragmentTracker",function(){return G});var Q=_("./src/events.ts"),U=_("./src/types/loader.ts"),D;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(D||(D={}));var G=function(){function O(T){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=T,this._registerListeners()}var y=O.prototype;return y._registerListeners=function(){var I=this.hls;I.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),I.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),I.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var I=this.hls;I.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),I.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),I.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(I,L){if(L===U.PlaylistLevelType.MAIN){var A=this.activeFragment,w=this.activeParts;if(!A)return null;if(w)for(var d=w.length;d--;){var o=w[d],l=o?o.end:A.appendedPTS;if(o.start<=I&&l!==void 0&&I<=l)return d>9&&(this.activeParts=w.slice(d-9)),o}else if(A.start<=I&&A.appendedPTS!==void 0&&I<=A.appendedPTS)return A}return this.getBufferedFrag(I,L)},y.getBufferedFrag=function(I,L){for(var A=this.fragments,w=Object.keys(A),d=w.length;d--;){var o=A[w[d]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=I&&I<=l.end)return l}}return null},y.detectEvictedFragments=function(I,L,A){var w=this;Object.keys(this.fragments).forEach(function(d){var o=w.fragments[d];if(!o)return;if(!o.buffered){o.body.type===A&&w.removeFragment(o.body);return}var l=o.range[I];if(!l)return;l.time.some(function(u){var C=!w.isTimeBuffered(u.startPTS,u.endPTS,L);return C&&w.removeFragment(o.body),C})})},y.detectPartialFragments=function(I){var L=this,A=this.timeRanges,w=I.frag,d=I.part;if(!A||w.sn==="initSegment")return;var o=F(w),l=this.fragments[o];if(!l)return;Object.keys(A).forEach(function(u){var C=w.elementaryStreams[u];if(!C)return;var v=A[u],g=d!==null||C.partial===!0;l.range[u]=L.getBufferedTimes(w,d,g,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(I){var L=F(I),A=this.fragments[L];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},y.getBufferedTimes=function(I,L,A,w){for(var d={time:[],partial:A},o=L?L.start:I.start,l=L?L.end:I.end,u=I.minEndPTS||l,C=I.maxStartPTS||o,v=0;v<w.length;v++){var g=w.start(v)-this.bufferPadding,k=w.end(v)+this.bufferPadding;if(C>=g&&u<=k){d.time.push({startPTS:Math.max(o,w.start(v)),endPTS:Math.min(l,w.end(v))});break}else if(o<k&&l>g)d.partial=!0,d.time.push({startPTS:Math.max(o,w.start(v)),endPTS:Math.min(l,w.end(v))});else if(l<=g)break}return d},y.getPartialFragment=function(I){var L=null,A,w,d,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var v=u[C];if(!v)return;H(v)&&(w=v.body.start-l,d=v.body.end+l,I>=w&&I<=d&&(A=Math.min(I-w,d-I),o<=A&&(L=v.body,o=A)))}),L},y.getState=function(I){var L=F(I),A=this.fragments[L];return A?A.buffered?H(A)?D.PARTIAL:D.OK:A.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},y.backtrack=function(I,L){var A=F(I),w=this.fragments[A];if(!w||w.backtrack)return null;var d=w.backtrack=L||w.loaded;return w.loaded=null,d},y.getBacktrackData=function(I){var L=F(I),A=this.fragments[L];if(A){var w,d=A.backtrack;if(d!=null&&(w=d.payload)!==null&&w!==void 0&&w.byteLength)return d;this.removeFragment(I)}return null},y.isTimeBuffered=function(I,L,A){for(var w,d,o=0;o<A.length;o++){if(w=A.start(o)-this.bufferPadding,d=A.end(o)+this.bufferPadding,I>=w&&L<=d)return!0;if(L<=w)return!1}return!1},y.onFragLoaded=function(I,L){var A=L.frag,w=L.part;if(A.sn==="initSegment"||A.bitrateTest||w)return;var d=F(A);this.fragments[d]={body:A,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(I,L){var A=this,w=L.frag,d=L.part,o=L.timeRanges;if(w.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=w,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var C=o[u];if(A.detectEvictedFragments(u,C),!d)for(var v=0;v<C.length;v++)w.appendedPTS=Math.max(C.end(v),w.appendedPTS||0)})},y.onFragBuffered=function(I,L){this.detectPartialFragments(L)},y.hasFragment=function(I){var L=F(I);return!!this.fragments[L]},y.removeFragmentsInRange=function(I,L,A){var w=this;Object.keys(this.fragments).forEach(function(d){var o=w.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===A&&l.start<L&&l.end>I&&w.removeFragment(l)}})},y.removeFragment=function(I){var L=F(I);I.stats.loaded=0,I.clearElementaryStreamInfo(),delete this.fragments[L]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function H(O){var y,T;return O.buffered&&(((y=O.range.video)===null||y===void 0?void 0:y.partial)||((T=O.range.audio)===null||T===void 0?void 0:T.partial))}function F(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),_.d(Z,"MAX_START_GAP_JUMP",function(){return F}),_.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),_.d(Z,"SKIP_BUFFER_RANGE_START",function(){return y}),_.d(Z,"default",function(){return T});var Q=_("./src/utils/buffer-helper.ts"),U=_("./src/errors.ts"),D=_("./src/events.ts"),G=_("./src/utils/logger.ts"),H=250,F=2,O=.1,y=.05,T=function(){function I(A,w,d,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=A,this.media=w,this.fragmentTracker=d,this.hls=o}var L=I.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(w){var d=this.config,o=this.media,l=this.stalled,u=o.currentTime,C=o.seeking,v=this.seeking&&!C,g=!this.seeking&&C;if(this.seeking=C,u!==w){if(this.moved=!0,l!==null){if(this.stallReported){var k=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Q.BufferHelper.getBuffered(o).length)return;var x=Q.BufferHelper.bufferInfo(o,u,0),f=x.len>0,p=x.nextStart||0;if(!f&&!p)return;if(C){var h=x.len>F,a=!p||p-u>F&&!this.fragmentTracker.getPartialFragment(u);if(h||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,m=Math.max(p,x.start||0)-u,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=E==null||((b=E.details)===null||b===void 0)?void 0:b.live,W=B?E.details.targetduration*2:F;if(m>0&&m<=W){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!C&&V>=H&&this._reportStall(x.len);var M=Q.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(M,V)},L._tryFixBufferStall=function(w,d){var o=this.config,l=this.fragmentTracker,u=this.media,C=u.currentTime,v=l.getPartialFragment(C);if(v){var g=this._trySkipBufferHole(v);if(g)return}w.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(w){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+w+")"),d.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:w}))},L._trySkipBufferHole=function(w){for(var d=this.config,o=this.hls,l=this.media,u=l.currentTime,C=0,v=Q.BufferHelper.getBuffered(l),g=0;g<v.length;g++){var k=v.start(g);if(u+d.maxBufferHole>=C&&u<k){var x=Math.max(k+y,l.currentTime+O);return G.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,w&&o.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+x,frag:w}),x}C=v.end(g)}return 0},L._tryNudgeBuffer=function(){var w=this.config,d=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<w.nudgeMaxRetry){var C=l+u*w.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+C),o.currentTime=C,d.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+w.nudgeMaxRetry+" nudges"),d.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},I}()},"./src/controller/id3-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),D=_("./src/demux/id3.ts"),G=.25,H=function(){function F(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var O=F.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var T=this.hls;T.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var T=this.hls;T.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(T,I){this.media=I.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(T){if(!this.media)return;for(var I=0;I<T.length;I++){var L=T[I];if(L.kind==="metadata"&&L.label==="id3")return Object(U.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(T,I){if(!this.media)return;var L=I.frag,A=I.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var w=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<A.length;d++){var o=D.getID3Frames(A[d].data);if(o){var l=A[d].pts,u=d<A.length-1?A[d+1].pts:L.end,C=u-l;C<=0&&(u=l+G);for(var v=0;v<o.length;v++){var g=o[v];if(!D.isTimeStampFrame(g)){var k=new w(l,u,"");k.value=g,this.id3Track.addCue(k)}}}}},O.onBufferFlushing=function(T,I){var L=I.startOffset,A=I.endOffset,w=I.type;if(!w||w==="audio"){var d=this.id3Track;d&&Object(U.removeCuesInRange)(d,L,A)}},F}();Z.default=H},"./src/controller/latency-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return F});var Q=_("./src/errors.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts");function G(O,y){for(var T=0;T<y.length;T++){var I=y[T];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(O,I.key,I)}}function H(O,y,T){return y&&G(O.prototype,y),T&&G(O,T),O}var F=function(){function O(T){var I=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 I.timeupdate()},this.hls=T,this.config=T.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(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},y.onMediaAttached=function(I,L){this.media=L.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(I,L){var A=L.details;this.levelDetails=A,A.advanced&&this.timeupdate(),!A.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(I,L){if(L.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,D.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var I=this.media,L=this.levelDetails;if(!I||!L)return;this.currentTime=I.currentTime;var A=this.computeLatency();if(A===null)return;this._latency=A;var w=this.config,d=w.lowLatencyMode,o=w.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var u=A-l,C=Math.min(this.maxLatency,l+L.targetduration),v=u<C;if(L.live&&v&&u>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,o)),k=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;I.playbackRate=Math.min(g,Math.max(1,k))}else I.playbackRate!==1&&I.playbackRate!==0&&(I.playbackRate=1)},y.estimateLiveEdge=function(){var I=this.levelDetails;return I===null?null:I.edge+I.age},y.computeLatency=function(){var I=this.estimateLiveEdge();return I===null?null:I-this.currentTime},H(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var I=this.config,L=this.levelDetails;return I.liveMaxLatencyDuration!==void 0?I.liveMaxLatencyDuration:L?I.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var I=this.levelDetails;if(I===null)return null;var L=I.holdBack,A=I.partHoldBack,w=I.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,u=d.lowLatencyMode,C=this.hls.userConfig,v=u&&A||L;(C.liveSyncDuration||C.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*w);var g=w,k=1;return v+Math.min(this.stallCount*k,g)}},{key:"liveSyncPosition",get:function(){var I=this.estimateLiveEdge(),L=this.targetLatency,A=this.levelDetails;if(I===null||L===null||A===null)return null;var w=A.edge,d=I-L-this.edgeStalled,o=w-A.totalduration,l=w-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var I=this.levelDetails;return I===null?1:I.drift}},{key:"edgeStalled",get:function(){var I=this.levelDetails;if(I===null)return 0;var L=(this.config.lowLatencyMode&&I.partTarget||I.targetduration)*3;return Math.max(I.age-L,0)}},{key:"forwardBufferLength",get:function(){var I=this.media,L=this.levelDetails;if(!I||!L)return 0;var A=I.buffered.length;return A?I.buffered.end(A-1):L.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return d});var Q=_("./src/types/level.ts"),U=_("./src/events.ts"),D=_("./src/errors.ts"),G=_("./src/utils/codecs.ts"),H=_("./src/controller/level-helper.ts"),F=_("./src/controller/base-playlist-controller.ts"),O=_("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var C in u)Object.prototype.hasOwnProperty.call(u,C)&&(o[C]=u[C])}return o},y.apply(this,arguments)}function T(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function I(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,A(o,l)}function A(o,l){return A=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},A(o,l)}var w=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){L(l,o);function l(C){var v;return v=o.call(this,C,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var u=l.prototype;return u._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var v=this._levels;v.forEach(function(g){g.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(v,g){var k=[],x=[],f=[],p,h={},a,b=!1,m=!1,E=!1;if(g.levels.forEach(function(V){var M=V.attrs;b=b||!!(V.width&&V.height),m=m||!!V.videoCodec,E=E||!!V.audioCodec,w&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var P=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=h[P],a?a.url.push(V.url):(a=new Q.Level(V),h[P]=a,k.push(a)),M&&(M.AUDIO&&Object(H.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(H.addGroupId)(a,"text",M.SUBTITLES))}),(b||m)&&E&&(k=k.filter(function(V){var M=V.videoCodec,P=V.width,$=V.height;return!!M||!!(P&&$)})),k=k.filter(function(V){var M=V.audioCodec,P=V.videoCodec;return(!M||Object(G.isCodecSupportedInMp4)(M,"audio"))&&(!P||Object(G.isCodecSupportedInMp4)(P,"video"))}),g.audioTracks&&(x=g.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(x)),g.subtitles&&(f=g.subtitles,Object(H.assignTrackIdsByGroup)(f)),k.length>0){p=k[0].bitrate,k.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=k;for(var B=0;B<k.length;B++)if(k[B].bitrate===p){this._firstLevel=B,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+p);break}var W=E&&!m,K={levels:k,audioTracks:x,subtitleTracks:f,firstLevel:this._firstLevel,stats:g.stats,audio:E,video:m,altAudio:!W&&x.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(v,g){if(o.prototype.onError.call(this,v,g),g.fatal)return;var k=g.context,x=this._levels[this.currentLevelIndex];if(k&&(k.type===O.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&k.groupId===x.audioGroupIds[x.urlId]||k.type===O.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&k.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,p=!0,h;switch(g.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=g.frag.level)):h=g.frag.level}break;case D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(p=!1),h=k.level),f=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:h=g.level,f=!0;break}h!==void 0&&this.recoverLevel(g,h,f,p)},u.recoverLevel=function(v,g,k,x){var f=v.details,p=this._levels[g];if(p.loadError++,k){var h=this.retryLoadingOrFail(v);if(h)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=p.url.length;if(a>1&&p.loadError<a)v.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var b=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(f+": switch to "+b),v.levelRetry=!0,this.hls.nextAutoLevel=b)}}},u.redundantFailover=function(v){var g=this._levels[v],k=g.url.length;if(k>1){var x=(g.urlId+1)%k;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(f){f.urlId=x}),this.level=v}},u.onFragLoaded=function(v,g){var k=g.frag;if(k!==void 0&&k.type===O.PlaylistLevelType.MAIN){var x=this._levels[k.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(v,g){var k,x=g.level,f=g.details,p=this._levels[x];if(!p){var h;this.warn("Invalid level index "+x),(h=g.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(f.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(x,g,p.details)):(k=g.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(v,g){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var x=-1,f=this.hls.audioTracks[g.id].groupId,p=0;p<k.audioGroupIds.length;p++)if(k.audioGroupIds[p]===f){x=p;break}x!==k.urlId&&(k.urlId=x,this.startLoad())}},u.loadPlaylist=function(v){var g=this.currentLevelIndex,k=this._levels[g];if(this.canLoad&&k&&k.url.length>0){var x=k.urlId,f=k.url[x];if(v)try{f=v.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+g+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+x+" "+f),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:f,level:g,id:x,deliveryDirectives:v||null})}},u.removeLevel=function(v,g){var k=function(p,h){return h!==g},x=this._levels.filter(function(f,p){return p!==v?!0:f.url.length>1&&g!==void 0?(f.url=f.url.filter(k),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(k)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(k)),f.urlId=0,!0):!1}).map(function(f,p){var h=f.details;return h!=null&&h.fragments&&h.fragments.forEach(function(a){a.level=p}),f});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},I(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var g,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===v&&(g=k[v])!==null&&g!==void 0&&g.details)return;if(v<0||v>=k.length){var x=v<0;if(this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:x,reason:"invalid level idx"}),x)return;v=Math.min(v,k.length-1)}this.clearTimer();var f=this.currentLevelIndex,p=k[f],h=k[v];this.log("switching to level "+v+" from "+f),this.currentLevelIndex=v;var a=y({},h,{level:v,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var b=h.details;if(!b||b.live){var m=this.switchParams(h.uri,p==null?void 0:p.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)}}]),l}(F.default)},"./src/controller/level-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"addGroupId",function(){return D}),_.d(Z,"assignTrackIdsByGroup",function(){return G}),_.d(Z,"updatePTS",function(){return H}),_.d(Z,"updateFragPTSDTS",function(){return O}),_.d(Z,"mergeDetails",function(){return y}),_.d(Z,"mapPartIntersection",function(){return T}),_.d(Z,"mapFragmentIntersection",function(){return I}),_.d(Z,"adjustSliding",function(){return L}),_.d(Z,"addSliding",function(){return A}),_.d(Z,"computeReloadInterval",function(){return w}),_.d(Z,"getFragmentWithSN",function(){return d}),_.d(Z,"getPartWith",function(){return o});var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts");function D(l,u,C){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function G(l){var u={};l.forEach(function(C){var v=C.groupId||"";C.id=u[v]=u[v]||0,u[v]++})}function H(l,u,C){var v=l[u],g=l[C];F(v,g)}function F(l,u){var C=u.startPTS;if(Object(Q.isFiniteNumber)(C)){var v=0,g;u.sn>l.sn?(v=C-l.start,g=l):(v=l.start-C,g=u),g.duration!==v&&(g.duration=v)}else if(u.sn>l.sn){var k=l.cc===u.cc;k&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function O(l,u,C,v,g,k){var x=v-C;x<=0&&(U.logger.warn("Fragment should have a positive duration",u),v=C+u.duration,k=g+u.duration);var f=C,p=v,h=u.startPTS,a=u.endPTS;if(Object(Q.isFiniteNumber)(h)){var b=Math.abs(h-C);Object(Q.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(b,u.deltaPTS):u.deltaPTS=b,f=Math.max(C,h),C=Math.min(C,h),g=Math.min(g,u.startDTS),p=Math.min(v,a),v=Math.max(v,a),k=Math.max(k,u.endDTS)}u.duration=v-C;var m=C-u.start;u.appendedPTS=v,u.start=u.startPTS=C,u.maxStartPTS=f,u.startDTS=g,u.endPTS=v,u.minEndPTS=p,u.endDTS=k;var E=u.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var B,W=E-l.startSN,K=l.fragments;for(K[W]=u,B=W;B>0;B--)F(K[B],K[B-1]);for(B=W;B<K.length-1;B++)F(K[B],K[B+1]);return l.fragmentHint&&F(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function y(l,u){for(var C=null,v=l.fragments,g=v.length-1;g>=0;g--){var k=v[g].initSegment;if(k){C=k;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,f;if(I(l,u,function(B,W){B.relurl&&(x=B.cc-W.cc),Object(Q.isFiniteNumber)(B.startPTS)&&Object(Q.isFiniteNumber)(B.endPTS)&&(W.start=W.startPTS=B.startPTS,W.startDTS=B.startDTS,W.appendedPTS=B.appendedPTS,W.maxStartPTS=B.maxStartPTS,W.endPTS=B.endPTS,W.endDTS=B.endDTS,W.minEndPTS=B.minEndPTS,W.duration=B.endPTS-B.startPTS,W.duration&&(f=W),u.PTSKnown=u.alignedSliding=!0),W.elementaryStreams=B.elementaryStreams,W.loader=B.loader,W.stats=B.stats,W.urlId=B.urlId,B.initSegment&&(W.initSegment=B.initSegment,C=B.initSegment)}),C){var p=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;p.forEach(function(B){var W;(!B.initSegment||B.initSegment.relurl===((W=C)===null||W===void 0?void 0:W.relurl))&&(B.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(B){return!B}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=u.skippedSegments;h--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<a.length;b++)a[b].cc+=x}u.skippedSegments&&(u.startCC=u.fragments[0].cc),T(l.partList,u.partList,function(B,W){W.elementaryStreams=B.elementaryStreams,W.stats=B.stats}),f?O(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):L(l,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var m=u.advancedDateTime;if(u.advanced&&m){var E=u.edge;u.driftStart||(u.driftStartTime=m,u.driftStart=E),u.driftEndTime=m,u.driftEnd=E}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function T(l,u,C){if(l&&u)for(var v=0,g=0,k=l.length;g<=k;g++){var x=l[g],f=u[g+v];x&&f&&x.index===f.index&&x.fragment.sn===f.fragment.sn?C(x,f):v--}}function I(l,u,C){for(var v=u.skippedSegments,g=Math.max(l.startSN,u.startSN)-u.startSN,k=(l.fragmentHint?1:0)+(v?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,x=u.startSN-l.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,p=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,h=g;h<=k;h++){var a=p[x+h],b=f[h];v&&!b&&h<v&&(b=u.fragments[h]=a),a&&b&&C(a,b)}}function L(l,u){var C=u.startSN+u.skippedSegments-l.startSN,v=l.fragments;if(C<0||C>=v.length)return;A(u,v[C].start)}function A(l,u){if(u){for(var C=l.fragments,v=l.skippedSegments;v<C.length;v++)C[v].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function w(l,u){var C=1e3*l.levelTargetDuration,v=C/2,g=l.age,k=g>0&&g<C*3,x=u.loading.end-u.loading.start,f,p=l.availabilityDelay;if(l.updated===!1)if(k){var h=333*l.misses;f=Math.max(Math.min(v,x*2),h),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=v;else k?(p=Math.min(p||C/2,g),l.availabilityDelay=p,f=p+C-g):f=C-x;return Math.round(f)}function d(l,u,C){if(!l||!l.details)return null;var v=l.details,g=v.fragments[u-v.startSN];return g||(g=v.fragmentHint,g&&g.sn===u?g:u<v.startSN&&C&&C.sn===u?C:null)}function o(l,u,C){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var g=v.length;g--;){var k=v[g];if(k.index===C&&k.fragment.sn===u)return k}return null}},"./src/controller/stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return v});var Q=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),D=_("./src/is-supported.ts"),G=_("./src/events.ts"),H=_("./src/utils/buffer-helper.ts"),F=_("./src/controller/fragment-tracker.ts"),O=_("./src/types/loader.ts"),y=_("./src/loader/fragment.ts"),T=_("./src/demux/transmuxer-interface.ts"),I=_("./src/types/transmuxer.ts"),L=_("./src/controller/gap-controller.ts"),A=_("./src/errors.ts"),w=_("./src/utils/logger.ts");function d(g,k){for(var x=0;x<k.length;x++){var f=k[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function o(g,k,x){return k&&d(g.prototype,k),x&&d(g,x),g}function l(g,k){g.prototype=Object.create(k.prototype),g.prototype.constructor=g,u(g,k)}function u(g,k){return u=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},u(g,k)}var C=100,v=function(g){l(k,g);function k(f,p){var h;return h=g.call(this,f,p,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var x=k.prototype;return x._registerListeners=function(){var p=this.hls;p.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(G.Events.ERROR,this.onError,this),p.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var p=this.hls;p.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(G.Events.ERROR,this.onError,this),p.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(p){if(this.levels){var h=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=a.startLevel;b===-1&&(a.config.testBandwidth?(b=0,this.bitrateTest=!0):b=a.nextAutoLevel),this.level=a.nextLoadLevel=b,this.loadedmetadata=!1}h>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),p=h),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var p,h=this.levels,a=this.level,b=h==null||((p=h[a])===null||p===void 0)?void 0:p.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),B=this.retryDate;(!B||E>=B||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var p,h,a=this.hls,b=this.levelLastLoaded,m=this.levels,E=this.media,B=a.config,W=a.nextLoadLevel;if(b===null||!E&&(this.startFragRequested||!B.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[W])return;var K=m[W];this.level=a.nextLoadLevel=W;var V=K.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==W){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,O.PlaylistLevelType.MAIN);if(M===null)return;var P=M.len,$=this.getMaxBufferLength(K.maxBitrate);if(P>=$)return;if(this._streamEnded(M,V)){var ae={};this.altAudio&&(ae.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ae),this.state=U.State.ENDED;return}var he=M.end,me=this.getNextFragment(he,V);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var De=me.sn-V.startSN;De>1&&(me=V.fragments[De-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===F.FragmentState.OK&&this.nextLoadPosition>he){var xe=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,xe,O.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,V)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((p=me.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((h=me.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(me,V):this.loadFragment(me,V,he)},x.loadFragment=function(p,h,a){var b,m=this.fragmentTracker.getState(p);if(this.fragCurrent=p,m===F.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(p);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=F.FragmentState.NOT_LOADED}m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,g.prototype.loadFragment.call(this,p,h,a)):m===F.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(p){var h=this.fragmentTracker.getAppendedFrag(p,O.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},x.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,O.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var p=this.levels,h=this.media;if(h!=null&&h.readyState){var a,b=this.getAppendedFrag(h.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!h.paused&&p){var m=this.hls.nextLoadLevel,E=p[m],B=this.fragLastKbps;B&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*B)+1:a=0}else a=0;var W=this.getBufferedFrag(h.currentTime+a);if(W){var K=this.followingBufferedFrag(W);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,M=K.duration,P=Math.max(W.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(p,h){g.prototype.flushMainBuffer.call(this,p,h,this.altAudio?"video":null)},x.onMediaAttached=function(p,h){g.prototype.onMediaAttached.call(this,p,h);var a=h.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 L.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),g.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var p=this.media,h=p?p.currentTime:null;Object(Q.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},x.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},x.onManifestParsed=function(p,h){var a=!1,b=!1,m;h.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=a&&b&&!Object(D.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},x.onLevelLoading=function(p,h){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var b=a[h.level];(!b.details||b.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(b.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(p,h){var a,b=this.levels,m=h.level,E=h.details,B=E.totalduration;if(!b){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+B);var W=this.fragCurrent;W&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==h.level&&W.loader&&(this.state=U.State.IDLE,W.loader.abort()));var K=b[m],V=0;if(E.live||(a=K.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;V=this.alignPlaylists(E,K.details)}if(K.details=E,this.levelLastLoaded=m,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=U.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,V),this.tick()},x._handleFragmentLoadProgress=function(p){var h,a=p.frag,b=p.part,m=p.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var B=E[a.level],W=B.details;if(!W){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=B.videoCodec,V=W.PTSKnown||!W.live,M=(h=a.initSegment)===null||h===void 0?void 0:h.data,P=this._getAudioCodec(B),$=this.transmuxer=this.transmuxer||new T.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ae=b?b.index:-1,he=ae!==-1,me=new I.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,ae,he),De=this.initPTS[a.cc];$.push(m,M,P,K,a,b,W.totalduration,V,me,De)},x.onAudioTrackSwitching=function(p,h){var a=this.altAudio,b=!!h.url,m=h.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var B=this.hls;a&&B.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),B.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:m})}},x.onAudioTrackSwitched=function(p,h){var a=h.id,b=!!this.hls.audioTracks[a].url;if(b){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=b,this.tick()},x.onBufferCreated=function(p,h){var a=h.tracks,b,m,E=!1;for(var B in a){var W=a[B];if(W.id==="main"){if(m=B,b=W,B==="video"){var K=a[B];K&&(this.videoBuffer=K.buffer)}}else E=!0}E&&b?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(p,h){var a=h.frag,b=h.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(b?" p: "+b.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var m=b?b.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,b)},x.onError=function(p,h){switch(h.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,h);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=U.State.ERROR):!h.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);b&&b.len>.5&&(a=!this.reduceMaxBufferLength(b.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var p=this.media,h=this.gapController;if(!p||!h||!p.readyState)return;var a=H.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(p,h){var a=h.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,O.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(p,h){this.levels=h.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var p=this.media,h=p.currentTime,a=this.startPosition;if(a>=0&&h<a){if(p.seeking){w.logger.log("could not seek to "+a+", already seeking at "+h);return}var b=H.BufferHelper.getBuffered(p),m=b.length?b.start(0):0,E=m-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(w.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+h),p.currentTime=a}},x._getAudioCodec=function(p){var h=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},x._loadBitrateTestFrag=function(p){var h=this;this._doFragLoad(p).then(function(a){var b=h.hls;if(!a||b.nextLoadLevel||h.fragContextChanged(p))return;h.fragLoadError=0,h.state=U.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var m=p.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),b.trigger(G.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(p){var h,a="main",b=this.hls,m=p.remuxResult,E=p.chunkMeta,B=this.getCurrentContext(E);if(!B){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var W=B.frag,K=B.part,V=B.level,M=m.video,P=m.text,$=m.id3,ae=m.initSegment,he=this.altAudio?void 0:m.audio;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,ae){ae.tracks&&(this._bufferInitSegment(V,ae.tracks,W,E),b.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:a,tracks:ae.tracks}));var me=ae.initPTS,De=ae.timescale;Object(Q.isFiniteNumber)(me)&&(this.initPTS[W.cc]=me,b.trigger(G.Events.INIT_PTS_FOUND,{frag:W,id:a,initPTS:me,timescale:De}))}if(M&&m.independent!==!1){if(V.details){var xe=M.startPTS,ke=M.endPTS,Te=M.startDTS,Se=M.endDTS;if(K)K.elementaryStreams[M.type]={startPTS:xe,endPTS:ke,startDTS:Te,endDTS:Se};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ye=this.getLoadPosition()+this.config.maxBufferHole;if(ye<xe){this.backtrack(W);return}W.setElementaryStreamInfo(M.type,W.start,ke,W.start,Se,!0)}W.setElementaryStreamInfo(M.type,xe,ke,Te,Se),this.bufferFragmentData(M,W,K,E)}}else if(m.independent===!1){this.backtrack(W);return}if(he){var z=he.startPTS,s=he.endPTS,c=he.startDTS,R=he.endDTS;K&&(K.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:z,endPTS:s,startDTS:c,endDTS:R}),W.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,z,s,c,R),this.bufferFragmentData(he,W,K,E)}if($!=null&&(h=$.samples)!==null&&h!==void 0&&h.length){var Y={frag:W,id:a,samples:$.samples};b.trigger(G.Events.FRAG_PARSING_METADATA,Y)}if(P){var N={frag:W,id:a,samples:P.samples};b.trigger(G.Events.FRAG_PARSING_USERDATA,N)}},x._bufferInitSegment=function(p,h,a,b){var m=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var E=h.audio,B=h.video,W=h.audiovideo;if(E){var K=p.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),E.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),p.audioCodec&&p.audioCodec!==K&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+K+'"'),E.levelCodec=K,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(p.audioCodec||"")+"/"+E.codec+"]")}B&&(B.levelCodec=p.videoCodec,B.id="main",this.log("Init video buffer, container:"+B.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+B.codec+"]")),W&&this.log("Init audiovideo buffer, container:"+W.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+W.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(M){var P=h[M],$=P.initSegment;$!=null&&$.byteLength&&m.hls.trigger(G.Events.BUFFER_APPENDING,{type:M,data:$,frag:a,part:null,chunkMeta:b,parent:a.type})}),this.tick()},x.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var h=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,h?this.resetFragmentLoading(p):this.state=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var p=this.media,h=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(H.BufferHelper.isBuffered(p,a)?h=this.getAppendedFrag(a):H.BufferHelper.isBuffered(p,a+.1)&&(h=this.getAppendedFrag(a+.1)),h){var b=this.fragPlaying,m=h.level;(!b||h.sn!==b.sn||b.level!==m||h.urlId!==b.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:h}),(!b||b.level!==m)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=h)}}},o(k,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"SubtitleStreamController",function(){return l});var Q=_("./src/events.ts"),U=_("./src/utils/logger.ts"),D=_("./src/utils/buffer-helper.ts"),G=_("./src/controller/fragment-finders.ts"),H=_("./src/utils/discontinuities.ts"),F=_("./src/controller/level-helper.ts"),O=_("./src/controller/fragment-tracker.ts"),y=_("./src/controller/base-stream-controller.ts"),T=_("./src/types/loader.ts"),I=_("./src/types/level.ts");function L(u,C){for(var v=0;v<C.length;v++){var g=C[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}function A(u,C,v){return C&&L(u.prototype,C),v&&L(u,v),u}function w(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,d(u,C)}function d(u,C){return d=Object.setPrototypeOf||function(g,k){return g.__proto__=k,g},d(u,C)}var o=500,l=function(u){w(C,u);function C(g,k){var x;return x=u.call(this,g,k,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var v=C.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var k=this.hls;k.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(Q.Events.ERROR,this.onError,this),k.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var k=this.hls;k.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(Q.Events.ERROR,this.onError,this),k.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(Q.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(k,x){this.mainDetails=x.details},v.onSubtitleFragProcessed=function(k,x){var f=x.frag,p=x.success;if(this.fragPrevious=f,this.state=y.State.IDLE,!p)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var a,b=f.start,m=0;m<h.length;m++)if(b>=h[m].start&&b<=h[m].end){a=h[m];break}var E=f.start+f.duration;a?a.end=E:(a={start:b,end:E},h.push(a)),this.fragmentTracker.fragBuffered(f)},v.onBufferFlushing=function(k,x){var f=x.startOffset,p=x.endOffset;if(f===0&&p!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var b=a[h].details,m=b.targetduration,E=p-m;if(E<=0)return;x.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(B){for(var W=0;W<B.length;){if(B[W].end<=E){B.shift();continue}else if(B[W].start<E)B[W].start=E;else break;W++}}),this.fragmentTracker.removeFragmentsInRange(f,E,T.PlaylistLevelType.SUBTITLE)}},v.onError=function(k,x){var f,p=x.frag;if(!p||p.type!==T.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},v.onSubtitleTracksUpdated=function(k,x){var f=this,p=x.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(h){return new I.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){f.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(k,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(k,x){var f,p=x.details,h=x.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var m=b[a];if(h>=b.length||h!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(f=m.details)!==null&&f!==void 0&&f.live){var E=this.mainDetails;if(p.deltaUpdateFailed||!E)return;var B=E.fragments[0];if(!m.details)p.hasProgramDateTime&&E.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(p,E):B&&Object(F.addSliding)(p,B.start);else{var W=this.alignPlaylists(p,m.details);W===0&&B&&Object(F.addSliding)(p,B.start)}}if(m.details=p,this.levelLastLoaded=h,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var K=Object(G.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(k){var x=k.frag,f=k.payload,p=x.decryptdata,h=this.hls;if(this.fragContextChanged(x))return;if(f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(b){var m=performance.now();h.trigger(Q.Events.FRAG_DECRYPTED,{frag:x,payload:b,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var k,x=this.currentTrackId,f=this.levels;if(!f.length||!f[x]||!f[x].details)return;var p=f[x].details,h=p.targetduration,a=this.config,b=this.media,m=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-h,a.maxBufferHole),E=m.end,B=m.len,W=this.getMaxBufferLength()+h;if(B>W)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var K=p.fragments,V=K.length,M=p.edge,P,$=this.fragPrevious;if(E<M){var ae=a.maxFragLookUpTolerance;$&&p.hasProgramDateTime&&(P=Object(G.findFragmentByPDT)(K,$.endProgramDateTime,ae)),P||(P=Object(G.findFragmentByPTS)($,K,E,ae),!P&&$&&$.start<K[0].start&&(P=K[0]))}else P=K[V-1];(k=P)!==null&&k!==void 0&&k.encrypted?(U.logger.log("Loading key for "+P.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===O.FragmentState.NOT_LOADED&&this.loadFragment(P,p,E)}},v.loadFragment=function(k,x,f){this.fragCurrent=k,u.prototype.loadFragment.call(this,k,x,f)},A(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(y.default)},"./src/controller/subtitle-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),D=_("./src/controller/base-playlist-controller.ts"),G=_("./src/types/loader.ts");function H(L,A){for(var w=0;w<A.length;w++){var d=A[w];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function F(L,A,w){return A&&H(L.prototype,A),w&&H(L,w),L}function O(L,A){L.prototype=Object.create(A.prototype),L.prototype.constructor=L,y(L,A)}function y(L,A){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(L,A)}var T=function(L){O(A,L);function A(d){var o;return o=L.call(this,d,"[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 w=A.prototype;return w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},w.registerListeners=function(){var o=this.hls;o.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Q.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var o=this.hls;o.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Q.Events.ERROR,this.onError,this)},w.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},w.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},w.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=I(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},w.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},w.onSubtitleTrackLoaded=function(o,l){var u=l.id,C=l.details,v=this.trackId,g=this.tracksInGroup[v];if(!g){this.warn("Invalid subtitle track id "+u);return}var k=g.details;g.details=l.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,k))},w.onLevelLoading=function(o,l){this.switchLevel(l.level)},w.onLevelSwitching=function(o,l){this.switchLevel(l.level)},w.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(x){return!u||x.groupId===u});this.tracksInGroup=v;var g=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var k={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,k),g!==-1&&this.setSubtitleTrack(g,C)}},w.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var C=l[u];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},w.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},w.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,C=l.groupId,v=l.url;if(o)try{v=o.addDirectives(v)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:v,id:u,groupId:C,deliveryDirectives:o||null})}},w.toggleTrackModes=function(o){var l=this,u=this.media,C=this.subtitleDisplay,v=this.trackId;if(!u)return;var g=I(u.textTracks),k=g.filter(function(p){return p.groupId===l.groupId});if(o===-1)[].slice.call(g).forEach(function(p){p.mode="disabled"});else{var x=k[v];x&&(x.mode="disabled")}var f=k[o];f&&(f.mode=C?"showing":"hidden")},w.setSubtitleTrack=function(o,l){var u,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=C[o])!==null&&u!==void 0&&u.details)||o<-1||o>=C.length)return;this.clearTimer();var v=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var g=v.id,k=v.groupId,x=k===void 0?"":k,f=v.name,p=v.type,h=v.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:x,name:f,type:p,url:h});var a=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:o})},w.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=I(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")o=u;else if(l[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},F(A,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),A}(D.default);function I(L){for(var A=[],w=0;w<L.length;w++){var d=L[w];d.kind==="subtitles"&&d.label&&A.push(L[w])}return A}Z.default=T},"./src/controller/timeline-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"TimelineController",function(){return I});var Q=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/utils/cea-608-parser.ts"),G=_("./src/utils/output-filter.ts"),H=_("./src/utils/webvtt-parser.ts"),F=_("./src/utils/texttrack-utils.ts"),O=_("./src/utils/imsc1-ttml-parser.ts"),y=_("./src/types/loader.ts"),T=_("./src/utils/logger.ts"),I=function(){function d(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=w(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new G.default(this,"textTrack1"),C=new G.default(this,"textTrack2"),v=new G.default(this,"textTrack3"),g=new G.default(this,"textTrack4");this.cea608Parser1=new D.default(1,u,C),this.cea608Parser2=new D.default(3,v,g)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(U.Events.FRAG_LOADING,this.onFragLoading,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,C,v,g,k){for(var x=!1,f=k.length;f--;){var p=k[f],h=A(p[0],p[1],C,v);if(h>=0&&(p[0]=Math.min(p[0],C),p[1]=Math.max(p[1],v),x=!0,h/(v-C)>.5))return}if(x||k.push([C,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,C,v,g)}else{var b=this.Cues.newCue(null,C,v,g);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:b,track:u})}},o.onInitPtsFound=function(u,C){var v=this,g=C.frag,k=C.id,x=C.initPTS,f=C.timescale,p=this.unparsedVttFrags;k==="main"&&(this.initPTS[g.cc]=x,this.timescale[g.cc]=f),p.length&&(this.unparsedVttFrags=[],p.forEach(function(h){v.onFragLoaded(U.Events.FRAG_LOADED,h)}))},o.getExistingTrack=function(u){var C=this.media;if(C)for(var v=0;v<C.textTracks.length;v++){var g=C.textTracks[v];if(g[u])return g}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var C=this.captionsProperties,v=this.captionsTracks,g=this.media,k=C[u],x=k.label,f=k.languageCode,p=this.getExistingTrack(u);if(p)v[u]=p,Object(F.clearCurrentCues)(v[u]),Object(F.sendAddTrackEvent)(v[u],g);else{var h=this.createTextTrack("captions",x,f);h&&(h[u]=!0,v[u]=h)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var C=this.captionsProperties[u];if(!C)return;var v=C.label,g={_id:u,label:v,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[u]=g,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},o.createTextTrack=function(u,C,v){var g=this.media;return g?g.addTextTrack(u,C,v):void 0},o.onMediaAttaching=function(u,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(C){Object(F.clearCurrentCues)(u[C]),delete u[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=w(),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 u=this.media;if(!u)return;var C=u.textTracks;if(C)for(var v=0;v<C.length;v++)Object(F.clearCurrentCues)(C[v])},o.onSubtitleTracksUpdated=function(u,C){var v=this;this.textTracks=[];var g=C.subtitleTracks||[],k=g.some(function(h){return h.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var x=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,a){var b;if(a<f.length){for(var m=null,E=0;E<f.length;E++)if(L(f[E],h)){m=f[E];break}m&&(b=m)}b?Object(F.clearCurrentCues)(b):(b=v.createTextTrack("subtitles",h.name,h.lang),b&&(b.mode="disabled")),b&&(b.groupId=h.groupId,v.textTracks.push(b))})}else if(!x&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(u,C){var v=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(g){var k=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!k)return;var x="textTrack"+k[1],f=v.captionsProperties[x];if(!f)return;f.label=g.name,g.lang&&(f.languageCode=g.lang),f.media=g})},o.onFragLoading=function(u,C){var v=this.cea608Parser1,g=this.cea608Parser2,k=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(v&&g))return;if(C.frag.type===y.PlaylistLevelType.MAIN){var f,p,h=C.frag.sn,a=(f=C==null||((p=C.part)===null||p===void 0)?void 0:p.index)!=null?f:-1;h===k+1||h===k&&a===x+1||(v.reset(),g.reset()),this.lastSn=h,this.lastPartIndex=a}},o.onFragLoaded=function(u,C){var v=C.frag,g=C.payload,k=this.initPTS,x=this.unparsedVttFrags;if(v.type===y.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(Q.isFiniteNumber)(k[v.cc])){x.push(C),k.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var f=v.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var p=this.tracks[v.level],h=this.vttCCs;h[v.cc]||(h[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===O.IMSC1_CODEC?this._parseIMSC1(v,g):this._parseVTTs(v,g,h)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,C){var v=this,g=this.hls;Object(O.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(k){v._appendCues(k,u.level),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(k){T.logger.log("Failed to parse IMSC1: "+k),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:k})})},o._parseVTTs=function(u,C,v){var g=this,k=this.hls;Object(H.parseWebVTT)(C,this.initPTS[u.cc],this.timescale[u.cc],v,u.cc,u.start,function(x){g._appendCues(x,u.level),k.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(x){g._fallbackToIMSC1(u,C),T.logger.log("Failed to parse VTT cue: "+x),k.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:x})})},o._fallbackToIMSC1=function(u,C){var v=this,g=this.tracks[u.level];g.textCodec||Object(O.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(){g.textCodec=O.IMSC1_CODEC,v._parseIMSC1(u,C)},function(){g.textCodec="wvtt"})},o._appendCues=function(u,C){var v=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[C];if(g.mode==="disabled")return;u.forEach(function(f){return Object(F.addCueToTrack)(g,f)})}else{var k=this.tracks[C],x=k.default?"default":"subtitles"+C;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:x})}},o.onFragDecrypted=function(u,C){var v=C.frag;if(v.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(U.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,C){var v=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(v&&g))return;for(var k=0;k<C.samples.length;k++){var x=C.samples[k].bytes;if(x){var f=this.extractCea608Data(x);v.addData(C.samples[k].pts,f[0]),g.addData(C.samples[k].pts,f[1])}}},o.onBufferFlushing=function(u,C){var v=C.startOffset,g=C.endOffset,k=C.endOffsetSubtitles,x=C.type,f=this.media;if(!f||f.currentTime<g)return;if(!x||x==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(a){return Object(F.removeCuesInRange)(p[a],v,g)})}if(this.config.renderTextTracksNatively&&(v===0&&k!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(a){return Object(F.removeCuesInRange)(h[a],v,k)})}},o.extractCea608Data=function(u){for(var C=u[0]&31,v=2,g=[[],[]],k=0;k<C;k++){var x=u[v++],f=127&u[v++],p=127&u[v++],h=(4&x)!==0,a=3&x;if(f===0&&p===0)continue;h&&((a===0||a===1)&&(g[a].push(f),g[a].push(p)))}return g},d}();function L(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function A(d,o,l,u){return Math.min(o,u)-Math.max(d,l)}function w(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return Q});var Q=function(){function U(G,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=H}var D=U.prototype;return D.decrypt=function(H,F){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},F,H)},U}()},"./src/crypt/aes-decryptor.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"removePadding",function(){return U}),_.d(Z,"default",function(){return D});var Q=_("./src/utils/typed-array.ts");function U(G){var H=G.byteLength,F=H&&new DataView(G.buffer).getUint8(H-1);return F?Object(Q.sliceUint8)(G,0,H-F):G}var D=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 H=G.prototype;return H.uint8ArrayToUint32Array_=function(O){for(var y=new DataView(O),T=new Uint32Array(4),I=0;I<4;I++)T[I]=y.getUint32(I*4);return T},H.initTable=function(){var O=this.sBox,y=this.invSBox,T=this.subMix,I=T[0],L=T[1],A=T[2],w=T[3],d=this.invSubMix,o=d[0],l=d[1],u=d[2],C=d[3],v=new Uint32Array(256),g=0,k=0,x=0;for(x=0;x<256;x++)x<128?v[x]=x<<1:v[x]=x<<1^283;for(x=0;x<256;x++){var f=k^k<<1^k<<2^k<<3^k<<4;f=f>>>8^f&255^99,O[g]=f,y[f]=g;var p=v[g],h=v[p],a=v[h],b=v[f]*257^f*16843008;I[g]=b<<24|b>>>8,L[g]=b<<16|b>>>16,A[g]=b<<8|b>>>24,w[g]=b,b=a*16843009^h*65537^p*257^g*16843008,o[f]=b<<24|b>>>8,l[f]=b<<16|b>>>16,u[f]=b<<8|b>>>24,C[f]=b,g?(g=p^v[v[v[a^p]]],k^=v[v[k]]):g=k=1}},H.expandKey=function(O){for(var y=this.uint8ArrayToUint32Array_(O),T=!0,I=0;I<y.length&&T;)T=y[I]===this.key[I],I++;if(T)return;this.key=y;var L=this.keySize=y.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var A=this.ksRows=(L+6+1)*4,w,d,o=this.keySchedule=new Uint32Array(A),l=this.invKeySchedule=new Uint32Array(A),u=this.sBox,C=this.rcon,v=this.invSubMix,g=v[0],k=v[1],x=v[2],f=v[3],p,h;for(w=0;w<A;w++){if(w<L){p=o[w]=y[w];continue}h=p,w%L===0?(h=h<<8|h>>>24,h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255],h^=C[w/L|0]<<24):L>6&&w%L===4&&(h=u[h>>>24]<<24|u[h>>>16&255]<<16|u[h>>>8&255]<<8|u[h&255]),o[w]=p=(o[w-L]^h)>>>0}for(d=0;d<A;d++)w=A-d,d&3?h=o[w]:h=o[w-4],d<4||w<=4?l[d]=h:l[d]=g[u[h>>>24]]^k[u[h>>>16&255]]^x[u[h>>>8&255]]^f[u[h&255]],l[d]=l[d]>>>0},H.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},H.decrypt=function(O,y,T){for(var I=this.keySize+6,L=this.invKeySchedule,A=this.invSBox,w=this.invSubMix,d=w[0],o=w[1],l=w[2],u=w[3],C=this.uint8ArrayToUint32Array_(T),v=C[0],g=C[1],k=C[2],x=C[3],f=new Int32Array(O),p=new Int32Array(f.length),h,a,b,m,E,B,W,K,V,M,P,$,ae,he,me=this.networkToHostOrderSwap;y<f.length;){for(V=me(f[y]),M=me(f[y+1]),P=me(f[y+2]),$=me(f[y+3]),E=V^L[0],B=$^L[1],W=P^L[2],K=M^L[3],ae=4,he=1;he<I;he++)h=d[E>>>24]^o[B>>16&255]^l[W>>8&255]^u[K&255]^L[ae],a=d[B>>>24]^o[W>>16&255]^l[K>>8&255]^u[E&255]^L[ae+1],b=d[W>>>24]^o[K>>16&255]^l[E>>8&255]^u[B&255]^L[ae+2],m=d[K>>>24]^o[E>>16&255]^l[B>>8&255]^u[W&255]^L[ae+3],E=h,B=a,W=b,K=m,ae=ae+4;h=A[E>>>24]<<24^A[B>>16&255]<<16^A[W>>8&255]<<8^A[K&255]^L[ae],a=A[B>>>24]<<24^A[W>>16&255]<<16^A[K>>8&255]<<8^A[E&255]^L[ae+1],b=A[W>>>24]<<24^A[K>>16&255]<<16^A[E>>8&255]<<8^A[B&255]^L[ae+2],m=A[K>>>24]<<24^A[E>>16&255]<<16^A[B>>8&255]<<8^A[W&255]^L[ae+3],p[y]=me(h^v),p[y+1]=me(m^g),p[y+2]=me(b^k),p[y+3]=me(a^x),v=V,g=M,k=P,x=$,y=y+4}return p.buffer},G}()},"./src/crypt/decrypter.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return y});var Q=_("./src/crypt/aes-crypto.ts"),U=_("./src/crypt/fast-aes-key.ts"),D=_("./src/crypt/aes-decryptor.ts"),G=_("./src/utils/logger.ts"),H=_("./src/utils/mp4-tools.ts"),F=_("./src/utils/typed-array.ts"),O=16,y=function(){function T(L,A,w){var d=w===void 0?{}:w,o=d.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=A,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var I=T.prototype;return I.destroy=function(){this.observer=null},I.isSync=function(){return this.config.enableSoftwareAES},I.flush=function(){var A=this.currentResult;if(!A){this.reset();return}var w=new Uint8Array(A);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(w):w},I.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},I.decrypt=function(A,w,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(A),w,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(A),w,d).then(o)},I.softwareDecrypt=function(A,w,d){var o=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(A=Object(H.appendUint8Array)(u,A),this.remainderData=null);var C=this.getValidChunk(A);if(!C.length)return null;o&&(d=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new D.default),v.expandKey(w);var g=l;return this.currentResult=v.decrypt(C.buffer,0,d),this.currentIV=Object(F.sliceUint8)(C,-16).buffer,g||null},I.webCryptoDecrypt=function(A,w,d){var o=this,l=this.subtle;return(this.key!==w||!this.fastAesKey)&&(this.key=w,this.fastAesKey=new U.default(l,w)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new Q.default(l,d);return C.decrypt(A.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,A,w,d)})},I.onWebCryptoError=function(A,w,d,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",A),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(w,d,o)},I.getValidChunk=function(A){var w=A,d=A.length-A.length%O;return d!==A.length&&(w=Object(F.sliceUint8)(A,0,d),this.remainderData=Object(F.sliceUint8)(A,d)),w},I.logOnce=function(A){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+A),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return Q});var Q=function(){function U(G,H){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=H}var D=U.prototype;return D.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/adts.ts"),D=_("./src/utils/logger.ts"),G=_("./src/demux/id3.ts");function H(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,F(y,T)}function F(y,T){return F=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},F(y,T)}var O=function(y){H(T,y);function T(L,A){var w;return w=y.call(this)||this,w.observer=void 0,w.config=void 0,w.observer=L,w.config=A,w}var I=T.prototype;return I.resetInitSegment=function(A,w,d){y.prototype.resetInitSegment.call(this,A,w,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:A,duration:d,inputTimeScale:9e4,dropped:0}},T.probe=function(A){if(!A)return!1;for(var w=G.getID3Data(A,0)||[],d=w.length,o=A.length;d<o;d++)if(U.probe(A,d))return D.logger.log("ADTS sync word found !"),!0;return!1},I.canParse=function(A,w){return U.canParse(A,w)},I.appendFrame=function(A,w,d){U.initTrackConfig(A,this.observer,w,d,A.manifestCodec);var o=U.appendFrame(A,w,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(Q.default);O.minProbeByteLength=9,Z.default=O},"./src/demux/adts.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"getAudioConfig",function(){return G}),_.d(Z,"isHeaderPattern",function(){return H}),_.d(Z,"getHeaderLength",function(){return F}),_.d(Z,"getFullFrameLength",function(){return O}),_.d(Z,"canGetFrameLength",function(){return y}),_.d(Z,"isHeader",function(){return T}),_.d(Z,"canParse",function(){return I}),_.d(Z,"probe",function(){return L}),_.d(Z,"initTrackConfig",function(){return A}),_.d(Z,"getFrameDuration",function(){return w}),_.d(Z,"parseFrameHeader",function(){return d}),_.d(Z,"appendFrame",function(){return o});var Q=_("./src/utils/logger.ts"),U=_("./src/errors.ts"),D=_("./src/events.ts");function G(l,u,C,v){var g,k,x,f,p=navigator.userAgent.toLowerCase(),h=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((u[C+2]&192)>>>6)+1;var b=(u[C+2]&60)>>>2;if(b>a.length-1){l.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return x=(u[C+2]&1)<<2,x|=(u[C+3]&192)>>>6,Q.logger.log("manifest codec:"+v+", ADTS type:"+g+", samplingIndex:"+b),/firefox/i.test(p)?b>=6?(g=5,f=new Array(4),k=b-3):(g=2,f=new Array(2),k=b):p.indexOf("android")!==-1?(g=2,f=new Array(2),k=b):(g=5,f=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&b>=6?k=b-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(b>=6&&x===1||/vivaldi/i.test(p))||!v&&x===1)&&(g=2,f=new Array(2)),k=b)),f[0]=g<<3,f[0]|=(b&14)>>1,f[1]|=(b&1)<<7,f[1]|=x<<3,g===5&&(f[1]|=(k&14)>>1,f[2]=(k&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[b],channelCount:x,codec:"mp4a.40."+g,manifestCodec:h}}function H(l,u){return l[u]===255&&(l[u+1]&246)===240}function F(l,u){return l[u+1]&1?7:9}function O(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function y(l,u){return u+5<l.length}function T(l,u){return u+1<l.length&&H(l,u)}function I(l,u){return y(l,u)&&H(l,u)&&O(l,u)<=l.length-u}function L(l,u){if(T(l,u)){var C=F(l,u);if(u+C>=l.length)return!1;var v=O(l,u);if(v<=C)return!1;var g=u+v;return g===l.length||T(l,g)}return!1}function A(l,u,C,v,g){if(!l.samplerate){var k=G(u,C,v,g);if(!k)return;l.config=k.config,l.samplerate=k.samplerate,l.channelCount=k.channelCount,l.codec=k.codec,l.manifestCodec=k.manifestCodec,Q.logger.log("parsed codec:"+l.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function w(l){return 1024*9e4/l}function d(l,u,C,v,g){var k=F(l,u),x=O(l,u);if(x-=k,x>0){var f=C+v*g;return{headerLength:k,frameLength:x,stamp:f}}}function o(l,u,C,v,g){var k=w(l.samplerate),x=d(u,C,v,g,k);if(x){var f=x.frameLength,p=x.headerLength,h=x.stamp,a=p+f,b=Math.max(0,C+a-u.length),m;b?(m=new Uint8Array(a-p),m.set(u.subarray(C+p,u.length),0)):m=u.subarray(C+p,C+a);var E={unit:m,pts:h};return b||l.samples.push(E),{sample:E,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"initPTSFn",function(){return O});var Q=_("./src/polyfills/number.ts"),U=_("./src/demux/id3.ts"),D=_("./src/demux/dummy-demuxed-track.ts"),G=_("./src/utils/mp4-tools.ts"),H=_("./src/utils/typed-array.ts"),F=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=y.prototype;return T.resetInitSegment=function(L,A,w){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(L,A){return!1},T.appendFrame=function(L,A,w){},T.demux=function(L,A){this.cachedData&&(L=Object(G.appendUint8Array)(this.cachedData,L),this.cachedData=null);var w=U.getID3Data(L,0),d=w?w.length:0,o,l,u=this._audioTrack,C=this._id3Track,v=w?U.getTimeStamp(w):void 0,g=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(v,A)),w&&w.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:w}),l=this.initPTS;d<g;){if(this.canParse(L,d)){var k=this.appendFrame(u,L,d);k?(this.frameIndex++,l=k.sample.pts,d+=k.length,o=d):d=g}else U.canParse(L,d)?(w=U.getID3Data(L,d),C.samples.push({pts:l,dts:l,data:w}),d+=w.length,o=d):d++;if(d===g&&o!==g){var x=Object(H.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:u,avcTrack:Object(D.dummyTrack)(),id3Track:C,textTrack:Object(D.dummyTrack)()}},T.demuxSampleAes=function(L,A,w){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(L){var A=this.cachedData;return A&&(this.cachedData=null,this.demux(A,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(D.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(D.dummyTrack)()}},T.destroy=function(){},y}(),O=function(T,I){return Object(Q.isFiniteNumber)(T)?T*90:I*9e4};Z.default=F},"./src/demux/chunk-cache.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return Q});var Q=function(){function D(){this.chunks=[],this.dataLength=0}var G=D.prototype;return G.push=function(F){this.chunks.push(F),this.dataLength+=F.length},G.flush=function(){var F=this.chunks,O=this.dataLength,y;if(F.length)F.length===1?y=F[0]:y=U(F,O);else return new Uint8Array(0);return this.reset(),y},G.reset=function(){this.chunks.length=0,this.dataLength=0},D}();function U(D,G){for(var H=new Uint8Array(G),F=0,O=0;O<D.length;O++){var y=D[O];H.set(y,F),F+=y.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/utils/logger.ts"),U=function(){function D(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var G=D.prototype;return G.loadWord=function(){var F=this.data,O=this.bytesAvailable,y=F.byteLength-O,T=new Uint8Array(4),I=Math.min(4,O);if(I===0)throw new Error("no bytes available");T.set(F.subarray(y,y+I)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=I*8,this.bytesAvailable-=I},G.skipBits=function(F){var O;this.bitsAvailable>F?(this.word<<=F,this.bitsAvailable-=F):(F-=this.bitsAvailable,O=F>>3,F-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=F,this.bitsAvailable-=F)},G.readBits=function(F){var O=Math.min(this.bitsAvailable,F),y=this.word>>>32-O;return F>32&&Q.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=F-O,O>0&&this.bitsAvailable?y<<O|this.readBits(O):y},G.skipLZ=function(){var F;for(F=0;F<this.bitsAvailable;++F)if((this.word&2147483648>>>F)!==0)return this.word<<=F,this.bitsAvailable-=F,F;return this.loadWord(),F+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var F=this.skipLZ();return this.readBits(F+1)-1},G.readEG=function(){var F=this.readUEG();return 1&F?1+F>>>1:-1*(F>>>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(F){for(var O=8,y=8,T,I=0;I<F;I++)y!==0&&(T=this.readEG(),y=(O+T+256)%256),O=y===0?O:y},G.readSPS=function(){var F=0,O=0,y=0,T=0,I,L,A,w=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),C=this.skipEG.bind(this),v=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);w();var k=w();if(d(5),u(3),w(),v(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var x=o();if(x===3&&u(1),v(),v(),u(1),l())for(L=x!==3?8:12,A=0;A<L;A++)l()&&(A<6?g(16):g(64))}v();var f=o();if(f===0)o();else if(f===1)for(u(1),C(),C(),I=o(),A=0;A<I;A++)C();v(),u(1);var p=o(),h=o(),a=d(1);a===0&&u(1),u(1),l()&&(F=o(),O=o(),y=o(),T=o());var b=[1,1];if(l()&&l()){var m=w();switch(m){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[w()<<8|w(),w()<<8|w()];break}}}return{width:Math.ceil((p+1)*16-F*2-O*2),height:(2-a)*(h+1)*16-(a?2:4)*(y+T),pixelRatio:b}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();Z.default=U},"./src/demux/id3.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isHeader",function(){return Q}),_.d(Z,"isFooter",function(){return U}),_.d(Z,"getID3Data",function(){return D}),_.d(Z,"canParse",function(){return H}),_.d(Z,"getTimeStamp",function(){return F}),_.d(Z,"isTimeStampFrame",function(){return O}),_.d(Z,"getID3Frames",function(){return T}),_.d(Z,"decodeFrame",function(){return I}),_.d(Z,"utf8ArrayToStr",function(){return o}),_.d(Z,"testables",function(){return l});var Q=function(g,k){return k+10<=g.length&&(g[k]===73&&g[k+1]===68&&g[k+2]===51&&(g[k+3]<255&&g[k+4]<255&&(g[k+6]<128&&g[k+7]<128&&g[k+8]<128&&g[k+9]<128)))},U=function(g,k){return k+10<=g.length&&(g[k]===51&&g[k+1]===68&&g[k+2]===73&&(g[k+3]<255&&g[k+4]<255&&(g[k+6]<128&&g[k+7]<128&&g[k+8]<128&&g[k+9]<128)))},D=function(g,k){for(var x=k,f=0;Q(g,k);){f+=10;var p=G(g,k+6);f+=p,U(g,k+10)&&(f+=10),k+=f}return f>0?g.subarray(x,x+f):void 0},G=function(g,k){var x=0;return x=(g[k]&127)<<21,x|=(g[k+1]&127)<<14,x|=(g[k+2]&127)<<7,x|=g[k+3]&127,x},H=function(g,k){return Q(g,k)&&G(g,k+6)+10<=g.length-k},F=function(g){for(var k=T(g),x=0;x<k.length;x++){var f=k[x];if(O(f))return d(f)}return},O=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},y=function(g){var k=String.fromCharCode(g[0],g[1],g[2],g[3]),x=G(g,4),f=10;return{type:k,size:x,data:g.subarray(f,f+x)}},T=function(g){for(var k=0,x=[];Q(g,k);){var f=G(g,k+6);k+=10;for(var p=k+f;k+8<p;){var h=y(g.subarray(k)),a=I(h);a&&x.push(a),k+=h.size+10}U(g,k)&&(k+=10)}return x},I=function(g){return g.type==="PRIV"?L(g):g.type[0]==="W"?w(g):A(g)},L=function(g){if(g.size<2)return;var k=o(g.data,!0),x=new Uint8Array(g.data.subarray(k.length+1));return{key:g.type,info:k,data:x.buffer}},A=function(g){if(g.size<2)return;if(g.type==="TXXX"){var k=1,x=o(g.data.subarray(k),!0);k+=x.length+1;var f=o(g.data.subarray(k));return{key:g.type,info:x,data:f}}var p=o(g.data.subarray(1));return{key:g.type,data:p}},w=function(g){if(g.type==="WXXX"){if(g.size<2)return;var k=1,x=o(g.data.subarray(k),!0);k+=x.length+1;var f=o(g.data.subarray(k));return{key:g.type,info:x,data:f}}var p=o(g.data);return{key:g.type,data:p}},d=function(g){if(g.data.byteLength===8){var k=new Uint8Array(g.data),x=k[3]&1,f=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return f/=45,x&&(f+=4772185884e-2),Math.round(f)}return},o=function(g,k){k===void 0&&(k=!1);var x=C();if(x){var f=x.decode(g);if(k){var p=f.indexOf("\0");return p!==-1?f.substring(0,p):f}return f.replace(/\0/g,"")}for(var h=g.length,a,b,m,E="",B=0;B<h;){if(a=g[B++],a===0&&k)return E;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:E+=String.fromCharCode(a);break;case 12:case 13:b=g[B++],E+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=g[B++],m=g[B++],E+=String.fromCharCode((a&15)<<12|(b&63)<<6|(m&63)<<0);break;default:}}return E},l={decodeTextFrame:A},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/id3.ts"),D=_("./src/utils/logger.ts"),G=_("./src/demux/mpegaudio.ts");function H(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,F(y,T)}function F(y,T){return F=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},F(y,T)}var O=function(y){H(T,y);function T(){return y.apply(this,arguments)||this}var I=T.prototype;return I.resetInitSegment=function(A,w,d){y.prototype.resetInitSegment.call(this,A,w,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:d,inputTimeScale:9e4,dropped:0}},T.probe=function(A){if(!A)return!1;for(var w=U.getID3Data(A,0)||[],d=w.length,o=A.length;d<o;d++)if(G.probe(A,d))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},I.canParse=function(A,w){return G.canParse(A,w)},I.appendFrame=function(A,w,d){return this.initPTS===null?void 0:G.appendFrame(A,w,d,this.initPTS,this.frameIndex)},T}(Q.default);O.minProbeByteLength=4,Z.default=O},"./src/demux/mp4demuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/utils/mp4-tools.ts"),U=_("./src/demux/dummy-demuxed-track.ts"),D=function(){function G(F,O){this.remainderData=null,this.config=void 0,this.config=O}var H=G.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},G.probe=function(O){return Object(Q.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},H.demux=function(O){var y=O,T=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Q.appendUint8Array)(this.remainderData,O));var I=Object(Q.segmentValidRange)(y);this.remainderData=I.remainder,T.samples=I.valid||new Uint8Array}else T.samples=y;return{audioTrack:Object(U.dummyTrack)(),avcTrack:T,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.flush=function(){var O=Object(U.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:O,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(O,y,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},G}();D.minProbeByteLength=1024,Z.default=D},"./src/demux/mpegaudio.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"appendFrame",function(){return F}),_.d(Z,"parseHeader",function(){return O}),_.d(Z,"isHeaderPattern",function(){return y}),_.d(Z,"isHeader",function(){return T}),_.d(Z,"canParse",function(){return I}),_.d(Z,"probe",function(){return L});var Q=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],D=[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]],H=[0,1,1,4];function F(A,w,d,o,l){if(d+24>w.length)return;var u=O(w,d);if(u&&d+u.frameLength<=w.length){var C=u.samplesPerFrame*9e4/u.sampleRate,v=o+l*C,g={unit:w.subarray(d,d+u.frameLength),pts:v,dts:v};return A.config=[],A.channelCount=u.channelCount,A.samplerate=u.sampleRate,A.samples.push(g),{sample:g,length:u.frameLength,missing:0}}}function O(A,w){var d=A[w+1]>>3&3,o=A[w+1]>>1&3,l=A[w+2]>>4&15,u=A[w+2]>>2&3;if(d!==1&&l!==0&&l!==15&&u!==3){var C=A[w+2]>>1&1,v=A[w+3]>>6,g=d===3?3-o:o===3?3:4,k=U[g*14+l-1]*1e3,x=d===3?0:d===2?1:2,f=D[x*3+u],p=v===3?1:2,h=G[d][o],a=H[o],b=h*8*a,m=Math.floor(h*k/f+C)*a;if(Q===null){var E=navigator.userAgent||"",B=E.match(/Chrome\/(\d+)/i);Q=B?parseInt(B[1]):0}var W=!!Q&&Q<=87;return W&&o===2&&k>=224e3&&v===0&&(A[w+3]=A[w+3]|128),{sampleRate:f,channelCount:p,frameLength:m,samplesPerFrame:b}}}function y(A,w){return A[w]===255&&(A[w+1]&224)===224&&(A[w+1]&6)!==0}function T(A,w){return w+1<A.length&&y(A,w)}function I(A,w){var d=4;return y(A,w)&&d<=A.length-w}function L(A,w){if(w+1<A.length&&y(A,w)){var d=4,o=O(A,w),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var u=w+l;return u===A.length||T(A,u)}return!1}},"./src/demux/sample-aes.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/crypt/decrypter.ts"),U=_("./src/demux/tsdemuxer.ts"),D=function(){function G(F,O,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Q.default(F,O,{removePKCS7Padding:!1})}var H=G.prototype;return H.decryptBuffer=function(O,y){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,y)},H.decryptAacSample=function(O,y,T,I){var L=O[y].unit,A=L.subarray(16,L.length-L.length%16),w=A.buffer.slice(A.byteOffset,A.byteOffset+A.length),d=this;this.decryptBuffer(w,function(o){var l=new Uint8Array(o);L.set(l,16),I||d.decryptAacSamples(O,y+1,T)})},H.decryptAacSamples=function(O,y,T){for(;;y++){if(y>=O.length){T();return}if(O[y].unit.length<32)continue;var I=this.decrypter.isSync();if(this.decryptAacSample(O,y,T,I),!I)return}},H.getAvcEncryptedData=function(O){for(var y=Math.floor((O.length-48)/160)*16+16,T=new Int8Array(y),I=0,L=32;L<=O.length-16;L+=160,I+=16)T.set(O.subarray(L,L+16),I);return T},H.getAvcDecryptedUnit=function(O,y){for(var T=new Uint8Array(y),I=0,L=32;L<=O.length-16;L+=160,I+=16)O.set(T.subarray(I,I+16),L);return O},H.decryptAvcSample=function(O,y,T,I,L,A){var w=Object(U.discardEPB)(L.data),d=this.getAvcEncryptedData(w),o=this;this.decryptBuffer(d.buffer,function(l){L.data=o.getAvcDecryptedUnit(w,l),A||o.decryptAvcSamples(O,y,T+1,I)})},H.decryptAvcSamples=function(O,y,T,I){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,T=0){if(y>=O.length){I();return}for(var L=O[y].units;!(T>=L.length);T++){var A=L[T];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var w=this.decrypter.isSync();if(this.decryptAvcSample(O,y,T,I,A,w),!w)return}}},G}();Z.default=D},"./src/demux/transmuxer-interface.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var Q=_("./node_modules/webworkify-webpack/index.js"),U=_.n(Q),D=_("./src/events.ts"),G=_("./src/demux/transmuxer.ts"),H=_("./src/utils/logger.ts"),F=_("./src/errors.ts"),O=_("./src/utils/mediasource-helper.ts"),y=_("./node_modules/eventemitter3/index.js"),T=_.n(y),I=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function A(d,o,l,u){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var v=d.config,g=function(h,a){a=a||{},a.frag=C.frag,a.id=C.id,d.trigger(h,a)};this.observer=new y.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,g),this.observer.on(D.Events.ERROR,g);var k={mp4:I.isTypeSupported("video/mp4"),mpeg:I.isTypeSupported("audio/mpeg"),mp3:I.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var f;try{f=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(p){d.trigger(D.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},f.postMessage({cmd:"init",typeSupported:k,vendor:x,id:o,config:JSON.stringify(v)})}catch(p){H.logger.warn("Error in worker:",p),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new G.default(this.observer,k,v,x,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,k,v,x,o)}var w=A.prototype;return w.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},w.push=function(o,l,u,C,v,g,k,x,f,p){var h=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,m=g?g.start:v.start,E=v.decryptdata,B=this.frag,W=!(B&&v.cc===B.cc),K=!(B&&f.level===B.level),V=B?f.sn-B.sn:-1,M=this.part?f.part-this.part.index:1,P=!K&&(V===1||V===0&&M===1),$=self.performance.now();(K||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),g&&(M||!P)&&(g.stats.parsing.start=$);var ae=new G.TransmuxState(W,P,x,K,m);if(!P||W){H.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+W+`
trackSwitch: `+K+`
contiguous: `+P+`
accurateTimeOffset: `+x+`
timeOffset: `+m);var he=new G.TransmuxConfig(u,C,l,k,p);this.configureTransmuxer(he)}if(this.frag=v,this.part=g,b)b.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:f,state:ae},o instanceof ArrayBuffer?[o]:[]);else if(a){var me=a.push(o,E,f,ae);Object(G.isPromise)(me)?me.then(function(De){h.handleTransmuxComplete(De)}):this.handleTransmuxComplete(me)}},w.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(u){var v=u.flush(o);Object(G.isPromise)(v)?v.then(function(g){l.handleFlushResult(g,o)}):this.handleFlushResult(v,o)}},w.handleFlushResult=function(o,l){var u=this;o.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(l)},w.onWorkerMessage=function(o){var l=o.data,u=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,u.trigger(l.event,l.data);break}}},w.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},w.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return F});var Q=_("./src/demux/transmuxer.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts"),G=_("./node_modules/eventemitter3/index.js"),H=_.n(G);function F(L){var A=new G.EventEmitter,w=function(o,l){L.postMessage({event:o,data:l})};A.on(U.Events.FRAG_DECRYPTED,w),A.on(U.Events.ERROR,w),L.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new Q.default(A,o.typeSupported,l,o.vendor,o.id),Object(D.enableLogs)(l.debug),w("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var u=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Q.isPromise)(u)?u.then(function(g){O(L,g)}):O(L,u);break}case"flush":{var C=o.chunkMeta,v=L.transmuxer.flush(C);Object(Q.isPromise)(v)?v.then(function(g){T(L,g,C)}):T(L,v,C);break}default:break}})}function O(L,A){if(I(A.remuxResult))return;var w=[],d=A.remuxResult,o=d.audio,l=d.video;o&&y(w,o),l&&y(w,l),L.postMessage({event:"transmuxComplete",data:A},w)}function y(L,A){A.data1&&L.push(A.data1.buffer),A.data2&&L.push(A.data2.buffer)}function T(L,A,w){A.forEach(function(d){O(L,d)}),L.postMessage({event:"flush",data:w})}function I(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l}),_.d(Z,"isPromise",function(){return v}),_.d(Z,"TransmuxConfig",function(){return g}),_.d(Z,"TransmuxState",function(){return k});var Q=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/crypt/decrypter.ts"),G=_("./src/demux/aacdemuxer.ts"),H=_("./src/demux/mp4demuxer.ts"),F=_("./src/demux/tsdemuxer.ts"),O=_("./src/demux/mp3demuxer.ts"),y=_("./src/remux/mp4-remuxer.ts"),T=_("./src/remux/passthrough-remuxer.ts"),I=_("./src/demux/chunk-cache.ts"),L=_("./src/utils/mp4-tools.ts"),A=_("./src/utils/logger.ts"),w;try{w=self.performance.now.bind(self.performance)}catch(x){A.logger.debug("Unable to use Performance API on this environment"),w=self.Date.now}var d=[{demux:F.default,remux:y.default},{demux:H.default,remux:T.default},{demux:G.default,remux:y.default},{demux:O.default,remux:y.default}],o=1024;d.forEach(function(x){var f=x.demux;o=Math.max(o,f.minProbeByteLength)});var l=function(){function x(p,h,a,b,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 I.default,this.observer=p,this.typeSupported=h,this.config=a,this.vendor=b,this.id=m}var f=x.prototype;return f.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},f.push=function(h,a,b,m){var E=this,B=b.transmuxing;B.executeStart=w();var W=new Uint8Array(h),K=this.cache,V=this.config,M=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var $=u(W,a);if($&&$.method==="AES-128"){var ae=this.getDecrypter();if(V.enableSoftwareAES){var he=ae.softwareDecrypt(W,$.key.buffer,$.iv.buffer);if(!he)return B.executeEnd=w(),C(b);W=new Uint8Array(he)}else return this.decryptionPromise=ae.webCryptoDecrypt(W,$.key.buffer,$.iv.buffer).then(function(be){var Ae=E.push(be,null,b);return E.decryptionPromise=null,Ae}),this.decryptionPromise}var me=m||M,De=me.contiguous,xe=me.discontinuity,ke=me.trackSwitch,Te=me.accurateTimeOffset,Se=me.timeOffset,ye=P.audioCodec,z=P.videoCodec,s=P.defaultInitPts,c=P.duration,R=P.initSegmentData;if((xe||ke)&&this.resetInitSegment(R,ye,z,c),xe&&this.resetInitialTimestamp(s),De||this.resetContiguity(),this.needsProbing(W,xe,ke)){if(K.dataLength){var Y=K.flush();W=Object(L.appendUint8Array)(Y,W)}this.configureTransmuxer(W,P)}var N=this.transmux(W,$,Se,Te,b),se=this.currentTransmuxState;return se.contiguous=!0,se.discontinuity=!1,se.trackSwitch=!1,B.executeEnd=w(),N},f.flush=function(h){var a=this,b=h.transmuxing;b.executeStart=w();var m=this.decrypter,E=this.cache,B=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return a.flush(h)});var K=[],V=B.timeOffset;if(m){var M=m.flush();M&&K.push(this.push(M,null,h))}var P=E.dataLength;E.reset();var $=this.demuxer,ae=this.remuxer;if(!$||!ae)return P>=o&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=w(),[C(h)];var he=$.flush(V);return v(he)?he.then(function(me){return a.flushRemux(K,me,h),K}):(this.flushRemux(K,he,h),K)},f.flushRemux=function(h,a,b){var m=a.audioTrack,E=a.avcTrack,B=a.id3Track,W=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,M=K.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var P=this.remuxer.remux(m,E,B,W,M,V,!0,this.id);h.push({remuxResult:P,chunkMeta:b}),b.transmuxing.executeEnd=w()},f.resetInitialTimestamp=function(h){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(h),b.resetTimeStamp(h)},f.resetContiguity=function(){var h=this.demuxer,a=this.remuxer;if(!h||!a)return;h.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(h,a,b,m){var E=this.demuxer,B=this.remuxer;if(!E||!B)return;E.resetInitSegment(a,b,m),B.resetInitSegment(h,a,b)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(h,a,b,m,E){var B;return a&&a.method==="SAMPLE-AES"?B=this.transmuxSampleAes(h,a,b,m,E):B=this.transmuxUnencrypted(h,b,m,E),B},f.transmuxUnencrypted=function(h,a,b,m){var E=this.demuxer.demux(h,a,!1,!this.config.progressive),B=E.audioTrack,W=E.avcTrack,K=E.id3Track,V=E.textTrack,M=this.remuxer.remux(B,W,K,V,a,b,!1,this.id);return{remuxResult:M,chunkMeta:m}},f.transmuxSampleAes=function(h,a,b,m,E){var B=this;return this.demuxer.demuxSampleAes(h,a,b).then(function(W){var K=B.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,b,m,!1,B.id);return{remuxResult:K,chunkMeta:E}})},f.configureTransmuxer=function(h,a){for(var b=this.config,m=this.observer,E=this.typeSupported,B=this.vendor,W=a.audioCodec,K=a.defaultInitPts,V=a.duration,M=a.initSegmentData,P=a.videoCodec,$,ae=0,he=d.length;ae<he;ae++)if(d[ae].demux.probe(h)){$=d[ae];break}$||(A.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:H.default,remux:T.default});var me=this.demuxer,De=this.remuxer,xe=$.remux,ke=$.demux;(!De||!(De instanceof xe))&&(this.remuxer=new xe(m,b,E,B)),(!me||!(me instanceof ke))&&(this.demuxer=new ke(m,b,E),this.probe=ke.probe),this.resetInitSegment(M,W,P,V),this.resetInitialTimestamp(K)},f.needsProbing=function(h,a,b){return!this.demuxer||!this.remuxer||a||b},f.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new D.default(this.observer,this.config)),h},x}();function u(x,f){var p=null;return x.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(p=f),p}var C=function(f){return{remuxResult:{},chunkMeta:f}};function v(x){return"then"in x&&x.then instanceof Function}var g=function(f,p,h,a,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=p,this.initSegmentData=h,this.duration=a,this.defaultInitPts=b},k=function(f,p,h,a,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=p,this.accurateTimeOffset=h,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"discardEPB",function(){return C});var Q=_("./src/demux/adts.ts"),U=_("./src/demux/mpegaudio.ts"),D=_("./src/demux/exp-golomb.ts"),G=_("./src/demux/id3.ts"),H=_("./src/demux/sample-aes.ts"),F=_("./src/events.ts"),O=_("./src/utils/mp4-tools.ts"),y=_("./src/utils/logger.ts"),T=_("./src/errors.ts"),I={video:1,audio:2,id3:3,text:4},L=function(){function v(k,x,f){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=k,this.config=x,this.typeSupported=f}v.probe=function(x){var f=v.syncOffset(x);return f<0?!1:(f&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},v.syncOffset=function(x){for(var f=Math.min(1e3,x.length-3*188),p=0;p<f;){if(x[p]===71&&x[p+188]===71&&x[p+2*188]===71)return p;p++}return-1},v.createTrack=function(x,f){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:I[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?f:void 0}};var g=v.prototype;return g.resetInitSegment=function(x,f,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",p),this._audioTrack=v.createTrack("audio",p),this._id3Track=v.createTrack("id3",p),this._txtTrack=v.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=f,this._duration=p},g.resetTimeStamp=function(){},g.resetContiguity=function(){var x=this._audioTrack,f=this._avcTrack,p=this._id3Track;x&&(x.pesData=null),f&&(f.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(x,f,p,h){p===void 0&&(p=!1),h===void 0&&(h=!1),p||(this.sampleAes=null);var a,b=this._avcTrack,m=this._audioTrack,E=this._id3Track,B=b.pid,W=b.pesData,K=m.pid,V=E.pid,M=m.pesData,P=E.pesData,$=!1,ae=this.pmtParsed,he=this._pmtId,me=x.length;if(this.remainderData&&(x=Object(O.appendUint8Array)(this.remainderData,x),me=x.length,this.remainderData=null),me<188&&!h)return this.remainderData=x,{audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};var De=Math.max(0,v.syncOffset(x));me-=(me+De)%188,me<x.byteLength&&!h&&(this.remainderData=new Uint8Array(x.buffer,me,x.buffer.byteLength-me));for(var xe=De;xe<me;xe+=188)if(x[xe]===71){var ke=!!(x[xe+1]&64),Te=((x[xe+1]&31)<<8)+x[xe+2],Se=(x[xe+3]&48)>>4,ye=void 0;if(Se>1){if(ye=xe+5+x[xe+4],ye===xe+188)continue}else ye=xe+4;switch(Te){case B:ke&&(W&&(a=o(W))&&this.parseAVCPES(a,!1),W={data:[],size:0}),W&&(W.data.push(x.subarray(ye,xe+188)),W.size+=xe+188-ye);break;case K:ke&&(M&&(a=o(M))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(x.subarray(ye,xe+188)),M.size+=xe+188-ye);break;case V:ke&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(x.subarray(ye,xe+188)),P.size+=xe+188-ye);break;case 0:ke&&(ye+=x[ye]+1),he=this._pmtId=w(x,ye);break;case he:{ke&&(ye+=x[ye]+1);var z=d(x,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);B=z.avc,B>0&&(b.pid=B),K=z.audio,K>0&&(m.pid=K,m.isAAC=z.isAAC),V=z.id3,V>0&&(E.pid=V),$&&!ae&&(y.logger.log("reparse from beginning"),$=!1,xe=De-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=W,m.pesData=M,E.pesData=P;var s={audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(s),s},g.flush=function(){var x=this.remainderData;this.remainderData=null;var f;return x?f=this.demux(x,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},g.extractRemainingSamples=function(x){var f=x.audioTrack,p=x.avcTrack,h=x.id3Track,a=p.pesData,b=f.pesData,m=h.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),p.pesData=null):p.pesData=a,b&&(E=o(b))?(f.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),f.pesData=null):(b!=null&&b.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=b),m&&(E=o(m))?(this.parseID3PES(E),h.pesData=null):h.pesData=m},g.demuxSampleAes=function(x,f,p){var h=this.demux(x,p,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,f);return this.decrypt(h,a)},g.decrypt=function(x,f){return new Promise(function(p){var h=x.audioTrack,a=x.avcTrack;h.samples&&h.isAAC?f.decryptAacSamples(h.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){p(x)}):p(x)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){p(x)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(x,f){var p=this,h=this._avcTrack,a=this.parseAVCNALu(x.data),b=!1,m=this.avcSample,E,B=!1;x.data=null,m&&a.length&&!h.audFound&&(l(m,h),m=this.avcSample=A(!1,x.pts,x.dts,"")),a.forEach(function(W){switch(W.type){case 1:{E=!0,m||(m=p.avcSample=A(!0,x.pts,x.dts,"")),b&&(m.debug+="NDR "),m.frame=!0;var K=W.data;if(B&&K.length>4){var V=new D.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=p.avcSample=A(!0,x.pts,x.dts,"")),b&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,b&&m&&(m.debug+="SEI ");var M=new D.default(C(W.data));M.readUByte();for(var P=0,$=0,ae=!1,he=0;!ae&&M.bytesAvailable>1;){P=0;do he=M.readUByte(),P+=he;while(he===255);$=0;do he=M.readUByte(),$+=he;while(he===255);if(P===4&&M.bytesAvailable!==0){ae=!0;var me=M.readUByte();if(me===181){var De=M.readUShort();if(De===49){var xe=M.readUInt();if(xe===1195456820){var ke=M.readUByte();if(ke===3){for(var Te=M.readUByte(),Se=M.readUByte(),ye=31&Te,z=[Te,Se],s=0;s<ye;s++)z.push(M.readUByte()),z.push(M.readUByte()),z.push(M.readUByte());u(p._txtTrack.samples,{type:3,pts:x.pts,bytes:z})}}}}}else if(P===5&&M.bytesAvailable!==0){if(ae=!0,$>16){for(var c=[],R=0;R<16;R++)c.push(M.readUByte().toString(16)),(R===3||R===5||R===7||R===9)&&c.push("-");for(var Y=$-16,N=new Uint8Array(Y),se=0;se<Y;se++)N[se]=M.readUByte();u(p._txtTrack.samples,{pts:x.pts,payloadType:P,uuid:c.join(""),userData:Object(G.utf8ArrayToStr)(N),userDataBytes:N})}}else if($<M.bytesAvailable)for(var be=0;be<$;be++)M.readUByte()}break}case 7:if(E=!0,B=!0,b&&m&&(m.debug+="SPS "),!h.sps){var Ae=new D.default(W.data),Oe=Ae.readSPS();h.width=Oe.width,h.height=Oe.height,h.pixelRatio=Oe.pixelRatio,h.sps=[W.data],h.duration=p._duration;for(var Le=W.data.subarray(1,4),_e="avc1.",Pe=0;Pe<3;Pe++){var He=Le[Pe].toString(16);He.length<2&&(He="0"+He),_e+=He}h.codec=_e}break;case 8:E=!0,b&&m&&(m.debug+="PPS "),h.pps||(h.pps=[W.data]);break;case 9:E=!1,h.audFound=!0,m&&l(m,h),m=p.avcSample=A(!1,x.pts,x.dts,b?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+W.type+" ");break}if(m&&E){var Ge=m.units;Ge.push(W)}}),f&&m&&(l(m,h),this.avcSample=null)},g.getLastNalUnit=function(){var x,f=this.avcSample,p;if(!f||f.units.length===0){var h=this._avcTrack.samples;f=h[h.length-1]}if((x=f)!==null&&x!==void 0&&x.units){var a=f.units;p=a[a.length-1]}return p},g.parseAVCNALu=function(x){var f=x.byteLength,p=this._avcTrack,h=p.naluState||0,a=h,b=[],m=0,E,B,W,K=-1,V=0;for(h===-1&&(K=0,V=x[0]&31,h=0,m=1);m<f;){if(E=x[m++],!h){h=E?0:1;continue}if(h===1){h=E?0:2;continue}if(!E)h=3;else if(E===1){if(K>=0){var M={data:x.subarray(K,m-h-1),type:V};b.push(M)}else{var P=this.getLastNalUnit();if(P&&(a&&m<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),B=m-h-1,B>0)){var $=new Uint8Array(P.data.byteLength+B);$.set(P.data,0),$.set(x.subarray(0,B),P.data.byteLength),P.data=$,P.state=0}}m<f?(W=x[m]&31,K=m,V=W,h=0):h=-1}else h=0}if(K>=0&&h>=0){var ae={data:x.subarray(K,f),type:V,state:h};b.push(ae)}if(b.length===0){var he=this.getLastNalUnit();if(he){var me=new Uint8Array(he.data.byteLength+x.byteLength);me.set(he.data,0),me.set(x,he.data.byteLength),he.data=me}}return p.naluState=h,b},g.parseAACPES=function(x){var f=0,p=this._audioTrack,h=this.aacOverFlow,a=x.data;if(h){this.aacOverFlow=null;var b=h.sample.unit.byteLength,m=Math.min(h.missing,b),E=b-m;h.sample.unit.set(a.subarray(0,m),E),p.samples.push(h.sample),f=h.missing}var B,W;for(B=f,W=a.length;B<W-1&&!Q.isHeader(a,B);B++);if(B!==f){var K,V;if(B<W-1?(K="AAC PES did not start with ADTS header,offset:"+B,V=!1):(K="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+K),this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Q.initTrackConfig(p,this.observer,a,B,this.audioCodec);var M;if(x.pts!==void 0)M=x.pts;else if(h){var P=Q.getFrameDuration(p.samplerate);M=h.sample.pts+P}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;B<W;)if(Q.isHeader(a,B)){if(B+5<W){var ae=Q.appendFrame(p,a,B,M,$);if(ae)if(ae.missing)this.aacOverFlow=ae;else{B+=ae.length,$++;continue}}break}else B++},g.parseMPEGPES=function(x){var f=x.data,p=f.length,h=0,a=0,b=x.pts;if(b===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<p;)if(U.isHeader(f,a)){var m=U.appendFrame(this._audioTrack,f,a,b,h);if(m)a+=m.length,h++;else break}else a++},g.parseID3PES=function(x){if(x.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},v}();L.minProbeByteLength=188;function A(v,g,k,x){return{key:v,frame:!1,pts:g,dts:k,units:[],debug:x,length:0}}function w(v,g){return(v[g+10]&31)<<8|v[g+11]}function d(v,g,k,x){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[g+1]&15)<<8|v[g+2],h=g+3+p-4,a=(v[g+10]&15)<<8|v[g+11];for(g+=12+a;g<h;){var b=(v[g+1]&31)<<8|v[g+2];switch(v[g]){case 207:if(!x){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=b);break;case 21:f.id3===-1&&(f.id3=b);break;case 219:if(!x){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=b);break;case 3:case 4:k?f.audio===-1&&(f.audio=b,f.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}g+=((v[g+3]&15)<<8|v[g+4])+5}return f}function o(v){var g=0,k,x,f,p,h,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var b=new Uint8Array(a[0].length+a[1].length);b.set(a[0]),b.set(a[1],a[0].length),a[0]=b,a.splice(1,1)}k=a[0];var m=(k[0]<<16)+(k[1]<<8)+k[2];if(m===1){if(x=(k[4]<<8)+k[5],x&&x>v.size-6)return null;var E=k[7];E&192&&(p=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,E&64?(h=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,p-h>60*9e4&&(y.logger.warn(Math.round((p-h)/9e4)+"s delta between PTS and DTS, align them"),p=h)):h=p),f=k[8];var B=f+9;if(v.size<=B)return null;v.size-=B;for(var W=new Uint8Array(v.size),K=0,V=a.length;K<V;K++){k=a[K];var M=k.byteLength;if(B)if(B>M){B-=M;continue}else k=k.subarray(B),M-=B,B=0;W.set(k,g),g+=M}return x&&(x-=f+3),{data:W,pts:p,dts:h,len:x}}return null}function l(v,g){if(v.units.length&&v.frame){if(v.pts===void 0){var k=g.samples,x=k.length;if(x){var f=k[x-1];v.pts=f.pts,v.dts=f.dts}else{g.dropped++;return}}g.samples.push(v)}v.debug.length&&y.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function u(v,g){var k=v.length;if(k>0){if(g.pts>=v[k-1].pts)v.push(g);else for(var x=k-1;x>=0;x--)if(g.pts<v[x].pts){v.splice(x,0,g);break}}else v.push(g)}function C(v){for(var g=v.byteLength,k=[],x=1;x<g-2;)v[x]===0&&v[x+1]===0&&v[x+2]===3?(k.push(x+2),x+=2):x++;if(k.length===0)return v;var f=g-k.length,p=new Uint8Array(f),h=0;for(x=0;x<f;h++,x++)h===k[0]&&(h++,k.shift()),p[x]=v[h];return p}Z.default=L},"./src/errors.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ErrorTypes",function(){return Q}),_.d(Z,"ErrorDetails",function(){return U});var Q;(function(D){D.NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError"})(Q||(Q={}));var U;(function(D){D.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",D.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",D.KEY_SYSTEM_NO_SESSION="keySystemNoSession",D.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",D.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",D.MANIFEST_LOAD_ERROR="manifestLoadError",D.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",D.MANIFEST_PARSING_ERROR="manifestParsingError",D.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",D.LEVEL_EMPTY_ERROR="levelEmptyError",D.LEVEL_LOAD_ERROR="levelLoadError",D.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",D.LEVEL_SWITCH_ERROR="levelSwitchError",D.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",D.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",D.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",D.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",D.FRAG_LOAD_ERROR="fragLoadError",D.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",D.FRAG_DECRYPT_ERROR="fragDecryptError",D.FRAG_PARSING_ERROR="fragParsingError",D.REMUX_ALLOC_ERROR="remuxAllocError",D.KEY_LOAD_ERROR="keyLoadError",D.KEY_LOAD_TIMEOUT="keyLoadTimeOut",D.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",D.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",D.BUFFER_APPEND_ERROR="bufferAppendError",D.BUFFER_APPENDING_ERROR="bufferAppendingError",D.BUFFER_STALLED_ERROR="bufferStalledError",D.BUFFER_FULL_ERROR="bufferFullError",D.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",D.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",D.INTERNAL_EXCEPTION="internalException",D.INTERNAL_ABORTED="aborted",D.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"Events",function(){return Q});var Q;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return v});var Q=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(Q),D=_("./src/loader/playlist-loader.ts"),G=_("./src/loader/key-loader.ts"),H=_("./src/controller/id3-track-controller.ts"),F=_("./src/controller/latency-controller.ts"),O=_("./src/controller/level-controller.ts"),y=_("./src/controller/fragment-tracker.ts"),T=_("./src/controller/stream-controller.ts"),I=_("./src/is-supported.ts"),L=_("./src/utils/logger.ts"),A=_("./src/config.ts"),w=_("./node_modules/eventemitter3/index.js"),d=_.n(w),o=_("./src/events.ts"),l=_("./src/errors.ts");function u(g,k){for(var x=0;x<k.length;x++){var f=k[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function C(g,k,x){return k&&u(g.prototype,k),x&&u(g,x),g}var v=function(){g.isSupported=function(){return Object(I.isSupported)()};function g(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new w.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 f=this.config=Object(A.mergeConfig)(g.DefaultConfig,x);this.userConfig=x,Object(L.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(A.enableStreamingMode)(f);var p=f.abrController,h=f.bufferController,a=f.capLevelController,b=f.fpsController,m=this.abrController=new p(this),E=this.bufferController=new h(this),B=this.capLevelController=new a(this),W=new b(this),K=new D.default(this),V=new G.default(this),M=new H.default(this),P=this.levelController=new O.default(this),$=new y.FragmentTracker(this),ae=this.streamController=new T.default(this,$);B.setStreamController(ae),W.setStreamController(ae);var he=[P,ae];this.networkControllers=he;var me=[K,V,m,E,B,W,M,$];this.audioTrackController=this.createController(f.audioTrackController,null,he),this.createController(f.audioStreamController,$,he),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,he),this.createController(f.subtitleStreamController,$,he),this.createController(f.timelineController,null,me),this.emeController=this.createController(f.emeController,null,me),this.cmcdController=this.createController(f.cmcdController,null,me),this.latencyController=this.createController(F.default,null,me),this.coreComponents=me}var k=g.prototype;return k.createController=function(f,p,h){if(f){var a=p?new f(this,p):new f(this);return h&&h.push(a),a}return null},k.on=function(f,p,h){h===void 0&&(h=this),this._emitter.on(f,p,h)},k.once=function(f,p,h){h===void 0&&(h=this),this._emitter.once(f,p,h)},k.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},k.off=function(f,p,h,a){h===void 0&&(h=this),this._emitter.off(f,p,h,a)},k.listeners=function(f){return this._emitter.listeners(f)},k.emit=function(f,p,h){return this._emitter.emit(f,p,h)},k.trigger=function(f,p){if(this.config.debug)return this.emit(f,f,p);try{return this.emit(f,f,p)}catch(h){L.logger.error("An internal error happened while handling event "+f+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:h})}return!1},k.listenerCount=function(f){return this._emitter.listenerCount(f)},k.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},k.attachMedia=function(f){L.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},k.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(f){this.stopLoad();var p=this.media,h=this.url,a=this.url=Q.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),p&&h&&h!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},k.startLoad=function(f){f===void 0&&(f=-1),L.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(p){p.startLoad(f)})},k.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},k.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){L.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},k.removeLevel=function(f,p){p===void 0&&(p=0),this.levelController.removeLevel(f,p)},C(g,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){L.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){L.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){L.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){L.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){L.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var p=!!f;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(L.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,p=this.config.minAutoBitrate;if(!f)return 0;for(var h=f.length,a=0;a<h;a++)if(f[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,p=this.autoLevelCapping,h;return p===-1&&f&&f.length?h=f.length-1:h=p,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var p=this.audioTrackController;p&&(p.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:A.hlsDefaultConfig},set:function(f){g.defaultConfig=f}}]),g}();v.defaultConfig=void 0},"./src/is-supported.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isSupported",function(){return D}),_.d(Z,"changeTypeSupported",function(){return G});var Q=_("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var H=Object(Q.getMediaSource)();if(!H)return!1;var F=U(),O=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!F||F.prototype&&typeof F.prototype.appendBuffer=="function"&&typeof F.prototype.remove=="function";return!!O&&!!y}function G(){var H,F=U();return typeof(F==null||((H=F.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L}),_.d(Z,"LoadError",function(){return w});var Q=_("./src/polyfills/number.ts"),U=_("./src/errors.ts");function D(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function G(d){var o=typeof Map=="function"?new Map:void 0;return G=function(u){if(u===null||!O(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,C)}function C(){return H(u,arguments,T(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),y(C,u)},G(d)}function H(d,o,l){return F()?H=Reflect.construct:H=function(C,v,g){var k=[null];k.push.apply(k,v);var x=Function.bind.apply(C,k),f=new x;return g&&y(f,g.prototype),f},H.apply(null,arguments)}function F(){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 O(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},y(d,o)}function T(d){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},T(d)}var I=Math.pow(2,17),L=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,C){var v=this,g=u.url;if(!g)return Promise.reject(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var k=this.config,x=k.fLoader,f=k.loader;return new Promise(function(p,h){v.loader&&v.loader.destroy();var a=v.loader=u.loader=x?new x(k):new f(k),b=A(u),m={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:I};u.stats=a.stats,a.load(b,m,{onSuccess:function(B,W,K,V){v.resetLoader(u,a),p({frag:u,part:null,payload:B.data,networkDetails:V})},onError:function(B,W,K){v.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:B,networkDetails:K}))},onAbort:function(B,W,K){v.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:K}))},onTimeout:function(B,W,K){v.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:K}))},onProgress:function(B,W,K,V){C&&C({frag:u,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(u,C,v){var g=this;this.abort();var k=this.config,x=k.fLoader,f=k.loader;return new Promise(function(p,h){g.loader&&g.loader.destroy();var a=g.loader=u.loader=x?new x(k):new f(k),b=A(u,C),m={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:I};C.stats=a.stats,a.load(b,m,{onSuccess:function(B,W,K,V){g.resetLoader(u,a),g.updateStatsFromPart(u,C);var M={frag:u,part:C,payload:B.data,networkDetails:V};v(M),p(M)},onError:function(B,W,K){g.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:B,networkDetails:K}))},onAbort:function(B,W,K){u.stats.aborted=C.stats.aborted,g.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:K}))},onTimeout:function(B,W,K){g.resetLoader(u,a),h(new w({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:K}))}})})},o.updateStatsFromPart=function(u,C){var v=u.stats,g=C.stats,k=g.total;if(v.loaded+=g.loaded,k){var x=Math.round(u.duration/C.duration),f=Math.min(Math.round(v.loaded/k),x),p=x-f,h=p*Math.round(v.loaded/f);v.total=v.loaded+h}else v.total=Math.max(v.loaded,v.total);var a=v.loading,b=g.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},o.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},d}();function A(d,o){o===void 0&&(o=null);var l=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(Q.isFiniteNumber)(C)&&Object(Q.isFiniteNumber)(v)&&(u.rangeStart=C,u.rangeEnd=v),u}var w=function(d){D(o,d);function o(l){for(var u,C=arguments.length,v=new Array(C>1?C-1:0),g=1;g<C;g++)v[g-1]=arguments[g];return u=d.call.apply(d,[this].concat(v))||this,u.data=void 0,u.data=l,u}return o}(G(Error))},"./src/loader/fragment.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ElementaryStreamTypes",function(){return L}),_.d(Z,"BaseSegment",function(){return A}),_.d(Z,"Fragment",function(){return w}),_.d(Z,"Part",function(){return d});var Q=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),D=_.n(U),G=_("./src/utils/logger.ts"),H=_("./src/loader/level-key.ts"),F=_("./src/loader/load-stats.ts");function O(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},y(o,l)}function T(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function I(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var A=function(){function o(u){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[L.AUDIO]=null,C[L.VIDEO]=null,C[L.AUDIOVIDEO]=null,C),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(C,v){var g=C.split("@",2),k=[];g.length===1?k[0]=v?v.byteRangeEndOffset:0:k[0]=parseInt(g[1]),k[1]=parseInt(g[0])+k[0],this._byteRange=k},I(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),w=function(o){O(l,o);function l(C,v){var g;return g=o.call(this,v)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new F.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=C,g}var u=l.prototype;return u.createInitializationVector=function(v){for(var g=new Uint8Array(16),k=12;k<16;k++)g[k]=v>>8*(15-k)&255;return g},u.setDecryptDataFromLevelKey=function(v,g){var k=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(k=H.LevelKey.fromURI(v.uri),k.method=v.method,k.iv=this.createInitializationVector(g),k.keyFormat="identity"),k},u.setElementaryStreamInfo=function(v,g,k,x,f,p){p===void 0&&(p=!1);var h=this.elementaryStreams,a=h[v];if(!a){h[v]={startPTS:g,endPTS:k,startDTS:x,endDTS:f,partial:p};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,k),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,f)},u.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[L.AUDIO]=null,v[L.VIDEO]=null,v[L.AUDIOVIDEO]=null},I(l,[{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(Q.isFiniteNumber)(this.programDateTime))return null;var v=Object(Q.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)}}]),l}(A),d=function(o){O(l,o);function l(u,C,v,g,k){var x;x=o.call(this,v)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new F.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=C,x.index=g;var f=u.enumeratedString("BYTERANGE");return f&&x.setByteRange(f,k),k&&(x.fragOffset=k.fragOffset+k.duration),x}return I(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(A)},"./src/loader/key-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return G});var Q=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/utils/logger.ts"),G=function(){function H(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var F=H.prototype;return F._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},F._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},F.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var T=this.loaders[y];T&&T.destroy()}this.loaders={}},F.onKeyLoading=function(y,T){var I=T.frag,L=I.type,A=this.loaders[L];if(!I.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var w=I.decryptdata.uri;if(w!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(A&&(D.logger.warn("abort previous key loader for type:"+L),A.abort()),!w){D.logger.warn("key uri is falsy");return}var o=d.loader,l=I.loader=this.loaders[L]=new o(d);this.decrypturl=w,this.decryptkey=null;var u={url:w,frag:I,responseType:"arraybuffer"},C={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,C,v)}else this.decryptkey&&(I.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:I}))},F.loadsuccess=function(y,T,I){var L=I.frag;if(!L.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(y.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:L})},F.loaderror=function(y,T){var I=T.frag,L=I.loader;L&&L.abort(),delete this.loaders[I.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:I,response:y})},F.loadtimeout=function(y,T){var I=T.frag,L=I.loader;L&&L.abort(),delete this.loaders[I.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:I})},H}()},"./src/loader/level-details.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LevelDetails",function(){return H});var Q=_("./src/polyfills/number.ts");function U(F,O){for(var y=0;y<O.length;y++){var T=O[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(F,T.key,T)}}function D(F,O,y){return O&&U(F.prototype,O),y&&U(F,y),F}var G=10,H=function(){function F(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=F.prototype;return O.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var I=this.lastPartSn-T.lastPartSn,L=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!L||!!I,this.advanced=this.endSN>T.endSN||I>0||I===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},D(F,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var I=this.driftEnd-this.driftStart;return I*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),F}()},"./src/loader/level-key.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LevelKey",function(){return H});var Q=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(Q);function D(F,O){for(var y=0;y<O.length;y++){var T=O[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(F,T.key,T)}}function G(F,O,y){return O&&D(F.prototype,O),y&&D(F,y),F}var H=function(){F.fromURL=function(y,T){return new F(y,T)},F.fromURI=function(y){return new F(y)};function F(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(Q.buildAbsoluteURL)(O,y,{alwaysNormalize:!0}):this._uri=O}return G(F,[{key:"uri",get:function(){return this._uri}}]),F}()},"./src/loader/load-stats.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LoadStats",function(){return Q});var Q=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(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l});var Q=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),D=_.n(U),G=_("./src/loader/fragment.ts"),H=_("./src/loader/level-details.ts"),F=_("./src/loader/level-key.ts"),O=_("./src/utils/attr-list.ts"),y=_("./src/utils/logger.ts"),T=_("./src/utils/codecs.ts"),I=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,A=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),w=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(k){var x,f;return d.test((x=(f=U.parseURL(k))===null||f===void 0?void 0:f.path)!=null?x:"")}var l=function(){function k(){}return k.findGroup=function(f,p){for(var h=0;h<f.length;h++){var a=f[h];if(a.id===p)return a}},k.convertAVC1ToAVCOTI=function(f){var p=f.split(".");if(p.length>2){var h=p.shift()+".";return h+=parseInt(p.shift()).toString(16),h+=("000"+parseInt(p.shift()).toString(16)).substr(-4),h}return f},k.resolve=function(f,p){return U.buildAbsoluteURL(p,f,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(f,p){var h=[],a={},b=!1;I.lastIndex=0;for(var m;(m=I.exec(f))!=null;)if(m[1]){var E=new O.AttrList(m[1]),B={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:k.resolve(m[2],p)},W=E.decimalResolution("RESOLUTION");W&&(B.width=W.width,B.height=W.height),u((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),B),B.videoCodec&&B.videoCodec.indexOf("avc1")!==-1&&(B.videoCodec=k.convertAVC1ToAVCOTI(B.videoCodec)),h.push(B)}else if(m[3]){var K=new O.AttrList(m[3]);K["DATA-ID"]&&(b=!0,a[K["DATA-ID"]]=K)}return{levels:h,sessionData:b?a:null}},k.parseMasterPlaylistMedia=function(f,p,h,a){a===void 0&&(a=[]);var b,m=[],E=0;for(L.lastIndex=0;(b=L.exec(f))!==null;){var B=new O.AttrList(b[1]);if(B.TYPE===h){var W={attrs:B,bitrate:0,id:E++,groupId:B["GROUP-ID"],instreamId:B["INSTREAM-ID"],name:B.NAME||B.LANGUAGE||"",type:h,default:B.bool("DEFAULT"),autoselect:B.bool("AUTOSELECT"),forced:B.bool("FORCED"),lang:B.LANGUAGE,url:B.URI?k.resolve(B.URI,p):""};if(a.length){var K=k.findGroup(a,W.groupId)||a[0];C(W,K,"audioCodec"),C(W,K,"textCodec")}m.push(W)}}return m},k.parseLevelPlaylist=function(f,p,h,a,b){var m=new H.LevelDetails(p),E=m.fragments,B=null,W=0,K=0,V=0,M=0,P=null,$=new G.Fragment(a,p),ae,he,me,De=-1,xe=!1;for(A.lastIndex=0,m.m3u8=f;(ae=A.exec(f))!==null;){xe&&(xe=!1,$=new G.Fragment(a,p),$.start=V,$.sn=W,$.cc=M,$.level=h,B&&($.initSegment=B,$.rawProgramDateTime=B.rawProgramDateTime));var ke=ae[1];if(ke){$.duration=parseFloat(ke);var Te=(" "+ae[2]).slice(1);$.title=Te||null,$.tagList.push(Te?["INF",ke,Te]:["INF",ke])}else if(ae[3])Object(Q.isFiniteNumber)($.duration)&&($.start=V,me&&($.levelkey=me),$.sn=W,$.level=h,$.cc=M,$.urlId=b,E.push($),$.relurl=(" "+ae[3]).slice(1),g($,P),P=$,V+=$.duration,W++,K=0,xe=!0);else if(ae[4]){var Se=(" "+ae[4]).slice(1);P?$.setByteRange(Se,P):$.setByteRange(Se)}else if(ae[5])$.rawProgramDateTime=(" "+ae[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),De===-1&&(De=E.length);else{if(ae=ae[0].match(w),!ae){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(he=1;he<ae.length&&!(typeof ae[he]!="undefined");he++);var ye=(" "+ae[he]).slice(1),z=(" "+ae[he+1]).slice(1),s=ae[he+2]?(" "+ae[he+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":m.type=z.toUpperCase();break;case"MEDIA-SEQUENCE":W=m.startSN=parseInt(z);break;case"SKIP":{var c=new O.AttrList(z),R=c.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(R)){m.skippedSegments=R;for(var Y=R;Y--;)E.unshift(null);W+=R}var N=c.enumeratedString("RECENTLY-REMOVED-DATERANGES");N&&(m.recentlyRemovedDateranges=N.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(z);break;case"VERSION":m.version=parseInt(z);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(z||s)&&$.tagList.push(s?[z,s]:[z]);break;case"DIS":M++;case"GAP":$.tagList.push([ye]);break;case"BITRATE":$.tagList.push([ye,z]);break;case"DISCONTINUITY-SEQ":M=parseInt(z);break;case"KEY":{var se,be=new O.AttrList(z),Ae=be.enumeratedString("METHOD"),Oe=be.URI,Le=be.hexadecimalInteger("IV"),_e=be.enumeratedString("KEYFORMATVERSIONS"),Pe=be.enumeratedString("KEYID"),He=(se=be.enumeratedString("KEYFORMAT"))!=null?se:"identity",Ge=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ge.indexOf(He)>-1){y.logger.warn("Keyformat "+He+" is not supported from the manifest");continue}else if(He!=="identity")continue;Ae&&(me=F.LevelKey.fromURL(p,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(me.method=Ae,me.keyFormat=He,Pe&&(me.keyID=Pe),_e&&(me.keyFormatVersions=_e),me.iv=Le));break}case"START":{var Xe=new O.AttrList(z),ze=Xe.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(ze)&&(m.startTimeOffset=ze);break}case"MAP":{var ot=new O.AttrList(z);$.relurl=ot.URI,ot.BYTERANGE&&$.setByteRange(ot.BYTERANGE),$.level=h,$.sn="initSegment",me&&($.levelkey=me),$.initSegment=null,B=$,xe=!0;break}case"SERVER-CONTROL":{var $e=new O.AttrList(z);m.canBlockReload=$e.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=$e.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&$e.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=$e.optionalFloat("PART-HOLD-BACK",0),m.holdBack=$e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Je=new O.AttrList(z);m.partTarget=Je.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=m.partList;Re||(Re=m.partList=[]);var rt=K>0?Re[Re.length-1]:void 0,qe=K++,oe=new G.Part(new O.AttrList(z),$,p,qe,rt);Re.push(oe),$.duration+=oe.duration;break}case"PRELOAD-HINT":{var q=new O.AttrList(z);m.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new O.AttrList(z);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ee);break}default:y.logger.warn("line parsed but not handled: "+ae);break}}}P&&!P.relurl?(E.pop(),V-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(g($,P),$.cc=M,m.fragmentHint=$);var ne=E.length,le=E[0],te=E[ne-1];if(V+=m.skippedSegments*m.targetduration,V>0&&ne&&te){m.averagetargetduration=V/ne;var ie=te.sn;m.endSN=ie!=="initSegment"?ie:0,le&&(m.startCC=le.cc,le.initSegment||m.fragments.every(function(ue){return ue.relurl&&o(ue.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,p),$.relurl=te.relurl,$.level=h,$.sn="initSegment",le.initSegment=$,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(V+=m.fragmentHint.duration),m.totalduration=V,m.endCC=M,De>0&&v(E,De),m},k}();function u(k,x){["video","audio","text"].forEach(function(f){var p=k.filter(function(a){return Object(T.isCodecType)(a,f)});if(p.length){var h=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[f+"Codec"]=h.length>0?h[0]:p[0],k=k.filter(function(a){return p.indexOf(a)===-1})}}),x.unknownCodecs=k}function C(k,x,f){var p=x[f];p&&(k[f]=p)}function v(k,x){for(var f=k[x],p=x;p--;){var h=k[p];if(!h)return;h.programDateTime=f.programDateTime-h.duration*1e3,f=h}}function g(k,x){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):x!=null&&x.programDateTime&&(k.programDateTime=x.endProgramDateTime),Object(Q.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/errors.ts"),G=_("./src/utils/logger.ts"),H=_("./src/utils/mp4-tools.ts"),F=_("./src/loader/m3u8-parser.ts"),O=_("./src/types/loader.ts"),y=_("./src/utils/attr-list.ts");function T(A){var w=A.type;switch(w){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function I(A,w){var d=A.url;return(d===void 0||d.indexOf("data:")===0)&&(d=w.url),d}var L=function(){function A(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var w=A.prototype;return w.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},w.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},w.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,C=l.loader,v=u||C,g=new v(l);return o.loader=g,this.loaders[o.type]=g,g},w.getInternalLoader=function(o){return this.loaders[o.type]},w.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},w.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},w.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},w.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},w.onLevelLoading=function(o,l){var u=l.id,C=l.level,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:O.PlaylistContextType.LEVEL,url:v,deliveryDirectives:g})},w.onAudioTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:g})},w.onSubtitleTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:g})},w.load=function(o){var l,u=this.hls.config,C=this.getInternalLoader(o);if(C){var v=C.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),C.abort()}var g,k,x,f;switch(o.type){case O.PlaylistContextType.MANIFEST:g=u.manifestLoadingMaxRetry,k=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:g=0,k=u.levelLoadingTimeOut;break;default:g=u.levelLoadingMaxRetry,k=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var p;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var h=p.partTarget,a=p.targetduration;h&&a&&(k=Math.min(Math.max(h*3,a*.8)*1e3,k))}}var b={timeout:k,maxRetry:g,retryDelay:x,maxRetryDelay:f,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,b,m)},w.loadsuccess=function(o,l,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,C);return}this.resetInternalLoader(u.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,C):this.handleMasterPlaylist(o,l,u,C)},w.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},w.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},w.handleMasterPlaylist=function(o,l,u,C){var v=this.hls,g=o.data,k=I(o,u),x=F.default.parseMasterPlaylist(g,k),f=x.levels,p=x.sessionData;if(!f.length){this.handleManifestParsingError(o,u,"no level found in manifest",C);return}var h=f.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),a=f.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),b=F.default.parseMasterPlaylistMedia(g,k,"AUDIO",h),m=F.default.parseMasterPlaylistMedia(g,k,"SUBTITLES",a),E=F.default.parseMasterPlaylistMedia(g,k,"CLOSED-CAPTIONS");if(b.length){var B=b.some(function(W){return!W.url});!B&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:f,audioTracks:b,subtitles:m,captions:E,url:k,stats:l,networkDetails:C,sessionData:p})},w.handleTrackOrLevelPlaylist=function(o,l,u,C){var v=this.hls,g=u.id,k=u.level,x=u.type,f=I(o,u),p=Object(Q.isFiniteNumber)(g)?g:0,h=Object(Q.isFiniteNumber)(k)?k:p,a=T(u),b=F.default.parseLevelPlaylist(o.data,f,h,a,p);if(!b.fragments.length){v.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(x===O.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:b,name:"",url:f};v.trigger(U.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:f,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),b.needSidxRanges){var E,B=(E=b.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:B,isSidxRequest:!0,type:x,level:k,levelDetails:b,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=b,this.handlePlaylistLoaded(o,l,u,C)},w.handleSidxRequest=function(o,l){var u=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var C=u.references,v=l.levelDetails;C.forEach(function(g,k){var x=g.info,f=v.fragments[k];f.byteRange.length===0&&f.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},w.handleManifestParsingError=function(o,l,u,C){this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:C})},w.handleNetworkError=function(o,l,u,C){u===void 0&&(u=!1),G.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=D.ErrorDetails.UNKNOWN,g=!1,k=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:v=u?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case O.PlaylistContextType.LEVEL:v=u?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case O.PlaylistContextType.AUDIO_TRACK:v=u?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:v=u?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}k&&this.resetInternalLoader(o.type);var x={type:D.ErrorTypes.NETWORK_ERROR,details:v,fatal:g,url:o.url,loader:k,context:o,networkDetails:l};C&&(x.response=C),this.hls.trigger(U.Events.ERROR,x)},w.handlePlaylistLoaded=function(o,l,u,C){var v=u.type,g=u.level,k=u.id,x=u.groupId,f=u.loader,p=u.levelDetails,h=u.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",C);return}if(!f)return;p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:p,level:g||0,id:k||0,stats:l,networkDetails:C,deliveryDirectives:h});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:h});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:h});break}},A}();Z.default=L},"./src/polyfills/number.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isFiniteNumber",function(){return Q}),_.d(Z,"MAX_SAFE_INTEGER",function(){return U});var Q=Number.isFinite||function(D){return typeof D=="number"&&isFinite(D)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=function(){function U(){}return U.getSilentFrame=function(G,H){switch(G){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===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(H===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(H===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(H===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(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();Z.default=Q},"./src/remux/mp4-generator.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=Math.pow(2,32)-1,U=function(){function D(){}return D.init=function(){D.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 H;for(H in D.types)D.types.hasOwnProperty(H)&&(D.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var F=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]);D.HDLR_TYPES={video:F,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]),T=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=T,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var I=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,I,A,I,L),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,y))},D.box=function(H){for(var F=8,O=arguments.length,y=new Array(O>1?O-1:0),T=1;T<O;T++)y[T-1]=arguments[T];for(var I=y.length,L=I;I--;)F+=y[I].byteLength;var A=new Uint8Array(F);for(A[0]=F>>24&255,A[1]=F>>16&255,A[2]=F>>8&255,A[3]=F&255,A.set(H,4),I=0,F=8;I<L;I++)A.set(y[I],F),F+=y[I].byteLength;return A},D.hdlr=function(H){return D.box(D.types.hdlr,D.HDLR_TYPES[H])},D.mdat=function(H){return D.box(D.types.mdat,H)},D.mdhd=function(H,F){F*=H;var O=Math.floor(F/(Q+1)),y=Math.floor(F%(Q+1));return D.box(D.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&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]))},D.mdia=function(H){return D.box(D.types.mdia,D.mdhd(H.timescale,H.duration),D.hdlr(H.type),D.minf(H))},D.mfhd=function(H){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},D.minf=function(H){return H.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(H)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(H))},D.moof=function(H,F,O){return D.box(D.types.moof,D.mfhd(H),D.traf(O,F))},D.moov=function(H){for(var F=H.length,O=[];F--;)O[F]=D.trak(H[F]);return D.box.apply(null,[D.types.moov,D.mvhd(H[0].timescale,H[0].duration)].concat(O).concat(D.mvex(H)))},D.mvex=function(H){for(var F=H.length,O=[];F--;)O[F]=D.trex(H[F]);return D.box.apply(null,[D.types.mvex].concat(O))},D.mvhd=function(H,F){F*=H;var O=Math.floor(F/(Q+1)),y=Math.floor(F%(Q+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&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 D.box(D.types.mvhd,T)},D.sdtp=function(H){var F=H.samples||[],O=new Uint8Array(4+F.length),y,T;for(y=0;y<F.length;y++)T=F[y].flags,O[y+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return D.box(D.types.sdtp,O)},D.stbl=function(H){return D.box(D.types.stbl,D.stsd(H),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(H){var F=[],O=[],y,T,I;for(y=0;y<H.sps.length;y++)T=H.sps[y],I=T.byteLength,F.push(I>>>8&255),F.push(I&255),F=F.concat(Array.prototype.slice.call(T));for(y=0;y<H.pps.length;y++)T=H.pps[y],I=T.byteLength,O.push(I>>>8&255),O.push(I&255),O=O.concat(Array.prototype.slice.call(T));var L=D.box(D.types.avcC,new Uint8Array([1,F[3],F[4],F[5],252|3,224|H.sps.length].concat(F).concat([H.pps.length]).concat(O))),A=H.width,w=H.height,d=H.pixelRatio[0],o=H.pixelRatio[1];return D.box(D.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,A>>8&255,A&255,w>>8&255,w&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]),L,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},D.esds=function(H){var F=H.config.length;return new Uint8Array([0,0,0,0,3,23+F,0,1,0,4,15+F,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([F]).concat(H.config).concat([6,1,2]))},D.mp4a=function(H){var F=H.samplerate;return D.box(D.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]),D.box(D.types.esds,D.esds(H)))},D.mp3=function(H){var F=H.samplerate;return D.box(D.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]))},D.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(H)):D.box(D.types.stsd,D.STSD,D.mp4a(H)):D.box(D.types.stsd,D.STSD,D.avc1(H))},D.tkhd=function(H){var F=H.id,O=H.duration*H.timescale,y=H.width,T=H.height,I=Math.floor(O/(Q+1)),L=Math.floor(O%(Q+1));return D.box(D.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&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,T>>8&255,T&255,0,0]))},D.traf=function(H,F){var O=D.sdtp(H),y=H.id,T=Math.floor(F/(Q+1)),I=Math.floor(F%(Q+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,I>>24,I>>16&255,I>>8&255,I&255])),D.trun(H,O.length+16+20+8+16+8+8),O)},D.trak=function(H){return H.duration=H.duration||4294967295,D.box(D.types.trak,D.tkhd(H),D.mdia(H))},D.trex=function(H){var F=H.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(H,F){var O=H.samples||[],y=O.length,T=12+16*y,I=new Uint8Array(T),L,A,w,d,o,l;for(F+=8+T,I.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255],0),L=0;L<y;L++)A=O[L],w=A.duration,d=A.size,o=A.flags,l=A.cts,I.set([w>>>24&255,w>>>16&255,w>>>8&255,w&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return D.box(D.types.trun,I)},D.initSegment=function(H){D.types||D.init();var F=D.moov(H),O=new Uint8Array(D.FTYP.byteLength+F.byteLength);return O.set(D.FTYP),O.set(F,D.FTYP.byteLength),O},D}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,Z.default=U},"./src/remux/mp4-remuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l}),_.d(Z,"normalizePts",function(){return u});var Q=_("./src/polyfills/number.ts"),U=_("./src/remux/aac-helper.ts"),D=_("./src/remux/mp4-generator.ts"),G=_("./src/events.ts"),H=_("./src/errors.ts"),F=_("./src/utils/logger.ts"),O=_("./src/types/loader.ts"),y=_("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(k[p]=f[p])}return k},T.apply(this,arguments)}var I=10*1e3,L=1024,A=1152,w=null,d=null,o=!1,l=function(){function k(f,p,h,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=f,this.config=p,this.typeSupported=h,this.ISGenerated=!1,w===null){var b=navigator.userAgent||"",m=b.match(/Chrome\/(\d+)/i);w=m?parseInt(m[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!w&&w<75||!!d&&d<600}var x=k.prototype;return x.destroy=function(){},x.resetTimeStamp=function(p){F.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},x.resetNextTimestamp=function(){F.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){F.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(p){var h=!1,a=p.reduce(function(b,m){var E=m.pts-b;return E<-4294967296?(h=!0,u(b,m.pts)):E>0?b:m.pts},p[0].pts);return h&&F.logger.debug("PTS rollover detected"),a},x.remux=function(p,h,a,b,m,E,B,W){var K,V,M,P,$,ae,he=m,me=m,De=p.pid>-1,xe=h.pid>-1,ke=h.samples.length,Te=p.samples.length>0,Se=ke>1,ye=(!De||Te)&&(!xe||Se)||this.ISGenerated||B;if(ye){this.ISGenerated||(M=this.generateIS(p,h,m));var z=this.isVideoContiguous,s=-1;if(Se&&(s=C(h.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,s>0){F.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+ke+" video samples due to a missing keyframe");var c=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(s),h.dropped+=s,me+=(h.samples[0].pts-c)/(h.timescale||9e4)}else s===-1&&(F.logger.warn("[mp4-remuxer]: No keyframe found out of "+ke+" video samples"),ae=!1);if(this.ISGenerated){if(Te&&Se){var R=this.getVideoStartPts(h.samples),Y=u(p.samples[0].pts,R)-R,N=Y/h.inputTimeScale;he+=Math.max(0,N),me+=Math.max(0,-N)}if(Te){if(p.samplerate||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(p,h,m)),V=this.remuxAudio(p,he,this.isAudioContiguous,E,xe||Se||W===O.PlaylistLevelType.AUDIO?me:void 0),Se){var se=V?V.endPTS-V.startPTS:0;h.inputTimeScale||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(p,h,m)),K=this.remuxVideo(h,me,z,se)}}else Se&&(K=this.remuxVideo(h,me,z,0));K&&(K.firstKeyFrame=s,K.independent=s!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,m)),b.samples.length&&(P=this.remuxText(b,m))),{audio:V,video:K,initSegment:M,independent:ae,text:P,id3:$}},x.generateIS=function(p,h,a){var b=p.samples,m=h.samples,E=this.typeSupported,B={},W=!Object(Q.isFiniteNumber)(this._initPTS),K="audio/mp4",V,M,P;if(W&&(V=M=Infinity),p.config&&b.length&&(p.timescale=p.samplerate,p.isAAC||(E.mpeg?(K="audio/mpeg",p.codec=""):E.mp3&&(p.codec="mp3")),B.audio={id:"audio",container:K,codec:p.codec,initSegment:!p.isAAC&&E.mpeg?new Uint8Array(0):D.default.initSegment([p]),metadata:{channelCount:p.channelCount}},W&&(P=p.inputTimeScale,V=M=b[0].pts-Math.round(P*a))),h.sps&&h.pps&&m.length&&(h.timescale=h.inputTimeScale,B.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:D.default.initSegment([h]),metadata:{width:h.width,height:h.height}},W)){P=h.inputTimeScale;var $=this.getVideoStartPts(m),ae=Math.round(P*a);M=Math.min(M,u(m[0].dts,$)-ae),V=Math.min(V,$-ae)}if(Object.keys(B).length)return this.ISGenerated=!0,W&&(this._initPTS=V,this._initDTS=M),{tracks:B,initPTS:V,timescale:P}},x.remuxVideo=function(p,h,a,b){var m=p.inputTimeScale,E=p.samples,B=[],W=E.length,K=this._initPTS,V=this.nextAvcDts,M=8,P,$,ae,he=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,De=0,xe=!1;if(!a||V===null){var ke=h*m,Te=E[0].pts-u(E[0].dts,E[0].pts);V=ke-Te}for(var Se=0;Se<W;Se++){var ye=E[Se];if(ye.pts=u(ye.pts-K,V),ye.dts=u(ye.dts-K,V),ye.dts>ye.pts){var z=9e4*.2;De=Math.max(Math.min(De,ye.pts-ye.dts),-1*z)}ye.dts<E[Se>0?Se-1:Se].dts&&(xe=!0)}xe&&E.sort(function(pt,nt){var tt=pt.dts-nt.dts,Tt=pt.pts-nt.pts;return tt||Tt}),$=E[0].dts,ae=E[E.length-1].dts;var s=Math.round((ae-$)/(W-1));if(De<0){if(De<s*-2){F.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-s,!0)+" ms");for(var c=De,R=0;R<W;R++)E[R].dts=c=Math.max(c,E[R].pts-s),E[R].pts=Math.max(c,E[R].pts)}else{F.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(De,!0)+" ms to overcome this issue");for(var Y=0;Y<W;Y++)E[Y].dts=E[Y].dts+De}$=E[0].dts}if(a){var N=$-V,se=N>s,be=N<-1;if(se||be){se?F.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(N,!0)+" ms ("+N+"dts) hole between fragments detected, filling it"):F.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-N,!0)+" ms ("+N+"dts) overlapping between fragments detected"),$=V;var Ae=E[0].pts-N;E[0].dts=$,E[0].pts=Ae,F.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(y.toMsFromMpegTsClock)($,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(N,!0)+" ms")}}o&&($=Math.max(0,$));for(var Oe=0,Le=0,_e=0;_e<W;_e++){for(var Pe=E[_e],He=Pe.units,Ge=He.length,Xe=0,ze=0;ze<Ge;ze++)Xe+=He[ze].data.length;Le+=Xe,Oe+=Ge,Pe.length=Xe,Pe.dts=Math.max(Pe.dts,$),Pe.pts=Math.max(Pe.pts,Pe.dts,0),he=Math.min(Pe.pts,he),me=Math.max(Pe.pts,me)}ae=E[W-1].dts;var ot=Le+4*Oe+8,$e;try{$e=new Uint8Array(ot)}catch(pt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ot,reason:"fail allocating video mdat "+ot});return}var Je=new DataView($e.buffer);Je.setUint32(0,ot),$e.set(D.default.types.mdat,4);for(var Re=0;Re<W;Re++){for(var rt=E[Re],qe=rt.units,oe=0,q=0,ee=qe.length;q<ee;q++){var ne=qe[q],le=ne.data,te=ne.data.byteLength;Je.setUint32(M,te),M+=4,$e.set(le,M),M+=te,oe+=4+te}if(Re<W-1)P=E[Re+1].dts-rt.dts;else{var ie=this.config,ue=rt.dts-E[Re>0?Re-1:Re].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ie.maxBufferHole*m),ve=(b?he+b*m:this.nextAudioPts)-rt.pts;ve>de?(P=ve-ue,P<0&&(P=ue),F.logger.log("[mp4-remuxer]: It is approximately "+ve/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=ue}else P=ue}var Ee=Math.round(rt.pts-rt.dts);B.push(new v(rt.key,P,oe,Ee))}if(B.length&&w&&w<70){var Me=B[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ae+P,this.isVideoContiguous=!0;var Be=D.default.moof(p.sequenceNumber++,$,T({},p,{samples:B})),Ye="video",We={data1:Be,data2:$e,startPTS:he/m,endPTS:(me+P)/m,startDTS:$/m,endDTS:V/m,type:Ye,hasAudio:!1,hasVideo:!0,nb:B.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert($e.length,"MDAT length must not be zero"),We},x.remuxAudio=function(p,h,a,b,m){var E=p.inputTimeScale,B=p.samplerate?p.samplerate:E,W=E/B,K=p.isAAC?L:A,V=K*W,M=this._initPTS,P=!p.isAAC&&this.typeSupported.mpeg,$=[],ae=p.samples,he=P?0:8,me=this.nextAudioPts||-1,De=h*E;if(this.isAudioContiguous=a=a||ae.length&&me>0&&(b&&Math.abs(De-me)<9e3||Math.abs(u(ae[0].pts-M,De)-me)<20*V),ae.forEach(function(le){le.pts=u(le.pts-M,De)}),!a||me<0){if(ae=ae.filter(function(le){return le.pts>=0}),!ae.length)return;m===0?me=0:b?me=Math.max(0,De):me=ae[0].pts}if(p.isAAC)for(var xe=m!==void 0,ke=this.config.maxAudioFramesDrift,Te=0,Se=me;Te<ae.length;Te++){var ye=ae[Te],z=ye.pts,s=z-Se,c=Math.abs(1e3*s/E);if(s<=-ke*V&&xe)Te===0&&(F.logger.warn("Audio frame @ "+(z/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*s/E)+" ms."),this.nextAudioPts=me=Se=z);else if(s>=ke*V&&c<I&&xe){var R=Math.round(s/V);Se=z-R*V,Se<0&&(R--,Se+=V),Te===0&&(this.nextAudioPts=me=Se),F.logger.warn("[mp4-remuxer]: Injecting "+R+" audio frame @ "+(Se/E).toFixed(3)+"s due to "+Math.round(1e3*s/E)+" ms gap.");for(var Y=0;Y<R;Y++){var N=Math.max(Se,0),se=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);se||(F.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),se=ye.unit.subarray()),ae.splice(Te,0,{unit:se,pts:N}),Se+=V,Te++}}ye.pts=Se,Se+=V}for(var be=null,Ae=null,Oe,Le=0,_e=ae.length;_e--;)Le+=ae[_e].unit.byteLength;for(var Pe=0,He=ae.length;Pe<He;Pe++){var Ge=ae[Pe],Xe=Ge.unit,ze=Ge.pts;if(Ae!==null){var ot=$[Pe-1];ot.duration=Math.round((ze-Ae)/W)}else if(a&&p.isAAC&&(ze=me),be=ze,Le>0){Le+=he;try{Oe=new Uint8Array(Le)}catch(le){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Le,reason:"fail allocating audio mdat "+Le});return}if(!P){var $e=new DataView(Oe.buffer);$e.setUint32(0,Le),Oe.set(D.default.types.mdat,4)}}else return;Oe.set(Xe,he);var Je=Xe.byteLength;he+=Je,$.push(new v(!0,K,Je,0)),Ae=ze}var Re=$.length;if(!Re)return;var rt=$[$.length-1];this.nextAudioPts=me=Ae+W*rt.duration;var qe=P?new Uint8Array(0):D.default.moof(p.sequenceNumber++,be/W,T({},p,{samples:$}));p.samples=[];var oe=be/E,q=me/E,ee="audio",ne={data1:qe,data2:Oe,startPTS:oe,endPTS:q,startDTS:oe,endDTS:q,type:ee,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ne},x.remuxEmptyAudio=function(p,h,a,b){var m=p.inputTimeScale,E=p.samplerate?p.samplerate:m,B=m/E,W=this.nextAudioPts,K=(W!==null?W:b.startDTS*m)+this._initDTS,V=b.endDTS*m+this._initDTS,M=B*L,P=Math.ceil((V-K)/M),$=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(F.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){F.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ae=[],he=0;he<P;he++){var me=K+he*M;ae.push({unit:$,pts:me,dts:me})}return p.samples=ae,this.remuxAudio(p,h,a,!1)},x.remuxID3=function(p,h){var a=p.samples.length;if(!a)return;for(var b=p.inputTimeScale,m=this._initPTS,E=this._initDTS,B=0;B<a;B++){var W=p.samples[B];W.pts=u(W.pts-m,h*b)/b,W.dts=u(W.dts-E,h*b)/b}var K=p.samples;return p.samples=[],{samples:K}},x.remuxText=function(p,h){var a=p.samples.length;if(!a)return;for(var b=p.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var B=p.samples[E];B.pts=u(B.pts-m,h*b)/b}p.samples.sort(function(K,V){return K.pts-V.pts});var W=p.samples;return p.samples=[],{samples:W}},k}();function u(k,x){var f;if(x===null)return k;for(x<k?f=-8589934592:f=8589934592;Math.abs(k-x)>4294967296;)k+=f;return k}function C(k){for(var x=0;x<k.length;x++)if(k[x].key)return x;return-1}var v=function(x,f,p,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=p,this.cts=h,this.flags=new g(x)},g=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/mp4-tools.ts"),D=_("./src/loader/fragment.ts"),G=_("./src/utils/logger.ts"),H=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 T=y.prototype;return T.destroy=function(){},T.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(L,A,w){this.audioCodec=A,this.videoCodec=w,this.generateInitSegment(L),this.emitInitSegment=!0},T.generateInitSegment=function(L){var A=this.audioCodec,w=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(L);A||(A=O(d.audio,D.ElementaryStreamTypes.AUDIO)),w||(w=O(d.video,D.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:A+","+w,initSegment:L,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:A,initSegment:L,id:"audio"}:d.video?o.video={container:"video/mp4",codec:w,initSegment:L,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(L,A,w,d,o){var l=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:d,id3:w,initSegment:void 0};Object(Q.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var v=A.samples;if(!v||!v.length)return C;var g={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(v),k=this.initData),!k||!k.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(l)||(this.initPTS=g.initPTS=l=F(k,v,u));var x=Object(U.getDuration)(v,k),f=u,p=x+f;Object(U.offsetStartDTS)(k,v,l),x>0?this.lastEndDTS=p:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!k.audio,a=!!k.video,b="";h&&(b+="audio"),a&&(b+="video");var m={data1:v,startPTS:f,startDTS:f,endPTS:p,endDTS:p,type:b,hasAudio:h,hasVideo:a,nb:1,dropped:0};return C.audio=m.type==="audio"?m:void 0,C.video=m.type!=="audio"?m:void 0,C.text=d,C.id3=w,C.initSegment=g,C},y}(),F=function(T,I,L){return Object(U.getStartDTS)(T,I)-L};function O(y,T){var I=y==null?void 0:y.codec;return I&&I.length>4?I:I==="hvc1"?"hvc1.1.c.L120.90":I==="av01"?"av01.0.04M.08":I==="avc1"||T===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=H},"./src/task-loop.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return Q});var Q=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var D=U.prototype;return D.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},D.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},D.onHandlerDestroyed=function(){},D.hasInterval=function(){return!!this._tickInterval},D.hasNextTick=function(){return!!this._tickTimer},D.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},D.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},D.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},D.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},D.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},D.doTick=function(){},U}()},"./src/types/cmcd.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"CMCDVersion",function(){return Q}),_.d(Z,"CMCDObjectType",function(){return U}),_.d(Z,"CMCDStreamingFormat",function(){return D}),_.d(Z,"CMCDStreamType",function(){return G});var Q=1,U;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(U||(U={}));var D;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(D||(D={}));var G;(function(H){H.VOD="v",H.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"HlsSkip",function(){return D}),_.d(Z,"getSkipValue",function(){return G}),_.d(Z,"HlsUrlParameters",function(){return H}),_.d(Z,"Level",function(){return F});function Q(O,y){for(var T=0;T<y.length;T++){var I=y[T];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(O,I.key,I)}}function U(O,y,T){return y&&Q(O.prototype,y),T&&Q(O,T),O}var D;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(D||(D={}));function G(O,y){var T=O.canSkipUntil,I=O.canSkipDateRanges,L=O.endSN,A=y!==void 0?y-L:0;return T&&A<T?I?D.v2:D.Yes:D.No}var H=function(){function O(T,I,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=I,this.skip=L}var y=O.prototype;return y.addDirectives=function(I){var L=new self.URL(I);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},O}(),F=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(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return U(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(T){var I=T%this.url.length;this._urlId!==I&&(this.details=void 0,this._urlId=I)}}]),O}()},"./src/types/loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"PlaylistContextType",function(){return Q}),_.d(Z,"PlaylistLevelType",function(){return U});var Q;(function(D){D.MANIFEST="manifest",D.LEVEL="level",D.AUDIO_TRACK="audioTrack",D.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var U;(function(D){D.MAIN="main",D.AUDIO="audio",D.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ChunkMetadata",function(){return Q});var Q=function(G,H,F,O,y,T){O===void 0&&(O=0),y===void 0&&(y=-1),T===void 0&&(T=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=G,this.sn=H,this.id=F,this.size=O,this.part=y,this.partial=T};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"AttrList",function(){return D});var Q=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function G(F){typeof F=="string"&&(F=G.parseAttrList(F));for(var O in F)F.hasOwnProperty(O)&&(this[O]=F[O])}var H=G.prototype;return H.decimalInteger=function(O){var y=parseInt(this[O],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.hexadecimalInteger=function(O){if(this[O]){var y=(this[O]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var T=new Uint8Array(y.length/2),I=0;I<y.length/2;I++)T[I]=parseInt(y.slice(I*2,I*2+2),16);return T}else return null},H.hexadecimalIntegerAsNumber=function(O){var y=parseInt(this[O],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.decimalFloatingPoint=function(O){return parseFloat(this[O])},H.optionalFloat=function(O,y){var T=this[O];return T?parseFloat(T):y},H.enumeratedString=function(O){return this[O]},H.bool=function(O){return this[O]==="YES"},H.decimalResolution=function(O){var y=Q.exec(this[O]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},G.parseAttrList=function(O){var y,T={},I='"';for(U.lastIndex=0;(y=U.exec(O))!==null;){var L=y[2];L.indexOf(I)===0&&L.lastIndexOf(I)===L.length-1&&(L=L.slice(1,-1)),T[y[1]]=L}return T},G}()},"./src/utils/binary-search.ts":function(fe,Z,_){"use strict";_.r(Z);var Q={search:function(D,G){for(var H=0,F=D.length-1,O=null,y=null;H<=F;){O=(H+F)/2|0,y=D[O];var T=G(y);if(T>0)H=O+1;else if(T<0)F=O-1;else return y}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"BufferHelper",function(){return D});var Q=_("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function G(){}return G.isBuffered=function(F,O){try{if(F){for(var y=G.getBuffered(F),T=0;T<y.length;T++)if(O>=y.start(T)&&O<=y.end(T))return!0}}catch(I){}return!1},G.bufferInfo=function(F,O,y){try{if(F){var T=G.getBuffered(F),I=[],L;for(L=0;L<T.length;L++)I.push({start:T.start(L),end:T.end(L)});return this.bufferedInfo(I,O,y)}}catch(A){}return{len:0,start:O,end:O,nextStart:void 0}},G.bufferedInfo=function(F,O,y){O=Math.max(0,O),F.sort(function(g,k){var x=g.start-k.start;return x||k.end-g.end});var T=[];if(y)for(var I=0;I<F.length;I++){var L=T.length;if(L){var A=T[L-1].end;F[I].start-A<y?F[I].end>A&&(T[L-1].end=F[I].end):T.push(F[I])}else T.push(F[I])}else T=F;for(var w=0,d,o=O,l=O,u=0;u<T.length;u++){var C=T[u].start,v=T[u].end;if(O+y>=C&&O<v)o=C,l=v,w=l-O;else if(O+y<C){d=C;break}}return{len:w,start:o||0,end:l||0,nextStart:d}},G.getBuffered=function(F){try{return F.buffered}catch(O){return Q.logger.log("failed to get media.buffered",O),U}},G}()},"./src/utils/cea-608-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"Row",function(){return l}),_.d(Z,"CaptionScreen",function(){return u});var Q=_("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},D=function(p){var h=p;return U.hasOwnProperty(p)&&(h=U[p]),String.fromCharCode(h)},G=15,H=100,F={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},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},I=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(L||(L={}));var A=function(){function f(){this.time=null,this.verboseLevel=L.ERROR}var p=f.prototype;return p.log=function(a,b){this.verboseLevel>=a&&Q.logger.log(this.time+" ["+a+"] "+b)},f}(),w=function(p){for(var h=[],a=0;a<p.length;a++)h.push(p[a].toString(16));return h},d=function(){function f(h,a,b,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=a||!1,this.italics=b||!1,this.background=m||"black",this.flash=E||!1}var p=f.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(a){for(var b=["foreground","underline","italics","background","flash"],m=0;m<b.length;m++){var E=b[m];a.hasOwnProperty(E)&&(this[E]=a[E])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},p.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(h,a,b,m,E,B){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new d(a,b,m,E,B)}var p=f.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(a,b){this.uchar=a,this.penState.copy(b)},p.setPenState=function(a){this.penState.copy(a)},p.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},p.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),l=function(){function f(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<H;a++)this.chars.push(new o);this.logger=h,this.pos=0,this.currPenState=new d}var p=f.prototype;return p.equals=function(a){for(var b=!0,m=0;m<H;m++)if(!this.chars[m].equals(a.chars[m])){b=!1;break}return b},p.copy=function(a){for(var b=0;b<H;b++)this.chars[b].copy(a.chars[b])},p.isEmpty=function(){for(var a=!0,b=0;b<H;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},p.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},p.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var m=this.pos+1;m<b+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(b)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(a){a>=144&&this.backSpace();var b=D(a);if(this.pos>=H){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var b;for(b=a;b<H;b++)this.chars[b].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var a=[],b=!0,m=0;m<H;m++){var E=this.chars[m].uchar;E!==" "&&(b=!1),a.push(E)}return b?"":a.join("")},p.setPenStyles=function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)},f}(),u=function(){function f(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new l(h));this.logger=h,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=f.prototype;return p.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},p.equals=function(a){for(var b=!0,m=0;m<G;m++)if(!this.rows[m].equals(a.rows[m])){b=!1;break}return b},p.copy=function(a){for(var b=0;b<G;b++)this.rows[b].copy(a.rows[b])},p.isEmpty=function(){for(var a=!0,b=0;b<G;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},p.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},p.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},p.insertChar=function(a){var b=this.rows[this.currRow];b.insertChar(a)},p.setPen=function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},p.moveCursor=function(a){var b=this.rows[this.currRow];b.moveCursor(a)},p.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},p.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var b=a.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var m=0;m<G;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,B=this.lastOutputScreen;if(B){var W=B.rows[E].cueStartTime,K=this.logger.time;if(W&&K!==null&&W<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[b-this.nrRollUpRows+V+1].copy(B.rows[E+V])}}this.currRow=b;var M=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,$=Math.max(P-1,0);M.setCursor(a.indent),a.color=M.chars[$].penState.foreground}var ae={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ae)},p.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},p.setRollUpRows=function(a){this.nrRollUpRows=a},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(L.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var b=[],m="",E=-1,B=0;B<G;B++){var W=this.rows[B].getTextString();W&&(E=B+1,a?b.push("Row "+E+": '"+W+"'"):b.push(W.trim()))}return b.length>0&&(a?m="["+b.join(" | ")+"]":m=b.join(`
`)),m},p.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(h,a,b){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(b),this.nonDisplayedMemory=new u(b),this.lastOutputScreen=new u(b),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var p=f.prototype;return p.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},p.getHandler=function(){return this.outputFilter},p.setHandler=function(a){this.outputFilter=a},p.setPAC=function(a){this.writeScreen.setPAC(a)},p.setBkgData=function(a){this.writeScreen.setBkgData(a)},p.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.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},p.insertChars=function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(L.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(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},p.ccMIDROW=function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=46,b.italics)b.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=E[m]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),v=function(){function f(h,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new A;this.channels=[null,new C(h,a,m),new C(h+1,b,m)],this.cmdHistory=x(),this.logger=m}var p=f.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,b){this.channels[a].setHandler(b)},p.addData=function(a,b){var m,E,B,W=!1;this.logger.time=a;for(var K=0;K<b.length;K+=2){if(E=b[K]&127,B=b[K+1]&127,E===0&&B===0)continue;if(this.logger.log(L.DATA,"["+w([b[K],b[K+1]])+"] -> ("+w([E,B])+")"),m=this.parseCmd(E,B),m||(m=this.parseMidrow(E,B)),m||(m=this.parsePAC(E,B)),m||(m=this.parseBackgroundAttributes(E,B)),!m&&(W=this.parseChars(E,B),W)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(W)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!W&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+w([E,B])+" orig: "+w([b[K],b[K+1]]))}},p.parseCmd=function(a,b){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,B=(a===23||a===31)&&b>=33&&b<=35;if(!(E||B))return!1;if(k(a,b,m))return g(null,null,m),this.logger.log(L.DEBUG,"Repeated command ("+w([a,b])+") is dropped"),!0;var W=a===20||a===21||a===23?1:2,K=this.channels[W];return a===20||a===21||a===28||a===29?b===32?K.ccRCL():b===33?K.ccBS():b===34?K.ccAOF():b===35?K.ccAON():b===36?K.ccDER():b===37?K.ccRU(2):b===38?K.ccRU(3):b===39?K.ccRU(4):b===40?K.ccFON():b===41?K.ccRDC():b===42?K.ccTR():b===43?K.ccRTD():b===44?K.ccEDM():b===45?K.ccCR():b===46?K.ccENM():b===47&&K.ccEOC():K.ccTO(b-32),g(a,b,m),this.currentChannel=W,!0},p.parseMidrow=function(a,b){var m=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(b),this.logger.log(L.DEBUG,"MIDROW ("+w([a,b])+")"),!0):!1}return!1},p.parsePAC=function(a,b){var m,E=this.cmdHistory,B=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,W=(a===16||a===24)&&b>=64&&b<=95;if(!(B||W))return!1;if(k(a,b,E))return g(null,null,E),!0;var K=a<=23?1:2;b>=64&&b<=95?m=K===1?F[a]:y[a]:m=K===1?O[a]:T[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(m,b)),g(a,b,E),this.currentChannel=K,!0):!1},p.interpretPAC=function(a,b){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?m=b-96:m=b-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},p.parseChars=function(a,b){var m,E=null,B=null;if(a>=25?(m=2,B=a-8):(m=1,B=a),B>=17&&B<=19){var W;B===17?W=b+80:B===18?W=b+112:W=b+144,this.logger.log(L.INFO,"Special char '"+D(W)+"' in channel "+m),E=[W]}else a>=32&&a<=127&&(E=b===0?[a]:[a,b]);if(E){var K=w(E);this.logger.log(L.DEBUG,"Char codes = "+K.join(",")),g(a,b,this.cmdHistory)}return E},p.parseBackgroundAttributes=function(a,b){var m=(a===16||a===24)&&b>=32&&b<=47,E=(a===23||a===31)&&b>=45&&b<=47;if(!(m||E))return!1;var B,W={};a===16||a===24?(B=Math.floor((b-32)/2),W.background=I[B],b%2===1&&(W.background=W.background+"_semi")):b===45?W.background="transparent":(W.foreground="black",b===47&&(W.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(W),g(a,b,this.cmdHistory),!0},p.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var b=this.channels[a];b&&b.reset()}this.cmdHistory=x()},p.cueSplitAtTime=function(a){for(var b=0;b<this.channels.length;b++){var m=this.channels[b];m&&m.cueSplitAtTime(a)}},f}();function g(f,p,h){h.a=f,h.b=p}function k(f,p,h){return h.a===f&&h.b===p}function x(){return{a:null,b:null}}Z.default=v},"./src/utils/codecs.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isCodecType",function(){return U}),_.d(Z,"isCodecSupportedInMp4",function(){return D});var Q={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(G,H){var F=Q[H];return!!F&&F[G.slice(0,4)]===!0}function D(G,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/utils/vttparser.ts"),U=_("./src/utils/webvtt-parser.ts"),D=_("./src/utils/texttrack-utils.ts"),G=/\s/,H={newCue:function(O,y,T,I){for(var L=[],A,w,d,o,l,u=self.VTTCue||self.TextTrackCue,C=0;C<I.rows.length;C++)if(A=I.rows[C],d=!0,o=0,l="",!A.isEmpty()){for(var v=0;v<A.chars.length;v++)G.test(A.chars[v].uchar)&&d?o++:(l+=A.chars[v].uchar,d=!1);A.cueStartTime=y,y===T&&(T+=1e-4),o>=16?o--:o++;var g=Object(Q.fixLineBreaks)(l.trim()),k=Object(U.generateCueId)(y,T,g);(!O||!O.cues||!O.cues.getCueById(k))&&(w=new u(y,T,g),w.id=k,w.line=C+1,w.align="left",w.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(w))}return O&&L.length&&(L.sort(function(x,f){return x.line==="auto"||f.line==="auto"?0:x.line>8&&f.line>8?f.line-x.line:x.line-f.line}),L.forEach(function(x){return Object(D.addCueToTrack)(O,x)})),L}};Z.default=H},"./src/utils/discontinuities.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"findFirstFragWithCC",function(){return G}),_.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),_.d(Z,"findDiscontinuousReferenceFrag",function(){return F}),_.d(Z,"adjustSlidingStart",function(){return y}),_.d(Z,"alignStream",function(){return T}),_.d(Z,"alignPDT",function(){return L}),_.d(Z,"alignFragmentByPDTDelta",function(){return A}),_.d(Z,"alignMediaPlaylistByPDT",function(){return w});var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts"),D=_("./src/controller/level-helper.ts");function G(d,o){for(var l=null,u=0,C=d.length;u<C;u++){var v=d[u];if(v&&v.cc===o){l=v;break}}return l}function H(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function F(d,o){var l=d.fragments,u=o.fragments;if(!u.length||!l.length){U.logger.log("No fragments to align");return}var C=G(l,u[0].cc);if(!C||C&&!C.startPTS){U.logger.log("No frag in previous level to align on");return}return C}function O(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function y(d,o){for(var l=o.fragments,u=0,C=l.length;u<C;u++)O(l[u],d);o.fragmentHint&&O(o.fragmentHint,d),o.alignedSliding=!0}function T(d,o,l){if(!o)return;I(d,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(D.adjustSliding)(o.details,l)}function I(d,o,l){if(H(d,l,o)){var u=F(l.details,o);u&&Object(Q.isFiniteNumber)(u.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(u.start,o))}}function L(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,C=(u-l)/1e3+o.fragments[0].start;C&&Object(Q.isFiniteNumber)(C)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+C.toFixed(3)+" "+d.url+" "),y(C,d))}function A(d,o){var l=d.programDateTime;if(!l)return;var u=(l-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function w(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,C=l-u*1e3;d.fragments.forEach(function(v){A(v,C)}),d.fragmentHint&&A(d.fragmentHint,C),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/utils/ewma.ts"),U=function(){function D(H,F,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 Q.default(H),this.fast_=new Q.default(F)}var G=D.prototype;return G.update=function(F,O){var y=this.slow_,T=this.fast_;this.slow_.halfLife!==F&&(this.slow_=new Q.default(F,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new Q.default(O,T.getEstimate(),T.getTotalWeight()))},G.sample=function(F,O){F=Math.max(F,this.minDelayMs_);var y=8*O,T=F/1e3,I=y/T;this.fast_.sample(T,I),this.slow_.sample(T,I)},G.canEstimate=function(){var F=this.fast_;return F&&F.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},D}();Z.default=U},"./src/utils/ewma.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=function(){function U(G,H,F){H===void 0&&(H=0),F===void 0&&(F=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_=H,this.totalWeight_=F}var D=U.prototype;return D.sample=function(H,F){var O=Math.pow(this.alpha_,H);this.estimate_=F*(1-O)+O*this.estimate_,this.totalWeight_+=H},D.getTotalWeight=function(){return this.totalWeight_},D.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},U}();Z.default=Q},"./src/utils/fetch-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"fetchSupported",function(){return A});var Q=_("./src/polyfills/number.ts"),U=_("./src/loader/load-stats.ts"),D=_("./src/demux/chunk-cache.ts");function G(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,T(u,C)}function H(u){var C=typeof Map=="function"?new Map:void 0;return H=function(g){if(g===null||!y(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(g))return C.get(g);C.set(g,k)}function k(){return F(g,arguments,I(this).constructor)}return k.prototype=Object.create(g.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),T(k,g)},H(u)}function F(u,C,v){return O()?F=Reflect.construct:F=function(k,x,f){var p=[null];p.push.apply(p,x);var h=Function.bind.apply(k,p),a=new h;return f&&T(a,f.prototype),a},F.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(u){return!1}}function y(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function T(u,C){return T=Object.setPrototypeOf||function(g,k){return g.__proto__=k,g},T(u,C)}function I(u){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},I(u)}function L(){return L=Object.assign||function(u){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(u[g]=v[g])}return u},L.apply(this,arguments)}function A(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var w=function(){function u(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 U.LoadStats}var C=u.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(g,k,x){var f=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var h=d(g,this.controller.signal),a=x.onProgress,b=g.responseType==="arraybuffer",m=b?"byteLength":"length";this.context=g,this.config=k,this.callbacks=x,this.request=this.fetchSetup(g,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),x.onTimeout(p,g,f.response)},k.timeout),self.fetch(this.request).then(function(E){if(f.response=f.loader=E,!E.ok){var B=E.status,W=E.statusText;throw new l(W||"fetch, bad network response",B,E)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(Q.isFiniteNumber)(k.highWaterMark)?f.loadProgressively(E,p,g,k.highWaterMark,a):b?E.arrayBuffer():E.text()}).then(function(E){var B=f.response;self.clearTimeout(f.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=E[m];var W={url:B.url,data:E};a&&!Object(Q.isFiniteNumber)(k.highWaterMark)&&a(p,g,E,B),x.onSuccess(W,p,g,B)}).catch(function(E){if(self.clearTimeout(f.requestTimeout),p.aborted)return;var B=E.code||0;x.onError({code:B,text:E.message},g,E.details)})},C.getCacheAge=function(){var g=null;if(this.response){var k=this.response.headers.get("age");g=k?parseFloat(k):null}return g},C.loadProgressively=function(g,k,x,f,p){f===void 0&&(f=0);var h=new D.default,a=g.body.getReader(),b=function m(){return a.read().then(function(E){if(E.done)return h.dataLength&&p(k,x,h.flush(),g),Promise.resolve(new ArrayBuffer(0));var B=E.value,W=B.length;return k.loaded+=W,W<f||h.dataLength?(h.push(B),h.dataLength>=f&&p(k,x,h.flush(),g)):p(k,x,B,g),m()}).catch(function(){return Promise.reject()})};return b()},u}();function d(u,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(L({},u.headers))};return u.rangeEnd&&v.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),v}function o(u,C){return new self.Request(u.url,C)}var l=function(u){G(C,u);function C(v,g,k){var x;return x=u.call(this,v)||this,x.code=void 0,x.details=void 0,x.code=g,x.details=k,x}return C}(H(Error));Z.default=w},"./src/utils/imsc1-ttml-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"IMSC1_CODEC",function(){return y}),_.d(Z,"parseIMSC1",function(){return A});var Q=_("./src/utils/mp4-tools.ts"),U=_("./src/utils/vttparser.ts"),D=_("./src/utils/vttcue.ts"),G=_("./src/demux/id3.ts"),H=_("./src/utils/timescale-conversion.ts"),F=_("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(f){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var a in h)Object.prototype.hasOwnProperty.call(h,a)&&(f[a]=h[a])}return f},O.apply(this,arguments)}var y="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,I=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function A(f,p,h,a,b){var m=Object(Q.findBox)(new Uint8Array(f),["mdat"]);if(m.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],B=Object(G.utf8ArrayToStr)(new Uint8Array(f,E.start,E.end-E.start)),W=Object(H.toTimescaleFromScale)(p,1,h);try{a(w(B,W))}catch(K){b(K)}}function w(f,p){var h=new DOMParser,a=h.parseFromString(f,"text/xml"),b=a.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(M,P){return M[P]=b.getAttribute("ttp:"+P)||m[P],M},{}),B=b.getAttribute("xml:space")!=="preserve",W=o(d(b,"styling","style")),K=o(d(b,"layout","region")),V=d(b,"body","[begin]");return[].map.call(V,function(M){var P=l(M,B);if(!P||!M.hasAttribute("begin"))return null;var $=g(M.getAttribute("begin"),E),ae=g(M.getAttribute("dur"),E),he=g(M.getAttribute("end"),E);if($===null)throw v(M);if(he===null){if(ae===null)throw v(M);he=$+ae}var me=new D.default($-p,he-p,P);me.id=Object(F.generateCueId)(me.startTime,me.endTime,me.text);var De=K[M.getAttribute("region")],xe=W[M.getAttribute("style")];me.position=10,me.size=80;var ke=u(De,xe),Te=ke.textAlign;if(Te){var Se=L[Te];Se&&(me.lineAlign=Se),me.align=Te}return O(me,ke),me}).filter(function(M){return M!==null})}function d(f,p,h){var a=f.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(h)):[]}function o(f){return f.reduce(function(p,h){var a=h.getAttribute("xml:id");return a&&(p[a]=h),p},{})}function l(f,p){return[].slice.call(f.childNodes).reduce(function(h,a,b){var m;return a.nodeName==="br"&&b?h+`
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?l(a,p):p?h+a.textContent.trim().replace(/\s+/g," "):h+a.textContent},"")}function u(f,p){var h="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,m){var E=C(p,h,m)||C(f,h,m);return E&&(b[m]=E),b},{})}function C(f,p,h){return f.hasAttributeNS(p,h)?f.getAttributeNS(p,h):null}function v(f){return new Error("Could not parse ttml timestamp "+f)}function g(f,p){if(!f)return null;var h=Object(U.parseTimeStamp)(f);return h===null&&(T.test(f)?h=k(f,p):I.test(f)&&(h=x(f,p))),h}function k(f,p){var h=T.exec(f),a=(h[4]|0)+(h[5]|0)/p.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+a/p.frameRate}function x(f,p){var h=I.exec(f),a=Number(h[1]),b=h[2];switch(b){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/p.frameRate;case"t":return a/p.tickRate}return a}},"./src/utils/logger.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"enableLogs",function(){return F}),_.d(Z,"logger",function(){return O});var Q=function(){},U={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},D=U;function G(y){var T=self.console[y];return T?T.bind(self.console,"["+y+"] >"):Q}function H(y){for(var T=arguments.length,I=new Array(T>1?T-1:0),L=1;L<T;L++)I[L-1]=arguments[L];I.forEach(function(A){D[A]=y[A]?y[A].bind(y):G(A)})}function F(y){if(self.console&&y===!0||typeof y=="object"){H(y,"debug","log","info","warn","error");try{D.log()}catch(T){D=U}}else D=U}var O=D},"./src/utils/mediakeys-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"KeySystems",function(){return Q}),_.d(Z,"requestMediaKeySystemAccess",function(){return U});var Q;(function(D){D.WIDEVINE="com.widevine.alpha",D.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"bin2str",function(){return H}),_.d(Z,"readUint16",function(){return F}),_.d(Z,"readUint32",function(){return O}),_.d(Z,"writeUint32",function(){return y}),_.d(Z,"findBox",function(){return T}),_.d(Z,"parseSegmentIndex",function(){return I}),_.d(Z,"parseInitSegment",function(){return L}),_.d(Z,"getStartDTS",function(){return A}),_.d(Z,"getDuration",function(){return w}),_.d(Z,"computeRawDurationFromSamples",function(){return d}),_.d(Z,"offsetStartDTS",function(){return o}),_.d(Z,"segmentValidRange",function(){return l}),_.d(Z,"appendUint8Array",function(){return u});var Q=_("./src/utils/typed-array.ts"),U=_("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,G=[].push;function H(C){return String.fromCharCode.apply(null,C)}function F(C,v){"data"in C&&(v+=C.start,C=C.data);var g=C[v]<<8|C[v+1];return g<0?65536+g:g}function O(C,v){"data"in C&&(v+=C.start,C=C.data);var g=C[v]<<24|C[v+1]<<16|C[v+2]<<8|C[v+3];return g<0?4294967296+g:g}function y(C,v,g){"data"in C&&(v+=C.start,C=C.data),C[v]=g>>24,C[v+1]=g>>16&255,C[v+2]=g>>8&255,C[v+3]=g&255}function T(C,v){var g=[];if(!v.length)return g;var k,x,f;"data"in C?(k=C.data,x=C.start,f=C.end):(k=C,x=0,f=k.byteLength);for(var p=x;p<f;){var h=O(k,p),a=H(k.subarray(p+4,p+8)),b=h>1?p+h:f;if(a===v[0])if(v.length===1)g.push({data:k,start:p+8,end:b});else{var m=T({data:k,start:p+8,end:b},v.slice(1));m.length&&G.apply(g,m)}p=b}return g}function I(C){var v=T(C,["moov"]),g=v[0],k=g?g.end:null,x=T(C,["sidx"]);if(!x||!x[0])return null;var f=[],p=x[0],h=p.data[0],a=h===0?8:16,b=O(p,a);a+=4;var m=0,E=0;h===0?a+=8:a+=16,a+=2;var B=p.end+E,W=F(p,a);a+=2;for(var K=0;K<W;K++){var V=a,M=O(p,V);V+=4;var P=M&2147483647,$=(M&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ae=O(p,V);V+=4,f.push({referenceSize:P,subsegmentDuration:ae,info:{duration:ae/b,start:B,end:B+P-1}}),B+=P,V+=4,a=V}return{earliestPresentationTime:m,timescale:b,version:h,referencesCount:W,references:f,moovEndOffset:k}}function L(C){for(var v=[],g=T(C,["moov","trak"]),k=0;k<g.length;k++){var x=g[k],f=T(x,["tkhd"])[0];if(f){var p=f.data[f.start],h=p===0?12:20,a=O(f,h),b=T(x,["mdia","mdhd"])[0];if(b){p=b.data[b.start],h=p===0?12:20;var m=O(b,h),E=T(x,["mdia","hdlr"])[0];if(E){var B=H(E.data.subarray(E.start+8,E.start+12)),W={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[B];if(W){var K=T(x,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=H(K.data.subarray(K.start+12,K.start+16))),v[a]={timescale:m,type:W},v[W]={timescale:m,id:a,codec:V}}}}}}var M=T(C,["moov","mvex","trex"]);return M.forEach(function(P){var $=O(P,4),ae=v[$];ae&&(ae.default={duration:O(P,12),flags:O(P,20)})}),v}function A(C,v){return T(v,["moof","traf"]).reduce(function(g,k){var x=T(k,["tfdt"])[0],f=x.data[x.start],p=T(k,["tfhd"]).reduce(function(h,a){var b=O(a,4),m=C[b];if(m){var E=O(x,4);f===1&&(E*=Math.pow(2,32),E+=O(x,8));var B=m.timescale||9e4,W=E/B;if(isFinite(W)&&(h===null||W<h))return W}return h},null);return p!==null&&isFinite(p)&&(g===null||p<g)?p:g},null)||0}function w(C,v){for(var g=0,k=0,x=0,f=T(C,["moof","traf"]),p=0;p<f.length;p++){var h=f[p],a=T(h,["tfhd"])[0],b=O(a,4),m=v[b];if(!m)continue;var E=m.default,B=O(a,0)|(E==null?void 0:E.flags),W=E==null?void 0:E.duration;B&8&&(B&2?W=O(a,12):W=O(a,8));for(var K=m.timescale||9e4,V=T(h,["trun"]),M=0;M<V.length;M++){if(W){var P=O(V[M],4);g=W*P}else g=d(V[M]);m.type===U.ElementaryStreamTypes.VIDEO?k+=g/K:m.type===U.ElementaryStreamTypes.AUDIO&&(x+=g/K)}}if(k===0&&x===0){var $=I(C);if($!=null&&$.references)return $.references.reduce(function(ae,he){return ae+he.info.duration||0},0)}return k||x}function d(C){var v=O(C,0),g=8;v&1&&(g+=4),v&4&&(g+=4);for(var k=0,x=O(C,4),f=0;f<x;f++){if(v&256){var p=O(C,g);k+=p,g+=4}v&512&&(g+=4),v&1024&&(g+=4),v&2048&&(g+=4)}return k}function o(C,v,g){T(v,["moof","traf"]).forEach(function(k){T(k,["tfhd"]).forEach(function(x){var f=O(x,4),p=C[f];if(!p)return;var h=p.timescale||9e4;T(k,["tfdt"]).forEach(function(a){var b=a.data[a.start],m=O(a,4);if(b===0)y(a,4,m-g*h);else{m*=Math.pow(2,32),m+=O(a,8),m-=g*h,m=Math.max(m,0);var E=Math.floor(m/(D+1)),B=Math.floor(m%(D+1));y(a,4,E),y(a,8,B)}})})})}function l(C){var v={valid:null,remainder:null},g=T(C,["moof"]);if(g){if(g.length<2)return v.remainder=C,v}else return v;var k=g[g.length-1];return v.valid=Object(Q.sliceUint8)(C,0,k.start-8),v.remainder=Object(Q.sliceUint8)(C,k.start-8),v}function u(C,v){var g=new Uint8Array(C.length+v.length);return g.set(C),g.set(v,C.length),g}},"./src/utils/output-filter.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return Q});var Q=function(){function U(G,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=H}var D=U.prototype;return D.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},D.newCue=function(H,F,O){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=F,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"sendAddTrackEvent",function(){return U}),_.d(Z,"addCueToTrack",function(){return D}),_.d(Z,"clearCurrentCues",function(){return G}),_.d(Z,"removeCuesInRange",function(){return H}),_.d(Z,"getCuesInRange",function(){return O});var Q=_("./src/utils/logger.ts");function U(y,T){var I;try{I=new Event("addtrack")}catch(L){I=document.createEvent("Event"),I.initEvent("addtrack",!1,!1)}I.track=y,T.dispatchEvent(I)}function D(y,T){var I=y.mode;if(I==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(T.id))try{if(y.addCue(T),!y.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(A){Q.logger.debug("[texttrack-utils]: "+A);var L=new self.TextTrackCue(T.startTime,T.endTime,T.text);L.id=T.id,y.addCue(L)}I==="disabled"&&(y.mode=I)}function G(y){var T=y.mode;if(T==="disabled"&&(y.mode="hidden"),y.cues)for(var I=y.cues.length;I--;)y.removeCue(y.cues[I]);T==="disabled"&&(y.mode=T)}function H(y,T,I){var L=y.mode;if(L==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var A=O(y.cues,T,I),w=0;w<A.length;w++)y.removeCue(A[w]);L==="disabled"&&(y.mode=L)}function F(y,T){if(T<y[0].startTime)return 0;var I=y.length-1;if(T>y[I].endTime)return-1;for(var L=0,A=I;L<=A;){var w=Math.floor((A+L)/2);if(T<y[w].startTime)A=w-1;else if(T>y[w].startTime&&L<I)L=w+1;else return w}return y[L].startTime-T<T-y[A].startTime?L:A}function O(y,T,I){var L=[],A=F(y,T);if(A>-1)for(var w=A,d=y.length;w<d;w++){var o=y[w];if(o.startTime>=T&&o.endTime<=I)L.push(o);else if(o.startTime>I)return L}return L}},"./src/utils/time-ranges.ts":function(fe,Z,_){"use strict";_.r(Z);var Q={toString:function(D){for(var G="",H=D.length,F=0;F<H;F++)G+="["+D.start(F).toFixed(3)+","+D.end(F).toFixed(3)+"]";return G}};Z.default=Q},"./src/utils/timescale-conversion.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"toTimescaleFromBase",function(){return U}),_.d(Z,"toTimescaleFromScale",function(){return D}),_.d(Z,"toMsFromMpegTsClock",function(){return G}),_.d(Z,"toMpegTsClockFromTimescale",function(){return H});var Q=9e4;function U(F,O,y,T){y===void 0&&(y=1),T===void 0&&(T=!1);var I=F*O*y;return T?Math.round(I):I}function D(F,O,y,T){return y===void 0&&(y=1),T===void 0&&(T=!1),U(F,O,1/y,T)}function G(F,O){return O===void 0&&(O=!1),U(F,1e3,1/Q,O)}function H(F,O){return O===void 0&&(O=1),U(F,Q,1/O)}},"./src/utils/typed-array.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"sliceUint8",function(){return Q});function Q(U,D,G){return Uint8Array.prototype.slice?U.slice(D,G):new Uint8Array(Array.prototype.slice.call(U,D,G))}},"./src/utils/vttcue.ts":function(fe,Z,_){"use strict";_.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],U=["start","middle","end","left","right"];function D(y,T){if(typeof T!="string")return!1;if(!Array.isArray(y))return!1;var I=T.toLowerCase();return~y.indexOf(I)?I:!1}function G(y){return D(Q,y)}function H(y){return D(U,y)}function F(y){for(var T=arguments.length,I=new Array(T>1?T-1:0),L=1;L<T;L++)I[L-1]=arguments[L];for(var A=1;A<arguments.length;A++){var w=arguments[A];for(var d in w)y[d]=w[d]}return y}function O(y,T,I){var L=this,A={enumerable:!0};L.hasBeenReset=!1;var w="",d=!1,o=y,l=T,u=I,C=null,v="",g=!0,k="auto",x="start",f=50,p="middle",h=50,a="middle";Object.defineProperty(L,"id",F({},A,{get:function(){return w},set:function(m){w=""+m}})),Object.defineProperty(L,"pauseOnExit",F({},A,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(L,"startTime",F({},A,{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(L,"endTime",F({},A,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",F({},A,{get:function(){return u},set:function(m){u=""+m,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",F({},A,{get:function(){return C},set:function(m){C=m,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",F({},A,{get:function(){return v},set:function(m){var E=G(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=E,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",F({},A,{get:function(){return g},set:function(m){g=!!m,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",F({},A,{get:function(){return k},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=m,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",F({},A,{get:function(){return x},set:function(m){var E=H(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");x=E,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",F({},A,{get:function(){return f},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");f=m,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",F({},A,{get:function(){return p},set:function(m){var E=H(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",F({},A,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",F({},A,{get:function(){return a},set:function(m){var E=H(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),L.displayState=void 0}return O.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"parseTimeStamp",function(){return D}),_.d(Z,"fixLineBreaks",function(){return T}),_.d(Z,"VTTParser",function(){return I});var Q=_("./src/utils/vttcue.ts"),U=function(){function L(){}var A=L.prototype;return A.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},L}();function D(L){function A(d,o,l,u){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var w=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return w?parseFloat(w[2])>59?A(w[2],w[3],0,w[4]):A(w[1],w[2],w[3],w[4]):null}var G=function(){function L(){this.values=Object.create(null)}var A=L.prototype;return A.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},A.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},A.has=function(d){return d in this.values},A.alt=function(d,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(d,o);break}},A.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},A.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},L}();function H(L,A,w,d){var o=d?L.split(d):[L];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(w);if(u.length!==2)continue;var C=u[0],v=u[1];A(C,v)}}var F=new Q.default(0,0,""),O=F.align==="middle"?"middle":"center";function y(L,A,w){var d=L;function o(){var C=D(L);if(C===null)throw new Error("Malformed timestamp: "+d);return L=L.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,v){var g=new G;H(C,function(f,p){var h;switch(f){case"region":for(var a=w.length-1;a>=0;a--)if(w[a].id===p){g.set(f,w[a].region);break}break;case"vertical":g.alt(f,p,["rl","lr"]);break;case"line":h=p.split(","),g.integer(f,h[0]),g.percent(f,h[0])&&g.set("snapToLines",!1),g.alt(f,h[0],["auto"]),h.length===2&&g.alt("lineAlign",h[1],["start",O,"end"]);break;case"position":h=p.split(","),g.percent(f,h[0]),h.length===2&&g.alt("positionAlign",h[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":g.percent(f,p);break;case"align":g.alt(f,p,["start",O,"end","left","right"]);break}},/:/,/\s/),v.region=g.get("region",null),v.vertical=g.get("vertical","");var k=g.get("line","auto");k==="auto"&&F.line===-1&&(k=-1),v.line=k,v.lineAlign=g.get("lineAlign","start"),v.snapToLines=g.get("snapToLines",!0),v.size=g.get("size",100),v.align=g.get("align",O);var x=g.get("position","auto");x==="auto"&&F.position===50&&(x=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=x}function u(){L=L.replace(/^\s+/,"")}if(u(),A.startTime=o(),u(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);L=L.substr(3),u(),A.endTime=o(),u(),l(L,A)}function T(L){return L.replace(/<br(?: \/)?>/gi,`
`)}var I=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=L.prototype;return A.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var x=o.buffer,f=0;for(x=T(x);f<x.length&&x[f]!=="\r"&&x[f]!==`
`;)++f;var p=x.substr(0,f);return x[f]==="\r"&&++f,x[f]===`
`&&++f,o.buffer=x.substr(f),p}function u(x){H(x,function(f,p){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=l();var v=C.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var g=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;g?g=!1:C=l();switch(o.state){case"HEADER":/:/.test(C)?u(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new Q.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(C,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var k=C.indexOf("-->")!==-1;if(!C||k&&(g=!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+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"generateCueId",function(){return I}),_.d(Z,"parseWebVTT",function(){return A});var Q=_("./src/polyfills/number.ts"),U=_("./src/utils/vttparser.ts"),D=_("./src/demux/id3.ts"),G=_("./src/utils/timescale-conversion.ts"),H=_("./src/remux/mp4-remuxer.ts"),F=/\r\n|\n\r|\n|\r/g,O=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),C=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(l)||!Object(Q.isFiniteNumber)(u)||!Object(Q.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*C,o},T=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function I(w,d,o){return T(w.toString())+T(d.toString())+T(o)}var L=function(d,o,l){var u=d[o],C=d[u.prevCC];if(!C||!C.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;d.ccOffset+=u.start-C.start,u.new=!1,u=C,C=d[u.prevCC]}d.presentationOffset=l};function A(w,d,o,l,u,C,v,g){var k=new U.VTTParser,x=Object(D.utf8ArrayToStr)(new Uint8Array(w)).trim().replace(F,`
`).split(`
`),f=[],p=Object(G.toMpegTsClockFromTimescale)(d,o),h="00:00.000",a=0,b=0,m,E=!0,B=!1;k.oncue=function(W){var K=l[u],V=l.ccOffset,M=(a-p)/9e4;if(K!=null&&K.new&&(b!==void 0?V=l.ccOffset=K.start:L(l,u,M)),M&&(V=M-l.presentationOffset),B){var P=W.endTime-W.startTime,$=Object(H.normalizePts)((W.startTime+V-b)*9e4,C*9e4)/9e4;W.startTime=$,W.endTime=$+P}var ae=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ae)),W.id||(W.id=I(W.startTime,W.endTime,ae)),W.endTime>0&&f.push(W)},k.onparsingerror=function(W){m=W},k.onflush=function(){if(m){g(m);return}v(f)},x.forEach(function(W){if(E)if(O(W,"X-TIMESTAMP-MAP=")){E=!1,B=!0,W.substr(16).split(",").forEach(function(K){O(K,"LOCAL:")?h=K.substr(6):O(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{b=y(h)/1e3}catch(K){B=!1,m=K}return}else W===""&&(E=!1);k.parse(W+`
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(fe,Z,_){"use strict";_.r(Z);var Q=_("./src/utils/logger.ts"),U=_("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,G=function(){function H(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 U.LoadStats,this.retryDelay=0}var F=H.prototype;return F.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},F.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()))},F.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},F.load=function(y,T,I){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=T,this.callbacks=I,this.retryDelay=T.retryDelay,this.loadInternal()},F.loadInternal=function(){var y=this.config,T=this.context;if(!y)return;var I=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var A=this.xhrSetup;try{if(A)try{A(I,T.url)}catch(o){I.open("GET",T.url,!0),A(I,T.url)}I.readyState||I.open("GET",T.url,!0);var w=this.context.headers;if(w)for(var d in w)I.setRequestHeader(d,w[d])}catch(o){this.callbacks.onError({code:I.status,text:o.message},T,I);return}T.rangeEnd&&I.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),I.onreadystatechange=this.readystatechange.bind(this),I.onprogress=this.loadprogress.bind(this),I.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),I.send()},F.readystatechange=function(){var y=this.context,T=this.loader,I=this.stats;if(!y||!T)return;var L=T.readyState,A=this.config;if(I.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),I.loading.first===0&&(I.loading.first=Math.max(self.performance.now(),I.loading.start)),L===4){T.onreadystatechange=null,T.onprogress=null;var w=T.status;if(w>=200&&w<300){I.loading.end=Math.max(self.performance.now(),I.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=T.response,o=d.byteLength):(d=T.responseText,o=d.length),I.loaded=I.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(I,y,d,T),!this.callbacks)return;var u={url:T.responseURL,data:d};this.callbacks.onSuccess(u,I,y,T)}else I.retry>=A.maxRetry||w>=400&&w<499?(Q.logger.error(w+" while loading "+y.url),this.callbacks.onError({code:w,text:T.statusText},y,T)):(Q.logger.warn(w+" 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,A.maxRetryDelay),I.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},F.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},F.loadprogress=function(y){var T=this.stats;T.loaded=y.loaded,y.lengthComputable&&(T.total=y.total)},F.getCacheAge=function(){var y=null;if(this.loader&&D.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");y=T?parseFloat(T):null}return y},H}();Z.default=G}}).default})},vHTk:function(ft,it,pe){ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);