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.
410 lines
897 KiB
410 lines
897 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[219,7],{"+NIl":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(Z,D){"use strict";function Y(L,w){L.cmdState.push(w)}function N(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function P(L){var w=L.cmdState.pop();w&&w.closeBracket()}function H(L){for(var w=L.cmdState,T=w.length-1;T>=0;T--){var u=w[T];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function W(L,w,T){return function(){this.name=L,this.bracketNo=0,this.style=w,this.styles=T,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=W("importmodule","tag",["string","builtin"]),M.documentclass=W("documentclass","tag",["","atom"]),M.usepackage=W("usepackage","tag",["atom"]),M.begin=W("begin","tag",["atom"]),M.end=W("end","tag",["atom"]),M.label=W("label","tag",["atom"]),M.ref=W("ref","tag",["atom"]),M.eqref=W("eqref","tag",["atom"]),M.cite=W("cite","tag",["atom"]),M.bibitem=W("bibitem","tag",["atom"]),M.Bibitem=W("Bibitem","tag",["atom"]),M.RBibitem=W("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(L,w){L.f=w}function y(L,w){var T;if(L.match(/^\\[a-zA-Z@]+/)){var u=L.current().slice(1);return T=M.hasOwnProperty(u)?M[u]:M.DEFAULT,T=new T,Y(w,T),O(w,R),T.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return O(w,function(l,h){return A(l,h,"\\]")}),"keyword";if(L.match("\\("))return O(w,function(l,h){return A(l,h,"\\)")}),"keyword";if(L.match("$$"))return O(w,function(l,h){return A(l,h,"$$")}),"keyword";if(L.match("$"))return O(w,function(l,h){return A(l,h,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(T=N(w),T)T.closeBracket(o),O(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(T=M.DEFAULT,T=new T,Y(w,T),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),T=H(w),T.name=="begin"&&(T.argument=L.current()),T.styleIdentifier())}function A(L,w,T){if(L.eatSpace())return null;if(T&&L.match(T))return O(w,y),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=L.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(L.skipToEnd(),"comment"):"error"}function R(L,w){var T=L.peek(),u;return T=="{"||T=="["?(u=N(w),u.openBracket(T),L.eat(T),O(w,y),"bracket"):/[ \t\r]/.test(T)?(L.eat(T),null):(O(w,y),P(w),y(L,w))}return{startState:function(){var L=D.inMathMode?function(w,T){return A(w,T)}:y;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,w){return w.f(L,w)},blankLine:function(L){L.f=y,L.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"19Vz":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){re.defineOption("placeholder","",function(W,M,O){var y=O&&O!=re.Init;if(M&&!y)W.on("blur",N),W.on("change",P),W.on("swapDoc",P),re.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Y(W)}),P(W);else if(!M&&y){W.off("blur",N),W.off("change",P),W.off("swapDoc",P),re.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),Z(W);var A=W.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}M&&!W.hasFocus()&&N(W)});function Z(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){Z(W);var M=W.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=W.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var O=W.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),M.appendChild(O),W.display.lineSpace.insertBefore(M,W.display.lineSpace.firstChild)}function Y(W){setTimeout(function(){var M=!1,O=W.getInputField();O.nodeName=="TEXTAREA"?M=!O.value:W.lineCount()==1&&(M=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),M?D(W):Z(W)},20)}function N(W){H(W)&&D(W)}function P(W){var M=W.getWrapperElement(),O=H(W);M.className=M.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?D(W):Z(W)}function H(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(Y,N){var P=Y.indentUnit,H={},W=N.htmlMode?Z:D;for(var M in W)H[M]=W[M];for(var M in N)H[M]=N[M];var O,y;function A(a,x){function v(G){return x.tokenize=G,G(a,x)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(w("atom","]]>")):null:a.match("--")?v(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(T(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=w("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",x.tokenize=R,"tag bracket");if(S=="&"){var I;return a.eat("#")?a.eat("x")?I=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):I=a.eatWhile(/[\d]/)&&a.eat(";"):I=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),I?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function R(a,x){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return x.tokenize=A,O=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return O="equals",null;if(v=="<"){x.tokenize=A,x.state=h,x.tagName=x.tagStart=null;var S=x.tokenize(a,x);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(v)?(x.tokenize=L(v),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var x=function(v,S){for(;!v.eol();)if(v.next()==a){S.tokenize=R;break}return"string"};return x.isInAttribute=!0,x}function w(a,x){return function(v,S){for(;!v.eol();){if(v.match(x)){S.tokenize=A;break}v.next()}return a}}function T(a){return function(x,v){for(var S;(S=x.next())!=null;){if(S=="<")return v.tokenize=T(a+1),v.tokenize(x,v);if(S==">")if(a==1){v.tokenize=A;break}else return v.tokenize=T(a-1),v.tokenize(x,v)}return"meta"}}function u(a,x,v){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=v,(H.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!H.contextGrabbers.hasOwnProperty(v)||!H.contextGrabbers[v].hasOwnProperty(x))return;o(a)}}function h(a,x,v){return a=="openTag"?(v.tagStart=x.column(),C):a=="closeTag"?g:h}function C(a,x,v){return a=="word"?(v.tagName=x.current(),y="tag",b):H.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,x,v)):(y="error",C)}function g(a,x,v){if(a=="word"){var S=x.current();return v.context&&v.context.tagName!=S&&H.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==S||H.matchClosing===!1?(y="tag",p):(y="tag error",k)}else return H.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,x,v)):(y="error",k)}function p(a,x,v){return a!="endTag"?(y="error",p):(o(v),h)}function k(a,x,v){return y="error",p(a,x,v)}function b(a,x,v){if(a=="word")return y="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var S=v.tagName,I=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(S)?l(v,S):(l(v,S),v.context=new u(v,S,I==v.indented)),h}return y="error",b}function f(a,x,v){return a=="equals"?m:(H.allowMissing||(y="error"),b(a,x,v))}function m(a,x,v){return a=="string"?d:a=="word"&&H.allowUnquoted?(y="string",b):(y="error",b(a,x,v))}function d(a,x,v){return a=="string"?d:b(a,x,v)}return{startState:function(a){var x={tokenize:A,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;O=null;var v=x.tokenize(a,x);return(v||O)&&v!="comment"&&(y=null,x.state=x.state(O||v,a,x),y&&(v=y=="error"?v+" error":y)),v},indent:function(a,x,v){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(S&&S.noIndent)return re.Pass;if(a.tokenize!=R&&a.tokenize!=A)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return H.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var I=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(I&&I[1])for(;S;)if(S.tagName==I[2]){S=S.prev;break}else if(H.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(I)for(;S;){var G=H.contextGrabbers[S.tagName];if(G&&G.hasOwnProperty(I[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(a){a.state==m&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],v=a.context;v;v=v.prev)v.tagName&&x.push(v.tagName);return x.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(wt,pt,se){"use strict";var re=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 D(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(Z)}var Y=/^(?:[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 N(R){return typeof R=="string"&&Y.test(R)}for(var P=N,H=[],W=0;W<256;++W)H.push((W+256).toString(16).substr(1));function M(R){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(H[R[L+0]]+H[R[L+1]]+H[R[L+2]]+H[R[L+3]]+"-"+H[R[L+4]]+H[R[L+5]]+"-"+H[R[L+6]]+H[R[L+7]]+"-"+H[R[L+8]]+H[R[L+9]]+"-"+H[R[L+10]]+H[R[L+11]]+H[R[L+12]]+H[R[L+13]]+H[R[L+14]]+H[R[L+15]]).toLowerCase();if(!P(w))throw TypeError("Stringified UUID is invalid");return w}var O=M;function y(R,L,w){R=R||{};var T=R.random||(R.rng||D)();if(T[6]=T[6]&15|64,T[8]=T[8]&63|128,L){w=w||0;for(var u=0;u<16;++u)L[w+u]=T[u];return L}return O(T)}var A=pt.a=y},"7ahc":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return C});var re=se("k1fw"),Z=se("0Owb"),D=se("+L6B"),Y=se("2/Rp"),N=se("y8nQ"),P=se("Vl3Y"),H=se("tJVT"),W=se("OaEy"),M=se("2fM7"),O=se("q1tI"),y=se.n(O),A=se("VrN/"),R=se.n(A),L=se("p77/"),w=se.n(L),T=se("c5Ni"),u=se.n(T),o=M.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};pt.b=function(g){var p=g.callback,k=g.onCancel,b=Object(O.useState)("python"),f=Object(H.a)(b,2),m=f[0],d=f[1];function a(v){d(h[v][1])}function x(v){p(v)}return y.a.createElement(P.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(M.a,{onChange:a},Object.keys(h).map(function(v){return y.a.createElement(o,{key:v,value:v},h[v][0])}))),y.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(C,{mode:m})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Y.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function C(g){var p=g.value,k=g.onChange,b=g.mode,f=g.options,m=f===void 0?{}:f,d=Object(O.useRef)(),a=Object(O.useState)(),x=Object(H.a)(a,2),v=x[0],S=x[1];return Object(O.useEffect)(function(){if(v){function I(G){var V=G.getValue();k&&k(V)}return v.on("change",I),function(){v.off("change",I)}}},[v,k]),Object(O.useEffect)(function(){v&&v.setOption("mode",b)},[v,b]),Object(O.useEffect)(function(){v&&((p!==v.getValue()||p==="")&&setTimeout(function(){v.setValue(p||" ")},300))},[v,p]),Object(O.useEffect)(function(){if(d.current&&!v){var I=R.a.fromTextArea(d.current,Object(re.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},m));S(I)}},[d.current,v]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:d}))}},"7ixt":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return D});var re={adjustX:1,adjustY:1},Z=[0,0],D={left:{points:["cr","cl"],overflow:re,offset:[-4,0],targetOffset:Z},right:{points:["cl","cr"],overflow:re,offset:[4,0],targetOffset:Z},top:{points:["bc","tc"],overflow:re,offset:[0,-4],targetOffset:Z},bottom:{points:["tc","bc"],overflow:re,offset:[0,4],targetOffset:Z},topLeft:{points:["bl","tl"],overflow:re,offset:[0,-4],targetOffset:Z},leftTop:{points:["tr","tl"],overflow:re,offset:[-4,0],targetOffset:Z},topRight:{points:["br","tr"],overflow:re,offset:[0,-4],targetOffset:Z},rightTop:{points:["tl","tr"],overflow:re,offset:[4,0],targetOffset:Z},bottomRight:{points:["tr","br"],overflow:re,offset:[0,4],targetOffset:Z},rightBottom:{points:["bl","br"],overflow:re,offset:[4,0],targetOffset:Z},bottomLeft:{points:["tl","bl"],overflow:re,offset:[0,4],targetOffset:Z},leftBottom:{points:["br","bl"],overflow:re,offset:[-4,0],targetOffset:Z}},Y=D},"8EBN":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";re.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<re.modeInfo.length;Z++){var D=re.modeInfo[Z];D.mimes&&(D.mime=D.mimes[0])}re.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var N=0;N<re.modeInfo.length;N++){var P=re.modeInfo[N];if(P.mime==Y)return P;if(P.mimes){for(var H=0;H<P.mimes.length;H++)if(P.mimes[H]==Y)return P}}if(/\+xml$/.test(Y))return re.findModeByMIME("application/xml");if(/\+json$/.test(Y))return re.findModeByMIME("application/json")},re.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var N=0;N<re.modeInfo.length;N++){var P=re.modeInfo[N];if(P.ext){for(var H=0;H<P.ext.length;H++)if(P.ext[H]==Y)return P}}},re.findModeByFileName=function(Y){for(var N=0;N<re.modeInfo.length;N++){var P=re.modeInfo[N];if(P.file&&P.file.test(Y))return P}var H=Y.lastIndexOf("."),W=H>-1&&Y.substring(H+1,Y.length);if(W)return re.findModeByExtension(W)},re.findModeByName=function(Y){Y=Y.toLowerCase();for(var N=0;N<re.modeInfo.length;N++){var P=re.modeInfo[N];if(P.name.toLowerCase()==Y)return P;if(P.alias){for(var H=0;H<P.alias.length;H++)if(P.alias[H].toLowerCase()==Y)return P}}}})},"8hTe":function(wt,pt,se){wt.exports={button:"button___1wy9m"}},"9Bee":function(wt,pt,se){"use strict";var re=se("DYRE"),Z=se("zeV3"),D=se("+L6B"),Y=se("2/Rp"),N=se("k1fw"),P=se("9og8"),H=se("tJVT"),W=se("WmNS"),M=se.n(W),O=se("q1tI"),y=se.n(O),A=se("vg9a"),R=se("DlQD"),L=se.n(R),w=se("rUJ1");function T(j,s){var c=j.match(/^(\s+)(?:```)/);if(c===null)return s;var _=c[1];return s.split(`
|
|
`).map(function($){var F=$.match(/^\s+/);if(F===null)return $;var he=Object(H.a)(F,1),Re=he[0];return Re.length>=_.length?$.slice(_.length):$}).join(`
|
|
`)}var u=[],o=["<ul>"],l=new L.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){u.length=0,o=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(j,s,c,_){if(s>=j.length||j[s].level<=c)return s;var $=j[s];_.push("<li><a href='#"+$.anchor+"'>"+$.text+"</a>"),s++;var F=[];return s=p(j,s,$.level,F),F.length>0&&(_.push("<ul>"),F.forEach(function(he){_.push(he)}),_.push("</ul>")),_.push("</li>"),s=p(j,s,c,_),s}function k(){return p(u,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(s){var c=h.exec(s);if(c)return{type:"heading",raw:c[0],depth:c[1].length,text:c[2]}},fences:function(s){var c=this.rules.block.fences.exec(s);if(c){var _=c[0],$=T(_,c[3]||""),F=c[2]?c[2].trim():c[2];if(["latex","katex","math"].indexOf(F)>=0){var he=d(),Re=$;$=he,a[he]={type:"block",expression:Re}}return{type:"code",raw:_,lang:F,text:$}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,m=0,d=function(){return"__special_katext_id_".concat(m++,"__")},a={};function x(){return a}function v(){m=0,a={}}function S(j){return j=j.replace(f,function(s,c){var _=d();return a[_]={type:"inline",expression:c},_}),j}var I=l.listitem;l.listitem=function(j){return I(S(j))};var G=l.paragraph;l.paragraph=function(j){return G(S(j))};var V=l.tablecell;l.tablecell=function(j,s){return V(S(j),s)},l.code=function(j,s,c){var _=(s||"").match(/\S*/)[0];return _?["latex","katex","math"].indexOf(_)>=0?"<p class='editormd-tex'>".concat(j,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(c?j:Object(w.escape)(j,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(c?j:Object(w.escape)(j,!0))+"</code></pre>"},l.heading=function(j,s,c){var _=this.options.headerPrefix+c.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:_,level:s,text:j}),"<h"+s+' id="'+_+'">'+j+"</h"+s+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:b,renderer:l});var Q=L.a,z=se("SJMd"),U=se("ulZh"),q=se.n(U),ae=se("m3rI"),ce=se("Oy/b"),ve=se("p5ED"),Oe=se("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var xe=function(j,s){return(xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,_){c.__proto__=_}||function(c,_){for(var $ in _)Object.prototype.hasOwnProperty.call(_,$)&&(c[$]=_[$])})(j,s)};function Te(j,s){function c(){this.constructor=j}xe(j,s),j.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function Ce(j,s,c,_){return new(c||(c=Promise))(function($,F){function he(ht){try{Ve(_.next(ht))}catch(Ie){F(Ie)}}function Re(ht){try{Ve(_.throw(ht))}catch(Ie){F(Ie)}}function Ve(ht){var Ie;ht.done?$(ht.value):(Ie=ht.value,Ie instanceof c?Ie:new c(function(vt){vt(Ie)})).then(he,Re)}Ve((_=_.apply(j,s||[])).next())})}function Se(j,s){var c,_,$,F,he={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return F={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Re(Ve){return function(ht){return function(Ie){if(c)throw new TypeError("Generator is already executing.");for(;he;)try{if(c=1,_&&($=2&Ie[0]?_.return:Ie[0]?_.throw||(($=_.return)&&$.call(_),0):_.next)&&!($=$.call(_,Ie[1])).done)return $;switch(_=0,$&&(Ie=[2&Ie[0],$.value]),Ie[0]){case 0:case 1:$=Ie;break;case 4:return he.label++,{value:Ie[1],done:!1};case 5:he.label++,_=Ie[1],Ie=[0];continue;case 7:Ie=he.ops.pop(),he.trys.pop();continue;default:if(!($=he.trys,($=$.length>0&&$[$.length-1])||Ie[0]!==6&&Ie[0]!==2)){he=0;continue}if(Ie[0]===3&&(!$||Ie[1]>$[0]&&Ie[1]<$[3])){he.label=Ie[1];break}if(Ie[0]===6&&he.label<$[1]){he.label=$[1],$=Ie;break}if($&&he.label<$[2]){he.label=$[2],he.ops.push(Ie);break}$[2]&&he.ops.pop(),he.trys.pop();continue}Ie=s.call(j,he)}catch(vt){Ie=[6,vt],_=0}finally{c=$=0}if(5&Ie[0])throw Ie[1];return{value:Ie[0]?Ie[1]:void 0,done:!0}}([Ve,ht])}}}function pe(){for(var j=0,s=0,c=arguments.length;s<c;s++)j+=arguments[s].length;var _=Array(j),$=0;for(s=0;s<c;s++)for(var F=arguments[s],he=0,Re=F.length;he<Re;he++,$++)_[$]=F[he];return _}var oe=function(){function j(){}return j.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},j.setAttributes=function(s,c){for(var _=0,$=c;_<$.length;_++){var F=$[_],he=F[0],Re=F[1];s.setAttribute(he,Re)}},j.createRect=function(s,c,_){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",s.toString()),$.setAttribute("height",c.toString()),_&&j.setAttributes($,_),$},j.createLine=function(s,c,_,$,F){var he=document.createElementNS("http://www.w3.org/2000/svg","line");return he.setAttribute("x1",s.toString()),he.setAttribute("y1",c.toString()),he.setAttribute("x2",_.toString()),he.setAttribute("y2",$.toString()),F&&j.setAttributes(he,F),he},j.createPolygon=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","polygon");return _.setAttribute("points",s),c&&j.setAttributes(_,c),_},j.createCircle=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","circle");return _.setAttribute("cx",(s/2).toString()),_.setAttribute("cy",(s/2).toString()),_.setAttribute("r",s.toString()),c&&j.setAttributes(_,c),_},j.createEllipse=function(s,c,_){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(s/2).toString()),$.setAttribute("cy",(c/2).toString()),$.setAttribute("rx",(s/2).toString()),$.setAttribute("ry",(c/2).toString()),_&&j.setAttributes($,_),$},j.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&j.setAttributes(c,s),c},j.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},j.createMarker=function(s,c,_,$,F,he,Re){var Ve=document.createElementNS("http://www.w3.org/2000/svg","marker");return j.setAttributes(Ve,[["id",s],["orient",c],["markerWidth",_.toString()],["markerHeight",$.toString()],["refX",F.toString()],["refY",he.toString()]]),Ve.appendChild(Re),Ve},j.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&j.setAttributes(c,s),c},j.createTSpan=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","tspan");return _.textContent=s,c&&j.setAttributes(_,c),_},j.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&j.setAttributes(c,s),c},j.createPoint=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return _.x=s,_.y=c,_},j.createPath=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","path");return _.setAttribute("d",s),c&&j.setAttributes(_,c),_},j}(),De=function(){function j(){}return j.addKey=function(s){j.key=s},Object.defineProperty(j,"isLicensed",{get:function(){return!!j.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(j.key)},enumerable:!1,configurable:!0}),j}(),Ye=function(){function j(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return j.prototype.rasterize=function(s,c,_){var $=this;return new Promise(function(F){var he=_!==void 0?_:document.createElement("canvas");s===null&&($.markersOnly=!0,$.naturalSize=!1);var Re=document.createElementNS("http://www.w3.org/2000/svg","svg");Re.setAttribute("xmlns","http://www.w3.org/2000/svg"),Re.setAttribute("width",c.width.baseVal.valueAsString),Re.setAttribute("height",c.height.baseVal.valueAsString),Re.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),Re.innerHTML=c.innerHTML,$.naturalSize===!0?(Re.width.baseVal.value=s.naturalWidth,Re.height.baseVal.value=s.naturalHeight):$.width!==void 0&&$.height!==void 0&&(Re.width.baseVal.value=$.width,Re.height.baseVal.value=$.height),he.width=Re.width.baseVal.value,he.height=Re.height.baseVal.value;var Ve=Re.outerHTML,ht=he.getContext("2d");$.markersOnly!==!0&&ht.drawImage(s,0,0,he.width,he.height);var Ie=window.URL,vt=new Image(he.width,he.height);vt.setAttribute("crossOrigin","anonymous");var Nt=new Blob([Ve],{type:"image/svg+xml"}),Kt=Ie.createObjectURL(Nt);vt.onload=function(){ht.drawImage(vt,0,0),Ie.revokeObjectURL(Kt);var _r=he.toDataURL($.imageType,$.imageQuality);F(_r)},vt.src=Kt})},j}(),Ge=function(){},tt=function(){function j(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(j.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),j.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},j.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)},j.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 qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ae("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ae("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},j.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},j}(),qe=function(j,s){this.selector=j,this.style=s},Ae=function(j,s){this.localName=j,this.style=s},Ne=function(){function j(s,c,_,$,F){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=c,this.markerItems=_,this.uiStyleSettings=$,this.styles=F,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return j.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 _=document.createElement("div");_.className=this.toolbarBlockStyleClass.name,_.style.whiteSpace="nowrap",this.uiContainer.appendChild(_),this.addActionButton(_,'<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(_,'<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(_,'<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(_,'<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(_,'<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(_,'<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(_,'<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(_,'<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(F){var he=document.createElement("div");he.className=""+c.toolbarButtonStyleClass.name,he.setAttribute("data-type-name",F.typeName),he.innerHTML=F.icon,he.addEventListener("click",function(){c.markerToolbarButtonClicked(he,F)}),c.buttons.push(he),c.markerButtons.push(he)}),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 $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",$.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild($),this.addActionButton($,'<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($,'<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()},j.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},j.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},j.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},j.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]))}},j.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")},j.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)})},j.prototype.addActionButton=function(s,c,_){var $=this,F=document.createElement("div");switch(F.className=""+this.toolbarButtonStyleClass.name,F.innerHTML=c,F.setAttribute("data-action",_),F.addEventListener("click",function(){$.actionToolbarButtonClicked(F,_)}),_){case"select":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":F.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":F.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":F.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(F),this.buttons.push(F)},j.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ae("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 Ae("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ae("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ae("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 Ae("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ae("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 Ae("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new qe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},j.prototype.markerToolbarButtonClicked=function(s,c){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(_){return _("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},j.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(_){return _("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},j.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)},j.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(_){return _.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},j.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(_){return/delete|notes/.test(_.getAttribute("data-action"))}).forEach(function(_){c.currentMarker===void 0?(_.style.fillOpacity="0.4",_.style.pointerEvents="none"):(_.style.fillOpacity="1",_.style.pointerEvents="all")})},j}(),We=function(){function j(s,c,_,$){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=_,this.styles=$,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return j.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ae("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ae("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new qe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new qe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},j.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)},j.prototype.setPanelButtons=function(s){var c,_,$=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+" "+((_=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&_!==void 0?_:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var he;F.uiStyleSettings=$.uiStyleSettings;var Re=document.createElement("div");Re.className=$.toolboxButtonStyleClass.name+" "+((he=$.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&he!==void 0?he:$.toolboxButtonStyleColorsClass.name),Re.innerHTML=F.icon,Re.title=F.title,Re.addEventListener("click",function(){$.panelButtonClick(F)}),$.panelButtons.push(Re),$.buttonRow.appendChild(Re)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},j.prototype.panelButtonClick=function(s){var c=this,_=-1;if(s!==this.activePanel){_=this.panels.indexOf(s),this.panelRow.innerHTML="";var $=s.getUi();$.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild($),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(F,he){var Re,Ve;F.className=c.toolboxButtonStyleClass.name+" "+(he===_?""+((Re=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Re!==void 0?Re:c.toolboxActiveButtonStyleColorsClass.name):""+((Ve=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ve!==void 0?Ve:c.toolboxButtonStyleColorsClass.name))})},j}(),ze=function(j,s){this.title=j,this.icon=s},je=function(j){function s(c,_,$,F){var he=j.call(this,c,F||'<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 he.colors=[],he.addTransparent=!1,he.colorBoxes=[],he.colors=_,he.currentColor=$,he.setCurrentColor=he.setCurrentColor.bind(he),he.getColorBox=he.getColorBox.bind(he),he}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");return _.style.overflow="hidden",_.style.whiteSpace="nowrap",this.colors.forEach(function($){var F=c.getColorBox($);_.appendChild(F),c.colorBoxes.push(F)}),_},s.prototype.getColorBox=function(c){var _=this,$=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-$,he=document.createElement("div");he.style.display="inline-block",he.style.boxSizing="content-box",he.style.width=F-2+"px",he.style.height=F-2+"px",he.style.padding="1px",he.style.marginRight="2px",he.style.marginBottom="2px",he.style.borderWidth="2px",he.style.borderStyle="solid",he.style.borderRadius=(F+2)/2+"px",he.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",he.addEventListener("click",function(){_.setCurrentColor(c,he)});var Re=document.createElement("div");return Re.style.display="inline-block",Re.style.width=F-2+"px",Re.style.height=F-2+"px",Re.style.backgroundColor=c,Re.style.borderRadius=F/2+"px",c==="transparent"&&(Re.style.fill=this.uiStyleSettings.toolboxAccentColor,Re.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>`),he.appendChild(Re),he},s.prototype.setCurrentColor=function(c,_){var $=this;this.currentColor=c,this.colorBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(ze),_e=function(){function j(s,c,_){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=_,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(j.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),j.prototype.ownsTarget=function(s){return!1},Object.defineProperty(j.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),j.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},j.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},j.prototype.pointerDown=function(s,c){},j.prototype.dblClick=function(s,c){},j.prototype.manipulate=function(s){},j.prototype.pointerUp=function(s){this.stateChanged()},j.prototype.dispose=function(){},j.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},j.prototype.getState=function(){return{typeName:j.typeName,state:this.state,notes:this.notes}},j.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},j.prototype.scale=function(s,c){},j.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},j.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},j.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)}},j.typeName="MarkerBase",j}(),Pe=function(){function j(){this.findGripByVisual=this.findGripByVisual.bind(this)}return j.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},j}(),Ke=function(){function j(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return j.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},j}(),$e=function(){function j(){}return j.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},j.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},j}(),Qe=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(oe.createTransform()),F.setupControlBox(),F}return Te(s,j),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 _=oe.createTransform();this._visual.transform.baseVal.appendItem(_)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!j.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),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 $=this.unrotatePoint(c);if(this.manipulationStartX=$.x,this.manipulationStartY=$.y,this.offsetX=$.x-this.left,this.offsetY=$.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(_),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(_)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var he=this.container.transform.baseVal.getItem(0);he.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(he,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var _=this.state;j.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",_==="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 _=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(_.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(_.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(_):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var _=this.manipulationStartLeft,$=this.manipulationStartWidth,F=this.manipulationStartTop,he=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:_=this.manipulationStartLeft+c.x-this.manipulationStartX,$=this.manipulationStartWidth+this.manipulationStartLeft-_;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:$=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+c.y-this.manipulationStartY,he=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:he=this.manipulationStartHeight+c.y-this.manipulationStartY}$>=0?(this.left=_,this.width=$):(this.left=_+$,this.width=-$),he>=0?(this.top=F,this.height=he):(this.top=F+he,this.height=-he),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 _=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*_,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 _=this.container.getCTM(),$=oe.createPoint(c.x,c.y);return{x:($=$.matrixTransform(_)).x,y:$.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var _=this.container.getCTM();_=_.inverse();var $=oe.createPoint(c.x,c.y);return{x:($=$.matrixTransform(_)).x,y:$.y}},s.prototype.select=function(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var c=oe.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=oe.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=oe.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Pe,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 Ke;return c.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,_=-c/2,$=_,F=(this.width+this.CB_DISTANCE)/2-c/2,he=(this.height+this.CB_DISTANCE)/2-c/2,Re=this.height+this.CB_DISTANCE-c/2,Ve=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,_,$),this.positionGrip(this.controlGrips.topCenter.visual,F,$),this.positionGrip(this.controlGrips.topRight.visual,Ve,$),this.positionGrip(this.controlGrips.centerLeft.visual,_,he),this.positionGrip(this.controlGrips.centerRight.visual,Ve,he),this.positionGrip(this.controlGrips.bottomLeft.visual,_,Re),this.positionGrip(this.controlGrips.bottomCenter.visual,F,Re),this.positionGrip(this.controlGrips.bottomRight.visual,Ve,Re),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,$-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,_,$){var F=c.transform.baseVal.getItem(0);F.setTranslate(_,$),c.transform.baseVal.replaceItem(F,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:$e.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:$e.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},j.prototype.getState.call(this))},s.prototype.restoreState=function(c){j.prototype.restoreState.call(this,c);var _=c;this.left=_.left,this.top=_.top,this.width=_.width,this.height=_.height,this.rotationAngle=_.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix($e.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,_.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix($e.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,_.containerTransformMatrix))},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_);var $=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:$.x*c,y:$.y*_});this.left=F.x,this.top=F.y,this.width=this.width*c,this.height=this.height*_,this.adjustControlBox()},s}(_e),Xe=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=oe.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){j.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){j.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){j.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){j.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&oe.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},j.prototype.getState.call(this))},s.prototype.restoreState=function(c){var _=c;this.fillColor=_.fillColor,this.strokeColor=_.strokeColor,this.strokeWidth=_.strokeWidth,this.strokeDasharray=_.strokeDasharray,this.opacity=_.opacity,this.createVisual(),j.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),this.setSize()},s.title="Rectangle marker",s}(Qe),dt=function(j){function s(c,_,$,F){var he=j.call(this,c,F||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return he.widths=[],he.widthBoxes=[],he.widths=_,he.currentWidth=$,he.setCurrentWidth=he.setCurrentWidth.bind(he),he}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");return _.style.display="flex",_.style.overflow="hidden",_.style.flexGrow="2",this.widths.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=$===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentWidth($,F)}),_.appendChild(F);var he=document.createElement("div");he.innerText=$.toString(),he.style.marginRight="5px",F.appendChild(he);var Re=document.createElement("div");Re.style.minHeight="20px",Re.style.flexGrow="2",Re.style.display="flex",Re.style.alignItems="center";var Ve=document.createElement("hr");Ve.style.minWidth="20px",Ve.style.border="0px",Ve.style.borderTop=$+"px solid "+c.uiStyleSettings.toolboxColor,Ve.style.flexGrow="2",Re.appendChild(Ve),F.appendChild(Re),c.widthBoxes.push(F)}),_},s.prototype.setCurrentWidth=function(c,_){var $=this;this.currentWidth=c,this.widthBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(ze),et=function(j){function s(c,_,$,F){var he=j.call(this,c,F||'<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 he.styles=[],he.styleBoxes=[],he.styles=_,he.currentStyle=$,he.setCurrentStyle=he.setCurrentStyle.bind(he),he}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");return _.style.display="flex",_.style.overflow="hidden",_.style.flexGrow="2",this.styles.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/c.styles.length-5+"%",F.style.borderColor=$===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentStyle($,F)}),_.appendChild(F);var he=document.createElement("div");he.style.minHeight="20px",he.style.flexGrow="2",he.style.overflow="hidden";var Re=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+($!==""?'stroke-dasharray="'+$+'"':"")+` />
|
|
</svg>`;he.innerHTML=Re,F.appendChild(he),c.styleBoxes.push(F)}),_},s.prototype.setCurrentStyle=function(c,_){var $=this;this.currentStyle=c,this.styleBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(ze),it=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new et("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=j.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}(Xe),we=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},lt=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return Te(s,j),s.prototype.ownsTarget=function(c){return!!j.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),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(_)?this.activeGrip=this.grip1:this.grip2.ownsTarget(_)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var _=this.state;j.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",_==="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(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=oe.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 Ke;return c.visual.transform.baseVal.appendItem(oe.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,_,$){var F=c.transform.baseVal.getItem(0);F.setTranslate(_,$),c.transform.baseVal.replaceItem(F,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},j.prototype.getState.call(this))},s.prototype.restoreState=function(c){j.prototype.restoreState.call(this,c);var _=c;this.x1=_.x1,this.y1=_.y1,this.x2=_.x2,this.y2=_.y2},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),this.x1=this.x1*c,this.y1=this.y1*_,this.x2=this.x2*c,this.y2=this.y2*_,this.adjustVisual(),this.adjustControlBox()},s}(_e),nt=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new et("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),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()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){j.prototype.restoreState.call(this,c);var _=c;this.strokeColor=_.strokeColor,this.strokeWidth=_.strokeWidth,this.strokeDasharray=_.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}(lt),Le=function(j){function s(c,_,$,F){var he=j.call(this,c,F||'<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 he.fonts=[],he.fontBoxes=[],he.fonts=_,he.currentFont=$,he.setCurrentFont=he.setCurrentFont.bind(he),he}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");return _.style.overflow="hidden",_.style.flexGrow="2",this.fonts.forEach(function($){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/c.fonts.length-5+"%",F.style.borderColor=$===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentFont($,F)}),_.appendChild(F);var he=document.createElement("div");he.style.display="flex",he.style.minHeight="20px",he.style.flexGrow="2",he.style.fontFamily=$,he.style.overflow="hidden";var Re=document.createElement("div");Re.style.whiteSpace="nowrap",Re.style.overflow="hidden",Re.style.textOverflow="ellipsis",Re.innerHTML="The quick brown fox jumps over the lazy dog",he.appendChild(Re),F.appendChild(he),c.fontBoxes.push(F)}),_},s.prototype.setCurrentFont=function(c,_){var $=this;this.currentFont=c,this.fontBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(ze),Fe=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=$.defaultColor,F.fontFamily=$.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new je("Color",$.defaultColorSet,$.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new Le("Font",$.defaultFontFamilies,$.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return Te(s,j),s.prototype.ownsTarget=function(c){if(j.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var _=!1;return this.textElement.childNodes.forEach(function($){$===c&&(_=!0)}),_},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),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(_){c.textElement.appendChild(oe.createTSpan(_.trim()===""?" ":_.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),_=1;if(c.width>0&&c.height>0){var $=(1*this.width-this.width*this.padding*2/100)/c.width,F=(1*this.height-this.height*this.padding*2/100)/c.height;_=Math.min($,F)}return _},s.prototype.getTextPosition=function(c){var _=this.textElement.getBBox(),$=0,F=0;return _.width>0&&_.height>0&&($=(this.width-_.width*c)/2,F=this.height/2-_.height*c/2),{x:$,y:F}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),_=this.getTextScale(),$=this.getTextPosition(_);$.y-=c.y*_,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+$.x+"px, "+$.y+"px) scale("+_+", "+_+")":(this.textElement.transform.baseVal.getItem(0).setTranslate($.x,$.y),this.textElement.transform.baseVal.getItem(1).setScale(_,_))},s.prototype.manipulate=function(c){j.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){j.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){j.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var _=this.state;_==="creating"&&(this._suppressMarkerCreateEvent=!0),j.prototype.pointerUp.call(this,c),this.setSize(),(_==="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(_){_.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var _=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&_>.9;)_-=.1,c.textEditor.style.fontSize=Math.max(_,.9)+"em"}),this.textEditor.addEventListener("keyup",function(_){_.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(_){if(_.clipboardData){var $=_.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode($)),_.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(),_=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),$=this.textElement.getBBox(),F={x:$.width*c,y:$.height*c};_.x-=F.x/2,_.y-=F.y/2,this.textEditor.style.top=_.y+"px",this.textEditor.style.left=_.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-_.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(){j.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),j.prototype.deselect.call(this)},s.prototype.dblClick=function(c,_){j.prototype.dblClick.call(this,c,_),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&oe.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&&oe.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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var _=c;this.color=_.color,this.fontFamily=_.fontFamily,this.padding=_.padding,this.text=_.text,this.createVisual(),j.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),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}(Qe),ge=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=$.defaultColor,F.lineWidth=$.defaultStrokeWidth,F.pixelRatio=$.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new je("Color",$.defaultColorSet,$.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var c=oe.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,_){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):j.prototype.pointerDown.call(this,c,_)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):j.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){j.prototype.resize.call(this,c),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.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()):j.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(),j.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),j.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),_=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],$=_[0],F=_[1],he=_[2],Re=_[3],Ve=!1,ht=0;ht<this.canvasElement.height;ht++)for(var Ie=0;Ie<this.canvasElement.width;Ie++)c.data[ht*this.canvasElement.width*4+4*Ie+3]>0&&(Ve=!0,ht<F&&(F=ht),Ie<$&&($=Ie),ht>Re&&(Re=ht),Ie>he&&(he=Ie));if(Ve){this.left=$/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(he-$)/this.pixelRatio,this.height=(Re-F)/this.pixelRatio;var vt=document.createElement("canvas");vt.width=he-$,vt.height=Re-F,vt.getContext("2d").putImageData(this.canvasContext.getImageData($,F,he-$,Re-F),0,0),this.drawingImgUrl=vt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),j.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),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}(Qe),de=function(j){function s(c,_,$){var F=j.call(this,c,$||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return F.typeBoxes=[],F.currentType=_,F.setCurrentType=F.setCurrentType.bind(F),F}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");_.style.display="flex",_.style.overflow="hidden",_.style.flexGrow="2";for(var $=function(Re){var Ve="both";switch(Re){case 0:Ve="both";break;case 1:Ve="start";break;case 2:Ve="end";break;case 3:Ve="none"}var ht=document.createElement("div");if(ht.style.display="flex",ht.style.flexGrow="2",ht.style.alignItems="center",ht.style.justifyContent="space-between",ht.style.padding="5px",ht.style.borderWidth="2px",ht.style.borderStyle="solid",ht.style.borderColor=Ve===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",ht.addEventListener("click",function(){c.setCurrentType(Ve,ht)}),_.appendChild(ht),Ve==="both"||Ve==="start"){var Ie=document.createElement("div");Ie.style.display="flex",Ie.style.alignItems="center",Ie.style.minHeight="20px",Ie.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ie.style.marginLeft="5px",ht.appendChild(Ie)}var vt=document.createElement("div");vt.style.display="flex",vt.style.alignItems="center",vt.style.minHeight="20px",vt.style.flexGrow="2";var Nt=document.createElement("hr");if(Nt.style.minWidth="20px",Nt.style.border="0px",Nt.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),Nt.style.flexGrow="2",vt.appendChild(Nt),ht.appendChild(vt),Ve==="both"||Ve==="end"){var Kt=document.createElement("div");Kt.style.display="flex",Kt.style.alignItems="center",Kt.style.minHeight="20px",Kt.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Kt.style.marginRight="5px",ht.appendChild(Kt)}F.typeBoxes.push(ht)},F=this,he=0;he<4;he++)$(he);return _},s.prototype.setCurrentType=function(c,_){var $=this;this.currentType=c,this.typeBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(ze),fe=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new de("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,_){var $=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return c-$/2+","+(_+F/2)+" "+c+","+(_-F/2)+" "+(c+$/2)+","+(_+F/2)},s.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(j.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),_=this.arrow1.transform.baseVal.getItem(0);_.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(_,0);var $=this.arrow2.transform.baseVal.getItem(0);$.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem($,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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){j.prototype.restoreState.call(this,c);var _=c;this.arrowType=_.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}(nt),ee=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.fillColor=$.defaultFillColor,F.strokeWidth=0,F.fillPanel=new je("Color",$.defaultColorSet,$.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return Te(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=j.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}(Xe),te=function(j){function s(c,_,$,F){var he=j.call(this,c,F||'<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 he.opacities=[],he.opacityBoxes=[],he.opacities=_,he.currentOpacity=$,he.setCurrentOpacity=he.setCurrentOpacity.bind(he),he}return Te(s,j),s.prototype.getUi=function(){var c=this,_=document.createElement("div");return _.style.display="flex",_.style.overflow="hidden",_.style.flexGrow="2",_.style.justifyContent="space-between",this.opacities.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=$===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentOpacity($,F)}),_.appendChild(F);var he=document.createElement("div");he.innerText=100*$+"%",F.appendChild(he),c.opacityBoxes.push(F)}),_},s.prototype.setCurrentOpacity=function(c,_){var $=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===_?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(ze),ie=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=$.defaultHighlightColor,F.strokeWidth=0,F.opacity=$.defaultHighlightOpacity,F.fillPanel=new je("Color",$.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new te("Opacity",$.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Te(s,j),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&oe.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=j.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}(ee),ue='<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>',me=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=$.defaultStrokeColor,F.bgColor=$.defaultFillColor,F.fontFamily=$.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new je("Text color",$.defaultColorSet,F.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>'),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new je("Fill color",$.defaultColorSet,F.bgColor,ue),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new Le("Font",$.defaultFontFamilies,$.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new Ke,F.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return Te(s,j),s.prototype.ownsTarget=function(c){return j.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,_){this.state==="new"&&j.prototype.pointerDown.call(this,c,_),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(_)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):j.prototype.pointerDown.call(this,c,_)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,j.prototype.pointerUp.call(this,c);else{var _=this.state==="creating";j.prototype.pointerUp.call(this,c),this.setTipPoints(_),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var _=this.unrotatePoint(c);this.tipPosition={x:_.x-this.manipulationStartLeft,y:_.y-this.manipulationStartTop},this.positionTip()}else j.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",c]]),oe.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 _=Math.min(this.height/2,15),$=this.height/5;c&&(this.tipPosition={x:_+$/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?($=this.width/5,_=Math.min(this.width/2,15),this.tipBase1Position={x:_,y:0},this.tipBase2Position={x:_+$,y:0}):(this.tipBase1Position={x:0,y:_},this.tipBase2Position={x:0,y:_+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?($=this.width/5,_=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-_-$,y:0},this.tipBase2Position={x:this.width-_,y:0}):(this.tipBase1Position={x:this.width,y:_},this.tipBase2Position={x:this.width,y:_+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?F<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?($=this.width/5,_=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-_-$,y:this.height},this.tipBase2Position={x:this.width-_,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-_-$},this.tipBase2Position={x:this.width,y:this.height-_}):F<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?($=this.width/5,_=Math.min(this.width/2,15),this.tipBase1Position={x:_,y:this.height},this.tipBase2Position={x:_+$,y:this.height}):(this.tipBase1Position={x:0,y:this.height-_},this.tipBase2Position={x:0,y:this.height-_-$})},s.prototype.resize=function(c){j.prototype.resize.call(this,c),this.positionTip()},s.prototype.positionTip=function(){oe.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(),j.prototype.select.call(this)},s.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var _=c;this.bgColor=_.bgColor,this.tipPosition=_.tipPosition,j.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*_},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}(Fe),Ee=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.fillColor=$.defaultFillColor,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.setOpacity=F.setOpacity.bind(F),F.createVisual=F.createVisual.bind(F),F.strokePanel=new je("Line color",pe($.defaultColorSet,["transparent"]),$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.fillPanel=new je("Fill color",pe($.defaultColorSet,["transparent"]),F.fillColor,ue),F.fillPanel.onColorChanged=F.setFillColor,F.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new et("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F.opacityPanel=new te("Opacity",$.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=oe.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){j.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){j.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){j.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(c){j.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&oe.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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var _=c;this.fillColor=_.fillColor,this.strokeColor=_.strokeColor,this.strokeWidth=_.strokeWidth,this.strokeDasharray=_.strokeDasharray,this.opacity=_.opacity,this.createVisual(),j.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,_){j.prototype.scale.call(this,c,_),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}(Qe),Me=function(j){function s(c,_,$){return j.call(this,c,_,$)||this}return Te(s,j),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!j.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=oe.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(j.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),_=this.tip1.transform.baseVal.getItem(0);_.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(_,0);var $=this.tip2.transform.baseVal.getItem(0);$.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem($,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=j.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){j.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}(nt),rt=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.strokePanel.colors=$.defaultColorSet,F.fillColor="transparent",F}return Te(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=j.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}(Ee),mt=function(){function j(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),j.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))},j.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},j.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},j.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}},j.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},j}(),ct=function(j){function s(c,_,$){var F=j.call(this,c,_,$)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new et("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,j),s.prototype.ownsTarget=function(c){return!(!j.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=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,_){j.prototype.pointerDown.call(this,c,_),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(_)&&(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()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){j.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,j.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){j.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),j.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),j.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,_){this.curveX=this.curveX*c,this.curveY=this.curveY*_,j.prototype.scale.call(this,c,_)},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},j.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){j.prototype.restoreState.call(this,c);var _=c;this.strokeColor=_.strokeColor,this.strokeWidth=_.strokeWidth,this.strokeDasharray=_.strokeDasharray,this.curveX=_.curveX,this.curveY=_.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}(lt),Ct=function(){function j(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(j.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),j.prototype.preventDefault=function(){this._defaultPrevented=!0},j}(),St=function(j){function s(c,_,$){var F=j.call(this,c,!1)||this;return F.dataUrl=_,F.state=$,F}return Te(s,j),s}(Ct),st=function(j){function s(c,_,$){$===void 0&&($=!1);var F=j.call(this,c,$)||this;return F.marker=_,F}return Te(s,j),s}(Ct),Ft=function(){function j(){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 j.prototype.addEventListener=function(s,c){this[s].push(c)},j.prototype.removeEventListener=function(s,c){var _=this[s].indexOf(c);_>-1&&this[s].splice(_,1)},j}(),Ot=function(){function j(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 we,this._isOpen=!1,this.undoRedoManager=new mt,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 Ft,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=j.instanceCounter++,this.styles=new tt(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(j.prototype,"ALL_MARKER_TYPES",{get:function(){return[it,ge,fe,Fe,rt,Ee,ie,me,Me,ee,nt,ct]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[it,ge,fe,Fe,Ee,ie,me]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"BASIC_MARKER_TYPES",{get:function(){return[it,ge,fe,Fe,ie]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(_){if(typeof _=="string"){var $=c.ALL_MARKER_TYPES.find(function(F){return F.typeName===_});$!==void 0&&c._availableMarkerTypes.push($)}else c._availableMarkerTypes.push(_)})},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),j.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),De.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},j.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&Ge.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ge.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new Ct(s))})},j.prototype.render=function(){return Ce(this,void 0,void 0,function(){var s;return Se(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new Ye).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()]}})})},j.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var _=!1;s||this.eventListeners.beforeclose.forEach(function($){var F=new Ct(c,!0);$(F),F.defaultPrevented&&(_=!0)}),_||(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($){return $(new Ct(c))}),this.detachEvents(),this._isOpen=!1)}},j.prototype.addMarkersToToolbar=function(){for(var s,c=[],_=0;_<arguments.length;_++)c[_]=arguments[_];(s=this._availableMarkerTypes).push.apply(s,c)},j.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(c){s(c.dataUrl,c.state)})},j.prototype.removeRenderEventListener=function(s){},j.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},j.prototype.removeCloseEventListener=function(s){},j.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))},j.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,_=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(c,_)},j.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},j.prototype.resize=function(s,c){this._isResizing=!0;var _=s/this.imageWidth,$=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(_,$),this._isResizing=!1},j.prototype.scaleMarkers=function(s,c){var _,$=this;this._currentMarker&&this._currentMarker instanceof Fe?this._currentMarker.scale(s,c):(_=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(F){F!==$._currentMarker&&F.scale(s,c)}),_!==void 0&&this.setCurrentMarker(_)},j.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"},j.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left,this.top=s.top-c.top},j.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)},j.prototype.addDefs=function(){for(var s,c=[],_=0;_<arguments.length;_++)c[_]=arguments[_];this.defs=oe.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,c)},j.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},j.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)},j.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},j.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},j.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)},j.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},j.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)},j.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()},j.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")},j.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"},j.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},j.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 Ne(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 We(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},j.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},j.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},j.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())},j.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()}},j.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function($){var F=new st(s,s._currentMarker,!0);$(F),F.defaultPrevented&&(c=!0)}),!c){var _=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($){return $(new st(s,_))})}}},j.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(he){var Re=new st(s,void 0,!0);he(Re),Re.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var _=function(he){var Re=$.markers[he];$.setCurrentMarker($.markers[he]),$._currentMarker.dispose(),$.markerImage.removeChild($._currentMarker.container),$.markers.splice($.markers.indexOf($._currentMarker),1),$.eventListeners.markerdelete.forEach(function(Ve){return Ve(new st(s,Re))})},$=this,F=this.markers.length-1;F>=0;F--)_(F);this.addUndoStep()}},Object.defineProperty(j.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),j.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))},j.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)},j.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},j.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),_=this.undoRedoManager.getLastUndoStep();if(!_||_.width===c.width&&_.height===c.height){var $=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),$<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(F){return F(new Ct(s))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(F){return F(new Ct(s))})}},j.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},j.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(_){return _(new Ct(s))}))},j.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},j.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(_){return _(new Ct(s))}))},j.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},j.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},j.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var s,c,_=this;return Se(this,function($){switch($.label){case 0:return[4,this.render()];case 1:return s=$.sent(),c=this.getState(),this.eventListeners.render.forEach(function(F){return F(new St(_,s,c))}),this.close(!0),[2]}})})},j.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(_){return c.markers.push(_.getState())}),c},j.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(_){var $=c._availableMarkerTypes.find(function(he){return he.typeName===_.typeName});if($!==void 0){var F=c.addNewMarker($);F.restoreState(_),c.markers.push(F)}}),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(_){return _(new Ct(c))})},j.prototype.addNewMarker=function(s){var c=oe.createGroup();return this.markerImage.appendChild(c),new s(c,this.overlayContainer,this.settings)},j.prototype.createNewMarker=function(s){var c,_=this;(c=typeof s=="string"?this._availableMarkerTypes.find(function($){return $.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($){return $(new st(_,_._currentMarker))}))},j.prototype.markerCreated=function(s){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(_){return _(new st(c,c._currentMarker))})},j.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},j.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},j.prototype.markerStateChanged=function(s){var c=this;this.eventListeners.markerchange.forEach(function(_){return _(new st(c,s))})},j.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(_){return _(new st(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(_){return _(new st(c,c._currentMarker))}))},j.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(_){return _.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))},j.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(_){return _.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()}},j.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}))},j.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()},j.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},j.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},j.prototype.clientToLocalCoordinates=function(s,c){var _=this.markerImage.getBoundingClientRect();return{x:(s-_.left)/this.zoomLevel,y:(c-_.top)/this.zoomLevel}},j.prototype.onWindowResize=function(){this.positionUI()},j.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()},j.prototype.addLicenseKey=function(s){De.addKey(s)},j.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},j.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},j.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(j.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),j.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 Ct(s))}))},j.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 Ct(s))}))},j.instanceCounter=0,j}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Zt=function(j,s){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,_){c.__proto__=_}||function(c,_){for(var $ in _)Object.prototype.hasOwnProperty.call(_,$)&&(c[$]=_[$])})(j,s)};function Xt(j,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=j}Zt(j,s),j.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function _t(j,s,c,_){return new(c||(c=Promise))(function($,F){function he(ht){try{Ve(_.next(ht))}catch(Ie){F(Ie)}}function Re(ht){try{Ve(_.throw(ht))}catch(Ie){F(Ie)}}function Ve(ht){var Ie;ht.done?$(ht.value):(Ie=ht.value,Ie instanceof c?Ie:new c(function(vt){vt(Ie)})).then(he,Re)}Ve((_=_.apply(j,s||[])).next())})}function Ir(j,s){var c,_,$,F,he={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return F={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Re(Ve){return function(ht){return function(Ie){if(c)throw new TypeError("Generator is already executing.");for(;he;)try{if(c=1,_&&($=2&Ie[0]?_.return:Ie[0]?_.throw||(($=_.return)&&$.call(_),0):_.next)&&!($=$.call(_,Ie[1])).done)return $;switch(_=0,$&&(Ie=[2&Ie[0],$.value]),Ie[0]){case 0:case 1:$=Ie;break;case 4:return he.label++,{value:Ie[1],done:!1};case 5:he.label++,_=Ie[1],Ie=[0];continue;case 7:Ie=he.ops.pop(),he.trys.pop();continue;default:if(!($=he.trys,($=$.length>0&&$[$.length-1])||Ie[0]!==6&&Ie[0]!==2)){he=0;continue}if(Ie[0]===3&&(!$||Ie[1]>$[0]&&Ie[1]<$[3])){he.label=Ie[1];break}if(Ie[0]===6&&he.label<$[1]){he.label=$[1],$=Ie;break}if($&&he.label<$[2]){he.label=$[2],he.ops.push(Ie);break}$[2]&&he.ops.pop(),he.trys.pop();continue}Ie=s.call(j,he)}catch(vt){Ie=[6,vt],_=0}finally{c=$=0}if(5&Ie[0])throw Ie[1];return{value:Ie[0]?Ie[1]:void 0,done:!0}}([Ve,ht])}}}var Kr=function(){function j(){}return j.addKey=function(s){j.key=s},Object.defineProperty(j,"isLicensed",{get:function(){return!!j.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(j.key)},enumerable:!1,configurable:!0}),j}(),bt=function(){function j(){}return j.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},j.setAttributes=function(s,c){for(var _=0,$=c;_<$.length;_++){var F=$[_],he=F[0],Re=F[1];s.setAttribute(he,Re)}},j.createRect=function(s,c,_){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",s.toString()),$.setAttribute("height",c.toString()),_&&j.setAttributes($,_),$},j.createLine=function(s,c,_,$,F){var he=document.createElementNS("http://www.w3.org/2000/svg","line");return he.setAttribute("x1",s.toString()),he.setAttribute("y1",c.toString()),he.setAttribute("x2",_.toString()),he.setAttribute("y2",$.toString()),F&&j.setAttributes(he,F),he},j.createPolygon=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","polygon");return _.setAttribute("points",s),c&&j.setAttributes(_,c),_},j.createCircle=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","circle");return _.setAttribute("cx",(s/2).toString()),_.setAttribute("cy",(s/2).toString()),_.setAttribute("r",s.toString()),c&&j.setAttributes(_,c),_},j.createEllipse=function(s,c,_){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(s/2).toString()),$.setAttribute("cy",(c/2).toString()),$.setAttribute("rx",(s/2).toString()),$.setAttribute("ry",(c/2).toString()),_&&j.setAttributes($,_),$},j.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&j.setAttributes(c,s),c},j.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},j.createMarker=function(s,c,_,$,F,he,Re){var Ve=document.createElementNS("http://www.w3.org/2000/svg","marker");return j.setAttributes(Ve,[["id",s],["orient",c],["markerWidth",_.toString()],["markerHeight",$.toString()],["refX",F.toString()],["refY",he.toString()]]),Ve.appendChild(Re),Ve},j.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&j.setAttributes(c,s),c},j.createTSpan=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","tspan");return _.textContent=s,c&&j.setAttributes(_,c),_},j.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&j.setAttributes(c,s),c},j.createPoint=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return _.x=s,_.y=c,_},j.createPath=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg","path");return _.setAttribute("d",s),c&&j.setAttributes(_,c),_},j.createElement=function(s,c){var _=document.createElementNS("http://www.w3.org/2000/svg",s);return c&&j.setAttributes(_,c),_},j.getHollowRectanglePath=function(s,c,_,$,F,he,Re,Ve){return"M"+s+","+c+"V"+(c+$)+"H"+(s+_)+"V"+c+"H"+F+"V"+he+"H"+(F+Re)+"V"+(he+Ve)+"H"+F+"V"+c+"Z"},j}(),Nr=function(){function j(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(j.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),j.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},j.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)},j.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 hr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new pr("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new pr("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},j.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},j}(),hr=function(j,s){this.selector=j,this.style=s},pr=function(j,s){this.localName=j,this.style=s},Br=function(){function j(){this.blocks=[],this.display=""}return j.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},j.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},j.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(c){return s.appendChild(c.getUI())}),s},j}(),ci=function(){function j(){}return j.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},j}(),qr=function(j){function s(){var c=j!==null&&j.apply(this,arguments)||this;return c.buttons=[],c}return Xt(s,j),s.prototype.addButton=function(c){c.className=this.buttonClassName,c.colorsClassName=this.buttonColorsClassName,c.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(c)},s.prototype.getUI=function(){var c=j.prototype.getUI.call(this);return this.buttons.forEach(function(_){return c.appendChild(_.getUI())}),c},s}(ci),It=function(){function j(s,c){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=c,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(j.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),j.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},j.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,"")))},j.prototype.hide=function(){this._isHidden=!0},j}(),ut=function(j){function s(){var c=j!==null&&j.apply(this,arguments)||this;return c.elements=[],c}return Xt(s,j),s.prototype.addElement=function(c){this.elements.push(c)},s.prototype.getUI=function(){var c=j.prototype.getUI.call(this);return this.elements.forEach(function(_){return c.appendChild(_)}),c},s}(ci),Hr=function(){function j(s,c){this.horizontal=s,this.vertical=c}return Object.defineProperty(j.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),j.prototype.getVerticalLength=function(s){return s/this.ratio},j.prototype.getHorizontalLength=function(s){return s*this.ratio},j}(),ei=function(){function j(){}return j.getIcon=function(s,c){if(s>0&&c>0){var _=new Hr(s,c),$=_.ratio>=1?20:_.getHorizontalLength(20),F=_.ratio<1?20:_.getVerticalLength(20),he=document.createElementNS("http://www.w3.org/2000/svg","svg");he.setAttribute("xmlns","http://www.w3.org/2000/svg"),he.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(he);var Re=bt.createDefs();he.appendChild(Re);var Ve=bt.createElement("clipPath",[["id","text-bg-clip"]]);Re.appendChild(Ve);var ht=bt.createPath(bt.getHollowRectanglePath((24-$)/2,(24-F)/2,$,F,(24-$)/2+2,(24-F)/2+2,$-4,F-4));he.appendChild(ht);var Ie=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ie.appendChild(bt.createTSpan(s+":"+c)),he.appendChild(Ie);var vt=Ie.getBBox();bt.setAttributes(Ie,[["x",((24-vt.width)/2).toString()],["y",((24-vt.height)/2-vt.y).toString()]]);var Nt=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(vt.width))/2,(24-Math.ceil(vt.height))/2,Math.ceil(vt.width),Math.ceil(vt.height)));return Ve.appendChild(Nt),bt.setAttributes(ht,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(he),he.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>'},j}(),mr=function(j){function s(c,_,$){var F=j.call(this,c,_)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=$,F}return Xt(s,j),s.prototype.setupDropdown=function(){var c=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(_){_.className=c.className,_.colorsClassName=c.colorsClassName,c.dropdownBlock.appendChild(_.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(It),kt=function(){function j(s,c){this.GRIP_SIZE=10,this.color=s,this.fillColor=c,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return j.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},j.prototype.setCenter=function(s,c){this.visual.childNodes.forEach(function(_){return bt.setAttributes(_,[["cx",s.toString()],["cy",c.toString()]])})},j}(),Fr=function(){function j(s,c,_,$){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=c,this.margin=_,this.container=$,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(j.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),j.prototype.open=function(){var s=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var c=0;c<this.numberOfGridLines;c++)this.horizontalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(_){return s.gridContainer.appendChild(_)}),this.verticalGridLines.forEach(function(_){return s.gridContainer.appendChild(_)}),this.cropRectElement=bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},j.prototype.setCropRectangle=function(s){this.cropRect=s;var c=Object.assign({},this.cropRect);this.zoomFactor!==1&&(c.width=this.cropRect.width*this.zoomFactor,c.height=this.cropRect.height*this.zoomFactor,c.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-c.width/2,c.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-c.height/2),bt.setAttributes(this.cropRectElement,[["x",c.x.toString()],["y",c.y.toString()],["width",c.width.toString()],["height",c.height.toString()]]);var _=c.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,he){var Re=c.y+_*(he+1);bt.setAttributes(F,[["x1",""+c.x],["y1",""+Re],["x2",""+(c.x+c.width)],["y2",""+Re]])});var $=c.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,he){var Re=c.x+$*(he+1);bt.setAttributes(F,[["x1",""+Re],["y1",""+c.y],["x2",""+Re],["y2",""+(c.y+c.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,c.x,c.y,c.width,c.height)]]),this.topLeftGrip.setCenter(c.x,c.y),this.topRightGrip.setCenter(c.x+c.width,c.y),this.bottomLeftGrip.setCenter(c.x,c.y+c.height),this.bottomRightGrip.setCenter(c.x+c.width,c.y+c.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},j.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)},j.prototype.clientToLocalCoordinates=function(s,c){var _=this.container.getBoundingClientRect();return{x:s-_.left+this.margin,y:c-_.top+this.margin}},j.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},j.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var c=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(c)}s.preventDefault()},j.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},j.prototype.move=function(s){var c=s.x-this.previousPoint.x,_=s.y-this.previousPoint.y;this.zoomFactor!==1&&(c=-c/this.zoomFactor,_=-_/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+c),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+_),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},j.prototype.resize=function(s){var c=Object.assign({},this.cropRect),_=s.x-this.previousPoint.x,$=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:c.x+_<this.margin&&(_=this.margin-c.x),c.x+=_,c.width=this.cropRect.x+this.cropRect.width-c.x;break;case this.bottomRightGrip:case this.topRightGrip:c.width+_>this.canvasWidth*this.zoomFactor&&(_=this.canvasWidth*this.zoomFactor-c.width),c.width+=_}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(c.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(_),c.height=this.aspectRatio.getVerticalLength(c.width)):(c.y+=$,c.height=this.cropRect.y+this.cropRect.height-c.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?c.height=this.aspectRatio.getVerticalLength(c.width):c.height+=$}c.width<10&&(c.x=this.cropRect.x,c.width=10),c.height<10&&(c.y=this.cropRect.y,c.height=10),this.previousPoint=s,c.x>=this.margin&&c.y>=this.margin&&c.x-this.margin+c.width<=this.canvasWidth&&c.y-this.margin+c.height<=this.canvasHeight&&(this.cropRect=c,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},j.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,c=this.cropRect.y+this.cropRect.height/2,_=this.aspectRatio.getHorizontalLength(this.cropRect.height),$=this.aspectRatio.getVerticalLength(this.cropRect.width);_/this.canvasWidth<$/this.canvasHeight?this.cropRect.width=_:this.cropRect.height=$,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=s-this.cropRect.width/2,this.cropRect.y=c-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)}},j.prototype.getRescaledRect=function(s,c,_,$,F,he){var Re=_/s,Ve=$/c;return{x:(F.x-he)*Re+he,y:(F.y-he)*Ve+he,width:F.width*Re,height:F.height*Ve}},j.prototype.scaleCanvas=function(s,c){var _=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,c,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=c,this.onCropChange&&this.onCropChange(_),this.setCropRectangle(_)},j}(),Vr=function(){function j(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(j.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),j.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},j.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},j.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},j.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},j.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},j.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},j.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var c="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,_=1;_<=this.width/5+10;_++){var $=_%5==0?this.height/3:this.height/6;c+="h4v"+-$+"h1v"+$}c+="v1H0Z",this.scaleShape=bt.createPath(c);var F=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(F),s.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var he=bt.createTSpan("");return he.innerHTML="°",this.angleLabelElement.appendChild(he),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},j}(),fi=function(){function j(){this.naturalSize=!1,this.imageType="image/png"}return j.prototype.rasterize=function(s,c,_,$,F,he,Re){var Ve=this;return new Promise(function(ht){var Ie=document.createElement("canvas");Ie.width=s.width.baseVal.value-2*$,Ie.height=s.height.baseVal.value-2*$;var vt=1,Nt=1;Ve.naturalSize===!0?(vt=c.naturalWidth/(s.width.baseVal.value-2*$)/he,Nt=c.naturalHeight/(s.height.baseVal.value-2*$)/Re,Ie.width=c.naturalWidth/he,Ie.height=c.naturalHeight/Re):Ve.width!==void 0&&Ve.height!==void 0&&(vt=Ve.width/_.width,Nt=Ve.height/_.height,Ie.width*=vt,Ie.height*=Nt);var Kt=Ie.getContext("2d");Kt.translate(Ie.width/2,Ie.height/2),Kt.rotate(F*Math.PI/180),Kt.scale(he,Re),Kt.translate(-Ie.width/2,-Ie.height/2),Kt.drawImage(c,0,0,Ie.width,Ie.height);var _r=document.createElement("canvas");_r.width=_.width*vt,_r.height=_.height*Nt,_r.getContext("2d").putImageData(Kt.getImageData((_.x-$)*vt,(_.y-$)*Nt,_.width*vt,_.height*Nt),0,0),ht(_r.toDataURL(Ve.imageType,Ve.imageQuality))})},j}(),Ue=function(){function j(s){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=j.instanceCounter++,this.styles=new Nr(this.instanceNo),this.target=s,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(j.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),j.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},j.prototype.show=function(){this.showUI(),this.open()},j.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(c){return c()}),this._isOpen=!1)},j.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},j.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},j.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},j.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},j.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},j.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,_=c+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(c,_)}},j.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},j.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",bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},j.prototype.resize=function(s,c){this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),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()},j.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var c=s.toDataURL();bt.setAttributes(this.editingTarget,[["href",c]]),this.setEditingTargetSize()},j.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left-this.CANVAS_MARGIN,this.top=s.top-c.top-this.CANVAS_MARGIN},j.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=bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=bt.createGroup(),this.editingTargetRotationScaleContainer=bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var c=bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(c),this.editingTargetContainer=bt.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)},j.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},j.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Fr(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()},j.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,c=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=s+"px "+c+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-c+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},j.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)},j.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},j.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},j.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"},j.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},j.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,c=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=c+"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},j.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},j.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Br,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 c=new qr;c.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(c);var _=[];this.aspectRatios.forEach(function(Nt){var Kt=new It(ei.getIcon(Nt.horizontal,Nt.vertical),Nt.horizontal===0&&Nt.vertical===0?"FREE":Nt.horizontal+":"+Nt.vertical);Kt.onClick=function(){return s.ratioButtonClicked(Nt)},_.push(Kt)}),this.aspectRatioButton=new mr(ei.getIcon(0,0),"Aspect ratio",_),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,c.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var $=new It('<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");$.isActive=this.isGridVisible,$.onClick=function(){s.isGridVisible=!s.isGridVisible,$.isActive=s.isGridVisible},c.addButton($);var F=new It('<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(F.isActive=this.zoomToCropEnabled,F.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,F.isActive=s.zoomToCropEnabled},c.addButton(F),!Kr.isLicensed){var he=new ut;this.topToolbar.addElementBlock(he);var Re=document.createElement("div");Re.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ve=document.createElement("a");Ve.style.color="currentColor",Ve.href="https://markerjs.com/products/cropro",Ve.target="_blank",Ve.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>',Re.appendChild(Ve),he.addElement(Re)}var ht=new qr;ht.minWidth=3*this.toolbarHeight+"px",ht.contentAlign="end",this.topToolbar.addButtonBlock(ht);var Ie=new It('<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");Ie.onClick=this.startRenderAndClose,ht.addButton(Ie),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ie.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var vt=new It('<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");vt.onClick=this.close,ht.addButton(vt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(vt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},j.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Br,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 c=new qr;c.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(c);var _=new It('<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");_.onClick=this.rotateLeftButtonClicked,c.addButton(_);var $=new It('<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");$.onClick=this.rotateRightButtonClicked,c.addButton($);var F=new ut;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new Vr("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(ht){s.rotateBy(ht),s.straightener.angle=s.rotationAngle},F.addElement(this.straightener.getUI());var he=new qr;he.minWidth=2*this.toolbarHeight+"px",he.contentAlign="end",this.bottomToolbar.addButtonBlock(he);var Re=new It('<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");Re.onClick=this.flipHorizontallyButtonClicked,he.addButton(Re);var Ve=new It('<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");Ve.onClick=this.flipVerticallyButtonClicked,he.addButton(Ve)},j.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},j.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ei.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},j.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Hr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},j.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},j.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},j.prototype.restoreState=function(s){if(s){var c=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(c),this.cropRectChanged(c),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},j.prototype.clientToLocalCoordinates=function(s,c){var _=this.cropImage.getBoundingClientRect();return{x:s-_.left,y:c-_.top}},j.prototype.onWindowResize=function(){this.positionUI()},j.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.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="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},j.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},j.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},j.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},j.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},j.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var c=this.editingTargetRotationContainer.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(c,0);var _=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/_.width,this.imageHeight/_.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},j.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},j.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},j.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},j.prototype.startRenderAndClose=function(){return _t(this,void 0,void 0,function(){var s,c;return Ir(this,function(_){switch(_.label){case 0:return[4,this.render()];case 1:return s=_.sent(),c=this.getState(),this.renderEventListeners.forEach(function($){return $(s,c)}),this.close(!0),[2]}})})},j.prototype.render=function(){return _t(this,void 0,void 0,function(){var s;return Ir(this,function(c){switch(c.label){case 0:return(s=new fi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 c.sent(),[4,s.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,c.sent()]}})})},j.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new pr("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 pr("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new pr("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new pr("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*s)+`px;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new pr("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 pr("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new pr("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 pr("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new pr("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},j.instanceCounter=0,j}(),Et=se("8hTe"),pi=se.n(Et),mi=/<pre[^>]*>/g;function gi(j){var s=document.createElement("div");return s.innerHTML=j,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var vi=pt.a=function(j){var s=j.value,c=s===void 0?"":s,_=j.edit,$=_===void 0?!1:_,F=j.className,he=j.showTextOnly,Re=j.showLines,Ve=j.replaces,ht=j.zoomImg,Ie=j.hasMask,vt=j.style,Nt=vt===void 0?{}:vt,Kt=j.stylesPrev,_r=Kt===void 0?{}:Kt,gr=String(c),vr=Object(O.useRef)(),Xr=Object(O.useRef)(),_i=Object(O.useState)(""),nr=Object(H.a)(_i,2),Ur=nr[0],oi=nr[1],si=Object(O.useState)("office"),Or=Object(H.a)(si,2),Oi=Or[0],yi=Or[1],zi=function(){var Bt=new Ue(Xr.current);Bt.displayMode="popup",Bt.addRenderEventListener(function(){var dr=Object(P.a)(M.a.mark(function Dt(qt){var Wt;return M.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return vr.current.style.display="none",ar.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt}});case 3:Wt=ar.sent,Wt!=null&&Wt.id&&Ve(Xr.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 5:case"end":return ar.stop()}},Dt)}));return function(Dt){return dr.apply(this,arguments)}}()),Bt.show()},Ki=function(){var Bt=new Ot(Xr.current);Bt.settings.displayMode="popup",Bt.addEventListener("render",function(){var dr=Object(P.a)(M.a.mark(function Dt(qt){var Wt;return M.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:if(vr.current.style.display="none",!Xr.current){ar.next=6;break}return ar.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt.dataUrl}});case 4:Wt=ar.sent,Wt!=null&&Wt.id&&Ve(Xr.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 6:case"end":return ar.stop()}},Dt)}));return function(Dt){return dr.apply(this,arguments)}}()),Bt.show(),window.markerArea=Bt},Yr=Object(O.useMemo)(function(){vr.current&&(vr.current.style.zIndex=-1);try{var Jt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Bt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,dr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;gr=gr.replace(Jt,"("+ae.a.API_SERVER+"/api/attachments/").replace(Bt,'"'+ae.a.API_SERVER+"/api/attachments/").replace(dr,'"'+ae.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(ti){}var Dt=Q(gr),qt=x();if(gr.match(/\[TOC\]/)&&(Dt=Dt.replace("<p>[TOC]</p>",k()),C()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ti,ar){var Er=qt[ar],Vi=Er.type,Ei=Er.expression;return Object(ce.renderToString)(gi(Ei)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),v(),he){var Wt=document.createElement("div");return Wt.innerHTML=Dt,Wt.innerText}return setTimeout(function(){return dn()},500),Dt},[gr]),Gr=Object(O.useRef)();g.WebkitLineClamp=Re,Re&&(Nt=Object(N.a)(Object(N.a)({},Nt),g));function bi(Jt){var Bt=Jt.target;if(Bt.tagName.toUpperCase()==="IMG"){if(ht){var dr=Bt.getAttribute("src");oi(dr),yi("image")}}else if(Bt.tagName.toUpperCase()==="A"){var Dt=Bt.getAttribute("href");if(Dt.indexOf("office")>-1)Jt.preventDefault(),oi(Dt),yi("office");else if(Dt.indexOf("application/pdf")>-1)Jt.preventDefault(),oi(Dt),yi("pdf");else if(Dt.indexOf("text/html")>-1)Jt.preventDefault(),oi(Dt),yi("html");else if(Dt.startsWith("#")){Jt.preventDefault();var qt=document.getElementById(Dt.replace("#",""));qt&&qt.scrollIntoView(!0)}}}var dn=function(){var Bt,dr=(Bt=Gr.current)===null||Bt===void 0?void 0:Bt.querySelectorAll("video");dr==null||dr.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var qt=new q.a;qt.loadSource(Dt.src),qt.attachMedia(Dt)}}})};Object(O.useEffect)(function(){if(Gr.current&&Yr&&(Yr.match(mi)&&window.PR.prettyPrint()),Gr.current)return Gr.current.addEventListener("click",bi),function(){Gr.current.removeEventListener("click",bi),v(),C()}},[Yr,Gr.current,bi]);var xi=function(Bt){if(!$)return;Bt.target.nodeName==="IMG"?(vr.current.style.zIndex=1,vr.current.style.display="flex",vr.current.style.width=Bt.target.clientWidth+"px",vr.current.style.height=Bt.target.clientHeight+"px",vr.current.style.top=Bt.target.offsetTop+"px",vr.current.style.left=Bt.target.offsetLeft+"px",Xr.current.src=Bt.target.getAttribute("src")):vr.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Gr,style:Object(N.a)({},Nt),className:"".concat(F||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:xi,dangerouslySetInnerHTML:{__html:Yr}}),y.a.createElement("div",{ref:vr,className:pi.a.button},y.a.createElement(Z.a,null,y.a.createElement(Y.a,{onClick:function(){return zi()}},"\u88C1\u526A"),y.a.createElement(Y.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ve.a,{close:!0,data:Ur,type:Ur!=null&&Ur.length?Oi:"",style:Object(N.a)({},_r),onClose:function(){return oi("")}}))}},"9VGf":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return D});var re=se("q1tI"),Z=se.n(re);function D(Y,N){var P=Object(re.useRef)();Object(re.useEffect)(function(){P.current=Y}),Object(re.useEffect)(function(){function H(){P.current()}if(N!==null){var W=setInterval(H,N);return function(){return clearInterval(W)}}},[N])}},Bd2K:function(wt,pt,se){(function(re){re(se("VrN/"),se("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(M,O,y){if(y!=re.Init&&y&&M.removeKeyMap("autoCloseTags"),!O)return;var A={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(A["'/'"]=function(R){return P(R)}),(typeof O!="object"||O.whenOpening!==!1)&&(A["'>'"]=function(R){return Y(R)}),M.addKeyMap(A)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Y(M){if(M.getOption("disableInput"))return re.Pass;for(var O=M.listSelections(),y=[],A=M.getOption("autoCloseTags"),R=0;R<O.length;R++){if(!O[R].empty())return re.Pass;var L=O[R].head,w=M.getTokenAt(L),T=re.innerMode(M.getMode(),w.state),u=T.state,o=T.mode.xmlCurrentTag&&T.mode.xmlCurrentTag(u),l=o&&o.name;if(!l)return re.Pass;var h=T.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||h&&Z,g=typeof A=="object"&&A.indentTags||h&&D;w.end>L.ch&&(l=l.slice(0,l.length-w.end+L.ch));var p=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=L.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==L.ch-w.start-1||C&&H(C,p)>-1||W(M,T.mode.xmlCurrentContext&&T.mode.xmlCurrentContext(u)||[],l,L,!0))return re.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&H(k,l)>-1){y[R]={text:"/>",newPos:re.Pos(L.line,L.ch+2)};continue}var b=g&&H(g,p)>-1;y[R]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+l+">",newPos:b?re.Pos(L.line+1,0):re.Pos(L.line,L.ch+1)}}for(var f=typeof A=="object"&&A.dontIndentOnAutoClose,R=O.length-1;R>=0;R--){var m=y[R];M.replaceRange(m.text,O[R].head,O[R].anchor,"+insert");var d=M.listSelections().slice(0);d[R]={head:m.newPos,anchor:m.newPos},M.setSelections(d),!f&&m.indent&&(M.indentLine(m.newPos.line,null,!0),M.indentLine(m.newPos.line+1,null,!0))}}function N(M,O){for(var y=M.listSelections(),A=[],R=O?"/":"</",L=M.getOption("autoCloseTags"),w=typeof L=="object"&&L.dontIndentOnSlash,T=0;T<y.length;T++){if(!y[T].empty())return re.Pass;var u=y[T].head,o=M.getTokenAt(u),l=re.innerMode(M.getMode(),o.state),h=l.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return re.Pass;var C,g=l.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(g&&l.mode.name=="javascript")C=R+"script";else if(g&&l.mode.name=="css")C=R+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!p||p.length&&W(M,p,p[p.length-1],u))return re.Pass;C=R+p[p.length-1]}M.getLine(u.line).charAt(o.end)!=">"&&(C+=">"),A[T]=C}if(M.replaceSelections(A),y=M.listSelections(),!w)for(var T=0;T<y.length;T++)(T==y.length-1||y[T].head.line<y[T+1].head.line)&&M.indentLine(y[T].head.line)}function P(M){return M.getOption("disableInput")?re.Pass:N(M,!0)}re.commands.closeTag=function(M){return N(M)};function H(M,O){if(M.indexOf)return M.indexOf(O);for(var y=0,A=M.length;y<A;++y)if(M[y]==O)return y;return-1}function W(M,O,y,A,R){if(!re.scanForClosingTag)return!1;var L=Math.min(M.lastLine()+1,A.line+500),w=re.scanForClosingTag(M,A,null,L);if(!w||w.tag!=y)return!1;for(var T=R?1:0,u=O.length-1;u>=0&&O[u]==y;u--)++T;A=w.to;for(var u=1;u<T;u++){var o=re.scanForClosingTag(M,A,null,L);if(!o||o.tag!=y)return!1;A=o.to}return!0}})},BjJ7:function(wt,pt,se){"use strict";se.d(pt,"d",function(){return Z}),se.d(pt,"c",function(){return D}),se.d(pt,"e",function(){return Y}),se.d(pt,"b",function(){return N}),se.d(pt,"a",function(){return H});var re=se("m3rI");function Z(W){var M=!0;if(W.length>0){for(var O=0;O<W.length;O++)if(W[O].compile_success==0||!W[O].compile_success){M=!1;break}}else M=!1;return M}function D(W){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],y=0;y<W.length;y++){var A=W[y],R=M?"".concat(M,"/").concat(A.name):"".concat(A.name);O.push({title:A.name,isLeaf:!(A.type==="tree"),key:R})}return O}function Y(W,M,O){for(var y=0;y<W.length;y++){var A=W[y];if(A.key===M){A.children=O;break}A.children&&Y(A.children,M,O)}return W}function N(W,M,O){var y;return function(){var A=this,R=arguments,L=function(){y=null,O||W.apply(A,R)},w=O&&!y;clearTimeout(y),y=setTimeout(L,M),w&&W.apply(A,R)}}var P=!0,H=re.a.API_SERVER},"C+DQ":function(wt,pt,se){},DlQD:function(wt,pt,se){(function(re,Z){wt.exports=Z()})(this,function(){"use strict";function re(ge,de){for(var fe=0;fe<de.length;fe++){var ee=de[fe];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(ge,ee.key,ee)}}function Z(ge,de,fe){return de&&re(ge.prototype,de),fe&&re(ge,fe),ge}function D(ge,de){if(!ge)return;if(typeof ge=="string")return Y(ge,de);var fe=Object.prototype.toString.call(ge).slice(8,-1);if(fe==="Object"&&ge.constructor&&(fe=ge.constructor.name),fe==="Map"||fe==="Set")return Array.from(ge);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return Y(ge,de)}function Y(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var fe=0,ee=new Array(de);fe<de;fe++)ee[fe]=ge[fe];return ee}function N(ge,de){var fe;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(fe=D(ge))||de&&ge&&typeof ge.length=="number"){fe&&(ge=fe);var ee=0;return function(){return ee>=ge.length?{done:!0}:{done:!1,value:ge[ee++]}}}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 fe=ge[Symbol.iterator](),fe.next.bind(fe)}function P(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var H=P(function(ge){function de(){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 fe(ee){ge.exports.defaults=ee}ge.exports={defaults:de(),getDefaults:de,changeDefaults:fe}}),W=H.defaults,M=H.getDefaults,O=H.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},T=function(de){return w[de]};function u(ge,de){if(de){if(y.test(ge))return ge.replace(A,T)}else if(R.test(ge))return ge.replace(L,T);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ge){return ge.replace(o,function(de,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var h=/(^|[^\[])\^/g;function C(ge,de){ge=ge.source||ge,de=de||"";var fe={replace:function(te,ie){return ie=ie.source||ie,ie=ie.replace(h,"$1"),ge=ge.replace(te,ie),fe},getRegex:function(){return new RegExp(ge,de)}};return fe}var g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(ge,de,fe){if(ge){var ee;try{ee=decodeURIComponent(l(fe)).replace(g,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}de&&!p.test(fe)&&(fe=a(de,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(te){return null}return fe}var b={},f=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){b[" "+ge]||(f.test(ge)?b[" "+ge]=ge+"/":b[" "+ge]=I(ge,"/",!0)),ge=b[" "+ge];var fe=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?fe?de:ge.replace(m,"$1")+de:de.charAt(0)==="/"?fe?de:ge.replace(d,"$1")+de:ge+de}var x={exec:function(){}};function v(ge){for(var de=1,fe,ee;de<arguments.length;de++){fe=arguments[de];for(ee in fe)Object.prototype.hasOwnProperty.call(fe,ee)&&(ge[ee]=fe[ee])}return ge}function S(ge,de){var fe=ge.replace(/\|/g,function(ie,ue,me){for(var Ee=!1,Me=ue;--Me>=0&&me[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),ee=fe.split(/ \|/),te=0;if(ee.length>de)ee.splice(de);else for(;ee.length<de;)ee.push("");for(;te<ee.length;te++)ee[te]=ee[te].trim().replace(/\\\|/g,"|");return ee}function I(ge,de,fe){var ee=ge.length;if(ee===0)return"";for(var te=0;te<ee;){var ie=ge.charAt(ee-te-1);if(ie===de&&!fe)te++;else if(ie!==de&&fe)te++;else break}return ge.substr(0,ee-te)}function G(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var fe=ge.length,ee=0,te=0;te<fe;te++)if(ge[te]==="\\")te++;else if(ge[te]===de[0])ee++;else if(ge[te]===de[1]&&(ee--,ee<0))return te;return-1}function V(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var Q={escape:u,unescape:l,edit:C,cleanUrl:k,resolveUrl:a,noopTest:x,merge:v,splitCells:S,rtrim:I,findClosingBracket:G,checkSanitizeDeprecation:V},z=H.defaults,U=Q.rtrim,q=Q.splitCells,ae=Q.escape,ce=Q.findClosingBracket;function ve(ge,de,fe){var ee=de.href,te=de.title?ae(de.title):null,ie=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:fe,href:ee,title:te,text:ie}:{type:"image",raw:fe,href:ee,title:te,text:ae(ie)}}function Oe(ge,de){var fe=ge.match(/^(\s+)(?:```)/);if(fe===null)return de;var ee=fe[1];return de.split(`
|
|
`).map(function(te){var ie=te.match(/^\s+/);if(ie===null)return te;var ue=ie[0];return ue.length>=ee.length?te.slice(ee.length):te}).join(`
|
|
`)}var xe=function(){function ge(fe){this.options=fe||z}var de=ge.prototype;return de.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
|
|
`}},de.code=function(ee,te){var ie=this.rules.block.code.exec(ee);if(ie){var ue=te[te.length-1];if(ue&&ue.type==="paragraph")return{raw:ie[0],text:ie[0].trimRight()};var me=ie[0].replace(/^ {4}/gm,"");return{type:"code",raw:ie[0],codeBlockStyle:"indented",text:this.options.pedantic?me:U(me,`
|
|
`)}}},de.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var ie=te[0],ue=Oe(ie,te[3]||"");return{type:"code",raw:ie,lang:te[2]?te[2].trim():te[2],text:ue}}},de.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},de.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
`):[],raw:te[0]};if(ie.header.length===ie.align.length){var ue=ie.align.length,me;for(me=0;me<ue;me++)/^ *-+: *$/.test(ie.align[me])?ie.align[me]="right":/^ *:-+: *$/.test(ie.align[me])?ie.align[me]="center":/^ *:-+ *$/.test(ie.align[me])?ie.align[me]="left":ie.align[me]=null;for(ue=ie.cells.length,me=0;me<ue;me++)ie.cells[me]=q(ie.cells[me],ie.header.length);return ie}}},de.hr=function(ee){var te=this.rules.block.hr.exec(ee);if(te)return{type:"hr",raw:te[0]}},de.blockquote=function(ee){var te=this.rules.block.blockquote.exec(ee);if(te){var ie=te[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:te[0],text:ie}}},de.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){for(var ie=te[0],ue=te[2],me=ue.length>1,Ee=ue[ue.length-1]===")",Me={type:"list",raw:ie,ordered:me,start:me?+ue.slice(0,-1):"",loose:!1,items:[]},rt=te[0].match(this.rules.block.item),mt=!1,ct,Ct,St,st,Ft,Ot,Zt,Xt=rt.length,_t=0;_t<Xt;_t++)ct=rt[_t],ie=ct,Ct=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) */,""),~ct.indexOf(`
|
|
`)&&(Ct-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),_t!==Xt-1&&(St=this.rules.block.bullet.exec(rt[_t+1])[0],(me?St.length===1||!Ee&&St[St.length-1]===")":St.length>1||this.options.smartLists&&St!==ue)&&(st=rt.slice(_t+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-st.length),_t=Xt-1)),Ft=mt||/\n\n(?!\s*$)/.test(ct),_t!==Xt-1&&(mt=ct.charAt(ct.length-1)===`
|
|
`,Ft||(Ft=mt)),Ft&&(Me.loose=!0),Ot=/^\[[ xX]\] /.test(ct),Zt=void 0,Ot&&(Zt=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:ie,task:Ot,checked:Zt,loose:Ft,text:ct});return Me}},de.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):ae(te[0]):te[0]}},de.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ie=te[1].toLowerCase().replace(/\s+/g," ");return{tag:ie,raw:te[0],href:te[2],title:te[3]}}},de.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ie.header.length===ie.align.length){ie.raw=te[0];var ue=ie.align.length,me;for(me=0;me<ue;me++)/^ *-+: *$/.test(ie.align[me])?ie.align[me]="right":/^ *:-+: *$/.test(ie.align[me])?ie.align[me]="center":/^ *:-+ *$/.test(ie.align[me])?ie.align[me]="left":ie.align[me]=null;for(ue=ie.cells.length,me=0;me<ue;me++)ie.cells[me]=q(ie.cells[me].replace(/^ *\| *| *\| *$/g,""),ie.header.length);return ie}}},de.lheading=function(ee){var te=this.rules.block.lheading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[2].charAt(0)==="="?1:2,text:te[1]}},de.paragraph=function(ee){var te=this.rules.block.paragraph.exec(ee);if(te)return{type:"paragraph",raw:te[0],text:te[1].charAt(te[1].length-1)===`
|
|
`?te[1].slice(0,-1):te[1]}},de.text=function(ee,te){var ie=this.rules.block.text.exec(ee);if(ie){var ue=te[te.length-1];return ue&&ue.type==="text"?{raw:ie[0],text:ie[0]}:{type:"text",raw:ie[0],text:ie[0]}}},de.escape=function(ee){var te=this.rules.inline.escape.exec(ee);if(te)return{type:"escape",raw:te[0],text:ae(te[1])}},de.tag=function(ee,te,ie){var ue=this.rules.inline.tag.exec(ee);if(ue)return!te&&/^<a /i.test(ue[0])?te=!0:te&&/^<\/a>/i.test(ue[0])&&(te=!1),!ie&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?ie=!0:ie&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(ie=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:te,inRawBlock:ie,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ae(ue[0]):ue[0]}},de.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var ie=ce(te[2],"()");if(ie>-1){var ue=te[0].indexOf("!")===0?5:4,me=ue+te[1].length+ie;te[2]=te[2].substring(0,ie),te[0]=te[0].substring(0,me).trim(),te[3]=""}var Ee=te[2],Me="";if(this.options.pedantic){var rt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);rt?(Ee=rt[1],Me=rt[3]):Me=""}else Me=te[3]?te[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var mt=ve(te,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},te[0]);return mt}},de.reflink=function(ee,te){var ie;if((ie=this.rules.inline.reflink.exec(ee))||(ie=this.rules.inline.nolink.exec(ee))){var ue=(ie[2]||ie[1]).replace(/\s+/g," ");if(ue=te[ue.toLowerCase()],!ue||!ue.href){var me=ie[0].charAt(0);return{type:"text",raw:me,text:me}}var Ee=ve(ie,ue,ie[0]);return Ee}},de.strong=function(ee,te,ie){ie===void 0&&(ie="");var ue=this.rules.inline.strong.start.exec(ee);if(ue&&(!ue[1]||ue[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var me=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var Ee;(ue=me.exec(te))!=null;)if(Ee=this.rules.inline.strong.middle.exec(te.slice(0,ue.index+3)),Ee)return{type:"strong",raw:ee.slice(0,Ee[0].length),text:ee.slice(2,Ee[0].length-2)}}},de.em=function(ee,te,ie){ie===void 0&&(ie="");var ue=this.rules.inline.em.start.exec(ee);if(ue&&(!ue[1]||ue[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var me=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var Ee;(ue=me.exec(te))!=null;)if(Ee=this.rules.inline.em.middle.exec(te.slice(0,ue.index+2)),Ee)return{type:"em",raw:ee.slice(0,Ee[0].length),text:ee.slice(1,Ee[0].length-1)}}},de.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var ie=te[2].replace(/\n/g," "),ue=/[^ ]/.test(ie),me=ie.startsWith(" ")&&ie.endsWith(" ");return ue&&me&&(ie=ie.substring(1,ie.length-1)),ie=ae(ie,!0),{type:"codespan",raw:te[0],text:ie}}},de.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},de.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[1]}},de.autolink=function(ee,te){var ie=this.rules.inline.autolink.exec(ee);if(ie){var ue,me;return ie[2]==="@"?(ue=ae(this.options.mangle?te(ie[1]):ie[1]),me="mailto:"+ue):(ue=ae(ie[1]),me=ue),{type:"link",raw:ie[0],text:ue,href:me,tokens:[{type:"text",raw:ue,text:ue}]}}},de.url=function(ee,te){var ie;if(ie=this.rules.inline.url.exec(ee)){var ue,me;if(ie[2]==="@")ue=ae(this.options.mangle?te(ie[0]):ie[0]),me="mailto:"+ue;else{var Ee;do Ee=ie[0],ie[0]=this.rules.inline._backpedal.exec(ie[0])[0];while(Ee!==ie[0]);ue=ae(ie[0]),ie[1]==="www."?me="http://"+ue:me=ue}return{type:"link",raw:ie[0],text:ue,href:me,tokens:[{type:"text",raw:ue,text:ue}]}}},de.inlineText=function(ee,te,ie){var ue=this.rules.inline.text.exec(ee);if(ue){var me;return te?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ae(ue[0]):ue[0]:me=ae(this.options.smartypants?ie(ue[0]):ue[0]),{type:"text",raw:ue[0],text:me}}},ge}(),Te=Q.noopTest,Ce=Q.edit,Se=Q.merge,pe={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:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Ce(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Ce(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Ce(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Ce(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Ce(pe._paragraph).replace("hr",pe.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",pe._tag).getRegex(),pe.blockquote=Ce(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=Se({},pe),pe.gfm=Se({},pe.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*|$)"}),pe.gfm.nptable=Ce(pe.gfm.nptable).replace("hr",pe.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",pe._tag).getRegex(),pe.gfm.table=Ce(pe.gfm.table).replace("hr",pe.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",pe._tag).getRegex(),pe.pedantic=Se({},pe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._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:Te,paragraph:Ce(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=Ce(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=Ce(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=Ce(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=Ce(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=Ce(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=Ce(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=Ce(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=Ce(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=Ce(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=Ce(oe._blockSkip,"g").getRegex(),oe.overlapSkip=Ce(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,oe.autolink=Ce(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=Ce(oe.tag).replace("comment",pe._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=Ce(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=Ce(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=Ce(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=Se({},oe),oe.pedantic=Se({},oe.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=Se({},oe.normal,{escape:Ce(oe.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=Ce(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=Se({},oe.gfm,{br:Ce(oe.br).replace("{2,}","*").getRegex(),text:Ce(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var De={block:pe,inline:oe},Ye=H.defaults,Ge=De.block,tt=De.inline;function qe(ge){return ge.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 Ae(ge){var de="",fe,ee,te=ge.length;for(fe=0;fe<te;fe++)ee=ge.charCodeAt(fe),Math.random()>.5&&(ee="x"+ee.toString(16)),de+="&#"+ee+";";return de}var Ne=function(){function ge(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||Ye,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:Ge.normal,inline:tt.normal};this.options.pedantic?(ee.block=Ge.pedantic,ee.inline=tt.pedantic):this.options.gfm&&(ee.block=Ge.gfm,this.options.breaks?ee.inline=tt.breaks:ee.inline=tt.gfm),this.tokenizer.rules=ee}ge.lex=function(ee,te){var ie=new ge(te);return ie.lex(ee)};var de=ge.prototype;return de.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(ee,te,ie){te===void 0&&(te=[]),ie===void 0&&(ie=!0),ee=ee.replace(/^ +$/gm,"");for(var ue,me,Ee,Me;ee;){if(ue=this.tokenizer.space(ee)){ee=ee.substring(ue.raw.length),ue.type&&te.push(ue);continue}if(ue=this.tokenizer.code(ee,te)){ee=ee.substring(ue.raw.length),ue.type?te.push(ue):(Me=te[te.length-1],Me.raw+=`
|
|
`+ue.raw,Me.text+=`
|
|
`+ue.text);continue}if(ue=this.tokenizer.fences(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.heading(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.nptable(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.hr(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.blockquote(ee)){ee=ee.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],ie),te.push(ue);continue}if(ue=this.tokenizer.list(ee)){for(ee=ee.substring(ue.raw.length),Ee=ue.items.length,me=0;me<Ee;me++)ue.items[me].tokens=this.blockTokens(ue.items[me].text,[],!1);te.push(ue);continue}if(ue=this.tokenizer.html(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ie&&(ue=this.tokenizer.def(ee))){ee=ee.substring(ue.raw.length),this.tokens.links[ue.tag]||(this.tokens.links[ue.tag]={href:ue.href,title:ue.title});continue}if(ue=this.tokenizer.table(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.lheading(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ie&&(ue=this.tokenizer.paragraph(ee))){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.text(ee,te)){ee=ee.substring(ue.raw.length),ue.type?te.push(ue):(Me=te[te.length-1],Me.raw+=`
|
|
`+ue.raw,Me.text+=`
|
|
`+ue.text);continue}if(ee){var rt="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return te},de.inline=function(ee){var te,ie,ue,me,Ee,Me,rt=ee.length;for(te=0;te<rt;te++){Me=ee[te];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:[]},me=Me.header.length,ie=0;ie<me;ie++)Me.tokens.header[ie]=[],this.inlineTokens(Me.header[ie],Me.tokens.header[ie]);for(me=Me.cells.length,ie=0;ie<me;ie++)for(Ee=Me.cells[ie],Me.tokens.cells[ie]=[],ue=0;ue<Ee.length;ue++)Me.tokens.cells[ie][ue]=[],this.inlineTokens(Ee[ue],Me.tokens.cells[ie][ue]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(me=Me.items.length,ie=0;ie<me;ie++)this.inline(Me.items[ie].tokens);break}}}return ee},de.inlineTokens=function(ee,te,ie,ue,me){te===void 0&&(te=[]),ie===void 0&&(ie=!1),ue===void 0&&(ue=!1),me===void 0&&(me="");var Ee,Me=ee,rt;if(this.tokens.links){var mt=Object.keys(this.tokens.links);if(mt.length>0)for(;(rt=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)mt.includes(rt[0].slice(rt[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,rt.index)+"["+"a".repeat(rt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(rt=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,rt.index)+"["+"a".repeat(rt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ee;){if(Ee=this.tokenizer.escape(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.tag(ee,ie,ue)){ee=ee.substring(Ee.raw.length),ie=Ee.inLink,ue=Ee.inRawBlock,te.push(Ee);continue}if(Ee=this.tokenizer.link(ee)){ee=ee.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ue)),te.push(Ee);continue}if(Ee=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ue)),te.push(Ee);continue}if(Ee=this.tokenizer.strong(ee,Me,me)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ie,ue),te.push(Ee);continue}if(Ee=this.tokenizer.em(ee,Me,me)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ie,ue),te.push(Ee);continue}if(Ee=this.tokenizer.codespan(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.br(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.del(ee)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ie,ue),te.push(Ee);continue}if(Ee=this.tokenizer.autolink(ee,Ae)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(!ie&&(Ee=this.tokenizer.url(ee,Ae))){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.inlineText(ee,ue,qe)){ee=ee.substring(Ee.raw.length),me=Ee.raw.slice(-1),te.push(Ee);continue}if(ee){var ct="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return te},Z(ge,null,[{key:"rules",get:function(){return{block:Ge,inline:tt}}}]),ge}(),We=H.defaults,ze=Q.cleanUrl,je=Q.escape,_e=function(){function ge(fe){this.options=fe||We}var de=ge.prototype;return de.code=function(ee,te,ie){var ue=(te||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight(ee,ue);me!=null&&me!==ee&&(ie=!0,ee=me)}return ue?'<pre><code class="'+this.options.langPrefix+je(ue,!0)+'">'+(ie?ee:je(ee,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ie?ee:je(ee,!0))+`</code></pre>
|
|
`},de.blockquote=function(ee){return`<blockquote>
|
|
`+ee+`</blockquote>
|
|
`},de.html=function(ee){return ee},de.heading=function(ee,te,ie,ue){return this.options.headerIds?"<h"+te+' id="'+this.options.headerPrefix+ue.slug(ie)+'">'+ee+"</h"+te+`>
|
|
`:"<h"+te+">"+ee+"</h"+te+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(ee,te,ie){var ue=te?"ol":"ul",me=te&&ie!==1?' start="'+ie+'"':"";return"<"+ue+me+`>
|
|
`+ee+"</"+ue+`>
|
|
`},de.listitem=function(ee){return"<li>"+ee+`</li>
|
|
`},de.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(ee){return"<p>"+ee+`</p>
|
|
`},de.table=function(ee,te){return te&&(te="<tbody>"+te+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ee+`</thead>
|
|
`+te+`</table>
|
|
`},de.tablerow=function(ee){return`<tr>
|
|
`+ee+`</tr>
|
|
`},de.tablecell=function(ee,te){var ie=te.header?"th":"td",ue=te.align?"<"+ie+' align="'+te.align+'">':"<"+ie+">";return ue+ee+"</"+ie+`>
|
|
`},de.strong=function(ee){return"<strong>"+ee+"</strong>"},de.em=function(ee){return"<em>"+ee+"</em>"},de.codespan=function(ee){return"<code>"+ee+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(ee){return"<del>"+ee+"</del>"},de.link=function(ee,te,ie){if(ee=ze(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var ue='<a href="'+je(ee)+'"';return te&&(ue+=' title="'+te+'"'),ue+=">"+ie+"</a>",ue},de.image=function(ee,te,ie){if(ee=ze(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var ue='<img src="'+ee+'" alt="'+ie+'"';return te&&(ue+=' title="'+te+'"'),ue+=this.options.xhtml?"/>":">",ue},de.text=function(ee){return ee},ge}(),Pe=function(){function ge(){}var de=ge.prototype;return de.strong=function(ee){return ee},de.em=function(ee){return ee},de.codespan=function(ee){return ee},de.del=function(ee){return ee},de.html=function(ee){return ee},de.text=function(ee){return ee},de.link=function(ee,te,ie){return""+ie},de.image=function(ee,te,ie){return""+ie},de.br=function(){return""},ge}(),Ke=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(ee){var te=ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(te)){var ie=te;do this.seen[ie]++,te=ie+"-"+this.seen[ie];while(this.seen.hasOwnProperty(te))}return this.seen[te]=0,te},ge}(),$e=H.defaults,Qe=Q.unescape,Xe=function(){function ge(fe){this.options=fe||$e,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 Ke}ge.parse=function(ee,te){var ie=new ge(te);return ie.parse(ee)};var de=ge.prototype;return de.parse=function(ee,te){te===void 0&&(te=!0);var ie="",ue,me,Ee,Me,rt,mt,ct,Ct,St,st,Ft,Ot,Zt,Xt,_t,Ir,Kr,bt,Nr=ee.length;for(ue=0;ue<Nr;ue++){st=ee[ue];switch(st.type){case"space":continue;case"hr":{ie+=this.renderer.hr();continue}case"heading":{ie+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Qe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{ie+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Ct="",ct="",Me=st.header.length,me=0;me<Me;me++)ct+=this.renderer.tablecell(this.parseInline(st.tokens.header[me]),{header:!0,align:st.align[me]});for(Ct+=this.renderer.tablerow(ct),St="",Me=st.cells.length,me=0;me<Me;me++){for(mt=st.tokens.cells[me],ct="",rt=mt.length,Ee=0;Ee<rt;Ee++)ct+=this.renderer.tablecell(this.parseInline(mt[Ee]),{header:!1,align:st.align[Ee]});St+=this.renderer.tablerow(ct)}ie+=this.renderer.table(Ct,St);continue}case"blockquote":{St=this.parse(st.tokens),ie+=this.renderer.blockquote(St);continue}case"list":{for(Ft=st.ordered,Ot=st.start,Zt=st.loose,Me=st.items.length,St="",me=0;me<Me;me++)_t=st.items[me],Ir=_t.checked,Kr=_t.task,Xt="",_t.task&&(bt=this.renderer.checkbox(Ir),Zt?_t.tokens.length>0&&_t.tokens[0].type==="text"?(_t.tokens[0].text=bt+" "+_t.tokens[0].text,_t.tokens[0].tokens&&_t.tokens[0].tokens.length>0&&_t.tokens[0].tokens[0].type==="text"&&(_t.tokens[0].tokens[0].text=bt+" "+_t.tokens[0].tokens[0].text)):_t.tokens.unshift({type:"text",text:bt}):Xt+=bt),Xt+=this.parse(_t.tokens,Zt),St+=this.renderer.listitem(Xt,Kr,Ir);ie+=this.renderer.list(St,Ft,Ot);continue}case"html":{ie+=this.renderer.html(st.text);continue}case"paragraph":{ie+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(St=st.tokens?this.parseInline(st.tokens):st.text;ue+1<Nr&&ee[ue+1].type==="text";)st=ee[++ue],St+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);ie+=te?this.renderer.paragraph(St):St;continue}default:{var hr='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return ie},de.parseInline=function(ee,te){te=te||this.renderer;var ie="",ue,me,Ee=ee.length;for(ue=0;ue<Ee;ue++){me=ee[ue];switch(me.type){case"escape":{ie+=te.text(me.text);break}case"html":{ie+=te.html(me.text);break}case"link":{ie+=te.link(me.href,me.title,this.parseInline(me.tokens,te));break}case"image":{ie+=te.image(me.href,me.title,me.text);break}case"strong":{ie+=te.strong(this.parseInline(me.tokens,te));break}case"em":{ie+=te.em(this.parseInline(me.tokens,te));break}case"codespan":{ie+=te.codespan(me.text);break}case"br":{ie+=te.br();break}case"del":{ie+=te.del(this.parseInline(me.tokens,te));break}case"text":{ie+=te.text(me.text);break}default:{var Me='Token with "'+me.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return ie},ge}(),dt=Q.merge,et=Q.checkSanitizeDeprecation,it=Q.escape,we=H.getDefaults,lt=H.changeDefaults,nt=H.defaults;function Le(ge,de,fe){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(fe=de,de=null),de=dt({},Le.defaults,de||{}),et(de),fe){var ee=de.highlight,te;try{te=Ne.lex(ge,de)}catch(Ee){return fe(Ee)}var ie=function(Me){var rt;if(!Me)try{rt=Xe.parse(te,de)}catch(mt){Me=mt}return de.highlight=ee,Me?fe(Me):fe(null,rt)};if(!ee||ee.length<3)return ie();if(delete de.highlight,!te.length)return ie();var ue=0;Le.walkTokens(te,function(Ee){Ee.type==="code"&&(ue++,setTimeout(function(){ee(Ee.text,Ee.lang,function(Me,rt){if(Me)return ie(Me);rt!=null&&rt!==Ee.text&&(Ee.text=rt,Ee.escaped=!0),ue--,ue===0&&ie()})},0))}),ue===0&&ie();return}try{var me=Ne.lex(ge,de);return de.walkTokens&&Le.walkTokens(me,de.walkTokens),Xe.parse(me,de)}catch(Ee){if(Ee.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+it(Ee.message+"",!0)+"</pre>";throw Ee}}Le.options=Le.setOptions=function(ge){return dt(Le.defaults,ge),lt(Le.defaults),Le},Le.getDefaults=we,Le.defaults=nt,Le.use=function(ge){var de=dt({},ge);if(ge.renderer&&function(){var ee=Le.defaults.renderer||new _e,te=function(me){var Ee=ee[me];ee[me]=function(){for(var Me=arguments.length,rt=new Array(Me),mt=0;mt<Me;mt++)rt[mt]=arguments[mt];var ct=ge.renderer[me].apply(ee,rt);return ct===!1&&(ct=Ee.apply(ee,rt)),ct}};for(var ie in ge.renderer)te(ie);de.renderer=ee}(),ge.tokenizer&&function(){var ee=Le.defaults.tokenizer||new xe,te=function(me){var Ee=ee[me];ee[me]=function(){for(var Me=arguments.length,rt=new Array(Me),mt=0;mt<Me;mt++)rt[mt]=arguments[mt];var ct=ge.tokenizer[me].apply(ee,rt);return ct===!1&&(ct=Ee.apply(ee,rt)),ct}};for(var ie in ge.tokenizer)te(ie);de.tokenizer=ee}(),ge.walkTokens){var fe=Le.defaults.walkTokens;de.walkTokens=function(ee){ge.walkTokens(ee),fe&&fe(ee)}}Le.setOptions(de)},Le.walkTokens=function(ge,de){for(var fe=N(ge),ee;!(ee=fe()).done;){var te=ee.value;de(te);switch(te.type){case"table":{for(var ie=N(te.tokens.header),ue;!(ue=ie()).done;){var me=ue.value;Le.walkTokens(me,de)}for(var Ee=N(te.tokens.cells),Me;!(Me=Ee()).done;)for(var rt=Me.value,mt=N(rt),ct;!(ct=mt()).done;){var Ct=ct.value;Le.walkTokens(Ct,de)}break}case"list":{Le.walkTokens(te.items,de);break}default:te.tokens&&Le.walkTokens(te.tokens,de)}}},Le.Parser=Xe,Le.parser=Xe.parse,Le.Renderer=_e,Le.TextRenderer=Pe,Le.Lexer=Ne,Le.lexer=Ne.lex,Le.Tokenizer=xe,Le.Slugger=Ke,Le.parse=Le;var Fe=Le;return Fe})},ELLl:function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=re.Pos;re.defineOption("autoCloseBrackets",!1,function(w,T,u){u&&u!=re.Init&&(w.removeKeyMap(N),w.state.closeBrackets=null),T&&(P(Y(T,"pairs")),w.state.closeBrackets=T,w.addKeyMap(N))});function Y(w,T){return T=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[T]!=null?w[T]:Z[T]}var N={Backspace:M,Enter:O};function P(w){for(var T=0;T<w.length;T++){var u=w.charAt(T),o="'"+u+"'";N[o]||(N[o]=H(u))}}P(Z.pairs+"`");function H(w){return function(T){return A(T,w)}}function W(w){var T=w.state.closeBrackets;if(!T||T.override)return T;var u=w.getModeAt(w.getCursor());return u.closeBrackets||T}function M(w){var T=W(w);if(!T||w.getOption("disableInput"))return re.Pass;for(var u=Y(T,"pairs"),o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return re.Pass;var h=R(w,o[l].head);if(!h||u.indexOf(h)%2!=0)return re.Pass}for(var l=o.length-1;l>=0;l--){var C=o[l].head;w.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function O(w){var T=W(w),u=T&&Y(T,"explode");if(!u||w.getOption("disableInput"))return re.Pass;for(var o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return re.Pass;var h=R(w,o[l].head);if(!h||u.indexOf(h)%2!=0)return re.Pass}w.operation(function(){var C=w.lineSeparator()||`
|
|
`;w.replaceSelection(C+C,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var g=0;g<o.length;g++){var p=o[g].head.line;w.indentLine(p,null,!0),w.indentLine(p+1,null,!0)}})}function y(w){var T=re.cmpPos(w.anchor,w.head)>0;return{anchor:new D(w.anchor.line,w.anchor.ch+(T?-1:1)),head:new D(w.head.line,w.head.ch+(T?1:-1))}}function A(w,T){var u=W(w);if(!u||w.getOption("disableInput"))return re.Pass;var o=Y(u,"pairs"),l=o.indexOf(T);if(l==-1)return re.Pass;for(var h=Y(u,"closeBefore"),C=Y(u,"triples"),g=o.charAt(l+1)==T,p=w.listSelections(),k=l%2==0,b,f=0;f<p.length;f++){var m=p[f],d=m.head,a,x=w.getRange(d,D(d.line,d.ch+1));if(k&&!m.empty())a="surround";else if((g||!k)&&x==T)g&&L(w,d)?a="both":C.indexOf(T)>=0&&w.getRange(d,D(d.line,d.ch+3))==T+T+T?a="skipThree":a="skip";else if(g&&d.ch>1&&C.indexOf(T)>=0&&w.getRange(D(d.line,d.ch-2),d)==T+T){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(D(d.line,d.ch-2))))return re.Pass;a="addFour"}else if(g){var v=d.ch==0?" ":w.getRange(D(d.line,d.ch-1),d);if(!re.isWordChar(x)&&v!=T&&!re.isWordChar(v))a="both";else return re.Pass}else if(k&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))a="both";else return re.Pass;if(!b)b=a;else if(b!=a)return re.Pass}var S=l%2?o.charAt(l-1):T,I=l%2?T:o.charAt(l+1);w.operation(function(){if(b=="skip")w.execCommand("goCharRight");else if(b=="skipThree")for(var G=0;G<3;G++)w.execCommand("goCharRight");else if(b=="surround"){for(var V=w.getSelections(),G=0;G<V.length;G++)V[G]=S+V[G]+I;w.replaceSelections(V,"around"),V=w.listSelections().slice();for(var G=0;G<V.length;G++)V[G]=y(V[G]);w.setSelections(V)}else b=="both"?(w.replaceSelection(S+I,null),w.triggerElectric(S+I),w.execCommand("goCharLeft")):b=="addFour"&&(w.replaceSelection(S+S+S+S,"before"),w.execCommand("goCharRight"))})}function R(w,T){var u=w.getRange(D(T.line,T.ch-1),D(T.line,T.ch+1));return u.length==2?u:null}function L(w,T){var u=w.getTokenAt(D(T.line,T.ch+1));return/\bstring/.test(u.type)&&u.start==T.ch&&(T.ch==0||!/\bstring/.test(w.getTokenTypeAt(T)))}})},Gytx:function(wt,pt){wt.exports=function(re,Z,D,Y){var N=D?D.call(Y,re,Z):void 0;if(N!==void 0)return!!N;if(re===Z)return!0;if(typeof re!="object"||!re||typeof Z!="object"||!Z)return!1;var P=Object.keys(re),H=Object.keys(Z);if(P.length!==H.length)return!1;for(var W=Object.prototype.hasOwnProperty.bind(Z),M=0;M<P.length;M++){var O=P[M];if(!W(O))return!1;var y=re[O],A=Z[O];if(N=D?D.call(Y,y,A,O):void 0,N===!1||N===void 0&&y!==A)return!1}return!0}},HmJG:function(wt,pt,se){},LdHM:function(wt,pt,se){"use strict";se.d(pt,"b",function(){return h}),se.d(pt,"a",function(){return g});var re=se("1OyB"),Z=se("vuIU"),D=se("Ji7U"),Y=se("LK+K"),N=se("q1tI"),P=se("rePB"),H=se("Ff2n"),W=se("ODXe"),M=se("4IlW"),O=se("bX4T"),y=se("YrtM"),A=se("TSYQ"),R=se.n(A),L=se("+nKL"),w=se("8OUc"),T=function(q,ae){var ce=q.prefixCls,ve=q.id,Oe=q.flattenOptions,xe=q.childrenAsData,Te=q.values,Ce=q.searchValue,Se=q.multiple,pe=q.defaultActiveFirstOption,oe=q.height,De=q.itemHeight,Ye=q.notFoundContent,Ge=q.open,tt=q.menuItemSelectedIcon,qe=q.virtual,Ae=q.onSelect,Ne=q.onToggleOpen,We=q.onActiveValue,ze=q.onScroll,je=q.onMouseEnter,_e="".concat(ce,"-item"),Pe=Object(y.a)(function(){return Oe},[Ge,Oe],function(Fe,ge){return ge[0]&&Fe[1]!==ge[1]}),Ke=N.useRef(null),$e=function(ge){ge.preventDefault()},Qe=function(ge){Ke.current&&Ke.current.scrollTo({index:ge})},Xe=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=Pe.length,ee=0;ee<fe;ee+=1){var te=(ge+ee*de+fe)%fe,ie=Pe[te],ue=ie.group,me=ie.data;if(!ue&&!me.disabled)return te}return-1},dt=N.useState(function(){return Xe(0)}),et=Object(W.a)(dt,2),it=et[0],we=et[1],lt=function(ge){we(ge);var de=Pe[ge];if(!de){We(null,-1);return}We(de.data.value,ge)};N.useEffect(function(){lt(pe!==!1?Xe(0):-1)},[Pe.length,Ce]),N.useEffect(function(){var Fe=setTimeout(function(){if(!Se&&Ge&&Te.size===1){var ge=Array.from(Te)[0],de=Pe.findIndex(function(fe){var ee=fe.data;return ee.value===ge});lt(de),Qe(de)}});return function(){return clearTimeout(Fe)}},[Ge]);var nt=function(ge){ge!==void 0&&Ae(ge,{selected:!Te.has(ge)}),Se||Ne(!1)};if(N.useImperativeHandle(ae,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case M.a.UP:case M.a.DOWN:{var fe=0;if(de===M.a.UP?fe=-1:de===M.a.DOWN&&(fe=1),fe!==0){var ee=Xe(it+fe,fe);Qe(ee),lt(ee)}break}case M.a.ENTER:{var te=Pe[it];te&&!te.data.disabled?nt(te.data.value):nt(void 0),Ge&&ge.preventDefault();break}case M.a.ESC:Ne(!1)}},onKeyUp:function(){},scrollTo:function(ge){Qe(ge)}}}),Pe.length===0)return N.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(_e,"-empty"),onMouseDown:$e},Ye);function Le(Fe){var ge=Pe[Fe];if(!ge)return null;var de=ge.data||{},fe=de.value,ee=de.label,te=de.children,ie=Object(O.a)(de,!0),ue=xe?te:ee;return ge?N.createElement("div",Object.assign({"aria-label":typeof ue=="string"?ue:null},ie,{key:Fe,role:"option",id:"".concat(ve,"_list_").concat(Fe),"aria-selected":Te.has(fe)}),fe):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(it-1),Le(it),Le(it+1)),N.createElement(L.a,{itemKey:"key",ref:Ke,data:Pe,height:oe,itemHeight:De,fullHeight:!1,onMouseDown:$e,onScroll:ze,virtual:qe,onMouseEnter:je},function(Fe,ge){var de,fe=Fe.group,ee=Fe.groupOption,te=Fe.data,ie=te.label,ue=te.key;if(fe)return N.createElement("div",{className:R()(_e,"".concat(_e,"-group"))},ie!==void 0?ie:ue);var me=te.disabled,Ee=te.value,Me=te.title,rt=te.children,mt=te.style,ct=te.className,Ct=Object(H.a)(te,["disabled","value","title","children","style","className"]),St=Te.has(Ee),st="".concat(_e,"-option"),Ft=R()(_e,st,ct,(de={},Object(P.a)(de,"".concat(st,"-grouped"),ee),Object(P.a)(de,"".concat(st,"-active"),it===ge&&!me),Object(P.a)(de,"".concat(st,"-disabled"),me),Object(P.a)(de,"".concat(st,"-selected"),St),de)),Ot=xe?rt:ie,Zt=!tt||typeof tt=="function"||St;return N.createElement("div",Object.assign({},Ct,{"aria-selected":St,className:Ft,title:Me,onMouseMove:function(){if(it===ge||me)return;lt(ge)},onClick:function(){me||nt(Ee)},style:mt}),N.createElement("div",{className:"".concat(st,"-content")},Ot||Ee),N.isValidElement(tt)||St,Zt&&N.createElement(w.a,{className:"".concat(_e,"-option-state"),customizeIcon:tt,customizeIconProps:{isSelected:St}},St?"\u2713":null))}))},u=N.forwardRef(T);u.displayName="OptionList";var o=u,l=function(){return null};l.isSelectOption=!0;var h=l,C=function(){return null};C.isSelectOptGroup=!0;var g=C,p=se("VTBJ"),k=se("Zm9Q");function b(U){var q=U.key,ae=U.props,ce=ae.children,ve=ae.value,Oe=Object(H.a)(ae,["children","value"]);return Object(p.a)({key:q,value:ve!==void 0?ve:q,children:ce},Oe)}function f(U){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(U).map(function(ae,ce){if(!N.isValidElement(ae)||!ae.type)return null;var ve=ae.type.isSelectOptGroup,Oe=ae.key,xe=ae.props,Te=xe.children,Ce=Object(H.a)(xe,["children"]);return q||!ve?b(ae):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?ce:Oe,"__"),label:Oe},Ce),{},{options:f(Te)})}).filter(function(ae){return ae})}var m=se("2Qr1"),d=se("qNPg"),a=se("U8pU"),x=se("Kwbf"),v=se("WKfj");function S(U){var q=U.mode,ae=U.options,ce=U.children,ve=U.backfill,Oe=U.allowClear,xe=U.placeholder,Te=U.getInputElement,Ce=U.showSearch,Se=U.onSearch,pe=U.defaultOpen,oe=U.autoFocus,De=U.labelInValue,Ye=U.value,Ge=U.inputValue,tt=U.optionLabelProp,qe=q==="multiple"||q==="tags",Ae=Ce!==void 0?Ce:qe||q==="combobox",Ne=ae||f(ce);if(Object(x.a)(q!=="tags"||Ne.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),q==="tags"||q==="combobox"){var We=Ne.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(x.a)(!We,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(q!=="combobox"||!tt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(q==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(x.a)(q==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(x.b)(q!=="combobox"||!Te||!Oe||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!Ae&&q!=="combobox"&&q!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!pe||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ye!=null){var ze=Object(v.d)(Ye);Object(x.a)(!De||ze.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(x.a)(!qe||Array.isArray(Ye),"`value` should be array when `mode` is `multiple` or `tags`")}if(ce){var je=null;Object(k.a)(ce).some(function(_e){if(!N.isValidElement(_e)||!_e.type)return!1;var Pe=_e.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Ke=Object(k.a)(_e.props.children).every(function($e){return!N.isValidElement($e)||!_e.type||$e.type.isSelectOption?!0:(je=$e.type,!1)});return!Ke}return je=Pe,!0}),je&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(x.a)(Ge===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=S,G=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:m.d,getLabeledValue:m.e,filterOptions:m.b,isValueDisabled:m.g,findValueOption:m.c,warningProps:I,fillOptionsWithMissingValue:m.a}),V=function(U){Object(D.a)(ae,U);var q=Object(Y.a)(ae);function ae(){var ce;return Object(re.a)(this,ae),ce=q.apply(this,arguments),ce.selectRef=N.createRef(),ce.focus=function(){ce.selectRef.current.focus()},ce.blur=function(){ce.selectRef.current.blur()},ce}return Object(Z.a)(ae,[{key:"render",value:function(){return N.createElement(G,Object.assign({ref:this.selectRef},this.props))}}]),ae}(N.Component);V.Option=h,V.OptGroup=g;var Q=V,z=pt.c=Q},M8RZ:function(wt,pt,se){"use strict";se.d(pt,"a",function(){return M});var re=se("fWQN"),Z=se("mtLc"),D=se("yKVA"),Y=se("879j"),N=se("q1tI"),P=se.n(N),H=se("i8i4"),W=se.n(H),M=function(O){Object(D.a)(A,O);var y=Object(Y.a)(A);function A(R){var L;Object(re.a)(this,A),L=y.call(this,R);var w=window.document;return L.node=w.createElement("div"),w.body.appendChild(L.node),L}return Object(Z.a)(A,[{key:"render",value:function(){var L=this.props.children;return Object(H.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},OLES:function(wt,pt,se){"use strict";var re=se("U8pU"),Z=se("VTBJ"),D=se("Ff2n"),Y=se("q1tI"),N=se("uciX"),P=se("7ixt"),H=function(R){var L=R.overlay,w=R.prefixCls,T=R.id,u=R.overlayInnerStyle;return Y.createElement("div",{className:"".concat(w,"-inner"),id:T,role:"tooltip",style:u},typeof L=="function"?L():L)},W=H,M=function(R,L){var w=R.overlayClassName,T=R.trigger,u=T===void 0?["hover"]:T,o=R.mouseEnterDelay,l=o===void 0?0:o,h=R.mouseLeaveDelay,C=h===void 0?.1:h,g=R.overlayStyle,p=R.prefixCls,k=p===void 0?"rc-tooltip":p,b=R.children,f=R.onVisibleChange,m=R.afterVisibleChange,d=R.transitionName,a=R.animation,x=R.placement,v=x===void 0?"right":x,S=R.align,I=S===void 0?{}:S,G=R.destroyTooltipOnHide,V=G===void 0?!1:G,Q=R.defaultVisible,z=R.getTooltipContainer,U=R.overlayInnerStyle,q=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ae=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(L,function(){return ae.current});var ce=Object(Z.a)({},q);"visible"in R&&(ce.popupVisible=R.visible);var ve=function(){var Se=R.arrowContent,pe=Se===void 0?null:Se,oe=R.overlay,De=R.id;return[Y.createElement("div",{className:"".concat(k,"-arrow"),key:"arrow"},pe),Y.createElement(W,{key:"content",prefixCls:k,id:De,overlay:oe,overlayInnerStyle:U})]},Oe=!1,xe=!1;if(typeof V=="boolean")Oe=V;else if(V&&Object(re.a)(V)==="object"){var Te=V.keepParent;Oe=Te===!0,xe=Te===!1}return Y.createElement(N.a,Object.assign({popupClassName:w,prefixCls:k,popup:ve,action:u,builtinPlacements:P.a,popupPlacement:v,ref:ae,popupAlign:I,getPopupContainer:z,onPopupVisibleChange:f,afterPopupVisibleChange:m,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:Q,destroyPopupOnHide:Oe,autoDestroy:xe,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:l},ce),b)},O=Object(Y.forwardRef)(M),y=pt.a=O},Ot1p:function(wt,pt,se){"use strict";var re=se("2qtc"),Z=se("kLXV"),D=se("rAM+"),Y=se("miYZ"),N=se("tsqr"),P=se("9og8"),H=se("tJVT"),W=se("jrin"),M=se("WmNS"),O=se.n(M),y=se("q1tI"),A=se.n(y),R=se("VrN/"),L=se.n(R),w=se("bdgK"),T=se("p77/"),u=se("Bd2K"),o=se("ELLl"),l=se("19Vz"),h=se("lZu9"),C=se("+NIl"),g=se("kSUc"),p=se("9Bee"),k=function(me){var Ee=me.value,Me=Ee===void 0?"":Ee,rt=me.className,mt=me.showTextOnly,ct=me.showLines,Ct=me.style,St=Ct===void 0?{}:Ct,st=Object(y.useMemo)(function(){return""},[Me]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},b=se("0Owb"),f=se("dejd"),m=se("C+DQ"),d=se("1vsH"),a=se("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(me){var Ee=me.onActionCallback,Me=me.title,rt=me.icon,mt=me.actionName,ct=me.className,Ct=ct===void 0?"":ct,St=me.children;function st(){Ee(mt)}return A.a.createElement("a",{title:Me,className:Ct,onClick:st},A.a.createElement("i",{className:"md-iconfont ".concat(rt)}),St)}var S=function(me){var Ee=me.watch,Me=me.showNullButton,rt=me.onActionCallback,mt=me.fullScreen,ct=me.insertTemp,Ct=me.hidetoolBar,St=me.uuid,st=me.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(St,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ft=[].concat(x,[{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 A.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ft.map(function(Ot,Zt){return A.a.createElement("li",{key:Zt},Ot.actionName?A.a.createElement(v,Object(b.a)({},Ot,{onActionCallback:rt})):A.a.createElement("span",{className:"v-line"}))}),Me?A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ct&&A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ct),onActionCallback:rt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(v,{icon:"".concat(mt?"icon-shrink":"icon-enlarge"),title:mt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},I=se("M8RZ"),G=se("+L6B"),V=se("2/Rp"),Q=se("y8nQ"),z=se("Vl3Y"),U=se("5NDa"),q=se("5rEg"),ae={labelCol:{span:4},wrapperCol:{span:20}},ce=function(me){var Ee=me.callback,Me=me.onCancel;function rt(mt){Ee(mt)}return A.a.createElement(z.a,Object(b.a)({},ae,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),A.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(q.a,null)),A.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(q.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ve=se("7ahc"),Oe=se("HmJG"),xe=se("BjJ7"),Te=z.a.useForm,Ce={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},pe=function(me){var Ee=me.callback,Me=me.onCancel,rt=Te(),mt=Object(H.a)(rt,1),ct=mt[0];function Ct(Ft){Ee(Ft)}function St(Ft,Ot){if(Ft.status===-1){N.b.error(Ft.message);return}ct.setFieldsValue({src:"/api/attachments/".concat(Ft.id),type:Ot.type})}function st(Ft){var Ot=Ft.target.files[0];De(Ot,St)}return A.a.createElement(z.a,Object(b.a)({form:ct},Se,{className:"upload-image-panel",onFinish:Ct}),A.a.createElement(z.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(q.a,{style:Ce})),A.a.createElement(oe,{onFileChange:st}))),A.a.createElement(z.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(q.a,{style:{width:264}})),A.a.createElement(z.a.Item,{style:{textAlign:"right"}},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function oe(me){var Ee=me.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ee}))}function De(me,Ee){if(!me)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",me),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(mt){Ee(JSON.parse(mt.target.responseText),me)},!1),rt.addEventListener("error",function(mt){console.error(mt)},!1),rt.open("POST","".concat(xe.a,"/api/attachments.json")),rt.send(Me)}var Ye=se("giR+"),Ge=se("fyUT"),tt=se("7Kak"),qe=se("9yH6"),Ae=qe.a.Group,Ne={margin:"0 8px"},We=function(me){var Ee=me.callback,Me=me.onCancel;function rt(mt){Ee(mt)}return A.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Ne},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Ne},"\u884C\u6570"),A.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(Ge.a,null)),A.a.createElement("span",{style:Ne},"\u5217\u6570"),A.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(Ge.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Ne},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(z.a.Item,{name:"align"},A.a.createElement(Ae,null,A.a.createElement(qe.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(qe.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(qe.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(qe.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ze=se("ErOA"),je=se("7Cbv"),_e="link",Pe="upload-image",Ke="code-block",$e="add-table",Qe="------------",Xe={default:Qe,left:":".concat(Qe),center:":".concat(Qe,":"),right:"".concat(Qe,":")},dt=se("9VGf"),et,it;function we(){}var lt=0,nt=1e4,Le="\u2581",Fe=`
|
|
**\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 ge(me){return/^\d+$/.test(me)?"".concat(me,"px"):me}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=de?"Cmd":"Ctrl",ee=["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"],te=(et={},Object(W.a)(et,fe+"-B","bold"),Object(W.a)(et,fe+"-I","italic"),et),ie=(it={},Object(W.a)(it,_e,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(it,Ke,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(it,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(it,$e,"\u6DFB\u52A0\u8868\u683C"),it),ue=pt.a=function(me){var Ee=me.defaultValue,Me=Ee===void 0?"":Ee,rt=me.onChange,mt=me.width,ct=mt===void 0?"100%":mt,Ct=me.height,St=Ct===void 0?400:Ct,st=me.miniToolbar,Ft=st===void 0?!1:st,Ot=me.isFocus,Zt=Ot===void 0?!1:Ot,Xt=me.watch,_t=me.insertTemp,Ir=me.mode,Kr=Ir===void 0?"markdown":Ir,bt=me.id,Nr=bt===void 0?"markdown-editor-id":bt,hr=me.showResizeBar,pr=hr===void 0?!1:hr,Br=me.noStorage,ci=Br===void 0?!1:Br,qr=me.showNullButton,It=qr===void 0?!1:qr,ut=me.hidetoolBar,Hr=ut===void 0?!1:ut,ei=me.fullScreen,mr=ei===void 0?!1:ei,kt=me.onBlur,Fr=me.onCMBeforeChange,Vr=me.onFullScreen,fi=me.className,Ue=fi===void 0?"":fi,Et=me.disablePaste,pi=Et===void 0?!1:Et,mi=me.placeholder,gi=mi===void 0?"":mi,vi=me.values,j=vi===void 0?"":vi,s=Object(y.useState)(null),c=Object(H.a)(s,2),_=c[0],$=c[1],F=Object(y.useState)(Me),he=Object(H.a)(F,2),Re=he[0],Ve=he[1],ht=Object(y.useState)(Xt),Ie=Object(H.a)(ht,2),vt=Ie[0],Nt=Ie[1],Kt=Object(y.useState)(mr),_r=Object(H.a)(Kt,2),gr=_r[0],vr=_r[1],Xr=Object(y.useState)(""),_i=Object(H.a)(Xr,2),nr=_i[0],Ur=_i[1],oi=Object(y.useState)(0),si=Object(H.a)(oi,2),Or=si[0],Oi=si[1],yi=Object(y.useState)(St),zi=Object(H.a)(yi,2),Ki=zi[0],Yr=zi[1],Gr=Object(y.useState)(!1),bi=Object(H.a)(Gr,2),dn=bi[0],xi=bi[1],Jt=Object(y.useRef)(Object(je.a)()),Bt=Object(y.useRef)(!1),dr=Object(y.useRef)(),Dt=Object(y.useRef)(),qt=Object(y.useRef)(),Wt=Object(y.useRef)(),ti=Object(y.useRef)(),ar=function(){var ft=Object(P.a)(O.a.mark(function Tt(){var yt,Lt;return O.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Jt.current}});case 2:Lt=Gt.sent,Lt!=null&&(yt=Lt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",_,Dt),Lt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?_.replaceSelection(".concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?_.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?_.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):_.replaceSelection("[".concat(Pt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Gt.stop()}},Tt)}));return function(){return ft.apply(this,arguments)}}();Object(y.useEffect)(function(){Ve(j),_==null||_.setValue(j)},[j]),Object(y.useEffect)(function(){Vr==null||Vr(gr)},[gr]),Object(y.useEffect)(function(){if(Dt.current){var ft=L.a.fromTextArea(Dt.current,{mode:Kr,lineNumbers:!Ft,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&ft.focus();function Tt(yt,Lt){if(pi){Lt.preventDefault();return}var Mt=Lt.clipboardData;if(Mt){var Gt=Mt.types.toString(),Pt=Mt.items;if(Gt==="Files"||Mt.types.indexOf("Files")>-1){if(Lt.preventDefault(),Kr=="stex")return;try{var rr,Cr=Pt[1];((rr=Pt[0])===null||rr===void 0?void 0:rr.kind)==="file"&&(Cr=Pt[0]);var Rt=Cr.getAsFile(),li=Rt.name.split(".").pop();De(Rt,function(Ut){if(Ut.id){var wr,yr,zr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?ft.replaceSelection(".concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?ft.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?ft.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ee.includes(li)?ft.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ft.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ft.on("paste",Tt),ft.on("dragleave",function(yt,Lt){qt.current.classList.remove("mouse-hover-md")}),ft.on("dragover",function(yt,Lt){qt.current.classList.add("mouse-hover-md")}),ft.on("drop",function(yt,Lt){qt.current.classList.add("mouse-hover-md");var Mt;if(Mt=Lt.dataTransfer.files,Mt.length>0){Lt.preventDefault(),Lt.stopPropagation();for(var Gt=function(Cr){var Rt=Mt[Cr],li=Rt.name.split(".").pop();De(Rt,function(Ut){if(Ut.id){var wr,yr,zr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?ft.replaceSelection(".concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?ft.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?ft.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ee.includes(li)?ft.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ft.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Mt.length;Pt++)Gt(Pt)}}),$(ft),function(){ft.off("paste",Tt)}}},[]);var Er=Object(y.useCallback)(function(){if(qt.current)try{}catch(ft){console.log(ft,"---- to set md editor body height")}},[Ki,qt,gr]);Object(y.useEffect)(function(){function ft(){var yt=new w.default(function(Lt){var Mt=Object(D.a)(Lt),Gt;try{for(Mt.s();!(Gt=Mt.n()).done;){var Pt=Gt.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(Er(),_.setSize("100%","100%"),_.refresh())}}catch(rr){Mt.e(rr)}finally{Mt.f()}});return yt.observe(Dt.current.parentElement),yt}if(_){var Tt=ft();return function(){Tt.unobserve(Dt.current.parentElement)}}},[_,Er]),Object(y.useEffect)(function(){if(_){for(var ft=[],Tt=function(){var Pt=Lt[yt];Mt=Object(H.a)(Pt,2);var rr=Mt[0],Cr=Mt[1],Rt=Object(W.a)({},rr,function(){Vi(Cr)});ft.push(Rt),_.addKeyMap(Rt)},yt=0,Lt=Object.entries(te);yt<Lt.length;yt++){var Mt;Tt()}return dr.current=setInterval(function(){Bt.current&&ar()},4e3),function(){clearInterval(dr.current);var Gt=Object(D.a)(ft),Pt;try{for(Gt.s();!(Pt=Gt.n()).done;){var rr=Pt.value;_.removeKeyMap(rr)}}catch(Cr){Gt.e(Cr)}finally{Gt.f()}}}},[_]),Object(y.useEffect)(function(){mr!==gr&&vr(mr)},[mr]),Object(dt.a)(function(){if(!ci&&Or>0){var ft=new Date().getTime(),Tt=window.sessionStorage.getItem(Nr);ft>=Or+nt&&(!Tt||Tt!==Re)&&(window.sessionStorage.setItem(Nr,Re),xi(!0))}},nt),Object(y.useEffect)(function(){Nt(Xt)},[_,Xt]),Object(y.useEffect)(function(){_&&(Zt&&_.focus())},[_,Zt]),Object(y.useEffect)(function(){if(vt&&_){var ft=_.getScrollerElement();function Tt(yt){var Lt=yt.target;if(ti.current){var Mt=Lt.scrollTop/Lt.scrollHeight;ti.current.scrollTop=ti.current.scrollHeight*Mt}}return ft.addEventListener("scroll",Tt),function(){ft.removeEventListener("scroll",Tt)}}},[_,vt]),Object(y.useEffect)(function(){if(_&&Fr){function ft(Tt,yt){Fr(Tt,yt)}return _.on("beforeChange",ft),function(){_.off("beforeChange",ft)}}},[_,Fr]),Object(y.useEffect)(function(){if(_&&kt){function ft(){kt(_.getValue())}return _.on("blur",ft),function(){_.off("blur",ft)}}},[_,kt]),Object(y.useEffect)(function(){if(_){function ft(Tt){var yt=Tt.getValue();Ve(yt),Oi(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(yt)}return _.on("change",ft),function(){_.off("change",ft)}}},[_,rt]),Object(y.useEffect)(function(){_&&(Me==null?(_.setValue(""),Ve("")):Me!==_.getValue()&&(_.setValue(Me),Ve(Me),_.setCursor(_.lineCount(),0)))},[_,Me]);var Vi=Object(y.useCallback)(function(ft){var Tt=_.getCursor(),yt=_.getSelection(),Lt=yt.split(`
|
|
`);switch(ft){case"bold":return _.replaceSelection("**"+yt+"**"),yt===""&&_.setCursor(Tt.line,Tt.ch+2),_.focus();case"italic":return _.replaceSelection("*"+yt+"*"),yt===""&&_.setCursor(Tt.line,Tt.ch+1),_.focus();case"code":return _.replaceSelection("`"+yt+"`"),yt===""&&_.setCursor(Tt.line,Tt.ch+1),_.focus();case"inline-latex":return _.replaceSelection("`$$"+yt+"$$`"),yt===""&&_.setCursor(Tt.line,Tt.ch+3),_.focus();case"latex":return _.replaceSelection("```latex\n"+yt+"\n```"),_.setCursor(Tt.line+1,yt.length+1),_.focus();case"line-break":return _.replaceSelection(`<br/>
|
|
`),_.focus();case"list-ul":return yt===""?_.replaceSelection("- "+yt):_.replaceSelection(Lt.map(function(Mt){return Mt===""?"":"- ".concat(Mt)}).join(`
|
|
`)),_.focus();case"list-ol":return yt===""?_.replaceSelection("1. "+yt):_.replaceSelection(Lt.map(function(Mt,Gt){return Mt===""?"":"".concat(Gt+1,". ").concat(Mt)}).join(`
|
|
`)),_.focus();case"add-null-ch":return yt===""&&_.setCursor(Tt.line,Tt.ch+1),_.replaceSelection(Le),_.focus();case"inster-template-1":return yt===""&&_.setCursor(Tt.line,Tt.ch),_.replaceSelection(Fe),_.focus();case"eraser":return _.setValue(""),_.focus();case"trigger-watch":return Nt(!vt),_.focus();case"trigger-full-screen":return vr(!gr),_.focus();case _e:Ur(_e);return;case Ke:Ur(Ke);return;case Pe:Ur(Pe);return;case $e:Ur($e);return;default:throw new Error}},[_,vt,gr]),Ei=Object(y.useCallback)(function(ft){Ur("");switch(nr){case _e:var Tt=ft.title,yt=ft.link;return _.replaceSelection("[".concat(Tt,"](").concat(yt,")")),_.focus();case Ke:var Lt=ft.language,Mt=ft.content;return _.replaceSelection(["```"+Lt,Mt,"```"].join(`
|
|
`)),_.focus();case Pe:var Gt=ft.src,Pt=ft.alt;return Pt?_.replaceSelection(".concat(Gt,' "').concat(Pt,'" )')):_.replaceSelection("")),_.focus();case $e:for(var rr=ft.row,Cr=ft.col,Rt=ft.align,li=`
|
|
`,Ut=0;Ut<rr;Ut++){for(var wr=[],yr=[],zr=0;zr<Cr;zr++)Ut===1&&yr.push(Xe[Rt]),wr.push(" ");Ut===1&&(li+="| ".concat(yr.join(" | "),` |
|
|
`)),li+="| ".concat(wr.join(Cr===1?"":" | "),` |
|
|
`)}return _.replaceSelection(li+`
|
|
`),_.focus();default:throw new Error}},[_,nr]),cn=Object(y.useMemo)(function(){switch(nr){case _e:return A.a.createElement(ce,{callback:Ei,onCancel:Si});case Ke:return A.a.createElement(ve.b,{callback:Ei,onCancel:Si});case Pe:return A.a.createElement(pe,{callback:Ei,onCancel:Si});case $e:return A.a.createElement(We,{callback:Ei,onCancel:Si});default:return null}},[nr]);function Si(){Ur("")}Object(y.useEffect)(function(){if(Wt.current){var ft=Wt.current,Tt=!1,yt=0;function Lt(Pt){Tt=!0,yt=Pt.pageY}function Mt(){Tt=!1}function Gt(Pt){if(Tt){var rr=Pt.pageY-yt;rr<0&&(rr=0),rr>300&&(rr=300);var Cr=St+rr+"px";Yr(Cr)}}return ft.addEventListener("mousedown",Lt),document.addEventListener("mousemove",Gt),document.addEventListener("mouseup",Mt),function(){ft.removeEventListener("mousedown",Lt),document.removeEventListener("mousemove",Gt),document.removeEventListener("mouseup",Mt)}}},[_,Wt]),Object(y.useEffect)(function(){Yr(St)},[St]);var ri=ge(ct),fn=ge(Ki),$r={width:ri,height:fn},pn=Object(y.useMemo)(function(){if(Or){var ft=new Date(Or),Tt=ft.getHours(),yt=ft.getMinutes(),Lt=ft.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,yt=yt<10?"0"+yt:yt,Lt=Lt<10?"0"+Lt:Lt,"".concat(Tt,":").concat(yt,":").concat(Lt)}return 0},[Or]);function jn(){window.sessionStorage.removeItem(Nr),xi(!1),Oi(0)}function Pi(){xi(!1),Oi(0),_.setValue(window.sessionStorage.getItem(Nr))}function ua(ft,Tt){var yt=_.getValue();yt=yt.replace(ft,Tt),Ve(yt),_==null||_.setValue(yt)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:qt},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ue," ").concat(vt?"on-preview":""," ").concat(Ft?"mini":""," ").concat(gr?"full-screen":""),style:$r},A.a.createElement(S,{insertTemp:_t,watch:vt,fullScreen:gr,showNullButton:It,onActionCallback:Vi,hidetoolBar:Hr,uuid:Jt.current,setOpenPhones:function(){Bt.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Dt,placeholder:gi})),vt?A.a.createElement("div",{ref:ti,className:"preview-container"},Kr==="stex"&&A.a.createElement(k,{value:Re}),Kr!=="stex"&&A.a.createElement(p.a,{edit:!0,value:Re,replaces:ua})):null))),pr?A.a.createElement("a",{ref:Wt,className:"editor-resize"}):null,A.a.createElement(I.a,null,ie[nr]?A.a.createElement(Z.a,{centered:!0,title:ie[nr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(wt,pt){/**
|
|
* @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 se,re,Z,D=!1,Y,N;window.PR_SHOULD_USE_CONTINUATION=!0;var P,H;(function(){var W=window,M=["break,continue,do,else,for,if,return,while"],O=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="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",T=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[A,L,R,T,u,o,l,h],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",k="kwd",b="com",f="typ",m="lit",d="pun",a="pln",x="tag",v="dec",S="src",I="atn",G="atv",V="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(Ae){for(var Ne=0,We=!1,ze=!1,je=0,_e=Ae.length;je<_e;++je){var Pe=Ae[je];if(Pe.ignoreCase)ze=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){We=!0,ze=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function $e(it){var we=it.charCodeAt(0);if(we!==92)return we;var lt=it.charAt(1);return we=Ke[lt],we||("0"<=lt&<<="7"?parseInt(it.substring(1),8):lt==="u"||lt==="x"?parseInt(it.substring(2),16):it.charCodeAt(1))}function Qe(it){if(it<32)return(it<16?"\\x0":"\\x")+it.toString(16);var we=String.fromCharCode(it);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function Xe(it){var we=it.substring(1,it.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")),lt=[],nt=we[0]==="^",Le=["["];nt&&Le.push("^");for(var Fe=nt?1:0,ge=we.length;Fe<ge;++Fe){var de=we[Fe];if(/\\[bdsw]/i.test(de))Le.push(de);else{var fe=$e(de),ee;Fe+2<ge&&we[Fe+1]==="-"?(ee=$e(we[Fe+2]),Fe+=2):ee=fe,lt.push([fe,ee]),ee<65||fe>122||(ee<65||fe>90||lt.push([Math.max(65,fe)|32,Math.min(ee,90)|32]),ee<97||fe>122||lt.push([Math.max(97,fe)&~32,Math.min(ee,122)&~32]))}}lt.sort(function(me,Ee){return me[0]-Ee[0]||Ee[1]-me[1]});for(var te=[],ie=[],Fe=0;Fe<lt.length;++Fe){var ue=lt[Fe];ue[0]<=ie[1]+1?ie[1]=Math.max(ie[1],ue[1]):te.push(ie=ue)}for(var Fe=0;Fe<te.length;++Fe){var ue=te[Fe];Le.push(Qe(ue[0])),ue[1]>ue[0]&&(ue[1]+1>ue[0]&&Le.push("-"),Le.push(Qe(ue[1])))}return Le.push("]"),Le.join("")}function dt(it){for(var we=it.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")),lt=we.length,nt=[],Le=0,Fe=0;Le<lt;++Le){var ge=we[Le];if(ge==="(")++Fe;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Fe?nt[de]=-1:we[Le]=Qe(de))}}for(var Le=1;Le<nt.length;++Le)nt[Le]===-1&&(nt[Le]=++Ne);for(var Le=0,Fe=0;Le<lt;++Le){var ge=we[Le];if(ge==="(")++Fe,nt[Fe]||(we[Le]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Fe&&(we[Le]="\\"+nt[de])}}for(var Le=0;Le<lt;++Le)we[Le]==="^"&&we[Le+1]!=="^"&&(we[Le]="");if(it.ignoreCase&&We)for(var Le=0;Le<lt;++Le){var ge=we[Le],fe=ge.charAt(0);ge.length>=2&&fe==="["?we[Le]=Xe(ge):fe!=="\\"&&(we[Le]=ge.replace(/[a-zA-Z]/g,function(ie){var ue=ie.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return we.join("")}for(var et=[],je=0,_e=Ae.length;je<_e;++je){var Pe=Ae[je];if(Pe.global||Pe.multiline)throw new Error(""+Pe);et.push("(?:"+dt(Pe)+")")}return new RegExp(et.join("|"),ze?"gi":"g")}function U(Ae,Ne){var We=/(?:^|\s)nocode(?:\s|$)/,ze=[],je=0,_e=[],Pe=0;function Ke($e){var Qe=$e.nodeType;if(Qe==1){if(We.test($e.className))return;for(var Xe=$e.firstChild;Xe;Xe=Xe.nextSibling)Ke(Xe);var dt=$e.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(ze[Pe]=`
|
|
`,_e[Pe<<1]=je++,_e[Pe++<<1|1]=$e)}else if(Qe==3||Qe==4){var et=$e.nodeValue;et.length&&(Ne?et=et.replace(/\r\n?/g,`
|
|
`):et=et.replace(/[ \t\r\n]+/g," "),ze[Pe]=et,_e[Pe<<1]=je,je+=et.length,_e[Pe++<<1|1]=$e)}}return Ke(Ae),{sourceCode:ze.join("").replace(/\n$/,""),spans:_e}}function q(Ae,Ne,We,ze,je){if(!We)return;var _e={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:We,spans:null,basePos:Ne,decorations:null};ze(_e),je.push.apply(je,_e.decorations)}var ae=/\S/;function ce(Ae){for(var Ne=void 0,We=Ae.firstChild;We;We=We.nextSibling){var ze=We.nodeType;Ne=ze===1?Ne?Ae:We:ze===3&&ae.test(We.nodeValue)?Ae:Ne}return Ne===Ae?void 0:Ne}function ve(Ae,Ne){var We={},ze;(function(){for(var Pe=Ae.concat(Ne),Ke=[],$e={},Qe=0,Xe=Pe.length;Qe<Xe;++Qe){var dt=Pe[Qe],et=dt[3];if(et)for(var it=et.length;--it>=0;)We[et.charAt(it)]=dt;var we=dt[1],lt=""+we;$e.hasOwnProperty(lt)||(Ke.push(we),$e[lt]=null)}Ke.push(/[\0-\uffff]/),ze=z(Ke)})();var je=Ne.length,_e=function(Pe){for(var Ke=Pe.sourceCode,$e=Pe.basePos,Qe=Pe.sourceNode,Xe=[$e,a],dt=0,et=Ke.match(ze)||[],it={},we=0,lt=et.length;we<lt;++we){var nt=et[we],Le=it[nt],Fe=void 0,ge;if(typeof Le=="string")ge=!1;else{var de=We[nt.charAt(0)];if(de)Fe=nt.match(de[1]),Le=de[0];else{for(var fe=0;fe<je;++fe)if(de=Ne[fe],Fe=nt.match(de[1]),Fe){Le=de[0];break}Fe||(Le=a)}ge=Le.length>=5&&Le.substring(0,5)==="lang-",ge&&!(Fe&&typeof Fe[1]=="string")&&(ge=!1,Le=S),ge||(it[nt]=Le)}var ee=dt;if(dt+=nt.length,!ge)Xe.push($e+ee,Le);else{var te=Fe[1],ie=nt.indexOf(te),ue=ie+te.length;Fe[2]&&(ue=nt.length-Fe[2].length,ie=ue-te.length);var me=Le.substring(5);q(Qe,$e+ee,nt.substring(0,ie),_e,Xe),q(Qe,$e+ee+ie,te,oe(me,te),Xe),q(Qe,$e+ee+ue,nt.substring(ue),_e,Xe)}}Pe.decorations=Xe};return _e}function Oe(Ae){var Ne=[],We=[];Ae.tripleQuotedStrings?Ne.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Ne.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ne.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&We.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=Ae.hashComments;ze&&(Ae.cStyleComments?(ze>1?Ne.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ne.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),We.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ne.push([b,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(We.push([b,/^\/\/[^\r\n]*/,null]),We.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Ae.regexLiterals;if(je){var _e=je>1?"":`
|
|
\r`,Pe=_e?".":"[\\S\\s]",Ke="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";We.push(["lang-regex",RegExp("^"+Q+"("+Ke+")")])}var $e=Ae.types;$e&&We.push([f,$e]);var Qe=(""+Ae.keywords).replace(/^ | $/g,"");Qe.length&&We.push([k,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Ne.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(Xe+="(?!s*/)"),We.push([m,/^@[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],[m,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(Xe),null]),ve(Ne,We)}var xe=Oe({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(Ae,Ne,We){for(var ze=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,_e=Ae.ownerDocument,Pe=_e.createElement("li");Ae.firstChild;)Pe.appendChild(Ae.firstChild);var Ke=[Pe];function $e(we){var lt=we.nodeType;if(lt==1&&!ze.test(we.className))if(we.nodeName==="br")Qe(we),we.parentNode&&we.parentNode.removeChild(we);else for(var nt=we.firstChild;nt;nt=nt.nextSibling)$e(nt);else if((lt==3||lt==4)&&We){var Le=we.nodeValue,Fe=Le.match(je);if(Fe){var ge=Le.substring(0,Fe.index);we.nodeValue=ge;var de=Le.substring(Fe.index+Fe[0].length);if(de){var fe=we.parentNode;fe.insertBefore(_e.createTextNode(de),we.nextSibling)}Qe(we),ge||we.parentNode.removeChild(we)}}}function Qe(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function lt(Fe,ge){var de=ge?Fe.cloneNode(!1):Fe,fe=Fe.parentNode;if(fe){var ee=lt(fe,1),te=Fe.nextSibling;ee.appendChild(de);for(var ie=te;ie;ie=te)te=ie.nextSibling,ee.appendChild(ie)}return de}for(var nt=lt(we.nextSibling,0),Le;(Le=nt.parentNode)&&Le.nodeType===1;)nt=Le;Ke.push(nt)}for(var Xe=0;Xe<Ke.length;++Xe)$e(Ke[Xe]);Ne===(Ne|0)&&Ke[0].setAttribute("value",Ne);var dt=_e.createElement("ol");dt.className="linenums";for(var et=Math.max(0,Ne-1|0)||0,Xe=0,it=Ke.length;Xe<it;++Xe)Pe=Ke[Xe],Pe.className="L"+(Xe+et)%10,Pe.firstChild||Pe.appendChild(_e.createTextNode("\xA0")),dt.appendChild(Pe);Ae.appendChild(dt)}function Ce(Ae){var Ne=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ne=Ne&&+Ne[1]<=8;var We=/\n/g,ze=Ae.sourceCode,je=ze.length,_e=0,Pe=Ae.spans,Ke=Pe.length,$e=0,Qe=Ae.decorations,Xe=Qe.length,dt=0;Qe[Xe]=je;var et,it;for(it=et=0;it<Xe;)Qe[it]!==Qe[it+2]?(Qe[et++]=Qe[it++],Qe[et++]=Qe[it++]):it+=2;for(Xe=et,it=et=0;it<Xe;){for(var we=Qe[it],lt=Qe[it+1],nt=it+2;nt+2<=Xe&&Qe[nt+1]===lt;)nt+=2;Qe[et++]=we,Qe[et++]=lt,it=nt}Xe=Qe.length=et;var Le=Ae.sourceNode,Fe="";Le&&(Fe=Le.style.display,Le.style.display="none");try{for(var ge=null;$e<Ke;){var de=Pe[$e],fe=Pe[$e+2]||je,ee=Qe[dt+2]||je,nt=Math.min(fe,ee),te=Pe[$e+1],ie;if(te.nodeType!==1&&(ie=ze.substring(_e,nt))){Ne&&(ie=ie.replace(We,"\r")),te.nodeValue=ie;var ue=te.ownerDocument,me=ue.createElement("span");me.className=Qe[dt+1];var Ee=te.parentNode;Ee.replaceChild(me,te),me.appendChild(te),_e<fe&&(Pe[$e+1]=te=ue.createTextNode(ze.substring(nt,fe)),Ee.insertBefore(te,me.nextSibling))}_e=nt,_e>=fe&&($e+=2),_e>=ee&&(dt+=2)}}finally{Le&&(Le.style.display=Fe)}}var Se={};function pe(Ae,Ne){for(var We=Ne.length;--We>=0;){var ze=Ne[We];Se.hasOwnProperty(ze)?W.console&&console.warn("cannot override language handler %s",ze):Se[ze]=Ae}}function oe(Ae,Ne){return Ae&&Se.hasOwnProperty(Ae)||(Ae=/^\s*</.test(Ne)?"default-markup":"default-code"),Se[Ae]}pe(xe,["default-code"]),pe(ve([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\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"]),pe(ve([[a,/^[\s]+/,null,` \r
|
|
`],[G,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!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"]),pe(ve([],[[G,/^[\s\S]+/]]),["uq.val"]),pe(Oe({keywords:A,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),pe(Oe({keywords:"null,true,false"}),["json"]),pe(Oe({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),pe(Oe({keywords:R,cStyleComments:!0}),["java"]),pe(Oe({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(Oe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(Oe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(Oe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(Oe({keywords:T,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(Oe({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(ve([],[[p,/^[\s\S]+/]]),["regex"]);function De(Ae){var Ne=Ae.langExtension;try{var We=U(Ae.sourceNode,Ae.pre),ze=We.sourceCode;Ae.sourceCode=ze,Ae.spans=We.spans,Ae.basePos=0,oe(Ne,ze)(Ae),Ce(Ae)}catch(je){W.console&&console.log(je&&je.stack||je)}}function Ye(Ae,Ne,We){var ze=We||!1,je=Ne||null,_e=document.createElement("div");_e.innerHTML="<pre>"+Ae+"</pre>",_e=_e.firstChild,ze&&Te(_e,ze,!0);var Pe={langExtension:je,numberLines:ze,sourceNode:_e,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return De(Pe),_e.innerHTML}function Ge(Ae,Ne){var We=Ne||document.body,ze=We.ownerDocument||document;function je(de){return We.getElementsByTagName(de)}for(var _e=[je("pre"),je("code"),je("xmp")],Pe=[],Ke=0;Ke<_e.length;++Ke)for(var $e=0,Qe=_e[Ke].length;$e<Qe;++$e)Pe.push(_e[Ke][$e]);_e=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var dt=0,et=/\blang(?:uage)?-([\w.]+)(?!\S)/,it=/\bprettyprint\b/,we=/\bprettyprinted\b/,lt=/pre|xmp/i,nt=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Fe={};function ge(){for(var de=W.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;dt<Pe.length&&Xe.now()<de;dt++){for(var fe=Pe[dt],ee=Fe,te=fe;te=te.previousSibling;){var ie=te.nodeType,ue=(ie===7||ie===8)&&te.nodeValue;if(ue?!/^\??prettify\b/.test(ue):ie!==3||/\S/.test(te.nodeValue))break;if(ue){ee={},ue.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Xt,_t,Ir){ee[_t]=Ir});break}}var me=fe.className;if((ee!==Fe||it.test(me))&&!we.test(me)){for(var Ee=!1,Me=fe.parentNode;Me;Me=Me.parentNode){var rt=Me.tagName;if(Le.test(rt)&&Me.className&&it.test(Me.className)){Ee=!0;break}}if(!Ee){fe.className+=" prettyprinted";var mt=ee.lang;if(!mt){mt=me.match(et);var ct;!mt&&(ct=ce(fe))&&nt.test(ct.tagName)&&(mt=ct.className.match(et)),mt&&(mt=mt[1])}var Ct;if(lt.test(fe.tagName))Ct=1;else{var St=fe.currentStyle,st=ze.defaultView,Ft=St?St.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(fe,null).getPropertyValue("white-space"):0;Ct=Ft&&Ft.substring(0,3)==="pre"}var Ot=ee.linenums;(Ot=Ot==="true"||+Ot)||(Ot=me.match(/\blinenums\b(?::(\d+))?/),Ot=Ot?Ot[1]&&Ot[1].length?+Ot[1]:!0:!1),Ot&&Te(fe,Ot,Ct);var Zt={langExtension:mt,sourceNode:fe,numberLines:Ot,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};De(Zt)}}}dt<Pe.length?W.setTimeout(ge,250):typeof Ae=="function"&&Ae()}ge()}var tt=W.PR={createSimpleLexer:ve,registerLangHandler:pe,sourceDecorator:Oe,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:G,PR_COMMENT:b,PR_DECLARATION:v,PR_KEYWORD:k,PR_LITERAL:m,PR_NOCODE:V,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:S,PR_STRING:p,PR_TAG:x,PR_TYPE:f,prettyPrintOne:D?W.prettyPrintOne=Ye:P=Ye,prettyPrint:H=D?W.prettyPrint=Ge:H=Ge},qe=W.define;typeof qe=="function"&&qe.amd&&qe("google-code-prettify",[],function(){return tt})})()},"VrN/":function(wt,pt,se){(function(re,Z){wt.exports=Z()})(this,function(){"use strict";var re=navigator.userAgent,Z=navigator.platform,D=/gecko\/\d/i.test(re),Y=/MSIE \d/.test(re),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),P=/Edge\/(\d+)/.exec(re),H=Y||N||P,W=H&&(Y?document.documentMode||6:+(P||N)[1]),M=!P&&/WebKit\//.test(re),O=M&&/Qt\/\d+\.\d+/.test(re),y=!P&&/Chrome\//.test(re),A=/Opera\//.test(re),R=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),w=/PhantomJS/.test(re),T=!P&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),u=/Android/.test(re),o=T||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),l=T||/Mac/.test(Z),h=/\bCrOS\b/.test(re),C=/win/i.test(Z),g=A&&re.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(A=!1,M=!0);var p=l&&(O||A&&(g==null||g<12.11)),k=D||H&&W>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var i=e.className,r=b(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 m(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return m(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 E=0;E<t.length;++E)n.appendChild(t[E]);return n}function x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var v;document.createRange?v=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:v=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 S(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 I(){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 G(e,t){var i=e.className;b(t).test(i)||(e.className+=(i?" ":"")+t)}function V(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!b(i[r]).test(t)&&(t+=" "+i[r]);return t}var Q=function(e){e.select()};T?Q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(Q=function(e){try{e.select()}catch(t){}});function z(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function U(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 q(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,B=n||0;;){var K=e.indexOf(" ",E);if(K<0||K>=t)return B+(t-E);B+=K-E,B+=i-B%i,E=K+1}}var ae=function(){this.id=null,this.f=null,this.time=0,this.handler=z(this.onTimeout,this)};ae.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ae.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ce(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var ve=50,Oe={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},Te={origin:"*mouse"},Ce={origin:"+move"};function Se(e,t,i){for(var r=0,n=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var B=E-r;if(E==e.length||n+B>=t)return r+Math.min(B,t-n);if(n+=E-r,n+=i-n%i,r=E+1,n>=t)return r}}var pe=[""];function oe(e){for(;pe.length<=e;)pe.push(De(pe)+" ");return pe[e]}function De(e){return e[e.length-1]}function Ye(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Ge(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function tt(){}function qe(e,t){var i;return Object.create?i=Object.create(e):(tt.prototype=e,i=new tt),t&&U(t,i),i}var Ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ne(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function We(e,t){return t?t.source.indexOf("\\w")>-1&&Ne(e)?!0:t.test(e):Ne(e)}function ze(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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&&je.test(e)}function Pe(e,t,i){for(;(i<0?t>0:t<e.length)&&_e(e.charAt(t));)t+=i;return t}function Ke(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,E=r<0?Math.ceil(n):Math.floor(n);if(E==t)return e(E)?t:i;e(E)?i=E:t=E+r}}function $e(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,E=0;E<e.length;++E){var B=e[E];(B.from<i&&B.to>t||t==i&&B.to==t)&&(r(Math.max(B.from,t),Math.min(B.to,i),B.level==1?"rtl":"ltr",E),n=!0)}n||r(t,i,"ltr")}var Qe=null;function Xe(e,t,i){var r;Qe=null;for(var n=0;n<e.length;++n){var E=e[n];if(E.from<t&&E.to>t)return n;E.to==t&&(E.from!=E.to&&i=="before"?r=n:Qe=n),E.from==t&&(E.from!=E.to&&i!="before"?r=n:Qe=n)}return r!=null?r:Qe}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(J){return J<=247?e.charAt(J):1424<=J&&J<=1524?"R":1536<=J&&J<=1785?t.charAt(J-1536):1774<=J&&J<=2220?"r":8192<=J&&J<=8203?"w":J==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,E=/[LRr]/,B=/[Lb1n]/,K=/[1n]/;function X(J,ne,le){this.level=J,this.from=ne,this.to=le}return function(J,ne){var le=ne=="ltr"?"L":"R";if(J.length==0||ne=="ltr"&&!r.test(J))return!1;for(var be=J.length,ye=[],ke=0;ke<be;++ke)ye.push(i(J.charCodeAt(ke)));for(var Be=0,He=le;Be<be;++Be){var Ze=ye[Be];Ze=="m"?ye[Be]=He:He=Ze}for(var at=0,Je=le;at<be;++at){var ot=ye[at];ot=="1"&&Je=="r"?ye[at]="n":E.test(ot)&&(Je=ot,ot=="r"&&(ye[at]="R"))}for(var xt=1,gt=ye[0];xt<be-1;++xt){var At=ye[xt];At=="+"&>=="1"&&ye[xt+1]=="1"?ye[xt]="1":At==","&>==ye[xt+1]&&(gt=="1"||gt=="n")&&(ye[xt]=gt),gt=At}for(var zt=0;zt<be;++zt){var lr=ye[zt];if(lr==",")ye[zt]="N";else if(lr=="%"){var Yt=void 0;for(Yt=zt+1;Yt<be&&ye[Yt]=="%";++Yt);for(var Mr=zt&&ye[zt-1]=="!"||Yt<be&&ye[Yt]=="1"?"1":"N",kr=zt;kr<Yt;++kr)ye[kr]=Mr;zt=Yt-1}}for(var er=0,Dr=le;er<be;++er){var fr=ye[er];Dr=="L"&&fr=="1"?ye[er]="L":E.test(fr)&&(Dr=fr)}for(var ir=0;ir<be;++ir)if(n.test(ye[ir])){var tr=void 0;for(tr=ir+1;tr<be&&n.test(ye[tr]);++tr);for(var $t=(ir?ye[ir-1]:le)=="L",Rr=(tr<be?ye[tr]:le)=="L",un=$t==Rr?$t?"L":"R":le,Ri=ir;Ri<tr;++Ri)ye[Ri]=un;ir=tr-1}for(var xr=[],ai,ur=0;ur<be;)if(B.test(ye[ur])){var Va=ur;for(++ur;ur<be&&B.test(ye[ur]);++ur);xr.push(new X(0,Va,ur))}else{var di=ur,Hi=xr.length,Gi=ne=="rtl"?1:0;for(++ur;ur<be&&ye[ur]!="L";++ur);for(var Tr=di;Tr<ur;)if(K.test(ye[Tr])){di<Tr&&(xr.splice(Hi,0,new X(1,di,Tr)),Hi+=Gi);var hn=Tr;for(++Tr;Tr<ur&&K.test(ye[Tr]);++Tr);xr.splice(Hi,0,new X(2,hn,Tr)),Hi+=Gi,di=Tr}else++Tr;di<ur&&xr.splice(Hi,0,new X(1,di,ur))}return ne=="ltr"&&(xr[0].level==1&&(ai=J.match(/^\s+/))&&(xr[0].from=ai[0].length,xr.unshift(new X(0,0,ai[0].length))),De(xr).level==1&&(ai=J.match(/\s+$/))&&(De(xr).to-=ai[0].length,xr.push(new X(0,be-ai[0].length,be)))),ne=="rtl"?xr.reverse():xr}}();function et(e,t){var i=e.order;return i==null&&(i=e.order=dt(e.text,t)),i}var it=[],we=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]||it).concat(i)}};function lt(e,t){return e._handlers&&e._handlers[t]||it}function nt(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 E=ce(n,i);E>-1&&(r[t]=n.slice(0,E).concat(n.slice(E+1)))}}}function Le(e,t){var i=lt(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 Fe(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,i||t.type,e,t),ie(t)||t.codemirrorIgnore}function ge(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)ce(i,t[r])==-1&&i.push(t[r])}function de(e,t){return lt(e,t).length>0}function fe(e){e.prototype.on=function(t,i){we(this,t,i)},e.prototype.off=function(t,i){nt(this,t,i)}}function ee(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ie(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){ee(e),te(e)}function me(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(H&&W<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),rt;function mt(e){if(rt==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(rt=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&W<8))}var i=rt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ct;function Ct(e){if(ct!=null)return ct;var t=d(e,document.createTextNode("A\u062EA")),i=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return m(e),!i||i.left==i.right?!1:ct=r.right-i.right<3}var St=`
|
|
|
|
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 E=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),B=E.indexOf("\r");B!=-1?(i.push(E.slice(0,B)),t+=B+1):(i.push(E),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ft=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ot=null;function Zt(e){if(Ot!=null)return Ot;var t=d(e,a("span","x")),i=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Ot=Math.abs(i.left-r.left)>1}var Xt={},_t={};function Ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Xt[e]=t}function Kr(e,t){_t[e]=t}function bt(e){if(typeof e=="string"&&_t.hasOwnProperty(e))e=_t[e];else if(e&&typeof e.name=="string"&&_t.hasOwnProperty(e.name)){var t=_t[e.name];typeof t=="string"&&(t={name:t}),e=qe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Nr(e,t){t=bt(t);var i=Xt[t.name];if(!i)return Nr(e,"text/plain");var r=i(e,t);if(hr.hasOwnProperty(t.name)){var n=hr[t.name];for(var E in n){if(!n.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=n[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var B in t.modeProps)r[B]=t.modeProps[B];return r}var hr={};function pr(e,t){var i=hr.hasOwnProperty(e)?hr[e]:hr[e]={};U(t,i)}function Br(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 ci(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 qr(e,t,i){return e.startState?e.startState(t,i):!0}var It=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};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.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},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=q(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return q(this.string,null,this.tabSize)-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(B){return i?B.toLowerCase():B},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(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],E=n.chunkSize();if(t<E){i=n;break}t-=E}return i.lines[t]}function Hr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(E){var B=E.text;n==i.line&&(B=B.slice(0,i.ch)),n==t.line&&(B=B.slice(t.ch)),r.push(B),++n}),r}function ei(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function mr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function kt(e){if(e.parent==null)return null;for(var t=e.parent,i=ce(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 Fr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],E=n.height;if(t<E){e=n;continue e}t-=E,i+=n.chunkSize()}return i}while(!e.lines);for(var B=0;B<e.lines.length;++B){var K=e.lines[B],X=K.height;if(t<X)break;t-=X}return i+B}function Vr(e,t){return t>=e.first&&t<e.first+e.size}function fi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ue(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ue))return new Ue(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Et(e,t){return e.line-t.line||e.ch-t.ch}function pi(e,t){return e.sticky==t.sticky&&Et(e,t)==0}function mi(e){return Ue(e.line,e.ch)}function gi(e,t){return Et(e,t)<0?t:e}function vi(e,t){return Et(e,t)<0?e:t}function j(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ue(e.first,0);var i=e.first+e.size-1;return t.line>i?Ue(i,ut(e,i).text.length):c(t,ut(e,t.line).text.length)}function c(e,t){var i=e.ch;return i==null||i>t?Ue(e.line,t):i<0?Ue(e.line,0):e}function _(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var $=function(e,t){this.state=e,this.lookAhead=t},F=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};F.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},F.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}},F.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},F.fromSaved=function(e,t,i){return t instanceof $?new F(e,Br(e.mode,t.state),i,t.lookAhead):new F(e,Br(e.mode,t),i)},F.prototype.save=function(e){var t=e!==!1?Br(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new $(t,this.maxLookAhead):t};function he(e,t,i,r){var n=[e.state.modeGen],E={};gr(e,t.text,e.doc.mode,i,function(J,ne){return n.push(J,ne)},E,r);for(var B=i.state,K=function(J){i.baseTokens=n;var ne=e.state.overlays[J],le=1,be=0;i.state=!0,gr(e,t.text,ne.mode,i,function(ye,ke){for(var Be=le;be<ye;){var He=n[le];He>ye&&n.splice(le,1,ye,n[le+1],He),le+=2,be=Math.min(ye,He)}if(!ke)return;if(ne.opaque)n.splice(Be,le-Be,ye,"overlay "+ke),le=Be+2;else for(;Be<le;Be+=2){var Ze=n[Be+1];n[Be+1]=(Ze?Ze+" ":"")+"overlay "+ke}},E),i.state=B,i.baseTokens=null,i.baseTokenPos=1},X=0;X<e.state.overlays.length;++X)K(X);return{styles:n,classes:E.bgClass||E.textClass?E:null}}function Re(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ve(e,kt(t)),n=t.text.length>e.options.maxHighlightLength&&Br(e.doc.mode,r.state),E=he(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=E.styles,E.classes?t.styleClasses=E.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 Ve(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new F(r,!0,t);var E=vr(e,t,i),B=E>r.first&&ut(r,E-1).stateAfter,K=B?F.fromSaved(r,B,E):new F(r,qr(r.mode),E);return r.iter(E,t,function(X){ht(e,X.text,K);var J=K.line;X.stateAfter=J==t-1||J%5==0||J>=n.viewFrom&&J<n.viewTo?K.save():null,K.nextLine()}),i&&(r.modeFrontier=K.line),K}function ht(e,t,i,r){var n=e.doc.mode,E=new It(t,e.options.tabSize,i);for(E.start=E.pos=r||0,t==""&&Ie(n,i.state);!E.eol();)vt(n,E,i.state),E.start=E.pos}function Ie(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=ci(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function vt(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=ci(e,i).mode);var E=e.token(t,i);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var Nt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Kt(e,t,i,r){var n=e.doc,E=n.mode,B;t=s(n,t);var K=ut(n,t.line),X=Ve(e,t.line,i),J=new It(K.text,e.options.tabSize,X),ne;for(r&&(ne=[]);(r||J.pos<t.ch)&&!J.eol();)J.start=J.pos,B=vt(E,J,X.state),r&&ne.push(new Nt(J,B,Br(n.mode,X.state)));return r?ne:new Nt(J,B,X.state)}function _r(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 gr(e,t,i,r,n,E,B){var K=i.flattenSpans;K==null&&(K=e.options.flattenSpans);var X=0,J=null,ne=new It(t,e.options.tabSize,r),le,be=e.options.addModeClass&&[null];for(t==""&&_r(Ie(i,r.state),E);!ne.eol();){if(ne.pos>e.options.maxHighlightLength?(K=!1,B&&ht(e,t,r,ne.pos),ne.pos=t.length,le=null):le=_r(vt(i,ne,r.state,be),E),be){var ye=be[0].name;ye&&(le="m-"+(le?ye+" "+le:ye))}if(!K||J!=le){for(;X<ne.start;)X=Math.min(ne.start,X+5e3),n(X,J);J=le}ne.start=ne.pos}for(;X<ne.pos;){var ke=Math.min(ne.pos,X+5e3);n(ke,J),X=ke}}function vr(e,t,i){for(var r,n,E=e.doc,B=i?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>B;--K){if(K<=E.first)return E.first;var X=ut(E,K-1),J=X.stateAfter;if(J&&(!i||K+(J instanceof $?J.lookAhead:0)<=E.modeFrontier))return K;var ne=q(X.text,null,e.options.tabSize);(n==null||r>ne)&&(n=K-1,r=ne)}return n}function Xr(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=ut(e,r).stateAfter;if(n&&(!(n instanceof $)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var _i=!1,nr=!1;function Ur(){_i=!0}function oi(){nr=!0}function si(e,t,i){this.marker=e,this.from=t,this.to=i}function Or(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Oi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function yi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var E=e[n],B=E.marker,K=E.from==null||(B.inclusiveLeft?E.from<=t:E.from<t);if(K||E.from==t&&B.type=="bookmark"&&(!i||!E.marker.insertLeft)){var X=E.to==null||(B.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new si(B,E.from,X?null:E.to))}}return r}function Ki(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var E=e[n],B=E.marker,K=E.to==null||(B.inclusiveRight?E.to>=t:E.to>t);if(K||E.from==t&&B.type=="bookmark"&&(!i||E.marker.insertLeft)){var X=E.from==null||(B.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new si(B,X?null:E.from-t,E.to==null?null:E.to-t))}}return r}function Yr(e,t){if(t.full)return null;var i=Vr(e,t.from.line)&&ut(e,t.from.line).markedSpans,r=Vr(e,t.to.line)&&ut(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,E=t.to.ch,B=Et(t.from,t.to)==0,K=zi(i,n,B),X=Ki(r,E,B),J=t.text.length==1,ne=De(t.text).length+(J?n:0);if(K)for(var le=0;le<K.length;++le){var be=K[le];if(be.to==null){var ye=Or(X,be.marker);ye?J&&(be.to=ye.to==null?null:ye.to+ne):be.to=n}}if(X)for(var ke=0;ke<X.length;++ke){var Be=X[ke];if(Be.to!=null&&(Be.to+=ne),Be.from==null){var He=Or(K,Be.marker);He||(Be.from=ne,J&&(K||(K=[])).push(Be))}else Be.from+=ne,J&&(K||(K=[])).push(Be)}K&&(K=Gr(K)),X&&X!=K&&(X=Gr(X));var Ze=[K];if(!J){var at=t.text.length-2,Je;if(at>0&&K)for(var ot=0;ot<K.length;++ot)K[ot].to==null&&(Je||(Je=[])).push(new si(K[ot].marker,null,null));for(var xt=0;xt<at;++xt)Ze.push(Je);Ze.push(X)}return Ze}function Gr(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 bi(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(ye){if(ye.markedSpans)for(var ke=0;ke<ye.markedSpans.length;++ke){var Be=ye.markedSpans[ke].marker;Be.readOnly&&(!r||ce(r,Be)==-1)&&(r||(r=[])).push(Be)}}),!r)return null;for(var n=[{from:t,to:i}],E=0;E<r.length;++E)for(var B=r[E],K=B.find(0),X=0;X<n.length;++X){var J=n[X];if(Et(J.to,K.from)<0||Et(J.from,K.to)>0)continue;var ne=[X,1],le=Et(J.from,K.from),be=Et(J.to,K.to);(le<0||!B.inclusiveLeft&&!le)&&ne.push({from:J.from,to:K.from}),(be>0||!B.inclusiveRight&&!be)&&ne.push({from:K.to,to:J.to}),n.splice.apply(n,ne),X+=ne.length-3}return n}function dn(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 xi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Jt(e){return e.inclusiveLeft?-1:0}function Bt(e){return e.inclusiveRight?1:0}function dr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),E=Et(r.from,n.from)||Jt(e)-Jt(t);if(E)return-E;var B=Et(r.to,n.to)||Bt(e)-Bt(t);return B||t.id-e.id}function Dt(e,t){var i=nr&&e.markedSpans,r;if(i)for(var n=void 0,E=0;E<i.length;++E)n=i[E],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||dr(r,n.marker)<0)&&(r=n.marker);return r}function qt(e){return Dt(e,!0)}function Wt(e){return Dt(e,!1)}function ti(e,t){var i=nr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var E=i[n];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||dr(r,E.marker)<0)&&(r=E.marker)}return r}function ar(e,t,i,r,n){var E=ut(e,t),B=nr&&E.markedSpans;if(B)for(var K=0;K<B.length;++K){var X=B[K];if(!X.marker.collapsed)continue;var J=X.marker.find(0),ne=Et(J.from,i)||Jt(X.marker)-Jt(n),le=Et(J.to,r)||Bt(X.marker)-Bt(n);if(ne>=0&&le<=0||ne<=0&&le>=0)continue;if(ne<=0&&(X.marker.inclusiveRight&&n.inclusiveLeft?Et(J.to,i)>=0:Et(J.to,i)>0)||ne>=0&&(X.marker.inclusiveRight&&n.inclusiveLeft?Et(J.from,r)<=0:Et(J.from,r)<0))return!0}}function Er(e){for(var t;t=qt(e);)e=t.find(-1,!0).line;return e}function Vi(e){for(var t;t=Wt(e);)e=t.find(1,!0).line;return e}function Ei(e){for(var t,i;t=Wt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function cn(e,t){var i=ut(e,t),r=Er(i);return i==r?t:kt(r)}function Si(e,t){if(t>e.lastLine())return t;var i=ut(e,t),r;if(!ri(e,i))return t;for(;r=Wt(i);)i=r.find(1,!0).line;return kt(i)+1}function ri(e,t){var i=nr&&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&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Or(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,E=0;E<t.markedSpans.length;++E)if(n=t.markedSpans[E],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function $r(e){e=Er(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 E=i.parent;E;i=E,E=i.parent)for(var B=0;B<E.children.length;++B){var K=E.children[B];if(K==i)break;t+=K.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=qt(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Wt(r);){var E=i.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=ut(i,i.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=pn(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Pi=function(e,t,i){this.text=e,xi(this,t),this.height=i?i(this):1};Pi.prototype.lineNo=function(){return kt(this)},fe(Pi);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),dn(e),xi(e,i);var n=r?r(e):1;n!=e.height&&mr(e,n)}function ft(e){e.parent=null,dn(e)}var Tt={},yt={};function Lt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?yt:Tt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Mt(e,t){var i=x("span",null,null,M?"padding-right: .1px":null),r={pre:x("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 E=n?t.rest[n-1]:t.line,B=void 0;r.pos=0,r.addToken=Pt,Ct(e.display.measure)&&(B=et(E,e.doc.direction))&&(r.addToken=Cr(r.addToken,B)),r.map=[];var K=t!=e.display.externalMeasured&&kt(E);li(E,r,Re(e,E,K)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=V(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=V(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(mt(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(M){var X=r.content.lastChild;(/\bcm-tab\b/.test(X.className)||X.querySelector&&X.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=V(r.pre.className,r.textClass||"")),r}function Gt(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 Pt(e,t,i,r,n,E,B){if(!t)return;var K=e.splitSpaces?rr(t,e.trailingSpace):t,X=e.cm.state.specialChars,J=!1,ne;if(!X.test(t))e.col+=t.length,ne=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ne),H&&W<9&&(J=!0),e.pos+=t.length;else{ne=document.createDocumentFragment();for(var le=0;;){X.lastIndex=le;var be=X.exec(t),ye=be?be.index-le:t.length-le;if(ye){var ke=document.createTextNode(K.slice(le,le+ye));H&&W<9?ne.appendChild(a("span",[ke])):ne.appendChild(ke),e.map.push(e.pos,e.pos+ye,ke),e.col+=ye,e.pos+=ye}if(!be)break;le+=ye+1;var Be=void 0;if(be[0]==" "){var He=e.cm.options.tabSize,Ze=He-e.col%He;Be=ne.appendChild(a("span",oe(Ze),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=Ze}else be[0]=="\r"||be[0]==`
|
|
`?(Be=ne.appendChild(a("span",be[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",be[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(be[0]),Be.setAttribute("cm-text",be[0]),H&&W<9?ne.appendChild(a("span",[Be])):ne.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,i||r||n||J||E||B){var at=i||"";r&&(at+=r),n&&(at+=n);var Je=a("span",[ne],at,E);if(B)for(var ot in B)B.hasOwnProperty(ot)&&ot!="style"&&ot!="class"&&Je.setAttribute(ot,B[ot]);return e.content.appendChild(Je)}e.content.appendChild(ne)}function rr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var E=e.charAt(n);E==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(E="\xA0"),r+=E,i=E==" "}return r}function Cr(e,t){return function(i,r,n,E,B,K,X){n=n?n+" cm-force-border":"cm-force-border";for(var J=i.pos,ne=J+r.length;;){for(var le=void 0,be=0;be<t.length&&!(le=t[be],le.to>J&&le.from<=J);be++);if(le.to>=ne)return e(i,r,n,E,B,K,X);e(i,r.slice(0,le.to-J),n,E,null,K,X),E=null,r=r.slice(le.to-J),J=le.to}}}function Rt(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 li(e,t,i){var r=e.markedSpans,n=e.text,E=0;if(!r){for(var B=1;B<i.length;B+=2)t.addToken(t,n.slice(E,E=i[B]),Lt(i[B+1],t.cm.options));return}for(var K=n.length,X=0,J=1,ne="",le,be,ye=0,ke,Be,He,Ze,at;;){if(ye==X){ke=Be=He=be="",at=null,Ze=null,ye=Infinity;for(var Je=[],ot=void 0,xt=0;xt<r.length;++xt){var gt=r[xt],At=gt.marker;if(At.type=="bookmark"&>.from==X&&At.widgetNode)Je.push(At);else if(gt.from<=X&&(gt.to==null||gt.to>X||At.collapsed&>.to==X&>.from==X)){if(gt.to!=null&>.to!=X&&ye>gt.to&&(ye=gt.to,Be=""),At.className&&(ke+=" "+At.className),At.css&&(be=(be?be+";":"")+At.css),At.startStyle&>.from==X&&(He+=" "+At.startStyle),At.endStyle&>.to==ye&&(ot||(ot=[])).push(At.endStyle,gt.to),At.title&&((at||(at={})).title=At.title),At.attributes)for(var zt in At.attributes)(at||(at={}))[zt]=At.attributes[zt];At.collapsed&&(!Ze||dr(Ze.marker,At)<0)&&(Ze=gt)}else gt.from>X&&ye>gt.from&&(ye=gt.from)}if(ot)for(var lr=0;lr<ot.length;lr+=2)ot[lr+1]==ye&&(Be+=" "+ot[lr]);if(!Ze||Ze.from==X)for(var Yt=0;Yt<Je.length;++Yt)Rt(t,0,Je[Yt]);if(Ze&&(Ze.from||0)==X){if(Rt(t,(Ze.to==null?K+1:Ze.to)-X,Ze.marker,Ze.from==null),Ze.to==null)return;Ze.to==X&&(Ze=!1)}}if(X>=K)break;for(var Mr=Math.min(K,ye);;){if(ne){var kr=X+ne.length;if(!Ze){var er=kr>Mr?ne.slice(0,Mr-X):ne;t.addToken(t,er,le?le+ke:ke,He,X+er.length==ye?Be:"",be,at)}if(kr>=Mr){ne=ne.slice(Mr-X),X=Mr;break}X=kr,He=""}ne=n.slice(E,E=i[J++]),le=Lt(i[J++],t.cm.options)}}}function Ut(e,t,i){this.line=t,this.rest=Ei(t),this.size=this.rest?kt(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ri(e,t)}function wr(e,t,i){for(var r=[],n,E=t;E<i;E=n){var B=new Ut(e.doc,ut(e.doc,E),E);n=E+B.size,r.push(B)}return r}var yr=null;function zr(e){yr?yr.ops.push(e):e.ownsGroup=yr={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 _s(e,t){var i=e.ownsGroup;if(!i)return;try{Rs(i)}finally{yr=null,t(i)}}var mn=null;function cr(e,t){var i=lt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;yr?n=yr.delayedCallbacks:mn?n=mn:(n=mn=[],setTimeout(Os,0));for(var E=function(K){n.push(function(){return i[K].apply(null,r)})},B=0;B<i.length;++B)E(B)}function Os(){var e=mn;mn=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 E=t.changes[n];E=="text"?Ms(e,t):E=="gutter"?Za(e,t,i,r):E=="class"?ha(e,t):E=="widget"&&Is(e,t,r)}t.changes=null}function gn(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),H&&W<8&&(e.node.style.zIndex=2)),e.node}function Ps(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=gn(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):Mt(e,t)}function Ms(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){Ps(e,t),t.line.wrapClass?gn(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=gn(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 E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var B=gn(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),B.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",fi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var X=0;X<e.display.gutterSpecs.length;++X){var J=e.display.gutterSpecs[X].className,ne=E.hasOwnProperty(J)&&E[J];ne&&K.appendChild(a("div",[ne],"CodeMirror-gutter-elt","left: "+r.gutterLeft[J]+"px; width: "+r.gutterWidth[J]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,E=void 0;n;n=E)E=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 E=gn(i),B=0,K=t.widgets;B<K.length;++B){var X=K[B],J=a("div",[X.node],"CodeMirror-linewidget"+(X.className?" "+X.className:""));X.handleMouseEvents||J.setAttribute("cm-ignore-events","true"),Bs(X,J,i,r),e.display.input.setUneditable(J),n&&X.above?E.insertBefore(J,i.gutter||i.text):E.appendChild(J),cr(X,"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 vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(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 ui(e,t){for(var i=me(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 Wn(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 ii(e){return ve-e.display.nativeBarWidth}function Mi(e){return e.display.scroller.clientWidth-ii(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-ii(e)-e.display.barHeight}function Fs(e,t,i){var r=e.options.lineWrapping,n=r&&Mi(e);if(!t.measure.heights||r&&t.measure.width!=n){var E=t.measure.heights=[];if(r){t.measure.width=n;for(var B=t.text.firstChild.getClientRects(),K=0;K<B.length-1;K++){var X=B[K],J=B[K+1];Math.abs(X.bottom-J.bottom)>2&&E.push((X.bottom+J.top)/2-i.top)}}E.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(kt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=Er(t);var i=kt(t),r=e.display.externalMeasured=new Ut(e.doc,t,i);r.lineN=i;var n=r.built=Mt(e,r);return r.text=n.pre,d(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return ni(e,Xi(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Bi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=kt(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 ni(e,t,i,r,n){t.before&&(i=-1);var E=i+(r||""),B;return t.cache.hasOwnProperty(E)?B=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),B=Ws(e,t,i,r),B.bogus||(t.cache[E]=B)),{left:B.left,right:B.right,top:n?B.rtop:B.top,bottom:n?B.rbottom:B.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,E,B,K,X,J=0;J<e.length;J+=3)if(K=e[J],X=e[J+1],t<K?(n=0,E=1,B="left"):t<X?(n=t-K,E=n+1):(J==e.length-3||t==X&&e[J+3]>t)&&(E=X-K,n=E-1,t>=X&&(B="right")),n!=null){if(r=e[J+2],K==X&&i==(r.insertLeft?"left":"right")&&(B=i),i=="left"&&n==0)for(;J&&e[J-2]==e[J-3]&&e[J-1].insertLeft;)r=e[(J-=3)+2],B="left";if(i=="right"&&n==X-K)for(;J<e.length-3&&e[J+3]==e[J+4]&&!e[J+5].insertLeft;)r=e[(J+=3)+2],B="right";break}return{node:r,start:n,end:E,collapse:B,coverStart:K,coverEnd:X}}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),E=n.node,B=n.start,K=n.end,X=n.collapse,J;if(E.nodeType==3){for(var ne=0;ne<4;ne++){for(;B&&_e(t.line.text.charAt(n.coverStart+B));)--B;for(;n.coverStart+K<n.coverEnd&&_e(t.line.text.charAt(n.coverStart+K));)++K;if(H&&W<9&&B==0&&K==n.coverEnd-n.coverStart?J=E.parentNode.getBoundingClientRect():J=js(v(E,B,K).getClientRects(),r),J.left||J.right||B==0)break;K=B,B=B-1,X="right"}H&&W<11&&(J=Hs(e.display.measure,J))}else{B>0&&(X=r="right");var le;e.options.lineWrapping&&(le=E.getClientRects()).length>1?J=le[r=="right"?le.length-1:0]:J=E.getBoundingClientRect()}if(H&&W<9&&!B&&(!J||!J.left&&!J.right)){var be=E.parentNode.getClientRects()[0];be?J={left:be.left,right:be.left+$i(e.display),top:be.top,bottom:be.bottom}:J=ro}for(var ye=J.top-t.rect.top,ke=J.bottom-t.rect.top,Be=(ye+ke)/2,He=t.view.measure.heights,Ze=0;Ze<He.length-1&&!(Be<He[Ze]);Ze++);var at=Ze?He[Ze-1]:0,Je=He[Ze],ot={left:(X=="right"?J.right:J.left)-t.rect.left,right:(X=="left"?J.left:J.right)-t.rect.left,top:at,bottom:Je};return!J.left&&!J.right&&(ot.bogus=!0),e.options.singleCursorHeightPerLine||(ot.rtop=ye,ot.rbottom=ke),ot}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Zt(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,m(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function yn(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&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&u?-(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+=vn(e.widgets[i]));return t}function Hn(e,t,i,r,n){if(!n){var E=pa(t);i.top+=E,i.bottom+=E}if(r=="line")return i;r||(r="local");var B=$r(t);if(r=="local"?B+=Wn(e.display):B-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();B+=K.top+(r=="window"?0:so());var X=K.left+(r=="window"?0:oo());i.left+=X,i.right+=X}return i.top+=B,i.bottom+=B,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 E=e.display.sizer.getBoundingClientRect();r+=E.left,n+=E.top}var B=e.display.lineSpace.getBoundingClientRect();return{left:r-B.left,top:n-B.top}}function ma(e,t,i,r,n){return r||(r=ut(e.doc,t.line)),Hn(e,r,to(e,r,t.ch,n),i)}function Zr(e,t,i,r,n,E){r=r||ut(e.doc,t.line),n||(n=Xi(e,r));function B(ke,Be){var He=ni(e,n,ke,Be?"right":"left",E);return Be?He.left=He.right:He.right=He.left,Hn(e,r,He,i)}var K=et(r,e.doc.direction),X=t.ch,J=t.sticky;if(X>=r.text.length?(X=r.text.length,J="before"):X<=0&&(X=0,J="after"),!K)return B(J=="before"?X-1:X,J=="before");function ne(ke,Be,He){var Ze=K[Be],at=Ze.level==1;return B(He?ke-1:ke,at!=He)}var le=Xe(K,X,J),be=Qe,ye=ne(X,le,J=="before");return be!=null&&(ye.other=ne(X,be,J!="before")),ye}function uo(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=ut(e.doc,t.line),n=$r(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var E=Ue(e,t,i);return E.xRel=n,r&&(E.outside=r),E}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=Fr(r,i),E=r.first+r.size-1;if(n>E)return ga(r.first+r.size-1,ut(r,E).text.length,null,1,1);t<0&&(t=0);for(var B=ut(r,n);;){var K=Gs(e,B,n,t,i),X=ti(B,K.ch+(K.xRel>0||K.outside>0?1:0));if(!X)return K;var J=X.find(1);if(J.line==n)return J;B=ut(r,n=J.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,E=Ke(function(B){return ni(e,i,B-1).bottom<=r},n,0);return n=Ke(function(B){return ni(e,i,B).top>r},E,n),{begin:E,end:n}}function co(e,t,i,r){i||(i=Xi(e,t));var n=Hn(e,t,ni(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-=$r(t);var E=Xi(e,t),B=pa(t),K=0,X=t.text.length,J=!0,ne=et(t,e.doc.direction);if(ne){var le=(e.options.lineWrapping?Ks:zs)(e,t,i,E,ne,r,n);J=le.level!=1,K=J?le.from:le.to-1,X=J?le.to:le.from-1}var be=null,ye=null,ke=Ke(function(xt){var gt=ni(e,E,xt);return gt.top+=B,gt.bottom+=B,ya(gt,r,n,!1)?(gt.top<=n&>.left<=r&&(be=xt,ye=gt),!0):!1},K,X),Be,He,Ze=!1;if(ye){var at=r-ye.left<ye.right-r,Je=at==J;ke=be+(Je?0:1),He=Je?"after":"before",Be=at?ye.left:ye.right}else{!J&&(ke==X||ke==K)&&ke++,He=ke==0?"after":ke==t.text.length?"before":ni(e,E,ke-(J?1:0)).bottom+B<=n==J?"after":"before";var ot=Zr(e,Ue(i,ke,He),"line",t,E);Be=ot.left,Ze=n<ot.top?-1:n>=ot.bottom?1:0}return ke=Pe(t.text,ke,1),ga(i,ke,He,Ze,r-Be)}function zs(e,t,i,r,n,E,B){var K=Ke(function(le){var be=n[le],ye=be.level!=1;return ya(Zr(e,Ue(i,ye?be.to:be.from,ye?"before":"after"),"line",t,r),E,B,!0)},0,n.length-1),X=n[K];if(K>0){var J=X.level!=1,ne=Zr(e,Ue(i,J?X.from:X.to,J?"after":"before"),"line",t,r);ya(ne,E,B,!0)&&ne.top>B&&(X=n[K-1])}return X}function Ks(e,t,i,r,n,E,B){var K=ho(e,t,r,B),X=K.begin,J=K.end;/\s/.test(t.text.charAt(J-1))&&J--;for(var ne=null,le=null,be=0;be<n.length;be++){var ye=n[be];if(ye.from>=J||ye.to<=X)continue;var ke=ye.level!=1,Be=ni(e,r,ke?Math.min(J,ye.to)-1:Math.max(X,ye.from)).right,He=Be<E?E-Be+1e9:Be-E;(!ne||le>He)&&(ne=ye,le=He)}return ne||(ne=n[n.length-1]),ne.from<X&&(ne={from:X,to:ne.to,level:ne.level}),ne.to>J&&(ne={from:ne.from,to:J,level:ne.level}),ne}var Ii;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ii==null){Ii=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ii.appendChild(document.createTextNode("x")),Ii.appendChild(a("br"));Ii.appendChild(document.createTextNode("x"))}d(e.measure,Ii);var i=Ii.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),m(e.measure),i||1}function $i(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,E=t.gutters.firstChild,B=0;E;E=E.nextSibling,++B){var K=e.display.gutterSpecs[B].className;i[K]=E.offsetLeft+E.clientLeft+n,r[K]=E.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=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(ri(e.doc,n))return 0;var E=0;if(n.widgets)for(var B=0;B<n.widgets.length;B++)n.widgets[B].height&&(E+=n.widgets[B].height);return i?E+(Math.ceil(n.text.length/r)||1)*t:E+t}}function Ea(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&mr(r,n)})}function Ni(e,t,i,r){var n=e.display;if(!i&&me(t).getAttribute("cm-not-content")=="true")return null;var E,B,K=n.lineSpace.getBoundingClientRect();try{E=t.clientX-K.left,B=t.clientY-K.top}catch(le){return null}var X=va(e,E,B),J;if(r&&X.xRel>0&&(J=ut(e.doc,X.line).text).length==X.ch){var ne=q(J,J.length,e.options.tabSize)-J.length;X=Ue(X.line,Math.max(0,Math.round((E-qa(e.display).left)/$i(e.display))-ne))}return X}function Bi(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 Ar(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)nr&&cn(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)nr&&Si(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var E=Gn(e,i,i+r,1);E?(n.view=n.view.slice(E.index),n.viewFrom=E.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var B=Gn(e,t,t,-1);B?(n.view=n.view.slice(0,B.index),n.viewTo=B.lineN):Ci(e)}else{var K=Gn(e,t,t,-1),X=Gn(e,i,i+r,1);K&&X?(n.view=n.view.slice(0,K.index).concat(wr(e,K.lineN,X.lineN)).concat(n.view.slice(X.index)),n.viewTo+=r):Ci(e)}var J=n.externalMeasured;J&&(i<J.lineN?J.lineN+=r:t<J.lineN+J.size&&(n.externalMeasured=null))}function Ti(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 E=r.view[Bi(e,t)];if(E.node==null)return;var B=E.changes||(E.changes=[]);ce(B,i)==-1&&B.push(i)}function Ci(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,i,r){var n=Bi(e,t),E,B=e.display.view;if(!nr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var K=e.display.viewFrom,X=0;X<n;X++)K+=B[X].size;if(K!=t){if(r>0){if(n==B.length-1)return null;E=K+B[n].size-t,n++}else E=K-t;t+=E,i+=E}for(;cn(e.doc,i)!=i;){if(n==(r<0?0:B.length-1))return null;i+=r*B[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=wr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=wr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Bi(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(wr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Bi(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 bn(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(),E=r.selection=document.createDocumentFragment(),B=0;B<i.sel.ranges.length;B++){if(!t&&B==i.sel.primIndex)continue;var K=i.sel.ranges[B];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var X=K.empty();(X||e.options.showCursorWhenSelecting)&&go(e,K.head,n),X||Xs(e,K,E)}return r}function go(e,t,i){var r=Zr(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 E=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,E=document.createDocumentFragment(),B=qa(e.display),K=B.left,X=Math.max(r.sizerWidth,Mi(e)-r.sizer.offsetLeft)-B.right,J=n.direction=="ltr";function ne(Je,ot,xt,gt){ot<0&&(ot=0),ot=Math.round(ot),gt=Math.round(gt),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
|
|
top: `+ot+"px; width: "+(xt==null?X-Je:xt)+`px;
|
|
height: `+(gt-ot)+"px"))}function le(Je,ot,xt){var gt=ut(n,Je),At=gt.text.length,zt,lr;function Yt(er,Dr){return ma(e,Ue(Je,er),"div",gt,Dr)}function Mr(er,Dr,fr){var ir=co(e,gt,null,er),tr=Dr=="ltr"==(fr=="after")?"left":"right",$t=fr=="after"?ir.begin:ir.end-(/\s/.test(gt.text.charAt(ir.end-1))?2:1);return Yt($t,tr)[tr]}var kr=et(gt,n.direction);return $e(kr,ot||0,xt==null?At:xt,function(er,Dr,fr,ir){var tr=fr=="ltr",$t=Yt(er,tr?"left":"right"),Rr=Yt(Dr-1,tr?"right":"left"),un=ot==null&&er==0,Ri=xt==null&&Dr==At,xr=ir==0,ai=!kr||ir==kr.length-1;if(Rr.top-$t.top<=3){var ur=(J?un:Ri)&&xr,Va=(J?Ri:un)&&ai,di=ur?K:(tr?$t:Rr).left,Hi=Va?X:(tr?Rr:$t).right;ne(di,$t.top,Hi-di,$t.bottom)}else{var Gi,Tr,hn,Xa;tr?(Gi=J&&un&&xr?K:$t.left,Tr=J?X:Mr(er,fr,"before"),hn=J?K:Mr(Dr,fr,"after"),Xa=J&&Ri&&ai?X:Rr.right):(Gi=J?Mr(er,fr,"before"):K,Tr=!J&&un&&xr?X:$t.right,hn=!J&&Ri&&ai?K:Rr.left,Xa=J?Mr(Dr,fr,"after"):X),ne(Gi,$t.top,Tr-Gi,$t.bottom),$t.bottom<Rr.top&&ne(K,$t.bottom,null,Rr.top),ne(hn,Rr.top,Xa-hn,Rr.bottom)}(!zt||zn($t,zt)<0)&&(zt=$t),zn(Rr,zt)<0&&(zt=Rr),(!lr||zn($t,lr)<0)&&(lr=$t),zn(Rr,lr)<0&&(lr=Rr)}),{start:zt,end:lr}}var be=t.from(),ye=t.to();if(be.line==ye.line)le(be.line,be.ch,ye.ch);else{var ke=ut(n,be.line),Be=ut(n,ye.line),He=Er(ke)==Er(Be),Ze=le(be.line,be.ch,He?ke.text.length+1:null).end,at=le(ye.line,He?0:null,ye.ch).start;He&&(Ze.top<at.top-2?(ne(Ze.right,Ze.top,null,Ze.bottom),ne(K,at.top,at.left,at.bottom)):ne(Ze.right,Ze.top,at.left-Ze.right,Ze.bottom)),Ze.bottom<at.top&&ne(K,Ze.bottom,null,at.top)}i.appendChild(E)}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()||Zi(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,Zi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,G(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(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 Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],E=e.options.lineWrapping,B=void 0,K=0;if(n.hidden)continue;if(H&&W<8){var X=n.node.offsetTop+n.node.offsetHeight;B=X-i,i=X}else{var J=n.node.getBoundingClientRect();B=J.bottom-J.top,!E&&n.text.firstChild&&(K=n.text.firstChild.getBoundingClientRect().right-J.left-1)}var ne=n.line.height-B;if((ne>.005||ne<-.005)&&(mr(n.line,B),bo(n.line),n.rest))for(var le=0;le<n.rest.length;le++)bo(n.rest[le]);if(K>e.display.sizerWidth){var be=Math.ceil(K/$i(e.display));be>e.display.maxLineLength&&(e.display.maxLineLength=be,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 Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,E=Fr(t,r),B=Fr(t,n);if(i&&i.ensure){var K=i.ensure.from.line,X=i.ensure.to.line;K<E?(E=K,B=Fr(t,$r(ut(t,K))+e.wrapper.clientHeight)):Math.min(X,t.lastLine())>=B&&(E=Fr(t,$r(ut(t,X))-e.wrapper.clientHeight),B=X)}return{from:E,to:Math.max(B,E+1)}}function Ys(e,t){if(Fe(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&&!w){var E=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+ii(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(n),e.display.lineSpace.removeChild(E)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ue(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ue(t.line,t.ch+1,"before"):t);for(var E=0;E<5;E++){var B=!1,K=Zr(e,t),X=!i||i==t?K:Zr(e,i);n={left:Math.min(K.left,X.left),top:Math.min(K.top,X.top)-r,right:Math.max(K.left,X.left),bottom:Math.max(K.bottom,X.bottom)+r};var J=Ca(e,n),ne=e.doc.scrollTop,le=e.doc.scrollLeft;if(J.scrollTop!=null&&(En(e,J.scrollTop),Math.abs(e.doc.scrollTop-ne)>1&&(B=!0)),J.scrollLeft!=null&&(Fi(e,J.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(B=!0)),!B)break}return n}function Zs(e,t){var i=Ca(e,t);i.scrollTop!=null&&En(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function Ca(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,E=ca(e),B={};t.bottom-t.top>E&&(t.bottom=t.top+E);var K=e.doc.height+da(i),X=t.top<r,J=t.bottom>K-r;if(t.top<n)B.scrollTop=X?0:t.top;else if(t.bottom>n+E){var ne=Math.min(t.top,(J?K:t.bottom)-E);ne!=n&&(B.scrollTop=ne)}var le=e.options.fixedGutter?0:i.gutters.offsetWidth,be=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-le,ye=Mi(e)-i.gutters.offsetWidth,ke=t.right-t.left>ye;return ke&&(t.right=t.left+ye),t.left<10?B.scrollLeft=0:t.left<be?B.scrollLeft=Math.max(0,t.left+le-(ke?0:10)):t.right>ye+be-3&&(B.scrollLeft=t.right+(ke?0:10)-ye),B}function wa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xn(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(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});xn(e,n.scrollLeft,n.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||La(e,{top:t}),Eo(e,t,!0),D&&La(e),Cn(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 Sn(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+ii(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Ui=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),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ui.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 E=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"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}},Ui.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ui.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ui.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ae,this.disableVert=new ae},Ui.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),E=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Ui.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Qi(e,t){t||(t=Sn(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&&Kn(e),So(e,Sn(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:Ui,null:Tn};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),we(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):En(e,t)},e),e.display.scrollbars.addClass&&G(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function ji(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},zr(e.curOp)}function Wi(e){var t=e.curOp;t&&_s(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 E=0;E<t.length;E++)il(t[E]);for(var B=0;B<t.length;B++)nl(t[B])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(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 Yn(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&&Kn(t),e.barMeasure=Sn(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+ii(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Mi(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==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(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,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var E=e.maybeHiddenMarkers,B=e.maybeUnhiddenMarkers;if(E)for(var K=0;K<E.length;++K)E[K].lines.length||Le(E[K],"hide");if(B)for(var X=0;X<B.length;++X)B[X].lines.length&&Le(B[X],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Pr(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Wi(e)}}function or(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Wi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Wi(this)}}}function sr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ji(t);try{return e.apply(this,arguments)}finally{Wi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,z(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Ve(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var B=E.styles,K=E.text.length>e.options.maxHighlightLength?Br(t.mode,r.state):null,X=he(e,E,r,!0);K&&(r.state=K),E.styles=X.styles;var J=E.styleClasses,ne=X.classes;ne?E.styleClasses=ne:J&&(E.styleClasses=null);for(var le=!B||B.length!=E.styles.length||J!=ne&&(!J||!ne||J.bgClass!=ne.bgClass||J.textClass!=ne.textClass),be=0;!le&&be<B.length;++be)le=B[be]!=E.styles[be];le&&n.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&ht(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Pr(e,function(){for(var E=0;E<n.length;E++)Ti(e,n[E],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mi(e),this.force=i,this.dims=ba(e),this.events=[]};Yn.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Le.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=ii(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ii(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();if(!t||!S(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(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==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(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 Ci(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)&&(Ci(e),t.dims=ba(e));var n=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),B=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<E&&E-i.viewFrom<20&&(E=Math.max(r.first,i.viewFrom)),i.viewTo>B&&i.viewTo-B<20&&(B=Math.min(n,i.viewTo)),nr&&(E=cn(e.doc,E),B=Si(e.doc,B));var K=E!=i.viewFrom||B!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,E,B),i.viewOffset=$r(ut(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var X=po(e);if(!K&&X==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var J=sl(e);return X>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),X>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(J),m(i.cursorDiv),m(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,K&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(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==Mi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+da(e.display)-ca(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!Aa(e,t))break;Kn(e);var n=Sn(e);bn(e),Qi(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 Yn(e,t);if(Aa(e,i)){Kn(e),wo(e,i);var r=Sn(e);bn(e),Qi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,E=r.lineDiv,B=E.firstChild;function K(ke){var Be=ke.nextSibling;return M&&l&&e.display.currentWheelTarget==ke?ke.style.display="none":ke.parentNode.removeChild(ke),Be}for(var X=r.view,J=r.viewFrom,ne=0;ne<X.length;ne++){var le=X[ne];if(!le.hidden)if(!le.node||le.node.parentNode!=E){var be=Ns(e,le,J,i);E.insertBefore(be,B)}else{for(;B!=le.node;)B=K(B);var ye=n&&t!=null&&t<=J&&le.lineNumber;le.changes&&(ce(le.changes,"gutter")>-1&&(ye=!1),Ya(e,le,J,i)),ye&&(m(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(fi(e.options,J)))),B=le.node.nextSibling}J+=le.size}for(;B;)B=K(B)}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+ii(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,E=r+"px",B=0;B<i.length;B++)if(!i[B].hidden){e.options.fixedGutter&&(i[B].gutter&&(i[B].gutter.style.left=E),i[B].gutterBackground&&(i[B].gutterBackground.style.left=E));var K=i[B].alignable;if(K)for(var X=0;X<K.length;X++)K[X].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=fi(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")),E=n.firstChild.offsetWidth,B=n.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-B)+1,r.lineNumWidth=r.lineNumInnerWidth+B,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 E=e[n],B=null;if(typeof E!="string"&&(B=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:E,style:B})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ko(e){var t=e.gutters,i=e.gutterSpecs;m(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],E=n.className,B=n.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+E));B&&(K.style.cssText=B),E=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function wn(e){ko(e.display),Ar(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=x("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=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var E=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[E],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+ve+"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"),H&&W<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!M&&!(D&&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 $n=0,jr=null;H?jr=-.53:D?jr=15:y?jr=-.7:R&&(jr=-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*=jr,t.y*=jr,t}function Ro(e,t){var i=Do(t),r=i.x,n=i.y,E=e.display,B=E.scroller,K=B.scrollWidth>B.clientWidth,X=B.scrollHeight>B.clientHeight;if(!(r&&K||n&&X))return;if(n&&l&&M){e:for(var J=t.target,ne=E.view;J!=B;J=J.parentNode)for(var le=0;le<ne.length;le++)if(ne[le].node==J){e.display.currentWheelTarget=J;break e}}if(r&&!D&&!A&&jr!=null){n&&X&&En(e,Math.max(0,B.scrollTop+n*jr)),Fi(e,Math.max(0,B.scrollLeft+r*jr)),(!n||n&&X)&&ee(t),E.wheelStartX=null;return}if(n&&jr!=null){var be=n*jr,ye=e.doc.scrollTop,ke=ye+E.wrapper.clientHeight;be<0?ye=Math.max(0,ye+be-50):ke=Math.min(e.doc.height,ke+be+50),La(e,{top:ye,bottom:ke})}$n<20&&(E.wheelStartX==null?(E.wheelStartX=B.scrollLeft,E.wheelStartY=B.scrollTop,E.wheelDX=r,E.wheelDY=n,setTimeout(function(){if(E.wheelStartX==null)return;var Be=B.scrollLeft-E.wheelStartX,He=B.scrollTop-E.wheelStartY,Ze=He&&E.wheelDY&&He/E.wheelDY||Be&&E.wheelDX&&Be/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!Ze)return;jr=(jr*$n+Ze)/($n+1),++$n},200)):(E.wheelDX+=r,E.wheelDY+=n))}var Wr=function(e,t){this.ranges=e,this.primIndex=t};Wr.prototype.primary=function(){return this.ranges[this.primIndex]},Wr.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(!pi(i.anchor,r.anchor)||!pi(i.head,r.head))return!1}return!0},Wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(mi(this.ranges[t].anchor),mi(this.ranges[t].head));return new Wr(e,this.primIndex)},Wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(Et(t,r.from())>=0&&Et(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return vi(this.anchor,this.head)},jt.prototype.to=function(){return gi(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Jr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(be,ye){return Et(be.from(),ye.from())}),i=ce(t,n);for(var E=1;E<t.length;E++){var B=t[E],K=t[E-1],X=Et(K.to(),B.from());if(r&&!B.empty()?X>0:X>=0){var J=vi(K.from(),B.from()),ne=gi(K.to(),B.to()),le=K.empty()?B.from()==B.head:K.from()==K.head;E<=i&&--i,t.splice(--E,2,new jt(le?ne:J,le?J:ne))}}return new Wr(t,i)}function wi(e,t){return new Wr([new jt(e,t||e)],0)}function Ai(e){return e.text?Ue(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(Et(e,t.from)<0)return e;if(Et(e,t.to)<=0)return Ai(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+=Ai(t).ch-t.to.ch),Ue(i,r)}function _a(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(_o(n.anchor,t),_o(n.head,t)))}return Jr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?Ue(i.line,e.ch-t.ch+i.ch):Ue(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ue(e.first,0),E=n,B=0;B<t.length;B++){var K=t[B],X=Oo(K.from,n,E),J=Oo(Ai(K),n,E);if(n=K.to,E=J,i=="around"){var ne=e.sel.ranges[B],le=Et(ne.head,ne.anchor)<0;r[B]=new jt(le?J:X,le?X:J)}else r[B]=new jt(X,X)}return new Wr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=Nr(e.options,e.doc.modeOption),An(e)}function An(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,Cn(e,100),e.state.modeGen++,e.curOp&&Ar(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&De(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(at){return i?i[at]:null}function E(at,Je,ot){ua(at,Je,ot,r),cr(at,"change",at,t)}function B(at,Je){for(var ot=[],xt=at;xt<Je;++xt)ot.push(new Pi(J[xt],n(xt),r));return ot}var K=t.from,X=t.to,J=t.text,ne=ut(e,K.line),le=ut(e,X.line),be=De(J),ye=n(J.length-1),ke=X.line-K.line;if(t.full)e.insert(0,B(0,J.length)),e.remove(J.length,e.size-J.length);else if(Po(e,t)){var Be=B(0,J.length-1);E(le,le.text,ye),ke&&e.remove(K.line,ke),Be.length&&e.insert(K.line,Be)}else if(ne==le)if(J.length==1)E(ne,ne.text.slice(0,K.ch)+be+ne.text.slice(X.ch),ye);else{var He=B(1,J.length-1);He.push(new Pi(be+ne.text.slice(X.ch),ye,r)),E(ne,ne.text.slice(0,K.ch)+J[0],n(0)),e.insert(K.line+1,He)}else if(J.length==1)E(ne,ne.text.slice(0,K.ch)+J[0]+le.text.slice(X.ch),n(0)),e.remove(K.line+1,ke);else{E(ne,ne.text.slice(0,K.ch)+J[0],n(0)),E(le,be+le.text.slice(X.ch),ye);var Ze=B(1,J.length-1);ke>1&&e.remove(K.line+1,ke-1),e.insert(K.line+1,Ze)}cr(e,"change",e,t)}function Li(e,t,i){function r(n,E,B){if(n.linked)for(var K=0;K<n.linked.length;++K){var X=n.linked[K];if(X.doc==E)continue;var J=B&&X.sharedHist;if(i&&!J)continue;t(X.doc,J),r(X.doc,n,J)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Oa(e),Io(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Ar(e)}function Io(e){(e.doc.direction=="rtl"?G:f)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Pr(e,function(){Io(e),Ar(e)})}function Zn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var i={from:mi(t.from),to:Ai(t),text:Hr(e,t.from,t.to)};return Fo(e,i,t.from.line,t.to.line+1),Li(e,function(r){return Fo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=De(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),De(e.done);if(e.done.length&&!De(e.done).ranges)return De(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function Bo(e,t,i,r){var n=e.history;n.undone.length=0;var E=+new Date,B,K;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(B=pl(n,n.lastOp==r)))K=De(B.changes),Et(t.from,t.to)==0&&Et(t.from,K.to)==0?K.to=Ai(t):B.changes.push(Ma(e,t));else{var X=De(n.done);for((!X||!X.ranges)&&Jn(e.sel,n.done),B={changes:[Ma(e,t)],generation:n.generation},n.done.push(B);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=E,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,K||Le(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,E=r&&r.origin;i==n.lastSelOp||E&&n.lastSelOrigin==E&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==E||ml(e,E,De(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=E,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Jn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Fo(e,t,i,r){var n=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(B){B.markedSpans&&((n||(n=t["spans_"+e.id]={}))[E]=B.markedSpans),++E})}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=Yr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var E=i[n],B=r[n];if(E&&B){e:for(var K=0;K<B.length;++K){for(var X=B[K],J=0;J<E.length;++J)if(E[J].marker==X.marker)continue e;E.push(X)}}else B&&(i[n]=B)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var E=e[n];if(E.ranges){r.push(i?Wr.prototype.deepCopy.call(E):E);continue}var B=E.changes,K=[];r.push({changes:K});for(var X=0;X<B.length;++X){var J=B[X],ne=void 0;if(K.push({from:J.from,to:J.to,text:J.text}),t)for(var le in J)(ne=le.match(/^spans_(\d+)$/))&&(ce(t,Number(ne[1]))>-1&&(De(K)[le]=J[le],delete J[le]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var E=Et(t,n)<0;E!=Et(i,n)<0?(n=t,t=i):E!=Et(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),br(e,new Wr([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),E=0;E<e.sel.ranges.length;E++)r[E]=Ia(e.sel.ranges[E],t[E],null,n);var B=Jr(e.cm,r,e.sel.primIndex);br(e,B,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,br(e,Jr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){br(e,wi(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var E=0;E<n.length;E++)this.ranges[E]=new jt(s(e,n[E].anchor),s(e,n[E].head))},origin:i&&i.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Jr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=De(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):br(e,t,i)}function br(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(Et(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(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,ge(e.cm)),cr(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,E=0;E<t.ranges.length;E++){var B=t.ranges[E],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],X=ea(e,B.anchor,K&&K.anchor,i,r),J=ea(e,B.head,K&&K.head,i,r);(n||X!=B.anchor||J!=B.head)&&(n||(n=t.ranges.slice(0,E)),n[E]=new jt(X,J))}return n?Jr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var E=ut(e,t.line);if(E.markedSpans)for(var B=0;B<E.markedSpans.length;++B){var K=E.markedSpans[B],X=K.marker,J="selectLeft"in X?!X.selectLeft:X.inclusiveLeft,ne="selectRight"in X?!X.selectRight:X.inclusiveRight;if((K.from==null||(J?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ne?K.to>=t.ch:K.to>t.ch))){if(n&&(Le(X,"beforeCursorEnter"),X.explicitlyCleared))if(E.markedSpans){--B;continue}else break;if(!X.atomic)continue;if(i){var le=X.find(r<0?1:-1),be=void 0;if((r<0?ne:J)&&(le=Vo(e,le,-r,le&&le.line==t.line?E:null)),le&&le.line==t.line&&(be=Et(le,i))&&(r<0?be<0:be>0))return en(e,le,t,r,n)}var ye=X.find(r<0?-1:1);return(r<0?J:ne)&&(ye=Vo(e,ye,r,ye.line==t.line?E:null)),ye?en(e,ye,t,r,n):null}}return t}function ea(e,t,i,r,n){var E=r||1,B=en(e,t,i,E,n)||!n&&en(e,t,i,E,!0)||en(e,t,i,-E,n)||!n&&en(e,t,i,-E,!0);return B||(e.cantEdit=!0,Ue(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ue(t.line-1)):null:i>0&&t.ch==(r||ut(e,t.line)).text.length?t.line<e.first+e.size-1?Ue(t.line+1,0):null:new Ue(t.line,t.ch+i)}function Xo(e){e.setSelection(Ue(e.firstLine(),0),Ue(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,E,B,K){n&&(r.from=s(e,n)),E&&(r.to=s(e,E)),B&&(r.text=B),K!==void 0&&(r.origin=K)}),Le(e,"beforeChange",e,r),e.cm&&Le(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 tn(e,t,i){if(e.cm){if(!e.cm.curOp)return or(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=_i&&!i&&bi(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]==""&&Et(t.from,t.to)==0)return;var i=_a(e,t);Bo(e,t,i,e.cm?e.cm.curOp.id:NaN),Ln(e,t,i,Yr(e,t));var r=[];Li(e,function(n,E){!E&&ce(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),Ln(n,t,null,Yr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,E,B=e.sel,K=t=="undo"?n.done:n.undone,X=t=="undo"?n.undone:n.done,J=0;J<K.length&&!(E=K[J],i?E.ranges&&!E.equals(e.sel):!E.ranges);J++);if(J==K.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(E=K.pop(),E.ranges){if(Jn(E,X),i&&!E.equals(e.sel)){br(e,E,{clearRedo:!1});return}B=E}else if(r){K.push(E);return}else break;var ne=[];Jn(B,X),X.push({changes:ne,generation:n.generation}),n.generation=E.generation||++n.maxGeneration;for(var le=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),be=function(Be){var He=E.changes[Be];if(He.origin=t,le&&!Yo(e,He,!1))return K.length=0,{};ne.push(Ma(e,He));var Ze=Be?_a(e,He):De(K);Ln(e,He,Ze,Uo(e,He)),!Be&&e.cm&&e.cm.scrollIntoView({from:He.from,to:Ai(He)});var at=[];Li(e,function(Je,ot){!ot&&ce(at,Je.history)==-1&&(qo(Je.history,He),at.push(Je.history)),Ln(Je,He,null,Uo(Je,He))})},ye=E.changes.length-1;ye>=0;--ye){var ke=be(ye);if(ke)return ke.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wr(Ye(e.sel.ranges,function(n){return new jt(Ue(n.anchor.line+t,n.anchor.ch),Ue(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Ar(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Ti(e.cm,r,"gutter")}}function Ln(e,t,i,r){if(e.cm&&!e.cm.curOp)return or(e.cm,Ln)(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:Ue(e.first,0),to:Ue(t.to.line+n,t.to.ch),text:[De(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Ue(E,ut(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Hr(e,t.from,t.to),i||(i=_a(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),qn(e,i,xe),e.cantEdit&&ea(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,E=t.from,B=t.to,K=!1,X=E.line;e.options.lineWrapping||(X=kt(Er(ut(r,E.line))),r.iter(X,B.line+1,function(ye){if(ye==n.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(X,E.line+t.text.length,function(ye){var ke=pn(ye);ke>n.maxLineLength&&(n.maxLine=ye,n.maxLineLength=ke,n.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Xr(r,E.line),Cn(e,400);var J=t.text.length-(B.line-E.line)-1;t.full?Ar(e):E.line==B.line&&t.text.length==1&&!Po(e.doc,t)?Ti(e,E.line,"text"):Ar(e,E.line,B.line+1,J);var ne=de(e,"changes"),le=de(e,"change");if(le||ne){var be={from:E,to:B,text:t.text,removed:t.removed,origin:t.origin};le&&cr(e,"change",e,be),ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(be)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var E;r||(r=i),Et(r,i)<0&&(E=[r,i],i=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(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 E=e[n],B=!0;if(E.ranges){E.copied||(E=e[n]=E.deepCopy(),E.copied=!0);for(var K=0;K<E.ranges.length;K++)Jo(E.ranges[K].anchor,t,i,r),Jo(E.ranges[K].head,t,i,r);continue}for(var X=0;X<E.changes.length;++X){var J=E.changes[X];if(i<J.from.line)J.from=Ue(J.from.line+r,J.from.ch),J.to=Ue(J.to.line+r,J.to.ch);else if(t<=J.to.line){B=!1;break}}B||(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 kn(e,t,i,r){var n=t,E=t;return typeof t=="number"?E=ut(e,j(e,t)):n=kt(t),n==null?null:(r(E,n)&&e.cm&&Ti(e.cm,n,i),E)}function Dn(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}Dn.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,ft(n),cr(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 Rn(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}Rn.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 E=Math.min(t,n-e),B=r.height;if(r.removeInner(e,E),this.height-=B-r.height,n==E&&(this.children.splice(i--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Dn))){var K=[];this.collapse(K),this.children=[new Dn(K)],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],E=n.chunkSize();if(e<=E){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var B=n.lines.length%25+25,K=B;K<n.lines.length;){var X=new Dn(n.lines.slice(K,K+=25));n.height-=X.height,this.children.splice(++r,0,X),X.parent=this}n.lines=n.lines.slice(0,B),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Rn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ce(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Rn(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],E=n.chunkSize();if(e<E){var B=Math.min(t,E-e);if(n.iterN(e,B,i))return!0;if((t-=B)==0)break;e=0}else e-=E}}};var _n=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};_n.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=kt(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 E=vn(this);mr(i,Math.max(0,i.height-E)),e&&(Pr(e,function(){es(e,i,-E),Ti(e,r,"widget")}),cr(e,"lineWidgetCleared",e,this,r))},_n.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=vn(this)-t;if(!n)return;ri(this.doc,r)||mr(r,r.height+n),i&&Pr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),cr(i,"lineWidgetChanged",i,e,kt(r))})},fe(_n);function es(e,t,i){$r(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function El(e,t,i,r){var n=new _n(e,i,r),E=e.cm;return E&&n.noHScroll&&(E.display.alignWidgets=!0),kn(e,t,"widget",function(B){var K=B.widgets||(B.widgets=[]);if(n.insertAt==null?K.push(n):K.splice(Math.min(K.length-1,Math.max(0,n.insertAt)),0,n),n.line=B,E&&!ri(e,B)){var X=$r(B)<e.scrollTop;mr(B,B.height+vn(n)),X&&wa(E,n.height),E.curOp.forceUpdate=!0}return!0}),E&&cr(E,"lineWidgetAdded",E,n,typeof t=="number"?t:kt(t)),n}var ts=0,ki=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};ki.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),de(this,"clear")){var i=this.find();i&&cr(this,"clear",i.from,i.to)}for(var r=null,n=null,E=0;E<this.lines.length;++E){var B=this.lines[E],K=Or(B.markedSpans,this);e&&!this.collapsed?Ti(e,kt(B),"text"):e&&(K.to!=null&&(n=kt(B)),K.from!=null&&(r=kt(B))),B.markedSpans=Oi(B.markedSpans,K),K.from==null&&this.collapsed&&!ri(this.doc,B)&&e&&mr(B,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var X=0;X<this.lines.length;++X){var J=Er(this.lines[X]),ne=pn(J);ne>e.display.maxLineLength&&(e.display.maxLine=J,e.display.maxLineLength=ne,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ar(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&&cr(e,"markerCleared",e,this,r,n),t&&Wi(e),this.parent&&this.parent.clear()},ki.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var E=this.lines[n],B=Or(E.markedSpans,this);if(B.from!=null&&(i=Ue(t?E:kt(E),B.from),e==-1))return i;if(B.to!=null&&(r=Ue(t?E:kt(E),B.to),e==1))return r}return i&&{from:i,to:r}},ki.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,E=kt(t.line),B=fa(r,E);if(B&&(no(B),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!ri(i.doc,n)&&i.height!=null){var K=i.height;i.height=null;var X=vn(i)-K;X&&mr(n,n.height+X)}cr(r,"markerChanged",r,e)})},ki.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ce(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ki.prototype.detachLine=function(e){if(this.lines.splice(ce(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fe(ki);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return or(e.cm,nn)(e,t,i,r,n);var E=new ki(e,n),B=Et(t,i);if(r&&U(r,E,!1),B>0||B==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=x("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(ar(e,t.line,t,i,E)||t.line!=i.line&&ar(e,i.line,t,i,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");oi()}E.addToHistory&&Bo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var K=t.line,X=e.cm,J;if(e.iter(K,i.line+1,function(le){X&&E.collapsed&&!X.options.lineWrapping&&Er(le)==X.display.maxLine&&(J=!0),E.collapsed&&K!=t.line&&mr(le,0),yi(le,new si(E,K==t.line?t.ch:null,K==i.line?i.ch:null)),++K}),E.collapsed&&e.iter(t.line,i.line+1,function(le){ri(e,le)&&mr(le,0)}),E.clearOnEnter&&we(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(Ur(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++ts,E.atomic=!0),X){if(J&&(X.curOp.updateMaxLine=!0),E.collapsed)Ar(X,t.line,i.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var ne=t.line;ne<=i.line;ne++)Ti(X,ne,"text");E.atomic&&zo(X.doc),cr(X,"markerAdded",X,E)}return E}var On=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};On.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();cr(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},fe(On);function Sl(e,t,i,r,n){r=U(r),r.shared=!1;var E=[nn(e,t,i,r,n)],B=E[0],K=r.widgetNode;return Li(e,function(X){K&&(r.widgetNode=K.cloneNode(!0)),E.push(nn(X,s(X,t),s(X,i),r,n));for(var J=0;J<X.linked.length;++J)if(X.linked[J].isParent)return;B=De(E)}),new On(E,B)}function rs(e){return e.findMarks(Ue(e.first,0),e.clipPos(Ue(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(),E=e.clipPos(n.from),B=e.clipPos(n.to);if(Et(E,B)){var K=nn(e,E,B,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],E=[n.primary.doc];Li(n.primary.doc,function(X){return E.push(X)});for(var B=0;B<n.markers.length;B++){var K=n.markers[B];ce(E,K.doc)==-1&&(K.parent=null,n.markers.splice(B--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Lr=function(e,t,i,r,n){if(!(this instanceof Lr))return new Lr(e,t,i,r,n);i==null&&(i=0),Rn.call(this,[new Dn([new Pi("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var E=Ue(i,0);this.sel=wi(E),this.history=new Zn(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)),Pa(this,{from:E,to:E,text:e}),br(this,wi(E),xe)};Lr.prototype=qe(Rn.prototype,{constructor:Lr,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=ei(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:sr(function(e){var t=Ue(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ue(i,ut(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xn(this.cm,0,0),br(this,wi(t),xe)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Hr(this,s(this,e),s(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 ut(this,e)},getLineNumber:function(e){return kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ut(this,e)),Er(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(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:sr(function(e,t,i){Wo(this,s(this,typeof e=="number"?Ue(e,t||0):e),null,i)}),setSelection:sr(function(e,t,i){Wo(this,s(this,e),s(this,t||e),i)}),extendSelection:sr(function(e,t,i){Qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:sr(function(e,t){jo(this,_(this,e),t)}),extendSelectionsBy:sr(function(e,t){var i=Ye(this.sel.ranges,e);jo(this,_(this,i),t)}),setSelections:sr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),br(this,Jr(this.cm,r,t),i)}),addSelection:sr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),br(this,Jr(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=Hr(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=Hr(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:sr(function(e,t,i){for(var r=[],n=this.sel,E=0;E<n.ranges.length;E++){var B=n.ranges[E];r[E]={from:B.from(),to:B.to(),text:this.splitLines(e[E]),origin:i}}for(var K=t&&t!="end"&&cl(this,r,t),X=r.length-1;X>=0;X--)tn(this,r[X]);K?Ho(this,K):this.cm&&Ji(this.cm)}),undo:sr(function(){ta(this,"undo")}),redo:sr(function(){ta(this,"redo")}),undoSelection:sr(function(){ta(this,"undo",!0)}),redoSelection:sr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,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 Zn(this.history.maxGeneration),Li(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Zn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:sr(function(e,t,i){return kn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&ze(n)&&(r.gutterMarkers=null),!0})}),clearGutter:sr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&kn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,ze(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=ut(this,e),!e)return null}else if(t=kt(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:sr(function(e,t,i){return kn(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(b(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:sr(function(e,t,i){return kn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[n];if(E)if(i==null)r[n]=null;else{var B=E.match(b(i));if(!B)return!1;var K=B.index+B[0].length;r[n]=E.slice(0,B.index)+(!B.index||K==E.length?"":" ")+E.slice(K)||null}else return!1;return!0})}),addLineWidget:sr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(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=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=ut(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=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(E){var B=E.markedSpans;if(B)for(var K=0;K<B.length;K++){var X=B[K];!(X.to!=null&&n==e.line&&e.ch>=X.to||X.from==null&&n!=e.line||X.from!=null&&n==t.line&&X.from>=t.ch)&&(!i||i(X.marker))&&r.push(X.marker.parent||X.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 E=n.text.length+r;if(E>e)return t=e,!0;e-=E,++i}),s(this,Ue(i,t))},indexFromPos:function(e){e=s(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 Lr(ei(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 Lr(ei(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 Vt&&(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];Li(e,function(n){return r.push(n.id)},!0),e.history=new Zn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Li(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):St(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:sr(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)})}),Lr.prototype.eachLine=Lr.prototype.iter;var is=0;function Al(e){var t=this;if(ns(t),Fe(t,e)||ui(t.display,e))return;ee(e),H&&(is=+new Date);var i=Ni(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,E=Array(n),B=0,K=function(){++B==n&&or(t,function(){i=s(t.doc,i);var ye={from:i,to:i,text:t.doc.splitLines(E.filter(function(ke){return ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,ye),Ho(t.doc,wi(s(t.doc,i),s(t.doc,Ai(ye))))})()},X=function(ye,ke){if(t.options.allowDropFileTypes&&ce(t.options.allowDropFileTypes,ye.type)==-1){K();return}var Be=new FileReader;Be.onerror=function(){return K()},Be.onload=function(){var He=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(He)){K();return}E[ke]=He,K()},Be.readAsText(ye)},J=0;J<r.length;J++)X(r[J],J);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 ne=e.dataTransfer.getData("Text");if(ne){var le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),qn(t.doc,wi(i,i)),le)for(var be=0;be<le.length;++be)rn(t.doc,"",le[be].anchor,le[be].head,"drag");t.replaceSelection(ne,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(H&&(!e.state.draggingText||+new Date-is<100)){ue(t);return}if(Fe(e,t)||ui(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function kl(e,t){var i=Ni(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 E=0;E<i.length;E++)e(i[E])})}var os=!1;function Dl(){if(os)return;Rl(),os=!0}function Rl(){var e;we(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(_l)},100))}),we(window,"blur",function(){return as(Zi)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Di={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"},Pn=0;Pn<10;Pn++)Di[Pn+48]=Di[Pn+96]=String(Pn);for(var ra=65;ra<=90;ra++)Di[ra]=String.fromCharCode(ra);for(var Mn=1;Mn<=12;Mn++)Di[Mn+111]=Di[Mn+63235]="F"+Mn;var hi={};hi.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"},hi.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"},hi.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"},hi.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"]},hi.default=l?hi.macDefault:hi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,E,B=0;B<t.length-1;B++){var K=t[B];if(/^(cmd|meta|m)$/i.test(K))E=!0;else if(/^a(lt)?$/i.test(K))i=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))n=!0;else throw new Error("Unrecognized modifier name: "+K)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),E&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(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=Ye(i.split(" "),Ol),E=0;E<n.length;E++){var B=void 0,K=void 0;E==n.length-1?(K=n.join(" "),B=r):(K=n.slice(0,E+1).join(" "),B="...");var X=t[K];if(!X)t[K]=B;else if(X!=B)throw new Error("Inconsistent bindings for "+K)}delete e[i]}for(var J in t)e[J]=t[J];return e}function an(e,t,i,r){t=ia(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 an(e,t.fallthrough,i,r);for(var E=0;E<t.fallthrough.length;E++){var B=an(e,t.fallthrough[E],i,r);if(B)return B}}}function ss(e){var t=typeof e=="string"?e:Di[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),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=Di[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function ia(e){return typeof e=="string"?hi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var E=t(i[n]);r.length&&Et(E.from,De(r).to)<=0;){var B=r.pop();if(Et(B.from,E.from)<0){E.from=B.from;break}}r.push(E)}Pr(e,function(){for(var K=r.length-1;K>=0;K--)rn(e.doc,"",r[K].from,r[K].to,"+delete");Ji(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 Ue(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var E=et(i,t.doc.direction);if(E){var B=n<0?De(E):E[0],K=n<0==(B.level==1),X=K?"after":"before",J;if(B.level>0||t.doc.direction=="rtl"){var ne=Xi(t,i);J=n<0?i.text.length-1:0;var le=ni(t,ne,J).top;J=Ke(function(be){return ni(t,ne,be).top==le},n<0==(B.level==1)?B.from:B.to-1,J),X=="before"&&(J=Ba(i,J,1))}else J=n<0?B.to:B.from;return new Ue(r,J,X)}}return new Ue(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=et(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 E=Xe(n,i.ch,i.sticky),B=n[E];if(e.doc.direction=="ltr"&&B.level%2==0&&(r>0?B.to>i.ch:B.from<i.ch))return Fa(t,i,r);var K=function(Ze,at){return Ba(t,Ze instanceof Ue?Ze.ch:Ze,at)},X,J=function(Ze){return e.options.lineWrapping?(X=X||Xi(e,t),co(e,t,X,Ze)):{begin:0,end:t.text.length}},ne=J(i.sticky=="before"?K(i,-1):i.ch);if(e.doc.direction=="rtl"||B.level==1){var le=B.level==1==r<0,be=K(i,le?1:-1);if(be!=null&&(le?be<=B.to&&be<=ne.end:be>=B.from&&be>=ne.begin)){var ye=le?"before":"after";return new Ue(i.line,be,ye)}}var ke=function(Ze,at,Je){for(var ot=function(zt,lr){return lr?new Ue(i.line,K(zt,1),"before"):new Ue(i.line,zt,"after")};Ze>=0&&Ze<n.length;Ze+=at){var xt=n[Ze],gt=at>0==(xt.level!=1),At=gt?Je.begin:K(Je.end,-1);if(xt.from<=At&&At<xt.to)return ot(At,gt);if(At=gt?xt.from:K(xt.to,-1),Je.begin<=At&&At<Je.end)return ot(At,gt)}},Be=ke(E+r,r,ne);if(Be)return Be;var He=r>0?ne.end:K(ne.begin,-1);return He!=null&&!(r>0&&He==t.text.length)&&(Be=ke(r>0?0:n.length-1,r,J(He)),Be)?Be:null}var In={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=ut(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ue(t.head.line+1,0)}:{from:t.head,to:Ue(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ue(t.from().line,0),to:s(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ue(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(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 on(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(Ue(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ue(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")},Ce)},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")},Ce)},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},Ce)},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 E=i[n].from(),B=q(e.getLine(E.line),E.ch,r);t.push(oe(r-B%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,E=ut(e.doc,n.line).text;if(E){if(n.ch==E.length&&(n=new Ue(n.line,n.ch-1)),n.ch>0)n=new Ue(n.line,n.ch+1),e.replaceRange(E.charAt(n.ch-1)+E.charAt(n.ch-2),Ue(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var B=ut(e.doc,n.line-1).text;B&&(n=new Ue(n.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+B.charAt(B.length-1),Ue(n.line-1,B.length-1),n,"+transpose"))}}i.push(new jt(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);Ji(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var i=ut(e.doc,t),r=Er(i);return r!=i&&(t=kt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=ut(e.doc,t),r=Vi(i);return r!=i&&(t=kt(r)),Ua(!0,e,i,t,-1)}function ds(e,t){var i=hs(e,t.line),r=ut(e.doc,i.line),n=et(r,e.doc.direction);if(!n||n[0].level==0){var E=Math.max(i.ch,r.text.search(/\S/)),B=t.line==i.line&&t.ch<=E&&t.ch;return Ue(i.line,B?0:E,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=In[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)!=Oe}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=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new ae;function Nn(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"&&cr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(ee(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||Nn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):Nn(e,i,t,function(r){return na(e,r)}):!1}function Fl(e,t,i){return Nn(e,"'"+i+"'",t,function(r){return na(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=I(),Fe(t,e))return;H&&W<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);A&&(ja=r?i:null,!r&&i==88&&!Ft&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!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;G(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),nt(document,"keyup",i),nt(document,"mouseover",i))}we(document,"keyup",i),we(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(ui(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==ja){ja=null,ee(e);return}if(A&&(!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&&Et(t,this.pos)==0&&i==this.button};var Bn,Fn;function Wl(e,t){var i=+new Date;return Fn&&Fn.compare(i,e,t)?(Bn=Fn=null,"triple"):Bn&&Bn.compare(i,e,t)?(Fn=new Wa(i,e,t),Bn=null,"double"):(Bn=new Wa(i,e,t),Fn=null,"single")}function vs(e){var t=this,i=t.display;if(Fe(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,ui(i,e)){M||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Ni(t,e),n=Ee(e),E=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,E,e))return;n==1?r?zl(t,r,E,e):me(e)==i.scroller&&ee(e):n==2?(r&&Qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(k?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,Nn(e,ls(E,n),n,function(B){if(typeof B=="string"&&(B=In[B]),!B)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=B(e,i)!=Oe}finally{e.state.suppressEdits=!1}return K})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var E=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=E?"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){H?setTimeout(z(vo,e),0):e.curOp.focus=I();var n=Gl(e,i,r),E=e.doc.sel,B;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(B=E.contains(t))>-1&&(Et((B=E.ranges[B]).from(),t)<0||t.xRel>0)&&(Et(B.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,E=!1,B=or(e,function(J){M&&(n.scroller.draggable=!1),e.state.draggingText=!1,nt(n.wrapper.ownerDocument,"mouseup",B),nt(n.wrapper.ownerDocument,"mousemove",K),nt(n.scroller,"dragstart",X),nt(n.scroller,"drop",B),E||(ee(J),r.addNew||Qn(e.doc,i,null,null,r.extend),M&&!R||H&&W==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),K=function(J){E=E||Math.abs(t.clientX-J.clientX)+Math.abs(t.clientY-J.clientY)>=10},X=function(){return E=!0};M&&(n.scroller.draggable=!0),e.state.draggingText=B,B.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),we(n.wrapper.ownerDocument,"mouseup",B),we(n.wrapper.ownerDocument,"mousemove",K),we(n.scroller,"dragstart",X),we(n.scroller,"drop",B),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Ue(t.line,0),s(e.doc,Ue(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,E=e.doc;ee(t);var B,K,X=E.sel,J=X.ranges;if(r.addNew&&!r.extend?(K=E.sel.contains(i),K>-1?B=J[K]:B=new jt(i,i)):(B=E.sel.primary(),K=E.sel.primIndex),r.unit=="rectangle")r.addNew||(B=new jt(i,i)),i=Ni(e,t,!0,!0),K=-1;else{var ne=ys(e,i,r.unit);r.extend?B=Ia(B,ne.anchor,ne.head,r.extend):B=ne}r.addNew?K==-1?(K=J.length,br(E,Jr(e,J.concat([B]),K),{scroll:!1,origin:"*mouse"})):J.length>1&&J[K].empty()&&r.unit=="char"&&!r.extend?(br(E,Jr(e,J.slice(0,K).concat(J.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),X=E.sel):Na(E,K,B,Te):(K=0,br(E,new Wr([B],0),Te),X=E.sel);var le=i;function be(Je){if(Et(le,Je)==0)return;if(le=Je,r.unit=="rectangle"){for(var ot=[],xt=e.options.tabSize,gt=q(ut(E,i.line).text,i.ch,xt),At=q(ut(E,Je.line).text,Je.ch,xt),zt=Math.min(gt,At),lr=Math.max(gt,At),Yt=Math.min(i.line,Je.line),Mr=Math.min(e.lastLine(),Math.max(i.line,Je.line));Yt<=Mr;Yt++){var kr=ut(E,Yt).text,er=Se(kr,zt,xt);zt==lr?ot.push(new jt(Ue(Yt,er),Ue(Yt,er))):kr.length>er&&ot.push(new jt(Ue(Yt,er),Ue(Yt,Se(kr,lr,xt))))}ot.length||ot.push(new jt(i,i)),br(E,Jr(e,X.ranges.slice(0,K).concat(ot),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var Dr=B,fr=ys(e,Je,r.unit),ir=Dr.anchor,tr;Et(fr.anchor,ir)>0?(tr=fr.head,ir=vi(Dr.from(),fr.anchor)):(tr=fr.anchor,ir=gi(Dr.to(),fr.head));var $t=X.ranges.slice(0);$t[K]=Xl(e,new jt(s(E,ir),tr)),br(E,Jr(e,$t,K),Te)}}var ye=n.wrapper.getBoundingClientRect(),ke=0;function Be(Je){var ot=++ke,xt=Ni(e,Je,!0,r.unit=="rectangle");if(!xt)return;if(Et(xt,le)!=0){e.curOp.focus=I(),be(xt);var gt=Vn(n,E);(xt.line>=gt.to||xt.line<gt.from)&&setTimeout(or(e,function(){ke==ot&&Be(Je)}),150)}else{var At=Je.clientY<ye.top?-20:Je.clientY>ye.bottom?20:0;At&&setTimeout(or(e,function(){if(ke!=ot)return;n.scroller.scrollTop+=At,Be(Je)}),50)}}function He(Je){e.state.selectingText=!1,ke=Infinity,Je&&(ee(Je),n.input.focus()),nt(n.wrapper.ownerDocument,"mousemove",Ze),nt(n.wrapper.ownerDocument,"mouseup",at),E.history.lastSelOrigin=null}var Ze=or(e,function(Je){Je.buttons===0||!Ee(Je)?He(Je):Be(Je)}),at=or(e,He);e.state.selectingText=at,we(n.wrapper.ownerDocument,"mousemove",Ze),we(n.wrapper.ownerDocument,"mouseup",at)}function Xl(e,t){var i=t.anchor,r=t.head,n=ut(e.doc,i.line);if(Et(i,r)==0&&i.sticky==r.sticky)return t;var E=et(n);if(!E)return t;var B=Xe(E,i.ch,i.sticky),K=E[B];if(K.from!=i.ch&&K.to!=i.ch)return t;var X=B+(K.from==i.ch==(K.level!=1)?0:1);if(X==0||X==E.length)return t;var J;if(r.line!=i.line)J=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ne=Xe(E,r.ch,r.sticky),le=ne-B||(r.ch-i.ch)*(K.level==1?-1:1);ne==X-1||ne==X?J=le<0:J=le>0}var be=E[X+(J?-1:0)],ye=J==(be.level==1),ke=ye?be.from:be.to,Be=ye?"after":"before";return i.ch==ke&&i.sticky==Be?t:new jt(new Ue(i.line,ke,Be),r)}function bs(e,t,i,r){var n,E;if(t.touches)n=t.touches[0].clientX,E=t.touches[0].clientY;else try{n=t.clientX,E=t.clientY}catch(be){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ee(t);var B=e.display,K=B.lineDiv.getBoundingClientRect();if(E>K.bottom||!de(e,i))return ie(t);E-=K.top-B.viewOffset;for(var X=0;X<e.display.gutterSpecs.length;++X){var J=B.gutters.childNodes[X];if(J&&J.getBoundingClientRect().right>=n){var ne=Fr(e.doc,E),le=e.display.gutterSpecs[X];return Le(e,i,e,ne,le.className,t),ie(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(ui(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return de(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-"),yn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,E,B){e.defaults[r]=n,E&&(t[r]=B?function(K,X,J){J!=sn&&E(K,X,J)}:E)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){An(r),yn(r),Ar(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var E=[],B=r.doc.first;r.doc.iter(function(X){for(var J=0;;){var ne=X.text.indexOf(n,J);if(ne==-1)break;J=ne+n.length,E.push(Ue(B,ne))}B++});for(var K=E.length-1;K>=0;K--)rn(r.doc,n,E[K],Ue(E[K].line,E[K].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,E){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),E!=sn&&r.refresh()}),i("specialCharPlaceholder",Gt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!C),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),wn(r)},!0),i("keyMap","default",function(r,n,E){var B=ia(n),K=E!=sn&&ia(E);K&&K.detach&&K.detach(r,B),B.attach&&B.attach(r,K||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),wn(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 Qi(r)},!0),i("scrollbarStyle","native",function(r){Co(r),Qi(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),wn(r)},!0),i("firstLineNumber",1,wn,!0),i("lineNumberFormatter",function(r){return r},wn,!0),i("showCursorWhenSelecting",!1,bn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(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,bn,!0),i("singleCursorHeightPerLine",!0,bn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,An,!0),i("addModeClass",!1,An,!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,An,!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!=sn;if(!t!=!r){var n=e.display.dragFunctions,E=t?we:nt;E(e.display.scroller,"dragstart",n.start),E(e.display.scroller,"dragenter",n.enter),E(e.display.scroller,"dragover",n.over),E(e.display.scroller,"dragleave",n.leave),E(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(G(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Ea(e),Ar(e),yn(e),setTimeout(function(){return Qi(e)},100)}function Vt(e,t){var i=this;if(!(this instanceof Vt))return new Vt(e,t);this.options=t=t?U(t):{},U(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Lr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Vt.inputStyles[t.inputStyle](this),E=this.display=new hl(e,r,n,t);E.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Co(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ae,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),H&&W<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),Dl(),ji(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Zi(this);for(var B in aa)aa.hasOwnProperty(B)&&aa[B](this,t[B],sn);Lo(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ga.length;++K)Ga[K](this);Wi(this),M&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}Vt.defaults=Ss,Vt.optionHandlers=aa;function Ql(e){var t=e.display;we(t.scroller,"mousedown",or(e,vs)),H&&W<11?we(t.scroller,"dblclick",or(e,function(X){if(Fe(e,X))return;var J=Ni(e,X);if(!J||Ha(e,X)||ui(e.display,X))return;ee(X);var ne=e.findWordAt(J);Qn(e.doc,ne.anchor,ne.head)})):we(t.scroller,"dblclick",function(X){return Fe(e,X)||ee(X)}),we(t.scroller,"contextmenu",function(X){return xs(e,X)}),we(t.input.getField(),"contextmenu",function(X){t.scroller.contains(X.target)||xs(e,X)});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 E(X){if(X.touches.length!=1)return!1;var J=X.touches[0];return J.radiusX<=1&&J.radiusY<=1}function B(X,J){if(J.left==null)return!0;var ne=J.left-X.left,le=J.top-X.top;return ne*ne+le*le>20*20}we(t.scroller,"touchstart",function(X){if(!Fe(e,X)&&!E(X)&&!Ha(e,X)){t.input.ensurePolled(),clearTimeout(i);var J=+new Date;t.activeTouch={start:J,moved:!1,prev:J-r.end<=300?r:null},X.touches.length==1&&(t.activeTouch.left=X.touches[0].pageX,t.activeTouch.top=X.touches[0].pageY)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(X){var J=t.activeTouch;if(J&&!ui(t,X)&&J.left!=null&&!J.moved&&new Date-J.start<300){var ne=e.coordsChar(t.activeTouch,"page"),le;!J.prev||B(J,J.prev)?le=new jt(ne,ne):!J.prev.prev||B(J,J.prev.prev)?le=e.findWordAt(ne):le=new jt(Ue(ne.line,0),s(e.doc,Ue(ne.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),ee(X)}n()}),we(t.scroller,"touchcancel",n),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),we(t.scroller,"mousewheel",function(X){return Ro(e,X)}),we(t.scroller,"DOMMouseScroll",function(X){return Ro(e,X)}),we(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(X){Fe(e,X)||ue(X)},over:function(X){Fe(e,X)||(kl(e,X),ue(X))},start:function(X){return Ll(e,X)},drop:or(e,Al),leave:function(X){Fe(e,X)||ns(e)}};var K=t.input.getField();we(K,"keyup",function(X){return ms.call(e,X)}),we(K,"keydown",or(e,ps)),we(K,"keypress",or(e,gs)),we(K,"focus",function(X){return Ta(e,X)}),we(K,"blur",function(X){return Zi(e,X)})}var Ga=[];Vt.defineInitHook=function(e){return Ga.push(e)};function Un(e,t,i,r){var n=e.doc,E;i==null&&(i="add"),i=="smart"&&(n.mode.indent?E=Ve(e,t).state:i="prev");var B=e.options.tabSize,K=ut(n,t),X=q(K.text,null,B);K.stateAfter&&(K.stateAfter=null);var J=K.text.match(/^\s*/)[0],ne;if(!r&&!/\S/.test(K.text))ne=0,i="not";else if(i=="smart"&&(ne=n.mode.indent(E,K.text.slice(J.length),K.text),ne==Oe||ne>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ne=q(ut(n,t-1).text,null,B):ne=0:i=="add"?ne=X+e.options.indentUnit:i=="subtract"?ne=X-e.options.indentUnit:typeof i=="number"&&(ne=X+i),ne=Math.max(0,ne);var le="",be=0;if(e.options.indentWithTabs)for(var ye=Math.floor(ne/B);ye;--ye)be+=B,le+=" ";if(be<ne&&(le+=oe(ne-be)),le!=J)return rn(n,le,Ue(t,0),Ue(t,J.length),"+input"),K.stateAfter=null,!0;for(var ke=0;ke<n.sel.ranges.length;ke++){var Be=n.sel.ranges[ke];if(Be.head.line==t&&Be.head.ch<J.length){var He=Ue(t,J.length);Na(n,ke,new jt(He,He));break}}}var Qr=null;function oa(e){Qr=e}function za(e,t,i,r,n){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var B=+new Date-200,K=n=="paste"||e.state.pasteIncoming>B,X=St(t),J=null;if(K&&r.ranges.length>1)if(Qr&&Qr.text.join(`
|
|
`)==t){if(r.ranges.length%Qr.text.length==0){J=[];for(var ne=0;ne<Qr.text.length;ne++)J.push(E.splitLines(Qr.text[ne]))}}else X.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(J=Ye(X,function(Ze){return[Ze]}));for(var le=e.curOp.updateInput,be=r.ranges.length-1;be>=0;be--){var ye=r.ranges[be],ke=ye.from(),Be=ye.to();ye.empty()&&(i&&i>0?ke=Ue(ke.line,ke.ch-i):e.state.overwrite&&!K?Be=Ue(Be.line,Math.min(ut(E,Be.line).text.length,Be.ch+De(X).length)):K&&Qr&&Qr.lineWise&&Qr.text.join(`
|
|
`)==X.join(`
|
|
`)&&(ke=Be=Ue(ke.line,0)));var He={from:ke,to:Be,text:J?J[be%J.length]:X,origin:n||(K?"paste":e.state.cutIncoming>B?"cut":"+input")};tn(e.doc,He),cr(e,"inputRead",e,He)}t&&!K&&Cs(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),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 E=e.getModeAt(n.head),B=!1;if(E.electricChars){for(var K=0;K<E.electricChars.length;K++)if(t.indexOf(E.electricChars.charAt(K))>-1){B=Un(e,n.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(ut(e.doc,n.head.line).text.slice(0,n.head.ch))&&(B=Un(e,n.head.line,"smart")));B&&cr(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,E={anchor:Ue(n,0),head:Ue(n+1,0)};i.push(E),t.push(e.getRange(E.anchor,E.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 M?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(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 E=this.options,B=E[r];if(E[r]==n&&r!="mode")return;E[r]=n,t.hasOwnProperty(r)&&or(this,t[r])(this,n,B),Le(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"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,E=0;E<n.length;++E)if(n[E]==r||n[E].name==r)return n.splice(E,1),!0},addOverlay:Sr(function(r,n){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");Ge(this.state.overlays,{mode:E,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(B){return B.priority}),this.state.modeGen++,Ar(this)}),removeOverlay:Sr(function(r){for(var n=this.state.overlays,E=0;E<n.length;++E){var B=n[E].modeSpec;if(B==r||typeof r=="string"&&B.name==r){n.splice(E,1),this.state.modeGen++,Ar(this);return}}}),indentLine:Sr(function(r,n,E){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Vr(this.doc,r)&&Un(this,r,n,E)}),indentSelection:Sr(function(r){for(var n=this.doc.sel.ranges,E=-1,B=0;B<n.length;B++){var K=n[B];if(K.empty())K.head.line>E&&(Un(this,K.head.line,r,!0),E=K.head.line,B==this.doc.sel.primIndex&&Ji(this));else{var X=K.from(),J=K.to(),ne=Math.max(E,X.line);E=Math.min(this.lastLine(),J.line-(J.ch?0:1))+1;for(var le=ne;le<E;++le)Un(this,le,r);var be=this.doc.sel.ranges;X.ch==0&&n.length==be.length&&be[B].from().ch>0&&Na(this.doc,B,new jt(X,be[B].to()),xe)}}}),getTokenAt:function(r,n){return Kt(this,r,n)},getLineTokens:function(r,n){return Kt(this,Ue(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=Re(this,ut(this.doc,r.line)),E=0,B=(n.length-1)/2,K=r.ch,X;if(K==0)X=n[2];else for(;;){var J=E+B>>1;if((J?n[J*2-1]:0)>=K)B=J;else if(n[J*2+1]<K)E=J+1;else{X=n[J*2+2];break}}var ne=X?X.indexOf("overlay "):-1;return ne<0?X:ne==0?null:X.slice(0,ne-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 E=[];if(!i.hasOwnProperty(n))return E;var B=i[n],K=this.getModeAt(r);if(typeof K[n]=="string")B[K[n]]&&E.push(B[K[n]]);else if(K[n])for(var X=0;X<K[n].length;X++){var J=B[K[n][X]];J&&E.push(J)}else K.helperType&&B[K.helperType]?E.push(B[K.helperType]):B[K.name]&&E.push(B[K.name]);for(var ne=0;ne<B._global.length;ne++){var le=B._global[ne];le.pred(K,this)&&ce(E,le.val)==-1&&E.push(le.val)}return E},getStateAfter:function(r,n){var E=this.doc;return r=j(E,r==null?E.first+E.size-1:r),Ve(this,r+1,n).state},cursorCoords:function(r,n){var E,B=this.doc.sel.primary();return r==null?E=B.head:typeof r=="object"?E=s(this.doc,r):E=r?B.from():B.to(),Zr(this,E,n||"page")},charCoords:function(r,n){return ma(this,s(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,Fr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,E){var B=!1,K;if(typeof r=="number"){var X=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>X&&(r=X,B=!0),K=ut(this.doc,r)}else K=r;return Hn(this,K,{top:0,left:0},n||"page",E||B).top+(B?this.doc.height-$r(K):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,E,B,K){var X=this.display;r=Zr(this,s(this.doc,r));var J=r.bottom,ne=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),X.sizer.appendChild(n),B=="over")J=r.top;else if(B=="above"||B=="near"){var le=Math.max(X.wrapper.clientHeight,this.doc.height),be=Math.max(X.sizer.clientWidth,X.lineSpace.clientWidth);(B=="above"||r.bottom+n.offsetHeight>le)&&r.top>n.offsetHeight?J=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=le&&(J=r.bottom),ne+n.offsetWidth>be&&(ne=be-n.offsetWidth)}n.style.top=J+"px",n.style.left=n.style.right="",K=="right"?(ne=X.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(K=="left"?ne=0:K=="middle"&&(ne=(X.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ne+"px"),E&&Zs(this,{left:ne,top:J,right:ne+n.offsetWidth,bottom:J+n.offsetHeight})},triggerOnKeyDown:Sr(ps),triggerOnKeyPress:Sr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Sr(vs),execCommand:function(r){if(In.hasOwnProperty(r))return In[r].call(null,this)},triggerElectric:Sr(function(r){Cs(this,r)}),findPosH:function(r,n,E,B){var K=1;n<0&&(K=-1,n=-n);for(var X=s(this.doc,r),J=0;J<n&&!(X=Ka(this.doc,X,K,E,B),X.hitSide);++J);return X},moveH:Sr(function(r,n){var E=this;this.extendSelectionsBy(function(B){return E.display.shift||E.doc.extend||B.empty()?Ka(E.doc,B.head,r,n,E.options.rtlMoveVisually):r<0?B.from():B.to()},Ce)}),deleteH:Sr(function(r,n){var E=this.doc.sel,B=this.doc;E.somethingSelected()?B.replaceSelection("",null,"+delete"):on(this,function(K){var X=Ka(B,K.head,r,n,!1);return r<0?{from:X,to:K.head}:{from:K.head,to:X}})}),findPosV:function(r,n,E,B){var K=1,X=B;n<0&&(K=-1,n=-n);for(var J=s(this.doc,r),ne=0;ne<n;++ne){var le=Zr(this,J,"div");if(X==null?X=le.left:le.left=X,J=ks(this,le,K,E),J.hitSide)break}return J},moveV:Sr(function(r,n){var E=this,B=this.doc,K=[],X=!this.display.shift&&!B.extend&&B.sel.somethingSelected();if(B.extendSelectionsBy(function(ne){if(X)return r<0?ne.from():ne.to();var le=Zr(E,ne.head,"div");ne.goalColumn!=null&&(le.left=ne.goalColumn),K.push(le.left);var be=ks(E,le,r,n);return n=="page"&&ne==B.sel.primary()&&wa(E,ma(E,be,"div").top-le.top),be},Ce),K.length)for(var J=0;J<B.sel.ranges.length;J++)B.sel.ranges[J].goalColumn=K[J]}),findWordAt:function(r){var n=this.doc,E=ut(n,r.line).text,B=r.ch,K=r.ch;if(E){var X=this.getHelper(r,"wordChars");(r.sticky=="before"||K==E.length)&&B?--B:++K;for(var J=E.charAt(B),ne=We(J,X)?function(le){return We(le,X)}:/\s/.test(J)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!We(le)};B>0&&ne(E.charAt(B-1));)--B;for(;K<E.length&&ne(E.charAt(K));)++K}return new jt(Ue(r.line,B),Ue(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?G(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(r,n){xn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ii(this)-this.display.barHeight,width:r.scrollWidth-ii(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Mi(this)}},scrollIntoView:Sr(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:Ue(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:Sr(function(r,n){var E=this,B=function(X){return typeof X=="number"||/^\d+$/.test(String(X))?X+"px":X};r!=null&&(this.display.wrapper.style.width=B(r)),n!=null&&(this.display.wrapper.style.height=B(n)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(X){if(X.widgets){for(var J=0;J<X.widgets.length;J++)if(X.widgets[J].noHScroll){Ti(E,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return Pr(this,r)},startOperation:function(){return ji(this)},endOperation:function(){return Wi(this)},refresh:Sr(function(){var r=this.display.cachedTextHeight;Ar(this),this.curOp.forceUpdate=!0,yn(this),xn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Ea(this),Le(this,"refresh",this)}),swapDoc:Sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yn(this),this.display.input.reset(),xn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,cr(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}},fe(e),e.registerHelper=function(r,n,E){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=E},e.registerGlobalHelper=function(r,n,E,B){e.registerHelper(r,n,B),i[r]._global.push({pred:E,val:B})}}function Ka(e,t,i,r,n){var E=t,B=i,K=ut(e,t.line),X=n&&e.direction=="rtl"?-i:i;function J(){var at=t.line+X;return at<e.first||at>=e.first+e.size?!1:(t=new Ue(at,t.ch,t.sticky),K=ut(e,at))}function ne(at){var Je;if(r=="codepoint"){var ot=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ot)?Je=null:Je=new Ue(t.line,Math.max(0,Math.min(K.text.length,t.ch+i*(ot>=55296&&ot<56320?2:1))),-i)}else n?Je=Ml(e.cm,K,t,i):Je=Fa(K,t,i);if(Je==null)if(!at&&J())t=Ua(n,e.cm,K,t.line,X);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")ne();else if(r=="column")ne(!0);else if(r=="word"||r=="group")for(var le=null,be=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),ke=!0;!(i<0&&!ne(!ke));ke=!1){var Be=K.text.charAt(t.ch)||`
|
|
`,He=We(Be,ye)?"w":be&&Be==`
|
|
`?"n":!be||/\s/.test(Be)?null:"p";if(be&&!ke&&!He&&(He="s"),le&&le!=He){i<0&&(i=1,ne(),t.sticky="after");break}if(He&&(le=He),i>0&&!ne(!ke))break}var Ze=ea(e,t,E,B,!0);return pi(E,Ze)&&(Ze.hitSide=!0),Ze}function ks(e,t,i,r){var n=e.doc,E=t.left,B;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),X=Math.max(K-.5*Yi(e.display),3);B=(i>0?t.bottom:t.top)+i*X}else r=="line"&&(B=i>0?t.bottom+3:t.top-3);for(var J;!(J=va(e,E,B),!J.outside);){if(i<0?B<=0:B>=n.height){J.hitSide=!0;break}B+=i*5}return J}var Ht=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ae,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ht.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 E(K){for(var X=K.target;X;X=X.parentNode){if(X==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(X.className))break}return!1}we(n,"paste",function(K){if(!E(K)||Fe(r,K)||Ts(K,r))return;W<=11&&setTimeout(or(r,function(){return t.updateFromDOM()}),20)}),we(n,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),we(n,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),we(n,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(n,"touchstart",function(){return i.forceCompositionEnd()}),we(n,"input",function(){t.composing||t.readFromDOMSoon()});function B(K){if(!E(K)||Fe(r,K))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var X=ws(r);oa({lineWise:!0,text:X.text}),K.type=="cut"&&r.operation(function(){r.setSelections(X.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var J=Qr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",J),K.clipboardData.getData("Text")==J){K.preventDefault();return}}var ne=Ls(),le=ne.firstChild;r.display.lineSpace.insertBefore(ne,r.display.lineSpace.firstChild),le.value=Qr.text.join(`
|
|
`);var be=document.activeElement;Q(le),setTimeout(function(){r.display.lineSpace.removeChild(ne),be.focus(),be==n&&i.showPrimarySelection()},50)}we(n,"copy",B),we(n,"cut",B)},Ht.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ht.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ht.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ht.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ht.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 E=sa(t,e.anchorNode,e.anchorOffset),B=sa(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&B&&!B.bad&&Et(vi(E,B),r)==0&&Et(gi(E,B),n)==0)return;var K=t.display.view,X=r.line>=t.display.viewFrom&&Ds(t,r)||{node:K[0].measure.map[2],offset:0},J=n.line<t.display.viewTo&&Ds(t,n);if(!J){var ne=K[K.length-1].measure,le=ne.maps?ne.maps[ne.maps.length-1]:ne.map;J={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!X||!J){e.removeAllRanges();return}var be=e.rangeCount&&e.getRangeAt(0),ye;try{ye=v(X.node,X.offset,J.offset,J.node)}catch(ke){}ye&&(!D&&t.state.focused?(e.collapse(X.node,X.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),be&&e.anchorNode==null?e.addRange(be):D&&this.startGracePeriod()),this.rememberSelection()},Ht.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)},Ht.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Ht.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ht.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},Ht.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ht.prototype.blur=function(){this.div.blur()},Ht.prototype.getField=function(){return this.div},Ht.prototype.supportsTouch=function(){return!0},Ht.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)},Ht.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ht.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&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=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Pr(t,function(){br(t.doc,wi(i,r),xe),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ht.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=Ue(r.line-1,ut(e.doc,r.line-1).length)),n.ch==ut(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ue(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var E,B,K;r.line==t.viewFrom||(E=Bi(e,r.line))==0?(B=kt(t.view[0].line),K=t.view[0].node):(B=kt(t.view[E].line),K=t.view[E-1].node.nextSibling);var X=Bi(e,n.line),J,ne;if(X==t.view.length-1?(J=t.viewTo-1,ne=t.lineDiv.lastChild):(J=kt(t.view[X+1].line)-1,ne=t.view[X+1].node.previousSibling),!K)return!1;for(var le=e.doc.splitLines(tu(e,K,ne,B,J)),be=Hr(e.doc,Ue(B,0),Ue(J,ut(e.doc,J).text.length));le.length>1&&be.length>1;)if(De(le)==De(be))le.pop(),be.pop(),J--;else if(le[0]==be[0])le.shift(),be.shift(),B++;else break;for(var ye=0,ke=0,Be=le[0],He=be[0],Ze=Math.min(Be.length,He.length);ye<Ze&&Be.charCodeAt(ye)==He.charCodeAt(ye);)++ye;for(var at=De(le),Je=De(be),ot=Math.min(at.length-(le.length==1?ye:0),Je.length-(be.length==1?ye:0));ke<ot&&at.charCodeAt(at.length-ke-1)==Je.charCodeAt(Je.length-ke-1);)++ke;if(le.length==1&&be.length==1&&B==r.line)for(;ye&&ye>r.ch&&at.charCodeAt(at.length-ke-1)==Je.charCodeAt(Je.length-ke-1);)ye--,ke++;le[le.length-1]=at.slice(0,at.length-ke).replace(/^\u200b+/,""),le[0]=le[0].slice(ye).replace(/\u200b+$/,"");var xt=Ue(B,ye),gt=Ue(J,be.length?De(be).length-ke:0);if(le.length>1||le[0]||Et(xt,gt))return rn(e.doc,le,xt,gt,"+input"),!0},Ht.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ht.prototype.reset=function(){this.forceCompositionEnd()},Ht.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ht.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)},Ht.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Pr(this.cm,function(){return Ar(e.cm)})},Ht.prototype.setUneditable=function(e){e.contentEditable="false"},Ht.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||or(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ht.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ht.prototype.onContextMenu=function(){},Ht.prototype.resetPosition=function(){},Ht.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=ut(e.doc,t.line),n=eo(i,r,t.line),E=et(r,e.doc.direction),B="left";if(E){var K=Xe(E,t.ch);B=K%2?"right":"left"}var X=io(n.map,t.ch,B);return X.offset=X.collapse=="right"?X.end:X.start,X}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var E="",B=!1,K=e.doc.lineSeparator(),X=!1;function J(ye){return function(ke){return ke.id==ye}}function ne(){B&&(E+=K,X&&(E+=K),B=X=!1)}function le(ye){ye&&(ne(),E+=ye)}function be(ye){if(ye.nodeType==1){var ke=ye.getAttribute("cm-text");if(ke){le(ke);return}var Be=ye.getAttribute("cm-marker"),He;if(Be){var Ze=e.findMarks(Ue(r,0),Ue(n+1,0),J(+Be));Ze.length&&(He=Ze[0].find(0))&&le(Hr(e.doc,He.from,He.to).join(K));return}if(ye.getAttribute("contenteditable")=="false")return;var at=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;at&&ne();for(var Je=0;Je<ye.childNodes.length;Je++)be(ye.childNodes[Je]);/^(pre|p)$/i.test(ye.nodeName)&&(X=!0),at&&(B=!0)}else ye.nodeType==3&&le(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(be(t),t==i);)t=t.nextSibling,X=!1;return E}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ue(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 E=e.display.view[n];if(E.node==r)return ru(E,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!S(r,t))return ln(Ue(kt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var E=e.rest?De(e.rest):e.line;return ln(Ue(kt(E),E.text.length),n)}var B=t.nodeType==3?t:null,K=t;for(!B&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(B=t.firstChild,i&&(i=B.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var X=e.measure,J=X.maps;function ne(He,Ze,at){for(var Je=-1;Je<(J?J.length:0);Je++)for(var ot=Je<0?X.map:J[Je],xt=0;xt<ot.length;xt+=3){var gt=ot[xt+2];if(gt==He||gt==Ze){var At=kt(Je<0?e.line:e.rest[Je]),zt=ot[xt]+at;return(at<0||gt!=He)&&(zt=ot[xt+(at?1:0)]),Ue(At,zt)}}}var le=ne(B,K,i);if(le)return ln(le,n);for(var be=K.nextSibling,ye=B?B.nodeValue.length-i:0;be;be=be.nextSibling){if(le=ne(be,be.firstChild,0),le)return ln(Ue(le.line,le.ch-ye),n);ye+=be.textContent.length}for(var ke=K.previousSibling,Be=i;ke;ke=ke.previousSibling){if(le=ne(ke,ke.firstChild,-1),le)return ln(Ue(le.line,le.ch+Be),n);Be+=ke.textContent.length}}var Qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ae,this.hasSelection=!1,this.composing=null};Qt.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),T&&(n.style.width="0px"),we(n,"input",function(){H&&W>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),we(n,"paste",function(B){if(Fe(r,B)||Ts(B,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function E(B){if(Fe(r,B))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=ws(r);oa({lineWise:!0,text:K.text}),B.type=="cut"?r.setSelections(K.ranges,null,xe):(i.prevInput="",n.value=K.text.join(`
|
|
`),Q(n))}else return;B.type=="cut"&&(r.state.cutIncoming=+new Date)}we(n,"cut",E),we(n,"copy",E),we(e.scroller,"paste",function(B){if(ui(e,B)||Fe(r,B))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var K=new Event("paste");K.clipboardData=B.clipboardData,n.dispatchEvent(K)}),we(e.lineSpace,"selectstart",function(B){ui(e,B)||ee(B)}),we(n,"compositionstart",function(){var B=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:B,range:r.markText(B,r.getCursor("to"),{className:"CodeMirror-composing"})}}),we(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Qt.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Zr(e,i.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),B=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+B.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+B.left-E.left))}return r},Qt.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")},Qt.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&&Q(this.textarea),H&&W>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",H&&W>=9&&(this.hasSelection=null))},Qt.prototype.getField=function(){return this.textarea},Qt.prototype.supportsTouch=function(){return!1},Qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},Qt.prototype.blur=function(){this.textarea.blur()},Qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Qt.prototype.receivedFocus=function(){this.slowPoll()},Qt.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()})},Qt.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)},Qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(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(H&&W>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=n.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var B=0,K=Math.min(r.length,n.length);B<K&&r.charCodeAt(B)==n.charCodeAt(B);)++B;return Pr(t,function(){za(t,n.slice(B),r.length-B,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},Qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Qt.prototype.onKeyPress=function(){H&&W>=9&&(this.hasSelection=null),this.fastPoll()},Qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=Ni(i,e),B=r.scroller.scrollTop;if(!E||A)return;var K=i.options.resetSelectionOnContextMenu;K&&i.doc.sel.contains(E)==-1&&or(i,br)(i.doc,wi(E),xe);var X=n.style.cssText,J=t.wrapper.style.cssText,ne=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ne.top-5)+"px; left: "+(e.clientX-ne.left-5)+`px;
|
|
z-index: 1000; background: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var le;M&&(le=window.scrollY),r.input.focus(),M&&window.scrollTo(null,le),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function be(){if(n.selectionStart!=null){var Be=i.somethingSelected(),He="\u200B"+(Be?n.value:"");n.value="\u21DA",n.value=He,t.prevInput=Be?"":"\u200B",n.selectionStart=1,n.selectionEnd=He.length,r.selForContextMenu=i.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=J,n.style.cssText=X,H&&W<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=B),n.selectionStart!=null){(!H||H&&W<9)&&be();var Be=0,He=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?or(i,Xo)(i):Be++<10?r.detectingSelectAll=setTimeout(He,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(He,200)}}if(H&&W>=9&&be(),k){ue(e);var ke=function(){nt(window,"mouseup",ke),setTimeout(ye,20)};we(window,"mouseup",ke)}else setTimeout(ye,50)},Qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Qt.prototype.setUneditable=function(){},Qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?U(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=I();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=K.getValue()}var n;if(e.form&&(we(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;n=E.submit;try{var B=E.submit=function(){r(),E.submit=n,E.submit(),E.submit=B}}catch(X){}}t.finishInit=function(X){X.save=r,X.getTextArea=function(){return e},X.toTextArea=function(){X.toTextArea=isNaN,r(),e.parentNode.removeChild(X.getWrapperElement()),e.style.display="",e.form&&(nt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var K=Vt(function(X){return e.parentNode.insertBefore(X,e.nextSibling)},t);return K}function nu(e){e.off=nt,e.on=we,e.wheelEventPixels=dl,e.Doc=Lr,e.splitLines=St,e.countColumn=q,e.findColumn=Se,e.isWordChar=Ne,e.Pass=Oe,e.signal=Le,e.Line=Pi,e.changeEnd=Ai,e.scrollbarModel=To,e.Pos=Ue,e.cmpPos=Et,e.modes=Xt,e.mimeModes=_t,e.resolveMode=bt,e.getMode=Nr,e.modeExtensions=hr,e.extendMode=pr,e.copyState=Br,e.startState=qr,e.innerMode=ci,e.commands=In,e.keyMap=hi,e.keyName=us,e.isModifierKey=ss,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=On,e.TextMarker=ki,e.LineWidget=_n,e.e_preventDefault=ee,e.e_stopPropagation=te,e.e_stop=ue,e.addClass=G,e.contains=S,e.rmClass=f,e.keyNames=Di}$l(Vt),ql(Vt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Lr.prototype)Lr.prototype.hasOwnProperty(la)&&ce(au,la)<0&&(Vt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Lr.prototype[la]));return fe(Lr),Vt.inputStyles={textarea:Qt,contenteditable:Ht},Vt.defineMode=function(e){!Vt.defaults.mode&&e!="null"&&(Vt.defaults.mode=e),Ir.apply(this,arguments)},Vt.defineMIME=Kr,Vt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Vt.defineMIME("text/plain","null"),Vt.defineExtension=function(e,t){Vt.prototype[e]=t},Vt.defineDocExtension=function(e,t){Lr.prototype[e]=t},Vt.fromTextArea=iu,nu(Vt),Vt.version="5.58.2",Vt})},VwnK:function(wt,pt,se){"use strict";se.r(pt);var re=se("+L6B"),Z=se("2/Rp"),D=se("OaEy"),Y=se("2fM7"),N=se("14J3"),P=se("BMrR"),H=se("5NDa"),W=se("5rEg"),M=se("jCWc"),O=se("kPKH"),y=se("jrin"),A=se("miYZ"),R=se("tsqr"),L=se("k1fw"),w=se("9og8"),T=se("y8nQ"),u=se("Vl3Y"),o=se("tJVT"),l=se("PpiC"),h=se("WmNS"),C=se.n(h),g=se("q1tI"),p=se.n(g),k=se("9kvl"),b=se("ErOA"),f=se("xKgJ"),m=se("Ot1p"),d=function(x){var v,S,I,G=x.user,V=x.globalSetting,Q=x.loading,z=x.dispatch,U=x.restful,q=Object(l.a)(x,["user","globalSetting","loading","dispatch","restful"]),ae=Object(g.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),ce=Object(o.a)(ae,2),ve=ce[0],Oe=ce[1],xe=Object(g.useState)(!0),Te=Object(o.a)(xe,2),Ce=Te[0],Se=Te[1],pe=q.match.params,oe=u.a.useForm(),De=Object(o.a)(oe,1),Ye=De[0],Ge=Object(g.useState)(`
|
|
|
|
|
|
##### \u7B80\u8981\u63CF\u8FF0
|
|
|
|
- \u7528\u6237\u6CE8\u518C\u63A5\u53E3
|
|
|
|
##### \u8BF7\u6C42URL
|
|
- \` http://xx.com/api/user/register \`
|
|
|
|
##### \u8BF7\u6C42\u65B9\u5F0F
|
|
- POST
|
|
|
|
##### \u53C2\u6570
|
|
|
|
|\u53C2\u6570\u540D|\u5FC5\u9009|\u7C7B\u578B|\u8BF4\u660E|
|
|
|:---- |:---|:----- |----- |
|
|
|username |\u662F |string |\u7528\u6237\u540D |
|
|
|password |\u662F |string | \u5BC6\u7801 |
|
|
|name |\u5426 |string | \u6635\u79F0 |
|
|
|
|
##### \u8FD4\u56DE\u793A\u4F8B
|
|
|
|
\`\`\`
|
|
{
|
|
"error_code": 0,
|
|
"data": {
|
|
"uid": "1",
|
|
"username": "12154545",
|
|
"name": "\u5434\u7CFB\u6302",
|
|
"groupid": 2 ,
|
|
"reg_time": "1436864169",
|
|
"last_login_time": "0",
|
|
}
|
|
}
|
|
\`\`\`
|
|
|
|
##### \u8FD4\u56DE\u53C2\u6570\u8BF4\u660E
|
|
|
|
|\u53C2\u6570\u540D|\u7C7B\u578B|\u8BF4\u660E|
|
|
|:----- |:-----|----- |
|
|
|groupid |int |\u7528\u6237\u7EC4id\uFF0C1\uFF1A\u8D85\u7EA7\u7BA1\u7406\u5458\uFF1B2\uFF1A\u666E\u901A\u7528\u6237 |
|
|
|
|
##### \u5907\u6CE8
|
|
|
|
- \u66F4\u591A\u8FD4\u56DE\u9519\u8BEF\u4EE3\u7801\u8BF7\u770B\u9996\u9875\u7684\u9519\u8BEF\u4EE3\u7801\u63CF\u8FF0
|
|
|
|
|
|
|
|
\u6B22\u8FCE\u4F7F\u7528\uFF01`),tt=Object(o.a)(Ge,2),qe=tt[0],Ae=tt[1];Object(g.useEffect)(function(){Ye.resetFields()},[pe.id]);var Ne=function(){var ze=Object(w.a)(C.a.mark(function je(_e){var Pe,Ke,$e;return C.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Ye.getFieldsValue();case 2:return Pe=Xe.sent,Ke="/api/restfuls.json",pe.id!=0&&(Ke="/api/restfuls/".concat(pe.id,".json")),Xe.next=7,Object(b.a)(Ke,{method:pe.id!=0?"put":"post",body:Object(L.a)(Object(L.a)({file_type:0},Pe),{},{parent_id:Pe.parent_id||""})});case 7:$e=Xe.sent,$e.status===0&&(R.b.success("\u6DFB\u52A0\u6210\u529F"),q.history.push("/ch/rest/".concat($e.data.id)));case 9:case"end":return Xe.stop()}},je)}));return function(_e){return ze.apply(this,arguments)}}(),We=function(){var ze=Object(w.a)(C.a.mark(function je(){var _e;return C.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,z({type:"restful/getRestful"});case 2:if(!(pe.id!=0)){Ke.next=8;break}return Ke.next=5,z({type:"restful/getRestfulDetail",payload:Object(L.a)({},pe)});case 5:_e=Ke.sent,Ye.setFieldsValue({description:_e==null?void 0:_e.description,name:_e==null?void 0:_e.name}),Object(f.o)()||q.history.replace("/403");case 8:case"end":return Ke.stop()}},je)}));return function(){return ze.apply(this,arguments)}}();return Object(g.useEffect)(function(){var ze,je;if((ze=U.restful)!==null&&ze!==void 0&&ze.data&&Ye.setFieldsValue({parent_id:pe.categoryId*1}),(je=U.restfulDetail)!==null&&je!==void 0&&je.description&&pe.id!=0){var _e;Ae((_e=U.restfulDetail)===null||_e===void 0?void 0:_e.description)}},[U.restful,(v=U.restfulDetail)===null||v===void 0?void 0:v.description]),Object(g.useEffect)(function(){Se(!0),We()},[pe.id]),p.a.createElement("section",null,p.a.createElement("aside",{className:"edu-container mt30"},p.a.createElement(u.a,{onFinish:Ne,form:Ye,initialValues:Object(y.a)({},"name","")},p.a.createElement(P.a,{className:"mt30"},p.a.createElement(O.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),p.a.createElement(O.a,{flex:"1"},p.a.createElement(u.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},p.a.createElement(W.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))),p.a.createElement(P.a,{className:""},p.a.createElement(O.a,{flex:"80px",className:"font14"},"\u6240\u5C5E\u76EE\u5F55:"),p.a.createElement(O.a,{flex:"1"},p.a.createElement(u.a.Item,{name:"parent_id",rules:[{required:!0,message:"\u6240\u5C5E\u76EE\u5F55"}]},p.a.createElement(Y.a,{showSearch:!0,style:{width:200},placeholder:"\u8BF7\u9009\u62E9\u76EE\u5F55",optionFilterProp:"children",filterOption:function(je,_e){return _e.children.toLowerCase().indexOf(je.toLowerCase())>=0}},p.a.createElement(Y.a.Option,{value:0,key:9999},"\u6839\u76EE\u5F55"),U==null||((S=U.restful)===null||S===void 0||((I=S.data)===null||I===void 0))?void 0:I.map(function(ze,je){return p.a.createElement(Y.a.Option,{value:ze.id,key:je},ze.title)}))))),p.a.createElement(u.a.Item,{name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},p.a.createElement(m.a,{defaultValue:qe,watch:!0,height:600})),p.a.createElement(P.a,{align:"middle",justify:"center"},p.a.createElement(O.a,null,p.a.createElement(Z.a,{style:{width:130},size:"large",type:"primary",htmlType:"submit"},"\u4FDD\u5B58"))),p.a.createElement("div",{className:"mt40"}))))};pt.default=Object(k.a)(function(a){var x=a.user,v=a.loading,S=a.globalSetting,I=a.restful;return{user:x,globalSetting:S,restful:I,loading:v.models.index}})(d)},Y1PL:function(wt,pt,se){"use strict";se.r(pt),se.d(pt,"ResizableTextArea",function(){return ce});var re=se("wx14"),Z=se("1OyB"),D=se("vuIU"),Y=se("Ji7U"),N=se("LK+K"),P=se("q1tI"),H=se("VTBJ"),W=se("rePB"),M=se("Zm9Q"),O=se("Kwbf"),y=se("c+Xe"),A=se("m+aA"),R=se("bdgK"),L=new Map;function w(xe){xe.forEach(function(Te){var Ce,Se=Te.target;(Ce=L.get(Se))===null||Ce===void 0||Ce.forEach(function(pe){return pe(Se)})})}var T=new R.default(w),u=null,o=null;function l(xe,Te){L.has(xe)||(L.set(xe,new Set),T.observe(xe)),L.get(xe).add(Te)}function h(xe,Te){L.has(xe)&&(L.get(xe).delete(Te),L.get(xe).size||(T.unobserve(xe),L.delete(xe)))}var C=function(xe){Object(Y.a)(Ce,xe);var Te=Object(N.a)(Ce);function Ce(){return Object(Z.a)(this,Ce),Te.apply(this,arguments)}return Object(D.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(P.Component),g=P.createContext(null);function p(xe){var Te=xe.children,Ce=xe.onBatchResize,Se=P.useRef(0),pe=P.useRef([]),oe=P.useContext(g),De=P.useCallback(function(Ye,Ge,tt){Se.current+=1;var qe=Se.current;pe.current.push({size:Ye,element:Ge,data:tt}),Promise.resolve().then(function(){qe===Se.current&&(Ce==null||Ce(pe.current),pe.current=[])}),oe==null||oe(Ye,Ge,tt)},[Ce,oe]);return P.createElement(g.Provider,{value:De},Te)}function k(xe){var Te=xe.children,Ce=xe.disabled,Se=P.useRef(null),pe=P.useRef(null),oe=P.useContext(g),De=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ye=P.isValidElement(Te)&&Object(y.c)(Te),Ge=Ye?Te.ref:null,tt=P.useMemo(function(){return Object(y.a)(Ge,Se)},[Ge,Se]),qe=P.useRef(xe);qe.current=xe;var Ae=P.useCallback(function(Ne){var We=qe.current,ze=We.onResize,je=We.data,_e=Ne.getBoundingClientRect(),Pe=_e.width,Ke=_e.height,$e=Ne.offsetWidth,Qe=Ne.offsetHeight,Xe=Math.floor(Pe),dt=Math.floor(Ke);if(De.current.width!==Xe||De.current.height!==dt||De.current.offsetWidth!==$e||De.current.offsetHeight!==Qe){var et={width:Xe,height:dt,offsetWidth:$e,offsetHeight:Qe};De.current=et;var it=$e===Math.round(Pe)?Pe:$e,we=Qe===Math.round(Ke)?Ke:Qe,lt=Object(H.a)(Object(H.a)({},et),{},{offsetWidth:it,offsetHeight:we});oe==null||oe(lt,Ne,je),ze&&Promise.resolve().then(function(){ze(lt,Ne)})}},[]);return P.useEffect(function(){var Ne=Object(A.a)(Se.current)||Object(A.a)(pe.current);return Ne&&!Ce&&l(Ne,Ae),function(){return h(Ne,Ae)}},[Se.current,Ce]),P.createElement(C,{ref:pe},Ye?P.cloneElement(Te,{ref:tt}):Te)}var b="rc-observer-key";function f(xe){var Te=xe.children,Ce=Object(M.a)(Te);return Ce.map(function(Se,pe){var oe=(Se==null?void 0:Se.key)||"".concat(b,"-").concat(pe);return P.createElement(k,Object(re.a)({},xe,{key:oe}),Se)})}f.Collection=p;var m=f,d=se("bT9E"),a=se("TSYQ"),x=se.n(a),v=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,S=["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"],I={},G;function V(xe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Te&&I[Ce])return I[Ce];var Se=window.getComputedStyle(xe),pe=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),De=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),Ye=S.map(function(tt){return"".concat(tt,":").concat(Se.getPropertyValue(tt))}).join(";"),Ge={sizingStyle:Ye,paddingSize:oe,borderSize:De,boxSizing:pe};return Te&&Ce&&(I[Ce]=Ge),Ge}function Q(xe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;G||(G=document.createElement("textarea"),G.setAttribute("tab-index","-1"),G.setAttribute("aria-hidden","true"),document.body.appendChild(G)),xe.getAttribute("wrap")?G.setAttribute("wrap",xe.getAttribute("wrap")):G.removeAttribute("wrap");var pe=V(xe,Te),oe=pe.paddingSize,De=pe.borderSize,Ye=pe.boxSizing,Ge=pe.sizingStyle;G.setAttribute("style","".concat(Ge,";").concat(v)),G.value=xe.value||xe.placeholder||"";var tt=Number.MIN_SAFE_INTEGER,qe=Number.MAX_SAFE_INTEGER,Ae=G.scrollHeight,Ne;if(Ye==="border-box"?Ae+=De:Ye==="content-box"&&(Ae-=oe),Ce!==null||Se!==null){G.value=" ";var We=G.scrollHeight-oe;Ce!==null&&(tt=We*Ce,Ye==="border-box"&&(tt=tt+oe+De),Ae=Math.max(tt,Ae)),Se!==null&&(qe=We*Se,Ye==="border-box"&&(qe=qe+oe+De),Ne=Ae>qe?"":"hidden",Ae=Math.min(qe,Ae))}return{height:Ae,minHeight:tt,maxHeight:qe,overflowY:Ne,resize:"none"}}var z=se("Gytx"),U=se.n(z),q;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})(q||(q={}));var ae=function(xe){Object(Y.a)(Ce,xe);var Te=Object(N.a)(Ce);function Ce(Se){var pe;return Object(Z.a)(this,Ce),pe=Te.call(this,Se),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(oe){pe.textArea=oe},pe.handleResize=function(oe){var De=pe.state.resizeStatus,Ye=pe.props,Ge=Ye.autoSize,tt=Ye.onResize;if(De!==q.NONE)return;typeof tt=="function"&&tt(oe),Ge&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var oe=pe.props.autoSize;if(!oe||!pe.textArea)return;var De=oe.minRows,Ye=oe.maxRows,Ge=Q(pe.textArea,!1,De,Ye);pe.setState({textareaStyles:Ge,resizeStatus:q.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:q.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:q.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var oe=pe.props,De=oe.prefixCls,Ye=De===void 0?"rc-textarea":De,Ge=oe.autoSize,tt=oe.onResize,qe=oe.className,Ae=oe.disabled,Ne=pe.state,We=Ne.textareaStyles,ze=Ne.resizeStatus,je=Object(d.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=x()(Ye,qe,Object(W.a)({},"".concat(Ye,"-disabled"),Ae));"value"in je&&(je.value=je.value||"");var Pe=Object(H.a)(Object(H.a)(Object(H.a)({},pe.props.style),We),ze===q.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(m,{onResize:pe.handleResize,disabled:!(Ge||tt)},P.createElement("textarea",Object(re.a)({},je,{className:_e,style:Pe,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:q.NONE},pe}return Object(D.a)(Ce,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!U()(pe.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 pe=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,oe)}}catch(De){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(P.Component),ce=ae,ve=function(xe){Object(Y.a)(Ce,xe);var Te=Object(N.a)(Ce);function Ce(Se){var pe;Object(Z.a)(this,Ce),pe=Te.call(this,Se),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(De){pe.resizableTextArea=De},pe.handleChange=function(De){var Ye=pe.props.onChange;pe.setValue(De.target.value,function(){pe.resizableTextArea.resizeTextarea()}),Ye&&Ye(De)},pe.handleKeyDown=function(De){var Ye=pe.props,Ge=Ye.onPressEnter,tt=Ye.onKeyDown;De.keyCode===13&&Ge&&Ge(De),tt&&tt(De)};var oe=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return pe.state={value:oe},pe}return Object(D.a)(Ce,[{key:"setValue",value:function(pe,oe){"value"in this.props||this.setState({value:pe},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ce,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Ce}(P.Component),Oe=pt.default=ve},ZpRC:function(wt,pt,se){"use strict";function re(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function Z(y,A){return(!A||y!=="hidden")&&y!=="visible"&&y!=="clip"}function D(y,A){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var R=getComputedStyle(y,null);return Z(R.overflowY,A)||Z(R.overflowX,A)||function(L){var w=function(T){if(!T.ownerDocument||!T.ownerDocument.defaultView)return null;try{return T.ownerDocument.defaultView.frameElement}catch(u){return null}}(L);return!!w&&(w.clientHeight<L.scrollHeight||w.clientWidth<L.scrollWidth)}(y)}return!1}function Y(y,A,R,L,w,T,u,o){return T<y&&u>A||T>y&&u<A?0:T<=y&&o<=R||u>=A&&o>=R?T-y-L:u>A&&o<R||T<y&&o>R?u-A+w:0}var N=function(y,A){var R=window,L=A.scrollMode,w=A.block,T=A.inline,u=A.boundary,o=A.skipOverflowHiddenElements,l=typeof u=="function"?u:function(We){return We!==u};if(!re(y))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,C=[],g=y;re(g)&&l(g);){if((g=g.parentElement)===h){C.push(g);break}g!=null&&g===document.body&&D(g)&&!D(document.documentElement)||g!=null&&D(g,o)&&C.push(g)}for(var p=R.visualViewport?R.visualViewport.width:innerWidth,k=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,m=y.getBoundingClientRect(),d=m.height,a=m.width,x=m.top,v=m.right,S=m.bottom,I=m.left,G=w==="start"||w==="nearest"?x:w==="end"?S:x+d/2,V=T==="center"?I+a/2:T==="end"?v:I,Q=[],z=0;z<C.length;z++){var U=C[z],q=U.getBoundingClientRect(),ae=q.height,ce=q.width,ve=q.top,Oe=q.right,xe=q.bottom,Te=q.left;if(L==="if-needed"&&x>=0&&I>=0&&S<=k&&v<=p&&x>=ve&&S<=xe&&I>=Te&&v<=Oe)return Q;var Ce=getComputedStyle(U),Se=parseInt(Ce.borderLeftWidth,10),pe=parseInt(Ce.borderTopWidth,10),oe=parseInt(Ce.borderRightWidth,10),De=parseInt(Ce.borderBottomWidth,10),Ye=0,Ge=0,tt="offsetWidth"in U?U.offsetWidth-U.clientWidth-Se-oe:0,qe="offsetHeight"in U?U.offsetHeight-U.clientHeight-pe-De:0;if(h===U)Ye=w==="start"?G:w==="end"?G-k:w==="nearest"?Y(f,f+k,k,pe,De,f+G,f+G+d,d):G-k/2,Ge=T==="start"?V:T==="center"?V-p/2:T==="end"?V-p:Y(b,b+p,p,Se,oe,b+V,b+V+a,a),Ye=Math.max(0,Ye+f),Ge=Math.max(0,Ge+b);else{Ye=w==="start"?G-ve-pe:w==="end"?G-xe+De+qe:w==="nearest"?Y(ve,xe,ae,pe,De+qe,G,G+d,d):G-(ve+ae/2)+qe/2,Ge=T==="start"?V-Te-Se:T==="center"?V-(Te+ce/2)+tt/2:T==="end"?V-Oe+oe+tt:Y(Te,Oe,ce,Se,oe+tt,V,V+a,a);var Ae=U.scrollLeft,Ne=U.scrollTop;G+=Ne-(Ye=Math.max(0,Math.min(Ne+Ye,U.scrollHeight-ae+qe))),V+=Ae-(Ge=Math.max(0,Math.min(Ae+Ge,U.scrollWidth-ce+tt)))}Q.push({el:U,top:Ye,left:Ge})}return Q};function P(y){return y===Object(y)&&Object.keys(y).length!==0}function H(y,A){A===void 0&&(A="auto");var R="scrollBehavior"in document.body.style;y.forEach(function(L){var w=L.el,T=L.top,u=L.left;w.scroll&&R?w.scroll({top:T,left:u,behavior:A}):(w.scrollTop=T,w.scrollLeft=u)})}function W(y){return y===!1?{block:"end",inline:"nearest"}:P(y)?y:{block:"start",inline:"nearest"}}function M(y,A){var R=!y.ownerDocument.documentElement.contains(y);if(P(A)&&typeof A.behavior=="function")return A.behavior(R?[]:N(y,A));if(R)return;var L=W(A);return H(N(y,L),L.behavior)}var O=pt.a=M},bT9E:function(wt,pt,se){"use strict";se.d(pt,"a",function(){return Z});var re=se("VTBJ");function Z(D,Y){var N=Object(re.a)({},D);return Array.isArray(Y)&&Y.forEach(function(P){delete N[P]}),N}},c5Ni:function(wt,pt,se){},dejd:function(wt,pt,se){},dmUQ:function(wt,pt,se){"use strict";var re=se("Ff2n"),Z=se("rePB"),D=se("1OyB"),Y=se("vuIU"),N=se("Ji7U"),P=se("md7G"),H=se("foSv"),W=se("q1tI"),M=se.n(W),O=se("TSYQ"),y=se.n(O),A=se("4IlW");function R(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),x.push.apply(x,v)}return x}function L(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?R(Object(x),!0).forEach(function(v){Object(Z.a)(d,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):R(Object(x)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(x,v))})}return d}function w(d){var a=T();return function(){var v=Object(H.a)(d),S;if(a){var I=Object(H.a)(this).constructor;S=Reflect.construct(v,arguments,I)}else S=v.apply(this,arguments);return Object(P.a)(this,S)}}function T(){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 u(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},h=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},k=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},b=function(d){Object(N.a)(x,d);var a=w(x);function x(v){var S;Object(D.a)(this,x),S=a.call(this,v),S.onKeyDown=function(V){var Q=S.props,z=Q.onKeyDown,U=Q.onPressEnter;if(V.keyCode===A.a.UP){var q=S.getRatio(V);S.up(V,q,null),S.stop()}else if(V.keyCode===A.a.DOWN){var ae=S.getRatio(V);S.down(V,ae,null),S.stop()}else V.keyCode===A.a.ENTER&&U&&U(V);if(S.recordCursorPosition(),S.lastKeyCode=V.keyCode,z){for(var ce=arguments.length,ve=new Array(ce>1?ce-1:0),Oe=1;Oe<ce;Oe++)ve[Oe-1]=arguments[Oe];z.apply(void 0,[V].concat(ve))}},S.onKeyUp=function(V){var Q=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),Q){for(var z=arguments.length,U=new Array(z>1?z-1:0),q=1;q<z;q++)U[q-1]=arguments[q];Q.apply(void 0,[V].concat(U))}},S.onChange=function(V){var Q=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(V)),S.setState({inputValue:S.rawInput}),Q(S.toNumber(S.rawInput))},S.onMouseUp=function(){var V=S.props.onMouseUp;S.recordCursorPosition(),V&&V.apply(void 0,arguments)},S.onFocus=function(){var V;S.setState({focused:!0}),(V=S.props).onFocus.apply(V,arguments)},S.onBlur=function(){var V=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var Q=S.getCurrentValidValue(S.state.inputValue),z=S.setValue(Q,u);if(V){var U=S.input.value,q=S.getInputDisplayValue({focus:!1,value:z});S.input.value=q&&Number(q),V.apply(void 0,arguments),S.input.value=U}},S.getRatio=function(V){var Q=1;return V.metaKey||V.ctrlKey?Q=.1:V.shiftKey&&(Q=10),Q},S.getFullNum=function(V){return isNaN(V)?V:/e/i.test(String(V))?Number(V).toFixed(18).replace(/\.?0+$/,""):V},S.getPrecision=function(V){if(p(S.props.precision))return S.props.precision;var Q=String(V);if(Q.indexOf("e-")>=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var z=0;return Q.indexOf(".")>=0&&(z=Q.length-Q.indexOf(".")-1),z},S.getInputDisplayValue=function(V){var Q=V||S.state,z=Q.focused,U=Q.inputValue,q=Q.value,ae;z?ae=U:ae=S.toPrecisionAsStep(q),ae==null&&(ae="");var ce=S.formatWrapper(ae);return p(S.props.decimalSeparator)&&(ce=ce.toString().replace(".",S.props.decimalSeparator)),ce},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(V){}},S.restoreByAfter=function(V){if(V===void 0)return!1;var Q=S.input.value,z=Q.lastIndexOf(V);if(z===-1)return!1;var U=S.cursorBefore.length;return S.lastKeyCode===A.a.DELETE&&S.cursorBefore.charAt(U-1)===V[0]?(S.fixCaret(U,U),!0):z+V.length===Q.length?(S.fixCaret(z,z),!0):!1},S.partRestoreByAfter=function(V){return V===void 0?!1:Array.prototype.some.call(V,function(Q,z){var U=V.substring(z);return S.restoreByAfter(U)})},S.isNotCompleteNumber=function(V){return isNaN(V)||V===""||V===null||V&&V.toString().indexOf(".")===V.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(V,Q,z){S.pressingUpOrDown=!0,S.step("down",V,Q,z)},S.up=function(V,Q,z){S.pressingUpOrDown=!0,S.step("up",V,Q,z)},S.saveInput=function(V){S.input=V};var I=v.value;I===void 0&&(I=v.defaultValue),S.state={focused:v.autoFocus};var G=S.getValidValue(S.toNumber(I));return S.state=L(L({},S.state),{},{inputValue:S.toPrecisionAsStep(G),value:G}),S}return Object(Y.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var I=this.props,G=I.value,V=I.onChange,Q=I.max,z=I.min,U=this.state.focused;if(S){if(!k(S.value,G)||!k(S.max,Q)||!k(S.min,z)){var q=U?G:this.getValidValue(G),ae;this.pressingUpOrDown?ae=q:this.inputting?ae=this.rawInput:ae=this.toPrecisionAsStep(q),this.setState({value:q,inputValue:ae})}var ce="value"in this.props?G:this.state.value;"max"in this.props&&S.max!==Q&&typeof ce=="number"&&ce>Q&&V&&V(Q),"min"in this.props&&S.min!==z&&typeof ce=="number"&&ce<z&&V&&V(z)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ve=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ve=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ve=this.cursorStart):ve=this.input.value.length,this.fixCaret(ve,ve)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Oe){}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(S){var I=S;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(S){var I=S.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,V=parseFloat(S);return isNaN(V)?S:(V<I&&(V=I),V>G&&(V=G),V)}},{key:"setValue",value:function(S,I){var G=this.props.precision,V=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),Q=this.state.value,z=Q===void 0?null:Q,U=this.state.inputValue,q=U===void 0?null:U,ae=typeof V=="number"?V.toFixed(G):"".concat(V),ce=V!==z||ae!=="".concat(q);return"value"in this.props?(q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:q},I)):this.setState({value:V,inputValue:this.toPrecisionAsStep(S)},I),ce&&this.props.onChange(V),V}},{key:"getMaxPrecision",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.props,V=G.precision,Q=G.step;if(p(V))return V;var z=this.getPrecision(I),U=this.getPrecision(Q),q=this.getPrecision(S);return S?Math.max(q,z+U):z+U}},{key:"getPrecisionFactor",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.getMaxPrecision(S,I);return Math.pow(10,G)}},{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(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var I=Math.abs(this.getMaxPrecision(S));return isNaN(I)?S.toString():Number(S).toFixed(I)}},{key:"toNumber",value:function(S){var I=this.props.precision,G=this.state.focused,V=S&&S.length>16&&G;return this.isNotCompleteNumber(S)||V?S:p(I)?Math.round(S*Math.pow(10,I))/Math.pow(10,I):Number(S)}},{key:"upStep",value:function(S,I){var G=this.props.step,V=this.getPrecisionFactor(S,I),Q=Math.abs(this.getMaxPrecision(S,I)),z=((V*S+V*G*I)/V).toFixed(Q);return this.toNumber(z)}},{key:"downStep",value:function(S,I){var G=this.props.step,V=this.getPrecisionFactor(S,I),Q=Math.abs(this.getMaxPrecision(S,I)),z=((V*S-V*G*I)/V).toFixed(Q);return this.toNumber(z)}},{key:"step",value:function(S,I){var G=this,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var z=this.props;if(z.disabled)return;var U=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(U))return;var q=this["".concat(S,"Step")](U,V),ae=q>z.max||q<z.min;if(q>z.max?q=z.max:q<z.min&&(q=z.min),this.setValue(q,null),this.setState({focused:!0},function(){G.pressingUpOrDown=!1}),ae)return;this.autoStepTimer=setTimeout(function(){G[S](I,V,!0)},Q?h:C)}},{key:"fixCaret",value:function(S,I){if(S===void 0||I===void 0||!this.input||!this.input.value)return;try{var G=this.input.selectionStart,V=this.input.selectionEnd;(S!==G||I!==V)&&this.input.setSelectionRange(S,I)}catch(Q){}}},{key:"render",value:function(){var S,I=this.props,G=I.prefixCls,V=I.disabled,Q=I.readOnly,z=I.useTouch,U=I.autoComplete,q=I.upHandler,ae=I.downHandler,ce=I.className,ve=I.max,Oe=I.min,xe=I.style,Te=I.title,Ce=I.onMouseEnter,Se=I.onMouseLeave,pe=I.onMouseOver,oe=I.onMouseOut,De=I.required,Ye=I.onClick,Ge=I.tabIndex,tt=I.type,qe=I.placeholder,Ae=I.id,Ne=I.inputMode,We=I.pattern,ze=I.step,je=I.maxLength,_e=I.autoFocus,Pe=I.name,Ke=I.onPaste,$e=I.onInput,Qe=Object(re.a)(I,["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"]),Xe=this.state,dt=Xe.value,et=Xe.focused,it=y()(G,(S={},Object(Z.a)(S,ce,!!ce),Object(Z.a)(S,"".concat(G,"-disabled"),V),Object(Z.a)(S,"".concat(G,"-focused"),et),S)),we={};Object.keys(Qe).forEach(function(ue){(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(we[ue]=Qe[ue])});var lt=!Q&&!V,nt=this.getInputDisplayValue(null),Le=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=ve),Fe=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=Oe),ge=Le||V||Q,de=Fe||V||Q,fe=y()("".concat(G,"-handler"),"".concat(G,"-handler-up"),Object(Z.a)({},"".concat(G,"-handler-up-disabled"),ge)),ee=y()("".concat(G,"-handler"),"".concat(G,"-handler-down"),Object(Z.a)({},"".concat(G,"-handler-down-disabled"),de)),te=z?{onTouchStart:ge?u:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ie=z?{onTouchStart:de?u:this.down,onTouchEnd:this.stop}:{onMouseDown:de?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:it,style:xe,title:Te,onMouseEnter:Ce,onMouseLeave:Se,onMouseOver:pe,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(G,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:fe}),q||M.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-up-inner"),onClick:o})),M.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:ee}),ae||M.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-down-inner"),onClick:o}))),M.a.createElement("div",{className:"".concat(G,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Oe,"aria-valuemax":ve,"aria-valuenow":dt,required:De,type:tt,placeholder:qe,onPaste:Ke,onClick:Ye,onMouseUp:this.onMouseUp,className:"".concat(G,"-input"),tabIndex:Ge,autoComplete:U,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:lt?this.onKeyDown:u,onKeyUp:lt?this.onKeyUp:u,autoFocus:_e,maxLength:je,readOnly:Q,disabled:V,max:ve,min:Oe,step:ze,name:Pe,title:Te,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(nt),pattern:We,inputMode:Ne,onInput:$e},we))))}}]),x}(M.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var f=b,m=pt.a=f},kSUc:function(wt,pt,se){},lZu9:function(wt,pt,se){(function(re){re(se("VrN/"),se("1eCo"),se("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(Z,D){var Y=re.getMode(Z,"text/html"),N=Y.name=="null";function P(z){if(re.findModeByName){var U=re.findModeByName(z);U&&(z=U.mime||U.mimes[0])}var q=re.getMode(Z,z);return q.name=="null"?null:q}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var H={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var W in H)H.hasOwnProperty(W)&&D.tokenTypeOverrides[W]&&(H[W]=D.tokenTypeOverrides[W]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,T=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(z,U,q){return U.f=U.inline=q,q(z,U)}function h(z,U,q){return U.f=U.block=q,q(z,U)}function C(z){return!z||!/\S/.test(z.string)}function g(z){if(z.linkTitle=!1,z.linkHref=!1,z.linkText=!1,z.em=!1,z.strong=!1,z.strikethrough=!1,z.quote=0,z.indentedCode=!1,z.f==k){var U=N;if(!U){var q=re.innerMode(Y,z.htmlState);U=q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText}U&&(z.f=d,z.block=p,z.htmlState=null)}return z.trailingSpace=0,z.trailingSpaceNewLine=!1,z.prevLine=z.thisLine,z.thisLine={stream:null},null}function p(z,U){var q=z.column()===U.indentation,ae=C(U.prevLine.stream),ce=U.indentedCode,ve=U.prevLine.hr,Oe=U.list!==!1,xe=(U.listStack[U.listStack.length-1]||0)+3;U.indentedCode=!1;var Te=U.indentation;if(U.indentationDiff===null&&(U.indentationDiff=U.indentation,Oe)){for(U.list=null;Te<U.listStack[U.listStack.length-1];)U.listStack.pop(),U.listStack.length?U.indentation=U.listStack[U.listStack.length-1]:U.list=!1;U.list!==!1&&(U.indentationDiff=Te-U.listStack[U.listStack.length-1])}var Ce=!ae&&!ve&&!U.prevLine.header&&(!Oe||!ce)&&!U.prevLine.fencedCodeEnd,Se=(U.list===!1||ve||ae)&&U.indentation<=xe&&z.match(M),pe=null;if(U.indentationDiff>=4&&(ce||U.prevLine.fencedCodeEnd||U.prevLine.header||ae))return z.skipToEnd(),U.indentedCode=!0,H.code;if(z.eatSpace())return null;if(q&&U.indentation<=xe&&(pe=z.match(A))&&pe[1].length<=6)return U.quote=0,U.header=pe[1].length,U.thisLine.header=!0,D.highlightFormatting&&(U.formatting="header"),U.f=U.inline,f(U);if(U.indentation<=xe&&z.eat(">"))return U.quote=q?1:U.quote+1,D.highlightFormatting&&(U.formatting="quote"),z.eatSpace(),f(U);if(!Se&&!U.setext&&q&&U.indentation<=xe&&(pe=z.match(O))){var oe=pe[1]?"ol":"ul";return U.indentation=Te+z.current().length,U.list=!0,U.quote=0,U.listStack.push(U.indentation),U.em=!1,U.strong=!1,U.code=!1,U.strikethrough=!1,D.taskLists&&z.match(y,!1)&&(U.taskList=!0),U.f=U.inline,D.highlightFormatting&&(U.formatting=["list","list-"+oe]),f(U)}else{if(q&&U.indentation<=xe&&(pe=z.match(w,!0)))return U.quote=0,U.fencedEndRE=new RegExp(pe[1]+"+ *$"),U.localMode=D.fencedCodeBlockHighlighting&&P(pe[2]||D.fencedCodeBlockDefaultMode),U.localMode&&(U.localState=re.startState(U.localMode)),U.f=U.block=b,D.highlightFormatting&&(U.formatting="code-block"),U.code=-1,f(U);if(U.setext||(!Ce||!Oe)&&!U.quote&&U.list===!1&&!U.code&&!Se&&!T.test(z.string)&&(pe=z.lookAhead(1))&&(pe=pe.match(R)))return U.setext?(U.header=U.setext,U.setext=0,z.skipToEnd(),D.highlightFormatting&&(U.formatting="header")):(U.header=pe[0].charAt(0)=="="?1:2,U.setext=U.header),U.thisLine.header=!0,U.f=U.inline,f(U);if(Se)return z.skipToEnd(),U.hr=!0,U.thisLine.hr=!0,H.hr;if(z.peek()==="[")return l(z,U,I)}return l(z,U,U.inline)}function k(z,U){var q=Y.token(z,U.htmlState);if(!N){var ae=re.innerMode(Y,U.htmlState);(ae.mode.name=="xml"&&ae.state.tagStart===null&&!ae.state.context&&ae.state.tokenize.isInText||U.md_inside&&z.current().indexOf(">")>-1)&&(U.f=d,U.block=p,U.htmlState=null)}return q}function b(z,U){var q=U.listStack[U.listStack.length-1]||0,ae=U.indentation<q,ce=q+3;if(U.fencedEndRE&&U.indentation<=ce&&(ae||z.match(U.fencedEndRE))){D.highlightFormatting&&(U.formatting="code-block");var ve;return ae||(ve=f(U)),U.localMode=U.localState=null,U.block=p,U.f=d,U.fencedEndRE=null,U.code=0,U.thisLine.fencedCodeEnd=!0,ae?h(z,U,U.block):ve}else return U.localMode?U.localMode.token(z,U.localState):(z.skipToEnd(),H.code)}function f(z){var U=[];if(z.formatting){U.push(H.formatting),typeof z.formatting=="string"&&(z.formatting=[z.formatting]);for(var q=0;q<z.formatting.length;q++)U.push(H.formatting+"-"+z.formatting[q]),z.formatting[q]==="header"&&U.push(H.formatting+"-"+z.formatting[q]+"-"+z.header),z.formatting[q]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=z.quote?U.push(H.formatting+"-"+z.formatting[q]+"-"+z.quote):U.push("error"))}if(z.taskOpen)return U.push("meta"),U.length?U.join(" "):null;if(z.taskClosed)return U.push("property"),U.length?U.join(" "):null;if(z.linkHref?U.push(H.linkHref,"url"):(z.strong&&U.push(H.strong),z.em&&U.push(H.em),z.strikethrough&&U.push(H.strikethrough),z.emoji&&U.push(H.emoji),z.linkText&&U.push(H.linkText),z.code&&U.push(H.code),z.image&&U.push(H.image),z.imageAltText&&U.push(H.imageAltText,"link"),z.imageMarker&&U.push(H.imageMarker)),z.header&&U.push(H.header,H.header+"-"+z.header),z.quote&&(U.push(H.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=z.quote?U.push(H.quote+"-"+z.quote):U.push(H.quote+"-"+D.maxBlockquoteDepth)),z.list!==!1){var ae=(z.listStack.length-1)%3;ae?ae===1?U.push(H.list2):U.push(H.list3):U.push(H.list1)}return z.trailingSpaceNewLine?U.push("trailing-space-new-line"):z.trailingSpace&&U.push("trailing-space-"+(z.trailingSpace%2?"a":"b")),U.length?U.join(" "):null}function m(z,U){return z.match(L,!0)?f(U):void 0}function d(z,U){var q=U.text(z,U);if(typeof q!="undefined")return q;if(U.list)return U.list=null,f(U);if(U.taskList){var ae=z.match(y,!0)[1]===" ";return ae?U.taskOpen=!0:U.taskClosed=!0,D.highlightFormatting&&(U.formatting="task"),U.taskList=!1,f(U)}if(U.taskOpen=!1,U.taskClosed=!1,U.header&&z.match(/^#+$/,!0))return D.highlightFormatting&&(U.formatting="header"),f(U);var ce=z.next();if(U.linkTitle){U.linkTitle=!1;var ve=ce;ce==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Oe="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(z.match(new RegExp(Oe),!0))return H.linkHref}if(ce==="`"){var xe=U.formatting;D.highlightFormatting&&(U.formatting="code"),z.eatWhile("`");var Te=z.current().length;if(U.code==0&&(!U.quote||Te==1))return U.code=Te,f(U);if(Te==U.code){var Ce=f(U);return U.code=0,Ce}else return U.formatting=xe,f(U)}else if(U.code)return f(U);if(ce==="\\"&&(z.next(),D.highlightFormatting)){var Se=f(U),pe=H.formatting+"-escape";return Se?Se+" "+pe:pe}if(ce==="!"&&z.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return U.imageMarker=!0,U.image=!0,D.highlightFormatting&&(U.formatting="image"),f(U);if(ce==="["&&U.imageMarker&&z.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return U.imageMarker=!1,U.imageAltText=!0,D.highlightFormatting&&(U.formatting="image"),f(U);if(ce==="]"&&U.imageAltText){D.highlightFormatting&&(U.formatting="image");var Se=f(U);return U.imageAltText=!1,U.image=!1,U.inline=U.f=x,Se}if(ce==="["&&!U.image)return U.linkText&&z.match(/^.*?\]/)||(U.linkText=!0,D.highlightFormatting&&(U.formatting="link")),f(U);if(ce==="]"&&U.linkText){D.highlightFormatting&&(U.formatting="link");var Se=f(U);return U.linkText=!1,U.inline=U.f=z.match(/\(.*?\)| ?\[.*?\]/,!1)?x:d,Se}if(ce==="<"&&z.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var Se=f(U);return Se?Se+=" ":Se="",Se+H.linkInline}if(ce==="<"&&z.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,D.highlightFormatting&&(U.formatting="link");var Se=f(U);return Se?Se+=" ":Se="",Se+H.linkEmail}if(D.xml&&ce==="<"&&z.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=z.string.indexOf(">",z.pos);if(oe!=-1){var De=z.string.substring(z.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(De)&&(U.md_inside=!0)}return z.backUp(1),U.htmlState=re.startState(Y),h(z,U,k)}if(D.xml&&ce==="<"&&z.match(/^\/\w*?>/))return U.md_inside=!1,"tag";if(ce==="*"||ce==="_"){for(var Ye=1,Ge=z.pos==1?" ":z.string.charAt(z.pos-2);Ye<3&&z.eat(ce);)Ye++;var tt=z.peek()||" ",qe=!/\s/.test(tt)&&(!u.test(tt)||/\s/.test(Ge)||u.test(Ge)),Ae=!/\s/.test(Ge)&&(!u.test(Ge)||/\s/.test(tt)||u.test(tt)),Ne=null,We=null;if(Ye%2&&(!U.em&&qe&&(ce==="*"||!Ae||u.test(Ge))?Ne=!0:U.em==ce&&Ae&&(ce==="*"||!qe||u.test(tt))&&(Ne=!1)),Ye>1&&(!U.strong&&qe&&(ce==="*"||!Ae||u.test(Ge))?We=!0:U.strong==ce&&Ae&&(ce==="*"||!qe||u.test(tt))&&(We=!1)),We!=null||Ne!=null){D.highlightFormatting&&(U.formatting=Ne==null?"strong":We==null?"em":"strong em"),Ne===!0&&(U.em=ce),We===!0&&(U.strong=ce);var Ce=f(U);return Ne===!1&&(U.em=!1),We===!1&&(U.strong=!1),Ce}}else if(ce===" "&&(z.eat("*")||z.eat("_"))){if(z.peek()===" ")return f(U);z.backUp(1)}if(D.strikethrough){if(ce==="~"&&z.eatWhile(ce)){if(U.strikethrough){D.highlightFormatting&&(U.formatting="strikethrough");var Ce=f(U);return U.strikethrough=!1,Ce}else if(z.match(/^[^\s]/,!1))return U.strikethrough=!0,D.highlightFormatting&&(U.formatting="strikethrough"),f(U)}else if(ce===" "&&z.match(/^~~/,!0)){if(z.peek()===" ")return f(U);z.backUp(2)}}if(D.emoji&&ce===":"&&z.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){U.emoji=!0,D.highlightFormatting&&(U.formatting="emoji");var ze=f(U);return U.emoji=!1,ze}return ce===" "&&(z.match(/^ +$/,!1)?U.trailingSpace++:U.trailingSpace&&(U.trailingSpaceNewLine=!0)),f(U)}function a(z,U){var q=z.next();if(q===">"){U.f=U.inline=d,D.highlightFormatting&&(U.formatting="link");var ae=f(U);return ae?ae+=" ":ae="",ae+H.linkInline}return z.match(/^[^>]+/,!0),H.linkInline}function x(z,U){if(z.eatSpace())return null;var q=z.next();return q==="("||q==="["?(U.f=U.inline=S(q==="("?")":"]"),D.highlightFormatting&&(U.formatting="link-string"),U.linkHref=!0,f(U)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(z){return function(U,q){var ae=U.next();if(ae===z){q.f=q.inline=d,D.highlightFormatting&&(q.formatting="link-string");var ce=f(q);return q.linkHref=!1,ce}return U.match(v[z]),q.linkHref=!0,f(q)}}function I(z,U){return z.match(/^([^\]\\]|\\.)*\]:/,!1)?(U.f=G,z.next(),D.highlightFormatting&&(U.formatting="link"),U.linkText=!0,f(U)):l(z,U,d)}function G(z,U){if(z.match(/^\]:/,!0)){U.f=U.inline=V,D.highlightFormatting&&(U.formatting="link");var q=f(U);return U.linkText=!1,q}return z.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function V(z,U){return z.eatSpace()?null:(z.match(/^[^\s]+/,!0),z.peek()===void 0?U.linkTitle=!0:z.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),U.f=U.inline=d,H.linkHref+" url")}var Q={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:d,text:m,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(z){return{f:z.f,prevLine:z.prevLine,thisLine:z.thisLine,block:z.block,htmlState:z.htmlState&&re.copyState(Y,z.htmlState),indentation:z.indentation,localMode:z.localMode,localState:z.localMode?re.copyState(z.localMode,z.localState):null,inline:z.inline,text:z.text,formatting:!1,linkText:z.linkText,linkTitle:z.linkTitle,linkHref:z.linkHref,code:z.code,em:z.em,strong:z.strong,strikethrough:z.strikethrough,emoji:z.emoji,header:z.header,setext:z.setext,hr:z.hr,taskList:z.taskList,list:z.list,listStack:z.listStack.slice(0),quote:z.quote,indentedCode:z.indentedCode,trailingSpace:z.trailingSpace,trailingSpaceNewLine:z.trailingSpaceNewLine,md_inside:z.md_inside,fencedEndRE:z.fencedEndRE}},token:function(z,U){if(U.formatting=!1,z!=U.thisLine.stream){if(U.header=0,U.hr=!1,z.match(/^\s*$/,!0))return g(U),null;if(U.prevLine=U.thisLine,U.thisLine={stream:z},U.taskList=!1,U.trailingSpace=0,U.trailingSpaceNewLine=!1,!U.localState&&(U.f=U.block,U.f!=k)){var q=z.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(U.indentation=q,U.indentationDiff=null,q>0)return null}}return U.f(z,U)},innerMode:function(z){return z.block==k?{state:z.htmlState,mode:Y}:z.localState?{state:z.localState,mode:z.localMode}:{state:z,mode:Q}},indent:function(z,U,q){return z.block==k&&Y.indent?Y.indent(z.htmlState,U,q):z.localState&&z.localMode.indent?z.localMode.indent(z.localState,U,q):re.Pass},blankLine:g,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";var Z=re.Pos;function D(u,o){return u.line-o.line||u.ch-o.ch}var Y="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",N=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Y+"]["+N+"]*)","g");function H(u,o,l,h){this.line=o,this.ch=l,this.cm=u,this.text=u.getLine(o),this.min=h?Math.max(h.from,u.firstLine()):u.firstLine(),this.max=h?Math.min(h.to-1,u.lastLine()):u.lastLine()}function W(u,o){var l=u.cm.getTokenTypeAt(Z(u.line,o));return l&&/\btag\b/.test(l)}function M(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function O(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function y(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(M(u))continue;return}if(!W(u,o+1)){u.ch=o+1;continue}var l=u.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,h?"selfClose":"regular"}}function A(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(O(u))continue;return}if(!W(u,o+1)){u.ch=o;continue}P.lastIndex=o,u.ch=o;var l=P.exec(u.text);if(l&&l.index==o)return l}}function R(u){for(;;){P.lastIndex=u.ch;var o=P.exec(u.text);if(!o){if(M(u))continue;return}if(!W(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function L(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(O(u))continue;return}if(!W(u,o+1)){u.ch=o;continue}var l=u.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,h?"selfClose":"regular"}}function w(u,o){for(var l=[];;){var h=R(u),C,g=u.line,p=u.ch-(h?h[0].length:0);if(!h||!(C=y(u)))return;if(C=="selfClose")continue;if(h[1]){for(var k=l.length-1;k>=0;--k)if(l[k]==h[2]){l.length=k;break}if(k<0&&(!o||o==h[2]))return{tag:h[2],from:Z(g,p),to:Z(u.line,u.ch)}}else l.push(h[2])}}function T(u,o){for(var l=[];;){var h=L(u);if(!h)return;if(h=="selfClose"){A(u);continue}var C=u.line,g=u.ch,p=A(u);if(!p)return;if(p[1])l.push(p[2]);else{for(var k=l.length-1;k>=0;--k)if(l[k]==p[2]){l.length=k;break}if(k<0&&(!o||o==p[2]))return{tag:p[2],from:Z(u.line,u.ch),to:Z(C,g)}}}}re.registerHelper("fold","xml",function(u,o){for(var l=new H(u,o.line,0);;){var h=R(l);if(!h||l.line!=o.line)return;var C=y(l);if(!C)return;if(!h[1]&&C!="selfClose"){var g=Z(l.line,l.ch),p=w(l,h[2]);return p&&D(p.from,g)>0?{from:g,to:p.from}:null}}}),re.findMatchingTag=function(u,o,l){var h=new H(u,o.line,o.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var C=y(h),g=C&&Z(h.line,h.ch),p=C&&A(h);if(!C||!p||D(h,o)>0)return;var k={from:Z(h.line,h.ch),to:g,tag:p[2]};return C=="selfClose"?{open:k,close:null,at:"open"}:p[1]?{open:T(h,p[2]),close:k,at:"close"}:(h=new H(u,g.line,g.ch,l),{open:k,close:w(h,p[2]),at:"open"})},re.findEnclosingTag=function(u,o,l,h){for(var C=new H(u,o.line,o.ch,l);;){var g=T(C,h);if(!g)break;var p=new H(u,o.line,o.ch,l),k=w(p,g.tag);if(k)return{open:g,close:k}}},re.scanForClosingTag=function(u,o,l,h){var C=new H(u,o.line,o.ch,h?{from:0,to:h}:null);return w(C,l)}})},p5ED:function(wt,pt,se){"use strict";var re=se("+L6B"),Z=se("2/Rp"),D=se("5Dmo"),Y=se("3S7+"),N=se("k1fw"),P=se("9og8"),H=se("tJVT"),W=se("WmNS"),M=se.n(W),O=se("q1tI"),y=se.n(O),A=se("vHTk"),R=se.n(A),L=se("yEEn"),w=se("ZW9T"),T=se("1vsH"),u=se("V0Rq"),o=se("m3rI");pt.a=function(l){var h,C,g,p,k,b,f,m=l.editOffice,d=m===void 0?"view":m,a=l.data,x=l.theme,v=l.type,S=l.filename,I=l.monacoEditor,G=l.className,V=l.style,Q=l.close,z=l.onClose,U=l.hasMask,q=l.disabledDownload,ae=Object(O.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ce=Object(H.a)(ae,2),ve=ce[0],Oe=ce[1],xe=Object(O.useState)(""),Te=Object(H.a)(xe,2),Ce=Te[0],Se=Te[1],pe=Object(O.useState)(),oe=Object(H.a)(pe,2),De=oe[0],Ye=oe[1],Ge=window.ENV==="build"?"/react/build":"",tt=o.a.PROXY_SERVER||location.origin,qe,Ae=1024*1024,Ne=10*Ae,We=Object(O.useRef)();(h=a)!==null&&h!==void 0&&h.startsWith("/api")&&v!=="txt"&&(a=o.a.API_SERVER+a),v==="office"&&(qe=Object(T.T)(a).filesize,qe>Ne&&(v="other")),S&&I&&(I.filename=S),Object(O.useEffect)(function(){var Pe,Ke,$e=(Pe=document.cookie)===null||Pe===void 0||((Ke=Pe.replace(/\s/g,""))===null||Ke===void 0)?void 0:Ke.split(";");$e==null||$e.map(function(Qe){var Xe=Qe.split("=");Xe[0]==="_educoder_session"&&Se(Xe[1])})},[]),Object(O.useEffect)(function(){v==="office"&&ze()},[v,a]);var ze=function(){var Pe=Object(P.a)(M.a.mark(function Ke(){var $e,Qe,Xe;return M.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return console.log("data:",a),$e=a,a.startsWith("http")||($e=location.origin+$e),Qe=new URL($e).pathname.split("/").pop(),et.next=6,Object(u.V)({attachment_id:Qe});case 6:Xe=et.sent,Ye(Xe);case 8:case"end":return et.stop()}},Ke)}));return function(){return Pe.apply(this,arguments)}}(),je=function(){if(a.startsWith("http")||a.startsWith("blob:")){_e();return}Object(T.z)(S||"educoder",a,S)},_e=function(){Object(T.x)(S||"educoder",decodeURIComponent(a))};return y.a.createElement("div",{style:Object(N.a)({},V||{}),className:"".concat(U&&R.a.bgBlack," ").concat(v?R.a.wrp:"hide")},Q&&y.a.createElement("div",{className:R.a.close,ref:We},!q&&y.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return We.current}},y.a.createElement("span",{onClick:_e},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return We.current}},y.a.createElement("span",{className:"",onClick:z},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(R.a[G]," ").concat(G," ").concat(R.a.monaco," ").concat(v==="txt"?"show":"hide")},v==="txt"&&y.a.createElement(w.b,I)),v==="audio"&&y.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((g=a)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),v==="video"&&y.a.createElement(y.a.Fragment,null,((p=a)===null||p===void 0?void 0:p.indexOf("http"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),v==="office"&&De&&y.a.createElement("iframe",{src:"".concat(Ge,"/office.html?key=").concat(De.key,"&url=").concat(tt+De.url,"&callbackUrl=").concat(tt+De.callbackUrl,"&fileType=").concat(De.fileType,"&title=").concat(De.title,"&model=").concat(d,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!q)}),v==="html"&&y.a.createElement("iframe",{src:a+"&disposition=inline"}),v==="pdf"&&y.a.createElement("iframe",{src:"".concat(Ge,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!q)}),v==="image"&&y.a.createElement("img",{src:"".concat(((k=a)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((b=a)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(f=a)!==null&&f!==void 0&&f.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),v==="other"&&y.a.createElement("div",null,y.a.createElement(Z.a,{type:"primary",size:"large",onClick:je},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),v==="download"&&y.a.createElement(Z.a,{type:"primary",size:"large",onClick:je},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(wt,pt,se){},rUJ1:function(wt,pt){const se=/[&<>"']/,re=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},N=b=>Y[b];function P(b,f){if(f){if(se.test(b))return b.replace(re,N)}else if(Z.test(b))return b.replace(D,N);return b}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(b){return b.replace(H,(f,m)=>(m=m.toLowerCase(),m==="colon"?":":m.charAt(0)==="#"?m.charAt(1)==="x"?String.fromCharCode(parseInt(m.substring(2),16)):String.fromCharCode(+m.substring(1)):""))}const M=/(^|[^\[])\^/g;function O(b,f){b=b.source||b,f=f||"";const m={replace:(d,a)=>(a=a.source||a,a=a.replace(M,"$1"),b=b.replace(d,a),m),getRegex:()=>new RegExp(b,f)};return m}const y=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,f,m){if(b){let d;try{d=decodeURIComponent(W(m)).replace(y,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!A.test(m)&&(m=o(f,m));try{m=encodeURI(m).replace(/%25/g,"%")}catch(d){return null}return m}const L={},w=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,f){L[" "+b]||(w.test(b)?L[" "+b]=b+"/":L[" "+b]=g(b,"/",!0)),b=L[" "+b];const m=b.indexOf(":")===-1;return f.substring(0,2)==="//"?m?f:b.replace(T,"$1")+f:f.charAt(0)==="/"?m?f:b.replace(u,"$1")+f:b+f}const l={exec:function(){}};function h(b){let f=1,m,d;for(;f<arguments.length;f++){m=arguments[f];for(d in m)Object.prototype.hasOwnProperty.call(m,d)&&(b[d]=m[d])}return b}function C(b,f){const m=b.replace(/\|/g,(x,v,S)=>{let I=!1,G=v;for(;--G>=0&&S[G]==="\\";)I=!I;return I?"|":" |"}),d=m.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 g(b,f,m){const d=b.length;if(d===0)return"";let a=0;for(;a<d;){const x=b.charAt(d-a-1);if(x===f&&!m)a++;else if(x!==f&&m)a++;else break}return b.substr(0,d-a)}function p(b,f){if(b.indexOf(f[1])===-1)return-1;const m=b.length;let d=0,a=0;for(;a<m;a++)if(b[a]==="\\")a++;else if(b[a]===f[0])d++;else if(b[a]===f[1]&&(d--,d<0))return a;return-1}function k(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}wt.exports={escape:P,unescape:W,edit:O,cleanUrl:R,resolveUrl:o,noopTest:l,merge:h,splitCells:C,rtrim:g,findClosingBracket:p,checkSanitizeDeprecation:k}},ulZh:function(wt,pt,se){typeof window!="undefined"&&function(Z,D){wt.exports=D()}(this,function(){return function(re){var Z={};function D(Y){if(Z[Y])return Z[Y].exports;var N=Z[Y]={i:Y,l:!1,exports:{}};return re[Y].call(N.exports,N,N.exports,D),N.l=!0,N.exports}return D.m=re,D.c=Z,D.d=function(Y,N,P){D.o(Y,N)||Object.defineProperty(Y,N,{enumerable:!0,get:P})},D.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},D.t=function(Y,N){if(N&1&&(Y=D(Y)),N&8)return Y;if(N&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Y}),N&2&&typeof Y!="string")for(var H in Y)D.d(P,H,function(W){return Y[W]}.bind(null,H));return P},D.n=function(Y){var N=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(N,"a",N),N},D.o=function(Y,N){return Object.prototype.hasOwnProperty.call(Y,N)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,Z,D){"use strict";var Y=Object.prototype.hasOwnProperty,N="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(N=!1));function H(y,A,R){this.fn=y,this.context=A,this.once=R||!1}function W(y,A,R,L,w){if(typeof R!="function")throw new TypeError("The listener must be a function");var T=new H(R,L||y,w),u=N?N+A:A;return y._events[u]?y._events[u].fn?y._events[u]=[y._events[u],T]:y._events[u].push(T):(y._events[u]=T,y._eventsCount++),y}function M(y,A){--y._eventsCount===0?y._events=new P:delete y._events[A]}function O(){this._events=new P,this._eventsCount=0}O.prototype.eventNames=function(){var A=[],R,L;if(this._eventsCount===0)return A;for(L in R=this._events)Y.call(R,L)&&A.push(N?L.slice(1):L);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(R)):A},O.prototype.listeners=function(A){var R=N?N+A:A,L=this._events[R];if(!L)return[];if(L.fn)return[L.fn];for(var w=0,T=L.length,u=new Array(T);w<T;w++)u[w]=L[w].fn;return u},O.prototype.listenerCount=function(A){var R=N?N+A:A,L=this._events[R];return L?L.fn?1:L.length:0},O.prototype.emit=function(A,R,L,w,T,u){var o=N?N+A:A;if(!this._events[o])return!1;var l=this._events[o],h=arguments.length,C,g;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,R),!0;case 3:return l.fn.call(l.context,R,L),!0;case 4:return l.fn.call(l.context,R,L,w),!0;case 5:return l.fn.call(l.context,R,L,w,T),!0;case 6:return l.fn.call(l.context,R,L,w,T,u),!0}for(g=1,C=new Array(h-1);g<h;g++)C[g-1]=arguments[g];l.fn.apply(l.context,C)}else{var p=l.length,k;for(g=0;g<p;g++){l[g].once&&this.removeListener(A,l[g].fn,void 0,!0);switch(h){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,R);break;case 3:l[g].fn.call(l[g].context,R,L);break;case 4:l[g].fn.call(l[g].context,R,L,w);break;default:if(!C)for(k=1,C=new Array(h-1);k<h;k++)C[k-1]=arguments[k];l[g].fn.apply(l[g].context,C)}}}return!0},O.prototype.on=function(A,R,L){return W(this,A,R,L,!1)},O.prototype.once=function(A,R,L){return W(this,A,R,L,!0)},O.prototype.removeListener=function(A,R,L,w){var T=N?N+A:A;if(!this._events[T])return this;if(!R)return M(this,T),this;var u=this._events[T];if(u.fn)u.fn===R&&(!w||u.once)&&(!L||u.context===L)&&M(this,T);else{for(var o=0,l=[],h=u.length;o<h;o++)(u[o].fn!==R||w&&!u[o].once||L&&u[o].context!==L)&&l.push(u[o]);l.length?this._events[T]=l.length===1?l[0]:l:M(this,T)}return this},O.prototype.removeAllListeners=function(A){var R;return A?(R=N?N+A:A,this._events[R]&&M(this,R)):(this._events=new P,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=N,O.EventEmitter=O,re.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,Z,D){(function(Y){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(O,y,A){if(A=A||{},O=O.trim(),y=y.trim(),!y){if(!A.alwaysNormalize)return O;var R=M.parseURL(O);if(!R)throw new Error("Error trying to parse base URL.");return R.path=M.normalizePath(R.path),M.buildURLFromParts(R)}var L=M.parseURL(y);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return A.alwaysNormalize?(L.path=M.normalizePath(L.path),M.buildURLFromParts(L)):y;var w=M.parseURL(O);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var T=P.exec(w.path);w.netLoc=T[1],w.path=T[2]}w.netLoc&&!w.path&&(w.path="/");var u={scheme:w.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(u.netLoc=w.netLoc,L.path[0]!=="/"))if(!L.path)u.path=w.path,L.params||(u.params=w.params,L.query||(u.query=w.query));else{var o=w.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;u.path=M.normalizePath(l)}return u.path===null&&(u.path=A.alwaysNormalize?M.normalizePath(L.path):L.path),M.buildURLFromParts(u)},parseURL:function(O){var y=N.exec(O);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(H,"");O.length!==(O=O.replace(W,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};re.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(re,Z,D){function Y(A){var R={};function L(T){if(R[T])return R[T].exports;var u=R[T]={i:T,l:!1,exports:{}};return A[T].call(u.exports,u,u.exports,L),u.l=!0,u.exports}L.m=A,L.c=R,L.i=function(T){return T},L.d=function(T,u,o){L.o(T,u)||Object.defineProperty(T,u,{configurable:!1,enumerable:!0,get:o})},L.r=function(T){Object.defineProperty(T,"__esModule",{value:!0})},L.n=function(T){var u=T&&T.__esModule?function(){return T.default}:function(){return T};return L.d(u,"a",u),u},L.o=function(T,u){return Object.prototype.hasOwnProperty.call(T,u)},L.p="/",L.oe=function(T){throw console.error(T),T};var w=L(L.s=ENTRY_MODULE);return w.default||w}var N="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function H(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(A){return!isNaN(1*A)}function M(A,R,L){var w={};w[L]=[];var T=R.toString(),u=T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return w;for(var o=u[1],l=new RegExp("(\\\\n|\\W)"+H(o)+P,"g"),h;h=l.exec(T);){if(h[3]==="dll-reference")continue;w[L].push(h[3])}for(l=new RegExp("\\("+H(o)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+P,"g");h=l.exec(T);)A[h[2]]||(w[L].push(h[1]),A[h[2]]=D(h[1]).m),w[h[2]]=w[h[2]]||[],w[h[2]].push(h[4]);for(var C=Object.keys(w),g=0;g<C.length;g++)for(var p=0;p<w[C[g]].length;p++)W(w[C[g]][p])&&(w[C[g]][p]=1*w[C[g]][p]);return w}function O(A){var R=Object.keys(A);return R.reduce(function(L,w){return L||A[w].length>0},!1)}function y(A,R){for(var L={main:[R]},w={main:[]},T={main:{}};O(L);)for(var u=Object.keys(L),o=0;o<u.length;o++){var l=u[o],h=L[l],C=h.pop();if(T[l]=T[l]||{},T[l][C]||!A[l][C])continue;T[l][C]=!0,w[l]=w[l]||[],w[l].push(C);for(var g=M(A,A[l][C],l),p=Object.keys(g),k=0;k<p.length;k++)L[p[k]]=L[p[k]]||[],L[p[k]]=L[p[k]].concat(g[p[k]])}return w}re.exports=function(A,R){R=R||{};var L={main:D.m},w=R.all?{main:Object.keys(L.main)}:y(L,A),T="";Object.keys(w).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;w[C][g];)g++;w[C].push(g),L[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",T=T+"var "+C+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+w[C].map(function(p){return""+JSON.stringify(p)+": "+L[C][p].toString()}).join(",")+`});
|
|
`}),T=T+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+w.main.map(function(C){return""+JSON.stringify(C)+": "+L.main[C].toString()}).join(",")+"}))(self);";var u=new window.Blob([T],{type:"text/javascript"});if(R.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(u),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"hlsDefaultConfig",function(){return k}),D.d(Z,"mergeConfig",function(){return f}),D.d(Z,"enableStreamingMode",function(){return m});var Y=D("./src/controller/abr-controller.ts"),N=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),H=D("./src/controller/subtitle-stream-controller.ts"),W=D("./src/controller/subtitle-track-controller.ts"),M=D("./src/controller/buffer-controller.ts"),O=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),R=D("./src/controller/eme-controller.ts"),L=D("./src/controller/cmcd-controller.ts"),w=D("./src/utils/xhr-loader.ts"),T=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(d[v]=x[v])}return d},h.apply(this,arguments)}function C(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),x.push.apply(x,v)}return x}function g(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?C(Object(x),!0).forEach(function(v){p(d,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(x,v))})}return d}function p(d,a,x){return a in d?Object.defineProperty(d,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):d[a]=x,d}var k=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:M.default,capLevelController:y.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:W.default,timelineController:O.TimelineController,audioStreamController:N.default,audioTrackController:P.default,emeController:R.default,cmcdController:L.default});function b(){return{cueHandler:u.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 h({},d,a)}function m(d){var a=d.loader;if(a!==T.default&&a!==w.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var x=Object(T.fetchSupported)();x&&(d.loader=T.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/errors.ts"),M=D("./src/types/loader.ts"),O=D("./src/utils/logger.ts");function y(L,w){for(var T=0;T<w.length;T++){var u=w[T];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function A(L,w,T){return w&&y(L.prototype,w),T&&y(L,T),L}var R=function(){function L(T){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=T;var u=T.config;this.bwEstimator=new N.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var w=L.prototype;return w.registerListeners=function(){var u=this.hls;u.on(P.Events.FRAG_LOADING,this.onFragLoading,this),u.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(P.Events.FRAG_LOADING,this.onFragLoading,this),u.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(u,o){var l=o.frag;if(l.type===M.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=o.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(u,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,C=l.config,g=l.media;if(!u||!g)return;var p=o?o.stats:u.stats,k=o?o.duration:u.duration;if(p.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||g.paused||!g.playbackRate||!g.readyState)return;var b=performance.now()-p.loading.start,f=Math.abs(g.playbackRate);if(b<=500*k/f)return;var m=l.levels,d=l.minAutoLevel,a=m[u.level],x=p.total||Math.max(p.loaded,Math.round(k*a.maxBitrate/8)),v=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),S=(x-p.loaded)/v,I=g.currentTime,G=(H.BufferHelper.bufferInfo(g,I,C.maxBufferHole).end-I)/f;if(G>=2*k/f||S<=G)return;var V=Number.POSITIVE_INFINITY,Q;for(Q=u.level-1;Q>d;Q--){var z=m[Q].maxBitrate;if(V=k*z/(8*.8*v),V<G)break}if(V>=S)return;var U=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+`
|
|
Current BW estimate: `+(Object(Y.isFiniteNumber)(U)?(U/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+S.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+V.toFixed(3)+` s
|
|
Time to underbuffer: `+G.toFixed(3)+" s"),l.nextLoadLevel=Q,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:p})},w.onFragLoaded=function(u,o){var l=o.frag,h=o.part;if(l.type===M.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(l.sn)){var C=h?h.stats:l.stats,g=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],k=(p.loaded?p.loaded.bytes:0)+C.loaded,b=(p.loaded?p.loaded.duration:0)+g;p.loaded={bytes:k,duration:b},p.realBitrate=Math.round(8*k/b)}if(l.bitrateTest){var f={stats:C,frag:l,part:h,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},w.onFragBuffered=function(u,o){var l=o.frag,h=o.part,C=h?h.stats:l.stats;if(C.aborted)return;if(l.type!==M.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},w.onError=function(u,o){switch(o.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.maxAutoLevel,C=l.config,g=l.minAutoLevel,p=l.media,k=o?o.duration:u?u.duration:0,b=p?p.currentTime:0,f=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,m=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,d=(H.BufferHelper.bufferInfo(p,b,C.maxBufferHole).end-b)/f,a=this.findBestLevel(m,g,h,d,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=k?Math.min(k,C.maxStarvationDelay):C.maxStarvationDelay,v=C.abrBandWidthFactor,S=C.abrBandWidthUpFactor;if(!d){var I=this.bitrateTestDelay;if(I){var G=k?Math.min(k,C.maxLoadingDelay):C.maxLoadingDelay;x=G-I,O.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),v=S=1}}return a=this.findBestLevel(m,g,h,d+x,v,S),Math.max(a,0)},w.findBestLevel=function(u,o,l,h,C,g){for(var p,k=this.fragCurrent,b=this.partCurrent,f=this.lastLoadedFragLevel,m=this.hls.levels,d=m[f],a=!!(d!=null&&(p=d.details)!==null&&p!==void 0&&p.live),x=d==null?void 0:d.codecSet,v=b?b.duration:k?k.duration:0,S=l;S>=o;S--){var I=m[S];if(!I||x&&I.codecSet!==x)continue;var G=I.details,V=(b?G==null?void 0:G.partTarget:G==null?void 0:G.averagetargetduration)||v,Q=void 0;S<=f?Q=C*u:Q=g*u;var z=m[S].maxBitrate,U=z*V/Q;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(Q)+"/"+z+"/"+V+"/"+h+"/"+U),Q>z&&(!U||a&&!this.bitrateTestDelay||U<h))return S}return-1},A(L,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),L}();Z.default=R},"./src/controller/audio-stream-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-tracker.ts"),M=D("./src/types/level.ts"),O=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),R=D("./src/demux/transmuxer-interface.ts"),L=D("./src/types/transmuxer.ts"),w=D("./src/controller/fragment-finders.ts"),T=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var f=arguments[b];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(k[m]=f[m])}return k},l.apply(this,arguments)}function h(k,b){k.prototype=Object.create(b.prototype),k.prototype.constructor=k,C(k,b)}function C(k,b){return C=Object.setPrototypeOf||function(m,d){return m.__proto__=d,m},C(k,b)}var g=100,p=function(k){h(b,k);function b(m,d){var a;return a=k.call(this,m,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=b.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(P.Events.ERROR,this.onError,this),d.on(P.Events.BUFFER_RESET,this.onBufferReset,this),d.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(P.Events.ERROR,this.onError,this),d.off(P.Events.BUFFER_RESET,this.onBufferReset,this),d.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,a){var x=a.frag,v=a.id,S=a.initPTS;if(v==="main"){var I=x.cc;this.initPTS[x.cc]=S,this.log("InitPTS for cc: "+I+" found from main: "+S),this.videoTrackCC=I,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=N.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var d,a=this.levels,x=this.trackId,v=a==null||((d=a[x])===null||d===void 0)?void 0:d.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var S,I=performance.now(),G=this.retryDate;(!G||I>=G||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var V=this.waitingData;if(V){var Q=V.frag,z=V.part,U=V.cache,q=V.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var ae=U.flush(),ce={frag:Q,part:z,payload:ae,networkDetails:null};this._handleFragmentLoadProgress(ce),q&&k.prototype._handleFragmentLoadComplete.call(this,ce)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),Oe=H.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),xe=Object(w.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,Q);xe<0&&(o.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.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=N.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,a,x=this.hls,v=this.levels,S=this.media,I=this.trackId,G=x.config;if(!v||!v[I])return;if(!S&&(this.startFragRequested||!G.startFragPrefetch))return;var V=v[I],Q=V.details;if(!Q||Q.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(Q)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(z===null)return;var U=z.len,q=this.getMaxBufferLength(),ae=this.audioSwitch;if(U>=q&&!ae)return;if(!ae&&this._streamEnded(z,Q)){x.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var ce=Q.fragments,ve=ce[0].start,Oe=z.end;if(ae){var xe=this.getLoadPosition();Oe=xe,Q.PTSKnown&&xe<ve&&((z.end>ve||z.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=ve+.05))}var Te=this.getNextFragment(Oe,Q);if(!Te){this.bufferFlushed=!0;return}((d=Te.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,Q):this.loadFragment(Te,Q,Oe)},f.getMaxBufferLength=function(){var d=k.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(v){return new M.Level(v)})},f.onAudioTrackSwitching=function(d,a){var x=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(g):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.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 x,v=this.levels,S=a.details,I=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var G=v[I],V=0;if(S.live||(x=G.details)!==null&&x!==void 0&&x.live){var Q=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!Q)return;!G.details&&S.hasProgramDateTime&&Q.hasProgramDateTime?(Object(T.alignMediaPlaylistByPDT)(S,Q),V=S.fragments[0].start):V=this.alignPlaylists(S,G.details)}G.details=S,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(G.details,V),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=N.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var a,x=d.frag,v=d.part,S=d.payload,I=this.config,G=this.trackId,V=this.levels;if(!V){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var Q=V[G];console.assert(Q,"Audio track is defined on fragment load progress");var z=Q.details;console.assert(z,"Audio track details are defined on fragment load progress");var U=I.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",q=this.transmuxer;q||(q=this.transmuxer=new R.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ae=this.initPTS[x.cc],ce=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ae!==void 0){var ve=!1,Oe=v?v.index:-1,xe=Oe!==-1,Te=new L.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,S.byteLength,Oe,xe);q.push(S,ce,U,"",x,v,z.totalduration,ve,Te,ae)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+z.startSN+" ,"+z.endSN+"],track "+G);var Ce=this.waitingData=this.waitingData||{frag:x,part:v,cache:new A.default,complete:!1},Se=Ce.cache;Se.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(d,a){var x=a.frag,v=a.part;if(x.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(v?" p: "+v.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,v)},f.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=a.fatal?N.State.ERROR:N.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var x=!0,v=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);v&&v.len>.5&&(x=!this.reduceMaxBufferLength(v.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,a){var x=a.type;x===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var a,x="audio",v=this.hls,S=d.remuxResult,I=d.chunkMeta,G=this.getCurrentContext(I);if(!G){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var V=G.frag,Q=G.part,z=S.audio,U=S.text,q=S.id3,ae=S.initSegment;if(this.fragContextChanged(V))return;if(this.state=N.State.PARSING,this.audioSwitch&&z&&this.completeAudioSwitch(),ae!=null&&ae.tracks&&(this._bufferInitSegment(ae.tracks,V,I),v.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:V,id:x,tracks:ae.tracks})),z){var ce=z.startPTS,ve=z.endPTS,Oe=z.startDTS,xe=z.endDTS;Q&&(Q.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ce,endPTS:ve,startDTS:Oe,endDTS:xe}),V.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ce,ve,Oe,xe),this.bufferFragmentData(z,V,Q,I)}if(q!=null&&(a=q.samples)!==null&&a!==void 0&&a.length){var Te=l({frag:V,id:x},q);v.trigger(P.Events.FRAG_PARSING_METADATA,Te)}if(U){var Ce=l({frag:V,id:x},U);v.trigger(P.Events.FRAG_PARSING_USERDATA,Ce)}},f._bufferInitSegment=function(d,a,x){if(this.state!==N.State.PARSING)return;d.video&&delete d.video;var v=d.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,d);var S=v.initSegment;if(S!=null&&S.byteLength){var I={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:S};this.hls.trigger(P.Events.BUFFER_APPENDING,I)}this.tick()},f.loadFragment=function(d,a,x){var v=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||v===W.FragmentState.NOT_LOADED||v===W.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(Y.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=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,d,a,x)))},f.completeAudioSwitch=function(){var d=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:x})},b}(N.default);Z.default=p},"./src/controller/audio-track-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts"),N=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function W(R,L){for(var w=0;w<L.length;w++){var T=L[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function M(R,L,w){return L&&W(R.prototype,L),w&&W(R,w),R}function O(R,L){R.prototype=Object.create(L.prototype),R.prototype.constructor=R,y(R,L)}function y(R,L){return y=Object.setPrototypeOf||function(T,u){return T.__proto__=u,T},y(R,L)}var A=function(R){O(L,R);function L(T){var u;return u=R.call(this,T,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var w=L.prototype;return w.registerListeners=function(){var u=this.hls;u.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(Y.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(Y.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(u,o){var l=o.id,h=o.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var g=C.details;C.details=o.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,g))},w.onLevelLoading=function(u,o){this.switchLevel(o.level)},w.onLevelSwitching=function(u,o){this.switchLevel(o.level)},w.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(g){return!l||g.groupId===l});this.selectDefaultTrack&&!h.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var C={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},w.onError=function(u,o){if(R.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===H.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=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 "+u);var h=o[u],C=h.id,g=h.groupId,p=g===void 0?"":g,k=h.name,b=h.type,f=h.url;if(this.trackId=u,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:p,name:k,type:b,url:f}),h.details&&!h.details.live)return;var m=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(m)},w.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.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(Y.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(u){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var h=o[l];if((!this.selectDefaultTrack||h.default)&&(!u||u===h.name))return h.id}return-1},w.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,h=o.groupId,C=o.url;if(u)try{C=u.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:h,deliveryDirectives:u||null})}},M(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),L}(P.default);Z.default=A},"./src/controller/base-playlist-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return M});var Y=D("./src/polyfills/number.ts"),N=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),H=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),M=function(){function O(A,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,R+":"),this.warn=H.logger.warn.bind(H.logger,R+":"),this.hls=A}var y=O.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(R,L){L.fatal&&L.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(R,L){var w=L==null?void 0:L.renditionReports;if(w)for(var T=0;T<w.length;T++){var u=w[T],o=""+u.URI;if(o===R.substr(-o.length)){var l=parseInt(u["LAST-MSN"]),h=parseInt(u["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var C=Math.min(L.age-L.partTarget,L.targetduration);h!==void 0&&C>L.partTarget&&(h+=1)}if(Object(Y.isFiniteNumber)(l))return new N.HlsUrlParameters(l,Object(Y.isFiniteNumber)(h)?h:void 0,N.HlsSkip.No)}}},y.loadPlaylist=function(R){},y.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},y.playlistLoaded=function(R,L,w){var T=this,u=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||w!=null&&w.live){if(u.reloaded(w),w&&this.log("live playlist "+R+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),w&&u.fragments.length>0&&Object(P.mergeDetails)(w,u),!this.canLoad||!u.live)return;var h,C=void 0,g=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var p=this.hls.config.lowLatencyMode,k=u.lastPartSn,b=u.endSN,f=u.lastPartIndex,m=f!==-1,d=k===b,a=p?0:f;m?(C=d?b+1:k,g=d?a:f+1):C=b+1;var x=u.age,v=x+u.ageHeader,S=Math.min(v-u.partTarget,u.targetduration*1.5);if(S>0){if(w&&S>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+S+" with playlist age: "+u.age),S=0;else{var I=Math.floor(S/u.targetduration);if(C+=I,g!==void 0){var G=Math.round(S%u.targetduration/u.partTarget);g+=G}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+S+" skip sn "+I+" to part "+g)}u.tuneInGoal=S}if(h=this.getDeliveryDirectives(u,L.deliveryDirectives,C,g),p||!d){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(u,L.deliveryDirectives,C,g);var V=Object(P.computeReloadInterval)(u,o);C!==void 0&&u.canBlockReload&&(V-=u.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(V)+" ms"),this.timer=self.setTimeout(function(){return T.loadPlaylist(h)},V)}else this.clearTimer()},y.getDeliveryDirectives=function(R,L,w,T){var u=Object(N.getSkipValue)(R,w);return L!=null&&L.skip&&R.deltaUpdateFailed&&(w=L.msn,T=L.part,u=N.HlsSkip.No),new N.HlsUrlParameters(w,T,u)},y.retryLoadingOrFail=function(R){var L=this,w=this.hls.config,T=this.retryCount<w.levelLoadingMaxRetry;if(T){var u;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(u=R.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return T},O}()},"./src/controller/base-stream-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"State",function(){return b}),D.d(Z,"default",function(){return f});var Y=D("./src/polyfills/number.ts"),N=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts"),M=D("./src/events.ts"),O=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/discontinuities.ts"),L=D("./src/controller/fragment-finders.ts"),w=D("./src/controller/level-helper.ts"),T=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function h(m,d){for(var a=0;a<d.length;a++){var x=d[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(m,x.key,x)}}function C(m,d,a){return d&&h(m.prototype,d),a&&h(m,a),m}function g(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function p(m,d){m.prototype=Object.create(d.prototype),m.prototype.constructor=m,k(m,d)}function k(m,d){return k=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},k(m,d)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(m){p(d,m);function d(x,v,S){var I;return I=m.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=b.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=S,I.log=W.logger.log.bind(W.logger,S+":"),I.warn=W.logger.warn.bind(W.logger,S+":"),I.hls=x,I.fragmentLoader=new T.default(x.config),I.fragmentTracker=v,I.config=x.config,I.decrypter=new u.default(x,x.config),x.on(M.Events.KEY_LOADED,I.onKeyLoaded,g(I)),I}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(v,S){var I=this.fragCurrent,G=this.fragmentTracker;if(!S.live&&I&&I.sn===S.endSN&&!v.nextStart){var V=G.getState(I);return V===P.FragmentState.PARTIAL||V===P.FragmentState.OK}return!1},a.onMediaAttached=function(v,S){var I=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var G=this.config;this.levels&&G.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(G.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var v=this.config,S=this.fragCurrent,I=this.media,G=this.mediaBuffer,V=this.state,Q=I?I.currentTime:0,z=H.BufferHelper.bufferInfo(G||I,Q,v.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(Q)?Q.toFixed(3):Q)+", state: "+V),V===b.ENDED)this.resetLoadingState();else if(S&&!z.len){var U=v.maxFragLookUpTolerance,q=S.start-U,ae=S.start+S.duration+U,ce=Q>ae;(Q<q||ce)&&(ce&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!z.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,S){if(this.state!==b.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var I=this.levels[S.frag.level].details;I&&this.loadFragment(S.frag,I,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),m.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,m.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(v,S){this.log("Loading key for "+v.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=b.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(M.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,S,I){this._loadFragForPlayback(v,S,I)},a._loadFragForPlayback=function(v,S,I){var G=this,V=function(z){if(G.fragContextChanged(v)){G.warn("Fragment "+v.sn+(z.part?" p: "+z.part.index:"")+" of level "+v.level+" was dropped during download."),G.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,G._handleFragmentLoadProgress(z)};this._doFragLoad(v,S,I,V).then(function(Q){if(!Q)return;G.fragLoadError=0;var z=G.state;if(G.fragContextChanged(v)){(z===b.FRAG_LOADING||z===b.BACKTRACKING||!G.fragCurrent&&z===b.PARSING)&&(G.fragmentTracker.removeFragment(v),G.state=b.IDLE);return}if("payload"in Q&&(G.log("Loaded fragment "+v.sn+" of level "+v.level),G.hls.trigger(M.Events.FRAG_LOADED,Q),G.state===b.BACKTRACKING)){G.fragmentTracker.backtrack(v,Q),G.resetFragmentLoading(v);return}G._handleFragmentLoadComplete(Q)}).catch(function(Q){G.warn(Q),G.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,S,I){if(I===void 0&&(I=null),!(v-S))return;var G={startOffset:v,endOffset:S,type:I};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,G)},a._loadInitSegment=function(v){var S=this;this._doFragLoad(v).then(function(I){if(!I||S.fragContextChanged(v)||!S.levels)throw new Error("init load aborted");return I}).then(function(I){var G=S.hls,V=I.payload,Q=v.decryptdata;if(V&&V.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var z=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(V),Q.key.buffer,Q.iv.buffer).then(function(U){var q=self.performance.now();return G.trigger(M.Events.FRAG_DECRYPTED,{frag:v,payload:U,stats:{tstart:z,tdecrypt:q}}),I.payload=U,I})}return I}).then(function(I){var G=S.fragCurrent,V=S.hls,Q=S.levels;if(!Q)throw new Error("init load aborted, missing levels");var z=Q[v.level].details;console.assert(z,"Level details are defined when init segment is loaded");var U=v.stats;S.state=b.IDLE,S.fragLoadError=0,v.data=new Uint8Array(I.payload),U.parsing.start=U.buffering.start=self.performance.now(),U.parsing.end=U.buffering.end=self.performance.now(),I.frag===G&&V.trigger(M.Events.FRAG_BUFFERED,{stats:U,frag:G,part:null,id:v.type}),S.tick()}).catch(function(I){S.warn(I),S.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var S=this.fragCurrent;return!v||!S||v.level!==S.level||v.sn!==S.sn||v.urlId!==S.urlId},a.fragBufferedComplete=function(v,S){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(H.BufferHelper.getBuffered(I))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var S=this.transmuxer;if(!S)return;var I=v.frag,G=v.part,V=v.partsLoaded,Q=!V||V.length===0||V.some(function(U){return!U}),z=new y.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,G?G.index:-1,!Q);S.flush(z)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,S,I,G){var V=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(v.start,I||0),this.config.lowLatencyMode&&S){var Q=S.partList;if(Q&&G){I>v.end&&S.fragmentHint&&(v=S.fragmentHint);var z=this.getNextPart(Q,v,I);if(z>-1){var U=Q[z];return this.log("Loading part sn: "+v.sn+" p: "+U.index+" cc: "+v.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+z+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=U.start+U.duration,this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:v,part:Q[z],targetBufferTime:I}),this.doFragPartsLoad(v,Q,z,G).catch(function(q){return V.handleFragLoadError(q)})}else if(!v.url||this.loadedEndOfParts(Q,I))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(I.toFixed(3))),Object(Y.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:v,targetBufferTime:I}),this.fragmentLoader.load(v,G).catch(function(q){return V.handleFragLoadError(q)})},a.doFragPartsLoad=function(v,S,I,G){var V=this;return new Promise(function(Q,z){var U=[],q=function ae(ce){var ve=S[ce];V.fragmentLoader.loadPart(v,ve,G).then(function(Oe){U[ve.index]=Oe;var xe=Oe.part;V.hls.trigger(M.Events.FRAG_LOADED,Oe);var Te=S[ce+1];if(Te&&Te.fragment===v)ae(ce+1);else return Q({frag:v,part:xe,partsLoaded:U})}).catch(z)};q(I)})},a.handleFragLoadError=function(v){var S=v.data;return S&&S.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(M.Events.ERROR,S),null},a._handleTransmuxerFlush=function(v){var S=this.getCurrentContext(v);if(!S||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var I=S.frag,G=S.part,V=S.level,Q=self.performance.now();I.stats.parsing.end=Q,G&&(G.stats.parsing.end=Q),this.updateLevelTiming(I,G,V,v.partial)},a.getCurrentContext=function(v){var S=this.levels,I=v.level,G=v.sn,V=v.part;if(!S||!S[I])return this.warn("Levels object was unset while buffering fragment "+G+" of level "+I+". The current chunk will not be buffered."),null;var Q=S[I],z=V>-1?Object(w.getPartWith)(Q,G,V):null,U=z?z.fragment:Object(w.getFragmentWithSN)(Q,G,this.fragCurrent);return U?{frag:U,part:z,level:Q}:null},a.bufferFragmentData=function(v,S,I,G){if(!v||this.state!==b.PARSING)return;var V=v.data1,Q=v.data2,z=V;if(V&&Q&&(z=Object(A.appendUint8Array)(V,Q)),!z||!z.length)return;var U={type:v.type,frag:S,part:I,chunkMeta:G,parent:S.type,data:z};this.hls.trigger(M.Events.BUFFER_APPENDING,U),v.dropped&&v.independent&&!I&&this.flushBufferGap(S)},a.flushBufferGap=function(v){var S=this.media;if(!S)return;if(!H.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,v.start);return}var I=S.currentTime,G=H.BufferHelper.bufferInfo(S,I,0),V=v.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,V*.25),z=Math.max(Math.min(v.start-Q,G.end-Q),I+Q);v.start-z>Q&&this.flushMainBuffer(z,v.start)},a.getFwdBufferInfo=function(v,S){var I=this.config,G=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(G))return null;var V=H.BufferHelper.bufferInfo(v,G,I.maxBufferHole);if(V.len===0&&V.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(G,S);if(Q&&V.nextStart<Q.end)return H.BufferHelper.bufferInfo(v,G,Math.max(V.nextStart,I.maxBufferHole))}return V},a.getMaxBufferLength=function(v){var S=this.config,I;return v?I=Math.max(8*S.maxBufferSize/v,S.maxBufferLength):I=S.maxBufferLength,Math.min(I,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var S=this.config,I=v||S.maxBufferLength;return S.maxMaxBufferLength>=I?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,S){var I,G,V=S.fragments,Q=V.length;if(!Q)return null;var z=this.config,U=V[0].start,q;if(S.live){var ae=z.initialLiveManifestSize;if(Q<ae)return this.warn("Not enough fragments to start playback (have: "+Q+", need: "+ae+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(q=this.getInitialLiveFragment(S,V),this.startPosition=q?this.hls.liveSyncPosition||q.start:v)}else v<=U&&(q=V[0]);if(!q){var ce=z.lowLatencyMode?S.partEnd:S.fragmentEnd;q=this.getFragmentAtPosition(v,ce,S)}return(I=q)!==null&&I!==void 0&&I.initSegment&&!((G=q)!==null&&G!==void 0&&G.initSegment.data)&&!this.bitrateTest&&(q=q.initSegment),q},a.getNextPart=function(v,S,I){for(var G=-1,V=!1,Q=!0,z=0,U=v.length;z<U;z++){var q=v[z];if(Q=Q&&!q.independent,G>-1&&I<q.start)break;var ae=q.loaded;!ae&&(V||q.independent||Q)&&q.fragment===S&&(G=z),V=ae}return G},a.loadedEndOfParts=function(v,S){var I=v[v.length-1];return I&&S>I.start&&I.loaded},a.getInitialLiveFragment=function(v,S){var I=this.fragPrevious,G=null;if(I){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),G=Object(L.findFragmentByPDT)(S,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!G){var V=I.sn+1;if(V>=v.startSN&&V<=v.endSN){var Q=S[V-v.startSN];I.cc===Q.cc&&(G=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+G.sn))}G||(G=Object(L.findFragWithCC)(S,I.cc),G&&this.log("Live playlist, switching playlist, load frag with same CC: "+G.sn))}}else{var z=this.hls.liveSyncPosition;z!==null&&(G=this.getFragmentAtPosition(z,this.bitrateTest?v.fragmentEnd:v.edge,v))}return G},a.getFragmentAtPosition=function(v,S,I){var G=this.config,V=this.fragPrevious,Q=I.fragments,z=I.endSN,U=I.fragmentHint,q=G.maxFragLookUpTolerance,ae=!!(G.lowLatencyMode&&I.partList&&U);ae&&U&&!this.bitrateTest&&(Q=Q.concat(U),z=U.sn);var ce;if(v<S){var ve=v>S-q?0:q;ce=Object(L.findFragmentByPTS)(V,Q,v,ve)}else ce=Q[Q.length-1];if(ce){var Oe=ce.sn-I.startSN,xe=V&&ce.level===V.level,Te=Q[Oe+1],Ce=this.fragmentTracker.getState(ce);if(Ce===P.FragmentState.BACKTRACKED){ce=null;for(var Se=Oe;Q[Se]&&this.fragmentTracker.getState(Q[Se])===P.FragmentState.BACKTRACKED;)V?ce=Q[Se--]:ce=Q[--Se];ce||(ce=Te)}else V&&ce.sn===V.sn&&!ae&&(xe&&(ce.sn<z&&this.fragmentTracker.getState(Te)!==P.FragmentState.OK?(this.log("SN "+ce.sn+" just loaded, load next one: "+Te.sn),ce=Te):ce=null))}return ce},a.synchronizeToLiveEdge=function(v){var S=this.config,I=this.media;if(!I)return;var G=this.hls.liveSyncPosition,V=I.currentTime,Q=v.fragments[0].start,z=v.edge,U=V>=Q-S.maxFragLookUpTolerance&&V<=z;if(G!==null&&I.duration>G&&(V<G||!U)){var q=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*v.targetduration;(!U&&I.readyState<4||V<z-q)&&(this.loadedmetadata||(this.nextLoadPosition=G),I.readyState&&(this.warn("Playback: "+V.toFixed(3)+" is located too far from the end of live sliding playlist: "+z+", reset currentTime to : "+G.toFixed(3)),I.currentTime=G))}},a.alignPlaylists=function(v,S){var I=this.levels,G=this.levelLastLoaded,V=this.fragPrevious,Q=G!==null?I[G]:null,z=v.fragments.length;if(!z)return this.warn("No fragments in live playlist"),0;var U=v.fragments[0].start,q=!S,ae=v.alignedSliding&&Object(Y.isFiniteNumber)(U);if(q||!ae&&!U){Object(R.alignStream)(V,Q,v);var ce=v.fragments[0].start;return this.log("Live playlist sliding: "+ce.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+v.startSN+" prev-sn: "+(V?V.sn:"na")+" fragments: "+z),ce}return U},a.waitForCdnTuneIn=function(v){var S=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*S)},a.setStartPosition=function(v,S){var I=this.startPosition;if(I<S&&(I=-1),I===-1||this.lastCurrentTime===-1){var G=v.startTimeOffset;Object(Y.isFiniteNumber)(G)?(I=S+G,G<0&&(I+=v.totalduration),I=Math.min(Math.max(S,I),S+v.totalduration),this.log("Start time offset "+G+" found in playlist, adjust startPosition to "+I),this.startPosition=I):v.live?I=this.hls.liveSyncPosition||S:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},a.getLoadPosition=function(){var v=this.media,S=0;return this.loadedmetadata&&v?S=v.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(v,S){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(S?" part"+S.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(v,S){if(S.fatal)return;var I=S.frag;if(!I||I.type!==v)return;var G=this.fragCurrent;console.assert(G&&I.sn===G.sn&&I.level===G.level&&I.urlId===G.urlId,"Frag load error must match current frag to retry");var V=this.config;if(this.fragLoadError+1<=V.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var Q=Math.min(Math.pow(2,this.fragLoadError)*V.fragLoadingRetryDelay,V.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+v+" "+I.level+" failed to load, retrying in "+Q+"ms"),this.retryDate=self.performance.now()+Q,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(v===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(W.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(v,S,I){if(!v)return;var G=H.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(S,G,I),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[v].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(v,S,I,G){var V=this,Q=I.details;console.assert(!!Q,"level.details must be defined");var z=Object.keys(v.elementaryStreams).reduce(function(U,q){var ae=v.elementaryStreams[q];if(ae){var ce=ae.endPTS-ae.startPTS;if(ce<=0)return V.warn("Could not parse fragment "+v.sn+" "+q+" duration reliably ("+ce+") resetting transmuxer to fallback to playlist timing"),V.resetTransmuxer(),U||!1;var ve=G?0:Object(w.updateFragPTSDTS)(Q,v,ae.startPTS,ae.endPTS,ae.startDTS,ae.endDTS);return V.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:Q,level:I,drift:ve,type:q,frag:v,start:ae.startPTS,end:ae.endPTS}),!0}return U},!1);z?(this.state=b.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:v,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(d,[{key:"state",get:function(){return this._state},set:function(v){var S=this._state;S!==v&&(this._state=v,this.log(S+"->"+v))}}]),d}(N.default)},"./src/controller/buffer-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return L});var Y=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./src/errors.ts"),W=D("./src/utils/buffer-helper.ts"),M=D("./src/utils/mediasource-helper.ts"),O=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),A=Object(M.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function w(u){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,h=o.media,C=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),h&&(o.updateMediaElementDuration(),l.trigger(N.Events.MEDIA_ATTACHED,{media:h})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var T=w.prototype;return T.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},T.destroy=function(){this.unregisterListeners(),this.details=null},T.registerListeners=function(){var o=this.hls;o.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(N.Events.BUFFER_RESET,this.onBufferReset,this),o.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(N.Events.BUFFER_EOS,this.onBufferEos,this),o.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(N.Events.FRAG_PARSED,this.onFragParsed,this),o.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},T.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(N.Events.BUFFER_RESET,this.onBufferReset,this),o.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(N.Events.BUFFER_EOS,this.onBufferEos,this),o.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(N.Events.FRAG_PARSED,this.onFragParsed,this),o.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},T._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},T.onManifestParsed=function(o,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},T.onMediaAttaching=function(o,l){var h=this.media=l.media;if(h&&A){var C=this.mediaSource=new A;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(C),this._objectUrl=h.src}},T.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){P.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(h&&self.URL.revokeObjectURL(h),o.src===h?(o.removeAttribute("src"),o.load()):P.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(N.Events.MEDIA_DETACHED,void 0)},T.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var h=o.sourceBuffer[l];try{h&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(h),o.sourceBuffer[l]=void 0)}catch(C){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},T.onBufferCodecs=function(o,l){var h=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(g){if(C){var p=h.tracks[g];if(p&&typeof p.buffer.changeType=="function"){var k=l[g],b=k.codec,f=k.levelCodec,m=k.container,d=(p.levelCodec||p.codec).replace(R,"$1"),a=(f||b).replace(R,"$1");if(d!==a){var x=m+";codecs="+(f||b);h.appendChangeType(g,x)}}}else h.pendingTracks[g]=l[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},T.appendChangeType=function(o,l){var h=this,C=this.operationQueue,g={execute:function(){var k=h.sourceBuffer[o];k&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),k.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(k){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",k)}};C.append(g,o)},T.onBufferAppending=function(o,l){var h=this,C=this.hls,g=this.operationQueue,p=this.tracks,k=l.data,b=l.type,f=l.frag,m=l.part,d=l.chunkMeta,a=d.buffering[b],x=self.performance.now();a.start=x;var v=f.stats.buffering,S=m?m.stats.buffering:null;v.start===0&&(v.start=x),S&&S.start===0&&(S.start=x);var I=p.audio,G=b==="audio"&&d.id===1&&(I==null?void 0:I.container)==="audio/mpeg",V={execute:function(){if(a.executeStart=self.performance.now(),G){var z=h.sourceBuffer[b];if(z){var U=f.start-z.timestampOffset;Math.abs(U)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+U+") sn: "+f.sn+")"),z.timestampOffset=f.start)}}h.appendExecutor(k,b)},onStart:function(){},onComplete:function(){var z=self.performance.now();a.executeEnd=a.end=z,v.first===0&&(v.first=z),S&&S.first===0&&(S.first=z);var U=h.sourceBuffer,q={};for(var ae in U)q[ae]=W.BufferHelper.getBuffered(U[ae]);h.appendError=0,h.hls.trigger(N.Events.BUFFER_APPENDED,{type:b,frag:f,part:m,chunkMeta:d,parent:f.type,timeRanges:q})},onError:function(z){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",z);var U={type:H.ErrorTypes.MEDIA_ERROR,parent:f.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:z,fatal:!1};z.code===DOMException.QUOTA_EXCEEDED_ERR?U.details=H.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,U.details=H.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>C.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),U.fatal=!0)),C.trigger(N.Events.ERROR,U)}};g.append(V,b)},T.onBufferFlushing=function(o,l){var h=this,C=this.operationQueue,g=function(k){return{execute:h.removeExecutor.bind(h,k,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(N.Events.BUFFER_FLUSHED,{type:k})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",f)}}};l.type?C.append(g(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){C.append(g(p),p)})},T.onFragParsed=function(o,l){var h=this,C=l.frag,g=l.part,p=[],k=g?g.elementaryStreams:C.elementaryStreams;k[O.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(k[O.ElementaryStreamTypes.AUDIO]&&p.push("audio"),k[O.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var m=self.performance.now();C.stats.buffering.end=m,g&&(g.stats.buffering.end=m);var d=g?g.stats:C.stats;h.hls.trigger(N.Events.FRAG_BUFFERED,{frag:C,part:g,stats:d,id:C.type})};p.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(b,p)},T.onFragChanged=function(o,l){this.flushBackBuffer()},T.onBufferEos=function(o,l){var h=this,C=this.getSourceBufferTypes().reduce(function(g,p){var k=h.sourceBuffer[p];return(!l.type||l.type===p)&&(k&&!k.ended&&(k.ended=!0,P.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),g&&!!(!k||k.ended)},!0);C&&this.blockBuffers(function(){var g=h.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},T.onLevelUpdated=function(o,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},T.flushBackBuffer=function(){var o=this.hls,l=this.details,h=this.media,C=this.sourceBuffer;if(!h||l===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Y.isFiniteNumber)(p)||p<0)return;var k=h.currentTime,b=l.levelTargetDuration,f=Math.max(p,b),m=Math.floor(k/b)*b-f;g.forEach(function(d){var a=C[d];if(a){var x=W.BufferHelper.getBuffered(a);x.length>0&&m>x.start(0)&&(o.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:m}),l.live&&o.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:m}),o.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:m,type:d}))}})},T.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,h=this.media,C=this.mediaSource,g=o.fragments[0].start+o.totalduration,p=h.duration,k=Object(Y.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(g>k&&g>p||!Object(Y.isFiniteNumber)(p))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},T.updateSeekableRange=function(o){var l=this.mediaSource,h=o.fragments,C=h.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var g=Math.max(0,h[0].start),p=Math.max(g,g+o.totalduration);l.setLiveSeekableRange(g,p)}},T.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,C=Object.keys(h).length;if(C&&!o||C===2){this.createSourceBuffers(h),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(N.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(p){l.executeNext(p)})}},T.createSourceBuffers=function(o){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in o)if(!l[g]){var p=o[g];if(!p)throw Error("source buffer exists for track "+g+", however track does not");var k=p.levelCodec||p.codec,b=p.container+";codecs="+k;P.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var f=l[g]=h.addSourceBuffer(b),m=g;this.addBufferListener(m,"updatestart",this._onSBUpdateStart),this.addBufferListener(m,"updateend",this._onSBUpdateEnd),this.addBufferListener(m,"error",this._onSBUpdateError),this.tracks[g]={buffer:f,codec:k,container:p.container,levelCodec:p.levelCodec,id:p.id},C++}catch(d){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(N.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:b})}}C&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},T._onSBUpdateStart=function(o){var l=this.operationQueue,h=l.current(o);h.onStart()},T._onSBUpdateEnd=function(o){var l=this.operationQueue,h=l.current(o);h.onComplete(),l.shiftAndExecuteNext(o)},T._onSBUpdateError=function(o,l){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(N.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(o);h&&h.onError(l)},T.removeExecutor=function(o,l,h){var C=this.media,g=this.mediaSource,p=this.operationQueue,k=this.sourceBuffer,b=k[o];if(!C||!g||!b){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var f=Object(Y.isFiniteNumber)(C.duration)?C.duration:Infinity,m=Object(Y.isFiniteNumber)(g.duration)?g.duration:Infinity,d=Math.max(0,l),a=Math.min(h,f,m);a>d?(P.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(d,a)):p.shiftAndExecuteNext(o)},T.appendExecutor=function(o,l){var h=this.operationQueue,C=this.sourceBuffer,g=C[l];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}g.ended=!1,console.assert(!g.updating,l+" sourceBuffer must not be updating"),g.appendBuffer(o)},T.blockBuffers=function(o,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,g=l.map(function(p){return C.appendBlocker(p)});Promise.all(g).then(function(){o(),l.forEach(function(p){var k=h.sourceBuffer[p];(!k||!k.updating)&&C.shiftAndExecuteNext(p)})})},T.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},T.addBufferListener=function(o,l,h){var C=this.sourceBuffer[o];if(!C)return;var g=h.bind(this,o);this.listeners[o].push({event:l,listener:g}),C.addEventListener(l,g)},T.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(h){l.removeEventListener(h.event,h.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return N});var Y=D("./src/utils/logger.ts"),N=function(){function P(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var H=P.prototype;return H.append=function(M,O){var y=this.queues[O];y.push(M),y.length===1&&this.buffers[O]&&this.executeNext(O)},H.insertAbort=function(M,O){var y=this.queues[O];y.unshift(M),this.executeNext(O)},H.appendBlocker=function(M){var O,y=new Promise(function(R){O=R}),A={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,M),y},H.executeNext=function(M){var O=this.buffers,y=this.queues,A=O[M],R=y[M];if(R.length){var L=R[0];try{L.execute()}catch(w){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(w),(!A||!A.updating)&&(R.shift(),this.executeNext(M))}}},H.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},H.current=function(M){return this.queues[M][0]},P}()},"./src/controller/cap-level-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts");function N(W,M){for(var O=0;O<M.length;O++){var y=M[O];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(W,y.key,y)}}function P(W,M,O){return M&&N(W.prototype,M),O&&N(W,O),W}var H=function(){function W(O){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=W.prototype;return M.setStreamController=function(y){this.streamController=y},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var y=this.hls;y.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var y=this.hls;y.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(y,A){W.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},M.onMediaAttaching=function(y,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},M.onManifestParsed=function(y,A){var R=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,R.config.capLevelToPlayerSize&&A.video&&this.startCapping()},M.onBufferCodecs=function(y,A){var R=this.hls;R.config.capLevelToPlayerSize&&A.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(y.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},M.getMaxLevel=function(y){var A=this,R=this.hls.levels;if(!R.length)return-1;var L=R.filter(function(w,T){return W.isLevelAllowed(T,A.restrictedLevels)&&T<=y});return this.clientRect=null,W.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},M.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,A={width:0,height:0};if(y){var R=y.getBoundingClientRect();A.width=R.width,A.height=R.height,!A.width&&!A.height&&(A.width=R.right-R.left||y.width||0,A.height=R.bottom-R.top||y.height||0)}return this.clientRect=A,A},W.isLevelAllowed=function(y,A){return A===void 0&&(A=[]),A.indexOf(y)===-1},W.getMaxLevelByMediaSize=function(y,A,R){if(!y||!y.length)return-1;for(var L=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},w=y.length-1,T=0;T<y.length;T+=1){var u=y[T];if((u.width>=A||u.height>=R)&&L(u,y[T+1])){w=T;break}}return w},P(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(A){}return y}}]),W}();Z.default=H},"./src/controller/cmcd-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return L});var Y=D("./src/events.ts"),N=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/utils/logger.ts");function W(w,T){for(var u=0;u<T.length;u++){var o=T[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function M(w,T,u){return T&&W(w.prototype,T),u&&W(w,u),w}function O(w,T){var u=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(u)return(u=u.call(w)).next.bind(u);if(Array.isArray(w)||(u=y(w))||T&&w&&typeof w.length=="number"){u&&(w=u);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[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(w,T){if(!w)return;if(typeof w=="string")return A(w,T);var u=Object.prototype.toString.call(w).slice(8,-1);if(u==="Object"&&w.constructor&&(u=w.constructor.name),u==="Map"||u==="Set")return Array.from(w);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return A(w,T)}function A(w,T){(T==null||T>w.length)&&(T=w.length);for(var u=0,o=new Array(T);u<T;u++)o[u]=w[u];return o}function R(){return R=Object.assign||function(w){for(var T=1;T<arguments.length;T++){var u=arguments[T];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(w[o]=u[o])}return w},R.apply(this,arguments)}var L=function(){function w(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(C){try{o.apply(C,{ot:N.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){H.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,p=o.hls.levels[g.level],k=o.getObjectType(g),b={d:g.duration*1e3,ot:k};(k===N.CMCDObjectType.VIDEO||k===N.CMCDObjectType.AUDIO||k==N.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=o.getTopBandwidth(k),b.bl=o.getBufferLength(k)),o.apply(C,b)}catch(f){H.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=u;var l=this.config=u.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||w.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var T=w.prototype;return T.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},T.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},T.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},T.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},T.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},T.onBufferCreated=function(o,l){var h,C;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},T.createData=function(){var o;return{v:N.CMCDVersion,sf:N.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}},T.apply=function(o,l){l===void 0&&(l={}),R(l,this.createData());var h=l.ot===N.CMCDObjectType.INIT||l.ot===N.CMCDObjectType.VIDEO||l.ot===N.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=w.toHeaders(l);if(!Object.keys(C).length)return;o.headers||(o.headers={}),R(o.headers,C)}else{var g=w.toQuery(l);if(!g)return;o.url=w.appendQueryToUri(o.url,g)}},T.getObjectType=function(o){var l=o.type;return l==="subtitle"?N.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?N.CMCDObjectType.INIT:l==="audio"?N.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},T.getTopBandwidth=function(o){for(var l=0,h=o===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=O(h),g;!(g=C()).done;){var p=g.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},T.getBufferLength=function(o){var l=this.hls.media,h=o===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var C=P.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return C.len*1e3},T.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,h=o||this.config.loader;return function(){function C(p){this.loader=void 0,this.loader=new h(p)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,b,f){l(k),this.loader.load(k,b,f)},M(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},T.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,h=o||this.config.loader;return function(){function C(p){this.loader=void 0,this.loader=new h(p)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,b,f){l(k),this.loader.load(k,b,f)},M(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},w.serialize=function(o){for(var l=[],h=function(G){return!Number.isNaN(G)&&G!=null&&G!==""&&G!==!1},C=function(G){return Math.round(G)},g=function(G){return C(G/100)*100},p=function(G){return encodeURIComponent(G)},k={br:C,d:C,bl:g,dl:g,mtp:g,nor:p,rtp:g,tb:C},b=Object.keys(o||{}).sort(),f=O(b),m;!(m=f()).done;){var d=m.value,a=o[d];if(!h(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var x=k[d];x&&(a=x(a));var v=typeof a,S=void 0;d==="ot"||d==="sf"||d==="st"?S=d+"="+a:v==="boolean"?S=d:v==="number"?S=d+"="+a:S=d+"="+JSON.stringify(a),l.push(S)}return l.join(",")},w.toHeaders=function(o){for(var l=Object.keys(o),h={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},k=0,b=l;k<b.length;k++){var f=b[k],m=p[f]!=null?p[f]:1;g[m][f]=o[f]}for(var d=0;d<g.length;d++){var a=w.serialize(g[d]);a&&(h["CMCD-"+C[d]]=a)}return h},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,l){if(!l)return o;var h=o.includes("?")?"&":"?";return""+o+h+l},w}()},"./src/controller/eme-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts"),N=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=D("./src/utils/mediakeys-helper.ts");function W(L,w){for(var T=0;T<w.length;T++){var u=w[T];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function M(L,w,T){return w&&W(L.prototype,w),T&&W(L,T),L}var O=3,y=function(w,T,u){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),T.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[o]},A=function(w,T,u,o){switch(w){case H.KeySystems.WIDEVINE:return y(T,u,o);default:throw new Error("Unknown key-system: "+w)}},R=function(){function L(T){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=T,this._config=T.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 w=L.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(u){switch(u){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},w._attemptKeySystemAccess=function(u,o,l){var h=this,C=A(u,o,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(u,C);this.mediaKeysPromise=g.then(function(p){return h._onMediaKeySystemAccessObtained(u,p)}),g.catch(function(p){P.logger.error('Failed to obtain key-system "'+u+'" access:',p)})},w._onMediaKeySystemAccessObtained=function(u,o){var l=this;P.logger.log('Access for key-system "'+u+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(h);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return h.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),g});return C.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),C},w._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(u){var o=this;P.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(l){o._onKeySessionMessage(u,l.message)},!1)},w._onKeySessionMessage=function(u,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},w.onMediaEncrypted=function(u){var o=this;if(P.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},w._attemptSetMediaKeys=function(u){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){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(u,o){var l=this,h=this._mediaKeysList[0];if(!h){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var C=h.mediaKeysSession;if(!C){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+u+'" init data type'),h.mediaKeysSessionInitialized=!0,C.generateRequest(u,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),l.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(u,o,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,u,o,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,h,u),C=void 0}catch(g){P.logger.error(g)}try{h.readyState||h.open("POST",u,!0),C&&C.call(this.hls,h,u)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return h},w._onLicenseRequestReadyStageChange=function(u,o,l,h){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var C=u.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,u,o)}catch(k){P.logger.error(k)}h(C)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=O-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,h)}break}},w._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},w._requestLicense=function(u,o){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(h,u,o);P.logger.log("Sending license request to URL: "+h);var g=this._generateLicenseRequestChallenge(l,u);C.send(g)}catch(p){P.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.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 u.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),h=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,l,h)},M(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Z.default=R},"./src/controller/fps-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts"),N=D("./src/utils/logger.ts"),P=function(){function H(M){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=M,this.registerListeners()}var W=H.prototype;return W.setStreamController=function(O){this.streamController=O},W.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(O,y){var A=this.hls.config;if(A.capLevelOnFPSDrop){var R=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(O,y,A){var R=performance.now();if(y){if(this.lastTime){var L=R-this.lastTime,w=A-this.lastDroppedFrames,T=y-this.lastDecodedFrames,u=1e3*w/L,o=this.hls;if(o.trigger(Y.Events.FPS_DROP,{currentDropped:w,currentDecoded:T,totalDroppedFrames:A}),u>0&&w>o.config.fpsDroppedMonitoringThreshold*T){var l=o.currentLevel;N.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(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=A,this.lastDecodedFrames=y}},W.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var y=O.getVideoPlaybackQuality();this.checkFPS(O,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},H}();Z.default=P},"./src/controller/fragment-finders.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"findFragmentByPDT",function(){return P}),D.d(Z,"findFragmentByPTS",function(){return H}),D.d(Z,"fragmentWithinToleranceTest",function(){return W}),D.d(Z,"pdtWithinToleranceTest",function(){return M}),D.d(Z,"findFragWithCC",function(){return O});var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/binary-search.ts");function P(y,A,R){if(A===null||!Array.isArray(y)||!y.length||!Object(Y.isFiniteNumber)(A))return null;var L=y[0].programDateTime;if(A<(L||0))return null;var w=y[y.length-1].endProgramDateTime;if(A>=(w||0))return null;R=R||0;for(var T=0;T<y.length;++T){var u=y[T];if(M(A,R,u))return u}return null}function H(y,A,R,L){R===void 0&&(R=0),L===void 0&&(L=0);var w=null;if(y?w=A[y.sn-A[0].sn+1]||null:R===0&&A[0].start===0&&(w=A[0]),w&&W(R,L,w)===0)return w;var T=N.default.search(A,W.bind(null,R,L));return T||w}function W(y,A,R){y===void 0&&(y=0),A===void 0&&(A=0);var L=Math.min(A,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-L<=y?1:R.start-L>y&&R.start?-1:0}function M(y,A,R){var L=Math.min(A,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,w=R.endProgramDateTime||0;return w-L>y}function O(y,A){return N.default.search(y,function(R){return R.cc<A?1:R.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"FragmentState",function(){return P}),D.d(Z,"FragmentTracker",function(){return H});var Y=D("./src/events.ts"),N=D("./src/types/loader.ts"),P;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(P||(P={}));var H=function(){function O(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var y=O.prototype;return y._registerListeners=function(){var R=this.hls;R.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var R=this.hls;R.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(R,L){if(L===N.PlaylistLevelType.MAIN){var w=this.activeFragment,T=this.activeParts;if(!w)return null;if(T)for(var u=T.length;u--;){var o=T[u],l=o?o.end:w.appendedPTS;if(o.start<=R&&l!==void 0&&R<=l)return u>9&&(this.activeParts=T.slice(u-9)),o}else if(w.start<=R&&w.appendedPTS!==void 0&&R<=w.appendedPTS)return w}return this.getBufferedFrag(R,L)},y.getBufferedFrag=function(R,L){for(var w=this.fragments,T=Object.keys(w),u=T.length;u--;){var o=w[T[u]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=R&&R<=l.end)return l}}return null},y.detectEvictedFragments=function(R,L,w){var T=this;Object.keys(this.fragments).forEach(function(u){var o=T.fragments[u];if(!o)return;if(!o.buffered){o.body.type===w&&T.removeFragment(o.body);return}var l=o.range[R];if(!l)return;l.time.some(function(h){var C=!T.isTimeBuffered(h.startPTS,h.endPTS,L);return C&&T.removeFragment(o.body),C})})},y.detectPartialFragments=function(R){var L=this,w=this.timeRanges,T=R.frag,u=R.part;if(!w||T.sn==="initSegment")return;var o=M(T),l=this.fragments[o];if(!l)return;Object.keys(w).forEach(function(h){var C=T.elementaryStreams[h];if(!C)return;var g=w[h],p=u!==null||C.partial===!0;l.range[h]=L.getBufferedTimes(T,u,p,g)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(R){var L=M(R),w=this.fragments[L];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},y.getBufferedTimes=function(R,L,w,T){for(var u={time:[],partial:w},o=L?L.start:R.start,l=L?L.end:R.end,h=R.minEndPTS||l,C=R.maxStartPTS||o,g=0;g<T.length;g++){var p=T.start(g)-this.bufferPadding,k=T.end(g)+this.bufferPadding;if(C>=p&&h<=k){u.time.push({startPTS:Math.max(o,T.start(g)),endPTS:Math.min(l,T.end(g))});break}else if(o<k&&l>p)u.partial=!0,u.time.push({startPTS:Math.max(o,T.start(g)),endPTS:Math.min(l,T.end(g))});else if(l<=p)break}return u},y.getPartialFragment=function(R){var L=null,w,T,u,o=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(C){var g=h[C];if(!g)return;W(g)&&(T=g.body.start-l,u=g.body.end+l,R>=T&&R<=u&&(w=Math.min(R-T,u-R),o<=w&&(L=g.body,o=w)))}),L},y.getState=function(R){var L=M(R),w=this.fragments[L];return w?w.buffered?W(w)?P.PARTIAL:P.OK:w.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},y.backtrack=function(R,L){var w=M(R),T=this.fragments[w];if(!T||T.backtrack)return null;var u=T.backtrack=L||T.loaded;return T.loaded=null,u},y.getBacktrackData=function(R){var L=M(R),w=this.fragments[L];if(w){var T,u=w.backtrack;if(u!=null&&(T=u.payload)!==null&&T!==void 0&&T.byteLength)return u;this.removeFragment(R)}return null},y.isTimeBuffered=function(R,L,w){for(var T,u,o=0;o<w.length;o++){if(T=w.start(o)-this.bufferPadding,u=w.end(o)+this.bufferPadding,R>=T&&L<=u)return!0;if(L<=T)return!1}return!1},y.onFragLoaded=function(R,L){var w=L.frag,T=L.part;if(w.sn==="initSegment"||w.bitrateTest||T)return;var u=M(w);this.fragments[u]={body:w,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(R,L){var w=this,T=L.frag,u=L.part,o=L.timeRanges;if(T.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=T,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(h){var C=o[h];if(w.detectEvictedFragments(h,C),!u)for(var g=0;g<C.length;g++)T.appendedPTS=Math.max(C.end(g),T.appendedPTS||0)})},y.onFragBuffered=function(R,L){this.detectPartialFragments(L)},y.hasFragment=function(R){var L=M(R);return!!this.fragments[L]},y.removeFragmentsInRange=function(R,L,w){var T=this;Object.keys(this.fragments).forEach(function(u){var o=T.fragments[u];if(!o)return;if(o.buffered){var l=o.body;l.type===w&&l.start<L&&l.end>R&&T.removeFragment(l)}})},y.removeFragment=function(R){var L=M(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[L]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function W(O){var y,A;return O.buffered&&(((y=O.range.video)===null||y===void 0?void 0:y.partial)||((A=O.range.audio)===null||A===void 0?void 0:A.partial))}function M(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return W}),D.d(Z,"MAX_START_GAP_JUMP",function(){return M}),D.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),D.d(Z,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d(Z,"default",function(){return A});var Y=D("./src/utils/buffer-helper.ts"),N=D("./src/errors.ts"),P=D("./src/events.ts"),H=D("./src/utils/logger.ts"),W=250,M=2,O=.1,y=.05,A=function(){function R(w,T,u,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=w,this.media=T,this.fragmentTracker=u,this.hls=o}var L=R.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(T){var u=this.config,o=this.media,l=this.stalled,h=o.currentTime,C=o.seeking,g=this.seeking&&!C,p=!this.seeking&&C;if(this.seeking=C,h!==T){if(this.moved=!0,l!==null){if(this.stallReported){var k=self.performance.now()-l;H.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Y.BufferHelper.getBuffered(o).length)return;var b=Y.BufferHelper.bufferInfo(o,h,0),f=b.len>0,m=b.nextStart||0;if(!f&&!m)return;if(C){var d=b.len>M,a=!m||m-h>M&&!this.fragmentTracker.getPartialFragment(h);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,v=Math.max(m,b.start||0)-h,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=S==null||((x=S.details)===null||x===void 0)?void 0:x.live,G=I?S.details.targetduration*2:M;if(v>0&&v<=G){this._trySkipBufferHole(null);return}}var V=self.performance.now();if(l===null){this.stalled=V;return}var Q=V-l;!C&&Q>=W&&this._reportStall(b.len);var z=Y.BufferHelper.bufferInfo(o,h,u.maxBufferHole);this._tryFixBufferStall(z,Q)},L._tryFixBufferStall=function(T,u){var o=this.config,l=this.fragmentTracker,h=this.media,C=h.currentTime,g=l.getPartialFragment(C);if(g){var p=this._trySkipBufferHole(g);if(p)return}T.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(T){var u=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+T+")"),u.trigger(P.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:T}))},L._trySkipBufferHole=function(T){for(var u=this.config,o=this.hls,l=this.media,h=l.currentTime,C=0,g=Y.BufferHelper.getBuffered(l),p=0;p<g.length;p++){var k=g.start(p);if(h+u.maxBufferHole>=C&&h<k){var b=Math.max(k+y,l.currentTime+O);return H.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,T&&o.trigger(P.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+b,frag:T}),b}C=g.end(p)}return 0},L._tryNudgeBuffer=function(){var T=this.config,u=this.hls,o=this.media,l=o.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<T.nudgeMaxRetry){var C=l+h*T.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+l+" to "+C),o.currentTime=C,u.trigger(P.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+T.nudgeMaxRetry+" nudges"),u.trigger(P.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),H=.25,W=function(){function M(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var O=M.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var A=this.hls;A.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var A=this.hls;A.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(A,R){this.media=R.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(A){if(!this.media)return;for(var R=0;R<A.length;R++){var L=A[R];if(L.kind==="metadata"&&L.label==="id3")return Object(N.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(A,R){if(!this.media)return;var L=R.frag,w=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var T=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<w.length;u++){var o=P.getID3Frames(w[u].data);if(o){var l=w[u].pts,h=u<w.length-1?w[u+1].pts:L.end,C=h-l;C<=0&&(h=l+H);for(var g=0;g<o.length;g++){var p=o[g];if(!P.isTimeStampFrame(p)){var k=new T(l,h,"");k.value=p,this.id3Track.addCue(k)}}}}},O.onBufferFlushing=function(A,R){var L=R.startOffset,w=R.endOffset,T=R.type;if(!T||T==="audio"){var u=this.id3Track;u&&Object(N.removeCuesInRange)(u,L,w)}},M}();Z.default=W},"./src/controller/latency-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return M});var Y=D("./src/errors.ts"),N=D("./src/events.ts"),P=D("./src/utils/logger.ts");function H(O,y){for(var A=0;A<y.length;A++){var R=y[A];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(O,R.key,R)}}function W(O,y,A){return y&&H(O.prototype,y),A&&H(O,A),O}var M=function(){function O(A){var R=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return R.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var y=O.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},y.onMediaAttached=function(R,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(R,L){var w=L.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(R,L){if(L.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var R=this.media,L=this.levelDetails;if(!R||!L)return;this.currentTime=R.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var T=this.config,u=T.lowLatencyMode,o=T.maxLiveSyncPlaybackRate;if(!u||o===1)return;var l=this.targetLatency;if(l===null)return;var h=w-l,C=Math.min(this.maxLatency,l+L.targetduration),g=h<C;if(L.live&&g&&h>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),k=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;R.playbackRate=Math.min(p,Math.max(1,k))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},y.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},y.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},W(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,L=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:L?R.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var L=R.holdBack,w=R.partHoldBack,T=R.targetduration,u=this.config,o=u.liveSyncDuration,l=u.liveSyncDurationCount,h=u.lowLatencyMode,C=this.hls.userConfig,g=h&&w||L;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:l*T);var p=T,k=1;return g+Math.min(this.stallCount*k,p)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),L=this.targetLatency,w=this.levelDetails;if(R===null||L===null||w===null)return null;var T=w.edge,u=R-L-this.edgeStalled,o=T-w.totalduration,l=T-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,u),l)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var L=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-L,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,L=this.levelDetails;if(!R||!L)return 0;var w=R.buffered.length;return w?R.buffered.end(w-1):L.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return u});var Y=D("./src/types/level.ts"),N=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/codecs.ts"),W=D("./src/controller/level-helper.ts"),M=D("./src/controller/base-playlist-controller.ts"),O=D("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var C in h)Object.prototype.hasOwnProperty.call(h,C)&&(o[C]=h[C])}return o},y.apply(this,arguments)}function A(o,l){for(var h=0;h<l.length;h++){var C=l[h];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function R(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,w(o,l)}function w(o,l){return w=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},w(o,l)}var T=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){L(l,o);function l(C){var g;return g=o.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var h=l.prototype;return h._registerListeners=function(){var g=this.hls;g.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(N.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var g=this.hls;g.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(N.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},h.startLoad=function(){var g=this._levels;g.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},h.onManifestLoaded=function(g,p){var k=[],b=[],f=[],m,d={},a,x=!1,v=!1,S=!1;if(p.levels.forEach(function(Q){var z=Q.attrs;x=x||!!(Q.width&&Q.height),v=v||!!Q.videoCodec,S=S||!!Q.audioCodec,T&&Q.audioCodec&&Q.audioCodec.indexOf("mp4a.40.34")!==-1&&(Q.audioCodec=void 0);var U=Q.bitrate+"-"+Q.attrs.RESOLUTION+"-"+Q.attrs.CODECS;a=d[U],a?a.url.push(Q.url):(a=new Y.Level(Q),d[U]=a,k.push(a)),z&&(z.AUDIO&&Object(W.addGroupId)(a,"audio",z.AUDIO),z.SUBTITLES&&Object(W.addGroupId)(a,"text",z.SUBTITLES))}),(x||v)&&S&&(k=k.filter(function(Q){var z=Q.videoCodec,U=Q.width,q=Q.height;return!!z||!!(U&&q)})),k=k.filter(function(Q){var z=Q.audioCodec,U=Q.videoCodec;return(!z||Object(H.isCodecSupportedInMp4)(z,"audio"))&&(!U||Object(H.isCodecSupportedInMp4)(U,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(Q){return!Q.audioCodec||Object(H.isCodecSupportedInMp4)(Q.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(b)),p.subtitles&&(f=p.subtitles,Object(W.assignTrackIdsByGroup)(f)),k.length>0){m=k[0].bitrate,k.sort(function(Q,z){return Q.bitrate-z.bitrate}),this._levels=k;for(var I=0;I<k.length;I++)if(k[I].bitrate===m){this._firstLevel=I,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+m);break}var G=S&&!v,V={levels:k,audioTracks:b,subtitleTracks:f,firstLevel:this._firstLevel,stats:p.stats,audio:S,video:v,altAudio:!G&&b.some(function(Q){return!!Q.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,V),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(g,p){if(o.prototype.onError.call(this,g,p),p.fatal)return;var k=p.context,b=this._levels[this.currentLevelIndex];if(k&&(k.type===O.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&k.groupId===b.audioGroupIds[b.urlId]||k.type===O.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&k.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,m=!0,d;switch(p.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=p.frag.level)):d=p.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(m=!1),d=k.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:d=p.level,f=!0;break}d!==void 0&&this.recoverLevel(p,d,f,m)},h.recoverLevel=function(g,p,k,b){var f=g.details,m=this._levels[p];if(m.loadError++,k){var d=this.retryLoadingOrFail(g);if(d)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=m.url.length;if(a>1&&m.loadError<a)g.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var x=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(f+": switch to "+x),g.levelRetry=!0,this.hls.nextAutoLevel=x)}}},h.redundantFailover=function(g){var p=this._levels[g],k=p.url.length;if(k>1){var b=(p.urlId+1)%k;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(f){f.urlId=b}),this.level=g}},h.onFragLoaded=function(g,p){var k=p.frag;if(k!==void 0&&k.type===O.PlaylistLevelType.MAIN){var b=this._levels[k.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},h.onLevelLoaded=function(g,p){var k,b=p.level,f=p.details,m=this._levels[b];if(!m){var d;this.warn("Invalid level index "+b),(d=p.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(m.fragmentError===0&&(m.loadError=0,this.retryCount=0),this.playlistLoaded(b,p,m.details)):(k=p.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(f.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(g,p){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var b=-1,f=this.hls.audioTracks[p.id].groupId,m=0;m<k.audioGroupIds.length;m++)if(k.audioGroupIds[m]===f){b=m;break}b!==k.urlId&&(k.urlId=b,this.startLoad())}},h.loadPlaylist=function(g){var p=this.currentLevelIndex,k=this._levels[p];if(this.canLoad&&k&&k.url.length>0){var b=k.urlId,f=k.url[b];if(g)try{f=g.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Attempt loading level index "+p+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+b+" "+f),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:f,level:p,id:b,deliveryDirectives:g||null})}},h.removeLevel=function(g,p){var k=function(m,d){return d!==p},b=this._levels.filter(function(f,m){return m!==g?!0:f.url.length>1&&p!==void 0?(f.url=f.url.filter(k),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(k)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(k)),f.urlId=0,!0):!1}).map(function(f,m){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=m}),f});this._levels=b,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:b})},R(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var p,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===g&&(p=k[g])!==null&&p!==void 0&&p.details)return;if(g<0||g>=k.length){var b=g<0;if(this.hls.trigger(N.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:b,reason:"invalid level idx"}),b)return;g=Math.min(g,k.length-1)}this.clearTimer();var f=this.currentLevelIndex,m=k[f],d=k[g];this.log("switching to level "+g+" from "+f),this.currentLevelIndex=g;var a=y({},d,{level:g,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,a);var x=d.details;if(!x||x.live){var v=this.switchParams(d.uri,m==null?void 0:m.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),l}(M.default)},"./src/controller/level-helper.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"addGroupId",function(){return P}),D.d(Z,"assignTrackIdsByGroup",function(){return H}),D.d(Z,"updatePTS",function(){return W}),D.d(Z,"updateFragPTSDTS",function(){return O}),D.d(Z,"mergeDetails",function(){return y}),D.d(Z,"mapPartIntersection",function(){return A}),D.d(Z,"mapFragmentIntersection",function(){return R}),D.d(Z,"adjustSliding",function(){return L}),D.d(Z,"addSliding",function(){return w}),D.d(Z,"computeReloadInterval",function(){return T}),D.d(Z,"getFragmentWithSN",function(){return u}),D.d(Z,"getPartWith",function(){return o});var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts");function P(l,h,C){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function H(l){var h={};l.forEach(function(C){var g=C.groupId||"";C.id=h[g]=h[g]||0,h[g]++})}function W(l,h,C){var g=l[h],p=l[C];M(g,p)}function M(l,h){var C=h.startPTS;if(Object(Y.isFiniteNumber)(C)){var g=0,p;h.sn>l.sn?(g=C-l.start,p=l):(g=l.start-C,p=h),p.duration!==g&&(p.duration=g)}else if(h.sn>l.sn){var k=l.cc===h.cc;k&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function O(l,h,C,g,p,k){var b=g-C;b<=0&&(N.logger.warn("Fragment should have a positive duration",h),g=C+h.duration,k=p+h.duration);var f=C,m=g,d=h.startPTS,a=h.endPTS;if(Object(Y.isFiniteNumber)(d)){var x=Math.abs(d-C);Object(Y.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(x,h.deltaPTS):h.deltaPTS=x,f=Math.max(C,d),C=Math.min(C,d),p=Math.min(p,h.startDTS),m=Math.min(g,a),g=Math.max(g,a),k=Math.max(k,h.endDTS)}h.duration=g-C;var v=C-h.start;h.appendedPTS=g,h.start=h.startPTS=C,h.maxStartPTS=f,h.startDTS=p,h.endPTS=g,h.minEndPTS=m,h.endDTS=k;var S=h.sn;if(!l||S<l.startSN||S>l.endSN)return 0;var I,G=S-l.startSN,V=l.fragments;for(V[G]=h,I=G;I>0;I--)M(V[I],V[I-1]);for(I=G;I<V.length-1;I++)M(V[I],V[I+1]);return l.fragmentHint&&M(V[V.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,v}function y(l,h){for(var C=null,g=l.fragments,p=g.length-1;p>=0;p--){var k=g[p].initSegment;if(k){C=k;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,f;if(R(l,h,function(I,G){I.relurl&&(b=I.cc-G.cc),Object(Y.isFiniteNumber)(I.startPTS)&&Object(Y.isFiniteNumber)(I.endPTS)&&(G.start=G.startPTS=I.startPTS,G.startDTS=I.startDTS,G.appendedPTS=I.appendedPTS,G.maxStartPTS=I.maxStartPTS,G.endPTS=I.endPTS,G.endDTS=I.endDTS,G.minEndPTS=I.minEndPTS,G.duration=I.endPTS-I.startPTS,G.duration&&(f=G),h.PTSKnown=h.alignedSliding=!0),G.elementaryStreams=I.elementaryStreams,G.loader=I.loader,G.stats=I.stats,G.urlId=I.urlId,I.initSegment&&(G.initSegment=I.initSegment,C=I.initSegment)}),C){var m=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;m.forEach(function(I){var G;(!I.initSegment||I.initSegment.relurl===((G=C)===null||G===void 0?void 0:G.relurl))&&(I.initSegment=C)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(I){return!I}),h.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=h.skippedSegments;d--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var a=h.fragments;if(b){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=b}h.skippedSegments&&(h.startCC=h.fragments[0].cc),A(l.partList,h.partList,function(I,G){G.elementaryStreams=I.elementaryStreams,G.stats=I.stats}),f?O(h,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):L(l,h),a.length&&(h.totalduration=h.edge-a[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var v=h.advancedDateTime;if(h.advanced&&v){var S=h.edge;h.driftStart||(h.driftStartTime=v,h.driftStart=S),h.driftEndTime=v,h.driftEnd=S}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function A(l,h,C){if(l&&h)for(var g=0,p=0,k=l.length;p<=k;p++){var b=l[p],f=h[p+g];b&&f&&b.index===f.index&&b.fragment.sn===f.fragment.sn?C(b,f):g--}}function R(l,h,C){for(var g=h.skippedSegments,p=Math.max(l.startSN,h.startSN)-h.startSN,k=(l.fragmentHint?1:0)+(g?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,b=h.startSN-l.startSN,f=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,m=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=p;d<=k;d++){var a=m[b+d],x=f[d];g&&!x&&d<g&&(x=h.fragments[d]=a),a&&x&&C(a,x)}}function L(l,h){var C=h.startSN+h.skippedSegments-l.startSN,g=l.fragments;if(C<0||C>=g.length)return;w(h,g[C].start)}function w(l,h){if(h){for(var C=l.fragments,g=l.skippedSegments;g<C.length;g++)C[g].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function T(l,h){var C=1e3*l.levelTargetDuration,g=C/2,p=l.age,k=p>0&&p<C*3,b=h.loading.end-h.loading.start,f,m=l.availabilityDelay;if(l.updated===!1)if(k){var d=333*l.misses;f=Math.max(Math.min(g,b*2),d),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=g;else k?(m=Math.min(m||C/2,p),l.availabilityDelay=m,f=m+C-p):f=C-b;return Math.round(f)}function u(l,h,C){if(!l||!l.details)return null;var g=l.details,p=g.fragments[h-g.startSN];return p||(p=g.fragmentHint,p&&p.sn===h?p:h<g.startSN&&C&&C.sn===h?C:null)}function o(l,h,C){if(!l||!l.details)return null;var g=l.details.partList;if(g)for(var p=g.length;p--;){var k=g[p];if(k.index===C&&k.fragment.sn===h)return k}return null}},"./src/controller/stream-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return g});var Y=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),H=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),M=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),R=D("./src/types/transmuxer.ts"),L=D("./src/controller/gap-controller.ts"),w=D("./src/errors.ts"),T=D("./src/utils/logger.ts");function u(p,k){for(var b=0;b<k.length;b++){var f=k[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}function o(p,k,b){return k&&u(p.prototype,k),b&&u(p,b),p}function l(p,k){p.prototype=Object.create(k.prototype),p.prototype.constructor=p,h(p,k)}function h(p,k){return h=Object.setPrototypeOf||function(f,m){return f.__proto__=m,f},h(p,k)}var C=100,g=function(p){l(k,p);function k(f,m){var d;return d=p.call(this,f,m,"[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 b=k.prototype;return b._registerListeners=function(){var m=this.hls;m.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),m.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),m.on(H.Events.ERROR,this.onError,this),m.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),m.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),m.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var m=this.hls;m.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),m.off(H.Events.ERROR,this.onError,this),m.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),m.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),m.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(m){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}d>0&&m===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),m=d),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=m,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var m,d=this.levels,a=this.level,x=d==null||((m=d[a])===null||m===void 0)?void 0:m.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var v,S=self.performance.now(),I=this.retryDate;(!I||S>=I||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var m,d,a=this.hls,x=this.levelLastLoaded,v=this.levels,S=this.media,I=a.config,G=a.nextLoadLevel;if(x===null||!S&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[G])return;var V=v[G];this.level=a.nextLoadLevel=G;var Q=V.details;if(!Q||this.state===N.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==G){this.state=N.State.WAITING_LEVEL;return}var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,O.PlaylistLevelType.MAIN);if(z===null)return;var U=z.len,q=this.getMaxBufferLength(V.maxBitrate);if(U>=q)return;if(this._streamEnded(z,Q)){var ae={};this.altAudio&&(ae.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,ae),this.state=N.State.ENDED;return}var ce=z.end,ve=this.getNextFragment(ce,Q);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Oe=ve.sn-Q.startSN;Oe>1&&(ve=Q.fragments[Oe-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===M.FragmentState.OK&&this.nextLoadPosition>ce){var xe=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,xe,O.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,Q)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((m=ve.decryptdata)===null||m===void 0?void 0:m.keyFormat)==="identity"&&!((d=ve.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ve,Q):this.loadFragment(ve,Q,ce)},b.loadFragment=function(m,d,a){var x,v=this.fragmentTracker.getState(m);if(this.fragCurrent=m,v===M.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(m);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else v=M.FragmentState.NOT_LOADED}v===M.FragmentState.NOT_LOADED||v===M.FragmentState.PARTIAL?m.sn==="initSegment"?this._loadInitSegment(m):this.bitrateTest?(m.bitrateTest=!0,this.log("Fragment "+m.sn+" of level "+m.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(m)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,m,d,a)):v===M.FragmentState.APPENDING?this.reduceMaxBufferLength(m.duration)&&this.fragmentTracker.removeFragment(m):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(m){var d=this.fragmentTracker.getAppendedFrag(m,O.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},b.getBufferedFrag=function(m){return this.fragmentTracker.getBufferedFrag(m,O.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(m){return m?this.getBufferedFrag(m.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var m=this.levels,d=this.media;if(d!=null&&d.readyState){var a,x=this.getAppendedFrag(d.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!d.paused&&m){var v=this.hls.nextLoadLevel,S=m[v],I=this.fragLastKbps;I&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*I)+1:a=0}else a=0;var G=this.getBufferedFrag(d.currentTime+a);if(G){var V=this.followingBufferedFrag(G);if(V){this.abortCurrentFrag();var Q=V.maxStartPTS?V.maxStartPTS:V.start,z=V.duration,U=Math.max(G.end,Q+Math.min(Math.max(z-this.config.maxFragLookUpTolerance,z*.5),z*.75));this.flushMainBuffer(U,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var m=this.fragCurrent;this.fragCurrent=null,m!=null&&m.loader&&m.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(m,d){p.prototype.flushMainBuffer.call(this,m,d,this.altAudio?"video":null)},b.onMediaAttached=function(m,d){p.prototype.onMediaAttached.call(this,m,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 L.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var m=this.media;m&&(m.removeEventListener("playing",this.onvplaying),m.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var m=this.media,d=m?m.currentTime:null;Object(Y.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(m,d){var a=!1,x=!1,v;d.levels.forEach(function(S){v=S.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(P.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},b.onLevelLoading=function(m,d){var a=this.levels;if(!a||this.state!==N.State.IDLE)return;var x=a[d.level];(!x.details||x.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(x.details))&&(this.state=N.State.WAITING_LEVEL)},b.onLevelLoaded=function(m,d){var a,x=this.levels,v=d.level,S=d.details,I=S.totalduration;if(!x){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+I);var G=this.fragCurrent;G&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(G.level!==d.level&&G.loader&&(this.state=N.State.IDLE,G.loader.abort()));var V=x[v],Q=0;if(S.live||(a=V.details)!==null&&a!==void 0&&a.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;Q=this.alignPlaylists(S,V.details)}if(V.details=S,this.levelLastLoaded=v,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:S,level:v}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=N.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,Q),this.tick()},b._handleFragmentLoadProgress=function(m){var d,a=m.frag,x=m.part,v=m.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var I=S[a.level],G=I.details;if(!G){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var V=I.videoCodec,Q=G.PTSKnown||!G.live,z=(d=a.initSegment)===null||d===void 0?void 0:d.data,U=this._getAudioCodec(I),q=this.transmuxer=this.transmuxer||new A.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ae=x?x.index:-1,ce=ae!==-1,ve=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,ae,ce),Oe=this.initPTS[a.cc];q.push(v,z,U,V,a,x,G.totalduration,Q,ve,Oe)},b.onAudioTrackSwitching=function(m,d){var a=this.altAudio,x=!!d.url,v=d.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;a&&I.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:v})}},b.onAudioTrackSwitched=function(m,d){var a=d.id,x=!!this.hls.audioTracks[a].url;if(x){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=x,this.tick()},b.onBufferCreated=function(m,d){var a=d.tracks,x,v,S=!1;for(var I in a){var G=a[I];if(G.id==="main"){if(v=I,x=G,I==="video"){var V=a[I];V&&(this.videoBuffer=V.buffer)}}else S=!0}S&&x?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(m,d){var a=d.frag,x=d.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var v=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},b.onError=function(m,d){switch(d.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=N.State.ERROR):!d.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var m=this.media,d=this.gapController;if(!m||!d||!m.readyState)return;var a=W.BufferHelper.getBuffered(m);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=m.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(m,d){var a=d.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,O.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(m,d){this.levels=d.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var m=this.media,d=m.currentTime,a=this.startPosition;if(a>=0&&d<a){if(m.seeking){T.logger.log("could not seek to "+a+", already seeking at "+d);return}var x=W.BufferHelper.getBuffered(m),v=x.length?x.start(0):0,S=v-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(T.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),m.currentTime=a}},b._getAudioCodec=function(m){var d=this.config.defaultAudioCodec||m.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},b._loadBitrateTestFrag=function(m){var d=this;this._doFragLoad(m).then(function(a){var x=d.hls;if(!a||x.nextLoadLevel||d.fragContextChanged(m))return;d.fragLoadError=0,d.state=N.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var v=m.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),x.trigger(H.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(m){var d,a="main",x=this.hls,v=m.remuxResult,S=m.chunkMeta,I=this.getCurrentContext(S);if(!I){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var G=I.frag,V=I.part,Q=I.level,z=v.video,U=v.text,q=v.id3,ae=v.initSegment,ce=this.altAudio?void 0:v.audio;if(this.fragContextChanged(G))return;if(this.state=N.State.PARSING,ae){ae.tracks&&(this._bufferInitSegment(Q,ae.tracks,G,S),x.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:a,tracks:ae.tracks}));var ve=ae.initPTS,Oe=ae.timescale;Object(Y.isFiniteNumber)(ve)&&(this.initPTS[G.cc]=ve,x.trigger(H.Events.INIT_PTS_FOUND,{frag:G,id:a,initPTS:ve,timescale:Oe}))}if(z&&v.independent!==!1){if(Q.details){var xe=z.startPTS,Te=z.endPTS,Ce=z.startDTS,Se=z.endDTS;if(V)V.elementaryStreams[z.type]={startPTS:xe,endPTS:Te,startDTS:Ce,endDTS:Se};else if(z.firstKeyFrame&&z.independent&&(this.couldBacktrack=!0),z.dropped&&z.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<xe){this.backtrack(G);return}G.setElementaryStreamInfo(z.type,G.start,Te,G.start,Se,!0)}G.setElementaryStreamInfo(z.type,xe,Te,Ce,Se),this.bufferFragmentData(z,G,V,S)}}else if(v.independent===!1){this.backtrack(G);return}if(ce){var oe=ce.startPTS,De=ce.endPTS,Ye=ce.startDTS,Ge=ce.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:De,startDTS:Ye,endDTS:Ge}),G.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,oe,De,Ye,Ge),this.bufferFragmentData(ce,G,V,S)}if(q!=null&&(d=q.samples)!==null&&d!==void 0&&d.length){var tt={frag:G,id:a,samples:q.samples};x.trigger(H.Events.FRAG_PARSING_METADATA,tt)}if(U){var qe={frag:G,id:a,samples:U.samples};x.trigger(H.Events.FRAG_PARSING_USERDATA,qe)}},b._bufferInitSegment=function(m,d,a,x){var v=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var S=d.audio,I=d.video,G=d.audiovideo;if(S){var V=m.audioCodec,Q=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(V&&(V.indexOf("mp4a.40.5")!==-1?V="mp4a.40.2":V="mp4a.40.5"),S.metadata.channelCount!==1&&Q.indexOf("firefox")===-1&&(V="mp4a.40.5")),Q.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(V="mp4a.40.2",this.log("Android: force audio codec to "+V)),m.audioCodec&&m.audioCodec!==V&&this.log('Swapping manifest audio codec "'+m.audioCodec+'" for "'+V+'"'),S.levelCodec=V,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(V||"")+"/"+(m.audioCodec||"")+"/"+S.codec+"]")}I&&(I.levelCodec=m.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(m.videoCodec||"")+"/"+I.codec+"]")),G&&this.log("Init audiovideo buffer, container:"+G.container+", codecs[level/parsed]=["+(m.attrs.CODECS||"")+"/"+G.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(z){var U=d[z],q=U.initSegment;q!=null&&q.byteLength&&v.hls.trigger(H.Events.BUFFER_APPENDING,{type:z,data:q,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},b.backtrack=function(m){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(m);var d=this.fragmentTracker.backtrack(m);this.fragPrevious=null,this.nextLoadPosition=m.start,d?this.resetFragmentLoading(m):this.state=N.State.BACKTRACKING},b.checkFragmentChanged=function(){var m=this.media,d=null;if(m&&m.readyState>1&&m.seeking===!1){var a=m.currentTime;if(W.BufferHelper.isBuffered(m,a)?d=this.getAppendedFrag(a):W.BufferHelper.isBuffered(m,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var x=this.fragPlaying,v=d.level;(!x||d.sn!==x.sn||x.level!==v||d.urlId!==x.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:d}),(!x||x.level!==v)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=d)}}},o(k,[{key:"nextLevel",get:function(){var m=this.nextBufferedFrag;return m?m.level:-1}},{key:"currentLevel",get:function(){var m=this.media;if(m){var d=this.getAppendedFrag(m.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var m=this.media;if(m){var d=this.getAppendedFrag(m.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"SubtitleStreamController",function(){return l});var Y=D("./src/events.ts"),N=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/controller/fragment-finders.ts"),W=D("./src/utils/discontinuities.ts"),M=D("./src/controller/level-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),R=D("./src/types/level.ts");function L(h,C){for(var g=0;g<C.length;g++){var p=C[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(h,p.key,p)}}function w(h,C,g){return C&&L(h.prototype,C),g&&L(h,g),h}function T(h,C){h.prototype=Object.create(C.prototype),h.prototype.constructor=h,u(h,C)}function u(h,C){return u=Object.setPrototypeOf||function(p,k){return p.__proto__=k,p},u(h,C)}var o=500,l=function(h){T(C,h);function C(p,k){var b;return b=h.call(this,p,k,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var k=this.hls;k.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(Y.Events.ERROR,this.onError,this),k.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var k=this.hls;k.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(Y.Events.ERROR,this.onError,this),k.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(k,b){this.mainDetails=b.details},g.onSubtitleFragProcessed=function(k,b){var f=b.frag,m=b.success;if(this.fragPrevious=f,this.state=y.State.IDLE,!m)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,x=f.start,v=0;v<d.length;v++)if(x>=d[v].start&&x<=d[v].end){a=d[v];break}var S=f.start+f.duration;a?a.end=S:(a={start:x,end:S},d.push(a)),this.fragmentTracker.fragBuffered(f)},g.onBufferFlushing=function(k,b){var f=b.startOffset,m=b.endOffset;if(f===0&&m!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var x=a[d].details,v=x.targetduration,S=m-v;if(S<=0)return;b.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(I){for(var G=0;G<I.length;){if(I[G].end<=S){I.shift();continue}else if(I[G].start<S)I[G].start=S;else break;G++}}),this.fragmentTracker.removeFragmentsInRange(f,S,A.PlaylistLevelType.SUBTITLE)}},g.onError=function(k,b){var f,m=b.frag;if(!m||m.type!==A.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},g.onSubtitleTracksUpdated=function(k,b){var f=this,m=b.subtitleTracks;this.tracksBuffered=[],this.levels=m.map(function(d){return new R.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(k,b){if(this.currentTrackId=b.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)},g.onSubtitleTrackLoaded=function(k,b){var f,m=b.details,d=b.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var v=x[a];if(d>=x.length||d!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,m.live||(f=v.details)!==null&&f!==void 0&&f.live){var S=this.mainDetails;if(m.deltaUpdateFailed||!S)return;var I=S.fragments[0];if(!v.details)m.hasProgramDateTime&&S.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(m,S):I&&Object(M.addSliding)(m,I.start);else{var G=this.alignPlaylists(m,v.details);G===0&&I&&Object(M.addSliding)(m,I.start)}}if(v.details=m,this.levelLastLoaded=d,this.tick(),m.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var V=Object(H.findFragmentByPTS)(null,m.fragments,this.media.currentTime,0);V||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(k){var b=k.frag,f=k.payload,m=b.decryptdata,d=this.hls;if(this.fragContextChanged(b))return;if(f&&f.byteLength>0&&m&&m.key&&m.iv&&m.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),m.key.buffer,m.iv.buffer).then(function(x){var v=performance.now();d.trigger(Y.Events.FRAG_DECRYPTED,{frag:b,payload:x,stats:{tstart:a,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var k,b=this.currentTrackId,f=this.levels;if(!f.length||!f[b]||!f[b].details)return;var m=f[b].details,d=m.targetduration,a=this.config,x=this.media,v=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-d,a.maxBufferHole),S=v.end,I=v.len,G=this.getMaxBufferLength()+d;if(I>G)return;console.assert(m,"Subtitle track details are defined on idle subtitle stream controller tick");var V=m.fragments,Q=V.length,z=m.edge,U,q=this.fragPrevious;if(S<z){var ae=a.maxFragLookUpTolerance;q&&m.hasProgramDateTime&&(U=Object(H.findFragmentByPDT)(V,q.endProgramDateTime,ae)),U||(U=Object(H.findFragmentByPTS)(q,V,S,ae),!U&&q&&q.start<V[0].start&&(U=V[0]))}else U=V[Q-1];(k=U)!==null&&k!==void 0&&k.encrypted?(N.logger.log("Loading key for "+U.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:U})):U&&this.fragmentTracker.getState(U)===O.FragmentState.NOT_LOADED&&this.loadFragment(U,m,S)}},g.loadFragment=function(k,b,f){this.fragCurrent=k,h.prototype.loadFragment.call(this,k,b,f)},w(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(y.default)},"./src/controller/subtitle-track-controller.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function W(L,w){for(var T=0;T<w.length;T++){var u=w[T];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function M(L,w,T){return w&&W(L.prototype,w),T&&W(L,T),L}function O(L,w){L.prototype=Object.create(w.prototype),L.prototype.constructor=L,y(L,w)}function y(L,w){return y=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},y(L,w)}var A=function(L){O(w,L);function w(u){var o;return o=L.call(this,u,"[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 T=w.prototype;return T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},T.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Y.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Y.Events.ERROR,this.onError,this)},T.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)},T.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},T.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=R(this.media.textTracks);o.forEach(function(l){Object(N.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},T.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},T.onSubtitleTrackLoaded=function(o,l){var h=l.id,C=l.details,g=this.trackId,p=this.tracksInGroup[g];if(!p){this.warn("Invalid subtitle track id "+h);return}var k=p.details;p.details=l.details,this.log("subtitle track "+h+" loaded ["+C.startSN+"-"+C.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,k))},T.onLevelLoading=function(o,l){this.switchLevel(l.level)},T.onLevelSwitching=function(o,l){this.switchLevel(l.level)},T.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(b){return!h||b.groupId===h});this.tracksInGroup=g;var p=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=h;var k={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,k),p!==-1&&this.setSubtitleTrack(p,C)}},T.findTrackId=function(o){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var C=l[h];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},T.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},T.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,C=l.groupId,g=l.url;if(o)try{g=o.addDirectives(g)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:g,id:h,groupId:C,deliveryDirectives:o||null})}},T.toggleTrackModes=function(o){var l=this,h=this.media,C=this.subtitleDisplay,g=this.trackId;if(!h)return;var p=R(h.textTracks),k=p.filter(function(m){return m.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(m){m.mode="disabled"});else{var b=k[g];b&&(b.mode="disabled")}var f=k[o];f&&(f.mode=C?"showing":"hidden")},T.setSubtitleTrack=function(o,l){var h,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(h=C[o])!==null&&h!==void 0&&h.details)||o<-1||o>=C.length)return;this.clearTimer();var g=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var p=g.id,k=g.groupId,b=k===void 0?"":k,f=g.name,m=g.type,d=g.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:f,type:m,url:d});var a=this.switchParams(g.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:o})},T.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=R(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")o=h;else if(l[h].mode==="showing"){o=h;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},M(w,[{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)}}]),w}(P.default);function R(L){for(var w=[],T=0;T<L.length;T++){var u=L[T];u.kind==="subtitles"&&u.label&&w.push(L[T])}return w}Z.default=A},"./src/controller/timeline-controller.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"TimelineController",function(){return R});var Y=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),H=D("./src/utils/output-filter.ts"),W=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),O=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),R=function(){function u(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=T(),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 h=new H.default(this,"textTrack1"),C=new H.default(this,"textTrack2"),g=new H.default(this,"textTrack3"),p=new H.default(this,"textTrack4");this.cea608Parser1=new P.default(1,h,C),this.cea608Parser2=new P.default(3,g,p)}l.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(N.Events.FRAG_LOADING,this.onFragLoading,this),l.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var h=this.hls;h.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(N.Events.FRAG_LOADING,this.onFragLoading,this),h.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(h,C,g,p,k){for(var b=!1,f=k.length;f--;){var m=k[f],d=w(m[0],m[1],C,g);if(d>=0&&(m[0]=Math.min(m[0],C),m[1]=Math.max(m[1],g),b=!0,d/(g-C)>.5))return}if(b||k.push([C,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[h];this.Cues.newCue(a,C,g,p)}else{var x=this.Cues.newCue(null,C,g,p);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:x,track:h})}},o.onInitPtsFound=function(h,C){var g=this,p=C.frag,k=C.id,b=C.initPTS,f=C.timescale,m=this.unparsedVttFrags;k==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=f),m.length&&(this.unparsedVttFrags=[],m.forEach(function(d){g.onFragLoaded(N.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(h){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var p=C.textTracks[g];if(p[h])return p}return null},o.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},o.createNativeTrack=function(h){if(this.captionsTracks[h])return;var C=this.captionsProperties,g=this.captionsTracks,p=this.media,k=C[h],b=k.label,f=k.languageCode,m=this.getExistingTrack(h);if(m)g[h]=m,Object(M.clearCurrentCues)(g[h]),Object(M.sendAddTrackEvent)(g[h],p);else{var d=this.createTextTrack("captions",b,f);d&&(d[h]=!0,g[h]=d)}},o.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var C=this.captionsProperties[h];if(!C)return;var g=C.label,p={_id:h,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[h]=p,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(h,C,g){var p=this.media;return p?p.addTextTrack(h,C,g):void 0},o.onMediaAttaching=function(h,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(C){Object(M.clearCurrentCues)(h[C]),delete h[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),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 h=this.media;if(!h)return;var C=h.textTracks;if(C)for(var g=0;g<C.length;g++)Object(M.clearCurrentCues)(C[g])},o.onSubtitleTracksUpdated=function(h,C){var g=this;this.textTracks=[];var p=C.subtitleTracks||[],k=p.some(function(d){return d.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var b=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var x;if(a<f.length){for(var v=null,S=0;S<f.length;S++)if(L(f[S],d)){v=f[S];break}v&&(x=v)}x?Object(M.clearCurrentCues)(x):(x=g.createTextTrack("subtitles",d.name,d.lang),x&&(x.mode="disabled")),x&&(x.groupId=d.groupId,g.textTracks.push(x))})}else if(!b&&this.tracks&&this.tracks.length){var m=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:m})}}},o.onManifestLoaded=function(h,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(p){var k=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!k)return;var b="textTrack"+k[1],f=g.captionsProperties[b];if(!f)return;f.label=p.name,p.lang&&(f.languageCode=p.lang),f.media=p})},o.onFragLoading=function(h,C){var g=this.cea608Parser1,p=this.cea608Parser2,k=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(g&&p))return;if(C.frag.type===y.PlaylistLevelType.MAIN){var f,m,d=C.frag.sn,a=(f=C==null||((m=C.part)===null||m===void 0)?void 0:m.index)!=null?f:-1;d===k+1||d===k&&a===b+1||(g.reset(),p.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(h,C){var g=C.frag,p=C.payload,k=this.initPTS,b=this.unparsedVttFrags;if(g.type===y.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Y.isFiniteNumber)(k[g.cc])){b.push(C),k.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var f=g.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var m=this.tracks[g.level],d=this.vttCCs;d[g.cc]||(d[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),m&&m.textCodec===O.IMSC1_CODEC?this._parseIMSC1(g,p):this._parseVTTs(g,p,d)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(h,C){var g=this,p=this.hls;Object(O.parseIMSC1)(C,this.initPTS[h.cc],this.timescale[h.cc],function(k){g._appendCues(k,h.level),p.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(k){A.logger.log("Failed to parse IMSC1: "+k),p.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:k})})},o._parseVTTs=function(h,C,g){var p=this,k=this.hls;Object(W.parseWebVTT)(C,this.initPTS[h.cc],this.timescale[h.cc],g,h.cc,h.start,function(b){p._appendCues(b,h.level),k.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(b){p._fallbackToIMSC1(h,C),A.logger.log("Failed to parse VTT cue: "+b),k.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:b})})},o._fallbackToIMSC1=function(h,C){var g=this,p=this.tracks[h.level];p.textCodec||Object(O.parseIMSC1)(C,this.initPTS[h.cc],this.timescale[h.cc],function(){p.textCodec=O.IMSC1_CODEC,g._parseIMSC1(h,C)},function(){p.textCodec="wvtt"})},o._appendCues=function(h,C){var g=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[C];if(p.mode==="disabled")return;h.forEach(function(f){return Object(M.addCueToTrack)(p,f)})}else{var k=this.tracks[C],b=k.default?"default":"subtitles"+C;g.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:h,track:b})}},o.onFragDecrypted=function(h,C){var g=C.frag;if(g.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(N.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(h,C){var g=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(g&&p))return;for(var k=0;k<C.samples.length;k++){var b=C.samples[k].bytes;if(b){var f=this.extractCea608Data(b);g.addData(C.samples[k].pts,f[0]),p.addData(C.samples[k].pts,f[1])}}},o.onBufferFlushing=function(h,C){var g=C.startOffset,p=C.endOffset,k=C.endOffsetSubtitles,b=C.type,f=this.media;if(!f||f.currentTime<p)return;if(!b||b==="video"){var m=this.captionsTracks;Object.keys(m).forEach(function(a){return Object(M.removeCuesInRange)(m[a],g,p)})}if(this.config.renderTextTracksNatively&&(g===0&&k!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(M.removeCuesInRange)(d[a],g,k)})}},o.extractCea608Data=function(h){for(var C=h[0]&31,g=2,p=[[],[]],k=0;k<C;k++){var b=h[g++],f=127&h[g++],m=127&h[g++],d=(4&b)!==0,a=3&b;if(f===0&&m===0)continue;d&&((a===0||a===1)&&(p[a].push(f),p[a].push(m)))}return p},u}();function L(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function w(u,o,l,h){return Math.min(o,h)-Math.max(u,l)}function T(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return Y});var Y=function(){function N(H,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=W}var P=N.prototype;return P.decrypt=function(W,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,W)},N}()},"./src/crypt/aes-decryptor.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"removePadding",function(){return N}),D.d(Z,"default",function(){return P});var Y=D("./src/utils/typed-array.ts");function N(H){var W=H.byteLength,M=W&&new DataView(H.buffer).getUint8(W-1);return M?Object(Y.sliceUint8)(H,0,W-M):H}var P=function(){function H(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var W=H.prototype;return W.uint8ArrayToUint32Array_=function(O){for(var y=new DataView(O),A=new Uint32Array(4),R=0;R<4;R++)A[R]=y.getUint32(R*4);return A},W.initTable=function(){var O=this.sBox,y=this.invSBox,A=this.subMix,R=A[0],L=A[1],w=A[2],T=A[3],u=this.invSubMix,o=u[0],l=u[1],h=u[2],C=u[3],g=new Uint32Array(256),p=0,k=0,b=0;for(b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(b=0;b<256;b++){var f=k^k<<1^k<<2^k<<3^k<<4;f=f>>>8^f&255^99,O[p]=f,y[f]=p;var m=g[p],d=g[m],a=g[d],x=g[f]*257^f*16843008;R[p]=x<<24|x>>>8,L[p]=x<<16|x>>>16,w[p]=x<<8|x>>>24,T[p]=x,x=a*16843009^d*65537^m*257^p*16843008,o[f]=x<<24|x>>>8,l[f]=x<<16|x>>>16,h[f]=x<<8|x>>>24,C[f]=x,p?(p=m^g[g[g[a^m]]],k^=g[g[k]]):p=k=1}},W.expandKey=function(O){for(var y=this.uint8ArrayToUint32Array_(O),A=!0,R=0;R<y.length&&A;)A=y[R]===this.key[R],R++;if(A)return;this.key=y;var L=this.keySize=y.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var w=this.ksRows=(L+6+1)*4,T,u,o=this.keySchedule=new Uint32Array(w),l=this.invKeySchedule=new Uint32Array(w),h=this.sBox,C=this.rcon,g=this.invSubMix,p=g[0],k=g[1],b=g[2],f=g[3],m,d;for(T=0;T<w;T++){if(T<L){m=o[T]=y[T];continue}d=m,T%L===0?(d=d<<8|d>>>24,d=h[d>>>24]<<24|h[d>>>16&255]<<16|h[d>>>8&255]<<8|h[d&255],d^=C[T/L|0]<<24):L>6&&T%L===4&&(d=h[d>>>24]<<24|h[d>>>16&255]<<16|h[d>>>8&255]<<8|h[d&255]),o[T]=m=(o[T-L]^d)>>>0}for(u=0;u<w;u++)T=w-u,u&3?d=o[T]:d=o[T-4],u<4||T<=4?l[u]=d:l[u]=p[h[d>>>24]]^k[h[d>>>16&255]]^b[h[d>>>8&255]]^f[h[d&255]],l[u]=l[u]>>>0},W.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},W.decrypt=function(O,y,A){for(var R=this.keySize+6,L=this.invKeySchedule,w=this.invSBox,T=this.invSubMix,u=T[0],o=T[1],l=T[2],h=T[3],C=this.uint8ArrayToUint32Array_(A),g=C[0],p=C[1],k=C[2],b=C[3],f=new Int32Array(O),m=new Int32Array(f.length),d,a,x,v,S,I,G,V,Q,z,U,q,ae,ce,ve=this.networkToHostOrderSwap;y<f.length;){for(Q=ve(f[y]),z=ve(f[y+1]),U=ve(f[y+2]),q=ve(f[y+3]),S=Q^L[0],I=q^L[1],G=U^L[2],V=z^L[3],ae=4,ce=1;ce<R;ce++)d=u[S>>>24]^o[I>>16&255]^l[G>>8&255]^h[V&255]^L[ae],a=u[I>>>24]^o[G>>16&255]^l[V>>8&255]^h[S&255]^L[ae+1],x=u[G>>>24]^o[V>>16&255]^l[S>>8&255]^h[I&255]^L[ae+2],v=u[V>>>24]^o[S>>16&255]^l[I>>8&255]^h[G&255]^L[ae+3],S=d,I=a,G=x,V=v,ae=ae+4;d=w[S>>>24]<<24^w[I>>16&255]<<16^w[G>>8&255]<<8^w[V&255]^L[ae],a=w[I>>>24]<<24^w[G>>16&255]<<16^w[V>>8&255]<<8^w[S&255]^L[ae+1],x=w[G>>>24]<<24^w[V>>16&255]<<16^w[S>>8&255]<<8^w[I&255]^L[ae+2],v=w[V>>>24]<<24^w[S>>16&255]<<16^w[I>>8&255]<<8^w[G&255]^L[ae+3],m[y]=ve(d^g),m[y+1]=ve(v^p),m[y+2]=ve(x^k),m[y+3]=ve(a^b),g=Q,p=z,k=U,b=q,y=y+4}return m.buffer},H}()},"./src/crypt/decrypter.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return y});var Y=D("./src/crypt/aes-crypto.ts"),N=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),H=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/typed-array.ts"),O=16,y=function(){function A(L,w,T){var u=T===void 0?{}:T,o=u.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=w,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=A.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var T=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(T):T},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(w,T,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),T,u);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),T,u).then(o)},R.softwareDecrypt=function(w,T,u){var o=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(w=Object(W.appendUint8Array)(h,w),this.remainderData=null);var C=this.getValidChunk(w);if(!C.length)return null;o&&(u=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(T);var p=l;return this.currentResult=g.decrypt(C.buffer,0,u),this.currentIV=Object(M.sliceUint8)(C,-16).buffer,p||null},R.webCryptoDecrypt=function(w,T,u){var o=this,l=this.subtle;return(this.key!==T||!this.fastAesKey)&&(this.key=T,this.fastAesKey=new N.default(l,T)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new Y.default(l,u);return C.decrypt(w.buffer,h)}).catch(function(h){return o.onWebCryptoError(h,w,T,u)})},R.onWebCryptoError=function(w,T,u,o){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(T,u,o)},R.getValidChunk=function(w){var T=w,u=w.length-w.length%O;return u!==w.length&&(T=Object(M.sliceUint8)(w,0,u),this.remainderData=Object(M.sliceUint8)(w,u)),T},R.logOnce=function(w){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return Y});var Y=function(){function N(H,W){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=W}var P=N.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/id3.ts");function W(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,M(y,A)}function M(y,A){return M=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},M(y,A)}var O=function(y){W(A,y);function A(L,w){var T;return T=y.call(this)||this,T.observer=void 0,T.config=void 0,T.observer=L,T.config=w,T}var R=A.prototype;return R.resetInitSegment=function(w,T,u){y.prototype.resetInitSegment.call(this,w,T,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var T=H.getID3Data(w,0)||[],u=T.length,o=w.length;u<o;u++)if(N.probe(w,u))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(w,T){return N.canParse(w,T)},R.appendFrame=function(w,T,u){N.initTrackConfig(w,this.observer,T,u,w.manifestCodec);var o=N.appendFrame(w,T,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Y.default);O.minProbeByteLength=9,Z.default=O},"./src/demux/adts.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"getAudioConfig",function(){return H}),D.d(Z,"isHeaderPattern",function(){return W}),D.d(Z,"getHeaderLength",function(){return M}),D.d(Z,"getFullFrameLength",function(){return O}),D.d(Z,"canGetFrameLength",function(){return y}),D.d(Z,"isHeader",function(){return A}),D.d(Z,"canParse",function(){return R}),D.d(Z,"probe",function(){return L}),D.d(Z,"initTrackConfig",function(){return w}),D.d(Z,"getFrameDuration",function(){return T}),D.d(Z,"parseFrameHeader",function(){return u}),D.d(Z,"appendFrame",function(){return o});var Y=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),P=D("./src/events.ts");function H(l,h,C,g){var p,k,b,f,m=navigator.userAgent.toLowerCase(),d=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((h[C+2]&192)>>>6)+1;var x=(h[C+2]&60)>>>2;if(x>a.length-1){l.trigger(P.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return b=(h[C+2]&1)<<2,b|=(h[C+3]&192)>>>6,Y.logger.log("manifest codec:"+g+", ADTS type:"+p+", samplingIndex:"+x),/firefox/i.test(m)?x>=6?(p=5,f=new Array(4),k=x-3):(p=2,f=new Array(2),k=x):m.indexOf("android")!==-1?(p=2,f=new Array(2),k=x):(p=5,f=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&x>=6?k=x-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(x>=6&&b===1||/vivaldi/i.test(m))||!g&&b===1)&&(p=2,f=new Array(2)),k=x)),f[0]=p<<3,f[0]|=(x&14)>>1,f[1]|=(x&1)<<7,f[1]|=b<<3,p===5&&(f[1]|=(k&14)>>1,f[2]=(k&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[x],channelCount:b,codec:"mp4a.40."+p,manifestCodec:d}}function W(l,h){return l[h]===255&&(l[h+1]&246)===240}function M(l,h){return l[h+1]&1?7:9}function O(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function y(l,h){return h+5<l.length}function A(l,h){return h+1<l.length&&W(l,h)}function R(l,h){return y(l,h)&&W(l,h)&&O(l,h)<=l.length-h}function L(l,h){if(A(l,h)){var C=M(l,h);if(h+C>=l.length)return!1;var g=O(l,h);if(g<=C)return!1;var p=h+g;return p===l.length||A(l,p)}return!1}function w(l,h,C,g,p){if(!l.samplerate){var k=H(h,C,g,p);if(!k)return;l.config=k.config,l.samplerate=k.samplerate,l.channelCount=k.channelCount,l.codec=k.codec,l.manifestCodec=k.manifestCodec,Y.logger.log("parsed codec:"+l.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function T(l){return 1024*9e4/l}function u(l,h,C,g,p){var k=M(l,h),b=O(l,h);if(b-=k,b>0){var f=C+g*p;return{headerLength:k,frameLength:b,stamp:f}}}function o(l,h,C,g,p){var k=T(l.samplerate),b=u(h,C,g,p,k);if(b){var f=b.frameLength,m=b.headerLength,d=b.stamp,a=m+f,x=Math.max(0,C+a-h.length),v;x?(v=new Uint8Array(a-m),v.set(h.subarray(C+m,h.length),0)):v=h.subarray(C+m,C+a);var S={unit:v,pts:d};return x||l.samples.push(S),{sample:S,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"initPTSFn",function(){return O});var Y=D("./src/polyfills/number.ts"),N=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),H=D("./src/utils/mp4-tools.ts"),W=D("./src/utils/typed-array.ts"),M=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=y.prototype;return A.resetInitSegment=function(L,w,T){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(L,w){return!1},A.appendFrame=function(L,w,T){},A.demux=function(L,w){this.cachedData&&(L=Object(H.appendUint8Array)(this.cachedData,L),this.cachedData=null);var T=N.getID3Data(L,0),u=T?T.length:0,o,l,h=this._audioTrack,C=this._id3Track,g=T?N.getTimeStamp(T):void 0,p=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(g,w)),T&&T.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:T}),l=this.initPTS;u<p;){if(this.canParse(L,u)){var k=this.appendFrame(h,L,u);k?(this.frameIndex++,l=k.sample.pts,u+=k.length,o=u):u=p}else N.canParse(L,u)?(T=N.getID3Data(L,u),C.samples.push({pts:l,dts:l,data:T}),u+=T.length,o=u):u++;if(u===p&&o!==p){var b=Object(W.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:h,avcTrack:Object(P.dummyTrack)(),id3Track:C,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(L,w,T){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(L){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},y}(),O=function(A,R){return Object(Y.isFiniteNumber)(A)?A*90:R*9e4};Z.default=M},"./src/demux/chunk-cache.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return Y});var Y=function(){function P(){this.chunks=[],this.dataLength=0}var H=P.prototype;return H.push=function(M){this.chunks.push(M),this.dataLength+=M.length},H.flush=function(){var M=this.chunks,O=this.dataLength,y;if(M.length)M.length===1?y=M[0]:y=N(M,O);else return new Uint8Array(0);return this.reset(),y},H.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function N(P,H){for(var W=new Uint8Array(H),M=0,O=0;O<P.length;O++){var y=P[O];W.set(y,M),M+=y.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/utils/logger.ts"),N=function(){function P(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var H=P.prototype;return H.loadWord=function(){var M=this.data,O=this.bytesAvailable,y=M.byteLength-O,A=new Uint8Array(4),R=Math.min(4,O);if(R===0)throw new Error("no bytes available");A.set(M.subarray(y,y+R)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},H.skipBits=function(M){var O;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,O=M>>3,M-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},H.readBits=function(M){var O=Math.min(this.bitsAvailable,M),y=this.word>>>32-O;return M>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=M-O,O>0&&this.bitsAvailable?y<<O|this.readBits(O):y},H.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},H.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(M){for(var O=8,y=8,A,R=0;R<M;R++)y!==0&&(A=this.readEG(),y=(O+A+256)%256),O=y===0?O:y},H.readSPS=function(){var M=0,O=0,y=0,A=0,R,L,w,T=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);T();var k=T();if(u(5),h(3),T(),g(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var b=o();if(b===3&&h(1),g(),g(),h(1),l())for(L=b!==3?8:12,w=0;w<L;w++)l()&&(w<6?p(16):p(64))}g();var f=o();if(f===0)o();else if(f===1)for(h(1),C(),C(),R=o(),w=0;w<R;w++)C();g(),h(1);var m=o(),d=o(),a=u(1);a===0&&h(1),h(1),l()&&(M=o(),O=o(),y=o(),A=o());var x=[1,1];if(l()&&l()){var v=T();switch(v){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[T()<<8|T(),T()<<8|T()];break}}}return{width:Math.ceil((m+1)*16-M*2-O*2),height:(2-a)*(d+1)*16-(a?2:4)*(y+A),pixelRatio:x}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();Z.default=N},"./src/demux/id3.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"isHeader",function(){return Y}),D.d(Z,"isFooter",function(){return N}),D.d(Z,"getID3Data",function(){return P}),D.d(Z,"canParse",function(){return W}),D.d(Z,"getTimeStamp",function(){return M}),D.d(Z,"isTimeStampFrame",function(){return O}),D.d(Z,"getID3Frames",function(){return A}),D.d(Z,"decodeFrame",function(){return R}),D.d(Z,"utf8ArrayToStr",function(){return o}),D.d(Z,"testables",function(){return l});var Y=function(p,k){return k+10<=p.length&&(p[k]===73&&p[k+1]===68&&p[k+2]===51&&(p[k+3]<255&&p[k+4]<255&&(p[k+6]<128&&p[k+7]<128&&p[k+8]<128&&p[k+9]<128)))},N=function(p,k){return k+10<=p.length&&(p[k]===51&&p[k+1]===68&&p[k+2]===73&&(p[k+3]<255&&p[k+4]<255&&(p[k+6]<128&&p[k+7]<128&&p[k+8]<128&&p[k+9]<128)))},P=function(p,k){for(var b=k,f=0;Y(p,k);){f+=10;var m=H(p,k+6);f+=m,N(p,k+10)&&(f+=10),k+=f}return f>0?p.subarray(b,b+f):void 0},H=function(p,k){var b=0;return b=(p[k]&127)<<21,b|=(p[k+1]&127)<<14,b|=(p[k+2]&127)<<7,b|=p[k+3]&127,b},W=function(p,k){return Y(p,k)&&H(p,k+6)+10<=p.length-k},M=function(p){for(var k=A(p),b=0;b<k.length;b++){var f=k[b];if(O(f))return u(f)}return},O=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},y=function(p){var k=String.fromCharCode(p[0],p[1],p[2],p[3]),b=H(p,4),f=10;return{type:k,size:b,data:p.subarray(f,f+b)}},A=function(p){for(var k=0,b=[];Y(p,k);){var f=H(p,k+6);k+=10;for(var m=k+f;k+8<m;){var d=y(p.subarray(k)),a=R(d);a&&b.push(a),k+=d.size+10}N(p,k)&&(k+=10)}return b},R=function(p){return p.type==="PRIV"?L(p):p.type[0]==="W"?T(p):w(p)},L=function(p){if(p.size<2)return;var k=o(p.data,!0),b=new Uint8Array(p.data.subarray(k.length+1));return{key:p.type,info:k,data:b.buffer}},w=function(p){if(p.size<2)return;if(p.type==="TXXX"){var k=1,b=o(p.data.subarray(k),!0);k+=b.length+1;var f=o(p.data.subarray(k));return{key:p.type,info:b,data:f}}var m=o(p.data.subarray(1));return{key:p.type,data:m}},T=function(p){if(p.type==="WXXX"){if(p.size<2)return;var k=1,b=o(p.data.subarray(k),!0);k+=b.length+1;var f=o(p.data.subarray(k));return{key:p.type,info:b,data:f}}var m=o(p.data);return{key:p.type,data:m}},u=function(p){if(p.data.byteLength===8){var k=new Uint8Array(p.data),b=k[3]&1,f=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return f/=45,b&&(f+=4772185884e-2),Math.round(f)}return},o=function(p,k){k===void 0&&(k=!1);var b=C();if(b){var f=b.decode(p);if(k){var m=f.indexOf("\0");return m!==-1?f.substring(0,m):f}return f.replace(/\0/g,"")}for(var d=p.length,a,x,v,S="",I=0;I<d;){if(a=p[I++],a===0&&k)return S;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:S+=String.fromCharCode(a);break;case 12:case 13:x=p[I++],S+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=p[I++],v=p[I++],S+=String.fromCharCode((a&15)<<12|(x&63)<<6|(v&63)<<0);break;default:}}return S},l={decodeTextFrame:w},h;function C(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/mpegaudio.ts");function W(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,M(y,A)}function M(y,A){return M=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},M(y,A)}var O=function(y){W(A,y);function A(){return y.apply(this,arguments)||this}var R=A.prototype;return R.resetInitSegment=function(w,T,u){y.prototype.resetInitSegment.call(this,w,T,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var T=N.getID3Data(w,0)||[],u=T.length,o=w.length;u<o;u++)if(H.probe(w,u))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(w,T){return H.canParse(w,T)},R.appendFrame=function(w,T,u){return this.initPTS===null?void 0:H.appendFrame(w,T,u,this.initPTS,this.frameIndex)},A}(Y.default);O.minProbeByteLength=4,Z.default=O},"./src/demux/mp4demuxer.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/utils/mp4-tools.ts"),N=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function H(M,O){this.remainderData=null,this.config=void 0,this.config=O}var W=H.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},H.probe=function(O){return Object(Y.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},W.demux=function(O){var y=O,A=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Y.appendUint8Array)(this.remainderData,O));var R=Object(Y.segmentValidRange)(y);this.remainderData=R.remainder,A.samples=R.valid||new Uint8Array}else A.samples=y;return{audioTrack:Object(N.dummyTrack)(),avcTrack:A,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},W.flush=function(){var O=Object(N.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:O,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},W.demuxSampleAes=function(O,y,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},H}();P.minProbeByteLength=1024,Z.default=P},"./src/demux/mpegaudio.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"appendFrame",function(){return M}),D.d(Z,"parseHeader",function(){return O}),D.d(Z,"isHeaderPattern",function(){return y}),D.d(Z,"isHeader",function(){return A}),D.d(Z,"canParse",function(){return R}),D.d(Z,"probe",function(){return L});var Y=null,N=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],W=[0,1,1,4];function M(w,T,u,o,l){if(u+24>T.length)return;var h=O(T,u);if(h&&u+h.frameLength<=T.length){var C=h.samplesPerFrame*9e4/h.sampleRate,g=o+l*C,p={unit:T.subarray(u,u+h.frameLength),pts:g,dts:g};return w.config=[],w.channelCount=h.channelCount,w.samplerate=h.sampleRate,w.samples.push(p),{sample:p,length:h.frameLength,missing:0}}}function O(w,T){var u=w[T+1]>>3&3,o=w[T+1]>>1&3,l=w[T+2]>>4&15,h=w[T+2]>>2&3;if(u!==1&&l!==0&&l!==15&&h!==3){var C=w[T+2]>>1&1,g=w[T+3]>>6,p=u===3?3-o:o===3?3:4,k=N[p*14+l-1]*1e3,b=u===3?0:u===2?1:2,f=P[b*3+h],m=g===3?1:2,d=H[u][o],a=W[o],x=d*8*a,v=Math.floor(d*k/f+C)*a;if(Y===null){var S=navigator.userAgent||"",I=S.match(/Chrome\/(\d+)/i);Y=I?parseInt(I[1]):0}var G=!!Y&&Y<=87;return G&&o===2&&k>=224e3&&g===0&&(w[T+3]=w[T+3]|128),{sampleRate:f,channelCount:m,frameLength:v,samplesPerFrame:x}}}function y(w,T){return w[T]===255&&(w[T+1]&224)===224&&(w[T+1]&6)!==0}function A(w,T){return T+1<w.length&&y(w,T)}function R(w,T){var u=4;return y(w,T)&&u<=w.length-T}function L(w,T){if(T+1<w.length&&y(w,T)){var u=4,o=O(w,T),l=u;o!=null&&o.frameLength&&(l=o.frameLength);var h=T+l;return h===w.length||A(w,h)}return!1}},"./src/demux/sample-aes.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/crypt/decrypter.ts"),N=D("./src/demux/tsdemuxer.ts"),P=function(){function H(M,O,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Y.default(M,O,{removePKCS7Padding:!1})}var W=H.prototype;return W.decryptBuffer=function(O,y){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,y)},W.decryptAacSample=function(O,y,A,R){var L=O[y].unit,w=L.subarray(16,L.length-L.length%16),T=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),u=this;this.decryptBuffer(T,function(o){var l=new Uint8Array(o);L.set(l,16),R||u.decryptAacSamples(O,y+1,A)})},W.decryptAacSamples=function(O,y,A){for(;;y++){if(y>=O.length){A();return}if(O[y].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(O,y,A,R),!R)return}},W.getAvcEncryptedData=function(O){for(var y=Math.floor((O.length-48)/160)*16+16,A=new Int8Array(y),R=0,L=32;L<=O.length-16;L+=160,R+=16)A.set(O.subarray(L,L+16),R);return A},W.getAvcDecryptedUnit=function(O,y){for(var A=new Uint8Array(y),R=0,L=32;L<=O.length-16;L+=160,R+=16)O.set(A.subarray(R,R+16),L);return O},W.decryptAvcSample=function(O,y,A,R,L,w){var T=Object(N.discardEPB)(L.data),u=this.getAvcEncryptedData(T),o=this;this.decryptBuffer(u.buffer,function(l){L.data=o.getAvcDecryptedUnit(T,l),w||o.decryptAvcSamples(O,y,A+1,R)})},W.decryptAvcSamples=function(O,y,A,R){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,A=0){if(y>=O.length){R();return}for(var L=O[y].units;!(A>=L.length);A++){var w=L[A];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var T=this.decrypter.isSync();if(this.decryptAvcSample(O,y,A,R,w,T),!T)return}}},H}();Z.default=P},"./src/demux/transmuxer-interface.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return L});var Y=D("./node_modules/webworkify-webpack/index.js"),N=D.n(Y),P=D("./src/events.ts"),H=D("./src/demux/transmuxer.ts"),W=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),O=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),A=D.n(y),R=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function w(u,o,l,h){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=l,this.onFlush=h;var g=u.config,p=function(d,a){a=a||{},a.frag=C.frag,a.id=C.id,u.trigger(d,a)};this.observer=new y.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,p),this.observer.on(P.Events.ERROR,p);var k={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var f;try{f=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(m){u.trigger(P.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(m.message+" ("+m.filename+":"+m.lineno+")")})},f.postMessage({cmd:"init",typeSupported:k,vendor:b,id:o,config:JSON.stringify(g)})}catch(m){W.logger.warn("Error in worker:",m),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new H.default(this.observer,k,g,b,o),this.worker=null}}else this.transmuxer=new H.default(this.observer,k,g,b,o)}var T=w.prototype;return T.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 h=this.observer;h&&h.removeAllListeners(),this.observer=null},T.push=function(o,l,h,C,g,p,k,b,f,m){var d=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,v=p?p.start:g.start,S=g.decryptdata,I=this.frag,G=!(I&&g.cc===I.cc),V=!(I&&f.level===I.level),Q=I?f.sn-I.sn:-1,z=this.part?f.part-this.part.index:1,U=!V&&(Q===1||Q===0&&z===1),q=self.performance.now();(V||Q||g.stats.parsing.start===0)&&(g.stats.parsing.start=q),p&&(z||!U)&&(p.stats.parsing.start=q);var ae=new H.TransmuxState(G,U,b,V,v);if(!U||G){W.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+G+`
|
|
trackSwitch: `+V+`
|
|
contiguous: `+U+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+v);var ce=new H.TransmuxConfig(h,C,l,k,m);this.configureTransmuxer(ce)}if(this.frag=g,this.part=p,x)x.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:f,state:ae},o instanceof ArrayBuffer?[o]:[]);else if(a){var ve=a.push(o,S,f,ae);Object(H.isPromise)(ve)?ve.then(function(Oe){d.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(ve)}},T.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var h=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(h){var g=h.flush(o);Object(H.isPromise)(g)?g.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(g,o)}},T.handleFlushResult=function(o,l){var h=this;o.forEach(function(C){h.handleTransmuxComplete(C)}),this.onFlush(l)},T.onWorkerMessage=function(o){var l=o.data,h=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,h.trigger(l.event,l.data);break}}},T.configureTransmuxer=function(o){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):h&&h.configure(o)},T.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return M});var Y=D("./src/demux/transmuxer.ts"),N=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./node_modules/eventemitter3/index.js"),W=D.n(H);function M(L){var w=new H.EventEmitter,T=function(o,l){L.postMessage({event:o,data:l})};w.on(N.Events.FRAG_DECRYPTED,T),w.on(N.Events.ERROR,T),L.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new Y.default(w,o.typeSupported,l,o.vendor,o.id),Object(P.enableLogs)(l.debug),T("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var h=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Y.isPromise)(h)?h.then(function(p){O(L,p)}):O(L,h);break}case"flush":{var C=o.chunkMeta,g=L.transmuxer.flush(C);Object(Y.isPromise)(g)?g.then(function(p){A(L,p,C)}):A(L,g,C);break}default:break}})}function O(L,w){if(R(w.remuxResult))return;var T=[],u=w.remuxResult,o=u.audio,l=u.video;o&&y(T,o),l&&y(T,l),L.postMessage({event:"transmuxComplete",data:w},T)}function y(L,w){w.data1&&L.push(w.data1.buffer),w.data2&&L.push(w.data2.buffer)}function A(L,w,T){w.forEach(function(u){O(L,u)}),L.postMessage({event:"flush",data:T})}function R(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return l}),D.d(Z,"isPromise",function(){return g}),D.d(Z,"TransmuxConfig",function(){return p}),D.d(Z,"TransmuxState",function(){return k});var Y=D("./src/events.ts"),N=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),H=D("./src/demux/aacdemuxer.ts"),W=D("./src/demux/mp4demuxer.ts"),M=D("./src/demux/tsdemuxer.ts"),O=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),R=D("./src/demux/chunk-cache.ts"),L=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/logger.ts"),T;try{T=self.performance.now.bind(self.performance)}catch(b){w.logger.debug("Unable to use Performance API on this environment"),T=self.Date.now}var u=[{demux:M.default,remux:y.default},{demux:W.default,remux:A.default},{demux:H.default,remux:y.default},{demux:O.default,remux:y.default}],o=1024;u.forEach(function(b){var f=b.demux;o=Math.max(o,f.minProbeByteLength)});var l=function(){function b(m,d,a,x,v){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=m,this.typeSupported=d,this.config=a,this.vendor=x,this.id=v}var f=b.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,a,x,v){var S=this,I=x.transmuxing;I.executeStart=T();var G=new Uint8Array(d),V=this.cache,Q=this.config,z=this.currentTransmuxState,U=this.transmuxConfig;v&&(this.currentTransmuxState=v);var q=h(G,a);if(q&&q.method==="AES-128"){var ae=this.getDecrypter();if(Q.enableSoftwareAES){var ce=ae.softwareDecrypt(G,q.key.buffer,q.iv.buffer);if(!ce)return I.executeEnd=T(),C(x);G=new Uint8Array(ce)}else return this.decryptionPromise=ae.webCryptoDecrypt(G,q.key.buffer,q.iv.buffer).then(function(Ne){var We=S.push(Ne,null,x);return S.decryptionPromise=null,We}),this.decryptionPromise}var ve=v||z,Oe=ve.contiguous,xe=ve.discontinuity,Te=ve.trackSwitch,Ce=ve.accurateTimeOffset,Se=ve.timeOffset,pe=U.audioCodec,oe=U.videoCodec,De=U.defaultInitPts,Ye=U.duration,Ge=U.initSegmentData;if((xe||Te)&&this.resetInitSegment(Ge,pe,oe,Ye),xe&&this.resetInitialTimestamp(De),Oe||this.resetContiguity(),this.needsProbing(G,xe,Te)){if(V.dataLength){var tt=V.flush();G=Object(L.appendUint8Array)(tt,G)}this.configureTransmuxer(G,U)}var qe=this.transmux(G,q,Se,Ce,x),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,I.executeEnd=T(),qe},f.flush=function(d){var a=this,x=d.transmuxing;x.executeStart=T();var v=this.decrypter,S=this.cache,I=this.currentTransmuxState,G=this.decryptionPromise;if(G)return G.then(function(){return a.flush(d)});var V=[],Q=I.timeOffset;if(v){var z=v.flush();z&&V.push(this.push(z,null,d))}var U=S.dataLength;S.reset();var q=this.demuxer,ae=this.remuxer;if(!q||!ae)return U>=o&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=T(),[C(d)];var ce=q.flush(Q);return g(ce)?ce.then(function(ve){return a.flushRemux(V,ve,d),V}):(this.flushRemux(V,ce,d),V)},f.flushRemux=function(d,a,x){var v=a.audioTrack,S=a.avcTrack,I=a.id3Track,G=a.textTrack,V=this.currentTransmuxState,Q=V.accurateTimeOffset,z=V.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var U=this.remuxer.remux(v,S,I,G,z,Q,!0,this.id);d.push({remuxResult:U,chunkMeta:x}),x.transmuxing.executeEnd=T()},f.resetInitialTimestamp=function(d){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(d),x.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,x,v){var S=this.demuxer,I=this.remuxer;if(!S||!I)return;S.resetInitSegment(a,x,v),I.resetInitSegment(d,a,x)},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,x,v,S){var I;return a&&a.method==="SAMPLE-AES"?I=this.transmuxSampleAes(d,a,x,v,S):I=this.transmuxUnencrypted(d,x,v,S),I},f.transmuxUnencrypted=function(d,a,x,v){var S=this.demuxer.demux(d,a,!1,!this.config.progressive),I=S.audioTrack,G=S.avcTrack,V=S.id3Track,Q=S.textTrack,z=this.remuxer.remux(I,G,V,Q,a,x,!1,this.id);return{remuxResult:z,chunkMeta:v}},f.transmuxSampleAes=function(d,a,x,v,S){var I=this;return this.demuxer.demuxSampleAes(d,a,x).then(function(G){var V=I.remuxer.remux(G.audioTrack,G.avcTrack,G.id3Track,G.textTrack,x,v,!1,I.id);return{remuxResult:V,chunkMeta:S}})},f.configureTransmuxer=function(d,a){for(var x=this.config,v=this.observer,S=this.typeSupported,I=this.vendor,G=a.audioCodec,V=a.defaultInitPts,Q=a.duration,z=a.initSegmentData,U=a.videoCodec,q,ae=0,ce=u.length;ae<ce;ae++)if(u[ae].demux.probe(d)){q=u[ae];break}q||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),q={demux:W.default,remux:A.default});var ve=this.demuxer,Oe=this.remuxer,xe=q.remux,Te=q.demux;(!Oe||!(Oe instanceof xe))&&(this.remuxer=new xe(v,x,S,I)),(!ve||!(ve instanceof Te))&&(this.demuxer=new Te(v,x,S),this.probe=Te.probe),this.resetInitSegment(z,G,U,Q),this.resetInitialTimestamp(V)},f.needsProbing=function(d,a,x){return!this.demuxer||!this.remuxer||a||x},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new P.default(this.observer,this.config)),d},b}();function h(b,f){var m=null;return b.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(m=f),m}var C=function(f){return{remuxResult:{},chunkMeta:f}};function g(b){return"then"in b&&b.then instanceof Function}var p=function(f,m,d,a,x){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=m,this.initSegmentData=d,this.duration=a,this.defaultInitPts=x},k=function(f,m,d,a,x){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=m,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"discardEPB",function(){return C});var Y=D("./src/demux/adts.ts"),N=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),H=D("./src/demux/id3.ts"),W=D("./src/demux/sample-aes.ts"),M=D("./src/events.ts"),O=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},L=function(){function g(k,b,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=b,this.typeSupported=f}g.probe=function(b){var f=g.syncOffset(b);return f<0?!1:(f&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},g.syncOffset=function(b){for(var f=Math.min(1e3,b.length-3*188),m=0;m<f;){if(b[m]===71&&b[m+188]===71&&b[m+2*188]===71)return m;m++}return-1},g.createTrack=function(b,f){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?f:void 0}};var p=g.prototype;return p.resetInitSegment=function(b,f,m){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",m),this._audioTrack=g.createTrack("audio",m),this._id3Track=g.createTrack("id3",m),this._txtTrack=g.createTrack("text",m),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=f,this._duration=m},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,f=this._avcTrack,m=this._id3Track;b&&(b.pesData=null),f&&(f.pesData=null),m&&(m.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,f,m,d){m===void 0&&(m=!1),d===void 0&&(d=!1),m||(this.sampleAes=null);var a,x=this._avcTrack,v=this._audioTrack,S=this._id3Track,I=x.pid,G=x.pesData,V=v.pid,Q=S.pid,z=v.pesData,U=S.pesData,q=!1,ae=this.pmtParsed,ce=this._pmtId,ve=b.length;if(this.remainderData&&(b=Object(O.appendUint8Array)(this.remainderData,b),ve=b.length,this.remainderData=null),ve<188&&!d)return this.remainderData=b,{audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};var Oe=Math.max(0,g.syncOffset(b));ve-=(ve+Oe)%188,ve<b.byteLength&&!d&&(this.remainderData=new Uint8Array(b.buffer,ve,b.buffer.byteLength-ve));for(var xe=Oe;xe<ve;xe+=188)if(b[xe]===71){var Te=!!(b[xe+1]&64),Ce=((b[xe+1]&31)<<8)+b[xe+2],Se=(b[xe+3]&48)>>4,pe=void 0;if(Se>1){if(pe=xe+5+b[xe+4],pe===xe+188)continue}else pe=xe+4;switch(Ce){case I:Te&&(G&&(a=o(G))&&this.parseAVCPES(a,!1),G={data:[],size:0}),G&&(G.data.push(b.subarray(pe,xe+188)),G.size+=xe+188-pe);break;case V:Te&&(z&&(a=o(z))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),z={data:[],size:0}),z&&(z.data.push(b.subarray(pe,xe+188)),z.size+=xe+188-pe);break;case Q:Te&&(U&&(a=o(U))&&this.parseID3PES(a),U={data:[],size:0}),U&&(U.data.push(b.subarray(pe,xe+188)),U.size+=xe+188-pe);break;case 0:Te&&(pe+=b[pe]+1),ce=this._pmtId=T(b,pe);break;case ce:{Te&&(pe+=b[pe]+1);var oe=u(b,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,m);I=oe.avc,I>0&&(x.pid=I),V=oe.audio,V>0&&(v.pid=V,v.isAAC=oe.isAAC),Q=oe.id3,Q>0&&(S.pid=Q),q&&!ae&&(y.logger.log("reparse from beginning"),q=!1,xe=Oe-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:q=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=G,v.pesData=z,S.pesData=U;var De={audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(De),De},p.flush=function(){var b=this.remainderData;this.remainderData=null;var f;return b?f=this.demux(b,-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},p.extractRemainingSamples=function(b){var f=b.audioTrack,m=b.avcTrack,d=b.id3Track,a=m.pesData,x=f.pesData,v=d.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),m.pesData=null):m.pesData=a,x&&(S=o(x))?(f.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),f.pesData=null):(x!=null&&x.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=x),v&&(S=o(v))?(this.parseID3PES(S),d.pesData=null):d.pesData=v},p.demuxSampleAes=function(b,f,m){var d=this.demux(b,m,!0,!this.config.progressive),a=this.sampleAes=new W.default(this.observer,this.config,f);return this.decrypt(d,a)},p.decrypt=function(b,f){return new Promise(function(m){var d=b.audioTrack,a=b.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){m(b)}):m(b)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){m(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,f){var m=this,d=this._avcTrack,a=this.parseAVCNALu(b.data),x=!1,v=this.avcSample,S,I=!1;b.data=null,v&&a.length&&!d.audFound&&(l(v,d),v=this.avcSample=w(!1,b.pts,b.dts,"")),a.forEach(function(G){switch(G.type){case 1:{S=!0,v||(v=m.avcSample=w(!0,b.pts,b.dts,"")),x&&(v.debug+="NDR "),v.frame=!0;var V=G.data;if(I&&V.length>4){var Q=new P.default(V).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=m.avcSample=w(!0,b.pts,b.dts,"")),x&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,x&&v&&(v.debug+="SEI ");var z=new P.default(C(G.data));z.readUByte();for(var U=0,q=0,ae=!1,ce=0;!ae&&z.bytesAvailable>1;){U=0;do ce=z.readUByte(),U+=ce;while(ce===255);q=0;do ce=z.readUByte(),q+=ce;while(ce===255);if(U===4&&z.bytesAvailable!==0){ae=!0;var ve=z.readUByte();if(ve===181){var Oe=z.readUShort();if(Oe===49){var xe=z.readUInt();if(xe===1195456820){var Te=z.readUByte();if(Te===3){for(var Ce=z.readUByte(),Se=z.readUByte(),pe=31&Ce,oe=[Ce,Se],De=0;De<pe;De++)oe.push(z.readUByte()),oe.push(z.readUByte()),oe.push(z.readUByte());h(m._txtTrack.samples,{type:3,pts:b.pts,bytes:oe})}}}}}else if(U===5&&z.bytesAvailable!==0){if(ae=!0,q>16){for(var Ye=[],Ge=0;Ge<16;Ge++)Ye.push(z.readUByte().toString(16)),(Ge===3||Ge===5||Ge===7||Ge===9)&&Ye.push("-");for(var tt=q-16,qe=new Uint8Array(tt),Ae=0;Ae<tt;Ae++)qe[Ae]=z.readUByte();h(m._txtTrack.samples,{pts:b.pts,payloadType:U,uuid:Ye.join(""),userData:Object(H.utf8ArrayToStr)(qe),userDataBytes:qe})}}else if(q<z.bytesAvailable)for(var Ne=0;Ne<q;Ne++)z.readUByte()}break}case 7:if(S=!0,I=!0,x&&v&&(v.debug+="SPS "),!d.sps){var We=new P.default(G.data),ze=We.readSPS();d.width=ze.width,d.height=ze.height,d.pixelRatio=ze.pixelRatio,d.sps=[G.data],d.duration=m._duration;for(var je=G.data.subarray(1,4),_e="avc1.",Pe=0;Pe<3;Pe++){var Ke=je[Pe].toString(16);Ke.length<2&&(Ke="0"+Ke),_e+=Ke}d.codec=_e}break;case 8:S=!0,x&&v&&(v.debug+="PPS "),d.pps||(d.pps=[G.data]);break;case 9:S=!1,d.audFound=!0,v&&l(v,d),v=m.avcSample=w(!1,b.pts,b.dts,x?"AUD ":"");break;case 12:S=!1;break;default:S=!1,v&&(v.debug+="unknown NAL "+G.type+" ");break}if(v&&S){var $e=v.units;$e.push(G)}}),f&&v&&(l(v,d),this.avcSample=null)},p.getLastNalUnit=function(){var b,f=this.avcSample,m;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((b=f)!==null&&b!==void 0&&b.units){var a=f.units;m=a[a.length-1]}return m},p.parseAVCNALu=function(b){var f=b.byteLength,m=this._avcTrack,d=m.naluState||0,a=d,x=[],v=0,S,I,G,V=-1,Q=0;for(d===-1&&(V=0,Q=b[0]&31,d=0,v=1);v<f;){if(S=b[v++],!d){d=S?0:1;continue}if(d===1){d=S?0:2;continue}if(!S)d=3;else if(S===1){if(V>=0){var z={data:b.subarray(V,v-d-1),type:Q};x.push(z)}else{var U=this.getLastNalUnit();if(U&&(a&&v<=4-a&&(U.state&&(U.data=U.data.subarray(0,U.data.byteLength-a))),I=v-d-1,I>0)){var q=new Uint8Array(U.data.byteLength+I);q.set(U.data,0),q.set(b.subarray(0,I),U.data.byteLength),U.data=q,U.state=0}}v<f?(G=b[v]&31,V=v,Q=G,d=0):d=-1}else d=0}if(V>=0&&d>=0){var ae={data:b.subarray(V,f),type:Q,state:d};x.push(ae)}if(x.length===0){var ce=this.getLastNalUnit();if(ce){var ve=new Uint8Array(ce.data.byteLength+b.byteLength);ve.set(ce.data,0),ve.set(b,ce.data.byteLength),ce.data=ve}}return m.naluState=d,x},p.parseAACPES=function(b){var f=0,m=this._audioTrack,d=this.aacOverFlow,a=b.data;if(d){this.aacOverFlow=null;var x=d.sample.unit.byteLength,v=Math.min(d.missing,x),S=x-v;d.sample.unit.set(a.subarray(0,v),S),m.samples.push(d.sample),f=d.missing}var I,G;for(I=f,G=a.length;I<G-1&&!Y.isHeader(a,I);I++);if(I!==f){var V,Q;if(I<G-1?(V="AAC PES did not start with ADTS header,offset:"+I,Q=!1):(V="no ADTS header found in AAC PES",Q=!0),y.logger.warn("parsing error:"+V),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:Q,reason:V}),Q)return}Y.initTrackConfig(m,this.observer,a,I,this.audioCodec);var z;if(b.pts!==void 0)z=b.pts;else if(d){var U=Y.getFrameDuration(m.samplerate);z=d.sample.pts+U}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var q=0;I<G;)if(Y.isHeader(a,I)){if(I+5<G){var ae=Y.appendFrame(m,a,I,z,q);if(ae)if(ae.missing)this.aacOverFlow=ae;else{I+=ae.length,q++;continue}}break}else I++},p.parseMPEGPES=function(b){var f=b.data,m=f.length,d=0,a=0,x=b.pts;if(x===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<m;)if(N.isHeader(f,a)){var v=N.appendFrame(this._audioTrack,f,a,x,d);if(v)a+=v.length,d++;else break}else a++},p.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},g}();L.minProbeByteLength=188;function w(g,p,k,b){return{key:g,frame:!1,pts:p,dts:k,units:[],debug:b,length:0}}function T(g,p){return(g[p+10]&31)<<8|g[p+11]}function u(g,p,k,b){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},m=(g[p+1]&15)<<8|g[p+2],d=p+3+m-4,a=(g[p+10]&15)<<8|g[p+11];for(p+=12+a;p<d;){var x=(g[p+1]&31)<<8|g[p+2];switch(g[p]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=x);break;case 21:f.id3===-1&&(f.id3=x);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=x);break;case 3:case 4:k?f.audio===-1&&(f.audio=x,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}p+=((g[p+3]&15)<<8|g[p+4])+5}return f}function o(g){var p=0,k,b,f,m,d,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}k=a[0];var v=(k[0]<<16)+(k[1]<<8)+k[2];if(v===1){if(b=(k[4]<<8)+k[5],b&&b>g.size-6)return null;var S=k[7];S&192&&(m=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,S&64?(d=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,m-d>60*9e4&&(y.logger.warn(Math.round((m-d)/9e4)+"s delta between PTS and DTS, align them"),m=d)):d=m),f=k[8];var I=f+9;if(g.size<=I)return null;g.size-=I;for(var G=new Uint8Array(g.size),V=0,Q=a.length;V<Q;V++){k=a[V];var z=k.byteLength;if(I)if(I>z){I-=z;continue}else k=k.subarray(I),z-=I,I=0;G.set(k,p),p+=z}return b&&(b-=f+3),{data:G,pts:m,dts:d,len:b}}return null}function l(g,p){if(g.units.length&&g.frame){if(g.pts===void 0){var k=p.samples,b=k.length;if(b){var f=k[b-1];g.pts=f.pts,g.dts=f.dts}else{p.dropped++;return}}p.samples.push(g)}g.debug.length&&y.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function h(g,p){var k=g.length;if(k>0){if(p.pts>=g[k-1].pts)g.push(p);else for(var b=k-1;b>=0;b--)if(p.pts<g[b].pts){g.splice(b,0,p);break}}else g.push(p)}function C(g){for(var p=g.byteLength,k=[],b=1;b<p-2;)g[b]===0&&g[b+1]===0&&g[b+2]===3?(k.push(b+2),b+=2):b++;if(k.length===0)return g;var f=p-k.length,m=new Uint8Array(f),d=0;for(b=0;b<f;d++,b++)d===k[0]&&(d++,k.shift()),m[b]=g[d];return m}Z.default=L},"./src/errors.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"ErrorTypes",function(){return Y}),D.d(Z,"ErrorDetails",function(){return N});var Y;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Y||(Y={}));var N;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"Events",function(){return Y});var Y;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return g});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(Y),P=D("./src/loader/playlist-loader.ts"),H=D("./src/loader/key-loader.ts"),W=D("./src/controller/id3-track-controller.ts"),M=D("./src/controller/latency-controller.ts"),O=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),R=D("./src/is-supported.ts"),L=D("./src/utils/logger.ts"),w=D("./src/config.ts"),T=D("./node_modules/eventemitter3/index.js"),u=D.n(T),o=D("./src/events.ts"),l=D("./src/errors.ts");function h(p,k){for(var b=0;b<k.length;b++){var f=k[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}function C(p,k,b){return k&&h(p.prototype,k),b&&h(p,b),p}var g=function(){p.isSupported=function(){return Object(R.isSupported)()};function p(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new T.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(w.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(L.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(w.enableStreamingMode)(f);var m=f.abrController,d=f.bufferController,a=f.capLevelController,x=f.fpsController,v=this.abrController=new m(this),S=this.bufferController=new d(this),I=this.capLevelController=new a(this),G=new x(this),V=new P.default(this),Q=new H.default(this),z=new W.default(this),U=this.levelController=new O.default(this),q=new y.FragmentTracker(this),ae=this.streamController=new A.default(this,q);I.setStreamController(ae),G.setStreamController(ae);var ce=[U,ae];this.networkControllers=ce;var ve=[V,Q,v,S,I,G,z,q];this.audioTrackController=this.createController(f.audioTrackController,null,ce),this.createController(f.audioStreamController,q,ce),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ce),this.createController(f.subtitleStreamController,q,ce),this.createController(f.timelineController,null,ve),this.emeController=this.createController(f.emeController,null,ve),this.cmcdController=this.createController(f.cmcdController,null,ve),this.latencyController=this.createController(M.default,null,ve),this.coreComponents=ve}var k=p.prototype;return k.createController=function(f,m,d){if(f){var a=m?new f(this,m):new f(this);return d&&d.push(a),a}return null},k.on=function(f,m,d){d===void 0&&(d=this),this._emitter.on(f,m,d)},k.once=function(f,m,d){d===void 0&&(d=this),this._emitter.once(f,m,d)},k.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},k.off=function(f,m,d,a){d===void 0&&(d=this),this._emitter.off(f,m,d,a)},k.listeners=function(f){return this._emitter.listeners(f)},k.emit=function(f,m,d){return this._emitter.emit(f,m,d)},k.trigger=function(f,m){if(this.config.debug)return this.emit(f,f,m);try{return this.emit(f,f,m)}catch(d){L.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},k.listenerCount=function(f){return this._emitter.listenerCount(f)},k.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},k.attachMedia=function(f){L.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},k.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(f){this.stopLoad();var m=this.media,d=this.url,a=this.url=Y.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),m&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(m)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},k.startLoad=function(f){f===void 0&&(f=-1),L.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(m){m.startLoad(f)})},k.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},k.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){L.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},k.removeLevel=function(f,m){m===void 0&&(m=0),this.levelController.removeLevel(f,m)},C(p,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){L.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){L.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){L.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){L.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){L.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var m=!!f;m!==this.config.capLevelToPlayerSize&&(m?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=m)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(L.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,m=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,a=0;a<d;a++)if(f[a].maxBitrate>m)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,m=this.autoLevelCapping,d;return m===-1&&f&&f.length?d=f.length-1:d=m,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 m=this.audioTrackController;m&&(m.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 m=this.subtitleTrackController;m&&(m.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 m=this.subtitleTrackController;m&&(m.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 p.defaultConfig?p.defaultConfig:w.hlsDefaultConfig},set:function(f){p.defaultConfig=f}}]),p}();g.defaultConfig=void 0},"./src/is-supported.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"isSupported",function(){return P}),D.d(Z,"changeTypeSupported",function(){return H});var Y=D("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var W=Object(Y.getMediaSource)();if(!W)return!1;var M=N(),O=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!O&&!!y}function H(){var W,M=N();return typeof(M==null||((W=M.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return L}),D.d(Z,"LoadError",function(){return T});var Y=D("./src/polyfills/number.ts"),N=D("./src/errors.ts");function P(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,y(u,o)}function H(u){var o=typeof Map=="function"?new Map:void 0;return H=function(h){if(h===null||!O(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(h))return o.get(h);o.set(h,C)}function C(){return W(h,arguments,A(this).constructor)}return C.prototype=Object.create(h.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),y(C,h)},H(u)}function W(u,o,l){return M()?W=Reflect.construct:W=function(C,g,p){var k=[null];k.push.apply(k,g);var b=Function.bind.apply(C,k),f=new b;return p&&y(f,p.prototype),f},W.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function O(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function y(u,o){return y=Object.setPrototypeOf||function(h,C){return h.__proto__=C,h},y(u,o)}function A(u){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(u)}var R=Math.pow(2,17),L=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(h,C){var g=this,p=h.url;if(!p)return Promise.reject(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var k=this.config,b=k.fLoader,f=k.loader;return new Promise(function(m,d){g.loader&&g.loader.destroy();var a=g.loader=h.loader=b?new b(k):new f(k),x=w(h),v={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:R};h.stats=a.stats,a.load(x,v,{onSuccess:function(I,G,V,Q){g.resetLoader(h,a),m({frag:h,part:null,payload:I.data,networkDetails:Q})},onError:function(I,G,V){g.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:I,networkDetails:V}))},onAbort:function(I,G,V){g.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:V}))},onTimeout:function(I,G,V){g.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:V}))},onProgress:function(I,G,V,Q){C&&C({frag:h,part:null,payload:V,networkDetails:Q})}})})},o.loadPart=function(h,C,g){var p=this;this.abort();var k=this.config,b=k.fLoader,f=k.loader;return new Promise(function(m,d){p.loader&&p.loader.destroy();var a=p.loader=h.loader=b?new b(k):new f(k),x=w(h,C),v={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:R};C.stats=a.stats,a.load(x,v,{onSuccess:function(I,G,V,Q){p.resetLoader(h,a),p.updateStatsFromPart(h,C);var z={frag:h,part:C,payload:I.data,networkDetails:Q};g(z),m(z)},onError:function(I,G,V){p.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:C,response:I,networkDetails:V}))},onAbort:function(I,G,V){h.stats.aborted=C.stats.aborted,p.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:C,networkDetails:V}))},onTimeout:function(I,G,V){p.resetLoader(h,a),d(new T({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:C,networkDetails:V}))}})})},o.updateStatsFromPart=function(h,C){var g=h.stats,p=C.stats,k=p.total;if(g.loaded+=p.loaded,k){var b=Math.round(h.duration/C.duration),f=Math.min(Math.round(g.loaded/k),b),m=b-f,d=m*Math.round(g.loaded/f);g.total=g.loaded+d}else g.total=Math.max(g.loaded,g.total);var a=g.loading,x=p.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(h,C){h.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},u}();function w(u,o){o===void 0&&(o=null);var l=o||u,h={frag:u,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,g=l.byteRangeEndOffset;return Object(Y.isFiniteNumber)(C)&&Object(Y.isFiniteNumber)(g)&&(h.rangeStart=C,h.rangeEnd=g),h}var T=function(u){P(o,u);function o(l){for(var h,C=arguments.length,g=new Array(C>1?C-1:0),p=1;p<C;p++)g[p-1]=arguments[p];return h=u.call.apply(u,[this].concat(g))||this,h.data=void 0,h.data=l,h}return o}(H(Error))},"./src/loader/fragment.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"ElementaryStreamTypes",function(){return L}),D.d(Z,"BaseSegment",function(){return w}),D.d(Z,"Fragment",function(){return T}),D.d(Z,"Part",function(){return u});var Y=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(N),H=D("./src/utils/logger.ts"),W=D("./src/loader/level-key.ts"),M=D("./src/loader/load-stats.ts");function O(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},y(o,l)}function A(o,l){for(var h=0;h<l.length;h++){var C=l[h];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function R(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var w=function(){function o(h){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[L.AUDIO]=null,C[L.VIDEO]=null,C[L.AUDIOVIDEO]=null,C),this.baseurl=h}var l=o.prototype;return l.setByteRange=function(C,g){var p=C.split("@",2),k=[];p.length===1?k[0]=g?g.byteRangeEndOffset:0:k[0]=parseInt(p[1]),k[1]=parseInt(p[0])+k[0],this._byteRange=k},R(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),T=function(o){O(l,o);function l(C,g){var p;return p=o.call(this,g)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new M.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=C,p}var h=l.prototype;return h.createInitializationVector=function(g){for(var p=new Uint8Array(16),k=12;k<16;k++)p[k]=g>>8*(15-k)&255;return p},h.setDecryptDataFromLevelKey=function(g,p){var k=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(k=W.LevelKey.fromURI(g.uri),k.method=g.method,k.iv=this.createInitializationVector(p),k.keyFormat="identity"),k},h.setElementaryStreamInfo=function(g,p,k,b,f,m){m===void 0&&(m=!1);var d=this.elementaryStreams,a=d[g];if(!a){d[g]={startPTS:p,endPTS:k,startDTS:b,endDTS:f,partial:m};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,k),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,f)},h.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[L.AUDIO]=null,g[L.VIDEO]=null,g[L.AUDIOVIDEO]=null},R(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var g=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),l}(w),u=function(o){O(l,o);function l(h,C,g,p,k){var b;b=o.call(this,g)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new M.LoadStats,b.duration=h.decimalFloatingPoint("DURATION"),b.gap=h.bool("GAP"),b.independent=h.bool("INDEPENDENT"),b.relurl=h.enumeratedString("URI"),b.fragment=C,b.index=p;var f=h.enumeratedString("BYTERANGE");return f&&b.setByteRange(f,k),k&&(b.fragOffset=k.fragOffset+k.duration),b}return R(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(w)},"./src/loader/key-loader.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return H});var Y=D("./src/events.ts"),N=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=function(){function W(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var M=W.prototype;return M._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var A=this.loaders[y];A&&A.destroy()}this.loaders={}},M.onKeyLoading=function(y,A){var R=A.frag,L=R.type,w=this.loaders[L];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var T=R.decryptdata.uri;if(T!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(w&&(P.logger.warn("abort previous key loader for type:"+L),w.abort()),!T){P.logger.warn("key uri is falsy");return}var o=u.loader,l=R.loader=this.loaders[L]=new o(u);this.decrypturl=T,this.decryptkey=null;var h={url:T,frag:R,responseType:"arraybuffer"},C={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,C,g)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:R}))},M.loadsuccess=function(y,A,R){var L=R.frag;if(!L.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(y.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:L})},M.loaderror=function(y,A){var R=A.frag,L=R.loader;L&&L.abort(),delete this.loaders[R.type],this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:y})},M.loadtimeout=function(y,A){var R=A.frag,L=R.loader;L&&L.abort(),delete this.loaders[R.type],this.hls.trigger(Y.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},W}()},"./src/loader/level-details.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"LevelDetails",function(){return W});var Y=D("./src/polyfills/number.ts");function N(M,O){for(var y=0;y<O.length;y++){var A=O[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(M,A.key,A)}}function P(M,O,y){return O&&N(M.prototype,O),y&&N(M,y),M}var H=10,W=function(){function M(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var O=M.prototype;return O.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-A.lastPartSn,L=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!L||!!R,this.advanced=this.endSN>A.endSN||R>0||R===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var R=this.driftEnd-this.driftStart;return R*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"LevelKey",function(){return W});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(Y);function P(M,O){for(var y=0;y<O.length;y++){var A=O[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(M,A.key,A)}}function H(M,O,y){return O&&P(M.prototype,O),y&&P(M,y),M}var W=function(){M.fromURL=function(y,A){return new M(y,A)},M.fromURI=function(y){return new M(y)};function M(O,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(Y.buildAbsoluteURL)(O,y,{alwaysNormalize:!0}):this._uri=O}return H(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"LoadStats",function(){return Y});var Y=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(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return l});var Y=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(N),H=D("./src/loader/fragment.ts"),W=D("./src/loader/level-details.ts"),M=D("./src/loader/level-key.ts"),O=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),T=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("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(k){var b,f;return u.test((b=(f=N.parseURL(k))===null||f===void 0?void 0:f.path)!=null?b:"")}var l=function(){function k(){}return k.findGroup=function(f,m){for(var d=0;d<f.length;d++){var a=f[d];if(a.id===m)return a}},k.convertAVC1ToAVCOTI=function(f){var m=f.split(".");if(m.length>2){var d=m.shift()+".";return d+=parseInt(m.shift()).toString(16),d+=("000"+parseInt(m.shift()).toString(16)).substr(-4),d}return f},k.resolve=function(f,m){return N.buildAbsoluteURL(m,f,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(f,m){var d=[],a={},x=!1;R.lastIndex=0;for(var v;(v=R.exec(f))!=null;)if(v[1]){var S=new O.AttrList(v[1]),I={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:k.resolve(v[2],m)},G=S.decimalResolution("RESOLUTION");G&&(I.width=G.width,I.height=G.height),h((S.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=k.convertAVC1ToAVCOTI(I.videoCodec)),d.push(I)}else if(v[3]){var V=new O.AttrList(v[3]);V["DATA-ID"]&&(x=!0,a[V["DATA-ID"]]=V)}return{levels:d,sessionData:x?a:null}},k.parseMasterPlaylistMedia=function(f,m,d,a){a===void 0&&(a=[]);var x,v=[],S=0;for(L.lastIndex=0;(x=L.exec(f))!==null;){var I=new O.AttrList(x[1]);if(I.TYPE===d){var G={attrs:I,bitrate:0,id:S++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:d,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?k.resolve(I.URI,m):""};if(a.length){var V=k.findGroup(a,G.groupId)||a[0];C(G,V,"audioCodec"),C(G,V,"textCodec")}v.push(G)}}return v},k.parseLevelPlaylist=function(f,m,d,a,x){var v=new W.LevelDetails(m),S=v.fragments,I=null,G=0,V=0,Q=0,z=0,U=null,q=new H.Fragment(a,m),ae,ce,ve,Oe=-1,xe=!1;for(w.lastIndex=0,v.m3u8=f;(ae=w.exec(f))!==null;){xe&&(xe=!1,q=new H.Fragment(a,m),q.start=Q,q.sn=G,q.cc=z,q.level=d,I&&(q.initSegment=I,q.rawProgramDateTime=I.rawProgramDateTime));var Te=ae[1];if(Te){q.duration=parseFloat(Te);var Ce=(" "+ae[2]).slice(1);q.title=Ce||null,q.tagList.push(Ce?["INF",Te,Ce]:["INF",Te])}else if(ae[3])Object(Y.isFiniteNumber)(q.duration)&&(q.start=Q,ve&&(q.levelkey=ve),q.sn=G,q.level=d,q.cc=z,q.urlId=x,S.push(q),q.relurl=(" "+ae[3]).slice(1),p(q,U),U=q,Q+=q.duration,G++,V=0,xe=!0);else if(ae[4]){var Se=(" "+ae[4]).slice(1);U?q.setByteRange(Se,U):q.setByteRange(Se)}else if(ae[5])q.rawProgramDateTime=(" "+ae[5]).slice(1),q.tagList.push(["PROGRAM-DATE-TIME",q.rawProgramDateTime]),Oe===-1&&(Oe=S.length);else{if(ae=ae[0].match(T),!ae){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ce=1;ce<ae.length&&!(typeof ae[ce]!="undefined");ce++);var pe=(" "+ae[ce]).slice(1),oe=(" "+ae[ce+1]).slice(1),De=ae[ce+2]?(" "+ae[ce+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":v.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":G=v.startSN=parseInt(oe);break;case"SKIP":{var Ye=new O.AttrList(oe),Ge=Ye.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(Ge)){v.skippedSegments=Ge;for(var tt=Ge;tt--;)S.unshift(null);G+=Ge}var qe=Ye.enumeratedString("RECENTLY-REMOVED-DATERANGES");qe&&(v.recentlyRemovedDateranges=qe.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(oe);break;case"VERSION":v.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(oe||De)&&q.tagList.push(De?[oe,De]:[oe]);break;case"DIS":z++;case"GAP":q.tagList.push([pe]);break;case"BITRATE":q.tagList.push([pe,oe]);break;case"DISCONTINUITY-SEQ":z=parseInt(oe);break;case"KEY":{var Ae,Ne=new O.AttrList(oe),We=Ne.enumeratedString("METHOD"),ze=Ne.URI,je=Ne.hexadecimalInteger("IV"),_e=Ne.enumeratedString("KEYFORMATVERSIONS"),Pe=Ne.enumeratedString("KEYID"),Ke=(Ae=Ne.enumeratedString("KEYFORMAT"))!=null?Ae:"identity",$e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($e.indexOf(Ke)>-1){y.logger.warn("Keyformat "+Ke+" is not supported from the manifest");continue}else if(Ke!=="identity")continue;We&&(ve=M.LevelKey.fromURL(m,ze),ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(We)>=0&&(ve.method=We,ve.keyFormat=Ke,Pe&&(ve.keyID=Pe),_e&&(ve.keyFormatVersions=_e),ve.iv=je));break}case"START":{var Qe=new O.AttrList(oe),Xe=Qe.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Xe)&&(v.startTimeOffset=Xe);break}case"MAP":{var dt=new O.AttrList(oe);q.relurl=dt.URI,dt.BYTERANGE&&q.setByteRange(dt.BYTERANGE),q.level=d,q.sn="initSegment",ve&&(q.levelkey=ve),q.initSegment=null,I=q,xe=!0;break}case"SERVER-CONTROL":{var et=new O.AttrList(oe);v.canBlockReload=et.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=et.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&et.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=et.optionalFloat("PART-HOLD-BACK",0),v.holdBack=et.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var it=new O.AttrList(oe);v.partTarget=it.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=v.partList;we||(we=v.partList=[]);var lt=V>0?we[we.length-1]:void 0,nt=V++,Le=new H.Part(new O.AttrList(oe),q,m,nt,lt);we.push(Le),q.duration+=Le.duration;break}case"PRELOAD-HINT":{var Fe=new O.AttrList(oe);v.preloadHint=Fe;break}case"RENDITION-REPORT":{var ge=new O.AttrList(oe);v.renditionReports=v.renditionReports||[],v.renditionReports.push(ge);break}default:y.logger.warn("line parsed but not handled: "+ae);break}}}U&&!U.relurl?(S.pop(),Q-=U.duration,v.partList&&(v.fragmentHint=U)):v.partList&&(p(q,U),q.cc=z,v.fragmentHint=q);var de=S.length,fe=S[0],ee=S[de-1];if(Q+=v.skippedSegments*v.targetduration,Q>0&&de&&ee){v.averagetargetduration=Q/de;var te=ee.sn;v.endSN=te!=="initSegment"?te:0,fe&&(v.startCC=fe.cc,fe.initSegment||v.fragments.every(function(ie){return ie.relurl&&o(ie.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),q=new H.Fragment(a,m),q.relurl=ee.relurl,q.level=d,q.sn="initSegment",fe.initSegment=q,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(Q+=v.fragmentHint.duration),v.totalduration=Q,v.endCC=z,Oe>0&&g(S,Oe),v},k}();function h(k,b){["video","audio","text"].forEach(function(f){var m=k.filter(function(a){return Object(A.isCodecType)(a,f)});if(m.length){var d=m.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[f+"Codec"]=d.length>0?d[0]:m[0],k=k.filter(function(a){return m.indexOf(a)===-1})}}),b.unknownCodecs=k}function C(k,b,f){var m=b[f];m&&(k[f]=m)}function g(k,b){for(var f=k[b],m=b;m--;){var d=k[m];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function p(k,b){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):b!=null&&b.programDateTime&&(k.programDateTime=b.endProgramDateTime),Object(Y.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/m3u8-parser.ts"),O=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function A(w){var T=w.type;switch(T){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function R(w,T){var u=w.url;return(u===void 0||u.indexOf("data:")===0)&&(u=T.url),u}var L=function(){function w(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var T=w.prototype;return T.registerListeners=function(){var o=this.hls;o.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.createInternalLoader=function(o){var l=this.hls.config,h=l.pLoader,C=l.loader,g=h||C,p=new g(l);return o.loader=p,this.loaders[o.type]=p,p},T.getInternalLoader=function(o){return this.loaders[o.type]},T.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},T.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},T.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},T.onManifestLoading=function(o,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},T.onLevelLoading=function(o,l){var h=l.id,C=l.level,g=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:null,level:C,responseType:"text",type:O.PlaylistContextType.LEVEL,url:g,deliveryDirectives:p})},T.onAudioTrackLoading=function(o,l){var h=l.id,C=l.groupId,g=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:p})},T.onSubtitleTrackLoading=function(o,l){var h=l.id,C=l.groupId,g=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:p})},T.load=function(o){var l,h=this.hls.config,C=this.getInternalLoader(o);if(C){var g=C.context;if(g&&g.url===o.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var p,k,b,f;switch(o.type){case O.PlaylistContextType.MANIFEST:p=h.manifestLoadingMaxRetry,k=h.manifestLoadingTimeOut,b=h.manifestLoadingRetryDelay,f=h.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:p=0,k=h.levelLoadingTimeOut;break;default:p=h.levelLoadingMaxRetry,k=h.levelLoadingTimeOut,b=h.levelLoadingRetryDelay,f=h.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var m;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?m=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?m=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(m=this.hls.subtitleTracks[o.id].details),m){var d=m.partTarget,a=m.targetduration;d&&a&&(k=Math.min(Math.max(d*3,a*.8)*1e3,k))}}var x={timeout:k,maxRetry:p,retryDelay:b,maxRetryDelay:f,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,x,v)},T.loadsuccess=function(o,l,h,C){if(C===void 0&&(C=null),h.isSidxRequest){this.handleSidxRequest(o,h),this.handlePlaylistLoaded(o,l,h,C);return}this.resetInternalLoader(h.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,h,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,h,C):this.handleMasterPlaylist(o,l,h,C)},T.loaderror=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,o)},T.loadtimeout=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},T.handleMasterPlaylist=function(o,l,h,C){var g=this.hls,p=o.data,k=R(o,h),b=M.default.parseMasterPlaylist(p,k),f=b.levels,m=b.sessionData;if(!f.length){this.handleManifestParsingError(o,h,"no level found in manifest",C);return}var d=f.map(function(G){return{id:G.attrs.AUDIO,audioCodec:G.audioCodec}}),a=f.map(function(G){return{id:G.attrs.SUBTITLES,textCodec:G.textCodec}}),x=M.default.parseMasterPlaylistMedia(p,k,"AUDIO",d),v=M.default.parseMasterPlaylistMedia(p,k,"SUBTITLES",a),S=M.default.parseMasterPlaylistMedia(p,k,"CLOSED-CAPTIONS");if(x.length){var I=x.some(function(G){return!G.url});!I&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}g.trigger(N.Events.MANIFEST_LOADED,{levels:f,audioTracks:x,subtitles:v,captions:S,url:k,stats:l,networkDetails:C,sessionData:m})},T.handleTrackOrLevelPlaylist=function(o,l,h,C){var g=this.hls,p=h.id,k=h.level,b=h.type,f=R(o,h),m=Object(Y.isFiniteNumber)(p)?p:0,d=Object(Y.isFiniteNumber)(k)?k:m,a=A(h),x=M.default.parseLevelPlaylist(o.data,f,d,a,m);if(!x.fragments.length){g.trigger(N.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(b===O.PlaylistContextType.MANIFEST){var v={attrs:new y.AttrList({}),bitrate:0,details:x,name:"",url:f};g.trigger(N.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:f,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var S,I=(S=x.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:I,isSidxRequest:!0,type:b,level:k,levelDetails:x,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=x,this.handlePlaylistLoaded(o,l,h,C)},T.handleSidxRequest=function(o,l){var h=Object(W.parseSegmentIndex)(new Uint8Array(o.data));if(!h)return;var C=h.references,g=l.levelDetails;C.forEach(function(p,k){var b=p.info,f=g.fragments[k];f.byteRange.length===0&&f.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),f.initSegment&&f.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},T.handleManifestParsingError=function(o,l,h,C){this.hls.trigger(N.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:h,response:o,context:l,networkDetails:C})},T.handleNetworkError=function(o,l,h,C){h===void 0&&(h=!1),H.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=P.ErrorDetails.UNKNOWN,p=!1,k=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:g=h?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case O.PlaylistContextType.LEVEL:g=h?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case O.PlaylistContextType.AUDIO_TRACK:g=h?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:g=h?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}k&&this.resetInternalLoader(o.type);var b={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:p,url:o.url,loader:k,context:o,networkDetails:l};C&&(b.response=C),this.hls.trigger(N.Events.ERROR,b)},T.handlePlaylistLoaded=function(o,l,h,C){var g=h.type,p=h.level,k=h.id,b=h.groupId,f=h.loader,m=h.levelDetails,d=h.deliveryDirectives;if(!(m!=null&&m.targetduration)){this.handleManifestParsingError(o,h,"invalid target duration",C);return}if(!f)return;m.live&&(f.getCacheAge&&(m.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(m.ageHeader))&&(m.ageHeader=0));switch(g){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:m,level:p||0,id:k||0,stats:l,networkDetails:C,deliveryDirectives:d});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:m,id:k||0,groupId:b||"",stats:l,networkDetails:C,deliveryDirectives:d});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:m,id:k||0,groupId:b||"",stats:l,networkDetails:C,deliveryDirectives:d});break}},w}();Z.default=L},"./src/polyfills/number.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"isFiniteNumber",function(){return Y}),D.d(Z,"MAX_SAFE_INTEGER",function(){return N});var Y=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,Z,D){"use strict";D.r(Z);var Y=function(){function N(){}return N.getSilentFrame=function(H,W){switch(H){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(W===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(W===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},N}();Z.default=Y},"./src/remux/mp4-generator.ts":function(re,Z,D){"use strict";D.r(Z);var Y=Math.pow(2,32)-1,N=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var W;for(W in P.types)P.types.hasOwnProperty(W)&&(P.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),O=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:M,audio:O};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,w,R,L),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,y))},P.box=function(W){for(var M=8,O=arguments.length,y=new Array(O>1?O-1:0),A=1;A<O;A++)y[A-1]=arguments[A];for(var R=y.length,L=R;R--;)M+=y[R].byteLength;var w=new Uint8Array(M);for(w[0]=M>>24&255,w[1]=M>>16&255,w[2]=M>>8&255,w[3]=M&255,w.set(W,4),R=0,M=8;R<L;R++)w.set(y[R],M),M+=y[R].byteLength;return w},P.hdlr=function(W){return P.box(P.types.hdlr,P.HDLR_TYPES[W])},P.mdat=function(W){return P.box(P.types.mdat,W)},P.mdhd=function(W,M){M*=W;var O=Math.floor(M/(Y+1)),y=Math.floor(M%(Y+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},P.mdia=function(W){return P.box(P.types.mdia,P.mdhd(W.timescale,W.duration),P.hdlr(W.type),P.minf(W))},P.mfhd=function(W){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},P.minf=function(W){return W.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(W)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(W))},P.moof=function(W,M,O){return P.box(P.types.moof,P.mfhd(W),P.traf(O,M))},P.moov=function(W){for(var M=W.length,O=[];M--;)O[M]=P.trak(W[M]);return P.box.apply(null,[P.types.moov,P.mvhd(W[0].timescale,W[0].duration)].concat(O).concat(P.mvex(W)))},P.mvex=function(W){for(var M=W.length,O=[];M--;)O[M]=P.trex(W[M]);return P.box.apply(null,[P.types.mvex].concat(O))},P.mvhd=function(W,M){M*=W;var O=Math.floor(M/(Y+1)),y=Math.floor(M%(Y+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,A)},P.sdtp=function(W){var M=W.samples||[],O=new Uint8Array(4+M.length),y,A;for(y=0;y<M.length;y++)A=M[y].flags,O[y+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,O)},P.stbl=function(W){return P.box(P.types.stbl,P.stsd(W),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(W){var M=[],O=[],y,A,R;for(y=0;y<W.sps.length;y++)A=W.sps[y],R=A.byteLength,M.push(R>>>8&255),M.push(R&255),M=M.concat(Array.prototype.slice.call(A));for(y=0;y<W.pps.length;y++)A=W.pps[y],R=A.byteLength,O.push(R>>>8&255),O.push(R&255),O=O.concat(Array.prototype.slice.call(A));var L=P.box(P.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|W.sps.length].concat(M).concat([W.pps.length]).concat(O))),w=W.width,T=W.height,u=W.pixelRatio[0],o=W.pixelRatio[1];return P.box(P.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,w>>8&255,w&255,T>>8&255,T&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),L,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(W){var M=W.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(W.config).concat([6,1,2]))},P.mp4a=function(W){var M=W.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),P.box(P.types.esds,P.esds(W)))},P.mp3=function(W){var M=W.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},P.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(W)):P.box(P.types.stsd,P.STSD,P.mp4a(W)):P.box(P.types.stsd,P.STSD,P.avc1(W))},P.tkhd=function(W){var M=W.id,O=W.duration*W.timescale,y=W.width,A=W.height,R=Math.floor(O/(Y+1)),L=Math.floor(O%(Y+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(W,M){var O=P.sdtp(W),y=W.id,A=Math.floor(M/(Y+1)),R=Math.floor(M%(Y+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(W,O.length+16+20+8+16+8+8),O)},P.trak=function(W){return W.duration=W.duration||4294967295,P.box(P.types.trak,P.tkhd(W),P.mdia(W))},P.trex=function(W){var M=W.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(W,M){var O=W.samples||[],y=O.length,A=12+16*y,R=new Uint8Array(A),L,w,T,u,o,l;for(M+=8+A,R.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),L=0;L<y;L++)w=O[L],T=w.duration,u=w.size,o=w.flags,l=w.cts,R.set([T>>>24&255,T>>>16&255,T>>>8&255,T&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return P.box(P.types.trun,R)},P.initSegment=function(W){P.types||P.init();var M=P.moov(W),O=new Uint8Array(P.FTYP.byteLength+M.byteLength);return O.set(P.FTYP),O.set(M,P.FTYP.byteLength),O},P}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,Z.default=N},"./src/remux/mp4-remuxer.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return l}),D.d(Z,"normalizePts",function(){return h});var Y=D("./src/polyfills/number.ts"),N=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),H=D("./src/events.ts"),W=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),O=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var f=arguments[b];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(k[m]=f[m])}return k},A.apply(this,arguments)}var R=10*1e3,L=1024,w=1152,T=null,u=null,o=!1,l=function(){function k(f,m,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=m,this.typeSupported=d,this.ISGenerated=!1,T===null){var x=navigator.userAgent||"",v=x.match(/Chrome\/(\d+)/i);T=v?parseInt(v[1]):0}if(u===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);u=S?parseInt(S[1]):0}o=!!T&&T<75||!!u&&u<600}var b=k.prototype;return b.destroy=function(){},b.resetTimeStamp=function(m){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=m},b.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(m){var d=!1,a=m.reduce(function(x,v){var S=v.pts-x;return S<-4294967296?(d=!0,h(x,v.pts)):S>0?x:v.pts},m[0].pts);return d&&M.logger.debug("PTS rollover detected"),a},b.remux=function(m,d,a,x,v,S,I,G){var V,Q,z,U,q,ae,ce=v,ve=v,Oe=m.pid>-1,xe=d.pid>-1,Te=d.samples.length,Ce=m.samples.length>0,Se=Te>1,pe=(!Oe||Ce)&&(!xe||Se)||this.ISGenerated||I;if(pe){this.ISGenerated||(z=this.generateIS(m,d,v));var oe=this.isVideoContiguous,De=-1;if(Se&&(De=C(d.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,De>0){M.logger.warn("[mp4-remuxer]: Dropped "+De+" out of "+Te+" video samples due to a missing keyframe");var Ye=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(De),d.dropped+=De,ve+=(d.samples[0].pts-Ye)/(d.timescale||9e4)}else De===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),ae=!1);if(this.ISGenerated){if(Ce&&Se){var Ge=this.getVideoStartPts(d.samples),tt=h(m.samples[0].pts,Ge)-Ge,qe=tt/d.inputTimeScale;ce+=Math.max(0,qe),ve+=Math.max(0,-qe)}if(Ce){if(m.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),z=this.generateIS(m,d,v)),Q=this.remuxAudio(m,ce,this.isAudioContiguous,S,xe||Se||G===O.PlaylistLevelType.AUDIO?ve:void 0),Se){var Ae=Q?Q.endPTS-Q.startPTS:0;d.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),z=this.generateIS(m,d,v)),V=this.remuxVideo(d,ve,oe,Ae)}}else Se&&(V=this.remuxVideo(d,ve,oe,0));V&&(V.firstKeyFrame=De,V.independent=De!==-1)}}return this.ISGenerated&&(a.samples.length&&(q=this.remuxID3(a,v)),x.samples.length&&(U=this.remuxText(x,v))),{audio:Q,video:V,initSegment:z,independent:ae,text:U,id3:q}},b.generateIS=function(m,d,a){var x=m.samples,v=d.samples,S=this.typeSupported,I={},G=!Object(Y.isFiniteNumber)(this._initPTS),V="audio/mp4",Q,z,U;if(G&&(Q=z=Infinity),m.config&&x.length&&(m.timescale=m.samplerate,m.isAAC||(S.mpeg?(V="audio/mpeg",m.codec=""):S.mp3&&(m.codec="mp3")),I.audio={id:"audio",container:V,codec:m.codec,initSegment:!m.isAAC&&S.mpeg?new Uint8Array(0):P.default.initSegment([m]),metadata:{channelCount:m.channelCount}},G&&(U=m.inputTimeScale,Q=z=x[0].pts-Math.round(U*a))),d.sps&&d.pps&&v.length&&(d.timescale=d.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:P.default.initSegment([d]),metadata:{width:d.width,height:d.height}},G)){U=d.inputTimeScale;var q=this.getVideoStartPts(v),ae=Math.round(U*a);z=Math.min(z,h(v[0].dts,q)-ae),Q=Math.min(Q,q-ae)}if(Object.keys(I).length)return this.ISGenerated=!0,G&&(this._initPTS=Q,this._initDTS=z),{tracks:I,initPTS:Q,timescale:U}},b.remuxVideo=function(m,d,a,x){var v=m.inputTimeScale,S=m.samples,I=[],G=S.length,V=this._initPTS,Q=this.nextAvcDts,z=8,U,q,ae,ce=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Oe=0,xe=!1;if(!a||Q===null){var Te=d*v,Ce=S[0].pts-h(S[0].dts,S[0].pts);Q=Te-Ce}for(var Se=0;Se<G;Se++){var pe=S[Se];if(pe.pts=h(pe.pts-V,Q),pe.dts=h(pe.dts-V,Q),pe.dts>pe.pts){var oe=9e4*.2;Oe=Math.max(Math.min(Oe,pe.pts-pe.dts),-1*oe)}pe.dts<S[Se>0?Se-1:Se].dts&&(xe=!0)}xe&&S.sort(function(Ct,St){var st=Ct.dts-St.dts,Ft=Ct.pts-St.pts;return st||Ft}),q=S[0].dts,ae=S[S.length-1].dts;var De=Math.round((ae-q)/(G-1));if(Oe<0){if(Oe<De*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-De,!0)+" ms");for(var Ye=Oe,Ge=0;Ge<G;Ge++)S[Ge].dts=Ye=Math.max(Ye,S[Ge].pts-De),S[Ge].pts=Math.max(Ye,S[Ge].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var tt=0;tt<G;tt++)S[tt].dts=S[tt].dts+Oe}q=S[0].dts}if(a){var qe=q-Q,Ae=qe>De,Ne=qe<-1;if(Ae||Ne){Ae?M.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(qe,!0)+" ms ("+qe+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-qe,!0)+" ms ("+qe+"dts) overlapping between fragments detected"),q=Q;var We=S[0].pts-qe;S[0].dts=q,S[0].pts=We,M.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(We,!0)+"/"+Object(y.toMsFromMpegTsClock)(q,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(qe,!0)+" ms")}}o&&(q=Math.max(0,q));for(var ze=0,je=0,_e=0;_e<G;_e++){for(var Pe=S[_e],Ke=Pe.units,$e=Ke.length,Qe=0,Xe=0;Xe<$e;Xe++)Qe+=Ke[Xe].data.length;je+=Qe,ze+=$e,Pe.length=Qe,Pe.dts=Math.max(Pe.dts,q),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ce=Math.min(Pe.pts,ce),ve=Math.max(Pe.pts,ve)}ae=S[G-1].dts;var dt=je+4*ze+8,et;try{et=new Uint8Array(dt)}catch(Ct){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var it=new DataView(et.buffer);it.setUint32(0,dt),et.set(P.default.types.mdat,4);for(var we=0;we<G;we++){for(var lt=S[we],nt=lt.units,Le=0,Fe=0,ge=nt.length;Fe<ge;Fe++){var de=nt[Fe],fe=de.data,ee=de.data.byteLength;it.setUint32(z,ee),z+=4,et.set(fe,z),z+=ee,Le+=4+ee}if(we<G-1)U=S[we+1].dts-lt.dts;else{var te=this.config,ie=lt.dts-S[we>0?we-1:we].dts;if(te.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(te.maxBufferHole*v),me=(x?ce+x*v:this.nextAudioPts)-lt.pts;me>ue?(U=me-ie,U<0&&(U=ie),M.logger.log("[mp4-remuxer]: It is approximately "+me/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=ie}else U=ie}var Ee=Math.round(lt.pts-lt.dts);I.push(new g(lt.key,U,Le,Ee))}if(I.length&&T&&T<70){var Me=I[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(U!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=ae+U,this.isVideoContiguous=!0;var rt=P.default.moof(m.sequenceNumber++,q,A({},m,{samples:I})),mt="video",ct={data1:rt,data2:et,startPTS:ce/v,endPTS:(ve+U)/v,startDTS:q/v,endDTS:Q/v,type:mt,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:m.dropped};return m.samples=[],m.dropped=0,console.assert(et.length,"MDAT length must not be zero"),ct},b.remuxAudio=function(m,d,a,x,v){var S=m.inputTimeScale,I=m.samplerate?m.samplerate:S,G=S/I,V=m.isAAC?L:w,Q=V*G,z=this._initPTS,U=!m.isAAC&&this.typeSupported.mpeg,q=[],ae=m.samples,ce=U?0:8,ve=this.nextAudioPts||-1,Oe=d*S;if(this.isAudioContiguous=a=a||ae.length&&ve>0&&(x&&Math.abs(Oe-ve)<9e3||Math.abs(h(ae[0].pts-z,Oe)-ve)<20*Q),ae.forEach(function(fe){fe.pts=h(fe.pts-z,Oe)}),!a||ve<0){if(ae=ae.filter(function(fe){return fe.pts>=0}),!ae.length)return;v===0?ve=0:x?ve=Math.max(0,Oe):ve=ae[0].pts}if(m.isAAC)for(var xe=v!==void 0,Te=this.config.maxAudioFramesDrift,Ce=0,Se=ve;Ce<ae.length;Ce++){var pe=ae[Ce],oe=pe.pts,De=oe-Se,Ye=Math.abs(1e3*De/S);if(De<=-Te*Q&&xe)Ce===0&&(M.logger.warn("Audio frame @ "+(oe/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*De/S)+" ms."),this.nextAudioPts=ve=Se=oe);else if(De>=Te*Q&&Ye<R&&xe){var Ge=Math.round(De/Q);Se=oe-Ge*Q,Se<0&&(Ge--,Se+=Q),Ce===0&&(this.nextAudioPts=ve=Se),M.logger.warn("[mp4-remuxer]: Injecting "+Ge+" audio frame @ "+(Se/S).toFixed(3)+"s due to "+Math.round(1e3*De/S)+" ms gap.");for(var tt=0;tt<Ge;tt++){var qe=Math.max(Se,0),Ae=N.default.getSilentFrame(m.manifestCodec||m.codec,m.channelCount);Ae||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=pe.unit.subarray()),ae.splice(Ce,0,{unit:Ae,pts:qe}),Se+=Q,Ce++}}pe.pts=Se,Se+=Q}for(var Ne=null,We=null,ze,je=0,_e=ae.length;_e--;)je+=ae[_e].unit.byteLength;for(var Pe=0,Ke=ae.length;Pe<Ke;Pe++){var $e=ae[Pe],Qe=$e.unit,Xe=$e.pts;if(We!==null){var dt=q[Pe-1];dt.duration=Math.round((Xe-We)/G)}else if(a&&m.isAAC&&(Xe=ve),Ne=Xe,je>0){je+=ce;try{ze=new Uint8Array(je)}catch(fe){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!U){var et=new DataView(ze.buffer);et.setUint32(0,je),ze.set(P.default.types.mdat,4)}}else return;ze.set(Qe,ce);var it=Qe.byteLength;ce+=it,q.push(new g(!0,V,it,0)),We=Xe}var we=q.length;if(!we)return;var lt=q[q.length-1];this.nextAudioPts=ve=We+G*lt.duration;var nt=U?new Uint8Array(0):P.default.moof(m.sequenceNumber++,Ne/G,A({},m,{samples:q}));m.samples=[];var Le=Ne/S,Fe=ve/S,ge="audio",de={data1:nt,data2:ze,startPTS:Le,endPTS:Fe,startDTS:Le,endDTS:Fe,type:ge,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),de},b.remuxEmptyAudio=function(m,d,a,x){var v=m.inputTimeScale,S=m.samplerate?m.samplerate:v,I=v/S,G=this.nextAudioPts,V=(G!==null?G:x.startDTS*v)+this._initDTS,Q=x.endDTS*v+this._initDTS,z=I*L,U=Math.ceil((Q-V)/z),q=N.default.getSilentFrame(m.manifestCodec||m.codec,m.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!q){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ae=[],ce=0;ce<U;ce++){var ve=V+ce*z;ae.push({unit:q,pts:ve,dts:ve})}return m.samples=ae,this.remuxAudio(m,d,a,!1)},b.remuxID3=function(m,d){var a=m.samples.length;if(!a)return;for(var x=m.inputTimeScale,v=this._initPTS,S=this._initDTS,I=0;I<a;I++){var G=m.samples[I];G.pts=h(G.pts-v,d*x)/x,G.dts=h(G.dts-S,d*x)/x}var V=m.samples;return m.samples=[],{samples:V}},b.remuxText=function(m,d){var a=m.samples.length;if(!a)return;for(var x=m.inputTimeScale,v=this._initPTS,S=0;S<a;S++){var I=m.samples[S];I.pts=h(I.pts-v,d*x)/x}m.samples.sort(function(V,Q){return V.pts-Q.pts});var G=m.samples;return m.samples=[],{samples:G}},k}();function h(k,b){var f;if(b===null)return k;for(b<k?f=-8589934592:f=8589934592;Math.abs(k-b)>4294967296;)k+=f;return k}function C(k){for(var b=0;b<k.length;b++)if(k[b].key)return b;return-1}var g=function(b,f,m,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=m,this.cts=d,this.flags=new p(b)},p=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),H=D("./src/utils/logger.ts"),W=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=y.prototype;return A.destroy=function(){},A.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(L,w,T){this.audioCodec=w,this.videoCodec=T,this.generateInitSegment(L),this.emitInitSegment=!0},A.generateInitSegment=function(L){var w=this.audioCodec,T=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(N.parseInitSegment)(L);w||(w=O(u.audio,P.ElementaryStreamTypes.AUDIO)),T||(T=O(u.video,P.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:w+","+T,initSegment:L,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:w,initSegment:L,id:"audio"}:u.video?o.video={container:"video/mp4",codec:T,initSegment:L,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(L,w,T,u,o){var l=this.initPTS,h=this.lastEndDTS,C={audio:void 0,video:void 0,text:u,id3:T,initSegment:void 0};Object(Y.isFiniteNumber)(h)||(h=this.lastEndDTS=o||0);var g=w.samples;if(!g||!g.length)return C;var p={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(g),k=this.initData),!k||!k.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=M(k,g,h));var b=Object(N.getDuration)(g,k),f=h,m=b+f;Object(N.offsetStartDTS)(k,g,l),b>0?this.lastEndDTS=m:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!k.audio,a=!!k.video,x="";d&&(x+="audio"),a&&(x+="video");var v={data1:g,startPTS:f,startDTS:f,endPTS:m,endDTS:m,type:x,hasAudio:d,hasVideo:a,nb:1,dropped:0};return C.audio=v.type==="audio"?v:void 0,C.video=v.type!=="audio"?v:void 0,C.text=u,C.id3=T,C.initSegment=p,C},y}(),M=function(A,R,L){return Object(N.getStartDTS)(A,R)-L};function O(y,A){var R=y==null?void 0:y.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=W},"./src/task-loop.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return Y});var Y=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=N.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},N}()},"./src/types/cmcd.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"CMCDVersion",function(){return Y}),D.d(Z,"CMCDObjectType",function(){return N}),D.d(Z,"CMCDStreamingFormat",function(){return P}),D.d(Z,"CMCDStreamType",function(){return H});var Y=1,N;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(N||(N={}));var P;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(P||(P={}));var H;(function(W){W.VOD="v",W.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"HlsSkip",function(){return P}),D.d(Z,"getSkipValue",function(){return H}),D.d(Z,"HlsUrlParameters",function(){return W}),D.d(Z,"Level",function(){return M});function Y(O,y){for(var A=0;A<y.length;A++){var R=y[A];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(O,R.key,R)}}function N(O,y,A){return y&&Y(O.prototype,y),A&&Y(O,A),O}var P;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(P||(P={}));function H(O,y){var A=O.canSkipUntil,R=O.canSkipDateRanges,L=O.endSN,w=y!==void 0?y-L:0;return A&&w<A?R?P.v2:P.Yes:P.No}var W=function(){function O(A,R,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=R,this.skip=L}var y=O.prototype;return y.addDirectives=function(R){var L=new self.URL(R);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},O}(),M=function(){function O(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return N(O,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var R=A%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),O}()},"./src/types/loader.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"PlaylistContextType",function(){return Y}),D.d(Z,"PlaylistLevelType",function(){return N});var Y;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var N;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"ChunkMetadata",function(){return Y});var Y=function(H,W,M,O,y,A){O===void 0&&(O=0),y===void 0&&(y=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=H,this.sn=W,this.id=M,this.size=O,this.part=y,this.partial=A};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"AttrList",function(){return P});var Y=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function H(M){typeof M=="string"&&(M=H.parseAttrList(M));for(var O in M)M.hasOwnProperty(O)&&(this[O]=M[O])}var W=H.prototype;return W.decimalInteger=function(O){var y=parseInt(this[O],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.hexadecimalInteger=function(O){if(this[O]){var y=(this[O]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var A=new Uint8Array(y.length/2),R=0;R<y.length/2;R++)A[R]=parseInt(y.slice(R*2,R*2+2),16);return A}else return null},W.hexadecimalIntegerAsNumber=function(O){var y=parseInt(this[O],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},W.decimalFloatingPoint=function(O){return parseFloat(this[O])},W.optionalFloat=function(O,y){var A=this[O];return A?parseFloat(A):y},W.enumeratedString=function(O){return this[O]},W.bool=function(O){return this[O]==="YES"},W.decimalResolution=function(O){var y=Y.exec(this[O]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},H.parseAttrList=function(O){var y,A={},R='"';for(N.lastIndex=0;(y=N.exec(O))!==null;){var L=y[2];L.indexOf(R)===0&&L.lastIndexOf(R)===L.length-1&&(L=L.slice(1,-1)),A[y[1]]=L}return A},H}()},"./src/utils/binary-search.ts":function(re,Z,D){"use strict";D.r(Z);var Y={search:function(P,H){for(var W=0,M=P.length-1,O=null,y=null;W<=M;){O=(W+M)/2|0,y=P[O];var A=H(y);if(A>0)W=O+1;else if(A<0)M=O-1;else return y}return null}};Z.default=Y},"./src/utils/buffer-helper.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"BufferHelper",function(){return P});var Y=D("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function H(){}return H.isBuffered=function(M,O){try{if(M){for(var y=H.getBuffered(M),A=0;A<y.length;A++)if(O>=y.start(A)&&O<=y.end(A))return!0}}catch(R){}return!1},H.bufferInfo=function(M,O,y){try{if(M){var A=H.getBuffered(M),R=[],L;for(L=0;L<A.length;L++)R.push({start:A.start(L),end:A.end(L)});return this.bufferedInfo(R,O,y)}}catch(w){}return{len:0,start:O,end:O,nextStart:void 0}},H.bufferedInfo=function(M,O,y){O=Math.max(0,O),M.sort(function(p,k){var b=p.start-k.start;return b||k.end-p.end});var A=[];if(y)for(var R=0;R<M.length;R++){var L=A.length;if(L){var w=A[L-1].end;M[R].start-w<y?M[R].end>w&&(A[L-1].end=M[R].end):A.push(M[R])}else A.push(M[R])}else A=M;for(var T=0,u,o=O,l=O,h=0;h<A.length;h++){var C=A[h].start,g=A[h].end;if(O+y>=C&&O<g)o=C,l=g,T=l-O;else if(O+y<C){u=C;break}}return{len:T,start:o||0,end:l||0,nextStart:u}},H.getBuffered=function(M){try{return M.buffered}catch(O){return Y.logger.log("failed to get media.buffered",O),N}},H}()},"./src/utils/cea-608-parser.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"Row",function(){return l}),D.d(Z,"CaptionScreen",function(){return h});var Y=D("./src/utils/logger.ts"),N={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},P=function(m){var d=m;return N.hasOwnProperty(m)&&(d=N[m]),String.fromCharCode(d)},H=15,W=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(L||(L={}));var w=function(){function f(){this.time=null,this.verboseLevel=L.ERROR}var m=f.prototype;return m.log=function(a,x){this.verboseLevel>=a&&Y.logger.log(this.time+" ["+a+"] "+x)},f}(),T=function(m){for(var d=[],a=0;a<m.length;a++)d.push(m[a].toString(16));return d},u=function(){function f(d,a,x,v,S){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=x||!1,this.background=v||"black",this.flash=S||!1}var m=f.prototype;return m.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},m.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],v=0;v<x.length;v++){var S=x[v];a.hasOwnProperty(S)&&(this[S]=a[S])}},m.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},m.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},m.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},m.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,x,v,S,I){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,x,v,S,I)}var m=f.prototype;return m.reset=function(){this.uchar=" ",this.penState.reset()},m.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},m.setPenState=function(a){this.penState.copy(a)},m.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},m.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},m.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<W;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var m=f.prototype;return m.equals=function(a){for(var x=!0,v=0;v<W;v++)if(!this.chars[v].equals(a.chars[v])){x=!1;break}return x},m.copy=function(a){for(var x=0;x<W;x++)this.chars[x].copy(a.chars[x])},m.isEmpty=function(){for(var a=!0,x=0;x<W;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},m.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},m.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var v=this.pos+1;v<x+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(x)},m.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},m.insertChar=function(a){a>=144&&this.backSpace();var x=P(a);if(this.pos>=W){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},m.clearFromPos=function(a){var x;for(x=a;x<W;x++)this.chars[x].reset()},m.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},m.clearToEndOfRow=function(){this.clearFromPos(this.pos)},m.getTextString=function(){for(var a=[],x=!0,v=0;v<W;v++){var S=this.chars[v].uchar;S!==" "&&(x=!1),a.push(S)}return x?"":a.join("")},m.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},f}(),h=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<H;a++)this.rows.push(new l(d));this.logger=d,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var m=f.prototype;return m.reset=function(){for(var a=0;a<H;a++)this.rows[a].clear();this.currRow=H-1},m.equals=function(a){for(var x=!0,v=0;v<H;v++)if(!this.rows[v].equals(a.rows[v])){x=!1;break}return x},m.copy=function(a){for(var x=0;x<H;x++)this.rows[x].copy(a.rows[x])},m.isEmpty=function(){for(var a=!0,x=0;x<H;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},m.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},m.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},m.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},m.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},m.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},m.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},m.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var v=0;v<H;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var G=I.rows[S].cueStartTime,V=this.logger.time;if(G&&V!==null&&G<V)for(var Q=0;Q<this.nrRollUpRows;Q++)this.rows[x-this.nrRollUpRows+Q+1].copy(I.rows[S+Q])}}this.currRow=x;var z=this.rows[this.currRow];if(a.indent!==null){var U=a.indent,q=Math.max(U-1,0);z.setCursor(a.indent),a.color=z.chars[q].penState.foreground}var ae={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ae)},m.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},m.setRollUpRows=function(a){this.nrRollUpRows=a},m.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(L.INFO,"Rolling up")},m.getDisplayText=function(a){a=a||!1;for(var x=[],v="",S=-1,I=0;I<H;I++){var G=this.rows[I].getTextString();G&&(S=I+1,a?x.push("Row "+S+": '"+G+"'"):x.push(G.trim()))}return x.length>0&&(a?v="["+x.join(" | ")+"]":v=x.join(`
|
|
`)),v},m.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(d,a,x){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 h(x),this.nonDisplayedMemory=new h(x),this.lastOutputScreen=new h(x),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var m=f.prototype;return m.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},m.getHandler=function(){return this.outputFilter},m.setHandler=function(a){this.outputFilter=a},m.setPAC=function(a){this.writeScreen.setPAC(a)},m.setBkgData=function(a){this.writeScreen.setBkgData(a)},m.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},m.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},m.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},m.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},m.ccAOF=function(){},m.ccAON=function(){},m.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},m.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},m.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},m.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},m.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},m.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},m.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},m.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},m.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},m.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},m.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},m.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var v=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=S[v]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},m.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},m.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),g=function(){function f(d,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new w;this.channels=[null,new C(d,a,v),new C(d+1,x,v)],this.cmdHistory=b(),this.logger=v}var m=f.prototype;return m.getHandler=function(a){return this.channels[a].getHandler()},m.setHandler=function(a,x){this.channels[a].setHandler(x)},m.addData=function(a,x){var v,S,I,G=!1;this.logger.time=a;for(var V=0;V<x.length;V+=2){if(S=x[V]&127,I=x[V+1]&127,S===0&&I===0)continue;if(this.logger.log(L.DATA,"["+T([x[V],x[V+1]])+"] -> ("+T([S,I])+")"),v=this.parseCmd(S,I),v||(v=this.parseMidrow(S,I)),v||(v=this.parsePAC(S,I)),v||(v=this.parseBackgroundAttributes(S,I)),!v&&(G=this.parseChars(S,I),G)){var Q=this.currentChannel;if(Q&&Q>0){var z=this.channels[Q];z.insertChars(G)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!G&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+T([S,I])+" orig: "+T([x[V],x[V+1]]))}},m.parseCmd=function(a,x){var v=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,I=(a===23||a===31)&&x>=33&&x<=35;if(!(S||I))return!1;if(k(a,x,v))return p(null,null,v),this.logger.log(L.DEBUG,"Repeated command ("+T([a,x])+") is dropped"),!0;var G=a===20||a===21||a===23?1:2,V=this.channels[G];return a===20||a===21||a===28||a===29?x===32?V.ccRCL():x===33?V.ccBS():x===34?V.ccAOF():x===35?V.ccAON():x===36?V.ccDER():x===37?V.ccRU(2):x===38?V.ccRU(3):x===39?V.ccRU(4):x===40?V.ccFON():x===41?V.ccRDC():x===42?V.ccTR():x===43?V.ccRTD():x===44?V.ccEDM():x===45?V.ccCR():x===46?V.ccENM():x===47&&V.ccEOC():V.ccTO(x-32),p(a,x,v),this.currentChannel=G,!0},m.parseMidrow=function(a,x){var v=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[v];return S?(S.ccMIDROW(x),this.logger.log(L.DEBUG,"MIDROW ("+T([a,x])+")"),!0):!1}return!1},m.parsePAC=function(a,x){var v,S=this.cmdHistory,I=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,G=(a===16||a===24)&&x>=64&&x<=95;if(!(I||G))return!1;if(k(a,x,S))return p(null,null,S),!0;var V=a<=23?1:2;x>=64&&x<=95?v=V===1?M[a]:y[a]:v=V===1?O[a]:A[a];var Q=this.channels[V];return Q?(Q.setPAC(this.interpretPAC(v,x)),p(a,x,S),this.currentChannel=V,!0):!1},m.interpretPAC=function(a,x){var v,S={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?v=x-96:v=x-64,S.underline=(v&1)===1,v<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((v-16)/2)*4,S},m.parseChars=function(a,x){var v,S=null,I=null;if(a>=25?(v=2,I=a-8):(v=1,I=a),I>=17&&I<=19){var G;I===17?G=x+80:I===18?G=x+112:G=x+144,this.logger.log(L.INFO,"Special char '"+P(G)+"' in channel "+v),S=[G]}else a>=32&&a<=127&&(S=x===0?[a]:[a,x]);if(S){var V=T(S);this.logger.log(L.DEBUG,"Char codes = "+V.join(",")),p(a,x,this.cmdHistory)}return S},m.parseBackgroundAttributes=function(a,x){var v=(a===16||a===24)&&x>=32&&x<=47,S=(a===23||a===31)&&x>=45&&x<=47;if(!(v||S))return!1;var I,G={};a===16||a===24?(I=Math.floor((x-32)/2),G.background=R[I],x%2===1&&(G.background=G.background+"_semi")):x===45?G.background="transparent":(G.foreground="black",x===47&&(G.underline=!0));var V=a<=23?1:2,Q=this.channels[V];return Q.setBkgData(G),p(a,x,this.cmdHistory),!0},m.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=b()},m.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var v=this.channels[x];v&&v.cueSplitAtTime(a)}},f}();function p(f,m,d){d.a=f,d.b=m}function k(f,m,d){return d.a===f&&d.b===m}function b(){return{a:null,b:null}}Z.default=g},"./src/utils/codecs.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"isCodecType",function(){return N}),D.d(Z,"isCodecSupportedInMp4",function(){return P});var Y={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 N(H,W){var M=Y[W];return!!M&&M[H.slice(0,4)]===!0}function P(H,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/utils/vttparser.ts"),N=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),H=/\s/,W={newCue:function(O,y,A,R){for(var L=[],w,T,u,o,l,h=self.VTTCue||self.TextTrackCue,C=0;C<R.rows.length;C++)if(w=R.rows[C],u=!0,o=0,l="",!w.isEmpty()){for(var g=0;g<w.chars.length;g++)H.test(w.chars[g].uchar)&&u?o++:(l+=w.chars[g].uchar,u=!1);w.cueStartTime=y,y===A&&(A+=1e-4),o>=16?o--:o++;var p=Object(Y.fixLineBreaks)(l.trim()),k=Object(N.generateCueId)(y,A,p);(!O||!O.cues||!O.cues.getCueById(k))&&(T=new h(y,A,p),T.id=k,T.line=C+1,T.align="left",T.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(T))}return O&&L.length&&(L.sort(function(b,f){return b.line==="auto"||f.line==="auto"?0:b.line>8&&f.line>8?f.line-b.line:b.line-f.line}),L.forEach(function(b){return Object(P.addCueToTrack)(O,b)})),L}};Z.default=W},"./src/utils/discontinuities.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"findFirstFragWithCC",function(){return H}),D.d(Z,"shouldAlignOnDiscontinuities",function(){return W}),D.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),D.d(Z,"adjustSlidingStart",function(){return y}),D.d(Z,"alignStream",function(){return A}),D.d(Z,"alignPDT",function(){return L}),D.d(Z,"alignFragmentByPDTDelta",function(){return w}),D.d(Z,"alignMediaPlaylistByPDT",function(){return T});var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function H(u,o){for(var l=null,h=0,C=u.length;h<C;h++){var g=u[h];if(g&&g.cc===o){l=g;break}}return l}function W(u,o,l){return!!(o.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function M(u,o){var l=u.fragments,h=o.fragments;if(!h.length||!l.length){N.logger.log("No fragments to align");return}var C=H(l,h[0].cc);if(!C||C&&!C.startPTS){N.logger.log("No frag in previous level to align on");return}return C}function O(u,o){if(u){var l=u.start+o;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function y(u,o){for(var l=o.fragments,h=0,C=l.length;h<C;h++)O(l[h],u);o.fragmentHint&&O(o.fragmentHint,u),o.alignedSliding=!0}function A(u,o,l){if(!o)return;R(u,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(P.adjustSliding)(o.details,l)}function R(u,o,l){if(W(u,l,o)){var h=M(l.details,o);h&&Object(Y.isFiniteNumber)(h.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(h.start,o))}}function L(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=u.fragments[0].programDateTime,C=(h-l)/1e3+o.fragments[0].start;C&&Object(Y.isFiniteNumber)(C)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+C.toFixed(3)+" "+u.url+" "),y(C,u))}function w(u,o){var l=u.programDateTime;if(!l)return;var h=(l-o)/1e3;u.start=u.startPTS=h,u.endPTS=h+u.duration}function T(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=o.fragments[0].start,C=l-h*1e3;u.fragments.forEach(function(g){w(g,C)}),u.fragmentHint&&w(u.fragmentHint,C),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/utils/ewma.ts"),N=function(){function P(W,M,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(W),this.fast_=new Y.default(M)}var H=P.prototype;return H.update=function(M,O){var y=this.slow_,A=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new Y.default(M,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new Y.default(O,A.getEstimate(),A.getTotalWeight()))},H.sample=function(M,O){M=Math.max(M,this.minDelayMs_);var y=8*O,A=M/1e3,R=y/A;this.fast_.sample(A,R),this.slow_.sample(A,R)},H.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},P}();Z.default=N},"./src/utils/ewma.ts":function(re,Z,D){"use strict";D.r(Z);var Y=function(){function N(H,W,M){W===void 0&&(W=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=W,this.totalWeight_=M}var P=N.prototype;return P.sample=function(W,M){var O=Math.pow(this.alpha_,W);this.estimate_=M*(1-O)+O*this.estimate_,this.totalWeight_+=W},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},N}();Z.default=Y},"./src/utils/fetch-loader.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"fetchSupported",function(){return w});var Y=D("./src/polyfills/number.ts"),N=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function H(h,C){h.prototype=Object.create(C.prototype),h.prototype.constructor=h,A(h,C)}function W(h){var C=typeof Map=="function"?new Map:void 0;return W=function(p){if(p===null||!y(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(p))return C.get(p);C.set(p,k)}function k(){return M(p,arguments,R(this).constructor)}return k.prototype=Object.create(p.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),A(k,p)},W(h)}function M(h,C,g){return O()?M=Reflect.construct:M=function(k,b,f){var m=[null];m.push.apply(m,b);var d=Function.bind.apply(k,m),a=new d;return f&&A(a,f.prototype),a},M.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function y(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function A(h,C){return A=Object.setPrototypeOf||function(p,k){return p.__proto__=k,p},A(h,C)}function R(h){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},R(h)}function L(){return L=Object.assign||function(h){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(h[p]=g[p])}return h},L.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var T=function(){function h(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new N.LoadStats}var C=h.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(p,k,b){var f=this,m=this.stats;if(m.loading.start)throw new Error("Loader can only be used once.");m.loading.start=self.performance.now();var d=u(p,this.controller.signal),a=b.onProgress,x=p.responseType==="arraybuffer",v=x?"byteLength":"length";this.context=p,this.config=k,this.callbacks=b,this.request=this.fetchSetup(p,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),b.onTimeout(m,p,f.response)},k.timeout),self.fetch(this.request).then(function(S){if(f.response=f.loader=S,!S.ok){var I=S.status,G=S.statusText;throw new l(G||"fetch, bad network response",I,S)}return m.loading.first=Math.max(self.performance.now(),m.loading.start),m.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(Y.isFiniteNumber)(k.highWaterMark)?f.loadProgressively(S,m,p,k.highWaterMark,a):x?S.arrayBuffer():S.text()}).then(function(S){var I=f.response;self.clearTimeout(f.requestTimeout),m.loading.end=Math.max(self.performance.now(),m.loading.first),m.loaded=m.total=S[v];var G={url:I.url,data:S};a&&!Object(Y.isFiniteNumber)(k.highWaterMark)&&a(m,p,S,I),b.onSuccess(G,m,p,I)}).catch(function(S){if(self.clearTimeout(f.requestTimeout),m.aborted)return;var I=S.code||0;b.onError({code:I,text:S.message},p,S.details)})},C.getCacheAge=function(){var p=null;if(this.response){var k=this.response.headers.get("age");p=k?parseFloat(k):null}return p},C.loadProgressively=function(p,k,b,f,m){f===void 0&&(f=0);var d=new P.default,a=p.body.getReader(),x=function v(){return a.read().then(function(S){if(S.done)return d.dataLength&&m(k,b,d.flush(),p),Promise.resolve(new ArrayBuffer(0));var I=S.value,G=I.length;return k.loaded+=G,G<f||d.dataLength?(d.push(I),d.dataLength>=f&&m(k,b,d.flush(),p)):m(k,b,I,p),v()}).catch(function(){return Promise.reject()})};return x()},h}();function u(h,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(L({},h.headers))};return h.rangeEnd&&g.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),g}function o(h,C){return new self.Request(h.url,C)}var l=function(h){H(C,h);function C(g,p,k){var b;return b=h.call(this,g)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=k,b}return C}(W(Error));Z.default=T},"./src/utils/imsc1-ttml-parser.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"IMSC1_CODEC",function(){return y}),D.d(Z,"parseIMSC1",function(){return w});var Y=D("./src/utils/mp4-tools.ts"),N=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),H=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),M=D("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(f){for(var m=1;m<arguments.length;m++){var d=arguments[m];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(f[a]=d[a])}return f},O.apply(this,arguments)}var y="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(f,m,d,a,x){var v=Object(Y.findBox)(new Uint8Array(f),["mdat"]);if(v.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var S=v[0],I=Object(H.utf8ArrayToStr)(new Uint8Array(f,S.start,S.end-S.start)),G=Object(W.toTimescaleFromScale)(m,1,d);try{a(T(I,G))}catch(V){x(V)}}function T(f,m){var d=new DOMParser,a=d.parseFromString(f,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(v).reduce(function(z,U){return z[U]=x.getAttribute("ttp:"+U)||v[U],z},{}),I=x.getAttribute("xml:space")!=="preserve",G=o(u(x,"styling","style")),V=o(u(x,"layout","region")),Q=u(x,"body","[begin]");return[].map.call(Q,function(z){var U=l(z,I);if(!U||!z.hasAttribute("begin"))return null;var q=p(z.getAttribute("begin"),S),ae=p(z.getAttribute("dur"),S),ce=p(z.getAttribute("end"),S);if(q===null)throw g(z);if(ce===null){if(ae===null)throw g(z);ce=q+ae}var ve=new P.default(q-m,ce-m,U);ve.id=Object(M.generateCueId)(ve.startTime,ve.endTime,ve.text);var Oe=V[z.getAttribute("region")],xe=G[z.getAttribute("style")];ve.position=10,ve.size=80;var Te=h(Oe,xe),Ce=Te.textAlign;if(Ce){var Se=L[Ce];Se&&(ve.lineAlign=Se),ve.align=Ce}return O(ve,Te),ve}).filter(function(z){return z!==null})}function u(f,m,d){var a=f.getElementsByTagName(m)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(f){return f.reduce(function(m,d){var a=d.getAttribute("xml:id");return a&&(m[a]=d),m},{})}function l(f,m){return[].slice.call(f.childNodes).reduce(function(d,a,x){var v;return a.nodeName==="br"&&x?d+`
|
|
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?l(a,m):m?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function h(f,m){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,v){var S=C(m,d,v)||C(f,d,v);return S&&(x[v]=S),x},{})}function C(f,m,d){return f.hasAttributeNS(m,d)?f.getAttributeNS(m,d):null}function g(f){return new Error("Could not parse ttml timestamp "+f)}function p(f,m){if(!f)return null;var d=Object(N.parseTimeStamp)(f);return d===null&&(A.test(f)?d=k(f,m):R.test(f)&&(d=b(f,m))),d}function k(f,m){var d=A.exec(f),a=(d[4]|0)+(d[5]|0)/m.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/m.frameRate}function b(f,m){var d=R.exec(f),a=Number(d[1]),x=d[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/m.frameRate;case"t":return a/m.tickRate}return a}},"./src/utils/logger.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"enableLogs",function(){return M}),D.d(Z,"logger",function(){return O});var Y=function(){},N={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},P=N;function H(y){var A=self.console[y];return A?A.bind(self.console,"["+y+"] >"):Y}function W(y){for(var A=arguments.length,R=new Array(A>1?A-1:0),L=1;L<A;L++)R[L-1]=arguments[L];R.forEach(function(w){P[w]=y[w]?y[w].bind(y):H(w)})}function M(y){if(self.console&&y===!0||typeof y=="object"){W(y,"debug","log","info","warn","error");try{P.log()}catch(A){P=N}}else P=N}var O=P},"./src/utils/mediakeys-helper.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"KeySystems",function(){return Y}),D.d(Z,"requestMediaKeySystemAccess",function(){return N});var Y;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"bin2str",function(){return W}),D.d(Z,"readUint16",function(){return M}),D.d(Z,"readUint32",function(){return O}),D.d(Z,"writeUint32",function(){return y}),D.d(Z,"findBox",function(){return A}),D.d(Z,"parseSegmentIndex",function(){return R}),D.d(Z,"parseInitSegment",function(){return L}),D.d(Z,"getStartDTS",function(){return w}),D.d(Z,"getDuration",function(){return T}),D.d(Z,"computeRawDurationFromSamples",function(){return u}),D.d(Z,"offsetStartDTS",function(){return o}),D.d(Z,"segmentValidRange",function(){return l}),D.d(Z,"appendUint8Array",function(){return h});var Y=D("./src/utils/typed-array.ts"),N=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,H=[].push;function W(C){return String.fromCharCode.apply(null,C)}function M(C,g){"data"in C&&(g+=C.start,C=C.data);var p=C[g]<<8|C[g+1];return p<0?65536+p:p}function O(C,g){"data"in C&&(g+=C.start,C=C.data);var p=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return p<0?4294967296+p:p}function y(C,g,p){"data"in C&&(g+=C.start,C=C.data),C[g]=p>>24,C[g+1]=p>>16&255,C[g+2]=p>>8&255,C[g+3]=p&255}function A(C,g){var p=[];if(!g.length)return p;var k,b,f;"data"in C?(k=C.data,b=C.start,f=C.end):(k=C,b=0,f=k.byteLength);for(var m=b;m<f;){var d=O(k,m),a=W(k.subarray(m+4,m+8)),x=d>1?m+d:f;if(a===g[0])if(g.length===1)p.push({data:k,start:m+8,end:x});else{var v=A({data:k,start:m+8,end:x},g.slice(1));v.length&&H.apply(p,v)}m=x}return p}function R(C){var g=A(C,["moov"]),p=g[0],k=p?p.end:null,b=A(C,["sidx"]);if(!b||!b[0])return null;var f=[],m=b[0],d=m.data[0],a=d===0?8:16,x=O(m,a);a+=4;var v=0,S=0;d===0?a+=8:a+=16,a+=2;var I=m.end+S,G=M(m,a);a+=2;for(var V=0;V<G;V++){var Q=a,z=O(m,Q);Q+=4;var U=z&2147483647,q=(z&2147483648)>>>31;if(q===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ae=O(m,Q);Q+=4,f.push({referenceSize:U,subsegmentDuration:ae,info:{duration:ae/x,start:I,end:I+U-1}}),I+=U,Q+=4,a=Q}return{earliestPresentationTime:v,timescale:x,version:d,referencesCount:G,references:f,moovEndOffset:k}}function L(C){for(var g=[],p=A(C,["moov","trak"]),k=0;k<p.length;k++){var b=p[k],f=A(b,["tkhd"])[0];if(f){var m=f.data[f.start],d=m===0?12:20,a=O(f,d),x=A(b,["mdia","mdhd"])[0];if(x){m=x.data[x.start],d=m===0?12:20;var v=O(x,d),S=A(b,["mdia","hdlr"])[0];if(S){var I=W(S.data.subarray(S.start+8,S.start+12)),G={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[I];if(G){var V=A(b,["mdia","minf","stbl","stsd"])[0],Q=void 0;V&&(Q=W(V.data.subarray(V.start+12,V.start+16))),g[a]={timescale:v,type:G},g[G]={timescale:v,id:a,codec:Q}}}}}}var z=A(C,["moov","mvex","trex"]);return z.forEach(function(U){var q=O(U,4),ae=g[q];ae&&(ae.default={duration:O(U,12),flags:O(U,20)})}),g}function w(C,g){return A(g,["moof","traf"]).reduce(function(p,k){var b=A(k,["tfdt"])[0],f=b.data[b.start],m=A(k,["tfhd"]).reduce(function(d,a){var x=O(a,4),v=C[x];if(v){var S=O(b,4);f===1&&(S*=Math.pow(2,32),S+=O(b,8));var I=v.timescale||9e4,G=S/I;if(isFinite(G)&&(d===null||G<d))return G}return d},null);return m!==null&&isFinite(m)&&(p===null||m<p)?m:p},null)||0}function T(C,g){for(var p=0,k=0,b=0,f=A(C,["moof","traf"]),m=0;m<f.length;m++){var d=f[m],a=A(d,["tfhd"])[0],x=O(a,4),v=g[x];if(!v)continue;var S=v.default,I=O(a,0)|(S==null?void 0:S.flags),G=S==null?void 0:S.duration;I&8&&(I&2?G=O(a,12):G=O(a,8));for(var V=v.timescale||9e4,Q=A(d,["trun"]),z=0;z<Q.length;z++){if(G){var U=O(Q[z],4);p=G*U}else p=u(Q[z]);v.type===N.ElementaryStreamTypes.VIDEO?k+=p/V:v.type===N.ElementaryStreamTypes.AUDIO&&(b+=p/V)}}if(k===0&&b===0){var q=R(C);if(q!=null&&q.references)return q.references.reduce(function(ae,ce){return ae+ce.info.duration||0},0)}return k||b}function u(C){var g=O(C,0),p=8;g&1&&(p+=4),g&4&&(p+=4);for(var k=0,b=O(C,4),f=0;f<b;f++){if(g&256){var m=O(C,p);k+=m,p+=4}g&512&&(p+=4),g&1024&&(p+=4),g&2048&&(p+=4)}return k}function o(C,g,p){A(g,["moof","traf"]).forEach(function(k){A(k,["tfhd"]).forEach(function(b){var f=O(b,4),m=C[f];if(!m)return;var d=m.timescale||9e4;A(k,["tfdt"]).forEach(function(a){var x=a.data[a.start],v=O(a,4);if(x===0)y(a,4,v-p*d);else{v*=Math.pow(2,32),v+=O(a,8),v-=p*d,v=Math.max(v,0);var S=Math.floor(v/(P+1)),I=Math.floor(v%(P+1));y(a,4,S),y(a,8,I)}})})})}function l(C){var g={valid:null,remainder:null},p=A(C,["moof"]);if(p){if(p.length<2)return g.remainder=C,g}else return g;var k=p[p.length-1];return g.valid=Object(Y.sliceUint8)(C,0,k.start-8),g.remainder=Object(Y.sliceUint8)(C,k.start-8),g}function h(C,g){var p=new Uint8Array(C.length+g.length);return p.set(C),p.set(g,C.length),p}},"./src/utils/output-filter.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"default",function(){return Y});var Y=function(){function N(H,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=W}var P=N.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(W,M,O){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=M,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"sendAddTrackEvent",function(){return N}),D.d(Z,"addCueToTrack",function(){return P}),D.d(Z,"clearCurrentCues",function(){return H}),D.d(Z,"removeCuesInRange",function(){return W}),D.d(Z,"getCuesInRange",function(){return O});var Y=D("./src/utils/logger.ts");function N(y,A){var R;try{R=new Event("addtrack")}catch(L){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=y,A.dispatchEvent(R)}function P(y,A){var R=y.mode;if(R==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(A.id))try{if(y.addCue(A),!y.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(w){Y.logger.debug("[texttrack-utils]: "+w);var L=new self.TextTrackCue(A.startTime,A.endTime,A.text);L.id=A.id,y.addCue(L)}R==="disabled"&&(y.mode=R)}function H(y){var A=y.mode;if(A==="disabled"&&(y.mode="hidden"),y.cues)for(var R=y.cues.length;R--;)y.removeCue(y.cues[R]);A==="disabled"&&(y.mode=A)}function W(y,A,R){var L=y.mode;if(L==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var w=O(y.cues,A,R),T=0;T<w.length;T++)y.removeCue(w[T]);L==="disabled"&&(y.mode=L)}function M(y,A){if(A<y[0].startTime)return 0;var R=y.length-1;if(A>y[R].endTime)return-1;for(var L=0,w=R;L<=w;){var T=Math.floor((w+L)/2);if(A<y[T].startTime)w=T-1;else if(A>y[T].startTime&&L<R)L=T+1;else return T}return y[L].startTime-A<A-y[w].startTime?L:w}function O(y,A,R){var L=[],w=M(y,A);if(w>-1)for(var T=w,u=y.length;T<u;T++){var o=y[T];if(o.startTime>=A&&o.endTime<=R)L.push(o);else if(o.startTime>R)return L}return L}},"./src/utils/time-ranges.ts":function(re,Z,D){"use strict";D.r(Z);var Y={toString:function(P){for(var H="",W=P.length,M=0;M<W;M++)H+="["+P.start(M).toFixed(3)+","+P.end(M).toFixed(3)+"]";return H}};Z.default=Y},"./src/utils/timescale-conversion.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"toTimescaleFromBase",function(){return N}),D.d(Z,"toTimescaleFromScale",function(){return P}),D.d(Z,"toMsFromMpegTsClock",function(){return H}),D.d(Z,"toMpegTsClockFromTimescale",function(){return W});var Y=9e4;function N(M,O,y,A){y===void 0&&(y=1),A===void 0&&(A=!1);var R=M*O*y;return A?Math.round(R):R}function P(M,O,y,A){return y===void 0&&(y=1),A===void 0&&(A=!1),N(M,O,1/y,A)}function H(M,O){return O===void 0&&(O=!1),N(M,1e3,1/Y,O)}function W(M,O){return O===void 0&&(O=1),N(M,Y,1/O)}},"./src/utils/typed-array.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"sliceUint8",function(){return Y});function Y(N,P,H){return Uint8Array.prototype.slice?N.slice(P,H):new Uint8Array(Array.prototype.slice.call(N,P,H))}},"./src/utils/vttcue.ts":function(re,Z,D){"use strict";D.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],N=["start","middle","end","left","right"];function P(y,A){if(typeof A!="string")return!1;if(!Array.isArray(y))return!1;var R=A.toLowerCase();return~y.indexOf(R)?R:!1}function H(y){return P(Y,y)}function W(y){return P(N,y)}function M(y){for(var A=arguments.length,R=new Array(A>1?A-1:0),L=1;L<A;L++)R[L-1]=arguments[L];for(var w=1;w<arguments.length;w++){var T=arguments[w];for(var u in T)y[u]=T[u]}return y}function O(y,A,R){var L=this,w={enumerable:!0};L.hasBeenReset=!1;var T="",u=!1,o=y,l=A,h=R,C=null,g="",p=!0,k="auto",b="start",f=50,m="middle",d=50,a="middle";Object.defineProperty(L,"id",M({},w,{get:function(){return T},set:function(v){T=""+v}})),Object.defineProperty(L,"pauseOnExit",M({},w,{get:function(){return u},set:function(v){u=!!v}})),Object.defineProperty(L,"startTime",M({},w,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",M({},w,{get:function(){return l},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",M({},w,{get:function(){return h},set:function(v){h=""+v,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",M({},w,{get:function(){return C},set:function(v){C=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",M({},w,{get:function(){return g},set:function(v){var S=H(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",M({},w,{get:function(){return p},set:function(v){p=!!v,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",M({},w,{get:function(){return k},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",M({},w,{get:function(){return b},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");b=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",M({},w,{get:function(){return f},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",M({},w,{get:function(){return m},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",M({},w,{get:function(){return d},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");d=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",M({},w,{get:function(){return a},set:function(v){var S=W(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),L.displayState=void 0}return O.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"parseTimeStamp",function(){return P}),D.d(Z,"fixLineBreaks",function(){return A}),D.d(Z,"VTTParser",function(){return R});var Y=D("./src/utils/vttcue.ts"),N=function(){function L(){}var w=L.prototype;return w.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},L}();function P(L){function w(u,o,l,h){return(u|0)*3600+(o|0)*60+(l|0)+parseFloat(h||0)}var T=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return T?parseFloat(T[2])>59?w(T[2],T[3],0,T[4]):w(T[1],T[2],T[3],T[4]):null}var H=function(){function L(){this.values=Object.create(null)}var w=L.prototype;return w.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},w.get=function(u,o,l){return l?this.has(u)?this.values[u]:o[l]:this.has(u)?this.values[u]:o},w.has=function(u){return u in this.values},w.alt=function(u,o,l){for(var h=0;h<l.length;++h)if(o===l[h]){this.set(u,o);break}},w.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},w.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},L}();function W(L,w,T,u){var o=u?L.split(u):[L];for(var l in o){if(typeof o[l]!="string")continue;var h=o[l].split(T);if(h.length!==2)continue;var C=h[0],g=h[1];w(C,g)}}var M=new Y.default(0,0,""),O=M.align==="middle"?"middle":"center";function y(L,w,T){var u=L;function o(){var C=P(L);if(C===null)throw new Error("Malformed timestamp: "+u);return L=L.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,g){var p=new H;W(C,function(f,m){var d;switch(f){case"region":for(var a=T.length-1;a>=0;a--)if(T[a].id===m){p.set(f,T[a].region);break}break;case"vertical":p.alt(f,m,["rl","lr"]);break;case"line":d=m.split(","),p.integer(f,d[0]),p.percent(f,d[0])&&p.set("snapToLines",!1),p.alt(f,d[0],["auto"]),d.length===2&&p.alt("lineAlign",d[1],["start",O,"end"]);break;case"position":d=m.split(","),p.percent(f,d[0]),d.length===2&&p.alt("positionAlign",d[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":p.percent(f,m);break;case"align":p.alt(f,m,["start",O,"end","left","right"]);break}},/:/,/\s/),g.region=p.get("region",null),g.vertical=p.get("vertical","");var k=p.get("line","auto");k==="auto"&&M.line===-1&&(k=-1),g.line=k,g.lineAlign=p.get("lineAlign","start"),g.snapToLines=p.get("snapToLines",!0),g.size=p.get("size",100),g.align=p.get("align",O);var b=p.get("position","auto");b==="auto"&&M.position===50&&(b=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=b}function h(){L=L.replace(/^\s+/,"")}if(h(),w.startTime=o(),h(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);L=L.substr(3),h(),w.endTime=o(),h(),l(L,w)}function A(L){return L.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=L.prototype;return w.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function l(){var b=o.buffer,f=0;for(b=A(b);f<b.length&&b[f]!=="\r"&&b[f]!==`
|
|
`;)++f;var m=b.substr(0,f);return b[f]==="\r"&&++f,b[f]===`
|
|
`&&++f,o.buffer=b.substr(f),m}function h(b){W(b,function(f,m){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=l();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:C=l();switch(o.state){case"HEADER":/:/.test(C)?h(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new Y.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(C,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var k=C.indexOf("-->")!==-1;if(!C||k&&(p=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(re,Z,D){"use strict";D.r(Z),D.d(Z,"generateCueId",function(){return R}),D.d(Z,"parseWebVTT",function(){return w});var Y=D("./src/polyfills/number.ts"),N=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),H=D("./src/utils/timescale-conversion.ts"),W=D("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,O=function(u,o,l){return l===void 0&&(l=0),u.substr(l,o.length)===o},y=function(u){var o=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),h=parseInt(u.substr(-9,2)),C=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(o)||!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(h)||!Object(Y.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*l,o+=60*1e3*h,o+=60*60*1e3*C,o},A=function(u){for(var o=5381,l=u.length;l;)o=o*33^u.charCodeAt(--l);return(o>>>0).toString()};function R(T,u,o){return A(T.toString())+A(u.toString())+A(o)}var L=function(u,o,l){var h=u[o],C=u[h.prevCC];if(!C||!C.new&&h.new){u.ccOffset=u.presentationOffset=h.start,h.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;u.ccOffset+=h.start-C.start,h.new=!1,h=C,C=u[h.prevCC]}u.presentationOffset=l};function w(T,u,o,l,h,C,g,p){var k=new N.VTTParser,b=Object(P.utf8ArrayToStr)(new Uint8Array(T)).trim().replace(M,`
|
|
`).split(`
|
|
`),f=[],m=Object(H.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,x=0,v,S=!0,I=!1;k.oncue=function(G){var V=l[h],Q=l.ccOffset,z=(a-m)/9e4;if(V!=null&&V.new&&(x!==void 0?Q=l.ccOffset=V.start:L(l,h,z)),z&&(Q=z-l.presentationOffset),I){var U=G.endTime-G.startTime,q=Object(W.normalizePts)((G.startTime+Q-x)*9e4,C*9e4)/9e4;G.startTime=q,G.endTime=q+U}var ae=G.text.trim();G.text=decodeURIComponent(encodeURIComponent(ae)),G.id||(G.id=R(G.startTime,G.endTime,ae)),G.endTime>0&&f.push(G)},k.onparsingerror=function(G){v=G},k.onflush=function(){if(v){p(v);return}g(f)},b.forEach(function(G){if(S)if(O(G,"X-TIMESTAMP-MAP=")){S=!1,I=!0,G.substr(16).split(",").forEach(function(V){O(V,"LOCAL:")?d=V.substr(6):O(V,"MPEGTS:")&&(a=parseInt(V.substr(7)))});try{x=y(d)/1e3}catch(V){I=!1,v=V}return}else G===""&&(S=!1);k.parse(G+`
|
|
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(re,Z,D){"use strict";D.r(Z);var Y=D("./src/utils/logger.ts"),N=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,H=function(){function W(O){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=O?O.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var M=W.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.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()))},M.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(y,A,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=A,this.callbacks=R,this.retryDelay=A.retryDelay,this.loadInternal()},M.loadInternal=function(){var y=this.config,A=this.context;if(!y)return;var R=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var w=this.xhrSetup;try{if(w)try{w(R,A.url)}catch(o){R.open("GET",A.url,!0),w(R,A.url)}R.readyState||R.open("GET",A.url,!0);var T=this.context.headers;if(T)for(var u in T)R.setRequestHeader(u,T[u])}catch(o){this.callbacks.onError({code:R.status,text:o.message},A,R);return}A.rangeEnd&&R.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),R.send()},M.readystatechange=function(){var y=this.context,A=this.loader,R=this.stats;if(!y||!A)return;var L=A.readyState,w=this.config;if(R.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),L===4){A.onreadystatechange=null,A.onprogress=null;var T=A.status;if(T>=200&&T<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var u,o;if(y.responseType==="arraybuffer"?(u=A.response,o=u.byteLength):(u=A.responseText,o=u.length),R.loaded=R.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(R,y,u,A),!this.callbacks)return;var h={url:A.responseURL,data:u};this.callbacks.onSuccess(h,R,y,A)}else R.retry>=w.maxRetry||T>=400&&T<499?(Y.logger.error(T+" while loading "+y.url),this.callbacks.onError({code:T,text:A.statusText},y,A)):(Y.logger.warn(T+" 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,w.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},M.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(y){var A=this.stats;A.loaded=y.loaded,y.lengthComputable&&(A.total=y.total)},M.getCacheAge=function(){var y=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");y=A?parseFloat(A):null}return y},W}();Z.default=H}}).default})},vHTk:function(wt,pt,se){wt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|