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.
366 lines
929 KiB
366 lines
929 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[185,6,7,9,12],{"+NIl":function(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){"use strict";de.defineMode("stex",function(Z,O){"use strict";function Q(k,A){k.cmdState.push(A)}function U(k){return k.cmdState.length>0?k.cmdState[k.cmdState.length-1]:null}function D(k){var A=k.cmdState.pop();A&&A.closeBracket()}function G(k){for(var A=k.cmdState,C=A.length-1;C>=0;C--){var h=A[C];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function H(k,A,C){return function(){this.name=k,this.bracketNo=0,this.style=A,this.styles=C,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var B={};B.importmodule=H("importmodule","tag",["string","builtin"]),B.documentclass=H("documentclass","tag",["","atom"]),B.usepackage=H("usepackage","tag",["atom"]),B.begin=H("begin","tag",["atom"]),B.end=H("end","tag",["atom"]),B.label=H("label","tag",["atom"]),B.ref=H("ref","tag",["atom"]),B.eqref=H("eqref","tag",["atom"]),B.cite=H("cite","tag",["atom"]),B.bibitem=H("bibitem","tag",["atom"]),B.Bibitem=H("Bibitem","tag",["atom"]),B.RBibitem=H("RBibitem","tag",["atom"]),B.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(k,A){k.f=A}function y(k,A){var C;if(k.match(/^\\[a-zA-Z@]+/)){var h=k.current().slice(1);return C=B.hasOwnProperty(h)?B[h]:B.DEFAULT,C=new C,Q(A,C),_(A,I),C.style}if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/\\]/))return"tag";if(k.match("\\["))return _(A,function(l,u){return T(l,u,"\\]")}),"keyword";if(k.match("\\("))return _(A,function(l,u){return T(l,u,"\\)")}),"keyword";if(k.match("$$"))return _(A,function(l,u){return T(l,u,"$$")}),"keyword";if(k.match("$"))return _(A,function(l,u){return T(l,u,"$")}),"keyword";var o=k.next();if(o=="%")return k.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=U(A),C)C.closeBracket(o),_(A,I);else return"error";return"bracket"}else return o=="{"||o=="["?(C=B.DEFAULT,C=new C,Q(A,C),"bracket"):/\d/.test(o)?(k.eatWhile(/[\w.%]/),"atom"):(k.eatWhile(/[\w\-_]/),C=G(A),C.name=="begin"&&(C.argument=k.current()),C.styleIdentifier())}function T(k,A,C){if(k.eatSpace())return null;if(C&&k.match(C))return _(A,y),"keyword";if(k.match(/^\\[a-zA-Z@]+/))return"tag";if(k.match(/^[a-zA-Z]+/))return"variable-2";if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/]/))return"tag";if(k.match(/^[\^_&]/))return"tag";if(k.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(k.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=k.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(k.skipToEnd(),"comment"):"error"}function I(k,A){var C=k.peek(),h;return C=="{"||C=="["?(h=U(A),h.openBracket(C),k.eat(C),_(A,y),"bracket"):/[ \t\r]/.test(C)?(k.eat(C),null):(_(A,y),D(A),y(k,A))}return{startState:function(){var k=O.inMathMode?function(A,C){return T(A,C)}:y;return{cmdState:[],f:k}},copyState:function(k){return{cmdState:k.cmdState.slice(),f:k.f}},token:function(k,A){return A.f(k,A)},blankLine:function(k){k.f=y,k.cmdState.length=0},lineComment:"%"}}),de.defineMIME("text/x-stex","stex"),de.defineMIME("text/x-latex","stex")})},"19Vz":function(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){de.defineOption("placeholder","",function(H,B,_){var y=_&&_!=de.Init;if(B&&!y)H.on("blur",U),H.on("change",D),H.on("swapDoc",D),de.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){Q(H)}),D(H);else if(!B&&y){H.off("blur",U),H.off("change",D),H.off("swapDoc",D),de.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var T=H.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}B&&!H.hasFocus()&&U(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function O(H){Z(H);var B=H.state.placeholder=document.createElement("pre");B.style.cssText="height: 0; overflow: visible",B.style.direction=H.getOption("direction"),B.className="CodeMirror-placeholder CodeMirror-line-like";var _=H.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),B.appendChild(_),H.display.lineSpace.insertBefore(B,H.display.lineSpace.firstChild)}function Q(H){setTimeout(function(){var B=!1,_=H.getInputField();_.nodeName=="TEXTAREA"?B=!_.value:H.lineCount()==1&&(B=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),B?O(H):Z(H)},20)}function U(H){G(H)&&O(H)}function D(H){var B=H.getWrapperElement(),_=G(H);B.className=B.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?O(H):Z(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){"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},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};de.defineMode("xml",function(Q,U){var D=Q.indentUnit,G={},H=U.htmlMode?Z:O;for(var B in H)G[B]=H[B];for(var B in U)G[B]=U[B];var _,y;function T(a,b){function m(j){return b.tokenize=j,j(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(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=A("meta","?>"),"meta"):(_=a.eat("/")?"closeTag":"openTag",b.tokenize=I,"tag bracket");if(E=="&"){var F;return a.eat("#")?a.eat("x")?F=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):F=a.eatWhile(/[\d]/)&&a.eat(";"):F=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),F?"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,_=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return _="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=k(m),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function k(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 C(a){return function(b,m){for(var E;(E=b.next())!=null;){if(E=="<")return m.tokenize=C(a+1),m.tokenize(b,m);if(E==">")if(a==1){m.tokenize=T;break}else return m.tokenize=C(a-1),m.tokenize(b,m)}return"meta"}}function h(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(),w):a=="closeTag"?v:u}function w(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",w)}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",L)}else return G.allowMissingTagName&&a=="endTag"?(y="tag bracket",g(a,b,m)):(y="error",L)}function g(a,b,m){return a!="endTag"?(y="error",g):(o(m),u)}function L(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,F=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(E)?l(m,E):(l(m,E),m.context=new h(m,E,F==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"?d:a=="word"&&G.allowUnquoted?(y="string",x):(y="error",x(a,b,m))}function d(a,b,m){return a=="string"?d: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;_=null;var m=b.tokenize(a,b);return(m||_)&&m!="comment"&&(y=null,b.state=b.state(_||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 de.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 F=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(F&&F[1])for(;E;)if(E.tagName==F[2]){E=E.prev;break}else if(G.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(F)for(;E;){var j=G.contextGrabbers[E.tagName];if(j&&j.hasOwnProperty(F[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()}}}),de.defineMIME("text/xml","xml"),de.defineMIME("application/xml","xml"),de.mimeModes.hasOwnProperty("text/html")||de.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(ht,et,pe){"use strict";var de=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 O(){if(!de)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return de(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 B(I){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(G[I[k+0]]+G[I[k+1]]+G[I[k+2]]+G[I[k+3]]+"-"+G[I[k+4]]+G[I[k+5]]+"-"+G[I[k+6]]+G[I[k+7]]+"-"+G[I[k+8]]+G[I[k+9]]+"-"+G[I[k+10]]+G[I[k+11]]+G[I[k+12]]+G[I[k+13]]+G[I[k+14]]+G[I[k+15]]).toLowerCase();if(!D(A))throw TypeError("Stringified UUID is invalid");return A}var _=B;function y(I,k,A){I=I||{};var C=I.random||(I.rng||O)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,k){A=A||0;for(var h=0;h<16;++h)k[A+h]=C[h];return k}return _(C)}var T=et.a=y},"7ahc":function(ht,et,pe){"use strict";pe.d(et,"a",function(){return w});var de=pe("k1fw"),Z=pe("0Owb"),O=pe("+L6B"),Q=pe("2/Rp"),U=pe("y8nQ"),D=pe("Vl3Y"),G=pe("tJVT"),H=pe("OaEy"),B=pe("2fM7"),_=pe("q1tI"),y=pe.n(_),T=pe("VrN/"),I=pe.n(T),k=pe("p77/"),A=pe.n(k),C=pe("c5Ni"),h=pe.n(C),o=B.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"]};et.b=function(v){var g=v.callback,L=v.onCancel,x=Object(_.useState)("python"),f=Object(G.a)(x,2),p=f[0],d=f[1];function a(m){d(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(B.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(w,{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:L},"\u53D6\u6D88")))};function w(v){var g=v.value,L=v.onChange,x=v.mode,f=v.options,p=f===void 0?{}:f,d=Object(_.useRef)(),a=Object(_.useState)(),b=Object(G.a)(a,2),m=b[0],E=b[1];return Object(_.useEffect)(function(){if(m){function F(j){var K=j.getValue();L&&L(K)}return m.on("change",F),function(){m.off("change",F)}}},[m,L]),Object(_.useEffect)(function(){m&&m.setOption("mode",x)},[m,x]),Object(_.useEffect)(function(){m&&((g!==m.getValue()||g==="")&&setTimeout(function(){m.setValue(g||" ")},300))},[m,g]),Object(_.useEffect)(function(){if(d.current&&!m){var F=I.a.fromTextArea(d.current,Object(de.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));E(F)}},[d.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:d}))}},"7ixt":function(ht,et,pe){"use strict";pe.d(et,"a",function(){return O});var de={adjustX:1,adjustY:1},Z=[0,0],O={left:{points:["cr","cl"],overflow:de,offset:[-4,0],targetOffset:Z},right:{points:["cl","cr"],overflow:de,offset:[4,0],targetOffset:Z},top:{points:["bc","tc"],overflow:de,offset:[0,-4],targetOffset:Z},bottom:{points:["tc","bc"],overflow:de,offset:[0,4],targetOffset:Z},topLeft:{points:["bl","tl"],overflow:de,offset:[0,-4],targetOffset:Z},leftTop:{points:["tr","tl"],overflow:de,offset:[-4,0],targetOffset:Z},topRight:{points:["br","tr"],overflow:de,offset:[0,-4],targetOffset:Z},rightTop:{points:["tl","tr"],overflow:de,offset:[4,0],targetOffset:Z},bottomRight:{points:["tr","br"],overflow:de,offset:[0,4],targetOffset:Z},rightBottom:{points:["bl","br"],overflow:de,offset:[4,0],targetOffset:Z},bottomLeft:{points:["tl","bl"],overflow:de,offset:[0,4],targetOffset:Z},leftBottom:{points:["br","bl"],overflow:de,offset:[-4,0],targetOffset:Z}},Q=O},"8EBN":function(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){"use strict";de.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<de.modeInfo.length;Z++){var O=de.modeInfo[Z];O.mimes&&(O.mime=O.mimes[0])}de.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var U=0;U<de.modeInfo.length;U++){var D=de.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 de.findModeByMIME("application/xml");if(/\+json$/.test(Q))return de.findModeByMIME("application/json")},de.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var U=0;U<de.modeInfo.length;U++){var D=de.modeInfo[U];if(D.ext){for(var G=0;G<D.ext.length;G++)if(D.ext[G]==Q)return D}}},de.findModeByFileName=function(Q){for(var U=0;U<de.modeInfo.length;U++){var D=de.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 de.findModeByExtension(H)},de.findModeByName=function(Q){Q=Q.toLowerCase();for(var U=0;U<de.modeInfo.length;U++){var D=de.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(ht,et,pe){ht.exports={button:"button___1wy9m"}},"9Bee":function(ht,et,pe){"use strict";var de=pe("DYRE"),Z=pe("zeV3"),O=pe("+L6B"),Q=pe("2/Rp"),U=pe("k1fw"),D=pe("9og8"),G=pe("tJVT"),H=pe("WmNS"),B=pe.n(H),_=pe("q1tI"),y=pe.n(_),T=pe("vg9a"),I=pe("DlQD"),k=pe.n(I),A=pe("rUJ1");function C(oe,q){var ee=oe.match(/^(\s+)(?:```)/);if(ee===null)return q;var ae=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>=ae.length?le.slice(ae.length):le}).join(`
|
|
`)}var h=[],o=["<ul>"],l=new k.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){h.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(oe,q,ee,ae){if(q>=oe.length||oe[q].level<=ee)return q;var le=oe[q];ae.push("<li><a href='#"+le.anchor+"'>"+le.text+"</a>"),q++;var te=[];return q=g(oe,q,le.level,te),te.length>0&&(ae.push("<ul>"),te.forEach(function(ie){ae.push(ie)}),ae.push("</ul>")),ae.push("</li>"),q=g(oe,q,ee,ae),q}function L(){return g(h,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 ae=ee[0],le=C(ae,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ie=d(),ue=le;le=ie,a[ie]={type:"block",expression:ue}}return{type:"code",raw:ae,lang:te,text:le}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,d=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 ae=d();return a[ae]={type:"inline",expression:ee},ae}),oe}var F=l.listitem;l.listitem=function(oe){return F(E(oe))};var j=l.paragraph;l.paragraph=function(oe){return j(E(oe))};var K=l.tablecell;l.tablecell=function(oe,q){return K(E(oe),q)},l.code=function(oe,q,ee){var ae=(q||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=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 ae=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:ae,level:q,text:oe}),"<h"+q+' id="'+ae+'">'+oe+"</h"+q+">"},k.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),k.a.use({tokenizer:x,renderer:l});var V=k.a,M=pe("SJMd"),P=pe("ulZh"),$=pe.n(P),ne=pe("m3rI"),he=pe("Oy/b"),me=pe("p5ED"),ke=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 Le=function(oe,q){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ae){ee.__proto__=ae}||function(ee,ae){for(var le in ae)Object.prototype.hasOwnProperty.call(ae,le)&&(ee[le]=ae[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}Le(oe,q),oe.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function Se(oe,q,ee,ae){return new(ee||(ee=Promise))(function(le,te){function ie(ve){try{ce(ae.next(ve))}catch(Ee){te(Ee)}}function ue(ve){try{ce(ae.throw(ve))}catch(Ee){te(Ee)}}function ce(ve){var Ee;ve.done?le(ve.value):(Ee=ve.value,Ee instanceof ee?Ee:new ee(function(Me){Me(Ee)})).then(ie,ue)}ce((ae=ae.apply(oe,q||[])).next())})}function ye(oe,q){var ee,ae,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(ce){return function(ve){return function(Ee){if(ee)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ee=1,ae&&(le=2&Ee[0]?ae.return:Ee[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ee[1])).done)return le;switch(ae=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++,ae=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],ae=0}finally{ee=le=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([ce,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 ae=0,le=ee;ae<le.length;ae++){var te=le[ae],ie=te[0],ue=te[1];q.setAttribute(ie,ue)}},oe.createRect=function(q,ee,ae){var le=document.createElementNS("http://www.w3.org/2000/svg","rect");return le.setAttribute("width",q.toString()),le.setAttribute("height",ee.toString()),ae&&oe.setAttributes(le,ae),le},oe.createLine=function(q,ee,ae,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",ae.toString()),ie.setAttribute("y2",le.toString()),te&&oe.setAttributes(ie,te),ie},oe.createPolygon=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",q),ee&&oe.setAttributes(ae,ee),ae},oe.createCircle=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(q/2).toString()),ae.setAttribute("cy",(q/2).toString()),ae.setAttribute("r",q.toString()),ee&&oe.setAttributes(ae,ee),ae},oe.createEllipse=function(q,ee,ae){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()),ae&&oe.setAttributes(le,ae),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,ae,le,te,ie,ue){var ce=document.createElementNS("http://www.w3.org/2000/svg","marker");return oe.setAttributes(ce,[["id",q],["orient",ee],["markerWidth",ae.toString()],["markerHeight",le.toString()],["refX",te.toString()],["refY",ie.toString()]]),ce.appendChild(ue),ce},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 ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=q,ee&&oe.setAttributes(ae,ee),ae},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 ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=q,ae.y=ee,ae},oe.createPath=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",q),ee&&oe.setAttributes(ae,ee),ae},oe.createElement=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg",q);return ee&&oe.setAttributes(ae,ee),ae},oe.getHollowRectanglePath=function(q,ee,ae,le,te,ie,ue,ce){return"M"+q+","+ee+"V"+(ee+le)+"H"+(q+ae)+"V"+ee+"H"+te+"V"+ie+"H"+(te+ue)+"V"+(ie+ce)+"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(ae){return ee.appendChild(ae.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(ae){return ee.appendChild(ae)}),ee},q}(se),De=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 ae=new De(q,ee),le=ae.ratio>=1?20:ae.getHorizontalLength(20),te=ae.ratio<1?20:ae.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 ce=s.createElement("clipPath",[["id","text-bg-clip"]]);ue.appendChild(ce);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 ce.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,ae,le){var te=oe.call(this,ee,ae)||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(ae){ae.className=ee.className,ae.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ae.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(ae){return s.setAttributes(ae,[["cx",q.toString()],["cy",ee.toString()]])})},oe}(),Ge=function(){function oe(q,ee,ae,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=ae,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(ae){return q.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return q.gridContainer.appendChild(ae)}),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 ae=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ie){var ue=ee.y+ae*(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 ae=this.container.getBoundingClientRect();return{x:q-ae.left+this.margin,y:ee-ae.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,ae=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ae=-ae/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+ae),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),ae=q.x-this.previousPoint.x,le=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+ae<this.margin&&(ae=this.margin-ee.x),ee.x+=ae,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ae}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(ae),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,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<le/this.canvasHeight?this.cropRect.width=ae: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,ae,le,te,ie){var ue=ae/q,ce=le/ee;return{x:(te.x-ie)*ue+ie,y:(te.y-ie)*ce+ie,width:te.width*ue,height:te.height*ce}},oe.prototype.scaleCanvas=function(q,ee){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},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,ae=1;ae<=this.width/5+10;ae++){var le=ae%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="°",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,ae,le,te,ie,ue){var ce=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;ce.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):ce.width!==void 0&&ce.height!==void 0&&(Me=ce.width/ae.width,Be=ce.height/ae.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=ae.width*Me,We.height=ae.height*Be,We.getContext("2d").putImageData(Ye.getImageData((ae.x-le)*Me,(ae.y-le)*Be,ae.width*Me,ae.height*Be),0,0),ve(We.toDataURL(ce.imageType,ce.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,ae=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,ae)}},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 ae=[];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)},ae.push(Ye)}),this.aspectRatioButton=new Pe(_e.getIcon(0,0),"Aspect ratio",ae),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 ce=document.createElement("a");ce.style.color="currentColor",ce.href="https://markerjs.com/products/cropro",ce.target="_blank",ce.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(ce),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 ae=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");ae.onClick=this.rotateLeftButtonClicked,ee.addButton(ae);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 ce=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");ce.onClick=this.flipVerticallyButtonClicked,ie.addButton(ce)},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 De(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 ae=this.cropImage.getBoundingClientRect();return{x:q-ae.left,y:ee-ae.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 ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.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(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return q=ae.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 it(oe){var q=document.createElement("div");return q.innerHTML=oe,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var qe=et.a=function(oe){var q=oe.value,ee=q===void 0?"":q,ae=oe.edit,le=ae===void 0?!1:ae,te=oe.className,ie=oe.showTextOnly,ue=oe.showLines,ce=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(_.useRef)(),rt=Object(_.useRef)(),Tt=Object(_.useState)(""),bt=Object(G.a)(Tt,2),xt=bt[0],Lt=bt[1],Et=Object(_.useState)("office"),qt=Object(G.a)(Et,2),Tr=qt[0],Yt=qt[1],gr=function(){var wt=new ot(rt.current);wt.displayMode="popup",wt.addRenderEventListener(function(){var Zt=Object(D.a)(B.a.mark(function gt(mt){var kt;return B.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return nt.current.style.display="none",Ut.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mt}});case 3:kt=Ut.sent,kt!=null&&kt.id&&ce(rt.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(kt==null?void 0:kt.id,"?type=").concat(kt.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(rt.current);wt.settings.displayMode="popup",wt.addEventListener("render",function(){var Zt=Object(D.a)(B.a.mark(function gt(mt){var kt;return B.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(nt.current.style.display="none",!rt.current){Ut.next=6;break}return Ut.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mt.dataUrl}});case 4:kt=Ut.sent,kt!=null&&kt.id&&ce(rt.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(kt==null?void 0:kt.id,"?type=").concat(kt.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(_.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,"("+ne.a.API_SERVER+"/api/attachments/").replace(wt,'"'+ne.a.API_SERVER+"/api/attachments/").replace(Zt,'"'+ne.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>",L()),w()),gt=gt.replace(/(__special_katext_id_\d+__)/g,function(vr,Ut){var Fe=mt[Ut],dt=Fe.type,ri=Fe.expression;return Object(he.renderToString)(it(ri)||"",{displayMode:dt==="block",throwOnError:!1,output:"html"})}),gt=gt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ie){var kt=document.createElement("div");return kt.innerHTML=gt,kt.innerText}return setTimeout(function(){return ti()},500),gt},[pt]),$t=Object(_.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");Lt(Zt),Yt("image")}}else if(wt.tagName.toUpperCase()==="A"){var gt=wt.getAttribute("href");if(gt.indexOf("office")>-1)Ze.preventDefault(),Lt(gt),Yt("office");else if(gt.indexOf("application/pdf")>-1)Ze.preventDefault(),Lt(gt),Yt("pdf");else if(gt.indexOf("text/html")>-1)Ze.preventDefault(),Lt(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(_.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(),w()}},[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",rt.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:rt,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 Lt("")}}))}},"9VGf":function(ht,et,pe){"use strict";pe.d(et,"a",function(){return O});var de=pe("q1tI"),Z=pe.n(de);function O(Q,U){var D=Object(de.useRef)();Object(de.useEffect)(function(){D.current=Q}),Object(de.useEffect)(function(){function G(){D.current()}if(U!==null){var H=setInterval(G,U);return function(){return clearInterval(H)}}},[U])}},"9ivq":function(ht,et,pe){},Bd2K:function(ht,et,pe){(function(de){de(pe("VrN/"),pe("osHv"))})(function(de){de.defineOption("autoCloseTags",!1,function(B,_,y){if(y!=de.Init&&y&&B.removeKeyMap("autoCloseTags"),!_)return;var T={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(T["'/'"]=function(I){return D(I)}),(typeof _!="object"||_.whenOpening!==!1)&&(T["'>'"]=function(I){return Q(I)}),B.addKeyMap(T)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Q(B){if(B.getOption("disableInput"))return de.Pass;for(var _=B.listSelections(),y=[],T=B.getOption("autoCloseTags"),I=0;I<_.length;I++){if(!_[I].empty())return de.Pass;var k=_[I].head,A=B.getTokenAt(k),C=de.innerMode(B.getMode(),A.state),h=C.state,o=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return de.Pass;var u=C.mode.configuration=="html",w=typeof T=="object"&&T.dontCloseTags||u&&Z,v=typeof T=="object"&&T.indentTags||u&&O;A.end>k.ch&&(l=l.slice(0,l.length-A.end+k.ch));var g=l.toLowerCase();if(!l||A.type=="string"&&(A.end!=k.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==k.ch-A.start-1||w&&G(w,g)>-1||H(B,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(h)||[],l,k,!0))return de.Pass;var L=typeof T=="object"&&T.emptyTags;if(L&&G(L,l)>-1){y[I]={text:"/>",newPos:de.Pos(k.line,k.ch+2)};continue}var x=v&&G(v,g)>-1;y[I]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+l+">",newPos:x?de.Pos(k.line+1,0):de.Pos(k.line,k.ch+1)}}for(var f=typeof T=="object"&&T.dontIndentOnAutoClose,I=_.length-1;I>=0;I--){var p=y[I];B.replaceRange(p.text,_[I].head,_[I].anchor,"+insert");var d=B.listSelections().slice(0);d[I]={head:p.newPos,anchor:p.newPos},B.setSelections(d),!f&&p.indent&&(B.indentLine(p.newPos.line,null,!0),B.indentLine(p.newPos.line+1,null,!0))}}function U(B,_){for(var y=B.listSelections(),T=[],I=_?"/":"</",k=B.getOption("autoCloseTags"),A=typeof k=="object"&&k.dontIndentOnSlash,C=0;C<y.length;C++){if(!y[C].empty())return de.Pass;var h=y[C].head,o=B.getTokenAt(h),l=de.innerMode(B.getMode(),o.state),u=l.state;if(_&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return de.Pass;var w,v=l.mode.name!="xml"&&B.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")w=I+"script";else if(v&&l.mode.name=="css")w=I+"style";else{var g=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!g||g.length&&H(B,g,g[g.length-1],h))return de.Pass;w=I+g[g.length-1]}B.getLine(h.line).charAt(o.end)!=">"&&(w+=">"),T[C]=w}if(B.replaceSelections(T),y=B.listSelections(),!A)for(var C=0;C<y.length;C++)(C==y.length-1||y[C].head.line<y[C+1].head.line)&&B.indentLine(y[C].head.line)}function D(B){return B.getOption("disableInput")?de.Pass:U(B,!0)}de.commands.closeTag=function(B){return U(B)};function G(B,_){if(B.indexOf)return B.indexOf(_);for(var y=0,T=B.length;y<T;++y)if(B[y]==_)return y;return-1}function H(B,_,y,T,I){if(!de.scanForClosingTag)return!1;var k=Math.min(B.lastLine()+1,T.line+500),A=de.scanForClosingTag(B,T,null,k);if(!A||A.tag!=y)return!1;for(var C=I?1:0,h=_.length-1;h>=0&&_[h]==y;h--)++C;T=A.to;for(var h=1;h<C;h++){var o=de.scanForClosingTag(B,T,null,k);if(!o||o.tag!=y)return!1;T=o.to}return!0}})},BjJ7:function(ht,et,pe){"use strict";pe.d(et,"d",function(){return Z}),pe.d(et,"c",function(){return O}),pe.d(et,"e",function(){return Q}),pe.d(et,"b",function(){return U}),pe.d(et,"a",function(){return G});var de=pe("m3rI");function Z(H){var B=!0;if(H.length>0){for(var _=0;_<H.length;_++)if(H[_].compile_success==0||!H[_].compile_success){B=!1;break}}else B=!1;return B}function O(H){for(var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],y=0;y<H.length;y++){var T=H[y],I=B?"".concat(B,"/").concat(T.name):"".concat(T.name);_.push({title:T.name,isLeaf:!(T.type==="tree"),key:I})}return _}function Q(H,B,_){for(var y=0;y<H.length;y++){var T=H[y];if(T.key===B){T.children=_;break}T.children&&Q(T.children,B,_)}return H}function U(H,B,_){var y;return function(){var T=this,I=arguments,k=function(){y=null,_||H.apply(T,I)},A=_&&!y;clearTimeout(y),y=setTimeout(k,B),A&&H.apply(T,I)}}var D=!0,G=de.a.API_SERVER},"C+DQ":function(ht,et,pe){},DlQD:function(ht,et,pe){(function(de,Z){ht.exports=Z()})(this,function(){"use strict";function de(ee,ae){for(var le=0;le<ae.length;le++){var te=ae[le];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ee,te.key,te)}}function Z(ee,ae,le){return ae&&de(ee.prototype,ae),le&&de(ee,le),ee}function O(ee,ae){if(!ee)return;if(typeof ee=="string")return Q(ee,ae);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,ae)}function Q(ee,ae){(ae==null||ae>ee.length)&&(ae=ee.length);for(var le=0,te=new Array(ae);le<ae;le++)te[le]=ee[le];return te}function U(ee,ae){var le;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(le=O(ee))||ae&&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,ae){return ae={exports:{}},ee(ae,ae.exports),ae.exports}var G=D(function(ee){function ae(){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:ae(),getDefaults:ae,changeDefaults:le}}),H=G.defaults,B=G.getDefaults,_=G.changeDefaults,y=/[&<>"']/,T=/[&<>"']/g,I=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},C=function(ae){return A[ae]};function h(ee,ae){if(ae){if(y.test(ee))return ee.replace(T,C)}else if(I.test(ee))return ee.replace(k,C);return ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ee){return ee.replace(o,function(ae,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 w(ee,ae){ee=ee.source||ee,ae=ae||"";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,ae)}};return le}var v=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(ee,ae,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}ae&&!g.test(le)&&(le=a(ae,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ie){return null}return le}var x={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ee,ae){x[" "+ee]||(f.test(ee)?x[" "+ee]=ee+"/":x[" "+ee]=F(ee,"/",!0)),ee=x[" "+ee];var le=ee.indexOf(":")===-1;return ae.substring(0,2)==="//"?le?ae:ee.replace(p,"$1")+ae:ae.charAt(0)==="/"?le?ae:ee.replace(d,"$1")+ae:ee+ae}var b={exec:function(){}};function m(ee){for(var ae=1,le,te;ae<arguments.length;ae++){le=arguments[ae];for(te in le)Object.prototype.hasOwnProperty.call(le,te)&&(ee[te]=le[te])}return ee}function E(ee,ae){var le=ee.replace(/\|/g,function(ue,ce,ve){for(var Ee=!1,Me=ce;--Me>=0&&ve[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=le.split(/ \|/),ie=0;if(te.length>ae)te.splice(ae);else for(;te.length<ae;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function F(ee,ae,le){var te=ee.length;if(te===0)return"";for(var ie=0;ie<te;){var ue=ee.charAt(te-ie-1);if(ue===ae&&!le)ie++;else if(ue!==ae&&le)ie++;else break}return ee.substr(0,te-ie)}function j(ee,ae){if(ee.indexOf(ae[1])===-1)return-1;for(var le=ee.length,te=0,ie=0;ie<le;ie++)if(ee[ie]==="\\")ie++;else if(ee[ie]===ae[0])te++;else if(ee[ie]===ae[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:h,unescape:l,edit:w,cleanUrl:L,resolveUrl:a,noopTest:b,merge:m,splitCells:E,rtrim:F,findClosingBracket:j,checkSanitizeDeprecation:K},M=G.defaults,P=V.rtrim,$=V.splitCells,ne=V.escape,he=V.findClosingBracket;function me(ee,ae,le){var te=ae.href,ie=ae.title?ne(ae.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:ne(ue)}}function ke(ee,ae){var le=ee.match(/^(\s+)(?:```)/);if(le===null)return ae;var te=le[1];return ae.split(`
|
|
`).map(function(ie){var ue=ie.match(/^\s+/);if(ue===null)return ie;var ce=ue[0];return ce.length>=te.length?ie.slice(te.length):ie}).join(`
|
|
`)}var xe=function(){function ee(le){this.options=le||M}var ae=ee.prototype;return ae.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},ae.code=function(te,ie){var ue=this.rules.block.code.exec(te);if(ue){var ce=ie[ie.length-1];if(ce&&ce.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,`
|
|
`)}}},ae.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var ue=ie[0],ce=ke(ue,ie[3]||"");return{type:"code",raw:ue,lang:ie[2]?ie[2].trim():ie[2],text:ce}}},ae.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]}},ae.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 ce=ue.align.length,ve;for(ve=0;ve<ce;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(ce=ue.cells.length,ve=0;ve<ce;ve++)ue.cells[ve]=$(ue.cells[ve],ue.header.length);return ue}}},ae.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},ae.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}}},ae.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var ue=ie[0],ce=ie[2],ve=ce.length>1,Ee=ce[ce.length-1]===")",Me={type:"list",raw:ue,ordered:ve,start:ve?+ce.slice(0,-1):"",loose:!1,items:[]},Be=ie[0].match(this.rules.block.item),Ye=!1,We,pt,nt,rt,Tt,bt,xt,Lt=Be.length,Et=0;Et<Lt;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!==Lt-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!==ce)&&(rt=Be.slice(Et+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-rt.length),Et=Lt-1)),Tt=Ye||/\n\n(?!\s*$)/.test(We),Et!==Lt-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}},ae.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]):ne(ie[0]):ie[0]}},ae.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]}}},ae.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 ce=ue.align.length,ve;for(ve=0;ve<ce;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(ce=ue.cells.length,ve=0;ve<ce;ve++)ue.cells[ve]=$(ue.cells[ve].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ae.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]}},ae.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]}},ae.text=function(te,ie){var ue=this.rules.block.text.exec(te);if(ue){var ce=ie[ie.length-1];return ce&&ce.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},ae.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ne(ie[1])}},ae.tag=function(te,ie,ue){var ce=this.rules.inline.tag.exec(te);if(ce)return!ie&&/^<a /i.test(ce[0])?ie=!0:ie&&/^<\/a>/i.test(ce[0])&&(ie=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:ie,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]}},ae.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var ue=he(ie[2],"()");if(ue>-1){var ce=ie[0].indexOf("!")===0?5:4,ve=ce+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}},ae.reflink=function(te,ie){var ue;if((ue=this.rules.inline.reflink.exec(te))||(ue=this.rules.inline.nolink.exec(te))){var ce=(ue[2]||ue[1]).replace(/\s+/g," ");if(ce=ie[ce.toLowerCase()],!ce||!ce.href){var ve=ue[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Ee=me(ue,ce,ue[0]);return Ee}},ae.strong=function(te,ie,ue){ue===void 0&&(ue="");var ce=this.rules.inline.strong.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ve=ce[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Ee;(ce=ve.exec(ie))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ie.slice(0,ce.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ae.em=function(te,ie,ue){ue===void 0&&(ue="");var ce=this.rules.inline.em.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ve=ce[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Ee;(ce=ve.exec(ie))!=null;)if(Ee=this.rules.inline.em.middle.exec(ie.slice(0,ce.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ae.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var ue=ie[2].replace(/\n/g," "),ce=/[^ ]/.test(ue),ve=ue.startsWith(" ")&&ue.endsWith(" ");return ce&&ve&&(ue=ue.substring(1,ue.length-1)),ue=ne(ue,!0),{type:"codespan",raw:ie[0],text:ue}}},ae.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},ae.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ae.autolink=function(te,ie){var ue=this.rules.inline.autolink.exec(te);if(ue){var ce,ve;return ue[2]==="@"?(ce=ne(this.options.mangle?ie(ue[1]):ue[1]),ve="mailto:"+ce):(ce=ne(ue[1]),ve=ce),{type:"link",raw:ue[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},ae.url=function(te,ie){var ue;if(ue=this.rules.inline.url.exec(te)){var ce,ve;if(ue[2]==="@")ce=ne(this.options.mangle?ie(ue[0]):ue[0]),ve="mailto:"+ce;else{var Ee;do Ee=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Ee!==ue[0]);ce=ne(ue[0]),ue[1]==="www."?ve="http://"+ce:ve=ce}return{type:"link",raw:ue[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},ae.inlineText=function(te,ie,ue){var ce=this.rules.inline.text.exec(te);if(ce){var ve;return ie?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]:ve=ne(this.options.smartypants?ue(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ve}}},ee}(),Le=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:Le,table:Le,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:Le,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:Le,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:Le,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 ae="",le,te,ie=ee.length;for(le=0;le<ie;le++)te=ee.charCodeAt(le),Math.random()>.5&&(te="x"+te.toString(16)),ae+="&#"+te+";";return ae}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 ae=ee.prototype;return ae.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},ae.blockTokens=function(te,ie,ue){ie===void 0&&(ie=[]),ue===void 0&&(ue=!0),te=te.replace(/^ +$/gm,"");for(var ce,ve,Ee,Me;te;){if(ce=this.tokenizer.space(te)){te=te.substring(ce.raw.length),ce.type&&ie.push(ce);continue}if(ce=this.tokenizer.code(te,ie)){te=te.substring(ce.raw.length),ce.type?ie.push(ce):(Me=ie[ie.length-1],Me.raw+=`
|
|
`+ce.raw,Me.text+=`
|
|
`+ce.text);continue}if(ce=this.tokenizer.fences(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.heading(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.nptable(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.hr(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.blockquote(te)){te=te.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],ue),ie.push(ce);continue}if(ce=this.tokenizer.list(te)){for(te=te.substring(ce.raw.length),Ee=ce.items.length,ve=0;ve<Ee;ve++)ce.items[ve].tokens=this.blockTokens(ce.items[ve].text,[],!1);ie.push(ce);continue}if(ce=this.tokenizer.html(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ue&&(ce=this.tokenizer.def(te))){te=te.substring(ce.raw.length),this.tokens.links[ce.tag]||(this.tokens.links[ce.tag]={href:ce.href,title:ce.title});continue}if(ce=this.tokenizer.table(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.lheading(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ue&&(ce=this.tokenizer.paragraph(te))){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.text(te,ie)){te=te.substring(ce.raw.length),ce.type?ie.push(ce):(Me=ie[ie.length-1],Me.raw+=`
|
|
`+ce.raw,Me.text+=`
|
|
`+ce.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},ae.inline=function(te){var ie,ue,ce,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]=[],ce=0;ce<Ee.length;ce++)Me.tokens.cells[ue][ce]=[],this.inlineTokens(Ee[ce],Me.tokens.cells[ue][ce]);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},ae.inlineTokens=function(te,ie,ue,ce,ve){ie===void 0&&(ie=[]),ue===void 0&&(ue=!1),ce===void 0&&(ce=!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,ce)){te=te.substring(Ee.raw.length),ue=Ee.inLink,ce=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,ce)),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,ce)),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,ce),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,ce),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,ce),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,ce,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,De=V.escape,_e=function(){function ee(le){this.options=le||Ae}var ae=ee.prototype;return ae.code=function(te,ie,ue){var ce=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(te,ce);ve!=null&&ve!==te&&(ue=!0,te=ve)}return ce?'<pre><code class="'+this.options.langPrefix+De(ce,!0)+'">'+(ue?te:De(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?te:De(te,!0))+`</code></pre>
|
|
`},ae.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},ae.html=function(te){return te},ae.heading=function(te,ie,ue,ce){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+ce.slug(ue)+'">'+te+"</h"+ie+`>
|
|
`:"<h"+ie+">"+te+"</h"+ie+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(te,ie,ue){var ce=ie?"ol":"ul",ve=ie&&ue!==1?' start="'+ue+'"':"";return"<"+ce+ve+`>
|
|
`+te+"</"+ce+`>
|
|
`},ae.listitem=function(te){return"<li>"+te+`</li>
|
|
`},ae.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},ae.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+ie+`</table>
|
|
`},ae.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},ae.tablecell=function(te,ie){var ue=ie.header?"th":"td",ce=ie.align?"<"+ue+' align="'+ie.align+'">':"<"+ue+">";return ce+te+"</"+ue+`>
|
|
`},ae.strong=function(te){return"<strong>"+te+"</strong>"},ae.em=function(te){return"<em>"+te+"</em>"},ae.codespan=function(te){return"<code>"+te+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(te){return"<del>"+te+"</del>"},ae.link=function(te,ie,ue){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var ce='<a href="'+De(te)+'"';return ie&&(ce+=' title="'+ie+'"'),ce+=">"+ue+"</a>",ce},ae.image=function(te,ie,ue){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var ce='<img src="'+te+'" alt="'+ue+'"';return ie&&(ce+=' title="'+ie+'"'),ce+=this.options.xhtml?"/>":">",ce},ae.text=function(te){return te},ee}(),Pe=function(){function ee(){}var ae=ee.prototype;return ae.strong=function(te){return te},ae.em=function(te){return te},ae.codespan=function(te){return te},ae.del=function(te){return te},ae.html=function(te){return te},ae.text=function(te){return te},ae.link=function(te,ie,ue){return""+ue},ae.image=function(te,ie,ue){return""+ue},ae.br=function(){return""},ee}(),He=function(){function ee(){this.seen={}}var ae=ee.prototype;return ae.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 ae=ee.prototype;return ae.parse=function(te,ie){ie===void 0&&(ie=!0);var ue="",ce,ve,Ee,Me,Be,Ye,We,pt,nt,rt,Tt,bt,xt,Lt,Et,qt,Tr,Yt,gr=te.length;for(ce=0;ce<gr;ce++){rt=te[ce];switch(rt.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,Xe(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(pt="",We="",Me=rt.header.length,ve=0;ve<Me;ve++)We+=this.renderer.tablecell(this.parseInline(rt.tokens.header[ve]),{header:!0,align:rt.align[ve]});for(pt+=this.renderer.tablerow(We),nt="",Me=rt.cells.length,ve=0;ve<Me;ve++){for(Ye=rt.tokens.cells[ve],We="",Be=Ye.length,Ee=0;Ee<Be;Ee++)We+=this.renderer.tablecell(this.parseInline(Ye[Ee]),{header:!1,align:rt.align[Ee]});nt+=this.renderer.tablerow(We)}ue+=this.renderer.table(pt,nt);continue}case"blockquote":{nt=this.parse(rt.tokens),ue+=this.renderer.blockquote(nt);continue}case"list":{for(Tt=rt.ordered,bt=rt.start,xt=rt.loose,Me=rt.items.length,nt="",ve=0;ve<Me;ve++)Et=rt.items[ve],qt=Et.checked,Tr=Et.task,Lt="",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}):Lt+=Yt),Lt+=this.parse(Et.tokens,xt),nt+=this.renderer.listitem(Lt,Tr,qt);ue+=this.renderer.list(nt,Tt,bt);continue}case"html":{ue+=this.renderer.html(rt.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(nt=rt.tokens?this.parseInline(rt.tokens):rt.text;ce+1<gr&&te[ce+1].type==="text";)rt=te[++ce],nt+=`
|
|
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);ue+=ie?this.renderer.paragraph(nt):nt;continue}default:{var fr='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return ue},ae.parseInline=function(te,ie){ie=ie||this.renderer;var ue="",ce,ve,Ee=te.length;for(ce=0;ce<Ee;ce++){ve=te[ce];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,it=G.changeDefaults,qe=G.defaults;function oe(ee,ae,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 ae=="function"&&(le=ae,ae=null),ae=ot({},oe.defaults,ae||{}),$e(ae),le){var te=ae.highlight,ie;try{ie=be.lex(ee,ae)}catch(Ee){return le(Ee)}var ue=function(Me){var Be;if(!Me)try{Be=ze.parse(ie,ae)}catch(Ye){Me=Ye}return ae.highlight=te,Me?le(Me):le(null,Be)};if(!te||te.length<3)return ue();if(delete ae.highlight,!ie.length)return ue();var ce=0;oe.walkTokens(ie,function(Ee){Ee.type==="code"&&(ce++,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),ce--,ce===0&&ue()})},0))}),ce===0&&ue();return}try{var ve=be.lex(ee,ae);return ae.walkTokens&&oe.walkTokens(ve,ae.walkTokens),ze.parse(ve,ae)}catch(Ee){if(Ee.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.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),it(oe.defaults),oe},oe.getDefaults=Re,oe.defaults=qe,oe.use=function(ee){var ae=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);ae.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);ae.tokenizer=te}(),ee.walkTokens){var le=oe.defaults.walkTokens;ae.walkTokens=function(te){ee.walkTokens(te),le&&le(te)}}oe.setOptions(ae)},oe.walkTokens=function(ee,ae){for(var le=U(ee),te;!(te=le()).done;){var ie=te.value;ae(ie);switch(ie.type){case"table":{for(var ue=U(ie.tokens.header),ce;!(ce=ue()).done;){var ve=ce.value;oe.walkTokens(ve,ae)}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,ae)}break}case"list":{oe.walkTokens(ie.items,ae);break}default:ie.tokens&&oe.walkTokens(ie.tokens,ae)}}},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(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=de.Pos;de.defineOption("autoCloseBrackets",!1,function(A,C,h){h&&h!=de.Init&&(A.removeKeyMap(U),A.state.closeBrackets=null),C&&(D(Q(C,"pairs")),A.state.closeBrackets=C,A.addKeyMap(U))});function Q(A,C){return C=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[C]!=null?A[C]:Z[C]}var U={Backspace:B,Enter:_};function D(A){for(var C=0;C<A.length;C++){var h=A.charAt(C),o="'"+h+"'";U[o]||(U[o]=G(h))}}D(Z.pairs+"`");function G(A){return function(C){return T(C,A)}}function H(A){var C=A.state.closeBrackets;if(!C||C.override)return C;var h=A.getModeAt(A.getCursor());return h.closeBrackets||C}function B(A){var C=H(A);if(!C||A.getOption("disableInput"))return de.Pass;for(var h=Q(C,"pairs"),o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return de.Pass;var u=I(A,o[l].head);if(!u||h.indexOf(u)%2!=0)return de.Pass}for(var l=o.length-1;l>=0;l--){var w=o[l].head;A.replaceRange("",O(w.line,w.ch-1),O(w.line,w.ch+1),"+delete")}}function _(A){var C=H(A),h=C&&Q(C,"explode");if(!h||A.getOption("disableInput"))return de.Pass;for(var o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return de.Pass;var u=I(A,o[l].head);if(!u||h.indexOf(u)%2!=0)return de.Pass}A.operation(function(){var w=A.lineSeparator()||`
|
|
`;A.replaceSelection(w+w,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 C=de.cmpPos(A.anchor,A.head)>0;return{anchor:new O(A.anchor.line,A.anchor.ch+(C?-1:1)),head:new O(A.head.line,A.head.ch+(C?1:-1))}}function T(A,C){var h=H(A);if(!h||A.getOption("disableInput"))return de.Pass;var o=Q(h,"pairs"),l=o.indexOf(C);if(l==-1)return de.Pass;for(var u=Q(h,"closeBefore"),w=Q(h,"triples"),v=o.charAt(l+1)==C,g=A.listSelections(),L=l%2==0,x,f=0;f<g.length;f++){var p=g[f],d=p.head,a,b=A.getRange(d,O(d.line,d.ch+1));if(L&&!p.empty())a="surround";else if((v||!L)&&b==C)v&&k(A,d)?a="both":w.indexOf(C)>=0&&A.getRange(d,O(d.line,d.ch+3))==C+C+C?a="skipThree":a="skip";else if(v&&d.ch>1&&w.indexOf(C)>=0&&A.getRange(O(d.line,d.ch-2),d)==C+C){if(d.ch>2&&/\bstring/.test(A.getTokenTypeAt(O(d.line,d.ch-2))))return de.Pass;a="addFour"}else if(v){var m=d.ch==0?" ":A.getRange(O(d.line,d.ch-1),d);if(!de.isWordChar(b)&&m!=C&&!de.isWordChar(m))a="both";else return de.Pass}else if(L&&(b.length===0||/\s/.test(b)||u.indexOf(b)>-1))a="both";else return de.Pass;if(!x)x=a;else if(x!=a)return de.Pass}var E=l%2?o.charAt(l-1):C,F=l%2?C:o.charAt(l+1);A.operation(function(){if(x=="skip")A.execCommand("goCharRight");else if(x=="skipThree")for(var j=0;j<3;j++)A.execCommand("goCharRight");else if(x=="surround"){for(var K=A.getSelections(),j=0;j<K.length;j++)K[j]=E+K[j]+F;A.replaceSelections(K,"around"),K=A.listSelections().slice();for(var j=0;j<K.length;j++)K[j]=y(K[j]);A.setSelections(K)}else x=="both"?(A.replaceSelection(E+F,null),A.triggerElectric(E+F),A.execCommand("goCharLeft")):x=="addFour"&&(A.replaceSelection(E+E+E+E,"before"),A.execCommand("goCharRight"))})}function I(A,C){var h=A.getRange(O(C.line,C.ch-1),O(C.line,C.ch+1));return h.length==2?h:null}function k(A,C){var h=A.getTokenAt(O(C.line,C.ch+1));return/\bstring/.test(h.type)&&h.start==C.ch&&(C.ch==0||!/\bstring/.test(A.getTokenTypeAt(C)))}})},GfqC:function(ht,et,pe){"use strict";var de=pe("q1tI"),Z=pe.n(de),O=pe("TSYQ"),Q=pe.n(O);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(ne){var he=V.data[ne];if(Array.isArray(he)){he.forEach(function(me){P.append(ne+"[]",me)});return}P.append(ne,V.data[ne])}),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(ne){$[ne]!==null&&M.setRequestHeader(ne,$[ne])}),M.send(P),{abort:function(){M.abort()}}}var H=+new Date,B=0;function _(){return"rc-upload-"+H+"-"+ ++B}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||"",ne=V.type||"",he=ne.replace(/\/.*$/,"");return P.some(function(me){var ke=me.trim();return ke.charAt(0)==="."?y($.toLowerCase(),ke.toLowerCase()):/\/\*$/.test(ke)?he===ke.replace(/\/.*$/,""):ne===ke})}return!0};function I(V,M){var P=V.createReader(),$=[];function ne(){P.readEntries(function(he){var me=Array.prototype.slice.apply(he);$=$.concat(me);var ke=!me.length;ke?M($):ne()})}ne()}var k=function(M,P,$){var ne=function he(me,ke){ke=ke||"",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(Le){he(Le,""+ke+me.name+"/")})})};M.forEach(function(he){ne(he.webkitGetAsEntry())})},A=k,C=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){var $=[],ne=!0,he=!1,me=void 0;try{for(var ke=M[Symbol.iterator](),xe;!(ne=(xe=ke.next()).done)&&!($.push(xe.value),P&&$.length===P);ne=!0);}catch(Le){he=!0,me=Le}finally{try{!ne&&ke.return&&ke.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 ne=P[$];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(M,ne.key,ne)}}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 w(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 L=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,$,ne,he;w(this,M);for(var me=arguments.length,ke=Array(me),xe=0;xe<me;xe++)ke[xe]=arguments[xe];return he=($=(ne=v(this,(P=M.__proto__||Object.getPrototypeOf(M)).call.apply(P,[this].concat(ke))),ne),ne.state={uid:_()},ne.reqs={},ne.onChange=function(Le){var Te=Le.target.files;ne.uploadFiles(Te),ne.reset()},ne.onClick=function(Le){var Te=ne.fileInput;if(!Te)return;var Se=ne.props,ye=Se.children,z=Se.onClick;ye&&ye.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),z&&z(Le)},ne.onKeyDown=function(Le){Le.key==="Enter"&&ne.onClick()},ne.onFileDrop=function(Le){var Te=ne.props.multiple;if(Le.preventDefault(),Le.type==="dragover")return;if(ne.props.directory)A(Array.prototype.slice.call(Le.dataTransfer.items),ne.uploadFiles,function(ye){return T(ye,ne.props.accept)});else{var Se=Array.prototype.slice.call(Le.dataTransfer.files).filter(function(ye){return T(ye,ne.props.accept)});Te===!1&&(Se=Se.slice(0,1)),ne.uploadFiles(Se)}},ne.uploadFiles=function(Le){var Te=Array.prototype.slice.call(Le);Te.map(function(Se){return Se.uid=_(),Se}).forEach(function(Se){ne.upload(Se,Te)})},ne.saveFileInput=function(Le){ne.fileInput=Le},$),v(ne,he)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ne){var he=this,me=this.props;if(!me.beforeUpload)return setTimeout(function(){return he.post($)},0);var ke=me.beforeUpload($,ne);ke&&ke.then?ke.then(function(xe){var Le=Object.prototype.toString.call(xe);return Le==="[object File]"||Le==="[object Blob]"?he.post(xe):he.post($)}).catch(function(xe){console.log(xe)}):ke!==!1&&setTimeout(function(){return he.post($)},0);return}},{key:"post",value:function($){var ne=this;if(!this._isMounted)return;var he=this.props,me=he.onStart,ke=he.onProgress,xe=he.transformFile,Le=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(Le($)).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=h(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:ke?function(se){ke(se,$)}:null,onSuccess:function(be,Ae){delete ne.reqs[Se],he.onSuccess(be,$,Ae)},onError:function(be,Ae){delete ne.reqs[Se],he.onError(be,Ae,$)}};me($),ne.reqs[Se]=ye(N)})})}},{key:"reset",value:function(){this.setState({uid:_()})}},{key:"abort",value:function($){var ne=this.reqs;if($){var he=$;$&&$.uid&&(he=$.uid),ne[he]&&ne[he].abort&&ne[he].abort(),delete ne[he]}else Object.keys(ne).forEach(function(me){ne[me]&&ne[me].abort&&ne[me].abort(),delete ne[me]})}},{key:"render",value:function(){var $,ne=this.props,he=ne.component,me=ne.prefixCls,ke=ne.className,xe=ne.disabled,Le=ne.id,Te=ne.style,Se=ne.multiple,ye=ne.accept,z=ne.children,s=ne.directory,c=ne.openFileDialogOnClick,R=ne.onMouseEnter,Y=ne.onMouseLeave,N=u(ne,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),se=Q()(($={},l($,me,!0),l($,me+"-disabled",xe),l($,ke,ke),$)),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,C({},be,{className:se,role:"button",style:Te}),Z.a.createElement("input",C({},L(N),{id:Le,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}(de.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},d=function(){function V(M,P){for(var $=0;$<P.length;$++){var ne=P[$];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(M,ne.key,ne)}}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 F=function(V){m(M,V);function M(){var P,$,ne,he;a(this,M);for(var me=arguments.length,ke=Array(me),xe=0;xe<me;xe++)ke[xe]=arguments[xe];return he=($=(ne=b(this,(P=M.__proto__||Object.getPrototypeOf(M)).call.apply(P,[this].concat(ke))),ne),ne.saveUploader=function(Le){ne.uploader=Le},$),b(ne,he)}return d(M,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Z.a.createElement(f,p({},this.props,{ref:this.saveUploader}))}}]),M}(de.Component);F.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 j=F,K=et.a=j},Gytx:function(ht,et){ht.exports=function(de,Z,O,Q){var U=O?O.call(Q,de,Z):void 0;if(U!==void 0)return!!U;if(de===Z)return!0;if(typeof de!="object"||!de||typeof Z!="object"||!Z)return!1;var D=Object.keys(de),G=Object.keys(Z);if(D.length!==G.length)return!1;for(var H=Object.prototype.hasOwnProperty.bind(Z),B=0;B<D.length;B++){var _=D[B];if(!H(_))return!1;var y=de[_],T=Z[_];if(U=O?O.call(Q,y,T,_):void 0,U===!1||U===void 0&&y!==T)return!1}return!0}},HmJG:function(ht,et,pe){},LdHM:function(ht,et,pe){"use strict";pe.d(et,"b",function(){return u}),pe.d(et,"a",function(){return v});var de=pe("1OyB"),Z=pe("vuIU"),O=pe("Ji7U"),Q=pe("LK+K"),U=pe("q1tI"),D=pe("rePB"),G=pe("Ff2n"),H=pe("ODXe"),B=pe("4IlW"),_=pe("bX4T"),y=pe("YrtM"),T=pe("TSYQ"),I=pe.n(T),k=pe("+nKL"),A=pe("8OUc"),C=function($,ne){var he=$.prefixCls,me=$.id,ke=$.flattenOptions,xe=$.childrenAsData,Le=$.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,De=$.onMouseEnter,_e="".concat(he,"-item"),Pe=Object(y.a)(function(){return ke},[R,ke],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 ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=Pe.length,te=0;te<le;te+=1){var ie=(ee+te*ae+le)%le,ue=Pe[ie],ce=ue.group,ve=ue.data;if(!ce&&!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],it=function(ee){Re(ee);var ae=Pe[ee];if(!ae){Ae(null,-1);return}Ae(ae.data.value,ee)};U.useEffect(function(){it(ye!==!1?ze(0):-1)},[Pe.length,Te]),U.useEffect(function(){var q=setTimeout(function(){if(!Se&&R&&Le.size===1){var ee=Array.from(Le)[0],ae=Pe.findIndex(function(le){var te=le.data;return te.value===ee});it(ae),Xe(ae)}});return function(){return clearTimeout(q)}},[R]);var qe=function(ee){ee!==void 0&&se(ee,{selected:!Le.has(ee)}),Se||be(!1)};if(U.useImperativeHandle(ne,function(){return{onKeyDown:function(ee){var ae=ee.which;switch(ae){case B.a.UP:case B.a.DOWN:{var le=0;if(ae===B.a.UP?le=-1:ae===B.a.DOWN&&(le=1),le!==0){var te=ze(Je+le,le);Xe(te),it(te)}break}case B.a.ENTER:{var ie=Pe[Je];ie&&!ie.data.disabled?qe(ie.data.value):qe(void 0),R&&ee.preventDefault();break}case B.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 ae=ee.data||{},le=ae.value,te=ae.label,ie=ae.children,ue=Object(_.a)(ae,!0),ce=xe?ie:te;return ee?U.createElement("div",Object.assign({"aria-label":typeof ce=="string"?ce:null},ue,{key:q,role:"option",id:"".concat(me,"_list_").concat(q),"aria-selected":Le.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(k.a,{itemKey:"key",ref:He,data:Pe,height:z,itemHeight:s,fullHeight:!1,onMouseDown:Ge,onScroll:Oe,virtual:N,onMouseEnter:De},function(q,ee){var ae,le=q.group,te=q.groupOption,ie=q.data,ue=ie.label,ce=ie.key;if(le)return U.createElement("div",{className:I()(_e,"".concat(_e,"-group"))},ue!==void 0?ue:ce);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=Le.has(Ee),rt="".concat(_e,"-option"),Tt=I()(_e,rt,We,(ae={},Object(D.a)(ae,"".concat(rt,"-grouped"),te),Object(D.a)(ae,"".concat(rt,"-active"),Je===ee&&!ve),Object(D.a)(ae,"".concat(rt,"-disabled"),ve),Object(D.a)(ae,"".concat(rt,"-selected"),nt),ae)),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;it(ee)},onClick:function(){ve||qe(Ee)},style:Ye}),U.createElement("div",{className:"".concat(rt,"-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))}))},h=U.forwardRef(C);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var u=l,w=function(){return null};w.isSelectOptGroup=!0;var v=w,g=pe("VTBJ"),L=pe("Zm9Q");function x(P){var $=P.key,ne=P.props,he=ne.children,me=ne.value,ke=Object(G.a)(ne,["children","value"]);return Object(g.a)({key:$,value:me!==void 0?me:$,children:he},ke)}function f(P){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(P).map(function(ne,he){if(!U.isValidElement(ne)||!ne.type)return null;var me=ne.type.isSelectOptGroup,ke=ne.key,xe=ne.props,Le=xe.children,Te=Object(G.a)(xe,["children"]);return $||!me?x(ne):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(ke===null?he:ke,"__"),label:ke},Te),{},{options:f(Le)})}).filter(function(ne){return ne})}var p=pe("2Qr1"),d=pe("qNPg"),a=pe("U8pU"),b=pe("Kwbf"),m=pe("WKfj");function E(P){var $=P.mode,ne=P.options,he=P.children,me=P.backfill,ke=P.allowClear,xe=P.placeholder,Le=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=ne||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"||!Le,"`getInputElement` only work with `combobox` mode."),Object(b.b)($!=="combobox"||!Le||!ke||!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 De=null;Object(L.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(L.a)(_e.props.children).every(function(Ge){return!U.isValidElement(Ge)||!_e.type||Ge.type.isSelectOption?!0:(De=Ge.type,!1)});return!He}return De=Pe,!0}),De&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(De.displayName||De.name||De,"`.")),Object(b.a)(R===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var F=E,j=Object(d.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:F,fillOptionsWithMissingValue:p.a}),K=function(P){Object(O.a)(ne,P);var $=Object(Q.a)(ne);function ne(){var he;return Object(de.a)(this,ne),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)(ne,[{key:"render",value:function(){return U.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),ne}(U.Component);K.Option=u,K.OptGroup=v;var V=K,M=et.c=V},M8RZ:function(ht,et,pe){"use strict";pe.d(et,"a",function(){return B});var de=pe("fWQN"),Z=pe("mtLc"),O=pe("yKVA"),Q=pe("879j"),U=pe("q1tI"),D=pe.n(U),G=pe("i8i4"),H=pe.n(G),B=function(_){Object(O.a)(T,_);var y=Object(Q.a)(T);function T(I){var k;Object(de.a)(this,T),k=y.call(this,I);var A=window.document;return k.node=A.createElement("div"),A.body.appendChild(k.node),k}return Object(Z.a)(T,[{key:"render",value:function(){var k=this.props.children;return Object(G.createPortal)(k,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(D.a.Component)},OLES:function(ht,et,pe){"use strict";var de=pe("U8pU"),Z=pe("VTBJ"),O=pe("Ff2n"),Q=pe("q1tI"),U=pe("uciX"),D=pe("7ixt"),G=function(I){var k=I.overlay,A=I.prefixCls,C=I.id,h=I.overlayInnerStyle;return Q.createElement("div",{className:"".concat(A,"-inner"),id:C,role:"tooltip",style:h},typeof k=="function"?k():k)},H=G,B=function(I,k){var A=I.overlayClassName,C=I.trigger,h=C===void 0?["hover"]:C,o=I.mouseEnterDelay,l=o===void 0?0:o,u=I.mouseLeaveDelay,w=u===void 0?.1:u,v=I.overlayStyle,g=I.prefixCls,L=g===void 0?"rc-tooltip":g,x=I.children,f=I.onVisibleChange,p=I.afterVisibleChange,d=I.transitionName,a=I.animation,b=I.placement,m=b===void 0?"right":b,E=I.align,F=E===void 0?{}:E,j=I.destroyTooltipOnHide,K=j===void 0?!1:j,V=I.defaultVisible,M=I.getTooltipContainer,P=I.overlayInnerStyle,$=Object(O.a)(I,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ne=Object(Q.useRef)(null);Object(Q.useImperativeHandle)(k,function(){return ne.current});var he=Object(Z.a)({},$);"visible"in I&&(he.popupVisible=I.visible);var me=function(){var Se=I.arrowContent,ye=Se===void 0?null:Se,z=I.overlay,s=I.id;return[Q.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},ye),Q.createElement(H,{key:"content",prefixCls:L,id:s,overlay:z,overlayInnerStyle:P})]},ke=!1,xe=!1;if(typeof K=="boolean")ke=K;else if(K&&Object(de.a)(K)==="object"){var Le=K.keepParent;ke=Le===!0,xe=Le===!1}return Q.createElement(U.a,Object.assign({popupClassName:A,prefixCls:L,popup:me,action:h,builtinPlacements:D.a,popupPlacement:m,ref:ne,popupAlign:F,getPopupContainer:M,onPopupVisibleChange:f,afterPopupVisibleChange:p,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:ke,autoDestroy:xe,mouseLeaveDelay:w,popupStyle:v,mouseEnterDelay:l},he),x)},_=Object(Q.forwardRef)(B),y=et.a=_},Ot1p:function(ht,et,pe){"use strict";var de=pe("2qtc"),Z=pe("kLXV"),O=pe("rAM+"),Q=pe("miYZ"),U=pe("tsqr"),D=pe("9og8"),G=pe("tJVT"),H=pe("jrin"),B=pe("WmNS"),_=pe.n(B),y=pe("q1tI"),T=pe.n(y),I=pe("VrN/"),k=pe.n(I),A=pe("bdgK"),C=pe("p77/"),h=pe("Bd2K"),o=pe("ELLl"),l=pe("19Vz"),u=pe("lZu9"),w=pe("+NIl"),v=pe("kSUc"),g=pe("9Bee"),L=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,rt=Object(y.useMemo)(function(){return""},[Me]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:rt}}))},x=pe("0Owb"),f=pe("dejd"),p=pe("C+DQ"),d=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 rt(){Ee(Ye)}return T.a.createElement("a",{title:Me,className:pt,onClick:rt},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,rt=ve.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.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})))},F=pe("M8RZ"),j=pe("+L6B"),K=pe("2/Rp"),V=pe("y8nQ"),M=pe("Vl3Y"),P=pe("5NDa"),$=pe("5rEg"),ne={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)({},ne,{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"),ke=pe("HmJG"),xe=pe("BjJ7"),Le=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=Le(),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 rt(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:rt}))),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"),De=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 it=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 ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ae?"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),ce=et.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,rt=ve.miniToolbar,Tt=rt===void 0?!1:rt,bt=ve.isFocus,xt=bt===void 0?!1:bt,Lt=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,kt=ve.onCMBeforeChange,vr=ve.onFullScreen,Ut=ve.className,Fe=Ut===void 0?"":Ut,dt=ve.disablePaste,ri=dt===void 0?!1:dt,bi=ve.placeholder,xi=bi===void 0?"":bi,ii=ve.values,Ei=ii===void 0?"":ii,ft=Object(y.useState)(null),Ln=Object(G.a)(ft,2),Ue=Ln[0],Si=Ln[1],Er=Object(y.useState)(Me),Ki=Object(G.a)(Er,2),ni=Ki[0],Cr=Ki[1],Vi=Object(y.useState)(Lt),Xi=Object(G.a)(Vi,2),wr=Xi[0],Yi=Xi[1],kn=Object(y.useState)(gt),$i=Object(G.a)(kn,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),Lr=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(De.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)(_.a.mark(function ct(){var lt,yt;return _.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&<!==void 0&<.length&&(console.log("cm:",Ue,Br),yt.attachments.map(function(Ct){Ct.content_type.indexOf("image")>-1?Ue.replaceSelection(".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()}},ct)}));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=k.a.fromTextArea(Br.current,{mode:Tr,lineNumbers:!Tt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});xt&&at.focus();function ct(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(".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",ct),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(".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",ct)}}},[]);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(O.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 ct=at();return function(){ct.unobserve(Br.current.parentElement)}}},[Ue,yr]),Object(y.useEffect)(function(){if(Ue){for(var at=[],ct=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;ct()}return wi.current=setInterval(function(){si.current&&Pn()},4e3),function(){clearInterval(wi.current);var _t=Object(O.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&&Lr>0){var at=new Date().getTime(),ct=window.sessionStorage.getItem(gr);at>=Lr+qe&&(!ct||ct!==ni)&&(window.sessionStorage.setItem(gr,ni),Ci(!0))}},qe),Object(y.useEffect)(function(){Yi(Lt)},[Ue,Lt]),Object(y.useEffect)(function(){Ue&&(xt&&Ue.focus())},[Ue,xt]),Object(y.useEffect)(function(){if(wr&&Ue){var at=Ue.getScrollerElement();function ct(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",ct),function(){at.removeEventListener("scroll",ct)}}},[Ue,wr]),Object(y.useEffect)(function(){if(Ue&&kt){function at(ct,lt){kt(ct,lt)}return Ue.on("beforeChange",at),function(){Ue.off("beforeChange",at)}}},[Ue,kt]),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(ct){var lt=ct.getValue();Cr(lt),Ji(new Date().getTime()),ct.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 ct=Ue.getCursor(),lt=Ue.getSelection(),yt=lt.split(`
|
|
`);switch(at){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(ct.line,ct.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(ct.line,ct.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(ct.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(ct.line,ct.ch+1),Ue.replaceSelection(oe),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(ct.line,ct.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]),Li=Object(y.useCallback)(function(at){Kr("");switch(ir){case _e:var ct=at.title,lt=at.link;return Ue.replaceSelection("[".concat(ct,"](").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(_t,' "').concat(Ct,'" )')):Ue.replaceSelection("")),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:Li,onCancel:Vr});case He:return T.a.createElement(me.b,{callback:Li,onCancel:Vr});case Pe:return T.a.createElement(ye,{callback:Li,onCancel:Vr});case Ge:return T.a.createElement(Ae,{callback:Li,onCancel:Vr});default:return null}},[ir]);function Vr(){Kr("")}Object(y.useEffect)(function(){if(Ur.current){var at=Ur.current,ct=!1,lt=0;function yt(Ct){ct=!0,lt=Ct.pageY}function At(){ct=!1}function _t(Ct){if(ct){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),kr={width:_r,height:qi},en=Object(y.useMemo)(function(){if(Lr){var at=new Date(Lr),ct=at.getHours(),lt=at.getMinutes(),yt=at.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,yt=yt<10?"0"+yt:yt,"".concat(ct,":").concat(lt,":").concat(yt)}return 0},[Lr]);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,ct){var lt=Ue.getValue();lt=lt.replace(at,ct),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:kr},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(L,{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(F.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(ht,et){/**
|
|
* @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,de,Z,O=!1,Q,U;window.PR_SHOULD_USE_CONTINUATION=!0;var D,G;(function(){var H=window,B=["break,continue,do,else,for,if,return,while"],_=[B,"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=[_,"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"],k=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],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",C=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[B,"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=[B,"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=[B,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,k,I,C,h,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",L="kwd",x="com",f="typ",p="lit",d="pun",a="pln",b="tag",m="dec",E="src",F="atn",j="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,De=0,_e=se.length;De<_e;++De){var Pe=se[De];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 it=Je.charAt(1);return Re=He[it],Re||("0"<=it&&it<="7"?parseInt(Je.substring(1),8):it==="u"||it==="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")),it=[],qe=Re[0]==="^",oe=["["];qe&&oe.push("^");for(var q=qe?1:0,ee=Re.length;q<ee;++q){var ae=Re[q];if(/\\[bdsw]/i.test(ae))oe.push(ae);else{var le=Ge(ae),te;q+2<ee&&Re[q+1]==="-"?(te=Ge(Re[q+2]),q+=2):te=le,it.push([le,te]),te<65||le>122||(te<65||le>90||it.push([Math.max(65,le)|32,Math.min(te,90)|32]),te<97||le>122||it.push([Math.max(97,le)&~32,Math.min(te,122)&~32]))}}it.sort(function(ve,Ee){return ve[0]-Ee[0]||Ee[1]-ve[1]});for(var ie=[],ue=[],q=0;q<it.length;++q){var ce=it[q];ce[0]<=ue[1]+1?ue[1]=Math.max(ue[1],ce[1]):ie.push(ue=ce)}for(var q=0;q<ie.length;++q){var ce=ie[q];oe.push(Xe(ce[0])),ce[1]>ce[0]&&(ce[1]+1>ce[0]&&oe.push("-"),oe.push(Xe(ce[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")),it=Re.length,qe=[],oe=0,q=0;oe<it;++oe){var ee=Re[oe];if(ee==="(")++q;else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&(ae<=q?qe[ae]=-1:Re[oe]=Xe(ae))}}for(var oe=1;oe<qe.length;++oe)qe[oe]===-1&&(qe[oe]=++be);for(var oe=0,q=0;oe<it;++oe){var ee=Re[oe];if(ee==="(")++q,qe[q]||(Re[oe]="(?:");else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&ae<=q&&(Re[oe]="\\"+qe[ae])}}for(var oe=0;oe<it;++oe)Re[oe]==="^"&&Re[oe+1]!=="^"&&(Re[oe]="");if(Je.ignoreCase&&Ae)for(var oe=0;oe<it;++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 ce=ue.charCodeAt(0);return"["+String.fromCharCode(ce&~32,ce|32)+"]"}))}return Re.join("")}for(var $e=[],De=0,_e=se.length;De<_e;++De){var Pe=se[De];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=[],De=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]=De++,_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]=De,De+=$e.length,_e[Pe++<<1|1]=Ge)}}return He(se),{sourceCode:Oe.join("").replace(/\n$/,""),spans:_e}}function $(se,be,Ae,Oe,De){if(!Ae)return;var _e={sourceNode:se,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:be,decorations:null};Oe(_e),De.push.apply(De,_e.decorations)}var ne=/\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&&ne.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],it=""+Re;Ge.hasOwnProperty(it)||(He.push(Re),Ge[it]=null)}He.push(/[\0-\uffff]/),Oe=M(He)})();var De=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,it=$e.length;Re<it;++Re){var qe=$e[Re],oe=Je[qe],q=void 0,ee;if(typeof oe=="string")ee=!1;else{var ae=Ae[qe.charAt(0)];if(ae)q=qe.match(ae[1]),oe=ae[0];else{for(var le=0;le<De;++le)if(ae=be[le],q=qe.match(ae[1]),q){oe=ae[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),ce=ue+ie.length;q[2]&&(ce=qe.length-q[2].length,ue=ce-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+ce,qe.substring(ce),_e,ze)}}Pe.decorations=ze};return _e}function ke(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 De=se.regexLiterals;if(De){var _e=De>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([L,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],[d,new RegExp(ze),null]),me(be,Ae)}var xe=ke({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Le(se,be,Ae){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,De=/\r\n?|\n/,_e=se.ownerDocument,Pe=_e.createElement("li");se.firstChild;)Pe.appendChild(se.firstChild);var He=[Pe];function Ge(Re){var it=Re.nodeType;if(it==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((it==3||it==4)&&Ae){var oe=Re.nodeValue,q=oe.match(De);if(q){var ee=oe.substring(0,q.index);Re.nodeValue=ee;var ae=oe.substring(q.index+q[0].length);if(ae){var le=Re.parentNode;le.insertBefore(_e.createTextNode(ae),Re.nextSibling)}Xe(Re),ee||Re.parentNode.removeChild(Re)}}}function Xe(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function it(q,ee){var ae=ee?q.cloneNode(!1):q,le=q.parentNode;if(le){var te=it(le,1),ie=q.nextSibling;te.appendChild(ae);for(var ue=ie;ue;ue=ie)ie=ue.nextSibling,te.appendChild(ue)}return ae}for(var qe=it(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,De=Oe.length,_e=0,Pe=se.spans,He=Pe.length,Ge=0,Xe=se.decorations,ze=Xe.length,ot=0;Xe[ze]=De;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],it=Xe[Je+1],qe=Je+2;qe+2<=ze&&Xe[qe+1]===it;)qe+=2;Xe[$e++]=Re,Xe[$e++]=it,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 ae=Pe[Ge],le=Pe[Ge+2]||De,te=Xe[ot+2]||De,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 ce=ie.ownerDocument,ve=ce.createElement("span");ve.className=Xe[ot+1];var Ee=ie.parentNode;Ee.replaceChild(ve,ie),ve.appendChild(ie),_e<le&&(Pe[Ge+1]=ie=ce.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]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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
|
|
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[F,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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([],[[j,/^[\s\S]+/]]),["uq.val"]),ye(ke({keywords:T,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ye(ke({keywords:"null,true,false"}),["json"]),ye(ke({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ye(ke({keywords:I,cStyleComments:!0}),["java"]),ye(ke({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(ke({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(ke({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(ke({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(ke({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(ke({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(De){H.console&&console.log(De&&De.stack||De)}}function c(se,be,Ae){var Oe=Ae||!1,De=be||null,_e=document.createElement("div");_e.innerHTML="<pre>"+se+"</pre>",_e=_e.firstChild,Oe&&Le(_e,Oe,!0);var Pe={langExtension:De,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 De(ae){return Ae.getElementsByTagName(ae)}for(var _e=[De("pre"),De("code"),De("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/,it=/pre|xmp/i,qe=/^code$/i,oe=/^(?:pre|code|xmp)$/i,q={};function ee(){for(var ae=H.PR_SHOULD_USE_CONTINUATION?ze.now()+250:Infinity;ot<Pe.length&&ze.now()<ae;ot++){for(var le=Pe[ot],te=q,ie=le;ie=ie.previousSibling;){var ue=ie.nodeType,ce=(ue===7||ue===8)&&ie.nodeValue;if(ce?!/^\??prettify\b/.test(ce):ue!==3||/\S/.test(ie.nodeValue))break;if(ce){te={},ce.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,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(it.test(le.tagName))pt=1;else{var nt=le.currentStyle,rt=Oe.defaultView,Tt=nt?nt.whiteSpace:rt&&rt.getComputedStyle?rt.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&&Le(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:ke,PR_ATTRIB_NAME:F,PR_ATTRIB_VALUE:j,PR_COMMENT:x,PR_DECLARATION:m,PR_KEYWORD:L,PR_LITERAL:p,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:E,PR_STRING:g,PR_TAG:b,PR_TYPE:f,prettyPrintOne:O?H.prettyPrintOne=c:D=c,prettyPrint:G=O?H.prettyPrint=R:G=R},N=H.define;typeof N=="function"&&N.amd&&N("google-code-prettify",[],function(){return Y})})()},STEk:function(ht,et,pe){"use strict";pe.d(et,"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 de=function(z,s){return(de=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}de(z,s),z.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function O(z,s,c,R){return new(c||(c=Promise))(function(Y,N){function se(Oe){try{Ae(R.next(Oe))}catch(De){N(De)}}function be(Oe){try{Ae(R.throw(Oe))}catch(De){N(De)}}function Ae(Oe){var De;Oe.done?Y(Oe.value):(De=Oe.value,De instanceof c?De:new c(function(_e){_e(De)})).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(De){if(c)throw new TypeError("Generator is already executing.");for(;se;)try{if(c=1,R&&(Y=2&De[0]?R.return:De[0]?R.throw||((Y=R.return)&&Y.call(R),0):R.next)&&!(Y=Y.call(R,De[1])).done)return Y;switch(R=0,Y&&(De=[2&De[0],Y.value]),De[0]){case 0:case 1:Y=De;break;case 4:return se.label++,{value:De[1],done:!1};case 5:se.label++,R=De[1],De=[0];continue;case 7:De=se.ops.pop(),se.trys.pop();continue;default:if(!(Y=se.trys,(Y=Y.length>0&&Y[Y.length-1])||De[0]!==6&&De[0]!==2)){se=0;continue}if(De[0]===3&&(!Y||De[1]>Y[0]&&De[1]<Y[3])){se.label=De[1];break}if(De[0]===6&&se.label<Y[1]){se.label=Y[1],Y=De;break}if(Y&&se.label<Y[2]){se.label=Y[2],se.ops.push(De);break}Y[2]&&se.ops.pop(),se.trys.pop();continue}De=s.call(z,se)}catch(_e){De=[6,_e],R=0}finally{c=Y=0}if(5&De[0])throw De[1];return{value:De[0]?De[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 De=window.URL,_e=new Image(se.width,se.height);_e.setAttribute("crossOrigin","anonymous");var Pe=new Blob([Ae],{type:"image/svg+xml"}),He=De.createObjectURL(Pe);_e.onload=function(){Oe.drawImage(_e,0,0),De.revokeObjectURL(He);var Ge=se.toDataURL(Y.imageType,Y.imageQuality);N(Ge)},_e.src=He})},z}(),B=function(){},_=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}(),k=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},C=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),h=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}(),w=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}(h),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}(w),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),L=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 C("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 L("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}(h),d=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 C("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 L("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 C("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}(w),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 C("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 De=0;De<this.canvasElement.width;De++)c.data[Oe*this.canvasElement.width*4+4*De+3]>0&&(Ae=!0,Oe<N&&(N=Oe),De<Y&&(Y=De),Oe>be&&(be=Oe),De>se&&(se=De));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}(w),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 De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.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>`,De.style.marginLeft="5px",Oe.appendChild(De)}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),F=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}(d),j=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 C("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 C("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}(j),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 C("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 C("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 C("Line color",U(Y.defaultColorSet,["transparent"]),Y.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.fillPanel=new C("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 L("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}(w),ne=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}(d),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}(),ke=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 C("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 L("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}(),Le=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 _(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,F,b,he,$,V,P,ne,j,d,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[x,m,F,b,$,V,P]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[x,m,F,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&&B.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=B.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new xe(s))})},z.prototype.render=function(){return O(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 k(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 O(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 Le(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(ht,et,pe){(function(de,Z){ht.exports=Z()})(this,function(){"use strict";var de=navigator.userAgent,Z=navigator.platform,O=/gecko\/\d/i.test(de),Q=/MSIE \d/.test(de),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(de),D=/Edge\/(\d+)/.exec(de),G=Q||U||D,H=G&&(Q?document.documentMode||6:+(D||U)[1]),B=!D&&/WebKit\//.test(de),_=B&&/Qt\/\d+\.\d+/.test(de),y=!D&&/Chrome\//.test(de),T=/Opera\//.test(de),I=/Apple Computer/.test(navigator.vendor),k=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(de),A=/PhantomJS/.test(de),C=!D&&/AppleWebKit/.test(de)&&/Mobile\/\w+/.test(de),h=/Android/.test(de),o=C||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(de),l=C||/Mac/.test(Z),u=/\bCrOS\b/.test(de),w=/win/i.test(Z),v=T&&de.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(T=!1,B=!0);var g=l&&(_||T&&(v==null||v<12.11)),L=O||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 d(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 F(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function j(e,t){var 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()};C?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,W=n||0;;){var X=e.indexOf(" ",S);if(X<0||X>=t)return W+(t-S);W+=X-S,W+=i-W%i,S=X+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ne.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ne.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,ke={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},Le={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 W=S-r;if(S==e.length||n+W>=t)return r+Math.min(W,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 De=/[\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&&De.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 W=e[S];(W.from<i&&W.to>t||t==i&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,i),W.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]/,W=/[Lb1n]/,X=/[1n]/;function J(re,fe,ge){this.level=re,this.from=fe,this.to=ge}return function(re,fe){var ge=fe=="ltr"?"L":"R";if(re.length==0||fe=="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 tt=Ce[Qe];tt=="1"&&Ve=="r"?Ce[Qe]="n":S.test(tt)&&(Ve=tt,tt=="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(W.test(Ce[Xt])){var Va=Xt;for(++Xt;Xt<we&&W.test(Ce[Xt]);++Xt);rr.push(new J(0,Va,Xt))}else{var Gr=Xt,vi=rr.length,yi=fe=="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 fe=="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)))),fe=="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 it(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=it(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 ae(e,t){return it(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 ce(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");d(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=d(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),W=S.indexOf("\r");W!=-1?(i.push(S.slice(0,W)),t+=W+1):(i.push(S),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},rt=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=d(e,a("span","x")),i=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(i.left-r.left)>1}var Lt={},Et={};function qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[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=Lt[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 W in t.modeProps)r[W]=t.modeProps[W];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(W){return i?W.toLowerCase():W},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 W=S.text;n==i.line&&(W=W.slice(0,i.ch)),n==t.line&&(W=W.slice(t.ch)),r.push(W),++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 kt(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 W=0;W<e.lines.length;++W){var X=e.lines[W],J=X.height;if(t<J)break;t-=J}return i+W}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 dt(e,t){return e.line-t.line||e.ch-t.ch}function ri(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function bi(e){return Fe(e.line,e.ch)}function xi(e,t){return dt(e,t)<0?t:e}function ii(e,t){return dt(e,t)<0?e:t}function Ei(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(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):Ln(t,Ze(e,t.line).text.length)}function Ln(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]=ft(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,fe){return n.push(re,fe)},S,r);for(var W=i.state,X=function(re){i.baseTokens=n;var fe=e.state.overlays[re],ge=1,we=0;i.state=!0,Ar(e,t.text,fe.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(fe.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=W,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),W=S>r.first&&Ze(r,S-1).stateAfter,X=W?Er.fromSaved(r,W,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 kn(e,t,i,r){var n=e.doc,S=n.mode,W;t=ft(n,t);var X=Ze(n,t.line),J=Cr(e,t.line,i),re=new Pt(X.text,e.options.tabSize,J),fe;for(r&&(fe=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,W=wr(S,re,J.state),r&&fe.push(new Yi(re,W,$t(n.mode,J.state)));return r?fe:new Yi(re,W,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,W){var X=i.flattenSpans;X==null&&(X=e.options.flattenSpans);var J=0,re=null,fe=new Pt(t,e.options.tabSize,r),ge,we=e.options.addModeClass&&[null];for(t==""&&$i(Xi(i,r.state),S);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(X=!1,W&&Vi(e,t,r,fe.pos),fe.pos=t.length,ge=null):ge=$i(wr(i,fe,r.state,we),S),we){var Ce=we[0].name;Ce&&(ge="m-"+(ge?Ce+" "+ge:Ce))}if(!X||re!=ge){for(;J<fe.start;)J=Math.min(fe.start,J+5e3),n(J,re);re=ge}fe.start=fe.pos}for(;J<fe.pos;){var Ie=Math.min(fe.pos,J+5e3);n(Ie,re),J=Ie}}function Dn(e,t,i){for(var r,n,S=e.doc,W=i?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>W;--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 fe=$(J.text,null,e.options.tabSize);(n==null||r>fe)&&(n=X-1,r=fe)}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 Lr(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],W=S.marker,X=S.from==null||(W.inclusiveLeft?S.from<=t:S.from<t);if(X||S.from==t&&W.type=="bookmark"&&(!i||!S.marker.insertLeft)){var J=S.to==null||(W.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new ai(W,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],W=S.marker,X=S.to==null||(W.inclusiveRight?S.to>=t:S.to>t);if(X||S.from==t&&W.type=="bookmark"&&(!i||S.marker.insertLeft)){var J=S.from==null||(W.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new ai(W,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,W=dt(t.from,t.to)==0,X=Rn(i,n,W),J=On(r,S,W),re=t.text.length==1,fe=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=Lr(J,we.marker);Ce?re&&(we.to=Ce.to==null?null:Ce.to+fe):we.to=n}}if(J)for(var Ie=0;Ie<J.length;++Ie){var Ne=J[Ie];if(Ne.to!=null&&(Ne.to+=fe),Ne.from==null){var je=Lr(X,Ne.marker);je||(Ne.from=fe,re&&(X||(X=[])).push(Ne))}else Ne.from+=fe,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 tt=0;tt<X.length;++tt)X[tt].to==null&&(Ve||(Ve=[])).push(new ai(X[tt].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 W=r[S],X=W.find(0),J=0;J<n.length;++J){var re=n[J];if(dt(re.to,X.from)<0||dt(re.from,X.to)>0)continue;var fe=[J,1],ge=dt(re.from,X.from),we=dt(re.to,X.to);(ge<0||!W.inclusiveLeft&&!ge)&&fe.push({from:re.from,to:X.from}),(we>0||!W.inclusiveRight&&!we)&&fe.push({from:X.to,to:re.to}),n.splice.apply(n,fe),J+=fe.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=dt(r.from,n.from)||oi(e)-oi(t);if(S)return-S;var W=dt(r.to,n.to)||si(e)-si(t);return W||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),W=ir&&S.markedSpans;if(W)for(var X=0;X<W.length;++X){var J=W[X];if(!J.marker.collapsed)continue;var re=J.marker.find(0),fe=dt(re.from,i)||oi(J.marker)-oi(n),ge=dt(re.to,r)||si(J.marker)-si(n);if(fe>=0&&ge<=0||fe<=0&&ge>=0)continue;if(fe<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?dt(re.to,i)>=0:dt(re.to,i)>0)||fe>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?dt(re.from,r)<=0:dt(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 Li(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,Lr(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 kr(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 W=0;W<S.children.length;++W){var X=S.children[W];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&>(e,n)}function at(e){e.parent=null,la(e)}var ct={},lt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?lt:ct;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function At(e,t){var i=b("span",null,null,B?"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,W=void 0;r.pos=0,r.addToken=Ct,pt(e.display.measure)&&(W=$e(S,e.doc.direction))&&(r.addToken=or(r.addToken,W)),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(B){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,W){if(!t)return;var X=e.splitSpaces?Ht(t,e.trailingSpace):t,J=e.cm.state.specialChars,re=!1,fe;if(!J.test(t))e.col+=t.length,fe=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,fe),G&&H<9&&(re=!0),e.pos+=t.length;else{fe=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?fe.appendChild(a("span",[Ie])):fe.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=fe.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=fe.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?fe.appendChild(a("span",[Ne])):fe.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||W){var Qe=i||"";r&&(Qe+=r),n&&(Qe+=n);var Ve=a("span",[fe],Qe,S);if(W)for(var tt in W)W.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ve.setAttribute(tt,W[tt]);return e.content.appendChild(Ve)}e.content.appendChild(fe)}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,W,X,J){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,fe=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>=fe)return e(i,r,n,S,W,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 W=1;W<i.length;W+=2)t.addToken(t,n.slice(S,S=i[W]),yt(i[W+1],t.cm.options));return}for(var X=n.length,J=0,re=1,fe="",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=[],tt=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&&(tt||(tt=[])).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(tt)for(var Vt=0;Vt<tt.length;Vt+=2)tt[Vt+1]==Ce&&(Ne+=" "+tt[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(fe){var hr=J+fe.length;if(!Ke){var jt=hr>mr?fe.slice(0,mr-J):fe;t.addToken(t,jt,ge?ge+Ie:Ie,je,J+jt.length==Ce?Ne:"",we,Qe)}if(hr>=mr){fe=fe.slice(mr-J),J=mr;break}J=hr,je=""}fe=n.slice(S,S=i[re++]),ge=yt(i[re++],t.cm.options)}}}function Dt(e,t,i){this.line=t,this.rest=Li(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 W=new Dt(e.doc,Ze(e.doc,S),S);n=S+W.size,r.push(W)}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=it(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)})},W=0;W<i.length;++W)S(W)}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 W=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),W.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,fe=S.hasOwnProperty(re)&&S[re];fe&&X.appendChild(a("div",[fe],"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),W=0,X=t.widgets;W<X.length;++W){var J=X[W],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;"),d(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=d(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 W=t.text.firstChild.getClientRects(),X=0;X<W.length-1;X++){var J=W[X],re=W[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,d(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Pr(e,ki(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 ki(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||""),W;return t.cache.hasOwnProperty(S)?W=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,i,r),W.bogus||(t.cache[S]=W)),{left:W.left,right:W.right,top:n?W.rtop:W.top,bottom:n?W.rbottom:W.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,S,W,X,J,re=0;re<e.length;re+=3)if(X=e[re],J=e[re+1],t<X?(n=0,S=1,W="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&&(W="right")),n!=null){if(r=e[re+2],X==J&&i==(r.insertLeft?"left":"right")&&(W=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],W="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],W="right";break}return{node:r,start:n,end:S,collapse:W,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,W=n.start,X=n.end,J=n.collapse,re;if(S.nodeType==3){for(var fe=0;fe<4;fe++){for(;W&&_e(t.line.text.charAt(n.coverStart+W));)--W;for(;n.coverStart+X<n.coverEnd&&_e(t.line.text.charAt(n.coverStart+X));)++X;if(G&&H<9&&W==0&&X==n.coverEnd-n.coverStart?re=S.parentNode.getBoundingClientRect():re=js(m(S,W,X).getClientRects(),r),re.left||re.right||W==0)break;X=W,W=W-1,J="right"}G&&H<11&&(re=Hs(e.display.measure,re))}else{W>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&&!W&&(!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],tt={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&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=Ce,tt.rbottom=Ie),tt}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&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var 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 W=kr(t);if(r=="local"?W+=Bn(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();W+=X.top+(r=="window"?0:so());var J=X.left+(r=="window"?0:oo());i.left+=J,i.right+=J}return i.top+=W,i.bottom+=W,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 W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:n-W.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=ki(e,r));function W(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 W(re=="before"?J-1:J,re=="before");function fe(Ie,Ne,je){var Ke=X[Ne],Qe=Ke.level==1;return W(je?Ie-1:Ie,Qe!=je)}var ge=ze(X,J,re),we=Xe,Ce=fe(J,ge,re=="before");return we!=null&&(Ce.other=fe(J,we,re!="before")),Ce}function uo(e,t){var i=0;t=ft(e.doc,t),e.options.lineWrapping||(i=Ri(e.display)*t.ch);var r=Ze(e.doc,t.line),n=kr(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=kt(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 W=Ze(r,n);;){var X=Gs(e,W,n,t,i),J=Ai(W,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;W=Ze(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,S=He(function(W){return Pr(e,i,W-1).bottom<=r},n,0);return n=He(function(W){return Pr(e,i,W).top>r},S,n),{begin:S,end:n}}function co(e,t,i,r){i||(i=ki(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-=kr(t);var S=ki(e,t),W=pa(t),X=0,J=t.text.length,re=!0,fe=$e(t,e.doc.direction);if(fe){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,S,fe,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+=W,st.bottom+=W,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+W<=n==re?"after":"before";var tt=Dr(e,Fe(i,Ie,je),"line",t,S);Ne=tt.left,Ke=n<tt.top?-1:n>=tt.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,W){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,W,!0)},0,n.length-1),J=n[X];if(X>0){var re=J.level!=1,fe=Dr(e,Fe(i,re?J.from:J.to,re?"after":"before"),"line",t,r);ya(fe,S,W,!0)&&fe.top>W&&(J=n[X-1])}return J}function Ks(e,t,i,r,n,S,W){var X=ho(e,t,r,W),J=X.begin,re=X.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var fe=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;(!fe||ge>je)&&(fe=Ce,ge=je)}return fe||(fe=n[n.length-1]),fe.from<J&&(fe={from:J,to:fe.to,level:fe.level}),fe.to>re&&(fe={from:fe.from,to:re,level:fe.level}),fe}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"))}d(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");d(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,W=0;S;S=S.nextSibling,++W){var X=e.display.gutterSpecs[W].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 W=0;W<n.widgets.length;W++)n.widgets[W].height&&(S+=n.widgets[W].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&>(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,W,X=n.lineSpace.getBoundingClientRect();try{S=t.clientX-X.left,W=t.clientY-X.top}catch(ge){return null}var J=va(e,S,W),re;if(r&&J.xRel>0&&(re=Ze(e.doc,J.line).text).length==J.ch){var fe=$(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))-fe))}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 W=Un(e,t,t,-1);W?(n.view=n.view.slice(0,W.index),n.viewTo=W.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 W=S.changes||(S.changes=[]);he(W,i)==-1&&W.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,W=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+=W[J].size;if(X!=t){if(r>0){if(n==W.length-1)return null;S=X+W[n].size-t,n++}else S=X-t;t+=S,i+=S}for(;Qi(e.doc,i)!=i;){if(n==(r<0?0:W.length-1))return null;i+=r*W[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(),W=0;W<i.sel.ranges.length;W++){if(!t&&W==i.sel.primIndex)continue;var X=i.sel.ranges[W];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(),W=qa(e.display),X=W.left,J=Math.max(r.sizerWidth,ui(e)-r.sizer.offsetLeft)-W.right,re=n.direction=="ltr";function fe(Ve,tt,ut,st){tt<0&&(tt=0),tt=Math.round(tt),st=Math.round(st),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
|
|
top: `+tt+"px; width: "+(ut==null?J-Ve:ut)+`px;
|
|
height: `+(st-tt)+"px"))}function ge(Ve,tt,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,tt||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=tt==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;fe(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),fe(yi,Bt.top,ar-yi,Bt.bottom),Bt.bottom<cr.top&&fe(X,Bt.bottom,null,cr.top),fe(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?(fe(Ke.right,Ke.top,null,Ke.bottom),fe(X,Qe.top,Qe.left,Qe.bottom)):fe(Ke.right,Ke.top,Qe.left-Ke.right,Ke.bottom)),Ke.bottom<Qe.top&&fe(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,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),B&&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,W=void 0,X=0;if(n.hidden)continue;if(G&&H<8){var J=n.node.offsetTop+n.node.offsetHeight;W=J-i,i=J}else{var re=n.node.getBoundingClientRect();W=re.bottom-re.top,!S&&n.text.firstChild&&(X=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var fe=n.line.height-W;if((fe>.005||fe<-.005)&&(gt(n.line,W),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=kt(t,r),W=kt(t,n);if(i&&i.ensure){var X=i.ensure.from.line,J=i.ensure.to.line;X<S?(S=X,W=kt(t,kr(Ze(t,X))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=W&&(S=kt(t,kr(Ze(t,J))-e.wrapper.clientHeight),W=J)}return{from:S,to:Math.max(W,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 W=!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),fe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(W=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(W=!0)),!W)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),W={};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)W.scrollTop=J?0:t.top;else if(t.bottom>n+S){var fe=Math.min(t.top,(re?X:t.bottom)-S);fe!=n&&(W.scrollTop=fe)}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?W.scrollLeft=0:t.left<we?W.scrollLeft=Math.max(0,t.left+ge-(Ie?0:10)):t.right>Ce+we-3&&(W.scrollLeft=t.right+(Ie?0:10)-Ce),W}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;O||La(e,{top:t}),Eo(e,t,!0),O&&La(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&&!k?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ne,this.disableVert=new ne},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&&j(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 W=0;W<t.length;W++)nl(t[W])}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==F();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,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var S=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(S)for(var X=0;X<S.length;++X)S[X].lines.length||oe(S[X],"hide");if(W)for(var J=0;J<W.length;++J)W[J].lines.length&&oe(W[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 W=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,fe=J.classes;fe?S.styleClasses=fe:re&&(S.styleClasses=null);for(var ge=!W||W.length!=S.styles.length||re!=fe&&(!re||!fe||re.bgClass!=fe.bgClass||re.textClass!=fe.textClass),we=0;!ge&&we<W.length;++we)ge=W[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){ae(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=F();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==F())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;Lo(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=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>W&&i.viewTo-W<20&&(W=Math.min(n,i.viewTo)),ir&&(S=Qi(e.doc,S),W=Vr(e.doc,W));var X=S!=i.viewFrom||W!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,S,W),i.viewOffset=kr(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 La(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,W=S.firstChild;function X(Ie){var Ne=Ie.nextSibling;return B&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Ne}for(var J=r.view,re=r.viewFrom,fe=0;fe<J.length;fe++){var ge=J[fe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=S){var we=Ns(e,ge,re,i);S.insertBefore(we,W)}else{for(;W!=ge.node;)W=X(W);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)))),W=ge.node.nextSibling}re+=ge.size}for(;W;)W=X(W)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+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",W=0;W<i.length;W++)if(!i[W].hidden){e.options.fixedGutter&&(i[W].gutter&&(i[W].gutter.style.left=S),i[W].gutterBackground&&(i[W].gutterBackground.style.left=S));var X=i[W].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 Lo(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,W=n.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var S=e[n],W=null;if(typeof S!="string"&&(W=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:S,style:W})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ko(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,W=n.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+S));W&&(X.style.cssText=W),S=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function cn(e){ko(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),!B&&!(O&&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),ko(n),i.init(n)}var Kn=0,br=null;G?br=-.53:O?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,W=S.scroller,X=W.scrollWidth>W.clientWidth,J=W.scrollHeight>W.clientHeight;if(!(r&&X||n&&J))return;if(n&&l&&B){e:for(var re=t.target,fe=S.view;re!=W;re=re.parentNode)for(var ge=0;ge<fe.length;ge++)if(fe[ge].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!O&&!T&&br!=null){n&&J&&ln(e,Math.max(0,W.scrollTop+n*br)),fi(e,Math.max(0,W.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),La(e,{top:Ce,bottom:Ie})}Kn<20&&(S.wheelStartX==null?(S.wheelStartX=W.scrollLeft,S.wheelStartY=W.scrollTop,S.wheelDX=r,S.wheelDY=n,setTimeout(function(){if(S.wheelStartX==null)return;var Ne=W.scrollLeft-S.wheelStartX,je=W.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(dt(t,r.from())>=0&&dt(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 dt(we.from(),Ce.from())}),i=he(t,n);for(var S=1;S<t.length;S++){var W=t[S],X=t[S-1],J=dt(X.to(),W.from());if(r&&!W.empty()?J>0:J>=0){var re=ii(X.from(),W.from()),fe=xi(X.to(),W.to()),ge=X.empty()?W.from()==W.head:X.from()==X.head;S<=i&&--i,t.splice(--S,2,new Rt(ge?fe:re,ge?re:fe))}}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(dt(e,t.from)<0)return e;if(dt(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,W=0;W<t.length;W++){var X=t[W],J=_o(X.from,n,S),re=_o(Zr(X),n,S);if(n=X.to,S=re,i=="around"){var fe=e.sel.ranges[W],ge=dt(fe.head,fe.anchor)<0;r[W]=new Rt(ge?re:J,ge?J:re)}else r[W]=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,tt){ua(Qe,Ve,tt,r),Jt(Qe,"change",Qe,t)}function W(Qe,Ve){for(var tt=[],ut=Qe;ut<Ve;++ut)tt.push(new li(re[ut],n(ut),r));return tt}var X=t.from,J=t.to,re=t.text,fe=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,W(0,re.length)),e.remove(re.length,e.size-re.length);else if(Mo(e,t)){var Ne=W(0,re.length-1);S(ge,ge.text,Ce),Ie&&e.remove(X.line,Ie),Ne.length&&e.insert(X.line,Ne)}else if(fe==ge)if(re.length==1)S(fe,fe.text.slice(0,X.ch)+we+fe.text.slice(J.ch),Ce);else{var je=W(1,re.length-1);je.push(new li(we+fe.text.slice(J.ch),Ce,r)),S(fe,fe.text.slice(0,X.ch)+re[0],n(0)),e.insert(X.line+1,je)}else if(re.length==1)S(fe,fe.text.slice(0,X.ch)+re[0]+ge.text.slice(J.ch),n(0)),e.remove(X.line+1,Ie);else{S(fe,fe.text.slice(0,X.ch)+re[0],n(0)),S(ge,we+ge.text.slice(J.ch),Ce);var Ke=W(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,W){if(n.linked)for(var X=0;X<n.linked.length;++X){var J=n.linked[X];if(J.doc==S)continue;var re=W&&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"?j: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,W,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)=="*"))&&(W=pl(n,n.lastOp==r)))X=s(W.changes),dt(t.from,t.to)==0&&dt(t.from,X.to)==0?X.to=Zr(t):W.changes.push(Pa(e,t));else{var J=s(n.done);for((!J||!J.ranges)&&Xn(e.sel,n.done),W={changes:[Pa(e,t)],generation:n.generation},n.done.push(W);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(W){W.markedSpans&&((n||(n=t["spans_"+e.id]={}))[S]=W.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],W=r[n];if(S&&W){e:for(var X=0;X<W.length;++X){for(var J=W[X],re=0;re<S.length;++re)if(S[re].marker==J.marker)continue e;S.push(J)}}else W&&(i[n]=W)}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 W=S.changes,X=[];r.push({changes:X});for(var J=0;J<W.length;++J){var re=W[J],fe=void 0;if(X.push({from:re.from,to:re.to,text:re.text}),t)for(var ge in re)(fe=ge.match(/^spans_(\d+)$/))&&(he(t,Number(fe[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=dt(t,n)<0;S!=dt(i,n)<0?(n=t,t=i):S!=dt(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 W=Rr(e.cm,r,e.sel.primIndex);tr(e,W,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(ft(e,n[S].anchor),ft(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){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(dt(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 W=t.ranges[S],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],J=Zn(e,W.anchor,X&&X.anchor,i,r),re=Zn(e,W.head,X&&X.head,i,r);(n||J!=W.anchor||re!=W.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 W=0;W<S.markedSpans.length;++W){var X=S.markedSpans[W],J=X.marker,re="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,fe="selectRight"in J?!J.selectRight:J.inclusiveRight;if((X.from==null||(re?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(fe?X.to>=t.ch:X.to>t.ch))){if(n&&(oe(J,"beforeCursorEnter"),J.explicitlyCleared))if(S.markedSpans){--W;continue}else break;if(!J.atomic)continue;if(i){var ge=J.find(r<0?1:-1),we=void 0;if((r<0?fe:re)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?S:null)),ge&&ge.line==t.line&&(we=dt(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:fe)&&(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,W=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 W||(e.cantEdit=!0,Fe(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ft(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,W,X){n&&(r.from=ft(e,n)),S&&(r.to=ft(e,S)),W&&(r.text=W),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((ae(e,"beforeChange")||e.cm&&ae(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]==""&&dt(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,W=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}W=S}else if(r){X.push(S);return}else break;var fe=[];Xn(W,J),J.push({changes:fe,generation:n.generation}),n.generation=S.generation||++n.maxGeneration;for(var ge=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),we=function(Ne){var je=S.changes[Ne];if(je.origin=t,ge&&!Yo(e,je,!1))return X.length=0,{};fe.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,tt){!tt&&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,W=t.to,X=!1,J=S.line;e.options.lineWrapping||(J=mt(yr(Ze(r,S.line))),r.iter(J,W.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-(W.line-S.line)-1;t.full?lr(e):S.line==W.line&&t.text.length==1&&!Mo(e.doc,t)?Xr(e,S.line,"text"):lr(e,S.line,W.line+1,re);var fe=ae(e,"changes"),ge=ae(e,"change");if(ge||fe){var we={from:S,to:W,text:t.text,removed:t.removed,origin:t.origin};ge&&Jt(e,"change",e,we),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function Bi(e,t,i,r,n){var S;r||(r=i),dt(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],W=!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){W=!1;break}}W||(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),W=r.height;if(r.removeInner(e,S),this.height-=W-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 W=n.lines.length%25+25,X=W;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,W),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 W=Math.min(t,S-e);if(n.iterN(e,W,i))return!0;if((t-=W)==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){kr(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(W){var X=W.widgets||(W.widgets=[]);if(n.insertAt==null?X.push(n):X.splice(Math.min(X.length-1,Math.max(0,n.insertAt)),0,n),n.line=W,S&&!_r(e,W)){var J=kr(W)<e.scrollTop;gt(W,W.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),ae(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 W=this.lines[S],X=Lr(W.markedSpans,this);e&&!this.collapsed?Xr(e,mt(W),"text"):e&&(X.to!=null&&(n=mt(W)),X.from!=null&&(r=mt(W))),W.markedSpans=Ji(W.markedSpans,X),X.from==null&&this.collapsed&&!_r(this.doc,W)&&e&>(W,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]),fe=en(re);fe>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=fe,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],W=Lr(S.markedSpans,this);if(W.from!=null&&(i=Fe(t?S:mt(S),W.from),e==-1))return i;if(W.to!=null&&(r=Fe(t?S:mt(S),W.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),W=fa(r,S);if(W&&(no(W),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&>(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),W=dt(t,i);if(r&&P(r,S,!1),W>0||W==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&>(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)&>(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 fe=t.line;fe<=i.line;fe++)Xr(J,fe,"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)],W=S[0],X=r.widgetNode;return Jr(e,function(J){X&&(r.widgetNode=X.cloneNode(!0)),S.push(Fi(J,ft(J,t),ft(J,i),r,n));for(var re=0;re<J.linked.length;++re)if(J.linked[re].isParent)return;W=s(S)}),new bn(S,W)}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),W=e.clipPos(n.to);if(dt(S,W)){var X=Fi(e,S,W,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 W=0;W<n.markers.length;W++){var X=n.markers[W];he(S,X.doc)==-1&&(X.parent=null,n.markers.splice(W--,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=ft(this,t),i=i?ft(this,i):t,Bi(this,e,t,i,r)},getRange:function(e,t,i){var r=wt(this,ft(this,e),ft(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 ft(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,ft(this,typeof e=="number"?Fe(e,t||0):e),null,i)}),setSelection:Kt(function(e,t,i){Wo(this,ft(this,e),ft(this,t||e),i)}),extendSelection:Kt(function(e,t,i){Yn(this,ft(this,e),t&&ft(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(ft(this,e[n].anchor),ft(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(ft(this,e),ft(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 W=n.ranges[S];r[S]={from:W.from(),to:W.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 W=S.match(x(i));if(!W)return!1;var X=W.index+W[0].length;r[n]=S.slice(0,W.index)+(!W.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,ft(this,e),ft(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=ft(this,e),Fi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ft(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=ft(this,e),t=ft(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(S){var W=S.markedSpans;if(W)for(var X=0;X<W.length;X++){var J=W[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}),ft(this,Fe(i,t))},indexFromPos:function(e){e=ft(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),W=0,X=function(){++W==n&&zt(t,function(){i=ft(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(ft(t.doc,i),ft(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 fe=e.dataTransfer.getData("Text");if(fe){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(fe,"around","paste"),t.display.input.focus()}}catch(Ce){}}}function Ll(e,t){if(G&&(!e.state.draggingText||+new Date-is<100)){ce(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 kl(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)),d(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,W=0;W<t.length-1;W++){var X=t[W];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 W=void 0,X=void 0;S==n.length-1?(X=n.join(" "),W=r):(X=n.slice(0,S+1).join(" "),W="...");var J=t[X];if(!J)t[X]=W;else if(J!=W)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 W=Ui(e,t.fallthrough[S],i,r);if(W)return W}}}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&&dt(S.from,s(r).to)<=0;){var W=r.pop();if(dt(W.from,S.from)<0){S.from=W.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 W=n<0?s(S):S[0],X=n<0==(W.level==1),J=X?"after":"before",re;if(W.level>0||t.doc.direction=="rtl"){var fe=ki(t,i);re=n<0?i.text.length-1:0;var ge=Pr(t,fe,re).top;re=He(function(we){return Pr(t,fe,we).top==ge},n<0==(W.level==1)?W.from:W.to-1,re),J=="before"&&(re=Ba(i,re,1))}else re=n<0?W.to:W.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),W=n[S];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>i.ch:W.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||ki(e,t),co(e,t,J,Ke)):{begin:0,end:t.text.length}},fe=re(i.sticky=="before"?X(i,-1):i.ch);if(e.doc.direction=="rtl"||W.level==1){var ge=W.level==1==r<0,we=X(i,ge?1:-1);if(we!=null&&(ge?we<=W.to&&we<=fe.end:we>=W.from&&we>=fe.begin)){var Ce=ge?"before":"after";return new Fe(i.line,we,Ce)}}var Ie=function(Ke,Qe,Ve){for(var tt=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 tt(vt,st);if(vt=st?ut.from:X(ut.to,-1),Ve.begin<=vt&&vt<Ve.end)return tt(vt,st)}},Ne=Ie(S+r,r,fe);if(Ne)return Ne;var je=r>0?fe.end:X(fe.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:ft(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(),W=$(e.getLine(S.line),S.ch,r);t.push(z(r-W%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 W=Ze(e.doc,n.line-1).text;W&&(n=new Fe(n.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),Fe(n.line-1,W.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/)),W=t.line==i.line&&t.ch<=S&&t.ch;return Fe(i.line,W?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)!=ke}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 ne;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=F(),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")),O&&!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;j(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&&dt(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)){B||(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&&(L?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(W){if(typeof W=="string"&&(W=Sn[W]),!W)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=W(e,i)!=ke}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=F();var n=Gl(e,i,r),S=e.doc.sel,W;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(W=S.contains(t))>-1&&(dt((W=S.ranges[W]).from(),t)<0||t.xRel>0)&&(dt(W.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,W=zt(e,function(re){B&&(n.scroller.draggable=!1),e.state.draggingText=!1,qe(n.wrapper.ownerDocument,"mouseup",W),qe(n.wrapper.ownerDocument,"mousemove",X),qe(n.scroller,"dragstart",J),qe(n.scroller,"drop",W),S||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),B&&!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};B&&(n.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Re(n.wrapper.ownerDocument,"mouseup",W),Re(n.wrapper.ownerDocument,"mousemove",X),Re(n.scroller,"dragstart",J),Re(n.scroller,"drop",W),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),ft(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 W,X,J=S.sel,re=J.ranges;if(r.addNew&&!r.extend?(X=S.sel.contains(i),X>-1?W=re[X]:W=new Rt(i,i)):(W=S.sel.primary(),X=S.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Rt(i,i)),i=di(e,t,!0,!0),X=-1;else{var fe=ys(e,i,r.unit);r.extend?W=Ia(W,fe.anchor,fe.head,r.extend):W=fe}r.addNew?X==-1?(X=re.length,tr(S,Rr(e,re.concat([W]),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,W,Le):(X=0,tr(S,new xr([W],0),Le),J=S.sel);var ge=i;function we(Ve){if(dt(ge,Ve)==0)return;if(ge=Ve,r.unit=="rectangle"){for(var tt=[],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?tt.push(new Rt(Fe(Nt,jt),Fe(Nt,jt))):hr.length>jt&&tt.push(new Rt(Fe(Nt,jt),Fe(Nt,Se(hr,Vt,ut))))}tt.length||tt.push(new Rt(i,i)),tr(S,Rr(e,J.ranges.slice(0,X).concat(tt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var dr=W,Qt=ys(e,Ve,r.unit),Gt=dr.anchor,Wt;dt(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(ft(S,Gt),Wt)),tr(S,Rr(e,Bt,X),Le)}}var Ce=n.wrapper.getBoundingClientRect(),Ie=0;function Ne(Ve){var tt=++Ie,ut=di(e,Ve,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,ge)!=0){e.curOp.focus=F(),we(ut);var st=Hn(n,S);(ut.line>=st.to||ut.line<st.from)&&setTimeout(zt(e,function(){Ie==tt&&Ne(Ve)}),150)}else{var vt=Ve.clientY<Ce.top?-20:Ve.clientY>Ce.bottom?20:0;vt&&setTimeout(zt(e,function(){if(Ie!=tt)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(dt(i,r)==0&&i.sticky==r.sticky)return t;var S=$e(n);if(!S)return t;var W=ze(S,i.ch,i.sticky),X=S[W];if(X.from!=i.ch&&X.to!=i.ch)return t;var J=W+(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 fe=ze(S,r.ch,r.sticky),ge=fe-W||(r.ch-i.ch)*(X.level==1?-1:1);fe==J-1||fe==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 W=e.display,X=W.lineDiv.getBoundingClientRect();if(S>X.bottom||!ae(e,i))return ue(t);S-=X.top-W.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var re=W.gutters.childNodes[J];if(re&&re.getBoundingClientRect().right>=n){var fe=kt(e.doc,S),ge=e.display.gutterSpecs[J];return oe(e,i,e,fe,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;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(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,W){e.defaults[r]=n,S&&(t[r]=W?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=[],W=r.doc.first;r.doc.iter(function(J){for(var re=0;;){var fe=J.text.indexOf(n,re);if(fe==-1)break;re=fe+n.length,S.push(Fe(W,fe))}W++});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",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),cn(r)},!0),i("keyMap","default",function(r,n,S){var W=qn(n),X=S!=Wi&&qn(S);X&&X.detach&&X.detach(r,W),W.attach&&W.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?(j(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 ne,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 W in ta)ta.hasOwnProperty(W)&&ta[W](this,t[W],Wi);Lo(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ga.length;++X)Ga[X](this);gi(this),B&&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 fe=e.findWordAt(re);Yn(e.doc,fe.anchor,fe.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 W(J,re){if(re.left==null)return!0;var fe=re.left-J.left,ge=re.top-J.top;return fe*fe+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 fe=e.coordsChar(t.activeTouch,"page"),ge;!re.prev||W(re,re.prev)?ge=new Rt(fe,fe):!re.prev.prev||W(re,re.prev.prev)?ge=e.findWordAt(fe):ge=new Rt(Fe(fe.line,0),ft(e.doc,Fe(fe.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)||ce(J)},over:function(J){q(e,J)||(kl(e,J),ce(J))},start:function(J){return Ll(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 W=e.options.tabSize,X=Ze(n,t),J=$(X.text,null,W);X.stateAfter&&(X.stateAfter=null);var re=X.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(X.text))fe=0,i="not";else if(i=="smart"&&(fe=n.mode.indent(S,X.text.slice(re.length),X.text),fe==ke||fe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?fe=$(Ze(n,t-1).text,null,W):fe=0:i=="add"?fe=J+e.options.indentUnit:i=="subtract"?fe=J-e.options.indentUnit:typeof i=="number"&&(fe=J+i),fe=Math.max(0,fe);var ge="",we=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(fe/W);Ce;--Ce)we+=W,ge+=" ";if(we<fe&&(ge+=z(fe-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 W=+new Date-200,X=n=="paste"||e.state.pasteIncoming>W,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 fe=0;fe<Or.text.length;fe++)re.push(S.splitLines(Or.text[fe]))}}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>W?"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),W=!1;if(S.electricChars){for(var X=0;X<S.electricChars.length;X++)if(t.indexOf(S.electricChars.charAt(X))>-1){W=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))&&(W=An(e,n.head.line,"smart")));W&&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 Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return B?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(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,W=S[r];if(S[r]==n&&r!="mode")return;S[r]=n,t.hasOwnProperty(r)&&zt(this,t[r])(this,n,W),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(W){return W.priority}),this.state.modeGen++,lr(this)}),removeOverlay:nr(function(r){for(var n=this.state.overlays,S=0;S<n.length;++S){var W=n[S].modeSpec;if(W==r||typeof r=="string"&&W.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,W=0;W<n.length;W++){var X=n[W];if(X.empty())X.head.line>S&&(An(this,X.head.line,r,!0),S=X.head.line,W==this.doc.sel.primIndex&&_i(this));else{var J=X.from(),re=X.to(),fe=Math.max(S,J.line);S=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ge=fe;ge<S;++ge)An(this,ge,r);var we=this.doc.sel.ranges;J.ch==0&&n.length==we.length&&we[W].from().ch>0&&Na(this.doc,W,new Rt(J,we[W].to()),xe)}}}),getTokenAt:function(r,n){return kn(this,r,n)},getLineTokens:function(r,n){return kn(this,Fe(r),n,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var n=ni(this,Ze(this.doc,r.line)),S=0,W=(n.length-1)/2,X=r.ch,J;if(X==0)J=n[2];else for(;;){var re=S+W>>1;if((re?n[re*2-1]:0)>=X)W=re;else if(n[re*2+1]<X)S=re+1;else{J=n[re*2+2];break}}var fe=J?J.indexOf("overlay "):-1;return fe<0?J:fe==0?null:J.slice(0,fe-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 W=i[n],X=this.getModeAt(r);if(typeof X[n]=="string")W[X[n]]&&S.push(W[X[n]]);else if(X[n])for(var J=0;J<X[n].length;J++){var re=W[X[n][J]];re&&S.push(re)}else X.helperType&&W[X.helperType]?S.push(W[X.helperType]):W[X.name]&&S.push(W[X.name]);for(var fe=0;fe<W._global.length;fe++){var ge=W._global[fe];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,W=this.doc.sel.primary();return r==null?S=W.head:typeof r=="object"?S=ft(this.doc,r):S=r?W.from():W.to(),Dr(this,S,n||"page")},charCoords:function(r,n){return ma(this,ft(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,kt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,S){var W=!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,W=!0),X=Ze(this.doc,r)}else X=r;return Fn(this,X,{top:0,left:0},n||"page",S||W).top+(W?this.doc.height-kr(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,W,X){var J=this.display;r=Dr(this,ft(this.doc,r));var re=r.bottom,fe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),W=="over")re=r.top;else if(W=="above"||W=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),we=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(W=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(re=r.bottom),fe+n.offsetWidth>we&&(fe=we-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",X=="right"?(fe=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(X=="left"?fe=0:X=="middle"&&(fe=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=fe+"px"),S&&Zs(this,{left:fe,top:re,right:fe+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,W){var X=1;n<0&&(X=-1,n=-n);for(var J=ft(this.doc,r),re=0;re<n&&!(J=Ka(this.doc,J,X,S,W),J.hitSide);++re);return J},moveH:nr(function(r,n){var S=this;this.extendSelectionsBy(function(W){return S.display.shift||S.doc.extend||W.empty()?Ka(S.doc,W.head,r,n,S.options.rtlMoveVisually):r<0?W.from():W.to()},Te)}),deleteH:nr(function(r,n){var S=this.doc.sel,W=this.doc;S.somethingSelected()?W.replaceSelection("",null,"+delete"):ji(this,function(X){var J=Ka(W,X.head,r,n,!1);return r<0?{from:J,to:X.head}:{from:X.head,to:J}})}),findPosV:function(r,n,S,W){var X=1,J=W;n<0&&(X=-1,n=-n);for(var re=ft(this.doc,r),fe=0;fe<n;++fe){var ge=Dr(this,re,"div");if(J==null?J=ge.left:ge.left=J,re=ks(this,ge,X,S),re.hitSide)break}return re},moveV:nr(function(r,n){var S=this,W=this.doc,X=[],J=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(fe){if(J)return r<0?fe.from():fe.to();var ge=Dr(S,fe.head,"div");fe.goalColumn!=null&&(ge.left=fe.goalColumn),X.push(ge.left);var we=ks(S,ge,r,n);return n=="page"&&fe==W.sel.primary()&&wa(S,ma(S,we,"div").top-ge.top),we},Te),X.length)for(var re=0;re<W.sel.ranges.length;re++)W.sel.ranges[re].goalColumn=X[re]}),findWordAt:function(r){var n=this.doc,S=Ze(n,r.line).text,W=r.ch,X=r.ch;if(S){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||X==S.length)&&W?--W:++X;for(var re=S.charAt(W),fe=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)};W>0&&fe(S.charAt(W-1));)--W;for(;X<S.length&&fe(S.charAt(X));)++X}return new Rt(Fe(r.line,W),Fe(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==F()},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,W=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=W(r)),n!=null&&(this.display.wrapper.style.height=W(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),ka(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,W){e.registerHelper(r,n,W),i[r]._global.push({pred:S,val:W})}}function Ka(e,t,i,r,n){var S=t,W=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 fe(Qe){var Ve;if(r=="codepoint"){var tt=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ve=null:Ve=new Fe(t.line,Math.max(0,Math.min(X.text.length,t.ch+i*(tt>=55296&&tt<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")fe();else if(r=="column")fe(!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&&!fe(!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,fe(),t.sticky="after");break}if(je&&(ge=je),i>0&&!fe(!Ie))break}var Ke=Zn(e,t,S,W,!0);return ri(S,Ke)&&(Ke.hitSide=!0),Ke}function ks(e,t,i,r){var n=e.doc,S=t.left,W;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);W=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(W=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,S,W),!re.outside);){if(i<0?W<=0:W>=n.height){re.hitSide=!0;break}W+=i*5}return re}var Ot=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ne,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 W(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 fe=Ls(),ge=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),ge.value=Or.text.join(`
|
|
`);var we=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(fe),we.focus(),we==n&&i.showPrimarySelection()},50)}Re(n,"copy",W),Re(n,"cut",W)},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),W=ia(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&W&&!W.bad&&dt(ii(S,W),r)==0&&dt(xi(S,W),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 fe=X[X.length-1].measure,ge=fe.maps?fe.maps[fe.maps.length-1]:fe.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&&(!O&&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):O&&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){d(this.cm.display.cursorDiv,e.cursors),d(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(h&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var 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,W,X;r.line==t.viewFrom||(S=ci(e,r.line))==0?(W=mt(t.view[0].line),X=t.view[0].node):(W=mt(t.view[S].line),X=t.view[S-1].node.nextSibling);var J=ci(e,n.line),re,fe;if(J==t.view.length-1?(re=t.viewTo-1,fe=t.lineDiv.lastChild):(re=mt(t.view[J+1].line)-1,fe=t.view[J+1].node.previousSibling),!X)return!1;for(var ge=e.doc.splitLines(tu(e,X,fe,W,re)),we=wt(e.doc,Fe(W,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(),W++;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),tt=Math.min(Qe.length-(ge.length==1?Ce:0),Ve.length-(we.length==1?Ce:0));Ie<tt&&Qe.charCodeAt(Qe.length-Ie-1)==Ve.charCodeAt(Ve.length-Ie-1);)++Ie;if(ge.length==1&&we.length==1&&W==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(W,Ce),st=Fe(re,we.length?s(we).length-Ie:0);if(ge.length>1||ge[0]||dt(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),W="left";if(S){var X=ze(S,t.ch);W=X%2?"right":"left"}var J=io(n.map,t.ch,W);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="",W=!1,X=e.doc.lineSeparator(),J=!1;function re(Ce){return function(Ie){return Ie.id==Ce}}function fe(){W&&(S+=X,J&&(S+=X),W=J=!1)}function ge(Ce){Ce&&(fe(),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&&fe();for(var Ve=0;Ve<Ce.childNodes.length;Ve++)we(Ce.childNodes[Ve]);/^(pre|p)$/i.test(Ce.nodeName)&&(J=!0),Qe&&(W=!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 W=t.nodeType==3?t:null,X=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,i&&(i=W.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var J=e.measure,re=J.maps;function fe(je,Ke,Qe){for(var Ve=-1;Ve<(re?re.length:0);Ve++)for(var tt=Ve<0?J.map:re[Ve],ut=0;ut<tt.length;ut+=3){var st=tt[ut+2];if(st==je||st==Ke){var vt=mt(Ve<0?e.line:e.rest[Ve]),Mt=tt[ut]+Qe;return(Qe<0||st!=je)&&(Mt=tt[ut+(Qe?1:0)]),Fe(vt,Mt)}}}var ge=fe(W,X,i);if(ge)return Hi(ge,n);for(var we=X.nextSibling,Ce=W?W.nodeValue.length-i:0;we;we=we.nextSibling){if(ge=fe(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=fe(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 ne,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),C&&(n.style.width="0px"),Re(n,"input",function(){G&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Re(n,"paste",function(W){if(q(r,W)||Ts(W,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function S(W){if(q(r,W))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}),W.type=="cut"?r.setSelections(X.ranges,null,xe):(i.prevInput="",n.value=X.text.join(`
|
|
`),V(n))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(n,"cut",S),Re(n,"copy",S),Re(e.scroller,"paste",function(W){if(Wr(e,W)||q(r,W))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var X=new Event("paste");X.clipboardData=W.clipboardData,n.dispatchEvent(X)}),Re(e.lineSpace,"selectstart",function(W){Wr(e,W)||te(W)}),Re(n,"compositionstart",function(){var W=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:W,range:r.markText(W,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=Ls(),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(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+W.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+W.left-S.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,i=t.display;d(i.cursorDiv,e.cursors),d(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||F()!=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||rt(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 W=0,X=Math.min(r.length,n.length);W<X&&r.charCodeAt(W)==n.charCodeAt(W);)++W;return pr(t,function(){za(t,n.slice(W),r.length-W,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),W=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,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.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;B&&(ge=window.scrollY),r.input.focus(),B&&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=W),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(),L){ce(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=F();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 W=S.submit=function(){r(),S.submit=n,S.submit(),S.submit=W}}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=ke,e.signal=oe,e.Line=li,e.changeEnd=Zr,e.scrollbarModel=To,e.Pos=Fe,e.cmpPos=dt,e.modes=Lt,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=ce,e.addClass=j,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(ht,et,pe){"use strict";pe.r(et),pe.d(et,"ResizableTextArea",function(){return he});var de=pe("wx14"),Z=pe("1OyB"),O=pe("vuIU"),Q=pe("Ji7U"),U=pe("LK+K"),D=pe("q1tI"),G=pe("VTBJ"),H=pe("rePB"),B=pe("Zm9Q"),_=pe("Kwbf"),y=pe("c+Xe"),T=pe("m+aA"),I=pe("bdgK"),k=new Map;function A(xe){xe.forEach(function(Le){var Te,Se=Le.target;(Te=k.get(Se))===null||Te===void 0||Te.forEach(function(ye){return ye(Se)})})}var C=new I.default(A),h=null,o=null;function l(xe,Le){k.has(xe)||(k.set(xe,new Set),C.observe(xe)),k.get(xe).add(Le)}function u(xe,Le){k.has(xe)&&(k.get(xe).delete(Le),k.get(xe).size||(C.unobserve(xe),k.delete(xe)))}var w=function(xe){Object(Q.a)(Te,xe);var Le=Object(U.a)(Te);function Te(){return Object(Z.a)(this,Te),Le.apply(this,arguments)}return Object(O.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(D.Component),v=D.createContext(null);function g(xe){var Le=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},Le)}function L(xe){var Le=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(Le)&&Object(y.c)(Le),R=c?Le.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,De=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,it=Object(G.a)(Object(G.a)({},$e),{},{offsetWidth:Je,offsetHeight:Re});z==null||z(it,be,De),Oe&&Promise.resolve().then(function(){Oe(it,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(w,{ref:ye},c?D.cloneElement(Le,{ref:Y}):Le)}var x="rc-observer-key";function f(xe){var Le=xe.children,Te=Object(B.a)(Le);return Te.map(function(Se,ye){var z=(Se==null?void 0:Se.key)||"".concat(x,"-").concat(ye);return D.createElement(L,Object(de.a)({},xe,{key:z}),Se)})}f.Collection=g;var p=f,d=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"],F={},j;function K(xe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Le&&F[Te])return F[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 Le&&Te&&(F[Te]=R),R}function V(xe){var Le=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;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),xe.getAttribute("wrap")?j.setAttribute("wrap",xe.getAttribute("wrap")):j.removeAttribute("wrap");var ye=K(xe,Le),z=ye.paddingSize,s=ye.borderSize,c=ye.boxSizing,R=ye.sizingStyle;j.setAttribute("style","".concat(R,";").concat(m)),j.value=xe.value||xe.placeholder||"";var Y=Number.MIN_SAFE_INTEGER,N=Number.MAX_SAFE_INTEGER,se=j.scrollHeight,be;if(c==="border-box"?se+=s:c==="content-box"&&(se-=z),Te!==null||Se!==null){j.value=" ";var Ae=j.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 ne=function(xe){Object(Q.a)(Te,xe);var Le=Object(U.a)(Te);function Te(Se){var ye;return Object(Z.a)(this,Te),ye=Le.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,De=Object(d.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=b()(c,N,Object(H.a)({},"".concat(c,"-disabled"),se));"value"in De&&(De.value=De.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(de.a)({},De,{className:_e,style:Pe,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:$.NONE},ye}return Object(O.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=ne,me=function(xe){Object(Q.a)(Te,xe);var Le=Object(U.a)(Te);function Te(Se){var ye;Object(Z.a)(this,Te),ye=Le.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(O.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(de.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),ke=et.default=me},Zss7:function(ht,et,pe){var de;(function(Z){var O=/^\s+/,Q=/\s+$/,U=0,D=Z.round,G=Z.min,H=Z.max,B=Z.random;function _(s,c){if(s=s||"",c=c||{},s instanceof _)return s;if(!(this instanceof _))return new _(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++}_.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 h(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:j[h(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=_(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 _(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(L,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(w,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(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},_.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]=ke(s[Y]));s=R}return _(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=ke(s.s),N=ke(s.v),c=C(s.h,Y,N),be=!0,Ae="hsv"):Se(s.h)&&Se(s.s)&&Se(s.l)&&(Y=ke(s.s),se=ke(s.l),c=k(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 k(s,c,R){var Y,N,se;s=M(s,360),c=M(c,100),R=M(R,100);function be(De,_e,Pe){return Pe<0&&(Pe+=1),Pe>1&&(Pe-=1),Pe<1/6?De+(_e-De)*6*Pe:Pe<1/2?_e:Pe<2/3?De+(_e-De)*(2/3-Pe)*6:De}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 C(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,De=[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:De*255,g:_e*255,b:Pe*255}}function h(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("")}_.equals=function(s,c){return!s||!c?!1:_(s).toRgbString()==_(c).toRgbString()},_.random=function(){return _.fromRatio({r:B(),g:B(),b:B()})};function u(s,c){c=c===0?0:c||10;var R=_(s).toHsl();return R.s-=c/100,R.s=P(R.s),_(R)}function w(s,c){c=c===0?0:c||10;var R=_(s).toHsl();return R.s+=c/100,R.s=P(R.s),_(R)}function v(s){return _(s).desaturate(100)}function g(s,c){c=c===0?0:c||10;var R=_(s).toHsl();return R.l+=c/100,R.l=P(R.l),_(R)}function L(s,c){c=c===0?0:c||10;var R=_(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)))),_(R)}function x(s,c){c=c===0?0:c||10;var R=_(s).toHsl();return R.l-=c/100,R.l=P(R.l),_(R)}function f(s,c){var R=_(s).toHsl(),Y=(R.h+c)%360;return R.h=Y<0?360+Y:Y,_(R)}function p(s){var c=_(s).toHsl();return c.h=(c.h+180)%360,_(c)}function d(s){var c=_(s).toHsl(),R=c.h;return[_(s),_({h:(R+120)%360,s:c.s,l:c.l}),_({h:(R+240)%360,s:c.s,l:c.l})]}function a(s){var c=_(s).toHsl(),R=c.h;return[_(s),_({h:(R+90)%360,s:c.s,l:c.l}),_({h:(R+180)%360,s:c.s,l:c.l}),_({h:(R+270)%360,s:c.s,l:c.l})]}function b(s){var c=_(s).toHsl(),R=c.h;return[_(s),_({h:(R+72)%360,s:c.s,l:c.l}),_({h:(R+216)%360,s:c.s,l:c.l})]}function m(s,c,R){c=c||6,R=R||30;var Y=_(s).toHsl(),N=360/R,se=[_(s)];for(Y.h=(Y.h-(N*c>>1)+720)%360;--c;)Y.h=(Y.h+N)%360,se.push(_(Y));return se}function E(s,c){c=c||6;for(var R=_(s).toHsv(),Y=R.h,N=R.s,se=R.v,be=[],Ae=1/c;c--;)be.push(_({h:Y,s:N,v:se})),se=(se+Ae)%1;return be}_.mix=function(s,c,R){R=R===0?0:R||50;var Y=_(s).toRgb(),N=_(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 _(be)},_.readability=function(s,c){var R=_(s),Y=_(c);return(Z.max(R.getLuminance(),Y.getLuminance())+.05)/(Z.min(R.getLuminance(),Y.getLuminance())+.05)},_.isReadable=function(s,c,R){var Y=_.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},_.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 De=0;De<c.length;De++)se=_.readability(s,c[De]),se>N&&(N=se,Y=_(c[De]));return _.isReadable(s,Y,{level:Ae,size:Oe})||!be?Y:(R.includeFallbackColors=!1,_.mostReadable(s,["#fff","#000"],R))};var F=_.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},j=_.hexNames=K(F);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){ne(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 ne(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 ke(s){return s<=1&&(s=s*100+"%"),s}function xe(s){return Z.round(parseFloat(s)*255).toString(16)}function Le(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(O,"").replace(Q,"").toLowerCase();var c=!1;if(F[s])s=F[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:Le(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:Le(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}}ht.exports?ht.exports=_:!(de=function(){return _}.call(et,pe,et,ht),de!==void 0&&(ht.exports=de))})(Math)},bT9E:function(ht,et,pe){"use strict";pe.d(et,"a",function(){return Z});var de=pe("VTBJ");function Z(O,Q){var U=Object(de.a)({},O);return Array.isArray(Q)&&Q.forEach(function(D){delete U[D]}),U}},c5Ni:function(ht,et,pe){},dejd:function(ht,et,pe){},dmUQ:function(ht,et,pe){"use strict";var de=pe("Ff2n"),Z=pe("rePB"),O=pe("1OyB"),Q=pe("vuIU"),U=pe("Ji7U"),D=pe("md7G"),G=pe("foSv"),H=pe("q1tI"),B=pe.n(H),_=pe("TSYQ"),y=pe.n(_),T=pe("4IlW");function I(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),b.push.apply(b,m)}return b}function k(d){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)(d,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):I(Object(b)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(b,m))})}return d}function A(d){var a=C();return function(){var m=Object(G.a)(d),E;if(a){var F=Object(G.a)(this).constructor;E=Reflect.construct(m,arguments,F)}else E=m.apply(this,arguments);return Object(D.a)(this,E)}}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function h(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,w=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},L=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},x=function(d){Object(U.a)(b,d);var a=A(b);function b(m){var E;Object(O.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 ne=E.getRatio(K);E.down(K,ne,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),ke=1;ke<he;ke++)me[ke-1]=arguments[ke];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,h);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,ne;M?ne=P:ne=E.toPrecisionAsStep($),ne==null&&(ne="");var he=E.formatWrapper(ne);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 F=m.value;F===void 0&&(F=m.defaultValue),E.state={focused:m.autoFocus};var j=E.getValidValue(E.toNumber(F));return E.state=k(k({},E.state),{},{inputValue:E.toPrecisionAsStep(j),value:j}),E}return Object(Q.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var F=this.props,j=F.value,K=F.onChange,V=F.max,M=F.min,P=this.state.focused;if(E){if(!L(E.value,j)||!L(E.max,V)||!L(E.min,M)){var $=P?j:this.getValidValue(j),ne;this.pressingUpOrDown?ne=$:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ne})}var he="value"in this.props?j: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(ke){}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 F=E;return F===""?F="":this.isNotCompleteNumber(parseFloat(F))?F=this.state.value:F=this.getValidValue(F),this.toNumber(F)}},{key:"getValueFromEvent",value:function(E){var F=E.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(F=F.replace(this.props.decimalSeparator,".")),F}},{key:"getValidValue",value:function(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(E);return isNaN(K)?E:(K<F&&(K=F),K>j&&(K=j),K)}},{key:"setValue",value:function(E,F){var j=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,ne=typeof K=="number"?K.toFixed(j):"".concat(K),he=K!==M||ne!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},F)):this.setState({value:K,inputValue:this.toPrecisionAsStep(E)},F),he&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,K=j.precision,V=j.step;if(g(K))return K;var M=this.getPrecision(F),P=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,M+P):M+P}},{key:"getPrecisionFactor",value:function(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(E,F);return Math.pow(10,j)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var F=Math.abs(this.getMaxPrecision(E));return isNaN(F)?E.toString():Number(E).toFixed(F)}},{key:"toNumber",value:function(E){var F=this.props.precision,j=this.state.focused,K=E&&E.length>16&&j;return this.isNotCompleteNumber(E)||K?E:g(F)?Math.round(E*Math.pow(10,F))/Math.pow(10,F):Number(E)}},{key:"upStep",value:function(E,F){var j=this.props.step,K=this.getPrecisionFactor(E,F),V=Math.abs(this.getMaxPrecision(E,F)),M=((K*E+K*j*F)/K).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(E,F){var j=this.props.step,K=this.getPrecisionFactor(E,F),V=Math.abs(this.getMaxPrecision(E,F)),M=((K*E-K*j*F)/K).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(E,F){var j=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),F&&(F.persist(),F.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),ne=$>M.max||$<M.min;if($>M.max?$=M.max:$<M.min&&($=M.min),this.setValue($,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),ne)return;this.autoStepTimer=setTimeout(function(){j[E](F,K,!0)},V?u:w)}},{key:"fixCaret",value:function(E,F){if(E===void 0||F===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,K=this.input.selectionEnd;(E!==j||F!==K)&&this.input.setSelectionRange(E,F)}catch(V){}}},{key:"render",value:function(){var E,F=this.props,j=F.prefixCls,K=F.disabled,V=F.readOnly,M=F.useTouch,P=F.autoComplete,$=F.upHandler,ne=F.downHandler,he=F.className,me=F.max,ke=F.min,xe=F.style,Le=F.title,Te=F.onMouseEnter,Se=F.onMouseLeave,ye=F.onMouseOver,z=F.onMouseOut,s=F.required,c=F.onClick,R=F.tabIndex,Y=F.type,N=F.placeholder,se=F.id,be=F.inputMode,Ae=F.pattern,Oe=F.step,De=F.maxLength,_e=F.autoFocus,Pe=F.name,He=F.onPaste,Ge=F.onInput,Xe=Object(de.a)(F,["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()(j,(E={},Object(Z.a)(E,he,!!he),Object(Z.a)(E,"".concat(j,"-disabled"),K),Object(Z.a)(E,"".concat(j,"-focused"),$e),E)),Re={};Object.keys(Xe).forEach(function(ce){(ce.substr(0,5)==="data-"||ce.substr(0,5)==="aria-"||ce==="role")&&(Re[ce]=Xe[ce])});var it=!V&&!K,qe=this.getInputDisplayValue(null),oe=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=me),q=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=ke),ee=oe||K||V,ae=q||K||V,le=y()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(Z.a)({},"".concat(j,"-handler-up-disabled"),ee)),te=y()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(Z.a)({},"".concat(j,"-handler-down-disabled"),ae)),ie=M?{onTouchStart:ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=M?{onTouchStart:ae?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return B.a.createElement("div",{className:Je,style:xe,title:Le,onMouseEnter:Te,onMouseLeave:Se,onMouseOver:ye,onMouseOut:z,onFocus:function(){return null},onBlur:function(){return null}},B.a.createElement("div",{className:"".concat(j,"-handler-wrap")},B.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:le}),$||B.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),B.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:te}),ne||B.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),B.a.createElement("div",{className:"".concat(j,"-input-wrap")},B.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":me,"aria-valuenow":ot,required:s,type:Y,placeholder:N,onPaste:He,onClick:c,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:R,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:it?this.onKeyDown:h,onKeyUp:it?this.onKeyUp:h,autoFocus:_e,maxLength:De,readOnly:V,disabled:K,max:me,min:ke,step:Oe,name:Pe,title:Le,id:se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:Ae,inputMode:be,onInput:Ge},Re))))}}]),b}(B.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var f=x,p=et.a=f},gkVt:function(ht,et,pe){"use strict";pe.r(et);var de=pe("DZo9"),Z=pe("8z0m"),O=pe("+L6B"),Q=pe("2/Rp"),U=pe("miYZ"),D=pe("tsqr"),G=pe("9og8"),H=pe("tJVT"),B=pe("WmNS"),_=pe.n(B),y=pe("q1tI"),T=pe.n(y),I=pe("5NDa"),k=pe("5rEg"),A=pe("Ot1p"),C=pe("ErOA");function h(d){var a=d.setIscreate,b=d.init,m=d.UpdateItem,E=Object(y.useState)(""),F=Object(H.a)(E,2),j=F[0],K=F[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 ne(){return he.apply(this,arguments)}function he(){return he=Object(G.a)(_.a.mark(function xe(){var Le;return _.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:if(j){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(C.a)("/api/hpc_courses.json",{method:"post",body:{name:j,description:P,container_type:window.location.pathname.split("/")[1]}});case 11:Le=Se.sent,Le&&(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 ke.apply(this,arguments)}function ke(){return ke=Object(G.a)(_.a.mark(function xe(){var Le;return _.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,Object(C.a)("/api/hpc_courses/".concat(m.id,".json"),{method:"put",body:{name:j,description:P,container_type:window.location.pathname.split("/")[1]}});case 2:Le=Se.sent,Le&&(D.b.info("\u7F16\u8F91\u6210\u529F"),a(!1),b(""));case 4:case"end":return Se.stop()}},xe)})),ke.apply(this,arguments)}return T.a.createElement("div",null,T.a.createElement(k.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:j,maxLength:60,addonAfter:String(j.length)+"/60",onChange:function(Le){return K(Le.target.value)}}),T.a.createElement(A.a,{id:"courseContentMD",defaultValue:P,onChange:function(Le){return $(Le)}}),T.a.createElement("div",{className:"clearfix mt30 mb30"},T.a.createElement(Q.a,{type:"primary",onClick:function(){return ne()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),T.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return a(!1)}},"\u53D6\u6D88")))}var o=h,l=pe("9Bee");function u(d){var a=d.CourseItem,b=d.userId,m=d.init,E=d.ItemUpdate,F=d.setSee,j=d.UserInfo;function K(){return V.apply(this,arguments)}function V(){return V=Object(G.a)(_.a.mark(function P(){var $;return _.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(C.a)("/api/hpc_courses/".concat(a.id,".json"),{method:"delete"});case 2:$=he.sent,$&&(D.b.info("\u5220\u9664\u6210\u529F"),m("delete"),F(!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||j!=null&&j.admin||j!=null&&j.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 w=u,v=pe("9ivq"),g=pe("m3rI"),L=pe("Ty5D"),x=pe("9kvl");function f(d){var a,b,m,E,F,j,K,V,M,P=d.user,$=d.dispatch,ne=Object(y.useState)(1),he=Object(H.a)(ne,2),me=he[0],ke=he[1],xe=Object(y.useState)(100),Le=Object(H.a)(xe,2),Te=Le[0],Se=Le[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],De=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),it=Re[0],qe=Re[1],oe=Object(L.i)(),q=oe.itemname,ee=Object(y.useState)(""),ae=Object(H.a)(ee,2),le=ae[0],te=ae[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)(_.a.mark(function Be(Ye){var We,pt,nt,rt,Tt;return _.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return xt.next=2,Object(C.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||((rt=nt.hpc_courses)===null||rt===void 0))||rt.map(function(Lt,Et){var qt;(q==null?void 0:q.toLocaleLowerCase())===(Lt==null||((qt=Lt.name)===null||qt===void 0)?void 0:qt.toLocaleLowerCase())&&(Tt=Et)}),Ge(We.data.hpc_courses[Tt]),De(!0),te(We.data.hpc_courses[Tt].id),(q==null?void 0:q.toLocaleLowerCase())==="resources"&&(Ge(We.data.hpc_courses.filter(function(Lt){return Lt.id===15})[0]),De(!0),te(15))):(Ge(We.data.hpc_courses[0]),De(!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 De(!1),xt.abrupt("return");case 18:Ge(We.data.hpc_courses[0]),De(!0),te(We.data.hpc_courses[0].id),xt.next=24;break;case 23:Ye==="add"?(Ge(We.data.hpc_courses[pt-1]),De(!0),te(We.data.hpc_courses[pt-1].id)):(Ge(We.data.hpc_courses.filter(function(Lt){return Lt.id===le})[0]),De(!0),te(le));case 24:case"end":return xt.stop()}},Be)})),ue.apply(this,arguments)}function ce(Be){se(!1),De(!0),Ge(Be),te(Be.id)}function ve(Be){$e(Be),se(!0),De(!1)}function Ee(){$e(""),se(!0),De(!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(it),")")}}),T.a.createElement("img",{style:{width:"100%"},src:g.a.IMG_SERVER+"/".concat(it)}),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 ce(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(w,{UserInfo:P==null?void 0:P.userInfo,setSee:De,userId:P==null||((F=P.userInfo)===null||F===void 0)?void 0:F.user_id,ItemUpdate:ve,CourseItem:He,init:ie}):null)),(P==null||((j=P.userInfo)===null||j===void 0)?void 0:j.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=et.default=Object(x.a)(function(d){var a=d.user;return{user:a}})(f)},h78n:function(ht,et,pe){"use strict";pe.d(et,"a",function(){return E});var de=pe("q1tI"),Z=pe.n(de),O=pe("TSYQ"),Q=pe.n(O),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(de.useRef)()}),M=Object(de.useRef)();return Object(de.useEffect)(function(){var P=Date.now(),$=!1;Object.keys(V).forEach(function(ne){var he=V[ne].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(j){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},G.apply(this,arguments)}function H(j,K){return I(j)||T(j,K)||_(j,K)||B()}function B(){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 _(j,K){if(!j)return;if(typeof j=="string")return y(j,K);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(j,K)}function y(j,K){(K==null||K>j.length)&&(K=j.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=j[V];return M}function T(j,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,P=!1,$=void 0;try{for(var ne=j[Symbol.iterator](),he;!(M=(he=ne.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(me){P=!0,$=me}finally{try{!M&&ne.return!=null&&ne.return()}finally{if(P)throw $}}return V}function I(j){if(Array.isArray(j))return j}function k(j,K){if(j==null)return{};var V=A(j,K),M,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(P=0;P<$.length;P++){if(M=$[P],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function A(j,K){if(j==null)return{};var V={},M=Object.keys(j),P,$;for($=0;$<M.length;$++){if(P=M[$],K.indexOf(P)>=0)continue;V[P]=j[P]}return V}var C=function(K){var V=K.className,M=K.percent,P=K.prefixCls,$=K.strokeColor,ne=K.strokeLinecap,he=K.strokeWidth,me=K.style,ke=K.trailColor,xe=K.trailWidth,Le=K.transition,Te=k(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(ne==="round"?R:0,",").concat(R,`
|
|
L `).concat(ne==="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:ne,stroke:ke,strokeWidth:xe||he,fillOpacity:"0"}),Se.map(function(Ae,Oe){var De={strokeDasharray:"".concat(Ae,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:Le||"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:ne,stroke:_e,strokeWidth:he,fillOpacity:"0",ref:c[Oe],style:De})}))};C.defaultProps=U;var h=C;function o(){return o=Object.assign||function(j){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},o.apply(this,arguments)}function l(j,K){return L(j)||g(j,K)||w(j,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 w(j,K){if(!j)return;if(typeof j=="string")return v(j,K);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(j,K)}function v(j,K){(K==null||K>j.length)&&(K=j.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=j[V];return M}function g(j,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,P=!1,$=void 0;try{for(var ne=j[Symbol.iterator](),he;!(M=(he=ne.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(me){P=!0,$=me}finally{try{!M&&ne.return!=null&&ne.return()}finally{if(P)throw $}}return V}function L(j){if(Array.isArray(j))return j}function x(j,K){if(j==null)return{};var V=f(j,K),M,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(P=0;P<$.length;P++){if(M=$[P],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function f(j,K){if(j==null)return{};var V={},M=Object.keys(j),P,$;for($=0;$<M.length;$++){if(P=M[$],K.indexOf(P)>=0)continue;V[P]=j[P]}return V}var p=0;function d(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function b(j,K,V,M){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ne=50-M/2,he=0,me=-ne,ke=0,xe=-2*ne;switch($){case"left":he=-ne,me=0,ke=2*ne,xe=0;break;case"right":he=ne,me=0,ke=-2*ne,xe=0;break;case"bottom":me=ne,xe=2*ne;break;default:}var Le="M 50,50 m ".concat(he,",").concat(me,`
|
|
a `).concat(ne,",").concat(ne," 0 1 1 ").concat(ke,",").concat(-xe,`
|
|
a `).concat(ne,",").concat(ne," 0 1 1 ").concat(-ke,",").concat(xe),Te=Math.PI*2*ne,Se={stroke:V,strokeDasharray:"".concat(K/100*(Te-P),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(P/2+j/100*(Te-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Le,pathStyle:Se}}var m=function(K){var V=K.prefixCls,M=K.strokeWidth,P=K.trailWidth,$=K.gapDegree,ne=K.gapPosition,he=K.trailColor,me=K.strokeLinecap,ke=K.style,xe=K.className,Le=K.strokeColor,Te=K.percent,Se=x(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ye=Object(de.useMemo)(function(){return p+=1,p},[]),z=b(0,100,he,M,$,ne),s=z.pathString,c=z.pathStyle,R=a(Te),Y=a(Le),N=Y.find(function(De){return Object.prototype.toString.call(De)==="[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,$,ne);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:ke},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(De,_e){return d(De)-d(_e)}).map(function(De,_e){return Z.a.createElement("stop",{key:_e,offset:De,stopColor:N[De]})}))),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,F={Line:h,Circle:E}},kSUc:function(ht,et,pe){},lZu9:function(ht,et,pe){(function(de){de(pe("VrN/"),pe("1eCo"),pe("8EBN"))})(function(de){"use strict";de.defineMode("markdown",function(Z,O){var Q=de.getMode(Z,"text/html"),U=Q.name=="null";function D(M){if(de.findModeByName){var P=de.findModeByName(M);P&&(M=P.mime||P.mimes[0])}var $=de.getMode(Z,M);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var 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)&&O.tokenTypeOverrides[H]&&(G[H]=O.tokenTypeOverrides[H]);var B=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,T=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,I=/^ {0,3}(?:\={1,}|-{2,})\s*$/,k=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(M,P,$){return P.f=P.inline=$,$(M,P)}function u(M,P,$){return P.f=P.block=$,$(M,P)}function w(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==L){var P=U;if(!P){var $=de.innerMode(Q,M.htmlState);P=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}P&&(M.f=d,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,ne=w(P.prevLine.stream),he=P.indentedCode,me=P.prevLine.hr,ke=P.list!==!1,xe=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var Le=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,ke)){for(P.list=null;Le<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=Le-P.listStack[P.listStack.length-1])}var Te=!ne&&!me&&!P.prevLine.header&&(!ke||!he)&&!P.prevLine.fencedCodeEnd,Se=(P.list===!1||me||ne)&&P.indentation<=xe&&M.match(B),ye=null;if(P.indentationDiff>=4&&(he||P.prevLine.fencedCodeEnd||P.prevLine.header||ne))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,O.highlightFormatting&&(P.formatting="header"),P.f=P.inline,f(P);if(P.indentation<=xe&&M.eat(">"))return P.quote=$?1:P.quote+1,O.highlightFormatting&&(P.formatting="quote"),M.eatSpace(),f(P);if(!Se&&!P.setext&&$&&P.indentation<=xe&&(ye=M.match(_))){var z=ye[1]?"ol":"ul";return P.indentation=Le+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,O.taskLists&&M.match(y,!1)&&(P.taskList=!0),P.f=P.inline,O.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=O.fencedCodeBlockHighlighting&&D(ye[2]||O.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=de.startState(P.localMode)),P.f=P.block=x,O.highlightFormatting&&(P.formatting="code-block"),P.code=-1,f(P);if(P.setext||(!Te||!ke)&&!P.quote&&P.list===!1&&!P.code&&!Se&&!C.test(M.string)&&(ye=M.lookAhead(1))&&(ye=ye.match(I)))return P.setext?(P.header=P.setext,P.setext=0,M.skipToEnd(),O.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,F)}return l(M,P,P.inline)}function L(M,P){var $=Q.token(M,P.htmlState);if(!U){var ne=de.innerMode(Q,P.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||P.md_inside&&M.current().indexOf(">")>-1)&&(P.f=d,P.block=g,P.htmlState=null)}return $}function x(M,P){var $=P.listStack[P.listStack.length-1]||0,ne=P.indentation<$,he=$+3;if(P.fencedEndRE&&P.indentation<=he&&(ne||M.match(P.fencedEndRE))){O.highlightFormatting&&(P.formatting="code-block");var me;return ne||(me=f(P)),P.localMode=P.localState=null,P.block=g,P.f=d,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,ne?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"&&(!O.maxBlockquoteDepth||O.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),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?P.push(G.quote+"-"+M.quote):P.push(G.quote+"-"+O.maxBlockquoteDepth)),M.list!==!1){var ne=(M.listStack.length-1)%3;ne?ne===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(k,!0)?f(P):void 0}function d(M,P){var $=P.text(M,P);if(typeof $!="undefined")return $;if(P.list)return P.list=null,f(P);if(P.taskList){var ne=M.match(y,!0)[1]===" ";return ne?P.taskOpen=!0:P.taskClosed=!0,O.highlightFormatting&&(P.formatting="task"),P.taskList=!1,f(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&M.match(/^#+$/,!0))return O.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 ke="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(M.match(new RegExp(ke),!0))return G.linkHref}if(he==="`"){var xe=P.formatting;O.highlightFormatting&&(P.formatting="code"),M.eatWhile("`");var Le=M.current().length;if(P.code==0&&(!P.quote||Le==1))return P.code=Le,f(P);if(Le==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(),O.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,O.highlightFormatting&&(P.formatting="image"),f(P);if(he==="["&&P.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,O.highlightFormatting&&(P.formatting="image"),f(P);if(he==="]"&&P.imageAltText){O.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,O.highlightFormatting&&(P.formatting="link")),f(P);if(he==="]"&&P.linkText){O.highlightFormatting&&(P.formatting="link");var Se=f(P);return P.linkText=!1,P.inline=P.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?b:d,Se}if(he==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,O.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,O.highlightFormatting&&(P.formatting="link");var Se=f(P);return Se?Se+=" ":Se="",Se+G.linkEmail}if(O.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=de.startState(Q),u(M,P,L)}if(O.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)&&(!h.test(Y)||/\s/.test(R)||h.test(R)),se=!/\s/.test(R)&&(!h.test(R)||/\s/.test(Y)||h.test(Y)),be=null,Ae=null;if(c%2&&(!P.em&&N&&(he==="*"||!se||h.test(R))?be=!0:P.em==he&&se&&(he==="*"||!N||h.test(Y))&&(be=!1)),c>1&&(!P.strong&&N&&(he==="*"||!se||h.test(R))?Ae=!0:P.strong==he&&se&&(he==="*"||!N||h.test(Y))&&(Ae=!1)),Ae!=null||be!=null){O.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(O.strikethrough){if(he==="~"&&M.eatWhile(he)){if(P.strikethrough){O.highlightFormatting&&(P.formatting="strikethrough");var Te=f(P);return P.strikethrough=!1,Te}else if(M.match(/^[^\s]/,!1))return P.strikethrough=!0,O.highlightFormatting&&(P.formatting="strikethrough"),f(P)}else if(he===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return f(P);M.backUp(2)}}if(O.emoji&&he===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,O.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=d,O.highlightFormatting&&(P.formatting="link");var ne=f(P);return ne?ne+=" ":ne="",ne+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($==="("?")":"]"),O.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,f(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(M){return function(P,$){var ne=P.next();if(ne===M){$.f=$.inline=d,O.highlightFormatting&&($.formatting="link-string");var he=f($);return $.linkHref=!1,he}return P.match(m[M]),$.linkHref=!0,f($)}}function F(M,P){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=j,M.next(),O.highlightFormatting&&(P.formatting="link"),P.linkText=!0,f(P)):l(M,P,d)}function j(M,P){if(M.match(/^\]:/,!0)){P.f=P.inline=K,O.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=d,G.linkHref+" url")}var V={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:d,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&&de.copyState(Q,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?de.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!=L)){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==L?{state:M.htmlState,mode:Q}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,P,$){return M.block==L&&Q.indent?Q.indent(M.htmlState,P,$):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,P,$):de.Pass},blankLine:v,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),de.defineMIME("text/markdown","markdown"),de.defineMIME("text/x-markdown","markdown")})},osHv:function(ht,et,pe){(function(de){de(pe("VrN/"))})(function(de){"use strict";var Z=de.Pos;function O(h,o){return h.line-o.line||h.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(h,o,l,u){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=u?Math.max(u.from,h.firstLine()):h.firstLine(),this.max=u?Math.min(u.to-1,h.lastLine()):h.lastLine()}function H(h,o){var l=h.cm.getTokenTypeAt(Z(h.line,o));return l&&/\btag\b/.test(l)}function B(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function _(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function y(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(B(h))continue;return}if(!H(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function T(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(_(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}D.lastIndex=o,h.ch=o;var l=D.exec(h.text);if(l&&l.index==o)return l}}function I(h){for(;;){D.lastIndex=h.ch;var o=D.exec(h.text);if(!o){if(B(h))continue;return}if(!H(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function k(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(_(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function A(h,o){for(var l=[];;){var u=I(h),w,v=h.line,g=h.ch-(u?u[0].length:0);if(!u||!(w=y(h)))return;if(w=="selfClose")continue;if(u[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==u[2]){l.length=L;break}if(L<0&&(!o||o==u[2]))return{tag:u[2],from:Z(v,g),to:Z(h.line,h.ch)}}else l.push(u[2])}}function C(h,o){for(var l=[];;){var u=k(h);if(!u)return;if(u=="selfClose"){T(h);continue}var w=h.line,v=h.ch,g=T(h);if(!g)return;if(g[1])l.push(g[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==g[2]){l.length=L;break}if(L<0&&(!o||o==g[2]))return{tag:g[2],from:Z(h.line,h.ch),to:Z(w,v)}}}}de.registerHelper("fold","xml",function(h,o){for(var l=new G(h,o.line,0);;){var u=I(l);if(!u||l.line!=o.line)return;var w=y(l);if(!w)return;if(!u[1]&&w!="selfClose"){var v=Z(l.line,l.ch),g=A(l,u[2]);return g&&O(g.from,v)>0?{from:v,to:g.from}:null}}}),de.findMatchingTag=function(h,o,l){var u=new G(h,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var w=y(u),v=w&&Z(u.line,u.ch),g=w&&T(u);if(!w||!g||O(u,o)>0)return;var L={from:Z(u.line,u.ch),to:v,tag:g[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:g[1]?{open:C(u,g[2]),close:L,at:"close"}:(u=new G(h,v.line,v.ch,l),{open:L,close:A(u,g[2]),at:"open"})},de.findEnclosingTag=function(h,o,l,u){for(var w=new G(h,o.line,o.ch,l);;){var v=C(w,u);if(!v)break;var g=new G(h,o.line,o.ch,l),L=A(g,v.tag);if(L)return{open:v,close:L}}},de.scanForClosingTag=function(h,o,l,u){var w=new G(h,o.line,o.ch,u?{from:0,to:u}:null);return A(w,l)}})},p5ED:function(ht,et,pe){"use strict";var de=pe("+L6B"),Z=pe("2/Rp"),O=pe("5Dmo"),Q=pe("3S7+"),U=pe("k1fw"),D=pe("9og8"),G=pe("tJVT"),H=pe("WmNS"),B=pe.n(H),_=pe("q1tI"),y=pe.n(_),T=pe("vHTk"),I=pe.n(T),k=pe("yEEn"),A=pe("ZW9T"),C=pe("1vsH"),h=pe("V0Rq"),o=pe("m3rI");et.a=function(l){var u,w,v,g,L,x,f,p=l.editOffice,d=p===void 0?"view":p,a=l.data,b=l.theme,m=l.type,E=l.filename,F=l.monacoEditor,j=l.className,K=l.style,V=l.close,M=l.onClose,P=l.hasMask,$=l.disabledDownload,ne=Object(_.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)(ne,2),me=he[0],ke=he[1],xe=Object(_.useState)(""),Le=Object(G.a)(xe,2),Te=Le[0],Se=Le[1],ye=Object(_.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(_.useRef)();(u=a)!==null&&u!==void 0&&u.startsWith("/api")&&m!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),m==="office"&&(N=Object(C.T)(a).filesize,N>be&&(m="other")),E&&F&&(F.filename=E),Object(_.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(_.useEffect)(function(){m==="office"&&Oe()},[m,a]);var Oe=function(){var Pe=Object(D.a)(B.a.mark(function He(){var Ge,Xe,ze;return B.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(h.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)}}(),De=function(){if(a.startsWith("http")||a.startsWith("blob:")){_e();return}Object(C.z)(E||"educoder",a,E)},_e=function(){Object(C.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[j]," ").concat(j," ").concat(I.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&y.a.createElement(A.b,F)),m==="audio"&&y.a.createElement("audio",{src:"".concat(((w=a)===null||w===void 0?void 0:w.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(d,"&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(((L=a)===null||L===void 0?void 0:L.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:De},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&y.a.createElement(Z.a,{type:"primary",size:"large",onClick:De},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ht,et,pe){},rUJ1:function(ht,et){const pe=/[&<>"']/,de=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>Q[x];function D(x,f){if(f){if(pe.test(x))return x.replace(de,U)}else if(Z.test(x))return x.replace(O,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 B=/(^|[^\[])\^/g;function _(x,f){x=x.source||x,f=f||"";const p={replace:(d,a)=>(a=a.source||a,a=a.replace(B,"$1"),x=x.replace(d,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 d;try{d=decodeURIComponent(H(p)).replace(y,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!T.test(p)&&(p=o(f,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(d){return null}return p}const k={},A=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,f){k[" "+x]||(A.test(x)?k[" "+x]=x+"/":k[" "+x]=v(x,"/",!0)),x=k[" "+x];const p=x.indexOf(":")===-1;return f.substring(0,2)==="//"?p?f:x.replace(C,"$1")+f:f.charAt(0)==="/"?p?f:x.replace(h,"$1")+f:x+f}const l={exec:function(){}};function u(x){let f=1,p,d;for(;f<arguments.length;f++){p=arguments[f];for(d in p)Object.prototype.hasOwnProperty.call(p,d)&&(x[d]=p[d])}return x}function w(x,f){const p=x.replace(/\|/g,(b,m,E)=>{let F=!1,j=m;for(;--j>=0&&E[j]==="\\";)F=!F;return F?"|":" |"}),d=p.split(/ \|/);let a=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function v(x,f,p){const d=x.length;if(d===0)return"";let a=0;for(;a<d;){const b=x.charAt(d-a-1);if(b===f&&!p)a++;else if(b!==f&&p)a++;else break}return x.substr(0,d-a)}function g(x,f){if(x.indexOf(f[1])===-1)return-1;const p=x.length;let d=0,a=0;for(;a<p;a++)if(x[a]==="\\")a++;else if(x[a]===f[0])d++;else if(x[a]===f[1]&&(d--,d<0))return a;return-1}function L(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")}ht.exports={escape:D,unescape:H,edit:_,cleanUrl:I,resolveUrl:o,noopTest:l,merge:u,splitCells:w,rtrim:v,findClosingBracket:g,checkSanitizeDeprecation:L}},ulZh:function(ht,et,pe){typeof window!="undefined"&&function(Z,O){ht.exports=O()}(this,function(){return function(de){var Z={};function O(Q){if(Z[Q])return Z[Q].exports;var U=Z[Q]={i:Q,l:!1,exports:{}};return de[Q].call(U.exports,U,U.exports,O),U.l=!0,U.exports}return O.m=de,O.c=Z,O.d=function(Q,U,D){O.o(Q,U)||Object.defineProperty(Q,U,{enumerable:!0,get:D})},O.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},O.t=function(Q,U){if(U&1&&(Q=O(Q)),U&8)return Q;if(U&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var D=Object.create(null);if(O.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:Q}),U&2&&typeof Q!="string")for(var G in Q)O.d(D,G,function(H){return Q[H]}.bind(null,G));return D},O.n=function(Q){var U=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return O.d(U,"a",U),U},O.o=function(Q,U){return Object.prototype.hasOwnProperty.call(Q,U)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(de,Z,O){"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,k,A){if(typeof I!="function")throw new TypeError("The listener must be a function");var C=new G(I,k||y,A),h=U?U+T:T;return y._events[h]?y._events[h].fn?y._events[h]=[y._events[h],C]:y._events[h].push(C):(y._events[h]=C,y._eventsCount++),y}function B(y,T){--y._eventsCount===0?y._events=new D:delete y._events[T]}function _(){this._events=new D,this._eventsCount=0}_.prototype.eventNames=function(){var T=[],I,k;if(this._eventsCount===0)return T;for(k in I=this._events)Q.call(I,k)&&T.push(U?k.slice(1):k);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(I)):T},_.prototype.listeners=function(T){var I=U?U+T:T,k=this._events[I];if(!k)return[];if(k.fn)return[k.fn];for(var A=0,C=k.length,h=new Array(C);A<C;A++)h[A]=k[A].fn;return h},_.prototype.listenerCount=function(T){var I=U?U+T:T,k=this._events[I];return k?k.fn?1:k.length:0},_.prototype.emit=function(T,I,k,A,C,h){var o=U?U+T:T;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,w,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,k),!0;case 4:return l.fn.call(l.context,I,k,A),!0;case 5:return l.fn.call(l.context,I,k,A,C),!0;case 6:return l.fn.call(l.context,I,k,A,C,h),!0}for(v=1,w=new Array(u-1);v<u;v++)w[v-1]=arguments[v];l.fn.apply(l.context,w)}else{var g=l.length,L;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,k);break;case 4:l[v].fn.call(l[v].context,I,k,A);break;default:if(!w)for(L=1,w=new Array(u-1);L<u;L++)w[L-1]=arguments[L];l[v].fn.apply(l[v].context,w)}}}return!0},_.prototype.on=function(T,I,k){return H(this,T,I,k,!1)},_.prototype.once=function(T,I,k){return H(this,T,I,k,!0)},_.prototype.removeListener=function(T,I,k,A){var C=U?U+T:T;if(!this._events[C])return this;if(!I)return B(this,C),this;var h=this._events[C];if(h.fn)h.fn===I&&(!A||h.once)&&(!k||h.context===k)&&B(this,C);else{for(var o=0,l=[],u=h.length;o<u;o++)(h[o].fn!==I||A&&!h[o].once||k&&h[o].context!==k)&&l.push(h[o]);l.length?this._events[C]=l.length===1?l[0]:l:B(this,C)}return this},_.prototype.removeAllListeners=function(T){var I;return T?(I=U?U+T:T,this._events[I]&&B(this,I)):(this._events=new D,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=U,_.EventEmitter=_,de.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(de,Z,O){(function(Q){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,B={buildAbsoluteURL:function(_,y,T){if(T=T||{},_=_.trim(),y=y.trim(),!y){if(!T.alwaysNormalize)return _;var I=B.parseURL(_);if(!I)throw new Error("Error trying to parse base URL.");return I.path=B.normalizePath(I.path),B.buildURLFromParts(I)}var k=B.parseURL(y);if(!k)throw new Error("Error trying to parse relative URL.");if(k.scheme)return T.alwaysNormalize?(k.path=B.normalizePath(k.path),B.buildURLFromParts(k)):y;var A=B.parseURL(_);if(!A)throw new Error("Error trying to parse base URL.");if(!A.netLoc&&A.path&&A.path[0]!=="/"){var C=D.exec(A.path);A.netLoc=C[1],A.path=C[2]}A.netLoc&&!A.path&&(A.path="/");var h={scheme:A.scheme,netLoc:k.netLoc,path:null,params:k.params,query:k.query,fragment:k.fragment};if(!k.netLoc&&(h.netLoc=A.netLoc,k.path[0]!=="/"))if(!k.path)h.path=A.path,k.params||(h.params=A.params,k.query||(h.query=A.query));else{var o=A.path,l=o.substring(0,o.lastIndexOf("/")+1)+k.path;h.path=B.normalizePath(l)}return h.path===null&&(h.path=T.alwaysNormalize?B.normalizePath(k.path):k.path),B.buildURLFromParts(h)},parseURL:function(_){var y=U.exec(_);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(G,"");_.length!==(_=_.replace(H,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};de.exports=B})(this)},"./node_modules/webworkify-webpack/index.js":function(de,Z,O){function Q(T){var I={};function k(C){if(I[C])return I[C].exports;var h=I[C]={i:C,l:!1,exports:{}};return T[C].call(h.exports,h,h.exports,k),h.l=!0,h.exports}k.m=T,k.c=I,k.i=function(C){return C},k.d=function(C,h,o){k.o(C,h)||Object.defineProperty(C,h,{configurable:!1,enumerable:!0,get:o})},k.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},k.n=function(C){var h=C&&C.__esModule?function(){return C.default}:function(){return C};return k.d(h,"a",h),h},k.o=function(C,h){return Object.prototype.hasOwnProperty.call(C,h)},k.p="/",k.oe=function(C){throw console.error(C),C};var A=k(k.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 B(T,I,k){var A={};A[k]=[];var C=I.toString(),h=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return A;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+G(o)+D,"g"),u;u=l.exec(C);){if(u[3]==="dll-reference")continue;A[k].push(u[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+D,"g");u=l.exec(C);)T[u[2]]||(A[k].push(u[1]),T[u[2]]=O(u[1]).m),A[u[2]]=A[u[2]]||[],A[u[2]].push(u[4]);for(var w=Object.keys(A),v=0;v<w.length;v++)for(var g=0;g<A[w[v]].length;g++)H(A[w[v]][g])&&(A[w[v]][g]=1*A[w[v]][g]);return A}function _(T){var I=Object.keys(T);return I.reduce(function(k,A){return k||T[A].length>0},!1)}function y(T,I){for(var k={main:[I]},A={main:[]},C={main:{}};_(k);)for(var h=Object.keys(k),o=0;o<h.length;o++){var l=h[o],u=k[l],w=u.pop();if(C[l]=C[l]||{},C[l][w]||!T[l][w])continue;C[l][w]=!0,A[l]=A[l]||[],A[l].push(w);for(var v=B(T,T[l][w],l),g=Object.keys(v),L=0;L<g.length;L++)k[g[L]]=k[g[L]]||[],k[g[L]]=k[g[L]].concat(v[g[L]])}return A}de.exports=function(T,I){I=I||{};var k={main:O.m},A=I.all?{main:Object.keys(k.main)}:y(k,T),C="";Object.keys(A).filter(function(w){return w!=="main"}).forEach(function(w){for(var v=0;A[w][v];)v++;A[w].push(v),k[w][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+w+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+A[w].map(function(g){return""+JSON.stringify(g)+": "+k[w][g].toString()}).join(",")+`});
|
|
`}),C=C+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+A.main.map(function(w){return""+JSON.stringify(w)+": "+k.main[w].toString()}).join(",")+"}))(self);";var h=new window.Blob([C],{type:"text/javascript"});if(I.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"hlsDefaultConfig",function(){return L}),O.d(Z,"mergeConfig",function(){return f}),O.d(Z,"enableStreamingMode",function(){return p});var Q=O("./src/controller/abr-controller.ts"),U=O("./src/controller/audio-stream-controller.ts"),D=O("./src/controller/audio-track-controller.ts"),G=O("./src/controller/subtitle-stream-controller.ts"),H=O("./src/controller/subtitle-track-controller.ts"),B=O("./src/controller/buffer-controller.ts"),_=O("./src/controller/timeline-controller.ts"),y=O("./src/controller/cap-level-controller.ts"),T=O("./src/controller/fps-controller.ts"),I=O("./src/controller/eme-controller.ts"),k=O("./src/controller/cmcd-controller.ts"),A=O("./src/utils/xhr-loader.ts"),C=O("./src/utils/fetch-loader.ts"),h=O("./src/utils/cues.ts"),o=O("./src/utils/mediakeys-helper.ts"),l=O("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(d[m]=b[m])}return d},u.apply(this,arguments)}function w(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),b.push.apply(b,m)}return b}function v(d){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?w(Object(b),!0).forEach(function(m){g(d,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):w(Object(b)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(b,m))})}return d}function g(d,a,b){return a in d?Object.defineProperty(d,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):d[a]=b,d}var L=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:B.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:_.TimelineController,audioStreamController:U.default,audioTrackController:D.default,emeController:I.default,cmcdController:k.default});function x(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(d,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({},d,a)}function p(d){var a=d.loader;if(a!==C.default&&a!==A.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var b=Object(C.fetchSupported)();b&&(d.loader=C.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/polyfills/number.ts"),U=O("./src/utils/ewma-bandwidth-estimator.ts"),D=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/errors.ts"),B=O("./src/types/loader.ts"),_=O("./src/utils/logger.ts");function y(k,A){for(var C=0;C<A.length;C++){var h=A[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function T(k,A,C){return A&&y(k.prototype,A),C&&y(k,C),k}var I=function(){function k(C){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=C;var h=C.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var A=k.prototype;return A.registerListeners=function(){var h=this.hls;h.on(D.Events.FRAG_LOADING,this.onFragLoading,this),h.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(D.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var h=this.hls;h.off(D.Events.FRAG_LOADING,this.onFragLoading,this),h.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.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(h,o){var l=o.frag;if(l.type===B.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(h,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 h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,w=l.config,v=l.media;if(!h||!v)return;var g=o?o.stats:h.stats,L=o?o.duration:h.duration;if(g.aborted){_.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*L/f)return;var p=l.levels,d=l.minAutoLevel,a=p[h.level],b=g.total||Math.max(g.loaded,Math.round(L*a.maxBitrate/8)),m=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/x),E=(b-g.loaded)/m,F=v.currentTime,j=(G.BufferHelper.bufferInfo(v,F,w.maxBufferHole).end-F)/f;if(j>=2*L/f||E<=j)return;var K=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>d;V--){var M=p[V].maxBitrate;if(K=L*M/(8*.8*m),K<j)break}if(K>=E)return;var P=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(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: `+j.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(x,g.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:g})},A.onFragLoaded=function(h,o){var l=o.frag,u=o.part;if(l.type===B.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(l.sn)){var w=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],L=(g.loaded?g.loaded.bytes:0)+w.loaded,x=(g.loaded?g.loaded.duration:0)+v;g.loaded={bytes:L,duration:x},g.realBitrate=Math.round(8*L/x)}if(l.bitrateTest){var f={stats:w,frag:l,part:u,id:l.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},A.onFragBuffered=function(h,o){var l=o.frag,u=o.part,w=u?u.stats:l.stats;if(w.aborted)return;if(l.type!==B.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=w.parsing.end-w.loading.start;this.bwEstimator.sample(v,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},A.onError=function(h,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 h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,w=l.config,v=l.minAutoLevel,g=l.media,L=o?o.duration:h?h.duration:0,x=g?g.currentTime:0,f=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,d=(G.BufferHelper.bufferInfo(g,x,w.maxBufferHole).end-x)/f,a=this.findBestLevel(p,v,u,d,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;_.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!d){var F=this.bitrateTestDelay;if(F){var j=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;b=j-F,_.logger.trace("bitrate test took "+Math.round(1e3*F)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),m=E=1}}return a=this.findBestLevel(p,v,u,d+b,m,E),Math.max(a,0)},A.findBestLevel=function(h,o,l,u,w,v){for(var g,L=this.fragCurrent,x=this.partCurrent,f=this.lastLoadedFragLevel,p=this.hls.levels,d=p[f],a=!!(d!=null&&(g=d.details)!==null&&g!==void 0&&g.live),b=d==null?void 0:d.codecSet,m=x?x.duration:L?L.duration:0,E=l;E>=o;E--){var F=p[E];if(!F||b&&F.codecSet!==b)continue;var j=F.details,K=(x?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||m,V=void 0;E<=f?V=w*h:V=v*h;var M=p[E].maxBitrate,P=M*K/V;if(_.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(k,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),k}();Z.default=I},"./src/controller/audio-stream-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),D=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-tracker.ts"),B=O("./src/types/level.ts"),_=O("./src/types/loader.ts"),y=O("./src/loader/fragment.ts"),T=O("./src/demux/chunk-cache.ts"),I=O("./src/demux/transmuxer-interface.ts"),k=O("./src/types/transmuxer.ts"),A=O("./src/controller/fragment-finders.ts"),C=O("./src/utils/discontinuities.ts"),h=O("./src/errors.ts"),o=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(L[p]=f[p])}return L},l.apply(this,arguments)}function u(L,x){L.prototype=Object.create(x.prototype),L.prototype.constructor=L,w(L,x)}function w(L,x){return w=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},w(L,x)}var v=100,g=function(L){u(x,L);function x(p,d){var a;return a=L.call(this,p,d,"[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 d=this.hls;d.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(D.Events.ERROR,this.onError,this),d.on(D.Events.BUFFER_RESET,this.onBufferReset,this),d.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(D.Events.ERROR,this.onError,this),d.off(D.Events.BUFFER_RESET,this.onBufferReset,this),d.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,a){var b=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var F=b.cc;this.initPTS[b.cc]=E,this.log("InitPTS for cc: "+F+" found from main: "+E),this.videoTrackCC=F,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&d===-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=d,this.tick()},f.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,a=this.levels,b=this.trackId,m=a==null||((d=a[b])===null||d===void 0)?void 0:d.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,F=performance.now(),j=this.retryDate;(!j||F>=j||(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 ne=P.flush(),he={frag:V,part:M,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(he),$&&L.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(),ke=G.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),xe=Object(A.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,V);xe<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,a,b=this.hls,m=this.levels,E=this.media,F=this.trackId,j=b.config;if(!m||!m[F])return;if(!E&&(this.startFragRequested||!j.startFragPrefetch))return;var K=m[F],V=K.details;if(!V||V.live&&this.levelLastLoaded!==F||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,_.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(M===null)return;var P=M.len,$=this.getMaxBufferLength(),ne=this.audioSwitch;if(P>=$&&!ne)return;if(!ne&&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,ke=M.end;if(ne){var xe=this.getLoadPosition();ke=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 Le=this.getNextFragment(ke,V);if(!Le){this.bufferFlushed=!0;return}((d=Le.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Le.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Le,V):this.loadFragment(Le,V,ke)},f.getMaxBufferLength=function(){var d=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(m){return new B.Level(m)})},f.onAudioTrackSwitching=function(d,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(d,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(d,a){var b,m=this.levels,E=a.details,F=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+F);return}this.log("Track "+F+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var j=m[F],K=0;if(E.live||(b=j.details)!==null&&b!==void 0&&b.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!j.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(E,V),K=E.fragments[0].start):K=this.alignPlaylists(E,j.details)}j.details=E,this.levelLastLoaded=F,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(j.details,K),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=U.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var a,b=d.frag,m=d.part,E=d.payload,F=this.config,j=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[j];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=F.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new I.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[b.cc],he=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(ne!==void 0){var me=!1,ke=m?m.index:-1,xe=ke!==-1,Le=new k.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,E.byteLength,ke,xe);$.push(E,he,P,"",b,m,M.totalduration,me,Le,ne)}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 "+j);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(d){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(d,a){var b=a.frag,m=a.part;if(b.type!==_.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(d,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var b=!0,m=this.getFwdBufferInfo(this.mediaBuffer,_.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,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,a){var b=a.type;b===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var a,b="audio",m=this.hls,E=d.remuxResult,F=d.chunkMeta,j=this.getCurrentContext(F);if(!j){this.warn("The loading context changed while buffering fragment "+F.sn+" of level "+F.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(F.level);return}var K=j.frag,V=j.part,M=E.audio,P=E.text,$=E.id3,ne=E.initSegment;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,K,F),m.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:b,tracks:ne.tracks})),M){var he=M.startPTS,me=M.endPTS,ke=M.startDTS,xe=M.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:me,startDTS:ke,endDTS:xe}),K.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,he,me,ke,xe),this.bufferFragmentData(M,K,V,F)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Le=l({frag:K,id:b},$);m.trigger(D.Events.FRAG_PARSING_METADATA,Le)}if(P){var Te=l({frag:K,id:b},P);m.trigger(D.Events.FRAG_PARSING_USERDATA,Te)}},f._bufferInitSegment=function(d,a,b){if(this.state!==U.State.PARSING)return;d.video&&delete d.video;var m=d.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,d);var E=m.initSegment;if(E!=null&&E.byteLength){var F={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:E};this.hls.trigger(D.Events.BUFFER_APPENDING,F)}this.tick()},f.loadFragment=function(d,a,b){var m=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||m===H.FragmentState.NOT_LOADED||m===H.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(Q.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,d,a,b)))},f.completeAudioSwitch=function(){var d=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:b})},x}(U.default);Z.default=g},"./src/controller/audio-track-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(I,k){for(var A=0;A<k.length;A++){var C=k[A];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(I,C.key,C)}}function B(I,k,A){return k&&H(I.prototype,k),A&&H(I,A),I}function _(I,k){I.prototype=Object.create(k.prototype),I.prototype.constructor=I,y(I,k)}function y(I,k){return y=Object.setPrototypeOf||function(C,h){return C.__proto__=h,C},y(I,k)}var T=function(I){_(k,I);function k(C){var h;return h=I.call(this,C,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var A=k.prototype;return A.registerListeners=function(){var h=this.hls;h.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Q.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var h=this.hls;h.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.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(h,o){this.tracks=o.audioTracks||[]},A.onAudioTrackLoaded=function(h,o){var l=o.id,u=o.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var v=w.details;w.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(h,o){this.switchLevel(o.level)},A.onLevelSwitching=function(h,o){this.switchLevel(o.level)},A.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var 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 w={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},A.onError=function(h,o){if(I.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},A.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var u=o[h],w=u.id,v=u.groupId,g=v===void 0?"":v,L=u.name,x=u.type,f=u.url;if(this.trackId=h,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:g,name:L,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 h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!h||h===u.name))return u.id}return-1},A.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,w=o.url;if(h)try{w=h.addDirectives(w)}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:w,id:l,groupId:u,deliveryDirectives:h||null})}},B(k,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),k}(D.default);Z.default=T},"./src/controller/base-playlist-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return B});var Q=O("./src/polyfills/number.ts"),U=O("./src/types/level.ts"),D=O("./src/controller/level-helper.ts"),G=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),B=function(){function _(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=_.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(I,k){k.fatal&&k.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,k){var A=k==null?void 0:k.renditionReports;if(A)for(var C=0;C<A.length;C++){var h=A[C],o=""+h.URI;if(o===I.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),u=parseInt(h["LAST-PART"]);if(k&&this.hls.config.lowLatencyMode){var w=Math.min(k.age-k.partTarget,k.targetduration);u!==void 0&&w>k.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,k,A){var C=this,h=k.details,o=k.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||A!=null&&A.live){if(h.reloaded(A),A&&this.log("live playlist "+I+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),A&&h.fragments.length>0&&Object(D.mergeDetails)(A,h),!this.canLoad||!h.live)return;var u,w=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var g=this.hls.config.lowLatencyMode,L=h.lastPartSn,x=h.endSN,f=h.lastPartIndex,p=f!==-1,d=L===x,a=g?0:f;p?(w=d?x+1:L,v=d?a:f+1):w=x+1;var b=h.age,m=b+h.ageHeader,E=Math.min(m-h.partTarget,h.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: "+h.age),E=0;else{var F=Math.floor(E/h.targetduration);if(w+=F,v!==void 0){var j=Math.round(E%h.targetduration/h.partTarget);v+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+E+" skip sn "+F+" to part "+v)}h.tuneInGoal=E}if(u=this.getDeliveryDirectives(h,k.deliveryDirectives,w,v),g||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(h,k.deliveryDirectives,w,v);var K=Object(D.computeReloadInterval)(h,o);w!==void 0&&h.canBlockReload&&(K-=h.partTarget||1),this.log("reload live playlist "+I+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(u)},K)}else this.clearTimer()},y.getDeliveryDirectives=function(I,k,A,C){var h=Object(U.getSkipValue)(I,A);return k!=null&&k.skip&&I.deltaUpdateFailed&&(A=k.msn,C=k.part,h=U.HlsSkip.No),new U.HlsUrlParameters(A,C,h)},y.retryLoadingOrFail=function(I){var k=this,A=this.hls.config,C=this.retryCount<A.levelLoadingMaxRetry;if(C){var h;if(this.retryCount++,I.details.indexOf("LoadTimeOut")>-1&&(h=I.context)!==null&&h!==void 0&&h.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 k.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 C},_}()},"./src/controller/base-stream-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"State",function(){return x}),O.d(Z,"default",function(){return f});var Q=O("./src/polyfills/number.ts"),U=O("./src/task-loop.ts"),D=O("./src/controller/fragment-tracker.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts"),B=O("./src/events.ts"),_=O("./src/errors.ts"),y=O("./src/types/transmuxer.ts"),T=O("./src/utils/mp4-tools.ts"),I=O("./src/utils/discontinuities.ts"),k=O("./src/controller/fragment-finders.ts"),A=O("./src/controller/level-helper.ts"),C=O("./src/loader/fragment-loader.ts"),h=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function u(p,d){for(var a=0;a<d.length;a++){var b=d[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(p,b.key,b)}}function w(p,d,a){return d&&u(p.prototype,d),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,d){p.prototype=Object.create(d.prototype),p.prototype.constructor=p,L(p,d)}function L(p,d){return L=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},L(p,d)}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(d,p);function d(b,m,E){var F;return F=p.call(this)||this,F.hls=void 0,F.fragPrevious=null,F.fragCurrent=null,F.fragmentTracker=void 0,F.transmuxer=null,F._state=x.STOPPED,F.media=void 0,F.mediaBuffer=void 0,F.config=void 0,F.bitrateTest=!1,F.lastCurrentTime=0,F.nextLoadPosition=0,F.startPosition=0,F.loadedmetadata=!1,F.fragLoadError=0,F.retryDate=0,F.levels=null,F.fragmentLoader=void 0,F.levelLastLoaded=null,F.startFragRequested=!1,F.decrypter=void 0,F.initPTS=[],F.onvseeking=null,F.onvended=null,F.logPrefix="",F.log=void 0,F.warn=void 0,F.logPrefix=E,F.log=H.logger.log.bind(H.logger,E+":"),F.warn=H.logger.warn.bind(H.logger,E+":"),F.hls=b,F.fragmentLoader=new C.default(b.config),F.fragmentTracker=m,F.config=b.config,F.decrypter=new h.default(b,b.config),b.on(B.Events.KEY_LOADED,F.onKeyLoaded,v(F)),F}var a=d.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 F=this.fragCurrent,j=this.fragmentTracker;if(!E.live&&F&&F.sn===E.endSN&&!m.nextStart){var K=j.getState(F);return K===D.FragmentState.PARTIAL||K===D.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var F=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),F.addEventListener("seeking",this.onvseeking),F.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(j.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,F=this.media,j=this.mediaBuffer,K=this.state,V=F?F.currentTime:0,M=G.BufferHelper.bufferInfo(j||F,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,ne=E.start+E.duration+P,he=V>ne;(V<$||he)&&(he&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}F&&(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 F=this.levels[E.frag.level].details;F&&this.loadFragment(E.frag,F,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(B.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(B.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,F){this._loadFragForPlayback(m,E,F)},a._loadFragForPlayback=function(m,E,F){var j=this,K=function(M){if(j.fragContextChanged(m)){j.warn("Fragment "+m.sn+(M.part?" p: "+M.part.index:"")+" of level "+m.level+" was dropped during download."),j.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,j._handleFragmentLoadProgress(M)};this._doFragLoad(m,E,F,K).then(function(V){if(!V)return;j.fragLoadError=0;var M=j.state;if(j.fragContextChanged(m)){(M===x.FRAG_LOADING||M===x.BACKTRACKING||!j.fragCurrent&&M===x.PARSING)&&(j.fragmentTracker.removeFragment(m),j.state=x.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+m.sn+" of level "+m.level),j.hls.trigger(B.Events.FRAG_LOADED,V),j.state===x.BACKTRACKING)){j.fragmentTracker.backtrack(m,V),j.resetFragmentLoading(m);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,F){if(F===void 0&&(F=null),!(m-E))return;var j={startOffset:m,endOffset:E,type:F};this.fragLoadError=0,this.hls.trigger(B.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(F){if(!F||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return F}).then(function(F){var j=E.hls,K=F.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 j.trigger(B.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:M,tdecrypt:$}}),F.payload=P,F})}return F}).then(function(F){var j=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(F.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),F.frag===j&&K.trigger(B.Events.FRAG_BUFFERED,{stats:P,frag:j,part:null,id:m.type}),E.tick()}).catch(function(F){E.warn(F),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 F=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(F))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var F=m.frag,j=m.part,K=m.partsLoaded,V=!K||K.length===0||K.some(function(P){return!P}),M=new y.ChunkMetadata(F.level,F.sn,F.stats.chunkCount+1,0,j?j.index:-1,!V);E.flush(M)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,F,j){var K=this;if(F===void 0&&(F=null),!this.levels)throw new Error("frag load aborted, missing levels");if(F=Math.max(m.start,F||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&j){F>m.end&&E.fragmentHint&&(m=E.fragmentHint);var M=this.getNextPart(V,m,F);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(F.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=x.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:m,part:V[M],targetBufferTime:F}),this.doFragPartsLoad(m,V,M,j).catch(function($){return K.handleFragLoadError($)})}else if(!m.url||this.loadedEndOfParts(V,F))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(F.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=x.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:m,targetBufferTime:F}),this.fragmentLoader.load(m,j).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(m,E,F,j){var K=this;return new Promise(function(V,M){var P=[],$=function ne(he){var me=E[he];K.fragmentLoader.loadPart(m,me,j).then(function(ke){P[me.index]=ke;var xe=ke.part;K.hls.trigger(B.Events.FRAG_LOADED,ke);var Le=E[he+1];if(Le&&Le.fragment===m)ne(he+1);else return V({frag:m,part:xe,partsLoaded:P})}).catch(M)};$(F)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(B.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 F=E.frag,j=E.part,K=E.level,V=self.performance.now();F.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(F,j,K,m.partial)},a.getCurrentContext=function(m){var E=this.levels,F=m.level,j=m.sn,K=m.part;if(!E||!E[F])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+F+". The current chunk will not be buffered."),null;var V=E[F],M=K>-1?Object(A.getPartWith)(V,j,K):null,P=M?M.fragment:Object(A.getFragmentWithSN)(V,j,this.fragCurrent);return P?{frag:P,part:M,level:V}:null},a.bufferFragmentData=function(m,E,F,j){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:F,chunkMeta:j,parent:E.type,data:M};this.hls.trigger(B.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!F&&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 F=E.currentTime,j=G.BufferHelper.bufferInfo(E,F,0),K=m.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),M=Math.max(Math.min(m.start-V,j.end-V),F+V);m.start-M>V&&this.flushMainBuffer(M,m.start)},a.getFwdBufferInfo=function(m,E){var F=this.config,j=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(j))return null;var K=G.BufferHelper.bufferInfo(m,j,F.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,E);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(m,j,Math.max(K.nextStart,F.maxBufferHole))}return K},a.getMaxBufferLength=function(m){var E=this.config,F;return m?F=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):F=E.maxBufferLength,Math.min(F,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,F=m||E.maxBufferLength;return E.maxMaxBufferLength>=F?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var F,j,K=E.fragments,V=K.length;if(!V)return null;var M=this.config,P=K[0].start,$;if(E.live){var ne=M.initialLiveManifestSize;if(V<ne)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ne+")"),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(F=$)!==null&&F!==void 0&&F.initSegment&&!((j=$)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(m,E,F){for(var j=-1,K=!1,V=!0,M=0,P=m.length;M<P;M++){var $=m[M];if(V=V&&!$.independent,j>-1&&F<$.start)break;var ne=$.loaded;!ne&&(K||$.independent||V)&&$.fragment===E&&(j=M),K=ne}return j},a.loadedEndOfParts=function(m,E){var F=m[m.length-1];return F&&E>F.start&&F.loaded},a.getInitialLiveFragment=function(m,E){var F=this.fragPrevious,j=null;if(F){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+F.programDateTime),j=Object(k.findFragmentByPDT)(E,F.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var K=F.sn+1;if(K>=m.startSN&&K<=m.endSN){var V=E[K-m.startSN];F.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(k.findFragWithCC)(E,F.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(j=this.getFragmentAtPosition(M,this.bitrateTest?m.fragmentEnd:m.edge,m))}return j},a.getFragmentAtPosition=function(m,E,F){var j=this.config,K=this.fragPrevious,V=F.fragments,M=F.endSN,P=F.fragmentHint,$=j.maxFragLookUpTolerance,ne=!!(j.lowLatencyMode&&F.partList&&P);ne&&P&&!this.bitrateTest&&(V=V.concat(P),M=P.sn);var he;if(m<E){var me=m>E-$?0:$;he=Object(k.findFragmentByPTS)(K,V,m,me)}else he=V[V.length-1];if(he){var ke=he.sn-F.startSN,xe=K&&he.level===K.level,Le=V[ke+1],Te=this.fragmentTracker.getState(he);if(Te===D.FragmentState.BACKTRACKED){he=null;for(var Se=ke;V[Se]&&this.fragmentTracker.getState(V[Se])===D.FragmentState.BACKTRACKED;)K?he=V[Se--]:he=V[--Se];he||(he=Le)}else K&&he.sn===K.sn&&!ne&&(xe&&(he.sn<M&&this.fragmentTracker.getState(Le)!==D.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+Le.sn),he=Le):he=null))}return he},a.synchronizeToLiveEdge=function(m){var E=this.config,F=this.media;if(!F)return;var j=this.hls.liveSyncPosition,K=F.currentTime,V=m.fragments[0].start,M=m.edge,P=K>=V-E.maxFragLookUpTolerance&&K<=M;if(j!==null&&F.duration>j&&(K<j||!P)){var $=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!P&&F.readyState<4||K<M-$)&&(this.loadedmetadata||(this.nextLoadPosition=j),F.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+j.toFixed(3)),F.currentTime=j))}},a.alignPlaylists=function(m,E){var F=this.levels,j=this.levelLastLoaded,K=this.fragPrevious,V=j!==null?F[j]:null,M=m.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var P=m.fragments[0].start,$=!E,ne=m.alignedSliding&&Object(Q.isFiniteNumber)(P);if($||!ne&&!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 F=this.startPosition;if(F<E&&(F=-1),F===-1||this.lastCurrentTime===-1){var j=m.startTimeOffset;Object(Q.isFiniteNumber)(j)?(F=E+j,j<0&&(F+=m.totalduration),F=Math.min(Math.max(E,F),E+m.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+F),this.startPosition=F):m.live?F=this.hls.liveSyncPosition||E:this.startPosition=F=0,this.lastCurrentTime=F}this.nextLoadPosition=F},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 F=E.frag;if(!F||F.type!==m)return;var j=this.fragCurrent;console.assert(j&&F.sn===j.sn&&F.level===j.level&&F.urlId===j.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(F.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+F.sn+" of "+m+" "+F.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,F){if(!m)return;var j=G.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,j,F),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,F,j){var K=this,V=F.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(m.elementaryStreams).reduce(function(P,$){var ne=m.elementaryStreams[$];if(ne){var he=ne.endPTS-ne.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=j?0:Object(A.updateFragPTSDTS)(V,m,ne.startPTS,ne.endPTS,ne.startDTS,ne.endDTS);return K.hls.trigger(B.Events.LEVEL_PTS_UPDATED,{details:V,level:F,drift:me,type:$,frag:m,start:ne.startPTS,end:ne.endPTS}),!0}return P},!1);M?(this.state=x.PARSED,this.hls.trigger(B.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(d,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),d}(U.default)},"./src/controller/buffer-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var Q=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts"),G=O("./src/errors.ts"),H=O("./src/utils/buffer-helper.ts"),B=O("./src/utils/mediasource-helper.ts"),_=O("./src/loader/fragment.ts"),y=O("./src/controller/buffer-operation-queue.ts"),T=Object(B.getMediaSource)(),I=/([ha]vc.)(?:\.[^.,]+)+/,k=function(){function A(h){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,w=o.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:u})),w&&w.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=h,this._initSourceBuffer(),this.registerListeners()}var C=A.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.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)},C.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)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.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")},C.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&T){var w=this.mediaSource=new T;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(w),this._objectUrl=u.src}},C.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(w){D.logger.warn("[buffer-controller]: onMediaDetaching: "+w.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)},C.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(w){D.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},C.onBufferCodecs=function(o,l){var u=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(w){var g=u.tracks[v];if(g&&typeof g.buffer.changeType=="function"){var L=l[v],x=L.codec,f=L.levelCodec,p=L.container,d=(g.levelCodec||g.codec).replace(I,"$1"),a=(f||x).replace(I,"$1");if(d!==a){var b=p+";codecs="+(f||x);u.appendChangeType(v,b)}}}else u.pendingTracks[v]=l[v]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(o,l){var u=this,w=this.operationQueue,v={execute:function(){var L=u.sourceBuffer[o];L&&(D.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){D.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(v,o)},C.onBufferAppending=function(o,l){var u=this,w=this.hls,v=this.operationQueue,g=this.tracks,L=l.data,x=l.type,f=l.frag,p=l.part,d=l.chunkMeta,a=d.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 F=g.audio,j=x==="audio"&&d.id===1&&(F==null?void 0:F.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),j){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(L,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 ne in P)$[ne]=H.BufferHelper.getBuffered(P[ne]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:f,part:p,chunkMeta:d,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>w.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),w.trigger(U.Events.ERROR,P)}};v.append(K,x)},C.onBufferFlushing=function(o,l){var u=this,w=this.operationQueue,v=function(L){return{execute:u.removeExecutor.bind(u,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:L})},onError:function(f){D.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",f)}}};l.type?w.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(g){w.append(v(g),g)})},C.onFragParsed=function(o,l){var u=this,w=l.frag,v=l.part,g=[],L=v?v.elementaryStreams:w.elementaryStreams;L[_.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(L[_.ElementaryStreamTypes.AUDIO]&&g.push("audio"),L[_.ElementaryStreamTypes.VIDEO]&&g.push("video"));var x=function(){var p=self.performance.now();w.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var d=v?v.stats:w.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:w,part:v,stats:d,id:w.type})};g.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(x,g)},C.onFragChanged=function(o,l){this.flushBackBuffer()},C.onBufferEos=function(o,l){var u=this,w=this.getSourceBufferTypes().reduce(function(v,g){var L=u.sourceBuffer[g];return(!l.type||l.type===g)&&(L&&!L.ended&&(L.ended=!0,D.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),v&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var v=u.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},C.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()},C.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,w=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 L=u.currentTime,x=l.levelTargetDuration,f=Math.max(g,x),p=Math.floor(L/x)*x-f;v.forEach(function(d){var a=w[d];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:d}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,w=this.mediaSource,v=o.fragments[0].start+o.totalduration,g=u.duration,L=Object(Q.isFiniteNumber)(w.duration)?w.duration:0;o.live&&l.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(v>L&&v>g||!Object(Q.isFiniteNumber)(g))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),w.duration=v)},C.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,w=u.length;if(w&&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)}},C.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,w=Object.keys(u).length;if(w&&!o||w===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)})}},C.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var w=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 L=g.levelCodec||g.codec,x=g.container+";codecs="+L;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:L,container:g.container,levelCodec:g.levelCodec,id:g.id},w++}catch(d){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:x})}}w&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},C._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},C._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)},C.removeExecutor=function(o,l,u){var w=this.media,v=this.mediaSource,g=this.operationQueue,L=this.sourceBuffer,x=L[o];if(!w||!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)(w.duration)?w.duration:Infinity,p=Object(Q.isFiniteNumber)(v.duration)?v.duration:Infinity,d=Math.max(0,l),a=Math.min(u,f,p);a>d?(D.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(d,a)):g.shiftAndExecuteNext(o)},C.appendExecutor=function(o,l){var u=this.operationQueue,w=this.sourceBuffer,v=w[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)},C.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 w=this.operationQueue,v=l.map(function(g){return w.appendBlocker(g)});Promise.all(v).then(function(){o(),l.forEach(function(g){var L=u.sourceBuffer[g];(!L||!L.updating)&&w.shiftAndExecuteNext(g)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(o,l,u){var w=this.sourceBuffer[o];if(!w)return;var v=u.bind(this,o);this.listeners[o].push({event:l,listener:v}),w.addEventListener(l,v)},C.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return U});var Q=O("./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(B,_){var y=this.queues[_];y.push(B),y.length===1&&this.buffers[_]&&this.executeNext(_)},G.insertAbort=function(B,_){var y=this.queues[_];y.unshift(B),this.executeNext(_)},G.appendBlocker=function(B){var _,y=new Promise(function(I){_=I}),T={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,B),y},G.executeNext=function(B){var _=this.buffers,y=this.queues,T=_[B],I=y[B];if(I.length){var k=I[0];try{k.execute()}catch(A){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),k.onError(A),(!T||!T.updating)&&(I.shift(),this.executeNext(B))}}},G.shiftAndExecuteNext=function(B){this.queues[B].shift(),this.executeNext(B)},G.current=function(B){return this.queues[B][0]},D}()},"./src/controller/cap-level-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts");function U(H,B){for(var _=0;_<B.length;_++){var y=B[_];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(H,y.key,y)}}function D(H,B,_){return B&&U(H.prototype,B),_&&U(H,_),H}var G=function(){function H(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var B=H.prototype;return B.setStreamController=function(y){this.streamController=y},B.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},B.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)},B.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)},B.onFpsDropLevelCapping=function(y,T){H.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},B.onMediaAttaching=function(y,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},B.onManifestParsed=function(y,T){var I=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,I.config.capLevelToPlayerSize&&T.video&&this.startCapping()},B.onBufferCodecs=function(y,T){var I=this.hls;I.config.capLevelToPlayerSize&&T.video&&this.startCapping()},B.onMediaDetaching=function(){this.stopCapping()},B.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}}},B.getMaxLevel=function(y){var T=this,I=this.hls.levels;if(!I.length)return-1;var k=I.filter(function(A,C){return H.isLevelAllowed(C,T.restrictedLevels)&&C<=y});return this.clientRect=null,H.getMaxLevelByMediaSize(k,this.mediaWidth,this.mediaHeight)},B.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()},B.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},B.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 k=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},A=y.length-1,C=0;C<y.length;C+=1){var h=y[C];if((h.width>=T||h.height>=I)&&k(h,y[C+1])){A=C;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(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var Q=O("./src/events.ts"),U=O("./src/types/cmcd.ts"),D=O("./src/utils/buffer-helper.ts"),G=O("./src/utils/logger.ts");function H(A,C){for(var h=0;h<C.length;h++){var o=C[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(A,o.key,o)}}function B(A,C,h){return C&&H(A.prototype,C),h&&H(A,h),A}function _(A,C){var h=typeof Symbol!="undefined"&&A[Symbol.iterator]||A["@@iterator"];if(h)return(h=h.call(A)).next.bind(h);if(Array.isArray(A)||(h=y(A))||C&&A&&typeof A.length=="number"){h&&(A=h);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,C){if(!A)return;if(typeof A=="string")return T(A,C);var h=Object.prototype.toString.call(A).slice(8,-1);if(h==="Object"&&A.constructor&&(h=A.constructor.name),h==="Map"||h==="Set")return Array.from(A);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return T(A,C)}function T(A,C){(C==null||C>A.length)&&(C=A.length);for(var h=0,o=new Array(C);h<C;h++)o[h]=A[h];return o}function I(){return I=Object.assign||function(A){for(var C=1;C<arguments.length;C++){var h=arguments[C];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(A[o]=h[o])}return A},I.apply(this,arguments)}var k=function(){function A(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){G.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(w){try{var v=w.frag,g=o.hls.levels[v.level],L=o.getObjectType(v),x={d:v.duration*1e3,ot:L};(L===U.CMCDObjectType.VIDEO||L===U.CMCDObjectType.AUDIO||L==U.CMCDObjectType.MUXED)&&(x.br=g.bitrate/1e3,x.tb=o.getTopBandwidth(L),x.bl=o.getBufferLength(L)),o.apply(w,x)}catch(f){G.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=h;var l=this.config=h.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 C=A.prototype;return C.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)},C.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()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(o,l){var u,w;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},C.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}},C.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 w=A.toHeaders(l);if(!Object.keys(w).length)return;o.headers||(o.headers={}),I(o.headers,w)}else{var v=A.toQuery(l);if(!v)return;o.url=A.appendQueryToUri(o.url,v)}},C.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},C.getTopBandwidth=function(o){for(var l=0,u=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=_(u),v;!(v=w()).done;){var g=v.value;g.bitrate>l&&(l=g.bitrate)}return l>0?l:NaN},C.getBufferLength=function(o){var l=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var w=D.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return w.len*1e3},C.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function w(g){this.loader=void 0,this.loader=new u(g)}var v=w.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,x,f){l(L),this.loader.load(L,x,f)},B(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},C.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function w(g){this.loader=void 0,this.loader=new u(g)}var v=w.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,x,f){l(L),this.loader.load(L,x,f)},B(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},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(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},w=function(j){return Math.round(j)},v=function(j){return w(j/100)*100},g=function(j){return encodeURIComponent(j)},L={br:w,d:w,bl:v,dl:v,mtp:v,nor:g,rtp:v,tb:w},x=Object.keys(o||{}).sort(),f=_(x),p;!(p=f()).done;){var d=p.value,a=o[d];if(!u(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var b=L[d];b&&(a=b(a));var m=typeof a,E=void 0;d==="ot"||d==="sf"||d==="st"?E=d+"="+a:m==="boolean"?E=d:m==="number"?E=d+"="+a:E=d+"="+JSON.stringify(a),l.push(E)}return l.join(",")},A.toHeaders=function(o){for(var l=Object.keys(o),u={},w=["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},L=0,x=l;L<x.length;L++){var f=x[L],p=g[f]!=null?g[f]:1;v[p][f]=o[f]}for(var d=0;d<v.length;d++){var a=A.serialize(v[d]);a&&(u["CMCD-"+w[d]]=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(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/utils/logger.ts"),G=O("./src/utils/mediakeys-helper.ts");function H(k,A){for(var C=0;C<A.length;C++){var h=A[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function B(k,A,C){return A&&H(k.prototype,A),C&&H(k,C),k}var _=3,y=function(A,C,h){var o={audioCapabilities:[],videoCapabilities:[]};return A.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),C.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},T=function(A,C,h,o){switch(A){case G.KeySystems.WIDEVINE:return y(C,h,o);default:throw new Error("Unknown key-system: "+A)}},I=function(){function k(C){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=C,this._config=C.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=k.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(h){switch(h){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},A._attemptKeySystemAccess=function(h,o,l){var u=this,w=T(h,o,l,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,w);this.mediaKeysPromise=v.then(function(g){return u._onMediaKeySystemAccessObtained(h,g)}),v.catch(function(g){D.logger.error('Failed to obtain key-system "'+h+'" access:',g)})},A._onMediaKeySystemAccessObtained=function(h,o){var l=this;D.logger.log('Access for key-system "'+h+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(u);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return u.mediaKeys=v,D.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),v});return w.catch(function(v){D.logger.error("Failed to create media-keys:",v)}),w},A._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},A._onNewMediaKeySession=function(h){var o=this;D.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},A._onKeySessionMessage=function(h,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"),h.update(l)})},A.onMediaEncrypted=function(h){var o=this;if(D.logger.log('Media is encrypted using "'+h.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(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},A._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){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(h,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 w=u.mediaKeysSession;if(!w){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 "'+h+'" init data type'),u.mediaKeysSessionInitialized=!0,w.generateRequest(h,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(h,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,h,o,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,u,h),w=void 0}catch(v){D.logger.error(v)}try{u.readyState||u.open("POST",h,!0),w&&w.call(this.hls,u,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return u},A._onLicenseRequestReadyStageChange=function(h,o,l,u){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var w=h.response,v=this._licenseResponseCallback;if(v)try{w=v.call(this.hls,h,o)}catch(L){D.logger.error(L)}u(w)}else{if(D.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){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=_-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(l,u)}break}},A._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},A._requestLicense=function(h,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),w=this._createLicenseXhr(u,h,o);D.logger.log("Sending license request to URL: "+u);var v=this._generateLicenseRequestChallenge(l,h);w.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(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),u=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,u)},B(k,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),k}();Z.default=I},"./src/controller/fps-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts"),U=O("./src/utils/logger.ts"),D=function(){function G(B){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=B,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(_){this.streamController=_},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(_,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(_,y,T){var I=performance.now();if(y){if(this.lastTime){var k=I-this.lastTime,A=T-this.lastDroppedFrames,C=y-this.lastDecodedFrames,h=1e3*A/k,o=this.hls;if(o.trigger(Q.Events.FPS_DROP,{currentDropped:A,currentDecoded:C,totalDroppedFrames:T}),h>0&&A>o.config.fpsDroppedMonitoringThreshold*C){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 _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var y=_.getVideoPlaybackQuality();this.checkFPS(_,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},G}();Z.default=D},"./src/controller/fragment-finders.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"findFragmentByPDT",function(){return D}),O.d(Z,"findFragmentByPTS",function(){return G}),O.d(Z,"fragmentWithinToleranceTest",function(){return H}),O.d(Z,"pdtWithinToleranceTest",function(){return B}),O.d(Z,"findFragWithCC",function(){return _});var Q=O("./src/polyfills/number.ts"),U=O("./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 k=y[0].programDateTime;if(T<(k||0))return null;var A=y[y.length-1].endProgramDateTime;if(T>=(A||0))return null;I=I||0;for(var C=0;C<y.length;++C){var h=y[C];if(B(T,I,h))return h}return null}function G(y,T,I,k){I===void 0&&(I=0),k===void 0&&(k=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,k,A)===0)return A;var C=U.default.search(T,H.bind(null,I,k));return C||A}function H(y,T,I){y===void 0&&(y=0),T===void 0&&(T=0);var k=Math.min(T,I.duration+(I.deltaPTS?I.deltaPTS:0));return I.start+I.duration-k<=y?1:I.start-k>y&&I.start?-1:0}function B(y,T,I){var k=Math.min(T,I.duration+(I.deltaPTS?I.deltaPTS:0))*1e3,A=I.endProgramDateTime||0;return A-k>y}function _(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(de,Z,O){"use strict";O.r(Z),O.d(Z,"FragmentState",function(){return D}),O.d(Z,"FragmentTracker",function(){return G});var Q=O("./src/events.ts"),U=O("./src/types/loader.ts"),D;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(D||(D={}));var G=function(){function _(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=_.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,k){if(k===U.PlaylistLevelType.MAIN){var A=this.activeFragment,C=this.activeParts;if(!A)return null;if(C)for(var h=C.length;h--;){var o=C[h],l=o?o.end:A.appendedPTS;if(o.start<=I&&l!==void 0&&I<=l)return h>9&&(this.activeParts=C.slice(h-9)),o}else if(A.start<=I&&A.appendedPTS!==void 0&&I<=A.appendedPTS)return A}return this.getBufferedFrag(I,k)},y.getBufferedFrag=function(I,k){for(var A=this.fragments,C=Object.keys(A),h=C.length;h--;){var o=A[C[h]];if((o==null?void 0:o.body.type)===k&&o.buffered){var l=o.body;if(l.start<=I&&I<=l.end)return l}}return null},y.detectEvictedFragments=function(I,k,A){var C=this;Object.keys(this.fragments).forEach(function(h){var o=C.fragments[h];if(!o)return;if(!o.buffered){o.body.type===A&&C.removeFragment(o.body);return}var l=o.range[I];if(!l)return;l.time.some(function(u){var w=!C.isTimeBuffered(u.startPTS,u.endPTS,k);return w&&C.removeFragment(o.body),w})})},y.detectPartialFragments=function(I){var k=this,A=this.timeRanges,C=I.frag,h=I.part;if(!A||C.sn==="initSegment")return;var o=B(C),l=this.fragments[o];if(!l)return;Object.keys(A).forEach(function(u){var w=C.elementaryStreams[u];if(!w)return;var v=A[u],g=h!==null||w.partial===!0;l.range[u]=k.getBufferedTimes(C,h,g,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(I){var k=B(I),A=this.fragments[k];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},y.getBufferedTimes=function(I,k,A,C){for(var h={time:[],partial:A},o=k?k.start:I.start,l=k?k.end:I.end,u=I.minEndPTS||l,w=I.maxStartPTS||o,v=0;v<C.length;v++){var g=C.start(v)-this.bufferPadding,L=C.end(v)+this.bufferPadding;if(w>=g&&u<=L){h.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(l,C.end(v))});break}else if(o<L&&l>g)h.partial=!0,h.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(l,C.end(v))});else if(l<=g)break}return h},y.getPartialFragment=function(I){var k=null,A,C,h,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(w){var v=u[w];if(!v)return;H(v)&&(C=v.body.start-l,h=v.body.end+l,I>=C&&I<=h&&(A=Math.min(I-C,h-I),o<=A&&(k=v.body,o=A)))}),k},y.getState=function(I){var k=B(I),A=this.fragments[k];return A?A.buffered?H(A)?D.PARTIAL:D.OK:A.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},y.backtrack=function(I,k){var A=B(I),C=this.fragments[A];if(!C||C.backtrack)return null;var h=C.backtrack=k||C.loaded;return C.loaded=null,h},y.getBacktrackData=function(I){var k=B(I),A=this.fragments[k];if(A){var C,h=A.backtrack;if(h!=null&&(C=h.payload)!==null&&C!==void 0&&C.byteLength)return h;this.removeFragment(I)}return null},y.isTimeBuffered=function(I,k,A){for(var C,h,o=0;o<A.length;o++){if(C=A.start(o)-this.bufferPadding,h=A.end(o)+this.bufferPadding,I>=C&&k<=h)return!0;if(k<=C)return!1}return!1},y.onFragLoaded=function(I,k){var A=k.frag,C=k.part;if(A.sn==="initSegment"||A.bitrateTest||C)return;var h=B(A);this.fragments[h]={body:A,loaded:k,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(I,k){var A=this,C=k.frag,h=k.part,o=k.timeRanges;if(C.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=C,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var w=o[u];if(A.detectEvictedFragments(u,w),!h)for(var v=0;v<w.length;v++)C.appendedPTS=Math.max(w.end(v),C.appendedPTS||0)})},y.onFragBuffered=function(I,k){this.detectPartialFragments(k)},y.hasFragment=function(I){var k=B(I);return!!this.fragments[k]},y.removeFragmentsInRange=function(I,k,A){var C=this;Object.keys(this.fragments).forEach(function(h){var o=C.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===A&&l.start<k&&l.end>I&&C.removeFragment(l)}})},y.removeFragment=function(I){var k=B(I);I.stats.loaded=0,I.clearElementaryStreamInfo(),delete this.fragments[k]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function H(_){var y,T;return _.buffered&&(((y=_.range.video)===null||y===void 0?void 0:y.partial)||((T=_.range.audio)===null||T===void 0?void 0:T.partial))}function B(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),O.d(Z,"MAX_START_GAP_JUMP",function(){return B}),O.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),O.d(Z,"SKIP_BUFFER_RANGE_START",function(){return y}),O.d(Z,"default",function(){return T});var Q=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),D=O("./src/events.ts"),G=O("./src/utils/logger.ts"),H=250,B=2,_=.1,y=.05,T=function(){function I(A,C,h,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=A,this.media=C,this.fragmentTracker=h,this.hls=o}var k=I.prototype;return k.destroy=function(){this.hls=this.fragmentTracker=this.media=null},k.poll=function(C){var h=this.config,o=this.media,l=this.stalled,u=o.currentTime,w=o.seeking,v=this.seeking&&!w,g=!this.seeking&&w;if(this.seeking=w,u!==C){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(L)+"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(w){var d=x.len>B,a=!p||p-u>B&&!this.fragmentTracker.getPartialFragment(u);if(d||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,F=E==null||((b=E.details)===null||b===void 0)?void 0:b.live,j=F?E.details.targetduration*2:B;if(m>0&&m<=j){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!w&&V>=H&&this._reportStall(x.len);var M=Q.BufferHelper.bufferInfo(o,u,h.maxBufferHole);this._tryFixBufferStall(M,V)},k._tryFixBufferStall=function(C,h){var o=this.config,l=this.fragmentTracker,u=this.media,w=u.currentTime,v=l.getPartialFragment(w);if(v){var g=this._trySkipBufferHole(v);if(g)return}C.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},k._reportStall=function(C){var h=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="+C+")"),h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},k._trySkipBufferHole=function(C){for(var h=this.config,o=this.hls,l=this.media,u=l.currentTime,w=0,v=Q.BufferHelper.getBuffered(l),g=0;g<v.length;g++){var L=v.start(g);if(u+h.maxBufferHole>=w&&u<L){var x=Math.max(L+y,l.currentTime+_);return G.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,C&&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:C}),x}w=v.end(g)}return 0},k._tryNudgeBuffer=function(){var C=this.config,h=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<C.nudgeMaxRetry){var w=l+u*C.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+w),o.currentTime=w,h.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 "+C.nudgeMaxRetry+" nudges"),h.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(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),D=O("./src/demux/id3.ts"),G=.25,H=function(){function B(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var _=B.prototype;return _.destroy=function(){this._unregisterListeners()},_._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)},_._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)},_.onMediaAttached=function(T,I){this.media=I.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(T){if(!this.media)return;for(var I=0;I<T.length;I++){var k=T[I];if(k.kind==="metadata"&&k.label==="id3")return Object(U.sendAddTrackEvent)(k,this.media),k}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(T,I){if(!this.media)return;var k=I.frag,A=I.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<A.length;h++){var o=D.getID3Frames(A[h].data);if(o){var l=A[h].pts,u=h<A.length-1?A[h+1].pts:k.end,w=u-l;w<=0&&(u=l+G);for(var v=0;v<o.length;v++){var g=o[v];if(!D.isTimeStampFrame(g)){var L=new C(l,u,"");L.value=g,this.id3Track.addCue(L)}}}}},_.onBufferFlushing=function(T,I){var k=I.startOffset,A=I.endOffset,C=I.type;if(!C||C==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,k,A)}},B}();Z.default=H},"./src/controller/latency-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return B});var Q=O("./src/errors.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts");function G(_,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(_,I.key,I)}}function H(_,y,T){return y&&G(_.prototype,y),T&&G(_,T),_}var B=function(){function _(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=_.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,k){this.media=k.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(I,k){var A=k.details;this.levelDetails=A,A.advanced&&this.timeupdate(),!A.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(I,k){if(k.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,k=this.levelDetails;if(!I||!k)return;this.currentTime=I.currentTime;var A=this.computeLatency();if(A===null)return;this._latency=A;var C=this.config,h=C.lowLatencyMode,o=C.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var u=A-l,w=Math.min(this.maxLatency,l+k.targetduration),v=u<w;if(k.live&&v&&u>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;I.playbackRate=Math.min(g,Math.max(1,L))}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(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var I=this.config,k=this.levelDetails;return I.liveMaxLatencyDuration!==void 0?I.liveMaxLatencyDuration:k?I.liveMaxLatencyDurationCount*k.targetduration:0}},{key:"targetLatency",get:function(){var I=this.levelDetails;if(I===null)return null;var k=I.holdBack,A=I.partHoldBack,C=I.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,u=h.lowLatencyMode,w=this.hls.userConfig,v=u&&A||k;(w.liveSyncDuration||w.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*C);var g=C,L=1;return v+Math.min(this.stallCount*L,g)}},{key:"liveSyncPosition",get:function(){var I=this.estimateLiveEdge(),k=this.targetLatency,A=this.levelDetails;if(I===null||k===null||A===null)return null;var C=A.edge,h=I-k-this.edgeStalled,o=C-A.totalduration,l=C-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,h),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 k=(this.config.lowLatencyMode&&I.partTarget||I.targetduration)*3;return Math.max(I.age-k,0)}},{key:"forwardBufferLength",get:function(){var I=this.media,k=this.levelDetails;if(!I||!k)return 0;var A=I.buffered.length;return A?I.buffered.end(A-1):k.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return h});var Q=O("./src/types/level.ts"),U=O("./src/events.ts"),D=O("./src/errors.ts"),G=O("./src/utils/codecs.ts"),H=O("./src/controller/level-helper.ts"),B=O("./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 w in u)Object.prototype.hasOwnProperty.call(u,w)&&(o[w]=u[w])}return o},y.apply(this,arguments)}function T(o,l){for(var u=0;u<l.length;u++){var w=l[u];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function I(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,A(o,l)}function A(o,l){return A=Object.setPrototypeOf||function(w,v){return w.__proto__=v,w},A(o,l)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){k(l,o);function l(w){var v;return v=o.call(this,w,"[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 L=[],x=[],f=[],p,d={},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,C&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var P=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=d[P],a?a.url.push(V.url):(a=new Q.Level(V),d[P]=a,L.push(a)),M&&(M.AUDIO&&Object(H.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(H.addGroupId)(a,"text",M.SUBTITLES))}),(b||m)&&E&&(L=L.filter(function(V){var M=V.videoCodec,P=V.width,$=V.height;return!!M||!!(P&&$)})),L=L.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)),L.length>0){p=L[0].bitrate,L.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=L;for(var F=0;F<L.length;F++)if(L[F].bitrate===p){this._firstLevel=F,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+p);break}var j=E&&!m,K={levels:L,audioTracks:x,subtitleTracks:f,firstLevel:this._firstLevel,stats:g.stats,audio:E,video:m,altAudio:!j&&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 L=g.context,x=this._levels[this.currentLevelIndex];if(L&&(L.type===_.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&L.groupId===x.audioGroupIds[x.urlId]||L.type===_.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&L.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,p=!0,d;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&&(d=g.frag.level)):d=g.frag.level}break;case D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(p=!1),d=L.level),f=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:d=g.level,f=!0;break}d!==void 0&&this.recoverLevel(g,d,f,p)},u.recoverLevel=function(v,g,L,x){var f=v.details,p=this._levels[g];if(p.loadError++,L){var d=this.retryLoadingOrFail(v);if(d)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],L=g.url.length;if(L>1){var x=(g.urlId+1)%L;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 L=g.frag;if(L!==void 0&&L.type===_.PlaylistLevelType.MAIN){var x=this._levels[L.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(v,g){var L,x=g.level,f=g.details,p=this._levels[x];if(!p){var d;this.warn("Invalid level index "+x),(d=g.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(x,g,p.details)):(L=g.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(v,g){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var x=-1,f=this.hls.audioTracks[g.id].groupId,p=0;p<L.audioGroupIds.length;p++)if(L.audioGroupIds[p]===f){x=p;break}x!==L.urlId&&(L.urlId=x,this.startLoad())}},u.loadPlaylist=function(v){var g=this.currentLevelIndex,L=this._levels[g];if(this.canLoad&&L&&L.url.length>0){var x=L.urlId,f=L.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 L=function(p,d){return d!==g},x=this._levels.filter(function(f,p){return p!==v?!0:f.url.length>1&&g!==void 0?(f.url=f.url.filter(L),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(L)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(L)),f.urlId=0,!0):!1}).map(function(f,p){var d=f.details;return d!=null&&d.fragments&&d.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,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===v&&(g=L[v])!==null&&g!==void 0&&g.details)return;if(v<0||v>=L.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,L.length-1)}this.clearTimer();var f=this.currentLevelIndex,p=L[f],d=L[v];this.log("switching to level "+v+" from "+f),this.currentLevelIndex=v;var a=y({},d,{level:v,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var b=d.details;if(!b||b.live){var m=this.switchParams(d.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}(B.default)},"./src/controller/level-helper.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"addGroupId",function(){return D}),O.d(Z,"assignTrackIdsByGroup",function(){return G}),O.d(Z,"updatePTS",function(){return H}),O.d(Z,"updateFragPTSDTS",function(){return _}),O.d(Z,"mergeDetails",function(){return y}),O.d(Z,"mapPartIntersection",function(){return T}),O.d(Z,"mapFragmentIntersection",function(){return I}),O.d(Z,"adjustSliding",function(){return k}),O.d(Z,"addSliding",function(){return A}),O.d(Z,"computeReloadInterval",function(){return C}),O.d(Z,"getFragmentWithSN",function(){return h}),O.d(Z,"getPartWith",function(){return o});var Q=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts");function D(l,u,w){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function G(l){var u={};l.forEach(function(w){var v=w.groupId||"";w.id=u[v]=u[v]||0,u[v]++})}function H(l,u,w){var v=l[u],g=l[w];B(v,g)}function B(l,u){var w=u.startPTS;if(Object(Q.isFiniteNumber)(w)){var v=0,g;u.sn>l.sn?(v=w-l.start,g=l):(v=l.start-w,g=u),g.duration!==v&&(g.duration=v)}else if(u.sn>l.sn){var L=l.cc===u.cc;L&&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 _(l,u,w,v,g,L){var x=v-w;x<=0&&(U.logger.warn("Fragment should have a positive duration",u),v=w+u.duration,L=g+u.duration);var f=w,p=v,d=u.startPTS,a=u.endPTS;if(Object(Q.isFiniteNumber)(d)){var b=Math.abs(d-w);Object(Q.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(b,u.deltaPTS):u.deltaPTS=b,f=Math.max(w,d),w=Math.min(w,d),g=Math.min(g,u.startDTS),p=Math.min(v,a),v=Math.max(v,a),L=Math.max(L,u.endDTS)}u.duration=v-w;var m=w-u.start;u.appendedPTS=v,u.start=u.startPTS=w,u.maxStartPTS=f,u.startDTS=g,u.endPTS=v,u.minEndPTS=p,u.endDTS=L;var E=u.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var F,j=E-l.startSN,K=l.fragments;for(K[j]=u,F=j;F>0;F--)B(K[F],K[F-1]);for(F=j;F<K.length-1;F++)B(K[F],K[F+1]);return l.fragmentHint&&B(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function y(l,u){for(var w=null,v=l.fragments,g=v.length-1;g>=0;g--){var L=v[g].initSegment;if(L){w=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,f;if(I(l,u,function(F,j){F.relurl&&(x=F.cc-j.cc),Object(Q.isFiniteNumber)(F.startPTS)&&Object(Q.isFiniteNumber)(F.endPTS)&&(j.start=j.startPTS=F.startPTS,j.startDTS=F.startDTS,j.appendedPTS=F.appendedPTS,j.maxStartPTS=F.maxStartPTS,j.endPTS=F.endPTS,j.endDTS=F.endDTS,j.minEndPTS=F.minEndPTS,j.duration=F.endPTS-F.startPTS,j.duration&&(f=j),u.PTSKnown=u.alignedSliding=!0),j.elementaryStreams=F.elementaryStreams,j.loader=F.loader,j.stats=F.stats,j.urlId=F.urlId,F.initSegment&&(j.initSegment=F.initSegment,w=F.initSegment)}),w){var p=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;p.forEach(function(F){var j;(!F.initSegment||F.initSegment.relurl===((j=w)===null||j===void 0?void 0:j.relurl))&&(F.initSegment=w)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(F){return!F}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)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(F,j){j.elementaryStreams=F.elementaryStreams,j.stats=F.stats}),f?_(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):k(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,w){if(l&&u)for(var v=0,g=0,L=l.length;g<=L;g++){var x=l[g],f=u[g+v];x&&f&&x.index===f.index&&x.fragment.sn===f.fragment.sn?w(x,f):v--}}function I(l,u,w){for(var v=u.skippedSegments,g=Math.max(l.startSN,u.startSN)-u.startSN,L=(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,d=g;d<=L;d++){var a=p[x+d],b=f[d];v&&!b&&d<v&&(b=u.fragments[d]=a),a&&b&&w(a,b)}}function k(l,u){var w=u.startSN+u.skippedSegments-l.startSN,v=l.fragments;if(w<0||w>=v.length)return;A(u,v[w].start)}function A(l,u){if(u){for(var w=l.fragments,v=l.skippedSegments;v<w.length;v++)w[v].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function C(l,u){var w=1e3*l.levelTargetDuration,v=w/2,g=l.age,L=g>0&&g<w*3,x=u.loading.end-u.loading.start,f,p=l.availabilityDelay;if(l.updated===!1)if(L){var d=333*l.misses;f=Math.max(Math.min(v,x*2),d),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=v;else L?(p=Math.min(p||w/2,g),l.availabilityDelay=p,f=p+w-g):f=w-x;return Math.round(f)}function h(l,u,w){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&&w&&w.sn===u?w:null)}function o(l,u,w){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var g=v.length;g--;){var L=v[g];if(L.index===w&&L.fragment.sn===u)return L}return null}},"./src/controller/stream-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return v});var Q=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),D=O("./src/is-supported.ts"),G=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),B=O("./src/controller/fragment-tracker.ts"),_=O("./src/types/loader.ts"),y=O("./src/loader/fragment.ts"),T=O("./src/demux/transmuxer-interface.ts"),I=O("./src/types/transmuxer.ts"),k=O("./src/controller/gap-controller.ts"),A=O("./src/errors.ts"),C=O("./src/utils/logger.ts");function h(g,L){for(var x=0;x<L.length;x++){var f=L[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function o(g,L,x){return L&&h(g.prototype,L),x&&h(g,x),g}function l(g,L){g.prototype=Object.create(L.prototype),g.prototype.constructor=g,u(g,L)}function u(g,L){return u=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},u(g,L)}var w=100,v=function(g){l(L,g);function L(f,p){var d;return d=g.call(this,f,p,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var x=L.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 d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),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}d>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),p=d),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,d=this.levels,a=this.level,b=d==null||((p=d[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(),F=this.retryDate;(!F||E>=F||(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,d,a=this.hls,b=this.levelLastLoaded,m=this.levels,E=this.media,F=a.config,j=a.nextLoadLevel;if(b===null||!E&&(this.startFragRequested||!F.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[j])return;var K=m[j];this.level=a.nextLoadLevel=j;var V=K.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,_.PlaylistLevelType.MAIN);if(M===null)return;var P=M.len,$=this.getMaxBufferLength(K.maxBitrate);if(P>=$)return;if(this._streamEnded(M,V)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ne),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 ke=me.sn-V.startSN;ke>1&&(me=V.fragments[ke-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===B.FragmentState.OK&&this.nextLoadPosition>he){var xe=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,xe,_.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"&&!((d=me.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(me,V):this.loadFragment(me,V,he)},x.loadFragment=function(p,d,a){var b,m=this.fragmentTracker.getState(p);if(this.fragCurrent=p,m===B.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(p);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=B.FragmentState.NOT_LOADED}m===B.FragmentState.NOT_LOADED||m===B.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,d,a)):m===B.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 d=this.fragmentTracker.getAppendedFrag(p,_.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},x.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,_.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,d=this.media;if(d!=null&&d.readyState){var a,b=this.getAppendedFrag(d.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!d.paused&&p){var m=this.hls.nextLoadLevel,E=p[m],F=this.fragLastKbps;F&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*F)+1:a=0}else a=0;var j=this.getBufferedFrag(d.currentTime+a);if(j){var K=this.followingBufferedFrag(j);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,M=K.duration,P=Math.max(j.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,d){g.prototype.flushMainBuffer.call(this,p,d,this.altAudio?"video":null)},x.onMediaAttached=function(p,d){g.prototype.onMediaAttached.call(this,p,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new k.default(this.config,a,this.fragmentTracker,this.hls)},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,d=p?p.currentTime:null;Object(Q.isFiniteNumber)(d)&&this.log("Media seeked to "+d.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,d){var a=!1,b=!1,m;d.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=d.levels,this.startFragRequested=!1},x.onLevelLoading=function(p,d){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var b=a[d.level];(!b.details||b.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(b.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(p,d){var a,b=this.levels,m=d.level,E=d.details,F=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:"+F);var j=this.fragCurrent;j&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==d.level&&j.loader&&(this.state=U.State.IDLE,j.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 d,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 F=E[a.level],j=F.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=F.videoCodec,V=j.PTSKnown||!j.live,M=(d=a.initSegment)===null||d===void 0?void 0:d.data,P=this._getAudioCodec(F),$=this.transmuxer=this.transmuxer||new T.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=b?b.index:-1,he=ne!==-1,me=new I.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,ne,he),ke=this.initPTS[a.cc];$.push(m,M,P,K,a,b,j.totalduration,V,me,ke)},x.onAudioTrackSwitching=function(p,d){var a=this.altAudio,b=!!d.url,m=d.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 F=this.hls;a&&F.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),F.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:m})}},x.onAudioTrackSwitched=function(p,d){var a=d.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,d){var a=d.tracks,b,m,E=!1;for(var F in a){var j=a[F];if(j.id==="main"){if(m=F,b=j,F==="video"){var K=a[F];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,d){var a=d.frag,b=d.part;if(a&&a.type!==_.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,d){switch(d.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(_.PlaylistLevelType.MAIN,d);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=U.State.ERROR):!d.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,_.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,d=this.gapController;if(!p||!d||!p.readyState)return;var a=H.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.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,d){var a=d.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,_.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(p,d){this.levels=d.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var p=this.media,d=p.currentTime,a=this.startPosition;if(a>=0&&d<a){if(p.seeking){C.logger.log("could not seek to "+a+", already seeking at "+d);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)&&(C.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 "+d),p.currentTime=a}},x._getAudioCodec=function(p){var d=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},x._loadBitrateTestFrag=function(p){var d=this;this._doFragLoad(p).then(function(a){var b=d.hls;if(!a||b.nextLoadLevel||d.fragContextChanged(p))return;d.fragLoadError=0,d.state=U.State.IDLE,d.startFragRequested=!1,d.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 d,a="main",b=this.hls,m=p.remuxResult,E=p.chunkMeta,F=this.getCurrentContext(E);if(!F){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 j=F.frag,K=F.part,V=F.level,M=m.video,P=m.text,$=m.id3,ne=m.initSegment,he=this.altAudio?void 0:m.audio;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,ne){ne.tracks&&(this._bufferInitSegment(V,ne.tracks,j,E),b.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:a,tracks:ne.tracks}));var me=ne.initPTS,ke=ne.timescale;Object(Q.isFiniteNumber)(me)&&(this.initPTS[j.cc]=me,b.trigger(G.Events.INIT_PTS_FOUND,{frag:j,id:a,initPTS:me,timescale:ke}))}if(M&&m.independent!==!1){if(V.details){var xe=M.startPTS,Le=M.endPTS,Te=M.startDTS,Se=M.endDTS;if(K)K.elementaryStreams[M.type]={startPTS:xe,endPTS:Le,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(j);return}j.setElementaryStreamInfo(M.type,j.start,Le,j.start,Se,!0)}j.setElementaryStreamInfo(M.type,xe,Le,Te,Se),this.bufferFragmentData(M,j,K,E)}}else if(m.independent===!1){this.backtrack(j);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}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,z,s,c,R),this.bufferFragmentData(he,j,K,E)}if($!=null&&(d=$.samples)!==null&&d!==void 0&&d.length){var Y={frag:j,id:a,samples:$.samples};b.trigger(G.Events.FRAG_PARSING_METADATA,Y)}if(P){var N={frag:j,id:a,samples:P.samples};b.trigger(G.Events.FRAG_PARSING_USERDATA,N)}},x._bufferInitSegment=function(p,d,a,b){var m=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var E=d.audio,F=d.video,j=d.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+"]")}F&&(F.levelCodec=p.videoCodec,F.id="main",this.log("Init video buffer, container:"+F.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+F.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(M){var P=d[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 d=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,d?this.resetFragmentLoading(p):this.state=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var p=this.media,d=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(H.BufferHelper.isBuffered(p,a)?d=this.getAppendedFrag(a):H.BufferHelper.isBuffered(p,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var b=this.fragPlaying,m=d.level;(!b||d.sn!==b.sn||b.level!==m||d.urlId!==b.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:d}),(!b||b.level!==m)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=d)}}},o(L,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"SubtitleStreamController",function(){return l});var Q=O("./src/events.ts"),U=O("./src/utils/logger.ts"),D=O("./src/utils/buffer-helper.ts"),G=O("./src/controller/fragment-finders.ts"),H=O("./src/utils/discontinuities.ts"),B=O("./src/controller/level-helper.ts"),_=O("./src/controller/fragment-tracker.ts"),y=O("./src/controller/base-stream-controller.ts"),T=O("./src/types/loader.ts"),I=O("./src/types/level.ts");function k(u,w){for(var v=0;v<w.length;v++){var g=w[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}function A(u,w,v){return w&&k(u.prototype,w),v&&k(u,v),u}function C(u,w){u.prototype=Object.create(w.prototype),u.prototype.constructor=u,h(u,w)}function h(u,w){return h=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},h(u,w)}var o=500,l=function(u){C(w,u);function w(g,L){var x;return x=u.call(this,g,L,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var v=w.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var L=this.hls;L.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(Q.Events.ERROR,this.onError,this),L.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var L=this.hls;L.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(Q.Events.ERROR,this.onError,this),L.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.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(L,x){this.mainDetails=x.details},v.onSubtitleFragProcessed=function(L,x){var f=x.frag,p=x.success;if(this.fragPrevious=f,this.state=y.State.IDLE,!p)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,b=f.start,m=0;m<d.length;m++)if(b>=d[m].start&&b<=d[m].end){a=d[m];break}var E=f.start+f.duration;a?a.end=E:(a={start:b,end:E},d.push(a)),this.fragmentTracker.fragBuffered(f)},v.onBufferFlushing=function(L,x){var f=x.startOffset,p=x.endOffset;if(f===0&&p!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var b=a[d].details,m=b.targetduration,E=p-m;if(E<=0)return;x.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(F){for(var j=0;j<F.length;){if(F[j].end<=E){F.shift();continue}else if(F[j].start<E)F[j].start=E;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(f,E,T.PlaylistLevelType.SUBTITLE)}},v.onError=function(L,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(L,x){var f=this,p=x.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(d){return new I.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(L,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(L,x){var f,p=x.details,d=x.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var m=b[a];if(d>=b.length||d!==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 F=E.fragments[0];if(!m.details)p.hasProgramDateTime&&E.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(p,E):F&&Object(B.addSliding)(p,F.start);else{var j=this.alignPlaylists(p,m.details);j===0&&F&&Object(B.addSliding)(p,F.start)}}if(m.details=p,this.levelLastLoaded=d,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(L){var x=L.frag,f=L.payload,p=x.decryptdata,d=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();d.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 L,x=this.currentTrackId,f=this.levels;if(!f.length||!f[x]||!f[x].details)return;var p=f[x].details,d=p.targetduration,a=this.config,b=this.media,m=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-d,a.maxBufferHole),E=m.end,F=m.len,j=this.getMaxBufferLength()+d;if(F>j)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 ne=a.maxFragLookUpTolerance;$&&p.hasProgramDateTime&&(P=Object(G.findFragmentByPDT)(K,$.endProgramDateTime,ne)),P||(P=Object(G.findFragmentByPTS)($,K,E,ne),!P&&$&&$.start<K[0].start&&(P=K[0]))}else P=K[V-1];(L=P)!==null&&L!==void 0&&L.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)===_.FragmentState.NOT_LOADED&&this.loadFragment(P,p,E)}},v.loadFragment=function(L,x,f){this.fragCurrent=L,u.prototype.loadFragment.call(this,L,x,f)},A(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(y.default)},"./src/controller/subtitle-track-controller.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),D=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(k,A){for(var C=0;C<A.length;C++){var h=A[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function B(k,A,C){return A&&H(k.prototype,A),C&&H(k,C),k}function _(k,A){k.prototype=Object.create(A.prototype),k.prototype.constructor=k,y(k,A)}function y(k,A){return y=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},y(k,A)}var T=function(k){_(A,k);function A(h){var o;return o=k.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var C=A.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,k.prototype.destroy.call(this)},C.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)},C.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)},C.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)},C.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},C.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},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},C.onSubtitleTrackLoaded=function(o,l){var u=l.id,w=l.details,v=this.trackId,g=this.tracksInGroup[v];if(!g){this.warn("Invalid subtitle track id "+u);return}var L=g.details;g.details=l.details,this.log("subtitle track "+u+" loaded ["+w.startSN+"-"+w.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,L))},C.onLevelLoading=function(o,l){this.switchLevel(l.level)},C.onLevelSwitching=function(o,l){this.switchLevel(l.level)},C.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 w=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(w==null?void 0:w.name)||this.findTrackId();this.groupId=u;var L={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,L),g!==-1&&this.setSubtitleTrack(g,w)}},C.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var w=l[u];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},C.onError=function(o,l){if(k.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)},C.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,w=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:w,deliveryDirectives:o||null})}},C.toggleTrackModes=function(o){var l=this,u=this.media,w=this.subtitleDisplay,v=this.trackId;if(!u)return;var g=I(u.textTracks),L=g.filter(function(p){return p.groupId===l.groupId});if(o===-1)[].slice.call(g).forEach(function(p){p.mode="disabled"});else{var x=L[v];x&&(x.mode="disabled")}var f=L[o];f&&(f.mode=w?"showing":"hidden")},C.setSubtitleTrack=function(o,l){var u,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=w[o])!==null&&u!==void 0&&u.details)||o<-1||o>=w.length)return;this.clearTimer();var v=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var g=v.id,L=v.groupId,x=L===void 0?"":L,f=v.name,p=v.type,d=v.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:x,name:f,type:p,url:d});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})},C.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)},B(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(k){for(var A=[],C=0;C<k.length;C++){var h=k[C];h.kind==="subtitles"&&h.label&&A.push(k[C])}return A}Z.default=T},"./src/controller/timeline-controller.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"TimelineController",function(){return I});var Q=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/utils/cea-608-parser.ts"),G=O("./src/utils/output-filter.ts"),H=O("./src/utils/webvtt-parser.ts"),B=O("./src/utils/texttrack-utils.ts"),_=O("./src/utils/imsc1-ttml-parser.ts"),y=O("./src/types/loader.ts"),T=O("./src/utils/logger.ts"),I=function(){function h(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),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"),w=new G.default(this,"textTrack2"),v=new G.default(this,"textTrack3"),g=new G.default(this,"textTrack4");this.cea608Parser1=new D.default(1,u,w),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=h.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,w,v,g,L){for(var x=!1,f=L.length;f--;){var p=L[f],d=A(p[0],p[1],w,v);if(d>=0&&(p[0]=Math.min(p[0],w),p[1]=Math.max(p[1],v),x=!0,d/(v-w)>.5))return}if(x||L.push([w,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,w,v,g)}else{var b=this.Cues.newCue(null,w,v,g);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:b,track:u})}},o.onInitPtsFound=function(u,w){var v=this,g=w.frag,L=w.id,x=w.initPTS,f=w.timescale,p=this.unparsedVttFrags;L==="main"&&(this.initPTS[g.cc]=x,this.timescale[g.cc]=f),p.length&&(this.unparsedVttFrags=[],p.forEach(function(d){v.onFragLoaded(U.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(u){var w=this.media;if(w)for(var v=0;v<w.textTracks.length;v++){var g=w.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 w=this.captionsProperties,v=this.captionsTracks,g=this.media,L=w[u],x=L.label,f=L.languageCode,p=this.getExistingTrack(u);if(p)v[u]=p,Object(B.clearCurrentCues)(v[u]),Object(B.sendAddTrackEvent)(v[u],g);else{var d=this.createTextTrack("captions",x,f);d&&(d[u]=!0,v[u]=d)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var w=this.captionsProperties[u];if(!w)return;var v=w.label,g={_id:u,label:v,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[u]=g,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},o.createTextTrack=function(u,w,v){var g=this.media;return g?g.addTextTrack(u,w,v):void 0},o.onMediaAttaching=function(u,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(w){Object(B.clearCurrentCues)(u[w]),delete u[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),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 w=u.textTracks;if(w)for(var v=0;v<w.length;v++)Object(B.clearCurrentCues)(w[v])},o.onSubtitleTracksUpdated=function(u,w){var v=this;this.textTracks=[];var g=w.subtitleTracks||[],L=g.some(function(d){return d.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||L&&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(d,a){var b;if(a<f.length){for(var m=null,E=0;E<f.length;E++)if(k(f[E],d)){m=f[E];break}m&&(b=m)}b?Object(B.clearCurrentCues)(b):(b=v.createTextTrack("subtitles",d.name,d.lang),b&&(b.mode="disabled")),b&&(b.groupId=d.groupId,v.textTracks.push(b))})}else if(!x&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(u,w){var v=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(g){var L=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!L)return;var x="textTrack"+L[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,w){var v=this.cea608Parser1,g=this.cea608Parser2,L=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(v&&g))return;if(w.frag.type===y.PlaylistLevelType.MAIN){var f,p,d=w.frag.sn,a=(f=w==null||((p=w.part)===null||p===void 0)?void 0:p.index)!=null?f:-1;d===L+1||d===L&&a===x+1||(v.reset(),g.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(u,w){var v=w.frag,g=w.payload,L=this.initPTS,x=this.unparsedVttFrags;if(v.type===y.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(Q.isFiniteNumber)(L[v.cc])){x.push(w),L.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],d=this.vttCCs;d[v.cc]||(d[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===_.IMSC1_CODEC?this._parseIMSC1(v,g):this._parseVTTs(v,g,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,w){var v=this,g=this.hls;Object(_.parseIMSC1)(w,this.initPTS[u.cc],this.timescale[u.cc],function(L){v._appendCues(L,u.level),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(L){T.logger.log("Failed to parse IMSC1: "+L),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:L})})},o._parseVTTs=function(u,w,v){var g=this,L=this.hls;Object(H.parseWebVTT)(w,this.initPTS[u.cc],this.timescale[u.cc],v,u.cc,u.start,function(x){g._appendCues(x,u.level),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(x){g._fallbackToIMSC1(u,w),T.logger.log("Failed to parse VTT cue: "+x),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:x})})},o._fallbackToIMSC1=function(u,w){var v=this,g=this.tracks[u.level];g.textCodec||Object(_.parseIMSC1)(w,this.initPTS[u.cc],this.timescale[u.cc],function(){g.textCodec=_.IMSC1_CODEC,v._parseIMSC1(u,w)},function(){g.textCodec="wvtt"})},o._appendCues=function(u,w){var v=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[w];if(g.mode==="disabled")return;u.forEach(function(f){return Object(B.addCueToTrack)(g,f)})}else{var L=this.tracks[w],x=L.default?"default":"subtitles"+w;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:x})}},o.onFragDecrypted=function(u,w){var v=w.frag;if(v.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(U.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,w){var v=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(v&&g))return;for(var L=0;L<w.samples.length;L++){var x=w.samples[L].bytes;if(x){var f=this.extractCea608Data(x);v.addData(w.samples[L].pts,f[0]),g.addData(w.samples[L].pts,f[1])}}},o.onBufferFlushing=function(u,w){var v=w.startOffset,g=w.endOffset,L=w.endOffsetSubtitles,x=w.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(B.removeCuesInRange)(p[a],v,g)})}if(this.config.renderTextTracksNatively&&(v===0&&L!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(B.removeCuesInRange)(d[a],v,L)})}},o.extractCea608Data=function(u){for(var w=u[0]&31,v=2,g=[[],[]],L=0;L<w;L++){var x=u[v++],f=127&u[v++],p=127&u[v++],d=(4&x)!==0,a=3&x;if(f===0&&p===0)continue;d&&((a===0||a===1)&&(g[a].push(f),g[a].push(p)))}return g},h}();function k(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function A(h,o,l,u){return Math.min(o,u)-Math.max(h,l)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(de,Z,O){"use strict";O.r(Z),O.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,B){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},B,H)},U}()},"./src/crypt/aes-decryptor.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"removePadding",function(){return U}),O.d(Z,"default",function(){return D});var Q=O("./src/utils/typed-array.ts");function U(G){var H=G.byteLength,B=H&&new DataView(G.buffer).getUint8(H-1);return B?Object(Q.sliceUint8)(G,0,H-B):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(_){for(var y=new DataView(_),T=new Uint32Array(4),I=0;I<4;I++)T[I]=y.getUint32(I*4);return T},H.initTable=function(){var _=this.sBox,y=this.invSBox,T=this.subMix,I=T[0],k=T[1],A=T[2],C=T[3],h=this.invSubMix,o=h[0],l=h[1],u=h[2],w=h[3],v=new Uint32Array(256),g=0,L=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=L^L<<1^L<<2^L<<3^L<<4;f=f>>>8^f&255^99,_[g]=f,y[f]=g;var p=v[g],d=v[p],a=v[d],b=v[f]*257^f*16843008;I[g]=b<<24|b>>>8,k[g]=b<<16|b>>>16,A[g]=b<<8|b>>>24,C[g]=b,b=a*16843009^d*65537^p*257^g*16843008,o[f]=b<<24|b>>>8,l[f]=b<<16|b>>>16,u[f]=b<<8|b>>>24,w[f]=b,g?(g=p^v[v[v[a^p]]],L^=v[v[L]]):g=L=1}},H.expandKey=function(_){for(var y=this.uint8ArrayToUint32Array_(_),T=!0,I=0;I<y.length&&T;)T=y[I]===this.key[I],I++;if(T)return;this.key=y;var k=this.keySize=y.length;if(k!==4&&k!==6&&k!==8)throw new Error("Invalid aes key size="+k);var A=this.ksRows=(k+6+1)*4,C,h,o=this.keySchedule=new Uint32Array(A),l=this.invKeySchedule=new Uint32Array(A),u=this.sBox,w=this.rcon,v=this.invSubMix,g=v[0],L=v[1],x=v[2],f=v[3],p,d;for(C=0;C<A;C++){if(C<k){p=o[C]=y[C];continue}d=p,C%k===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=w[C/k|0]<<24):k>6&&C%k===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),o[C]=p=(o[C-k]^d)>>>0}for(h=0;h<A;h++)C=A-h,h&3?d=o[C]:d=o[C-4],h<4||C<=4?l[h]=d:l[h]=g[u[d>>>24]]^L[u[d>>>16&255]]^x[u[d>>>8&255]]^f[u[d&255]],l[h]=l[h]>>>0},H.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},H.decrypt=function(_,y,T){for(var I=this.keySize+6,k=this.invKeySchedule,A=this.invSBox,C=this.invSubMix,h=C[0],o=C[1],l=C[2],u=C[3],w=this.uint8ArrayToUint32Array_(T),v=w[0],g=w[1],L=w[2],x=w[3],f=new Int32Array(_),p=new Int32Array(f.length),d,a,b,m,E,F,j,K,V,M,P,$,ne,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^k[0],F=$^k[1],j=P^k[2],K=M^k[3],ne=4,he=1;he<I;he++)d=h[E>>>24]^o[F>>16&255]^l[j>>8&255]^u[K&255]^k[ne],a=h[F>>>24]^o[j>>16&255]^l[K>>8&255]^u[E&255]^k[ne+1],b=h[j>>>24]^o[K>>16&255]^l[E>>8&255]^u[F&255]^k[ne+2],m=h[K>>>24]^o[E>>16&255]^l[F>>8&255]^u[j&255]^k[ne+3],E=d,F=a,j=b,K=m,ne=ne+4;d=A[E>>>24]<<24^A[F>>16&255]<<16^A[j>>8&255]<<8^A[K&255]^k[ne],a=A[F>>>24]<<24^A[j>>16&255]<<16^A[K>>8&255]<<8^A[E&255]^k[ne+1],b=A[j>>>24]<<24^A[K>>16&255]<<16^A[E>>8&255]<<8^A[F&255]^k[ne+2],m=A[K>>>24]<<24^A[E>>16&255]<<16^A[F>>8&255]<<8^A[j&255]^k[ne+3],p[y]=me(d^v),p[y+1]=me(m^g),p[y+2]=me(b^L),p[y+3]=me(a^x),v=V,g=M,L=P,x=$,y=y+4}return p.buffer},G}()},"./src/crypt/decrypter.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return y});var Q=O("./src/crypt/aes-crypto.ts"),U=O("./src/crypt/fast-aes-key.ts"),D=O("./src/crypt/aes-decryptor.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),B=O("./src/utils/typed-array.ts"),_=16,y=function(){function T(k,A,C){var h=C===void 0?{}:C,o=h.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=k,this.config=A,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(w){}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 C=new Uint8Array(A);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(C):C},I.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},I.decrypt=function(A,C,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(A),C,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(A),C,h).then(o)},I.softwareDecrypt=function(A,C,h){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 w=this.getValidChunk(A);if(!w.length)return null;o&&(h=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new D.default),v.expandKey(C);var g=l;return this.currentResult=v.decrypt(w.buffer,0,h),this.currentIV=Object(B.sliceUint8)(w,-16).buffer,g||null},I.webCryptoDecrypt=function(A,C,h){var o=this,l=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new U.default(l,C)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new Q.default(l,h);return w.decrypt(A.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,A,C,h)})},I.onWebCryptoError=function(A,C,h,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",A),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,h,o)},I.getValidChunk=function(A){var C=A,h=A.length-A.length%_;return h!==A.length&&(C=Object(B.sliceUint8)(A,0,h),this.remainderData=Object(B.sliceUint8)(A,h)),C},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(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.r(Z);var Q=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/adts.ts"),D=O("./src/utils/logger.ts"),G=O("./src/demux/id3.ts");function H(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,B(y,T)}function B(y,T){return B=Object.setPrototypeOf||function(k,A){return k.__proto__=A,k},B(y,T)}var _=function(y){H(T,y);function T(k,A){var C;return C=y.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=k,C.config=A,C}var I=T.prototype;return I.resetInitSegment=function(A,C,h){y.prototype.resetInitSegment.call(this,A,C,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:A,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(A){if(!A)return!1;for(var C=G.getID3Data(A,0)||[],h=C.length,o=A.length;h<o;h++)if(U.probe(A,h))return D.logger.log("ADTS sync word found !"),!0;return!1},I.canParse=function(A,C){return U.canParse(A,C)},I.appendFrame=function(A,C,h){U.initTrackConfig(A,this.observer,C,h,A.manifestCodec);var o=U.appendFrame(A,C,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(Q.default);_.minProbeByteLength=9,Z.default=_},"./src/demux/adts.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"getAudioConfig",function(){return G}),O.d(Z,"isHeaderPattern",function(){return H}),O.d(Z,"getHeaderLength",function(){return B}),O.d(Z,"getFullFrameLength",function(){return _}),O.d(Z,"canGetFrameLength",function(){return y}),O.d(Z,"isHeader",function(){return T}),O.d(Z,"canParse",function(){return I}),O.d(Z,"probe",function(){return k}),O.d(Z,"initTrackConfig",function(){return A}),O.d(Z,"getFrameDuration",function(){return C}),O.d(Z,"parseFrameHeader",function(){return h}),O.d(Z,"appendFrame",function(){return o});var Q=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),D=O("./src/events.ts");function G(l,u,w,v){var g,L,x,f,p=navigator.userAgent.toLowerCase(),d=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((u[w+2]&192)>>>6)+1;var b=(u[w+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[w+2]&1)<<2,x|=(u[w+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),L=b-3):(g=2,f=new Array(2),L=b):p.indexOf("android")!==-1?(g=2,f=new Array(2),L=b):(g=5,f=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&b>=6?L=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)),L=b)),f[0]=g<<3,f[0]|=(b&14)>>1,f[1]|=(b&1)<<7,f[1]|=x<<3,g===5&&(f[1]|=(L&14)>>1,f[2]=(L&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[b],channelCount:x,codec:"mp4a.40."+g,manifestCodec:d}}function H(l,u){return l[u]===255&&(l[u+1]&246)===240}function B(l,u){return l[u+1]&1?7:9}function _(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)&&_(l,u)<=l.length-u}function k(l,u){if(T(l,u)){var w=B(l,u);if(u+w>=l.length)return!1;var v=_(l,u);if(v<=w)return!1;var g=u+v;return g===l.length||T(l,g)}return!1}function A(l,u,w,v,g){if(!l.samplerate){var L=G(u,w,v,g);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,Q.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function C(l){return 1024*9e4/l}function h(l,u,w,v,g){var L=B(l,u),x=_(l,u);if(x-=L,x>0){var f=w+v*g;return{headerLength:L,frameLength:x,stamp:f}}}function o(l,u,w,v,g){var L=C(l.samplerate),x=h(u,w,v,g,L);if(x){var f=x.frameLength,p=x.headerLength,d=x.stamp,a=p+f,b=Math.max(0,w+a-u.length),m;b?(m=new Uint8Array(a-p),m.set(u.subarray(w+p,u.length),0)):m=u.subarray(w+p,w+a);var E={unit:m,pts:d};return b||l.samples.push(E),{sample:E,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"initPTSFn",function(){return _});var Q=O("./src/polyfills/number.ts"),U=O("./src/demux/id3.ts"),D=O("./src/demux/dummy-demuxed-track.ts"),G=O("./src/utils/mp4-tools.ts"),H=O("./src/utils/typed-array.ts"),B=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(k,A,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(k,A){return!1},T.appendFrame=function(k,A,C){},T.demux=function(k,A){this.cachedData&&(k=Object(G.appendUint8Array)(this.cachedData,k),this.cachedData=null);var C=U.getID3Data(k,0),h=C?C.length:0,o,l,u=this._audioTrack,w=this._id3Track,v=C?U.getTimeStamp(C):void 0,g=k.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(v,A)),C&&C.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),l=this.initPTS;h<g;){if(this.canParse(k,h)){var L=this.appendFrame(u,k,h);L?(this.frameIndex++,l=L.sample.pts,h+=L.length,o=h):h=g}else U.canParse(k,h)?(C=U.getID3Data(k,h),w.samples.push({pts:l,dts:l,data:C}),h+=C.length,o=h):h++;if(h===g&&o!==g){var x=Object(H.sliceUint8)(k,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:u,avcTrack:Object(D.dummyTrack)(),id3Track:w,textTrack:Object(D.dummyTrack)()}},T.demuxSampleAes=function(k,A,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(k){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}(),_=function(T,I){return Object(Q.isFiniteNumber)(T)?T*90:I*9e4};Z.default=B},"./src/demux/chunk-cache.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return Q});var Q=function(){function D(){this.chunks=[],this.dataLength=0}var G=D.prototype;return G.push=function(B){this.chunks.push(B),this.dataLength+=B.length},G.flush=function(){var B=this.chunks,_=this.dataLength,y;if(B.length)B.length===1?y=B[0]:y=U(B,_);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),B=0,_=0;_<D.length;_++){var y=D[_];H.set(y,B),B+=y.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.r(Z);var Q=O("./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 B=this.data,_=this.bytesAvailable,y=B.byteLength-_,T=new Uint8Array(4),I=Math.min(4,_);if(I===0)throw new Error("no bytes available");T.set(B.subarray(y,y+I)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=I*8,this.bytesAvailable-=I},G.skipBits=function(B){var _;this.bitsAvailable>B?(this.word<<=B,this.bitsAvailable-=B):(B-=this.bitsAvailable,_=B>>3,B-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=B,this.bitsAvailable-=B)},G.readBits=function(B){var _=Math.min(this.bitsAvailable,B),y=this.word>>>32-_;return B>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=B-_,_>0&&this.bitsAvailable?y<<_|this.readBits(_):y},G.skipLZ=function(){var B;for(B=0;B<this.bitsAvailable;++B)if((this.word&2147483648>>>B)!==0)return this.word<<=B,this.bitsAvailable-=B,B;return this.loadWord(),B+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var B=this.skipLZ();return this.readBits(B+1)-1},G.readEG=function(){var B=this.readUEG();return 1&B?1+B>>>1:-1*(B>>>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(B){for(var _=8,y=8,T,I=0;I<B;I++)y!==0&&(T=this.readEG(),y=(_+T+256)%256),_=y===0?_:y},G.readSPS=function(){var B=0,_=0,y=0,T=0,I,k,A,C=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),w=this.skipEG.bind(this),v=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);C();var L=C();if(h(5),u(3),C(),v(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var x=o();if(x===3&&u(1),v(),v(),u(1),l())for(k=x!==3?8:12,A=0;A<k;A++)l()&&(A<6?g(16):g(64))}v();var f=o();if(f===0)o();else if(f===1)for(u(1),w(),w(),I=o(),A=0;A<I;A++)w();v(),u(1);var p=o(),d=o(),a=h(1);a===0&&u(1),u(1),l()&&(B=o(),_=o(),y=o(),T=o());var b=[1,1];if(l()&&l()){var m=C();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=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((p+1)*16-B*2-_*2),height:(2-a)*(d+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(de,Z,O){"use strict";O.r(Z),O.d(Z,"isHeader",function(){return Q}),O.d(Z,"isFooter",function(){return U}),O.d(Z,"getID3Data",function(){return D}),O.d(Z,"canParse",function(){return H}),O.d(Z,"getTimeStamp",function(){return B}),O.d(Z,"isTimeStampFrame",function(){return _}),O.d(Z,"getID3Frames",function(){return T}),O.d(Z,"decodeFrame",function(){return I}),O.d(Z,"utf8ArrayToStr",function(){return o}),O.d(Z,"testables",function(){return l});var Q=function(g,L){return L+10<=g.length&&(g[L]===73&&g[L+1]===68&&g[L+2]===51&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},U=function(g,L){return L+10<=g.length&&(g[L]===51&&g[L+1]===68&&g[L+2]===73&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},D=function(g,L){for(var x=L,f=0;Q(g,L);){f+=10;var p=G(g,L+6);f+=p,U(g,L+10)&&(f+=10),L+=f}return f>0?g.subarray(x,x+f):void 0},G=function(g,L){var x=0;return x=(g[L]&127)<<21,x|=(g[L+1]&127)<<14,x|=(g[L+2]&127)<<7,x|=g[L+3]&127,x},H=function(g,L){return Q(g,L)&&G(g,L+6)+10<=g.length-L},B=function(g){for(var L=T(g),x=0;x<L.length;x++){var f=L[x];if(_(f))return h(f)}return},_=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},y=function(g){var L=String.fromCharCode(g[0],g[1],g[2],g[3]),x=G(g,4),f=10;return{type:L,size:x,data:g.subarray(f,f+x)}},T=function(g){for(var L=0,x=[];Q(g,L);){var f=G(g,L+6);L+=10;for(var p=L+f;L+8<p;){var d=y(g.subarray(L)),a=I(d);a&&x.push(a),L+=d.size+10}U(g,L)&&(L+=10)}return x},I=function(g){return g.type==="PRIV"?k(g):g.type[0]==="W"?C(g):A(g)},k=function(g){if(g.size<2)return;var L=o(g.data,!0),x=new Uint8Array(g.data.subarray(L.length+1));return{key:g.type,info:L,data:x.buffer}},A=function(g){if(g.size<2)return;if(g.type==="TXXX"){var L=1,x=o(g.data.subarray(L),!0);L+=x.length+1;var f=o(g.data.subarray(L));return{key:g.type,info:x,data:f}}var p=o(g.data.subarray(1));return{key:g.type,data:p}},C=function(g){if(g.type==="WXXX"){if(g.size<2)return;var L=1,x=o(g.data.subarray(L),!0);L+=x.length+1;var f=o(g.data.subarray(L));return{key:g.type,info:x,data:f}}var p=o(g.data);return{key:g.type,data:p}},h=function(g){if(g.data.byteLength===8){var L=new Uint8Array(g.data),x=L[3]&1,f=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return f/=45,x&&(f+=4772185884e-2),Math.round(f)}return},o=function(g,L){L===void 0&&(L=!1);var x=w();if(x){var f=x.decode(g);if(L){var p=f.indexOf("\0");return p!==-1?f.substring(0,p):f}return f.replace(/\0/g,"")}for(var d=g.length,a,b,m,E="",F=0;F<d;){if(a=g[F++],a===0&&L)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[F++],E+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=g[F++],m=g[F++],E+=String.fromCharCode((a&15)<<12|(b&63)<<6|(m&63)<<0);break;default:}}return E},l={decodeTextFrame:A},u;function w(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/id3.ts"),D=O("./src/utils/logger.ts"),G=O("./src/demux/mpegaudio.ts");function H(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,B(y,T)}function B(y,T){return B=Object.setPrototypeOf||function(k,A){return k.__proto__=A,k},B(y,T)}var _=function(y){H(T,y);function T(){return y.apply(this,arguments)||this}var I=T.prototype;return I.resetInitSegment=function(A,C,h){y.prototype.resetInitSegment.call(this,A,C,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(A){if(!A)return!1;for(var C=U.getID3Data(A,0)||[],h=C.length,o=A.length;h<o;h++)if(G.probe(A,h))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},I.canParse=function(A,C){return G.canParse(A,C)},I.appendFrame=function(A,C,h){return this.initPTS===null?void 0:G.appendFrame(A,C,h,this.initPTS,this.frameIndex)},T}(Q.default);_.minProbeByteLength=4,Z.default=_},"./src/demux/mp4demuxer.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/utils/mp4-tools.ts"),U=O("./src/demux/dummy-demuxed-track.ts"),D=function(){function G(B,_){this.remainderData=null,this.config=void 0,this.config=_}var H=G.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},G.probe=function(_){return Object(Q.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},H.demux=function(_){var y=_,T=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Q.appendUint8Array)(this.remainderData,_));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 _=Object(U.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:_,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(_,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(de,Z,O){"use strict";O.r(Z),O.d(Z,"appendFrame",function(){return B}),O.d(Z,"parseHeader",function(){return _}),O.d(Z,"isHeaderPattern",function(){return y}),O.d(Z,"isHeader",function(){return T}),O.d(Z,"canParse",function(){return I}),O.d(Z,"probe",function(){return k});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 B(A,C,h,o,l){if(h+24>C.length)return;var u=_(C,h);if(u&&h+u.frameLength<=C.length){var w=u.samplesPerFrame*9e4/u.sampleRate,v=o+l*w,g={unit:C.subarray(h,h+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 _(A,C){var h=A[C+1]>>3&3,o=A[C+1]>>1&3,l=A[C+2]>>4&15,u=A[C+2]>>2&3;if(h!==1&&l!==0&&l!==15&&u!==3){var w=A[C+2]>>1&1,v=A[C+3]>>6,g=h===3?3-o:o===3?3:4,L=U[g*14+l-1]*1e3,x=h===3?0:h===2?1:2,f=D[x*3+u],p=v===3?1:2,d=G[h][o],a=H[o],b=d*8*a,m=Math.floor(d*L/f+w)*a;if(Q===null){var E=navigator.userAgent||"",F=E.match(/Chrome\/(\d+)/i);Q=F?parseInt(F[1]):0}var j=!!Q&&Q<=87;return j&&o===2&&L>=224e3&&v===0&&(A[C+3]=A[C+3]|128),{sampleRate:f,channelCount:p,frameLength:m,samplesPerFrame:b}}}function y(A,C){return A[C]===255&&(A[C+1]&224)===224&&(A[C+1]&6)!==0}function T(A,C){return C+1<A.length&&y(A,C)}function I(A,C){var h=4;return y(A,C)&&h<=A.length-C}function k(A,C){if(C+1<A.length&&y(A,C)){var h=4,o=_(A,C),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var u=C+l;return u===A.length||T(A,u)}return!1}},"./src/demux/sample-aes.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/crypt/decrypter.ts"),U=O("./src/demux/tsdemuxer.ts"),D=function(){function G(B,_,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Q.default(B,_,{removePKCS7Padding:!1})}var H=G.prototype;return H.decryptBuffer=function(_,y){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,y)},H.decryptAacSample=function(_,y,T,I){var k=_[y].unit,A=k.subarray(16,k.length-k.length%16),C=A.buffer.slice(A.byteOffset,A.byteOffset+A.length),h=this;this.decryptBuffer(C,function(o){var l=new Uint8Array(o);k.set(l,16),I||h.decryptAacSamples(_,y+1,T)})},H.decryptAacSamples=function(_,y,T){for(;;y++){if(y>=_.length){T();return}if(_[y].unit.length<32)continue;var I=this.decrypter.isSync();if(this.decryptAacSample(_,y,T,I),!I)return}},H.getAvcEncryptedData=function(_){for(var y=Math.floor((_.length-48)/160)*16+16,T=new Int8Array(y),I=0,k=32;k<=_.length-16;k+=160,I+=16)T.set(_.subarray(k,k+16),I);return T},H.getAvcDecryptedUnit=function(_,y){for(var T=new Uint8Array(y),I=0,k=32;k<=_.length-16;k+=160,I+=16)_.set(T.subarray(I,I+16),k);return _},H.decryptAvcSample=function(_,y,T,I,k,A){var C=Object(U.discardEPB)(k.data),h=this.getAvcEncryptedData(C),o=this;this.decryptBuffer(h.buffer,function(l){k.data=o.getAvcDecryptedUnit(C,l),A||o.decryptAvcSamples(_,y,T+1,I)})},H.decryptAvcSamples=function(_,y,T,I){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,T=0){if(y>=_.length){I();return}for(var k=_[y].units;!(T>=k.length);T++){var A=k[T];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(_,y,T,I,A,C),!C)return}}},G}();Z.default=D},"./src/demux/transmuxer-interface.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var Q=O("./node_modules/webworkify-webpack/index.js"),U=O.n(Q),D=O("./src/events.ts"),G=O("./src/demux/transmuxer.ts"),H=O("./src/utils/logger.ts"),B=O("./src/errors.ts"),_=O("./src/utils/mediasource-helper.ts"),y=O("./node_modules/eventemitter3/index.js"),T=O.n(y),I=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},k=function(){function A(h,o,l,u){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var v=h.config,g=function(d,a){a=a||{},a.frag=w.frag,a.id=w.id,h.trigger(d,a)};this.observer=new y.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,g),this.observer.on(D.Events.ERROR,g);var L={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){h.trigger(D.Events.ERROR,{type:B.ErrorTypes.OTHER_ERROR,details:B.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},f.postMessage({cmd:"init",typeSupported:L,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,L,v,x,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,L,v,x,o)}var C=A.prototype;return C.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},C.push=function(o,l,u,w,v,g,L,x,f,p){var d=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,m=g?g.start:v.start,E=v.decryptdata,F=this.frag,j=!(F&&v.cc===F.cc),K=!(F&&f.level===F.level),V=F?f.sn-F.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 ne=new G.TransmuxState(j,P,x,K,m);if(!P||j){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: `+j+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+P+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+m);var he=new G.TransmuxConfig(u,w,l,L,p);this.configureTransmuxer(he)}if(this.frag=v,this.part=g,b)b.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:f,state:ne},o instanceof ArrayBuffer?[o]:[]);else if(a){var me=a.push(o,E,f,ne);Object(G.isPromise)(me)?me.then(function(ke){d.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(me)}},C.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,w=this.worker;if(w)w.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)}},C.handleFlushResult=function(o,l){var u=this;o.forEach(function(w){u.handleTransmuxComplete(w)}),this.onFlush(l)},C.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}}},C.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},C.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return B});var Q=O("./src/demux/transmuxer.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts"),G=O("./node_modules/eventemitter3/index.js"),H=O.n(G);function B(k){var A=new G.EventEmitter,C=function(o,l){k.postMessage({event:o,data:l})};A.on(U.Events.FRAG_DECRYPTED,C),A.on(U.Events.ERROR,C),k.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);k.transmuxer=new Q.default(A,o.typeSupported,l,o.vendor,o.id),Object(D.enableLogs)(l.debug),C("init",null);break}case"configure":{k.transmuxer.configure(o.config);break}case"demux":{var u=k.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Q.isPromise)(u)?u.then(function(g){_(k,g)}):_(k,u);break}case"flush":{var w=o.chunkMeta,v=k.transmuxer.flush(w);Object(Q.isPromise)(v)?v.then(function(g){T(k,g,w)}):T(k,v,w);break}default:break}})}function _(k,A){if(I(A.remuxResult))return;var C=[],h=A.remuxResult,o=h.audio,l=h.video;o&&y(C,o),l&&y(C,l),k.postMessage({event:"transmuxComplete",data:A},C)}function y(k,A){A.data1&&k.push(A.data1.buffer),A.data2&&k.push(A.data2.buffer)}function T(k,A,C){A.forEach(function(h){_(k,h)}),k.postMessage({event:"flush",data:C})}function I(k){return!k.audio&&!k.video&&!k.text&&!k.id3&&!k.initSegment}},"./src/demux/transmuxer.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"isPromise",function(){return v}),O.d(Z,"TransmuxConfig",function(){return g}),O.d(Z,"TransmuxState",function(){return L});var Q=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/crypt/decrypter.ts"),G=O("./src/demux/aacdemuxer.ts"),H=O("./src/demux/mp4demuxer.ts"),B=O("./src/demux/tsdemuxer.ts"),_=O("./src/demux/mp3demuxer.ts"),y=O("./src/remux/mp4-remuxer.ts"),T=O("./src/remux/passthrough-remuxer.ts"),I=O("./src/demux/chunk-cache.ts"),k=O("./src/utils/mp4-tools.ts"),A=O("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(x){A.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var h=[{demux:B.default,remux:y.default},{demux:H.default,remux:T.default},{demux:G.default,remux:y.default},{demux:_.default,remux:y.default}],o=1024;h.forEach(function(x){var f=x.demux;o=Math.max(o,f.minProbeByteLength)});var l=function(){function x(p,d,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=d,this.config=a,this.vendor=b,this.id=m}var f=x.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,a,b,m){var E=this,F=b.transmuxing;F.executeStart=C();var j=new Uint8Array(d),K=this.cache,V=this.config,M=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var $=u(j,a);if($&&$.method==="AES-128"){var ne=this.getDecrypter();if(V.enableSoftwareAES){var he=ne.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!he)return F.executeEnd=C(),w(b);j=new Uint8Array(he)}else return this.decryptionPromise=ne.webCryptoDecrypt(j,$.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,ke=me.contiguous,xe=me.discontinuity,Le=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||Le)&&this.resetInitSegment(R,ye,z,c),xe&&this.resetInitialTimestamp(s),ke||this.resetContiguity(),this.needsProbing(j,xe,Le)){if(K.dataLength){var Y=K.flush();j=Object(k.appendUint8Array)(Y,j)}this.configureTransmuxer(j,P)}var N=this.transmux(j,$,Se,Te,b),se=this.currentTransmuxState;return se.contiguous=!0,se.discontinuity=!1,se.trackSwitch=!1,F.executeEnd=C(),N},f.flush=function(d){var a=this,b=d.transmuxing;b.executeStart=C();var m=this.decrypter,E=this.cache,F=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(d)});var K=[],V=F.timeOffset;if(m){var M=m.flush();M&&K.push(this.push(M,null,d))}var P=E.dataLength;E.reset();var $=this.demuxer,ne=this.remuxer;if(!$||!ne)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=C(),[w(d)];var he=$.flush(V);return v(he)?he.then(function(me){return a.flushRemux(K,me,d),K}):(this.flushRemux(K,he,d),K)},f.flushRemux=function(d,a,b){var m=a.audioTrack,E=a.avcTrack,F=a.id3Track,j=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,F,j,M,V,!0,this.id);d.push({remuxResult:P,chunkMeta:b}),b.transmuxing.executeEnd=C()},f.resetInitialTimestamp=function(d){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(d),b.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(d,a,b,m){var E=this.demuxer,F=this.remuxer;if(!E||!F)return;E.resetInitSegment(a,b,m),F.resetInitSegment(d,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(d,a,b,m,E){var F;return a&&a.method==="SAMPLE-AES"?F=this.transmuxSampleAes(d,a,b,m,E):F=this.transmuxUnencrypted(d,b,m,E),F},f.transmuxUnencrypted=function(d,a,b,m){var E=this.demuxer.demux(d,a,!1,!this.config.progressive),F=E.audioTrack,j=E.avcTrack,K=E.id3Track,V=E.textTrack,M=this.remuxer.remux(F,j,K,V,a,b,!1,this.id);return{remuxResult:M,chunkMeta:m}},f.transmuxSampleAes=function(d,a,b,m,E){var F=this;return this.demuxer.demuxSampleAes(d,a,b).then(function(j){var K=F.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,b,m,!1,F.id);return{remuxResult:K,chunkMeta:E}})},f.configureTransmuxer=function(d,a){for(var b=this.config,m=this.observer,E=this.typeSupported,F=this.vendor,j=a.audioCodec,K=a.defaultInitPts,V=a.duration,M=a.initSegmentData,P=a.videoCodec,$,ne=0,he=h.length;ne<he;ne++)if(h[ne].demux.probe(d)){$=h[ne];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,ke=this.remuxer,xe=$.remux,Le=$.demux;(!ke||!(ke instanceof xe))&&(this.remuxer=new xe(m,b,E,F)),(!me||!(me instanceof Le))&&(this.demuxer=new Le(m,b,E),this.probe=Le.probe),this.resetInitSegment(M,j,P,V),this.resetInitialTimestamp(K)},f.needsProbing=function(d,a,b){return!this.demuxer||!this.remuxer||a||b},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new D.default(this.observer,this.config)),d},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 w=function(f){return{remuxResult:{},chunkMeta:f}};function v(x){return"then"in x&&x.then instanceof Function}var g=function(f,p,d,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=d,this.duration=a,this.defaultInitPts=b},L=function(f,p,d,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=d,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"discardEPB",function(){return w});var Q=O("./src/demux/adts.ts"),U=O("./src/demux/mpegaudio.ts"),D=O("./src/demux/exp-golomb.ts"),G=O("./src/demux/id3.ts"),H=O("./src/demux/sample-aes.ts"),B=O("./src/events.ts"),_=O("./src/utils/mp4-tools.ts"),y=O("./src/utils/logger.ts"),T=O("./src/errors.ts"),I={video:1,audio:2,id3:3,text:4},k=function(){function v(L,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=L,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,d){p===void 0&&(p=!1),d===void 0&&(d=!1),p||(this.sampleAes=null);var a,b=this._avcTrack,m=this._audioTrack,E=this._id3Track,F=b.pid,j=b.pesData,K=m.pid,V=E.pid,M=m.pesData,P=E.pesData,$=!1,ne=this.pmtParsed,he=this._pmtId,me=x.length;if(this.remainderData&&(x=Object(_.appendUint8Array)(this.remainderData,x),me=x.length,this.remainderData=null),me<188&&!d)return this.remainderData=x,{audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};var ke=Math.max(0,v.syncOffset(x));me-=(me+ke)%188,me<x.byteLength&&!d&&(this.remainderData=new Uint8Array(x.buffer,me,x.buffer.byteLength-me));for(var xe=ke;xe<me;xe+=188)if(x[xe]===71){var Le=!!(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 F:Le&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(x.subarray(ye,xe+188)),j.size+=xe+188-ye);break;case K:Le&&(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:Le&&(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:Le&&(ye+=x[ye]+1),he=this._pmtId=C(x,ye);break;case he:{Le&&(ye+=x[ye]+1);var z=h(x,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);F=z.avc,F>0&&(b.pid=F),K=z.audio,K>0&&(m.pid=K,m.isAAC=z.isAAC),V=z.id3,V>0&&(E.pid=V),$&&!ne&&(y.logger.log("reparse from beginning"),$=!1,xe=ke-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(B.Events.ERROR,B.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=j,m.pesData=M,E.pesData=P;var s={audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};return d&&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,d=x.id3Track,a=p.pesData,b=f.pesData,m=d.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),d.pesData=null):d.pesData=m},g.demuxSampleAes=function(x,f,p){var d=this.demux(x,p,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,f);return this.decrypt(d,a)},g.decrypt=function(x,f){return new Promise(function(p){var d=x.audioTrack,a=x.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.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,d=this._avcTrack,a=this.parseAVCNALu(x.data),b=!1,m=this.avcSample,E,F=!1;x.data=null,m&&a.length&&!d.audFound&&(l(m,d),m=this.avcSample=A(!1,x.pts,x.dts,"")),a.forEach(function(j){switch(j.type){case 1:{E=!0,m||(m=p.avcSample=A(!0,x.pts,x.dts,"")),b&&(m.debug+="NDR "),m.frame=!0;var K=j.data;if(F&&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(w(j.data));M.readUByte();for(var P=0,$=0,ne=!1,he=0;!ne&&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){ne=!0;var me=M.readUByte();if(me===181){var ke=M.readUShort();if(ke===49){var xe=M.readUInt();if(xe===1195456820){var Le=M.readUByte();if(Le===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(ne=!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,F=!0,b&&m&&(m.debug+="SPS "),!d.sps){var Ae=new D.default(j.data),Oe=Ae.readSPS();d.width=Oe.width,d.height=Oe.height,d.pixelRatio=Oe.pixelRatio,d.sps=[j.data],d.duration=p._duration;for(var De=j.data.subarray(1,4),_e="avc1.",Pe=0;Pe<3;Pe++){var He=De[Pe].toString(16);He.length<2&&(He="0"+He),_e+=He}d.codec=_e}break;case 8:E=!0,b&&m&&(m.debug+="PPS "),d.pps||(d.pps=[j.data]);break;case 9:E=!1,d.audFound=!0,m&&l(m,d),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 "+j.type+" ");break}if(m&&E){var Ge=m.units;Ge.push(j)}}),f&&m&&(l(m,d),this.avcSample=null)},g.getLastNalUnit=function(){var x,f=this.avcSample,p;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.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,d=p.naluState||0,a=d,b=[],m=0,E,F,j,K=-1,V=0;for(d===-1&&(K=0,V=x[0]&31,d=0,m=1);m<f;){if(E=x[m++],!d){d=E?0:1;continue}if(d===1){d=E?0:2;continue}if(!E)d=3;else if(E===1){if(K>=0){var M={data:x.subarray(K,m-d-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))),F=m-d-1,F>0)){var $=new Uint8Array(P.data.byteLength+F);$.set(P.data,0),$.set(x.subarray(0,F),P.data.byteLength),P.data=$,P.state=0}}m<f?(j=x[m]&31,K=m,V=j,d=0):d=-1}else d=0}if(K>=0&&d>=0){var ne={data:x.subarray(K,f),type:V,state:d};b.push(ne)}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=d,b},g.parseAACPES=function(x){var f=0,p=this._audioTrack,d=this.aacOverFlow,a=x.data;if(d){this.aacOverFlow=null;var b=d.sample.unit.byteLength,m=Math.min(d.missing,b),E=b-m;d.sample.unit.set(a.subarray(0,m),E),p.samples.push(d.sample),f=d.missing}var F,j;for(F=f,j=a.length;F<j-1&&!Q.isHeader(a,F);F++);if(F!==f){var K,V;if(F<j-1?(K="AAC PES did not start with ADTS header,offset:"+F,V=!1):(K="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+K),this.observer.emit(B.Events.ERROR,B.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,F,this.audioCodec);var M;if(x.pts!==void 0)M=x.pts;else if(d){var P=Q.getFrameDuration(p.samplerate);M=d.sample.pts+P}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;F<j;)if(Q.isHeader(a,F)){if(F+5<j){var ne=Q.appendFrame(p,a,F,M,$);if(ne)if(ne.missing)this.aacOverFlow=ne;else{F+=ne.length,$++;continue}}break}else F++},g.parseMPEGPES=function(x){var f=x.data,p=f.length,d=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,d);if(m)a+=m.length,d++;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}();k.minProbeByteLength=188;function A(v,g,L,x){return{key:v,frame:!1,pts:g,dts:L,units:[],debug:x,length:0}}function C(v,g){return(v[g+10]&31)<<8|v[g+11]}function h(v,g,L,x){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[g+1]&15)<<8|v[g+2],d=g+3+p-4,a=(v[g+10]&15)<<8|v[g+11];for(g+=12+a;g<d;){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:L?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,L,x,f,p,d,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)}L=a[0];var m=(L[0]<<16)+(L[1]<<8)+L[2];if(m===1){if(x=(L[4]<<8)+L[5],x&&x>v.size-6)return null;var E=L[7];E&192&&(p=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,E&64?(d=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,p-d>60*9e4&&(y.logger.warn(Math.round((p-d)/9e4)+"s delta between PTS and DTS, align them"),p=d)):d=p),f=L[8];var F=f+9;if(v.size<=F)return null;v.size-=F;for(var j=new Uint8Array(v.size),K=0,V=a.length;K<V;K++){L=a[K];var M=L.byteLength;if(F)if(F>M){F-=M;continue}else L=L.subarray(F),M-=F,F=0;j.set(L,g),g+=M}return x&&(x-=f+3),{data:j,pts:p,dts:d,len:x}}return null}function l(v,g){if(v.units.length&&v.frame){if(v.pts===void 0){var L=g.samples,x=L.length;if(x){var f=L[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 L=v.length;if(L>0){if(g.pts>=v[L-1].pts)v.push(g);else for(var x=L-1;x>=0;x--)if(g.pts<v[x].pts){v.splice(x,0,g);break}}else v.push(g)}function w(v){for(var g=v.byteLength,L=[],x=1;x<g-2;)v[x]===0&&v[x+1]===0&&v[x+2]===3?(L.push(x+2),x+=2):x++;if(L.length===0)return v;var f=g-L.length,p=new Uint8Array(f),d=0;for(x=0;x<f;d++,x++)d===L[0]&&(d++,L.shift()),p[x]=v[d];return p}Z.default=k},"./src/errors.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"ErrorTypes",function(){return Q}),O.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(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return v});var Q=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Q),D=O("./src/loader/playlist-loader.ts"),G=O("./src/loader/key-loader.ts"),H=O("./src/controller/id3-track-controller.ts"),B=O("./src/controller/latency-controller.ts"),_=O("./src/controller/level-controller.ts"),y=O("./src/controller/fragment-tracker.ts"),T=O("./src/controller/stream-controller.ts"),I=O("./src/is-supported.ts"),k=O("./src/utils/logger.ts"),A=O("./src/config.ts"),C=O("./node_modules/eventemitter3/index.js"),h=O.n(C),o=O("./src/events.ts"),l=O("./src/errors.ts");function u(g,L){for(var x=0;x<L.length;x++){var f=L[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function w(g,L,x){return L&&u(g.prototype,L),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 C.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(k.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(A.enableStreamingMode)(f);var p=f.abrController,d=f.bufferController,a=f.capLevelController,b=f.fpsController,m=this.abrController=new p(this),E=this.bufferController=new d(this),F=this.capLevelController=new a(this),j=new b(this),K=new D.default(this),V=new G.default(this),M=new H.default(this),P=this.levelController=new _.default(this),$=new y.FragmentTracker(this),ne=this.streamController=new T.default(this,$);F.setStreamController(ne),j.setStreamController(ne);var he=[P,ne];this.networkControllers=he;var me=[K,V,m,E,F,j,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(B.default,null,me),this.coreComponents=me}var L=g.prototype;return L.createController=function(f,p,d){if(f){var a=p?new f(this,p):new f(this);return d&&d.push(a),a}return null},L.on=function(f,p,d){d===void 0&&(d=this),this._emitter.on(f,p,d)},L.once=function(f,p,d){d===void 0&&(d=this),this._emitter.once(f,p,d)},L.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},L.off=function(f,p,d,a){d===void 0&&(d=this),this._emitter.off(f,p,d,a)},L.listeners=function(f){return this._emitter.listeners(f)},L.emit=function(f,p,d){return this._emitter.emit(f,p,d)},L.trigger=function(f,p){if(this.config.debug)return this.emit(f,f,p);try{return this.emit(f,f,p)}catch(d){k.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:d})}return!1},L.listenerCount=function(f){return this._emitter.listenerCount(f)},L.destroy=function(){k.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},L.attachMedia=function(f){k.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},L.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(f){this.stopLoad();var p=this.media,d=this.url,a=this.url=Q.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});k.logger.log("loadSource:"+a),p&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},L.startLoad=function(f){f===void 0&&(f=-1),k.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(p){p.startLoad(f)})},L.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},L.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){k.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},L.removeLevel=function(f,p){p===void 0&&(p=0),this.levelController.removeLevel(f,p)},w(g,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){k.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){k.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){k.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){k.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){k.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&&(k.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 d=f.length,a=0;a<d;a++)if(f[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,p=this.autoLevelCapping,d;return p===-1&&f&&f.length?d=f.length-1:d=p,d}},{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(de,Z,O){"use strict";O.r(Z),O.d(Z,"isSupported",function(){return D}),O.d(Z,"changeTypeSupported",function(){return G});var Q=O("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var H=Object(Q.getMediaSource)();if(!H)return!1;var B=U(),_=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!B||B.prototype&&typeof B.prototype.appendBuffer=="function"&&typeof B.prototype.remove=="function";return!!_&&!!y}function G(){var H,B=U();return typeof(B==null||((H=B.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k}),O.d(Z,"LoadError",function(){return C});var Q=O("./src/polyfills/number.ts"),U=O("./src/errors.ts");function D(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,y(h,o)}function G(h){var o=typeof Map=="function"?new Map:void 0;return G=function(u){if(u===null||!_(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,w)}function w(){return H(u,arguments,T(this).constructor)}return w.prototype=Object.create(u.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,u)},G(h)}function H(h,o,l){return B()?H=Reflect.construct:H=function(w,v,g){var L=[null];L.push.apply(L,v);var x=Function.bind.apply(w,L),f=new x;return g&&y(f,g.prototype),f},H.apply(null,arguments)}function B(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function _(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function y(h,o){return y=Object.setPrototypeOf||function(u,w){return u.__proto__=w,u},y(h,o)}function T(h){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},T(h)}var I=Math.pow(2,17),k=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,w){var v=this,g=u.url;if(!g)return Promise.reject(new C({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 L=this.config,x=L.fLoader,f=L.loader;return new Promise(function(p,d){v.loader&&v.loader.destroy();var a=v.loader=u.loader=x?new x(L):new f(L),b=A(u),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:I};u.stats=a.stats,a.load(b,m,{onSuccess:function(F,j,K,V){v.resetLoader(u,a),p({frag:u,part:null,payload:F.data,networkDetails:V})},onError:function(F,j,K){v.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:F,networkDetails:K}))},onAbort:function(F,j,K){v.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:K}))},onTimeout:function(F,j,K){v.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:K}))},onProgress:function(F,j,K,V){w&&w({frag:u,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(u,w,v){var g=this;this.abort();var L=this.config,x=L.fLoader,f=L.loader;return new Promise(function(p,d){g.loader&&g.loader.destroy();var a=g.loader=u.loader=x?new x(L):new f(L),b=A(u,w),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:I};w.stats=a.stats,a.load(b,m,{onSuccess:function(F,j,K,V){g.resetLoader(u,a),g.updateStatsFromPart(u,w);var M={frag:u,part:w,payload:F.data,networkDetails:V};v(M),p(M)},onError:function(F,j,K){g.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:w,response:F,networkDetails:K}))},onAbort:function(F,j,K){u.stats.aborted=w.stats.aborted,g.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:w,networkDetails:K}))},onTimeout:function(F,j,K){g.resetLoader(u,a),d(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:w,networkDetails:K}))}})})},o.updateStatsFromPart=function(u,w){var v=u.stats,g=w.stats,L=g.total;if(v.loaded+=g.loaded,L){var x=Math.round(u.duration/w.duration),f=Math.min(Math.round(v.loaded/L),x),p=x-f,d=p*Math.round(v.loaded/f);v.total=v.loaded+d}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,w){u.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},h}();function A(h,o){o===void 0&&(o=null);var l=o||h,u={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(Q.isFiniteNumber)(w)&&Object(Q.isFiniteNumber)(v)&&(u.rangeStart=w,u.rangeEnd=v),u}var C=function(h){D(o,h);function o(l){for(var u,w=arguments.length,v=new Array(w>1?w-1:0),g=1;g<w;g++)v[g-1]=arguments[g];return u=h.call.apply(h,[this].concat(v))||this,u.data=void 0,u.data=l,u}return o}(G(Error))},"./src/loader/fragment.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"ElementaryStreamTypes",function(){return k}),O.d(Z,"BaseSegment",function(){return A}),O.d(Z,"Fragment",function(){return C}),O.d(Z,"Part",function(){return h});var Q=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),D=O.n(U),G=O("./src/utils/logger.ts"),H=O("./src/loader/level-key.ts"),B=O("./src/loader/load-stats.ts");function _(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(w,v){return w.__proto__=v,w},y(o,l)}function T(o,l){for(var u=0;u<l.length;u++){var w=l[u];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function I(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}var k;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(k||(k={}));var A=function(){function o(u){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[k.AUDIO]=null,w[k.VIDEO]=null,w[k.AUDIOVIDEO]=null,w),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(w,v){var g=w.split("@",2),L=[];g.length===1?L[0]=v?v.byteRangeEndOffset:0:L[0]=parseInt(g[1]),L[1]=parseInt(g[0])+L[0],this._byteRange=L},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(w){this._url=w}}]),o}(),C=function(o){_(l,o);function l(w,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 B.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=w,g}var u=l.prototype;return u.createInitializationVector=function(v){for(var g=new Uint8Array(16),L=12;L<16;L++)g[L]=v>>8*(15-L)&255;return g},u.setDecryptDataFromLevelKey=function(v,g){var L=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(L=H.LevelKey.fromURI(v.uri),L.method=v.method,L.iv=this.createInitializationVector(g),L.keyFormat="identity"),L},u.setElementaryStreamInfo=function(v,g,L,x,f,p){p===void 0&&(p=!1);var d=this.elementaryStreams,a=d[v];if(!a){d[v]={startPTS:g,endPTS:L,startDTS:x,endDTS:f,partial:p};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,f)},u.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[k.AUDIO]=null,v[k.VIDEO]=null,v[k.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),h=function(o){_(l,o);function l(u,w,v,g,L){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 B.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=w,x.index=g;var f=u.enumeratedString("BYTERANGE");return f&&x.setByteRange(f,L),L&&(x.fragOffset=L.fragOffset+L.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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(A)},"./src/loader/key-loader.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return G});var Q=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/utils/logger.ts"),G=function(){function H(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var B=H.prototype;return B._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},B._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},B.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var T=this.loaders[y];T&&T.destroy()}this.loaders={}},B.onKeyLoading=function(y,T){var I=T.frag,k=I.type,A=this.loaders[k];if(!I.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=I.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(A&&(D.logger.warn("abort previous key loader for type:"+k),A.abort()),!C){D.logger.warn("key uri is falsy");return}var o=h.loader,l=I.loader=this.loaders[k]=new o(h);this.decrypturl=C,this.decryptkey=null;var u={url:C,frag:I,responseType:"arraybuffer"},w={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,w,v)}else this.decryptkey&&(I.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:I}))},B.loadsuccess=function(y,T,I){var k=I.frag;if(!k.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=k.decryptdata.key=new Uint8Array(y.data),k.loader=null,delete this.loaders[k.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:k})},B.loaderror=function(y,T){var I=T.frag,k=I.loader;k&&k.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})},B.loadtimeout=function(y,T){var I=T.frag,k=I.loader;k&&k.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"LevelDetails",function(){return H});var Q=O("./src/polyfills/number.ts");function U(B,_){for(var y=0;y<_.length;y++){var T=_[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(B,T.key,T)}}function D(B,_,y){return _&&U(B.prototype,_),y&&U(B,y),B}var G=10,H=function(){function B(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 _=B.prototype;return _.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var I=this.lastPartSn-T.lastPartSn,k=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!k||!!I,this.advanced=this.endSN>T.endSN||I>0||I===0&&k>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},D(B,[{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}}]),B}()},"./src/loader/level-key.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"LevelKey",function(){return H});var Q=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Q);function D(B,_){for(var y=0;y<_.length;y++){var T=_[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(B,T.key,T)}}function G(B,_,y){return _&&D(B.prototype,_),y&&D(B,y),B}var H=function(){B.fromURL=function(y,T){return new B(y,T)},B.fromURI=function(y){return new B(y)};function B(_,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)(_,y,{alwaysNormalize:!0}):this._uri=_}return G(B,[{key:"uri",get:function(){return this._uri}}]),B}()},"./src/loader/load-stats.ts":function(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l});var Q=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),D=O.n(U),G=O("./src/loader/fragment.ts"),H=O("./src/loader/level-details.ts"),B=O("./src/loader/level-key.ts"),_=O("./src/utils/attr-list.ts"),y=O("./src/utils/logger.ts"),T=O("./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,k=/#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"),C=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var x,f;return h.test((x=(f=U.parseURL(L))===null||f===void 0?void 0:f.path)!=null?x:"")}var l=function(){function L(){}return L.findGroup=function(f,p){for(var d=0;d<f.length;d++){var a=f[d];if(a.id===p)return a}},L.convertAVC1ToAVCOTI=function(f){var p=f.split(".");if(p.length>2){var d=p.shift()+".";return d+=parseInt(p.shift()).toString(16),d+=("000"+parseInt(p.shift()).toString(16)).substr(-4),d}return f},L.resolve=function(f,p){return U.buildAbsoluteURL(p,f,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(f,p){var d=[],a={},b=!1;I.lastIndex=0;for(var m;(m=I.exec(f))!=null;)if(m[1]){var E=new _.AttrList(m[1]),F={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:L.resolve(m[2],p)},j=E.decimalResolution("RESOLUTION");j&&(F.width=j.width,F.height=j.height),u((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),F),F.videoCodec&&F.videoCodec.indexOf("avc1")!==-1&&(F.videoCodec=L.convertAVC1ToAVCOTI(F.videoCodec)),d.push(F)}else if(m[3]){var K=new _.AttrList(m[3]);K["DATA-ID"]&&(b=!0,a[K["DATA-ID"]]=K)}return{levels:d,sessionData:b?a:null}},L.parseMasterPlaylistMedia=function(f,p,d,a){a===void 0&&(a=[]);var b,m=[],E=0;for(k.lastIndex=0;(b=k.exec(f))!==null;){var F=new _.AttrList(b[1]);if(F.TYPE===d){var j={attrs:F,bitrate:0,id:E++,groupId:F["GROUP-ID"],instreamId:F["INSTREAM-ID"],name:F.NAME||F.LANGUAGE||"",type:d,default:F.bool("DEFAULT"),autoselect:F.bool("AUTOSELECT"),forced:F.bool("FORCED"),lang:F.LANGUAGE,url:F.URI?L.resolve(F.URI,p):""};if(a.length){var K=L.findGroup(a,j.groupId)||a[0];w(j,K,"audioCodec"),w(j,K,"textCodec")}m.push(j)}}return m},L.parseLevelPlaylist=function(f,p,d,a,b){var m=new H.LevelDetails(p),E=m.fragments,F=null,j=0,K=0,V=0,M=0,P=null,$=new G.Fragment(a,p),ne,he,me,ke=-1,xe=!1;for(A.lastIndex=0,m.m3u8=f;(ne=A.exec(f))!==null;){xe&&(xe=!1,$=new G.Fragment(a,p),$.start=V,$.sn=j,$.cc=M,$.level=d,F&&($.initSegment=F,$.rawProgramDateTime=F.rawProgramDateTime));var Le=ne[1];if(Le){$.duration=parseFloat(Le);var Te=(" "+ne[2]).slice(1);$.title=Te||null,$.tagList.push(Te?["INF",Le,Te]:["INF",Le])}else if(ne[3])Object(Q.isFiniteNumber)($.duration)&&($.start=V,me&&($.levelkey=me),$.sn=j,$.level=d,$.cc=M,$.urlId=b,E.push($),$.relurl=(" "+ne[3]).slice(1),g($,P),P=$,V+=$.duration,j++,K=0,xe=!0);else if(ne[4]){var Se=(" "+ne[4]).slice(1);P?$.setByteRange(Se,P):$.setByteRange(Se)}else if(ne[5])$.rawProgramDateTime=(" "+ne[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ke===-1&&(ke=E.length);else{if(ne=ne[0].match(C),!ne){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(he=1;he<ne.length&&!(typeof ne[he]!="undefined");he++);var ye=(" "+ne[he]).slice(1),z=(" "+ne[he+1]).slice(1),s=ne[he+2]?(" "+ne[he+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":m.type=z.toUpperCase();break;case"MEDIA-SEQUENCE":j=m.startSN=parseInt(z);break;case"SKIP":{var c=new _.AttrList(z),R=c.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(R)){m.skippedSegments=R;for(var Y=R;Y--;)E.unshift(null);j+=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 _.AttrList(z),Ae=be.enumeratedString("METHOD"),Oe=be.URI,De=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=B.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=De));break}case"START":{var Xe=new _.AttrList(z),ze=Xe.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(ze)&&(m.startTimeOffset=ze);break}case"MAP":{var ot=new _.AttrList(z);$.relurl=ot.URI,ot.BYTERANGE&&$.setByteRange(ot.BYTERANGE),$.level=d,$.sn="initSegment",me&&($.levelkey=me),$.initSegment=null,F=$,xe=!0;break}case"SERVER-CONTROL":{var $e=new _.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 _.AttrList(z);m.partTarget=Je.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=m.partList;Re||(Re=m.partList=[]);var it=K>0?Re[Re.length-1]:void 0,qe=K++,oe=new G.Part(new _.AttrList(z),$,p,qe,it);Re.push(oe),$.duration+=oe.duration;break}case"PRELOAD-HINT":{var q=new _.AttrList(z);m.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new _.AttrList(z);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ee);break}default:y.logger.warn("line parsed but not handled: "+ne);break}}}P&&!P.relurl?(E.pop(),V-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(g($,P),$.cc=M,m.fragmentHint=$);var ae=E.length,le=E[0],te=E[ae-1];if(V+=m.skippedSegments*m.targetduration,V>0&&ae&&te){m.averagetargetduration=V/ae;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=d,$.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,ke>0&&v(E,ke),m},L}();function u(L,x){["video","audio","text"].forEach(function(f){var p=L.filter(function(a){return Object(T.isCodecType)(a,f)});if(p.length){var d=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[f+"Codec"]=d.length>0?d[0]:p[0],L=L.filter(function(a){return p.indexOf(a)===-1})}}),x.unknownCodecs=L}function w(L,x,f){var p=x[f];p&&(L[f]=p)}function v(L,x){for(var f=L[x],p=x;p--;){var d=L[p];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function g(L,x){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):x!=null&&x.programDateTime&&(L.programDateTime=x.endProgramDateTime),Object(Q.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/errors.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),B=O("./src/loader/m3u8-parser.ts"),_=O("./src/types/loader.ts"),y=O("./src/utils/attr-list.ts");function T(A){var C=A.type;switch(C){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function I(A,C){var h=A.url;return(h===void 0||h.indexOf("data:")===0)&&(h=C.url),h}var k=function(){function A(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var C=A.prototype;return C.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)},C.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)},C.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,w=l.loader,v=u||w,g=new v(l);return o.loader=g,this.loaders[o.type]=g,g},C.getInternalLoader=function(o){return this.loaders[o.type]},C.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},C.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},C.onLevelLoading=function(o,l){var u=l.id,w=l.level,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:null,level:w,responseType:"text",type:_.PlaylistContextType.LEVEL,url:v,deliveryDirectives:g})},C.onAudioTrackLoading=function(o,l){var u=l.id,w=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:w,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:g})},C.onSubtitleTrackLoading=function(o,l){var u=l.id,w=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:u,groupId:w,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:g})},C.load=function(o){var l,u=this.hls.config,w=this.getInternalLoader(o);if(w){var v=w.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),w.abort()}var g,L,x,f;switch(o.type){case _.PlaylistContextType.MANIFEST:g=u.manifestLoadingMaxRetry,L=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:g=0,L=u.levelLoadingTimeOut;break;default:g=u.levelLoadingMaxRetry,L=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var p;if(o.type===_.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===_.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===_.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var d=p.partTarget,a=p.targetduration;d&&a&&(L=Math.min(Math.max(d*3,a*.8)*1e3,L))}}var b={timeout:L,maxRetry:g,retryDelay:x,maxRetryDelay:f,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,b,m)},C.loadsuccess=function(o,l,u,w){if(w===void 0&&(w=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,w);return}this.resetInternalLoader(u.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,w):this.handleMasterPlaylist(o,l,u,w)},C.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},C.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},C.handleMasterPlaylist=function(o,l,u,w){var v=this.hls,g=o.data,L=I(o,u),x=B.default.parseMasterPlaylist(g,L),f=x.levels,p=x.sessionData;if(!f.length){this.handleManifestParsingError(o,u,"no level found in manifest",w);return}var d=f.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=f.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),b=B.default.parseMasterPlaylistMedia(g,L,"AUDIO",d),m=B.default.parseMasterPlaylistMedia(g,L,"SUBTITLES",a),E=B.default.parseMasterPlaylistMedia(g,L,"CLOSED-CAPTIONS");if(b.length){var F=b.some(function(j){return!j.url});!F&&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:L,stats:l,networkDetails:w,sessionData:p})},C.handleTrackOrLevelPlaylist=function(o,l,u,w){var v=this.hls,g=u.id,L=u.level,x=u.type,f=I(o,u),p=Object(Q.isFiniteNumber)(g)?g:0,d=Object(Q.isFiniteNumber)(L)?L:p,a=T(u),b=B.default.parseLevelPlaylist(o.data,f,d,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===_.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:w,sessionData:null})}if(l.parsing.end=performance.now(),b.needSidxRanges){var E,F=(E=b.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:F,isSidxRequest:!0,type:x,level:L,levelDetails:b,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=b,this.handlePlaylistLoaded(o,l,u,w)},C.handleSidxRequest=function(o,l){var u=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var w=u.references,v=l.levelDetails;w.forEach(function(g,L){var x=g.info,f=v.fragments[L];f.byteRange.length===0&&f.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(o,l,u,w){this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===_.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:w})},C.handleNetworkError=function(o,l,u,w){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,L=this.getInternalLoader(o);switch(o.type){case _.PlaylistContextType.MANIFEST:v=u?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case _.PlaylistContextType.LEVEL:v=u?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case _.PlaylistContextType.AUDIO_TRACK:v=u?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:v=u?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}L&&this.resetInternalLoader(o.type);var x={type:D.ErrorTypes.NETWORK_ERROR,details:v,fatal:g,url:o.url,loader:L,context:o,networkDetails:l};w&&(x.response=w),this.hls.trigger(U.Events.ERROR,x)},C.handlePlaylistLoaded=function(o,l,u,w){var v=u.type,g=u.level,L=u.id,x=u.groupId,f=u.loader,p=u.levelDetails,d=u.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",w);return}if(!f)return;p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:p,level:g||0,id:L||0,stats:l,networkDetails:w,deliveryDirectives:d});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:p,id:L||0,groupId:x||"",stats:l,networkDetails:w,deliveryDirectives:d});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:p,id:L||0,groupId:x||"",stats:l,networkDetails:w,deliveryDirectives:d});break}},A}();Z.default=k},"./src/polyfills/number.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"isFiniteNumber",function(){return Q}),O.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(de,Z,O){"use strict";O.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(de,Z,O){"use strict";O.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 B=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]),_=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:B,audio:_};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]),k=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,I,A,I,k),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,y))},D.box=function(H){for(var B=8,_=arguments.length,y=new Array(_>1?_-1:0),T=1;T<_;T++)y[T-1]=arguments[T];for(var I=y.length,k=I;I--;)B+=y[I].byteLength;var A=new Uint8Array(B);for(A[0]=B>>24&255,A[1]=B>>16&255,A[2]=B>>8&255,A[3]=B&255,A.set(H,4),I=0,B=8;I<k;I++)A.set(y[I],B),B+=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,B){B*=H;var _=Math.floor(B/(Q+1)),y=Math.floor(B%(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,_>>24,_>>16&255,_>>8&255,_&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,B,_){return D.box(D.types.moof,D.mfhd(H),D.traf(_,B))},D.moov=function(H){for(var B=H.length,_=[];B--;)_[B]=D.trak(H[B]);return D.box.apply(null,[D.types.moov,D.mvhd(H[0].timescale,H[0].duration)].concat(_).concat(D.mvex(H)))},D.mvex=function(H){for(var B=H.length,_=[];B--;)_[B]=D.trex(H[B]);return D.box.apply(null,[D.types.mvex].concat(_))},D.mvhd=function(H,B){B*=H;var _=Math.floor(B/(Q+1)),y=Math.floor(B%(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,_>>24,_>>16&255,_>>8&255,_&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 B=H.samples||[],_=new Uint8Array(4+B.length),y,T;for(y=0;y<B.length;y++)T=B[y].flags,_[y+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return D.box(D.types.sdtp,_)},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 B=[],_=[],y,T,I;for(y=0;y<H.sps.length;y++)T=H.sps[y],I=T.byteLength,B.push(I>>>8&255),B.push(I&255),B=B.concat(Array.prototype.slice.call(T));for(y=0;y<H.pps.length;y++)T=H.pps[y],I=T.byteLength,_.push(I>>>8&255),_.push(I&255),_=_.concat(Array.prototype.slice.call(T));var k=D.box(D.types.avcC,new Uint8Array([1,B[3],B[4],B[5],252|3,224|H.sps.length].concat(B).concat([H.pps.length]).concat(_))),A=H.width,C=H.height,h=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,C>>8&255,C&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),k,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([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},D.esds=function(H){var B=H.config.length;return new Uint8Array([0,0,0,0,3,23+B,0,1,0,4,15+B,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([B]).concat(H.config).concat([6,1,2]))},D.mp4a=function(H){var B=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,B>>8&255,B&255,0,0]),D.box(D.types.esds,D.esds(H)))},D.mp3=function(H){var B=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,B>>8&255,B&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 B=H.id,_=H.duration*H.timescale,y=H.width,T=H.height,I=Math.floor(_/(Q+1)),k=Math.floor(_%(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,B>>24&255,B>>16&255,B>>8&255,B&255,0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,T>>8&255,T&255,0,0]))},D.traf=function(H,B){var _=D.sdtp(H),y=H.id,T=Math.floor(B/(Q+1)),I=Math.floor(B%(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,_.length+16+20+8+16+8+8),_)},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 B=H.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(H,B){var _=H.samples||[],y=_.length,T=12+16*y,I=new Uint8Array(T),k,A,C,h,o,l;for(B+=8+T,I.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,B>>>24&255,B>>>16&255,B>>>8&255,B&255],0),k=0;k<y;k++)A=_[k],C=A.duration,h=A.size,o=A.flags,l=A.cts,I.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*k);return D.box(D.types.trun,I)},D.initSegment=function(H){D.types||D.init();var B=D.moov(H),_=new Uint8Array(D.FTYP.byteLength+B.byteLength);return _.set(D.FTYP),_.set(B,D.FTYP.byteLength),_},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(de,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"normalizePts",function(){return u});var Q=O("./src/polyfills/number.ts"),U=O("./src/remux/aac-helper.ts"),D=O("./src/remux/mp4-generator.ts"),G=O("./src/events.ts"),H=O("./src/errors.ts"),B=O("./src/utils/logger.ts"),_=O("./src/types/loader.ts"),y=O("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(L[p]=f[p])}return L},T.apply(this,arguments)}var I=10*1e3,k=1024,A=1152,C=null,h=null,o=!1,l=function(){function L(f,p,d,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=d,this.ISGenerated=!1,C===null){var b=navigator.userAgent||"",m=b.match(/Chrome\/(\d+)/i);C=m?parseInt(m[1]):0}if(h===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);h=E?parseInt(E[1]):0}o=!!C&&C<75||!!h&&h<600}var x=L.prototype;return x.destroy=function(){},x.resetTimeStamp=function(p){B.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},x.resetNextTimestamp=function(){B.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){B.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(p){var d=!1,a=p.reduce(function(b,m){var E=m.pts-b;return E<-4294967296?(d=!0,u(b,m.pts)):E>0?b:m.pts},p[0].pts);return d&&B.logger.debug("PTS rollover detected"),a},x.remux=function(p,d,a,b,m,E,F,j){var K,V,M,P,$,ne,he=m,me=m,ke=p.pid>-1,xe=d.pid>-1,Le=d.samples.length,Te=p.samples.length>0,Se=Le>1,ye=(!ke||Te)&&(!xe||Se)||this.ISGenerated||F;if(ye){this.ISGenerated||(M=this.generateIS(p,d,m));var z=this.isVideoContiguous,s=-1;if(Se&&(s=w(d.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,s>0){B.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+Le+" video samples due to a missing keyframe");var c=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(s),d.dropped+=s,me+=(d.samples[0].pts-c)/(d.timescale||9e4)}else s===-1&&(B.logger.warn("[mp4-remuxer]: No keyframe found out of "+Le+" video samples"),ne=!1);if(this.ISGenerated){if(Te&&Se){var R=this.getVideoStartPts(d.samples),Y=u(p.samples[0].pts,R)-R,N=Y/d.inputTimeScale;he+=Math.max(0,N),me+=Math.max(0,-N)}if(Te){if(p.samplerate||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(p,d,m)),V=this.remuxAudio(p,he,this.isAudioContiguous,E,xe||Se||j===_.PlaylistLevelType.AUDIO?me:void 0),Se){var se=V?V.endPTS-V.startPTS:0;d.inputTimeScale||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(p,d,m)),K=this.remuxVideo(d,me,z,se)}}else Se&&(K=this.remuxVideo(d,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:ne,text:P,id3:$}},x.generateIS=function(p,d,a){var b=p.samples,m=d.samples,E=this.typeSupported,F={},j=!Object(Q.isFiniteNumber)(this._initPTS),K="audio/mp4",V,M,P;if(j&&(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")),F.audio={id:"audio",container:K,codec:p.codec,initSegment:!p.isAAC&&E.mpeg?new Uint8Array(0):D.default.initSegment([p]),metadata:{channelCount:p.channelCount}},j&&(P=p.inputTimeScale,V=M=b[0].pts-Math.round(P*a))),d.sps&&d.pps&&m.length&&(d.timescale=d.inputTimeScale,F.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:D.default.initSegment([d]),metadata:{width:d.width,height:d.height}},j)){P=d.inputTimeScale;var $=this.getVideoStartPts(m),ne=Math.round(P*a);M=Math.min(M,u(m[0].dts,$)-ne),V=Math.min(V,$-ne)}if(Object.keys(F).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=M),{tracks:F,initPTS:V,timescale:P}},x.remuxVideo=function(p,d,a,b){var m=p.inputTimeScale,E=p.samples,F=[],j=E.length,K=this._initPTS,V=this.nextAvcDts,M=8,P,$,ne,he=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,ke=0,xe=!1;if(!a||V===null){var Le=d*m,Te=E[0].pts-u(E[0].dts,E[0].pts);V=Le-Te}for(var Se=0;Se<j;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;ke=Math.max(Math.min(ke,ye.pts-ye.dts),-1*z)}ye.dts<E[Se>0?Se-1:Se].dts&&(xe=!0)}xe&&E.sort(function(pt,nt){var rt=pt.dts-nt.dts,Tt=pt.pts-nt.pts;return rt||Tt}),$=E[0].dts,ne=E[E.length-1].dts;var s=Math.round((ne-$)/(j-1));if(ke<0){if(ke<s*-2){B.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-s,!0)+" ms");for(var c=ke,R=0;R<j;R++)E[R].dts=c=Math.max(c,E[R].pts-s),E[R].pts=Math.max(c,E[R].pts)}else{B.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var Y=0;Y<j;Y++)E[Y].dts=E[Y].dts+ke}$=E[0].dts}if(a){var N=$-V,se=N>s,be=N<-1;if(se||be){se?B.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(N,!0)+" ms ("+N+"dts) hole between fragments detected, filling it"):B.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,B.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,De=0,_e=0;_e<j;_e++){for(var Pe=E[_e],He=Pe.units,Ge=He.length,Xe=0,ze=0;ze<Ge;ze++)Xe+=He[ze].data.length;De+=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)}ne=E[j-1].dts;var ot=De+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<j;Re++){for(var it=E[Re],qe=it.units,oe=0,q=0,ee=qe.length;q<ee;q++){var ae=qe[q],le=ae.data,te=ae.data.byteLength;Je.setUint32(M,te),M+=4,$e.set(le,M),M+=te,oe+=4+te}if(Re<j-1)P=E[Re+1].dts-it.dts;else{var ie=this.config,ue=it.dts-E[Re>0?Re-1:Re].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var ce=Math.floor(ie.maxBufferHole*m),ve=(b?he+b*m:this.nextAudioPts)-it.pts;ve>ce?(P=ve-ue,P<0&&(P=ue),B.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(it.pts-it.dts);F.push(new v(it.key,P,oe,Ee))}if(F.length&&C&&C<70){var Me=F[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ne+P,this.isVideoContiguous=!0;var Be=D.default.moof(p.sequenceNumber++,$,T({},p,{samples:F})),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:F.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,d,a,b,m){var E=p.inputTimeScale,F=p.samplerate?p.samplerate:E,j=E/F,K=p.isAAC?k:A,V=K*j,M=this._initPTS,P=!p.isAAC&&this.typeSupported.mpeg,$=[],ne=p.samples,he=P?0:8,me=this.nextAudioPts||-1,ke=d*E;if(this.isAudioContiguous=a=a||ne.length&&me>0&&(b&&Math.abs(ke-me)<9e3||Math.abs(u(ne[0].pts-M,ke)-me)<20*V),ne.forEach(function(le){le.pts=u(le.pts-M,ke)}),!a||me<0){if(ne=ne.filter(function(le){return le.pts>=0}),!ne.length)return;m===0?me=0:b?me=Math.max(0,ke):me=ne[0].pts}if(p.isAAC)for(var xe=m!==void 0,Le=this.config.maxAudioFramesDrift,Te=0,Se=me;Te<ne.length;Te++){var ye=ne[Te],z=ye.pts,s=z-Se,c=Math.abs(1e3*s/E);if(s<=-Le*V&&xe)Te===0&&(B.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>=Le*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),B.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||(B.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),se=ye.unit.subarray()),ne.splice(Te,0,{unit:se,pts:N}),Se+=V,Te++}}ye.pts=Se,Se+=V}for(var be=null,Ae=null,Oe,De=0,_e=ne.length;_e--;)De+=ne[_e].unit.byteLength;for(var Pe=0,He=ne.length;Pe<He;Pe++){var Ge=ne[Pe],Xe=Ge.unit,ze=Ge.pts;if(Ae!==null){var ot=$[Pe-1];ot.duration=Math.round((ze-Ae)/j)}else if(a&&p.isAAC&&(ze=me),be=ze,De>0){De+=he;try{Oe=new Uint8Array(De)}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:De,reason:"fail allocating audio mdat "+De});return}if(!P){var $e=new DataView(Oe.buffer);$e.setUint32(0,De),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 it=$[$.length-1];this.nextAudioPts=me=Ae+j*it.duration;var qe=P?new Uint8Array(0):D.default.moof(p.sequenceNumber++,be/j,T({},p,{samples:$}));p.samples=[];var oe=be/E,q=me/E,ee="audio",ae={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"),ae},x.remuxEmptyAudio=function(p,d,a,b){var m=p.inputTimeScale,E=p.samplerate?p.samplerate:m,F=m/E,j=this.nextAudioPts,K=(j!==null?j:b.startDTS*m)+this._initDTS,V=b.endDTS*m+this._initDTS,M=F*k,P=Math.ceil((V-K)/M),$=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(B.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){B.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ne=[],he=0;he<P;he++){var me=K+he*M;ne.push({unit:$,pts:me,dts:me})}return p.samples=ne,this.remuxAudio(p,d,a,!1)},x.remuxID3=function(p,d){var a=p.samples.length;if(!a)return;for(var b=p.inputTimeScale,m=this._initPTS,E=this._initDTS,F=0;F<a;F++){var j=p.samples[F];j.pts=u(j.pts-m,d*b)/b,j.dts=u(j.dts-E,d*b)/b}var K=p.samples;return p.samples=[],{samples:K}},x.remuxText=function(p,d){var a=p.samples.length;if(!a)return;for(var b=p.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var F=p.samples[E];F.pts=u(F.pts-m,d*b)/b}p.samples.sort(function(K,V){return K.pts-V.pts});var j=p.samples;return p.samples=[],{samples:j}},L}();function u(L,x){var f;if(x===null)return L;for(x<L?f=-8589934592:f=8589934592;Math.abs(L-x)>4294967296;)L+=f;return L}function w(L){for(var x=0;x<L.length;x++)if(L[x].key)return x;return-1}var v=function(x,f,p,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=p,this.cts=d,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(de,Z,O){"use strict";O.r(Z);var Q=O("./src/polyfills/number.ts"),U=O("./src/utils/mp4-tools.ts"),D=O("./src/loader/fragment.ts"),G=O("./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(k){this.initPTS=k,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(k,A,C){this.audioCodec=A,this.videoCodec=C,this.generateInitSegment(k),this.emitInitSegment=!0},T.generateInitSegment=function(k){var A=this.audioCodec,C=this.videoCodec;if(!k||!k.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(k);A||(A=_(h.audio,D.ElementaryStreamTypes.AUDIO)),C||(C=_(h.video,D.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:A+","+C,initSegment:k,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:A,initSegment:k,id:"audio"}:h.video?o.video={container:"video/mp4",codec:C,initSegment:k,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(k,A,C,h,o){var l=this.initPTS,u=this.lastEndDTS,w={audio:void 0,video:void 0,text:h,id3:C,initSegment:void 0};Object(Q.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var v=A.samples;if(!v||!v.length)return w;var g={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(v),L=this.initData),!L||!L.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(l)||(this.initPTS=g.initPTS=l=B(L,v,u));var x=Object(U.getDuration)(v,L),f=u,p=x+f;Object(U.offsetStartDTS)(L,v,l),x>0?this.lastEndDTS=p:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!L.audio,a=!!L.video,b="";d&&(b+="audio"),a&&(b+="video");var m={data1:v,startPTS:f,startDTS:f,endPTS:p,endDTS:p,type:b,hasAudio:d,hasVideo:a,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=h,w.id3=C,w.initSegment=g,w},y}(),B=function(T,I,k){return Object(U.getStartDTS)(T,I)-k};function _(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(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"CMCDVersion",function(){return Q}),O.d(Z,"CMCDObjectType",function(){return U}),O.d(Z,"CMCDStreamingFormat",function(){return D}),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"HlsSkip",function(){return D}),O.d(Z,"getSkipValue",function(){return G}),O.d(Z,"HlsUrlParameters",function(){return H}),O.d(Z,"Level",function(){return B});function Q(_,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(_,I.key,I)}}function U(_,y,T){return y&&Q(_.prototype,y),T&&Q(_,T),_}var D;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(D||(D={}));function G(_,y){var T=_.canSkipUntil,I=_.canSkipDateRanges,k=_.endSN,A=y!==void 0?y-k:0;return T&&A<T?I?D.v2:D.Yes:D.No}var H=function(){function _(T,I,k){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=I,this.skip=k}var y=_.prototype;return y.addDirectives=function(I){var k=new self.URL(I);return this.msn!==void 0&&k.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&k.searchParams.set("_HLS_part",this.part.toString()),this.skip&&k.searchParams.set("_HLS_skip",this.skip),k.toString()},_}(),B=function(){function _(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(_,[{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)}}]),_}()},"./src/types/loader.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"PlaylistContextType",function(){return Q}),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"ChunkMetadata",function(){return Q});var Q=function(G,H,B,_,y,T){_===void 0&&(_=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=B,this.size=_,this.part=y,this.partial=T};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"AttrList",function(){return D});var Q=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function G(B){typeof B=="string"&&(B=G.parseAttrList(B));for(var _ in B)B.hasOwnProperty(_)&&(this[_]=B[_])}var H=G.prototype;return H.decimalInteger=function(_){var y=parseInt(this[_],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.hexadecimalInteger=function(_){if(this[_]){var y=(this[_]||"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(_){var y=parseInt(this[_],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},H.decimalFloatingPoint=function(_){return parseFloat(this[_])},H.optionalFloat=function(_,y){var T=this[_];return T?parseFloat(T):y},H.enumeratedString=function(_){return this[_]},H.bool=function(_){return this[_]==="YES"},H.decimalResolution=function(_){var y=Q.exec(this[_]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},G.parseAttrList=function(_){var y,T={},I='"';for(U.lastIndex=0;(y=U.exec(_))!==null;){var k=y[2];k.indexOf(I)===0&&k.lastIndexOf(I)===k.length-1&&(k=k.slice(1,-1)),T[y[1]]=k}return T},G}()},"./src/utils/binary-search.ts":function(de,Z,O){"use strict";O.r(Z);var Q={search:function(D,G){for(var H=0,B=D.length-1,_=null,y=null;H<=B;){_=(H+B)/2|0,y=D[_];var T=G(y);if(T>0)H=_+1;else if(T<0)B=_-1;else return y}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"BufferHelper",function(){return D});var Q=O("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function G(){}return G.isBuffered=function(B,_){try{if(B){for(var y=G.getBuffered(B),T=0;T<y.length;T++)if(_>=y.start(T)&&_<=y.end(T))return!0}}catch(I){}return!1},G.bufferInfo=function(B,_,y){try{if(B){var T=G.getBuffered(B),I=[],k;for(k=0;k<T.length;k++)I.push({start:T.start(k),end:T.end(k)});return this.bufferedInfo(I,_,y)}}catch(A){}return{len:0,start:_,end:_,nextStart:void 0}},G.bufferedInfo=function(B,_,y){_=Math.max(0,_),B.sort(function(g,L){var x=g.start-L.start;return x||L.end-g.end});var T=[];if(y)for(var I=0;I<B.length;I++){var k=T.length;if(k){var A=T[k-1].end;B[I].start-A<y?B[I].end>A&&(T[k-1].end=B[I].end):T.push(B[I])}else T.push(B[I])}else T=B;for(var C=0,h,o=_,l=_,u=0;u<T.length;u++){var w=T[u].start,v=T[u].end;if(_+y>=w&&_<v)o=w,l=v,C=l-_;else if(_+y<w){h=w;break}}return{len:C,start:o||0,end:l||0,nextStart:h}},G.getBuffered=function(B){try{return B.buffered}catch(_){return Q.logger.log("failed to get media.buffered",_),U}},G}()},"./src/utils/cea-608-parser.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"Row",function(){return l}),O.d(Z,"CaptionScreen",function(){return u});var Q=O("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},D=function(p){var d=p;return U.hasOwnProperty(p)&&(d=U[p]),String.fromCharCode(d)},G=15,H=100,B={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={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"],k;(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"})(k||(k={}));var A=function(){function f(){this.time=null,this.verboseLevel=k.ERROR}var p=f.prototype;return p.log=function(a,b){this.verboseLevel>=a&&Q.logger.log(this.time+" ["+a+"] "+b)},f}(),C=function(p){for(var d=[],a=0;a<p.length;a++)d.push(p[a].toString(16));return d},h=function(){function f(d,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=d||"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(d,a,b,m,E,F){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new h(a,b,m,E,F)}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(d){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=d,this.pos=0,this.currPenState=new h}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(k.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(k.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(k.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(d){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(d));this.logger=d,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(k.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},p.setPAC=function(a){this.logger.log(k.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,F=this.lastOutputScreen;if(F){var j=F.rows[E].cueStartTime,K=this.logger.time;if(j&&K!==null&&j<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[b-this.nrRollUpRows+V+1].copy(F.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 ne={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ne)},p.setBkgData=function(a){this.logger.log(k.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(k.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(k.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(k.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var b=[],m="",E=-1,F=0;F<G;F++){var j=this.rows[F].getTextString();j&&(E=F+1,a?b.push("Row "+E+": '"+j+"'"):b.push(j.trim()))}return b.length>0&&(a?m="["+b.join(" | ")+"]":m=b.join(`
|
|
`)),m},p.getTextAndFormat=function(){return this.rows},f}(),w=function(){function f(d,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=d,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(k.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},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(k.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(k.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(k.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(k.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(k.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(k.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(k.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(k.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(k.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(k.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(k.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(k.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(k.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(k.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(k.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(k.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(k.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(d,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 w(d,a,m),new w(d+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,F,j=!1;this.logger.time=a;for(var K=0;K<b.length;K+=2){if(E=b[K]&127,F=b[K+1]&127,E===0&&F===0)continue;if(this.logger.log(k.DATA,"["+C([b[K],b[K+1]])+"] -> ("+C([E,F])+")"),m=this.parseCmd(E,F),m||(m=this.parseMidrow(E,F)),m||(m=this.parsePAC(E,F)),m||(m=this.parseBackgroundAttributes(E,F)),!m&&(j=this.parseChars(E,F),j)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(j)}else this.logger.log(k.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!j&&this.logger.log(k.WARNING,"Couldn't parse cleaned data "+C([E,F])+" orig: "+C([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,F=(a===23||a===31)&&b>=33&&b<=35;if(!(E||F))return!1;if(L(a,b,m))return g(null,null,m),this.logger.log(k.DEBUG,"Repeated command ("+C([a,b])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,K=this.channels[j];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=j,!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(k.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(b),this.logger.log(k.DEBUG,"MIDROW ("+C([a,b])+")"),!0):!1}return!1},p.parsePAC=function(a,b){var m,E=this.cmdHistory,F=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,j=(a===16||a===24)&&b>=64&&b<=95;if(!(F||j))return!1;if(L(a,b,E))return g(null,null,E),!0;var K=a<=23?1:2;b>=64&&b<=95?m=K===1?B[a]:y[a]:m=K===1?_[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,F=null;if(a>=25?(m=2,F=a-8):(m=1,F=a),F>=17&&F<=19){var j;F===17?j=b+80:F===18?j=b+112:j=b+144,this.logger.log(k.INFO,"Special char '"+D(j)+"' in channel "+m),E=[j]}else a>=32&&a<=127&&(E=b===0?[a]:[a,b]);if(E){var K=C(E);this.logger.log(k.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 F,j={};a===16||a===24?(F=Math.floor((b-32)/2),j.background=I[F],b%2===1&&(j.background=j.background+"_semi")):b===45?j.background="transparent":(j.foreground="black",b===47&&(j.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(j),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,d){d.a=f,d.b=p}function L(f,p,d){return d.a===f&&d.b===p}function x(){return{a:null,b:null}}Z.default=v},"./src/utils/codecs.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"isCodecType",function(){return U}),O.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 B=Q[H];return!!B&&B[G.slice(0,4)]===!0}function D(G,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/utils/vttparser.ts"),U=O("./src/utils/webvtt-parser.ts"),D=O("./src/utils/texttrack-utils.ts"),G=/\s/,H={newCue:function(_,y,T,I){for(var k=[],A,C,h,o,l,u=self.VTTCue||self.TextTrackCue,w=0;w<I.rows.length;w++)if(A=I.rows[w],h=!0,o=0,l="",!A.isEmpty()){for(var v=0;v<A.chars.length;v++)G.test(A.chars[v].uchar)&&h?o++:(l+=A.chars[v].uchar,h=!1);A.cueStartTime=y,y===T&&(T+=1e-4),o>=16?o--:o++;var g=Object(Q.fixLineBreaks)(l.trim()),L=Object(U.generateCueId)(y,T,g);(!_||!_.cues||!_.cues.getCueById(L))&&(C=new u(y,T,g),C.id=L,C.line=w+1,C.align="left",C.position=10+Math.min(80,Math.floor(o*8/32)*10),k.push(C))}return _&&k.length&&(k.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}),k.forEach(function(x){return Object(D.addCueToTrack)(_,x)})),k}};Z.default=H},"./src/utils/discontinuities.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"findFirstFragWithCC",function(){return G}),O.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),O.d(Z,"findDiscontinuousReferenceFrag",function(){return B}),O.d(Z,"adjustSlidingStart",function(){return y}),O.d(Z,"alignStream",function(){return T}),O.d(Z,"alignPDT",function(){return k}),O.d(Z,"alignFragmentByPDTDelta",function(){return A}),O.d(Z,"alignMediaPlaylistByPDT",function(){return C});var Q=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts"),D=O("./src/controller/level-helper.ts");function G(h,o){for(var l=null,u=0,w=h.length;u<w;u++){var v=h[u];if(v&&v.cc===o){l=v;break}}return l}function H(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function B(h,o){var l=h.fragments,u=o.fragments;if(!u.length||!l.length){U.logger.log("No fragments to align");return}var w=G(l,u[0].cc);if(!w||w&&!w.startPTS){U.logger.log("No frag in previous level to align on");return}return w}function _(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function y(h,o){for(var l=o.fragments,u=0,w=l.length;u<w;u++)_(l[u],h);o.fragmentHint&&_(o.fragmentHint,h),o.alignedSliding=!0}function T(h,o,l){if(!o)return;I(h,l,o),!l.alignedSliding&&o.details&&k(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(D.adjustSliding)(o.details,l)}function I(h,o,l){if(H(h,l,o)){var u=B(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 k(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=h.fragments[0].programDateTime,w=(u-l)/1e3+o.fragments[0].start;w&&Object(Q.isFiniteNumber)(w)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+w.toFixed(3)+" "+h.url+" "),y(w,h))}function A(h,o){var l=h.programDateTime;if(!l)return;var u=(l-o)/1e3;h.start=h.startPTS=u,h.endPTS=u+h.duration}function C(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,w=l-u*1e3;h.fragments.forEach(function(v){A(v,w)}),h.fragmentHint&&A(h.fragmentHint,w),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/utils/ewma.ts"),U=function(){function D(H,B,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(H),this.fast_=new Q.default(B)}var G=D.prototype;return G.update=function(B,_){var y=this.slow_,T=this.fast_;this.slow_.halfLife!==B&&(this.slow_=new Q.default(B,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new Q.default(_,T.getEstimate(),T.getTotalWeight()))},G.sample=function(B,_){B=Math.max(B,this.minDelayMs_);var y=8*_,T=B/1e3,I=y/T;this.fast_.sample(T,I),this.slow_.sample(T,I)},G.canEstimate=function(){var B=this.fast_;return B&&B.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(de,Z,O){"use strict";O.r(Z);var Q=function(){function U(G,H,B){H===void 0&&(H=0),B===void 0&&(B=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_=B}var D=U.prototype;return D.sample=function(H,B){var _=Math.pow(this.alpha_,H);this.estimate_=B*(1-_)+_*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(de,Z,O){"use strict";O.r(Z),O.d(Z,"fetchSupported",function(){return A});var Q=O("./src/polyfills/number.ts"),U=O("./src/loader/load-stats.ts"),D=O("./src/demux/chunk-cache.ts");function G(u,w){u.prototype=Object.create(w.prototype),u.prototype.constructor=u,T(u,w)}function H(u){var w=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 w!="undefined"){if(w.has(g))return w.get(g);w.set(g,L)}function L(){return B(g,arguments,I(this).constructor)}return L.prototype=Object.create(g.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),T(L,g)},H(u)}function B(u,w,v){return _()?B=Reflect.construct:B=function(L,x,f){var p=[null];p.push.apply(p,x);var d=Function.bind.apply(L,p),a=new d;return f&&T(a,f.prototype),a},B.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function y(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function T(u,w){return T=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},T(u,w)}function I(u){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},I(u)}function k(){return k=Object.assign||function(u){for(var w=1;w<arguments.length;w++){var v=arguments[w];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(u[g]=v[g])}return u},k.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 C=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 w=u.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(g,L,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 d=h(g,this.controller.signal),a=x.onProgress,b=g.responseType==="arraybuffer",m=b?"byteLength":"length";this.context=g,this.config=L,this.callbacks=x,this.request=this.fetchSetup(g,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),x.onTimeout(p,g,f.response)},L.timeout),self.fetch(this.request).then(function(E){if(f.response=f.loader=E,!E.ok){var F=E.status,j=E.statusText;throw new l(j||"fetch, bad network response",F,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)(L.highWaterMark)?f.loadProgressively(E,p,g,L.highWaterMark,a):b?E.arrayBuffer():E.text()}).then(function(E){var F=f.response;self.clearTimeout(f.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=E[m];var j={url:F.url,data:E};a&&!Object(Q.isFiniteNumber)(L.highWaterMark)&&a(p,g,E,F),x.onSuccess(j,p,g,F)}).catch(function(E){if(self.clearTimeout(f.requestTimeout),p.aborted)return;var F=E.code||0;x.onError({code:F,text:E.message},g,E.details)})},w.getCacheAge=function(){var g=null;if(this.response){var L=this.response.headers.get("age");g=L?parseFloat(L):null}return g},w.loadProgressively=function(g,L,x,f,p){f===void 0&&(f=0);var d=new D.default,a=g.body.getReader(),b=function m(){return a.read().then(function(E){if(E.done)return d.dataLength&&p(L,x,d.flush(),g),Promise.resolve(new ArrayBuffer(0));var F=E.value,j=F.length;return L.loaded+=j,j<f||d.dataLength?(d.push(F),d.dataLength>=f&&p(L,x,d.flush(),g)):p(L,x,F,g),m()}).catch(function(){return Promise.reject()})};return b()},u}();function h(u,w){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(k({},u.headers))};return u.rangeEnd&&v.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),v}function o(u,w){return new self.Request(u.url,w)}var l=function(u){G(w,u);function w(v,g,L){var x;return x=u.call(this,v)||this,x.code=void 0,x.details=void 0,x.code=g,x.details=L,x}return w}(H(Error));Z.default=C},"./src/utils/imsc1-ttml-parser.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"IMSC1_CODEC",function(){return y}),O.d(Z,"parseIMSC1",function(){return A});var Q=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/vttparser.ts"),D=O("./src/utils/vttcue.ts"),G=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),B=O("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(f){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(f[a]=d[a])}return f},_.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)$/,k={left:"start",center:"center",right:"end",start:"start",end:"end"};function A(f,p,d,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],F=Object(G.utf8ArrayToStr)(new Uint8Array(f,E.start,E.end-E.start)),j=Object(H.toTimescaleFromScale)(p,1,d);try{a(C(F,j))}catch(K){b(K)}}function C(f,p){var d=new DOMParser,a=d.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},{}),F=b.getAttribute("xml:space")!=="preserve",j=o(h(b,"styling","style")),K=o(h(b,"layout","region")),V=h(b,"body","[begin]");return[].map.call(V,function(M){var P=l(M,F);if(!P||!M.hasAttribute("begin"))return null;var $=g(M.getAttribute("begin"),E),ne=g(M.getAttribute("dur"),E),he=g(M.getAttribute("end"),E);if($===null)throw v(M);if(he===null){if(ne===null)throw v(M);he=$+ne}var me=new D.default($-p,he-p,P);me.id=Object(B.generateCueId)(me.startTime,me.endTime,me.text);var ke=K[M.getAttribute("region")],xe=j[M.getAttribute("style")];me.position=10,me.size=80;var Le=u(ke,xe),Te=Le.textAlign;if(Te){var Se=k[Te];Se&&(me.lineAlign=Se),me.align=Te}return _(me,Le),me}).filter(function(M){return M!==null})}function h(f,p,d){var a=f.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(f){return f.reduce(function(p,d){var a=d.getAttribute("xml:id");return a&&(p[a]=d),p},{})}function l(f,p){return[].slice.call(f.childNodes).reduce(function(d,a,b){var m;return a.nodeName==="br"&&b?d+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?l(a,p):p?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function u(f,p){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,m){var E=w(p,d,m)||w(f,d,m);return E&&(b[m]=E),b},{})}function w(f,p,d){return f.hasAttributeNS(p,d)?f.getAttributeNS(p,d):null}function v(f){return new Error("Could not parse ttml timestamp "+f)}function g(f,p){if(!f)return null;var d=Object(U.parseTimeStamp)(f);return d===null&&(T.test(f)?d=L(f,p):I.test(f)&&(d=x(f,p))),d}function L(f,p){var d=T.exec(f),a=(d[4]|0)+(d[5]|0)/p.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/p.frameRate}function x(f,p){var d=I.exec(f),a=Number(d[1]),b=d[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(de,Z,O){"use strict";O.r(Z),O.d(Z,"enableLogs",function(){return B}),O.d(Z,"logger",function(){return _});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),k=1;k<T;k++)I[k-1]=arguments[k];I.forEach(function(A){D[A]=y[A]?y[A].bind(y):G(A)})}function B(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 _=D},"./src/utils/mediakeys-helper.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"KeySystems",function(){return Q}),O.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(de,Z,O){"use strict";O.r(Z),O.d(Z,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"bin2str",function(){return H}),O.d(Z,"readUint16",function(){return B}),O.d(Z,"readUint32",function(){return _}),O.d(Z,"writeUint32",function(){return y}),O.d(Z,"findBox",function(){return T}),O.d(Z,"parseSegmentIndex",function(){return I}),O.d(Z,"parseInitSegment",function(){return k}),O.d(Z,"getStartDTS",function(){return A}),O.d(Z,"getDuration",function(){return C}),O.d(Z,"computeRawDurationFromSamples",function(){return h}),O.d(Z,"offsetStartDTS",function(){return o}),O.d(Z,"segmentValidRange",function(){return l}),O.d(Z,"appendUint8Array",function(){return u});var Q=O("./src/utils/typed-array.ts"),U=O("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,G=[].push;function H(w){return String.fromCharCode.apply(null,w)}function B(w,v){"data"in w&&(v+=w.start,w=w.data);var g=w[v]<<8|w[v+1];return g<0?65536+g:g}function _(w,v){"data"in w&&(v+=w.start,w=w.data);var g=w[v]<<24|w[v+1]<<16|w[v+2]<<8|w[v+3];return g<0?4294967296+g:g}function y(w,v,g){"data"in w&&(v+=w.start,w=w.data),w[v]=g>>24,w[v+1]=g>>16&255,w[v+2]=g>>8&255,w[v+3]=g&255}function T(w,v){var g=[];if(!v.length)return g;var L,x,f;"data"in w?(L=w.data,x=w.start,f=w.end):(L=w,x=0,f=L.byteLength);for(var p=x;p<f;){var d=_(L,p),a=H(L.subarray(p+4,p+8)),b=d>1?p+d:f;if(a===v[0])if(v.length===1)g.push({data:L,start:p+8,end:b});else{var m=T({data:L,start:p+8,end:b},v.slice(1));m.length&&G.apply(g,m)}p=b}return g}function I(w){var v=T(w,["moov"]),g=v[0],L=g?g.end:null,x=T(w,["sidx"]);if(!x||!x[0])return null;var f=[],p=x[0],d=p.data[0],a=d===0?8:16,b=_(p,a);a+=4;var m=0,E=0;d===0?a+=8:a+=16,a+=2;var F=p.end+E,j=B(p,a);a+=2;for(var K=0;K<j;K++){var V=a,M=_(p,V);V+=4;var P=M&2147483647,$=(M&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=_(p,V);V+=4,f.push({referenceSize:P,subsegmentDuration:ne,info:{duration:ne/b,start:F,end:F+P-1}}),F+=P,V+=4,a=V}return{earliestPresentationTime:m,timescale:b,version:d,referencesCount:j,references:f,moovEndOffset:L}}function k(w){for(var v=[],g=T(w,["moov","trak"]),L=0;L<g.length;L++){var x=g[L],f=T(x,["tkhd"])[0];if(f){var p=f.data[f.start],d=p===0?12:20,a=_(f,d),b=T(x,["mdia","mdhd"])[0];if(b){p=b.data[b.start],d=p===0?12:20;var m=_(b,d),E=T(x,["mdia","hdlr"])[0];if(E){var F=H(E.data.subarray(E.start+8,E.start+12)),j={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[F];if(j){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:j},v[j]={timescale:m,id:a,codec:V}}}}}}var M=T(w,["moov","mvex","trex"]);return M.forEach(function(P){var $=_(P,4),ne=v[$];ne&&(ne.default={duration:_(P,12),flags:_(P,20)})}),v}function A(w,v){return T(v,["moof","traf"]).reduce(function(g,L){var x=T(L,["tfdt"])[0],f=x.data[x.start],p=T(L,["tfhd"]).reduce(function(d,a){var b=_(a,4),m=w[b];if(m){var E=_(x,4);f===1&&(E*=Math.pow(2,32),E+=_(x,8));var F=m.timescale||9e4,j=E/F;if(isFinite(j)&&(d===null||j<d))return j}return d},null);return p!==null&&isFinite(p)&&(g===null||p<g)?p:g},null)||0}function C(w,v){for(var g=0,L=0,x=0,f=T(w,["moof","traf"]),p=0;p<f.length;p++){var d=f[p],a=T(d,["tfhd"])[0],b=_(a,4),m=v[b];if(!m)continue;var E=m.default,F=_(a,0)|(E==null?void 0:E.flags),j=E==null?void 0:E.duration;F&8&&(F&2?j=_(a,12):j=_(a,8));for(var K=m.timescale||9e4,V=T(d,["trun"]),M=0;M<V.length;M++){if(j){var P=_(V[M],4);g=j*P}else g=h(V[M]);m.type===U.ElementaryStreamTypes.VIDEO?L+=g/K:m.type===U.ElementaryStreamTypes.AUDIO&&(x+=g/K)}}if(L===0&&x===0){var $=I(w);if($!=null&&$.references)return $.references.reduce(function(ne,he){return ne+he.info.duration||0},0)}return L||x}function h(w){var v=_(w,0),g=8;v&1&&(g+=4),v&4&&(g+=4);for(var L=0,x=_(w,4),f=0;f<x;f++){if(v&256){var p=_(w,g);L+=p,g+=4}v&512&&(g+=4),v&1024&&(g+=4),v&2048&&(g+=4)}return L}function o(w,v,g){T(v,["moof","traf"]).forEach(function(L){T(L,["tfhd"]).forEach(function(x){var f=_(x,4),p=w[f];if(!p)return;var d=p.timescale||9e4;T(L,["tfdt"]).forEach(function(a){var b=a.data[a.start],m=_(a,4);if(b===0)y(a,4,m-g*d);else{m*=Math.pow(2,32),m+=_(a,8),m-=g*d,m=Math.max(m,0);var E=Math.floor(m/(D+1)),F=Math.floor(m%(D+1));y(a,4,E),y(a,8,F)}})})})}function l(w){var v={valid:null,remainder:null},g=T(w,["moof"]);if(g){if(g.length<2)return v.remainder=w,v}else return v;var L=g[g.length-1];return v.valid=Object(Q.sliceUint8)(w,0,L.start-8),v.remainder=Object(Q.sliceUint8)(w,L.start-8),v}function u(w,v){var g=new Uint8Array(w.length+v.length);return g.set(w),g.set(v,w.length),g}},"./src/utils/output-filter.ts":function(de,Z,O){"use strict";O.r(Z),O.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,B,_){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=B,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"sendAddTrackEvent",function(){return U}),O.d(Z,"addCueToTrack",function(){return D}),O.d(Z,"clearCurrentCues",function(){return G}),O.d(Z,"removeCuesInRange",function(){return H}),O.d(Z,"getCuesInRange",function(){return _});var Q=O("./src/utils/logger.ts");function U(y,T){var I;try{I=new Event("addtrack")}catch(k){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 k=new self.TextTrackCue(T.startTime,T.endTime,T.text);k.id=T.id,y.addCue(k)}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 k=y.mode;if(k==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var A=_(y.cues,T,I),C=0;C<A.length;C++)y.removeCue(A[C]);k==="disabled"&&(y.mode=k)}function B(y,T){if(T<y[0].startTime)return 0;var I=y.length-1;if(T>y[I].endTime)return-1;for(var k=0,A=I;k<=A;){var C=Math.floor((A+k)/2);if(T<y[C].startTime)A=C-1;else if(T>y[C].startTime&&k<I)k=C+1;else return C}return y[k].startTime-T<T-y[A].startTime?k:A}function _(y,T,I){var k=[],A=B(y,T);if(A>-1)for(var C=A,h=y.length;C<h;C++){var o=y[C];if(o.startTime>=T&&o.endTime<=I)k.push(o);else if(o.startTime>I)return k}return k}},"./src/utils/time-ranges.ts":function(de,Z,O){"use strict";O.r(Z);var Q={toString:function(D){for(var G="",H=D.length,B=0;B<H;B++)G+="["+D.start(B).toFixed(3)+","+D.end(B).toFixed(3)+"]";return G}};Z.default=Q},"./src/utils/timescale-conversion.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"toTimescaleFromBase",function(){return U}),O.d(Z,"toTimescaleFromScale",function(){return D}),O.d(Z,"toMsFromMpegTsClock",function(){return G}),O.d(Z,"toMpegTsClockFromTimescale",function(){return H});var Q=9e4;function U(B,_,y,T){y===void 0&&(y=1),T===void 0&&(T=!1);var I=B*_*y;return T?Math.round(I):I}function D(B,_,y,T){return y===void 0&&(y=1),T===void 0&&(T=!1),U(B,_,1/y,T)}function G(B,_){return _===void 0&&(_=!1),U(B,1e3,1/Q,_)}function H(B,_){return _===void 0&&(_=1),U(B,Q,1/_)}},"./src/utils/typed-array.ts":function(de,Z,O){"use strict";O.r(Z),O.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(de,Z,O){"use strict";O.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 B(y){for(var T=arguments.length,I=new Array(T>1?T-1:0),k=1;k<T;k++)I[k-1]=arguments[k];for(var A=1;A<arguments.length;A++){var C=arguments[A];for(var h in C)y[h]=C[h]}return y}function _(y,T,I){var k=this,A={enumerable:!0};k.hasBeenReset=!1;var C="",h=!1,o=y,l=T,u=I,w=null,v="",g=!0,L="auto",x="start",f=50,p="middle",d=50,a="middle";Object.defineProperty(k,"id",B({},A,{get:function(){return C},set:function(m){C=""+m}})),Object.defineProperty(k,"pauseOnExit",B({},A,{get:function(){return h},set:function(m){h=!!m}})),Object.defineProperty(k,"startTime",B({},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(k,"endTime",B({},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(k,"text",B({},A,{get:function(){return u},set:function(m){u=""+m,this.hasBeenReset=!0}})),Object.defineProperty(k,"region",B({},A,{get:function(){return w},set:function(m){w=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"vertical",B({},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(k,"snapToLines",B({},A,{get:function(){return g},set:function(m){g=!!m,this.hasBeenReset=!0}})),Object.defineProperty(k,"line",B({},A,{get:function(){return L},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"lineAlign",B({},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(k,"position",B({},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(k,"positionAlign",B({},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(k,"size",B({},A,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"align",B({},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}})),k.displayState=void 0}return _.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"parseTimeStamp",function(){return D}),O.d(Z,"fixLineBreaks",function(){return T}),O.d(Z,"VTTParser",function(){return I});var Q=O("./src/utils/vttcue.ts"),U=function(){function k(){}var A=k.prototype;return A.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},k}();function D(k){function A(h,o,l,u){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var C=k.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?A(C[2],C[3],0,C[4]):A(C[1],C[2],C[3],C[4]):null}var G=function(){function k(){this.values=Object.create(null)}var A=k.prototype;return A.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},A.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},A.has=function(h){return h in this.values},A.alt=function(h,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(h,o);break}},A.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},A.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},k}();function H(k,A,C,h){var o=h?k.split(h):[k];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(C);if(u.length!==2)continue;var w=u[0],v=u[1];A(w,v)}}var B=new Q.default(0,0,""),_=B.align==="middle"?"middle":"center";function y(k,A,C){var h=k;function o(){var w=D(k);if(w===null)throw new Error("Malformed timestamp: "+h);return k=k.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,v){var g=new G;H(w,function(f,p){var d;switch(f){case"region":for(var a=C.length-1;a>=0;a--)if(C[a].id===p){g.set(f,C[a].region);break}break;case"vertical":g.alt(f,p,["rl","lr"]);break;case"line":d=p.split(","),g.integer(f,d[0]),g.percent(f,d[0])&&g.set("snapToLines",!1),g.alt(f,d[0],["auto"]),d.length===2&&g.alt("lineAlign",d[1],["start",_,"end"]);break;case"position":d=p.split(","),g.percent(f,d[0]),d.length===2&&g.alt("positionAlign",d[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":g.percent(f,p);break;case"align":g.alt(f,p,["start",_,"end","left","right"]);break}},/:/,/\s/),v.region=g.get("region",null),v.vertical=g.get("vertical","");var L=g.get("line","auto");L==="auto"&&B.line===-1&&(L=-1),v.line=L,v.lineAlign=g.get("lineAlign","start"),v.snapToLines=g.get("snapToLines",!0),v.size=g.get("size",100),v.align=g.get("align",_);var x=g.get("position","auto");x==="auto"&&B.position===50&&(x=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=x}function u(){k=k.replace(/^\s+/,"")}if(u(),A.startTime=o(),u(),k.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);k=k.substr(3),u(),A.endTime=o(),u(),l(k,A)}function T(k){return k.replace(/<br(?: \/)?>/gi,`
|
|
`)}var I=function(){function k(){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=k.prototype;return A.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{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 w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=l();var v=w.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:w=l();switch(o.state){case"HEADER":/:/.test(w)?u(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new Q.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(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+=w}continue;case"BADCUE":w||(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 h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
|
|
|
|
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},k}()},"./src/utils/webvtt-parser.ts":function(de,Z,O){"use strict";O.r(Z),O.d(Z,"generateCueId",function(){return I}),O.d(Z,"parseWebVTT",function(){return A});var Q=O("./src/polyfills/number.ts"),U=O("./src/utils/vttparser.ts"),D=O("./src/demux/id3.ts"),G=O("./src/utils/timescale-conversion.ts"),H=O("./src/remux/mp4-remuxer.ts"),B=/\r\n|\n\r|\n|\r/g,_=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},y=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),u=parseInt(h.substr(-9,2)),w=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(l)||!Object(Q.isFiniteNumber)(u)||!Object(Q.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*w,o},T=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function I(C,h,o){return T(C.toString())+T(h.toString())+T(o)}var k=function(h,o,l){var u=h[o],w=h[u.prevCC];if(!w||!w.new&&u.new){h.ccOffset=h.presentationOffset=u.start,u.new=!1;return}for(;(v=w)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=u.start-w.start,u.new=!1,u=w,w=h[u.prevCC]}h.presentationOffset=l};function A(C,h,o,l,u,w,v,g){var L=new U.VTTParser,x=Object(D.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(B,`
|
|
`).split(`
|
|
`),f=[],p=Object(G.toMpegTsClockFromTimescale)(h,o),d="00:00.000",a=0,b=0,m,E=!0,F=!1;L.oncue=function(j){var K=l[u],V=l.ccOffset,M=(a-p)/9e4;if(K!=null&&K.new&&(b!==void 0?V=l.ccOffset=K.start:k(l,u,M)),M&&(V=M-l.presentationOffset),F){var P=j.endTime-j.startTime,$=Object(H.normalizePts)((j.startTime+V-b)*9e4,w*9e4)/9e4;j.startTime=$,j.endTime=$+P}var ne=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(ne)),j.id||(j.id=I(j.startTime,j.endTime,ne)),j.endTime>0&&f.push(j)},L.onparsingerror=function(j){m=j},L.onflush=function(){if(m){g(m);return}v(f)},x.forEach(function(j){if(E)if(_(j,"X-TIMESTAMP-MAP=")){E=!1,F=!0,j.substr(16).split(",").forEach(function(K){_(K,"LOCAL:")?d=K.substr(6):_(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{b=y(d)/1e3}catch(K){F=!1,m=K}return}else j===""&&(E=!1);L.parse(j+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(de,Z,O){"use strict";O.r(Z);var Q=O("./src/utils/logger.ts"),U=O("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,G=function(){function H(_){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=_?_.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var B=H.prototype;return B.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},B.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()))},B.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},B.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()},B.loadInternal=function(){var y=this.config,T=this.context;if(!y)return;var I=this.loader=new self.XMLHttpRequest,k=this.stats;k.loading.first=0,k.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 C=this.context.headers;if(C)for(var h in C)I.setRequestHeader(h,C[h])}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()},B.readystatechange=function(){var y=this.context,T=this.loader,I=this.stats;if(!y||!T)return;var k=T.readyState,A=this.config;if(I.aborted)return;if(k>=2)if(self.clearTimeout(this.requestTimeout),I.loading.first===0&&(I.loading.first=Math.max(self.performance.now(),I.loading.start)),k===4){T.onreadystatechange=null,T.onprogress=null;var C=T.status;if(C>=200&&C<300){I.loading.end=Math.max(self.performance.now(),I.loading.first);var h,o;if(y.responseType==="arraybuffer"?(h=T.response,o=h.byteLength):(h=T.responseText,o=h.length),I.loaded=I.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(I,y,h,T),!this.callbacks)return;var u={url:T.responseURL,data:h};this.callbacks.onSuccess(u,I,y,T)}else I.retry>=A.maxRetry||C>=400&&C<499?(Q.logger.error(C+" while loading "+y.url),this.callbacks.onError({code:C,text:T.statusText},y,T)):(Q.logger.warn(C+" 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)},B.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))},B.loadprogress=function(y){var T=this.stats;T.loaded=y.loaded,y.lengthComputable&&(T.total=y.total)},B.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(ht,et,pe){ht.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|