You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Shixuns__New.e6547d28.as...

366 lines
959 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[251,6,7],{"+NIl":function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(J,k){"use strict";function $(A,_){A.cmdState.push(_)}function O(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function M(A){var _=A.cmdState.pop();_&&_.closeBracket()}function z(A){for(var _=A.cmdState,C=_.length-1;C>=0;C--){var l=_[C];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function H(A,_,C){return function(){this.name=A,this.bracketNo=0,this.style=_,this.styles=C,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var U={};U.importmodule=H("importmodule","tag",["string","builtin"]),U.documentclass=H("documentclass","tag",["","atom"]),U.usepackage=H("usepackage","tag",["atom"]),U.begin=H("begin","tag",["atom"]),U.end=H("end","tag",["atom"]),U.label=H("label","tag",["atom"]),U.ref=H("ref","tag",["atom"]),U.eqref=H("eqref","tag",["atom"]),U.cite=H("cite","tag",["atom"]),U.bibitem=H("bibitem","tag",["atom"]),U.Bibitem=H("Bibitem","tag",["atom"]),U.RBibitem=H("RBibitem","tag",["atom"]),U.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(A,_){A.f=_}function m(A,_){var C;if(A.match(/^\\[a-zA-Z@]+/)){var l=A.current().slice(1);return C=U.hasOwnProperty(l)?U[l]:U.DEFAULT,C=new C,$(_,C),R(_,D),C.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return R(_,function(s,d){return S(s,d,"\\]")}),"keyword";if(A.match("\\("))return R(_,function(s,d){return S(s,d,"\\)")}),"keyword";if(A.match("$$"))return R(_,function(s,d){return S(s,d,"$$")}),"keyword";if(A.match("$"))return R(_,function(s,d){return S(s,d,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=O(_),C)C.closeBracket(o),R(_,D);else return"error";return"bracket"}else return o=="{"||o=="["?(C=U.DEFAULT,C=new C,$(_,C),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),C=z(_),C.name=="begin"&&(C.argument=A.current()),C.styleIdentifier())}function S(A,_,C){if(A.eatSpace())return null;if(C&&A.match(C))return R(_,m),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=A.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(A.skipToEnd(),"comment"):"error"}function D(A,_){var C=A.peek(),l;return C=="{"||C=="["?(l=O(_),l.openBracket(C),A.eat(C),R(_,m),"bracket"):/[ \t\r]/.test(C)?(A.eat(C),null):(R(_,m),M(_),m(A,_))}return{startState:function(){var A=k.inMathMode?function(_,C){return S(_,C)}:m;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,_){return _.f(A,_)},blankLine:function(A){A.f=m,A.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"19Vz":function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){le.defineOption("placeholder","",function(H,U,R){var m=R&&R!=le.Init;if(U&&!m)H.on("blur",O),H.on("change",M),H.on("swapDoc",M),le.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){$(H)}),M(H);else if(!U&&m){H.off("blur",O),H.off("change",M),H.off("swapDoc",M),le.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),J(H);var S=H.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}U&&!H.hasFocus()&&O(H)});function J(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function k(H){J(H);var U=H.state.placeholder=document.createElement("pre");U.style.cssText="height: 0; overflow: visible",U.style.direction=H.getOption("direction"),U.className="CodeMirror-placeholder CodeMirror-line-like";var R=H.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),U.appendChild(R),H.display.lineSpace.insertBefore(U,H.display.lineSpace.firstChild)}function $(H){setTimeout(function(){var U=!1,R=H.getInputField();R.nodeName=="TEXTAREA"?U=!R.value:H.lineCount()==1&&(U=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),U?k(H):J(H)},20)}function O(H){z(H)&&k(H)}function M(H){var U=H.getWrapperElement(),R=z(H);U.className=U.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?k(H):J(H)}function z(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var J={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},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function($,O){var M=$.indentUnit,z={},H=O.htmlMode?J:k;for(var U in H)z[U]=H[U];for(var U in O)z[U]=O[U];var R,m;function S(a,E){function y(F){return E.tokenize=F,F(a,E)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(_("atom","]]>")):null:a.match("--")?y(_("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),E.tokenize=_("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",E.tokenize=D,"tag bracket");if(x=="&"){var B;return a.eat("#")?a.eat("x")?B=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):B=a.eatWhile(/[\d]/)&&a.eat(";"):B=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),B?"atom":"error"}else return a.eatWhile(/[^&<]/),null}S.isInText=!0;function D(a,E){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return E.tokenize=S,R=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return R="equals",null;if(y=="<"){E.tokenize=S,E.state=d,E.tagName=E.tagStart=null;var x=E.tokenize(a,E);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(y)?(E.tokenize=A(y),E.stringStartCol=a.column(),E.tokenize(a,E)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var E=function(y,x){for(;!y.eol();)if(y.next()==a){x.tokenize=D;break}return"string"};return E.isInAttribute=!0,E}function _(a,E){return function(y,x){for(;!y.eol();){if(y.match(E)){x.tokenize=S;break}y.next()}return a}}function C(a){return function(E,y){for(var x;(x=E.next())!=null;){if(x=="<")return y.tokenize=C(a+1),y.tokenize(E,y);if(x==">")if(a==1){y.tokenize=S;break}else return y.tokenize=C(a-1),y.tokenize(E,y)}return"meta"}}function l(a,E,y){this.prev=a.context,this.tagName=E,this.indent=a.indented,this.startOfLine=y,(z.doNotIndent.hasOwnProperty(E)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,E){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!z.contextGrabbers.hasOwnProperty(y)||!z.contextGrabbers[y].hasOwnProperty(E))return;o(a)}}function d(a,E,y){return a=="openTag"?(y.tagStart=E.column(),w):a=="closeTag"?g:d}function w(a,E,y){return a=="word"?(y.tagName=E.current(),m="tag",b):z.allowMissingTagName&&a=="endTag"?(m="tag bracket",b(a,E,y)):(m="error",w)}function g(a,E,y){if(a=="word"){var x=E.current();return y.context&&y.context.tagName!=x&&z.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==x||z.matchClosing===!1?(m="tag",v):(m="tag error",L)}else return z.allowMissingTagName&&a=="endTag"?(m="tag bracket",v(a,E,y)):(m="error",L)}function v(a,E,y){return a!="endTag"?(m="error",v):(o(y),d)}function L(a,E,y){return m="error",v(a,E,y)}function b(a,E,y){if(a=="word")return m="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var x=y.tagName,B=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(x)?s(y,x):(s(y,x),y.context=new l(y,x,B==y.indented)),d}return m="error",b}function c(a,E,y){return a=="equals"?p:(z.allowMissing||(m="error"),b(a,E,y))}function p(a,E,y){return a=="string"?h:a=="word"&&z.allowUnquoted?(m="string",b):(m="error",b(a,E,y))}function h(a,E,y){return a=="string"?h:b(a,E,y)}return{startState:function(a){var E={tokenize:S,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(E.baseIndent=a),E},token:function(a,E){if(!E.tagName&&a.sol()&&(E.indented=a.indentation()),a.eatSpace())return null;R=null;var y=E.tokenize(a,E);return(y||R)&&y!="comment"&&(m=null,E.state=E.state(R||y,a,E),m&&(y=m=="error"?y+" error":m)),y},indent:function(a,E,y){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(x&&x.noIndent)return le.Pass;if(a.tokenize!=D&&a.tokenize!=S)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var B=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(B&&B[1])for(;x;)if(x.tagName==B[2]){x=x.prev;break}else if(z.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(B)for(;x;){var F=z.contextGrabbers[x.tagName];if(F&&F.hasOwnProperty(B[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+M:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var E=[],y=a.context;y;y=y.prev)y.tagName&&E.push(y.tagName);return E.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6f40":function(pt,it,ie){pt.exports={practicalTraining:"practicalTraining___14zoU",titleWrap:"titleWrap___2awze",title:"title___3BF26",line:"line___wXl6Y",dec:"dec___ZXNkn"}},"7Cbv":function(pt,it,ie){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function k(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(J)}var $=/^(?:[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 O(D){return typeof D=="string"&&$.test(D)}for(var M=O,z=[],H=0;H<256;++H)z.push((H+256).toString(16).substr(1));function U(D){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=(z[D[A+0]]+z[D[A+1]]+z[D[A+2]]+z[D[A+3]]+"-"+z[D[A+4]]+z[D[A+5]]+"-"+z[D[A+6]]+z[D[A+7]]+"-"+z[D[A+8]]+z[D[A+9]]+"-"+z[D[A+10]]+z[D[A+11]]+z[D[A+12]]+z[D[A+13]]+z[D[A+14]]+z[D[A+15]]).toLowerCase();if(!M(_))throw TypeError("Stringified UUID is invalid");return _}var R=U;function m(D,A,_){D=D||{};var C=D.random||(D.rng||k)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,A){_=_||0;for(var l=0;l<16;++l)A[_+l]=C[l];return A}return R(C)}var S=it.a=m},"7ahc":function(pt,it,ie){"use strict";ie.d(it,"a",function(){return w});var le=ie("k1fw"),J=ie("0Owb"),k=ie("+L6B"),$=ie("2/Rp"),O=ie("y8nQ"),M=ie("Vl3Y"),z=ie("tJVT"),H=ie("OaEy"),U=ie("2fM7"),R=ie("q1tI"),m=ie.n(R),S=ie("VrN/"),D=ie.n(S),A=ie("p77/"),_=ie.n(A),C=ie("c5Ni"),l=ie.n(C),o=U.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};it.b=function(g){var v=g.callback,L=g.onCancel,b=Object(R.useState)("python"),c=Object(z.a)(b,2),p=c[0],h=c[1];function a(y){h(d[y][1])}function E(y){v(y)}return m.a.createElement(M.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),m.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(U.a,{onChange:a},Object.keys(d).map(function(y){return m.a.createElement(o,{key:y,value:y},d[y][0])}))),m.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(w,{mode:p})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement($.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(g){var v=g.value,L=g.onChange,b=g.mode,c=g.options,p=c===void 0?{}:c,h=Object(R.useRef)(),a=Object(R.useState)(),E=Object(z.a)(a,2),y=E[0],x=E[1];return Object(R.useEffect)(function(){if(y){function B(F){var K=F.getValue();L&&L(K)}return y.on("change",B),function(){y.off("change",B)}}},[y,L]),Object(R.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(R.useEffect)(function(){y&&((v!==y.getValue()||v==="")&&setTimeout(function(){y.setValue(v||" ")},300))},[y,v]),Object(R.useEffect)(function(){if(h.current&&!y){var B=D.a.fromTextArea(h.current,Object(le.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));x(B)}},[h.current,y]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:h}))}},"7ixt":function(pt,it,ie){"use strict";ie.d(it,"a",function(){return k});var le={adjustX:1,adjustY:1},J=[0,0],k={left:{points:["cr","cl"],overflow:le,offset:[-4,0],targetOffset:J},right:{points:["cl","cr"],overflow:le,offset:[4,0],targetOffset:J},top:{points:["bc","tc"],overflow:le,offset:[0,-4],targetOffset:J},bottom:{points:["tc","bc"],overflow:le,offset:[0,4],targetOffset:J},topLeft:{points:["bl","tl"],overflow:le,offset:[0,-4],targetOffset:J},leftTop:{points:["tr","tl"],overflow:le,offset:[-4,0],targetOffset:J},topRight:{points:["br","tr"],overflow:le,offset:[0,-4],targetOffset:J},rightTop:{points:["tl","tr"],overflow:le,offset:[4,0],targetOffset:J},bottomRight:{points:["tr","br"],overflow:le,offset:[0,4],targetOffset:J},rightBottom:{points:["bl","br"],overflow:le,offset:[4,0],targetOffset:J},bottomLeft:{points:["tl","bl"],overflow:le,offset:[0,4],targetOffset:J},leftBottom:{points:["br","bl"],overflow:le,offset:[-4,0],targetOffset:J}},$=k},"8EBN":function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.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 J=0;J<le.modeInfo.length;J++){var k=le.modeInfo[J];k.mimes&&(k.mime=k.mimes[0])}le.findModeByMIME=function($){$=$.toLowerCase();for(var O=0;O<le.modeInfo.length;O++){var M=le.modeInfo[O];if(M.mime==$)return M;if(M.mimes){for(var z=0;z<M.mimes.length;z++)if(M.mimes[z]==$)return M}}if(/\+xml$/.test($))return le.findModeByMIME("application/xml");if(/\+json$/.test($))return le.findModeByMIME("application/json")},le.findModeByExtension=function($){$=$.toLowerCase();for(var O=0;O<le.modeInfo.length;O++){var M=le.modeInfo[O];if(M.ext){for(var z=0;z<M.ext.length;z++)if(M.ext[z]==$)return M}}},le.findModeByFileName=function($){for(var O=0;O<le.modeInfo.length;O++){var M=le.modeInfo[O];if(M.file&&M.file.test($))return M}var z=$.lastIndexOf("."),H=z>-1&&$.substring(z+1,$.length);if(H)return le.findModeByExtension(H)},le.findModeByName=function($){$=$.toLowerCase();for(var O=0;O<le.modeInfo.length;O++){var M=le.modeInfo[O];if(M.name.toLowerCase()==$)return M;if(M.alias){for(var z=0;z<M.alias.length;z++)if(M.alias[z].toLowerCase()==$)return M}}}})},"8hTe":function(pt,it,ie){pt.exports={button:"button___1wy9m"}},"9Bee":function(pt,it,ie){"use strict";var le=ie("DYRE"),J=ie("zeV3"),k=ie("+L6B"),$=ie("2/Rp"),O=ie("k1fw"),M=ie("9og8"),z=ie("tJVT"),H=ie("WmNS"),U=ie.n(H),R=ie("q1tI"),m=ie.n(R),S=ie("vg9a"),D=ie("DlQD"),A=ie.n(D),_=ie("rUJ1");function C(G,u){var f=G.match(/^(\s+)(?:```)/);if(f===null)return u;var N=f[1];return u.split(`
`).map(function(Q){var W=Q.match(/^\s+/);if(W===null)return Q;var ye=Object(z.a)(W,1),He=ye[0];return He.length>=N.length?Q.slice(N.length):Q}).join(`
`)}var l=[],o=["<ul>"],s=new A.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){l.length=0,o=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(G,u,f,N){if(u>=G.length||G[u].level<=f)return u;var Q=G[u];N.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),u++;var W=[];return u=v(G,u,Q.level,W),W.length>0&&(N.push("<ul>"),W.forEach(function(ye){N.push(ye)}),N.push("</ul>")),N.push("</li>"),u=v(G,u,f,N),u}function L(){return v(l,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(u){var f=d.exec(u);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(u){var f=this.rules.block.fences.exec(u);if(f){var N=f[0],Q=C(N,f[3]||""),W=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(W)>=0){var ye=h(),He=Q;Q=ye,a[ye]={type:"block",expression:He}}return{type:"code",raw:N,lang:W,text:Q}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,h=function(){return"__special_katext_id_".concat(p++,"__")},a={};function E(){return a}function y(){p=0,a={}}function x(G){return G=G.replace(c,function(u,f){var N=h();return a[N]={type:"inline",expression:f},N}),G}var B=s.listitem;s.listitem=function(G){return B(x(G))};var F=s.paragraph;s.paragraph=function(G){return F(x(G))};var K=s.tablecell;s.tablecell=function(G,u){return K(x(G),u)},s.code=function(G,u,f){var N=(u||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(G,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(u,'">').concat(f?G:Object(_.escape)(G,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(f?G:Object(_.escape)(G,!0))+"</code></pre>"},s.heading=function(G,u,f){var N=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:N,level:u,text:G}),"<h"+u+' id="'+N+'">'+G+"</h"+u+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:b,renderer:s});var V=A.a,P=ie("SJMd"),I=ie("ulZh"),Y=ie.n(I),ee=ie("m3rI"),oe=ie("Oy/b"),pe=ie("p5ED"),Oe=ie("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Se=function(G,u){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,N){f.__proto__=N}||function(f,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(f[Q]=N[Q])})(G,u)};function we(G,u){function f(){this.constructor=G}Se(G,u),G.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}function Te(G,u,f,N){return new(f||(f=Promise))(function(Q,W){function ye(yt){try{et(N.next(yt))}catch(Ge){W(Ge)}}function He(yt){try{et(N.throw(yt))}catch(Ge){W(Ge)}}function et(yt){var Ge;yt.done?Q(yt.value):(Ge=yt.value,Ge instanceof f?Ge:new f(function(St){St(Ge)})).then(ye,He)}et((N=N.apply(G,u||[])).next())})}function Ce(G,u){var f,N,Q,W,ye={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function He(et){return function(yt){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ye;)try{if(f=1,N&&(Q=2&Ge[0]?N.return:Ge[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Ge[1])).done)return Q;switch(N=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(Q=ye.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<Q[1]){ye.label=Q[1],Q=Ge;break}if(Q&&ye.label<Q[2]){ye.label=Q[2],ye.ops.push(Ge);break}Q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=u.call(G,ye)}catch(St){Ge=[6,St],N=0}finally{f=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,yt])}}}function me(){for(var G=0,u=0,f=arguments.length;u<f;u++)G+=arguments[u].length;var N=Array(G),Q=0;for(u=0;u<f;u++)for(var W=arguments[u],ye=0,He=W.length;ye<He;ye++,Q++)N[Q]=W[ye];return N}var se=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(u,f){for(var N=0,Q=f;N<Q.length;N++){var W=Q[N],ye=W[0],He=W[1];u.setAttribute(ye,He)}},G.createRect=function(u,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",u.toString()),Q.setAttribute("height",f.toString()),N&&G.setAttributes(Q,N),Q},G.createLine=function(u,f,N,Q,W){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",u.toString()),ye.setAttribute("y1",f.toString()),ye.setAttribute("x2",N.toString()),ye.setAttribute("y2",Q.toString()),W&&G.setAttributes(ye,W),ye},G.createPolygon=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",u),f&&G.setAttributes(N,f),N},G.createCircle=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(u/2).toString()),N.setAttribute("cy",(u/2).toString()),N.setAttribute("r",u.toString()),f&&G.setAttributes(N,f),N},G.createEllipse=function(u,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(u/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(u/2).toString()),Q.setAttribute("ry",(f/2).toString()),N&&G.setAttributes(Q,N),Q},G.createGroup=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return u&&G.setAttributes(f,u),f},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(u,f,N,Q,W,ye,He){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(et,[["id",u],["orient",f],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",ye.toString()]]),et.appendChild(He),et},G.createText=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),u&&G.setAttributes(f,u),f},G.createTSpan=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=u,f&&G.setAttributes(N,f),N},G.createImage=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return u&&G.setAttributes(f,u),f},G.createPoint=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=u,N.y=f,N},G.createPath=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",u),f&&G.setAttributes(N,f),N},G}(),te=function(){function G(){}return G.addKey=function(u){G.key=u},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),ce=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(u,f,N){var Q=this;return new Promise(function(W){var ye=N!==void 0?N:document.createElement("canvas");u===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",f.width.baseVal.valueAsString),He.setAttribute("height",f.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),He.innerHTML=f.innerHTML,Q.naturalSize===!0?(He.width.baseVal.value=u.naturalWidth,He.height.baseVal.value=u.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(He.width.baseVal.value=Q.width,He.height.baseVal.value=Q.height),ye.width=He.width.baseVal.value,ye.height=He.height.baseVal.value;var et=He.outerHTML,yt=ye.getContext("2d");Q.markersOnly!==!0&&yt.drawImage(u,0,0,ye.width,ye.height);var Ge=window.URL,St=new Image(ye.width,ye.height);St.setAttribute("crossOrigin","anonymous");var Ht=new Blob([et],{type:"image/svg+xml"}),Jt=Ge.createObjectURL(Ht);St.onload=function(){yt.drawImage(St,0,0),Ge.revokeObjectURL(Jt);var Ur=ye.toDataURL(Q.imageType,Q.imageQuality);W(Ur)},St.src=Jt})},G}(),ae=function(){},Ae=function(){function G(u){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+u+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(u){return this.styleSheet===void 0&&this.addStyleSheet(),u.name=""+this.classNamePrefix+u.localName,this.classes.push(u),this.styleSheet.sheet.insertRule("."+u.name+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length),u},G.prototype.addRule=function(u){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(u),this.styleSheet.sheet.insertRule(u.selector+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var u;this.styleSheet=document.createElement("style"),((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var u;this.styleSheet&&(((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),Re=function(G,u){this.selector=G,this.style=u},xe=function(G,u){this.localName=G,this.style=u},ke=function(){function G(u,f,N,Q,W){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=u,this.displayMode=f,this.markerItems=N,this.uiStyleSettings=Q,this.styles=W,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return G.prototype.show=function(u){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=u,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(W){var ye=document.createElement("div");ye.className=""+f.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",W.typeName),ye.innerHTML=W.icon,ye.addEventListener("click",function(){f.markerToolbarButtonClicked(ye,W)}),f.buttons.push(ye),f.markerButtons.push(ye)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(u){this.buttonClickListeners.push(u)},G.prototype.removeButtonClickListener=function(u){this.buttonClickListeners.indexOf(u)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(u),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var u=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<u||f===u&&this.markerButtons.length-1===u?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===u&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},G.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},G.prototype.resetButtonStyles=function(){var u=this;this.buttons.forEach(function(f){f.className=f.className.replace(u.uiStyleSettings.toolbarButtonStyleColorsClassName?u.uiStyleSettings.toolbarButtonStyleColorsClassName:u.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(u.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?u.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:u.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(u.uiStyleSettings.toolbarButtonStyleColorsClassName?u.uiStyleSettings.toolbarButtonStyleColorsClassName:u.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(u,f,N){var Q=this,W=document.createElement("div");switch(W.className=""+this.toolbarButtonStyleClass.name,W.innerHTML=f,W.setAttribute("data-action",N),W.addEventListener("click",function(){Q.actionToolbarButtonClicked(W,N)}),N){case"select":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":W.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":W.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":W.style.fill=this.uiStyleSettings.closeButtonColor}u.appendChild(W),this.buttons.push(W)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("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 xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("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 xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var u=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
padding: `+u+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},G.prototype.markerToolbarButtonClicked=function(u,f){this.setActiveButton(u),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(u,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.prototype.setActiveButton=function(u){this.resetButtonStyles(),u.className=u.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),u.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},G.prototype.setActiveMarkerButton=function(u){var f=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===u});f&&this.setActiveButton(f)},G.prototype.setCurrentMarker=function(u){var f=this;this.currentMarker=u,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){f.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},G}(),Pe=function(){function G(u,f,N,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=u,this.displayMode=f,this.uiStyleSettings=N,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var u;this.toolboxStyleClass=this.styles.addClass(new xe("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 xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("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 xe("toolbox-panel-row_colors",`
background-color: `+((u=this.uiStyleSettings.toolboxBackgroundColor)!==null&&u!==void 0?u:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},G.prototype.show=function(u){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=u,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(u){var f,N,Q=this;this.panels=u,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(W){var ye;W.uiStyleSettings=Q.uiStyleSettings;var He=document.createElement("div");He.className=Q.toolboxButtonStyleClass.name+" "+((ye=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:Q.toolboxButtonStyleColorsClass.name),He.innerHTML=W.icon,He.title=W.title,He.addEventListener("click",function(){Q.panelButtonClick(W)}),Q.panelButtons.push(He),Q.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(u){var f=this,N=-1;if(u!==this.activePanel){N=this.panels.indexOf(u),this.panelRow.innerHTML="";var Q=u.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=u}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(W,ye){var He,et;W.className=f.toolboxButtonStyleClass.name+" "+(ye===N?""+((He=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:f.toolboxActiveButtonStyleColorsClass.name):""+((et=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&et!==void 0?et:f.toolboxButtonStyleColorsClass.name))})},G}(),je=function(G,u){this.title=G,this.icon=u},We=function(G){function u(f,N,Q,W){var ye=G.call(this,f,W||'<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 ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=N,ye.currentColor=Q,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var W=f.getColorBox(Q);N.appendChild(W),f.colorBoxes.push(W)}),N},u.prototype.getColorBox=function(f){var N=this,Q=this.uiStyleSettings.toolbarHeight/4,W=this.uiStyleSettings.toolbarHeight-Q,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=W-2+"px",ye.style.height=W-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(W+2)/2+"px",ye.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){N.setCurrentColor(f,ye)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=W-2+"px",He.style.height=W-2+"px",He.style.backgroundColor=f,He.style.borderRadius=W/2+"px",f==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.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>`),ye.appendChild(He),ye},u.prototype.setCurrentColor=function(f,N){var Q=this;this.currentColor=f,this.colorBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},u}(je),Be=function(){function G(u,f,N){this._state="new",this._isSelected=!1,this._container=u,this._overlayContainer=f,this.globalSettings=N,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(u){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(u,f){},G.prototype.dblClick=function(u,f){},G.prototype.manipulate=function(u){},G.prototype.pointerUp=function(u){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(u){this.container.childNodes.length>0?this.container.insertBefore(u,this.container.childNodes[0]):this.container.appendChild(u)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(u){this._state=u.state,this.notes=u.notes},G.prototype.scale=function(u,f){},G.prototype.colorChanged=function(u){this.onColorChanged&&this.onColorChanged(u),this.stateChanged()},G.prototype.fillColorChanged=function(u){this.onFillColorChanged&&this.onFillColorChanged(u),this.stateChanged()},G.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var u=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),u.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(u)&&this.onStateChanged(this)}},G.typeName="MarkerBase",G}(),Ie=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.prototype.findGripByVisual=function(u){return this.topLeft.ownsTarget(u)?this.topLeft:this.topCenter.ownsTarget(u)?this.topCenter:this.topRight.ownsTarget(u)?this.topRight:this.centerLeft.ownsTarget(u)?this.centerLeft:this.centerRight.ownsTarget(u)?this.centerRight:this.bottomLeft.ownsTarget(u)?this.bottomLeft:this.bottomCenter.ownsTarget(u)?this.bottomCenter:this.bottomRight.ownsTarget(u)?this.bottomRight:void 0},G}(),tt=function(){function G(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},G}(),Ze=function(){function G(){}return G.toITransformMatrix=function(u){return{a:u.a,b:u.b,c:u.c,d:u.d,e:u.e,f:u.f}},G.toSVGMatrix=function(u,f){return u.a=f.a,u.b=f.b,u.c=f.c,u.d=f.d,u.e=f.e,u.f=f.f,u},G}(),Je=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.left=0,W.top=0,W.width=0,W.height=0,W.defaultSize={x:50,y:20},W.offsetX=0,W.offsetY=0,W.rotationAngle=0,W.CB_DISTANCE=10,W._suppressMarkerCreateEvent=!1,W.container.transform.baseVal.appendItem(se.createTransform()),W.setupControlBox(),W}return we(u,G),Object.defineProperty(u.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var N=se.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),u.prototype.ownsTarget=function(f){return!!G.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(f);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var W=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=W.x-this.width/2,this.top=W.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},u.prototype.pointerUp=function(f){var N=this.state;G.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},u.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},u.prototype.manipulate=function(f){var N=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(f)},u.prototype.resize=function(f){var N=this.manipulationStartLeft,Q=this.manipulationStartWidth,W=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+f.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:W=this.manipulationStartTop+f.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-W;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+f.y-this.manipulationStartY}Q>=0?(this.left=N,this.width=Q):(this.left=N+Q,this.width=-Q),ye>=0?(this.top=W,this.height=ye):(this.top=W+ye,this.height=-ye),this.setSize()},u.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},u.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var N=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},u.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},u.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var N=this.container.getCTM(),Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},u.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var N=this.container.getCTM();N=N.inverse();var Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(N)).x,y:Q.y}},u.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var f=se.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ie,this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,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()},u.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()},u.prototype.createGrip=function(){var f=new tt;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},u.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,N=-f/2,Q=N,W=(this.width+this.CB_DISTANCE)/2-f/2,ye=(this.height+this.CB_DISTANCE)/2-f/2,He=this.height+this.CB_DISTANCE-f/2,et=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,N,Q),this.positionGrip(this.controlGrips.topCenter.visual,W,Q),this.positionGrip(this.controlGrips.topRight.visual,et,Q),this.positionGrip(this.controlGrips.centerLeft.visual,N,ye),this.positionGrip(this.controlGrips.centerRight.visual,et,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,N,He),this.positionGrip(this.controlGrips.bottomCenter.visual,W,He),this.positionGrip(this.controlGrips.bottomRight.visual,et,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,W,Q-3*this.CB_DISTANCE)},u.prototype.positionGrip=function(f,N,Q){var W=f.transform.baseVal.getItem(0);W.setTranslate(N,Q),f.transform.baseVal.replaceItem(W,0)},u.prototype.hideControlBox=function(){this.controlBox.style.display="none"},u.prototype.showControlBox=function(){this.controlBox.style.display=""},u.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ze.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ze.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N);var Q=this.rotatePoint({x:this.left,y:this.top}),W=this.unrotatePoint({x:Q.x*f,y:Q.y*N});this.left=W.x,this.top=W.y,this.width=this.width*f,this.height=this.height*N,this.adjustControlBox()},u}(Be),Ye=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.createVisual=W.createVisual.bind(W),W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual)},u.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){G.prototype.resize.call(this,f),this.setSize()},u.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(f){G.prototype.pointerUp.call(this,f),this.setSize()},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},u.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},u.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this))},u.prototype.restoreState=function(f){var N=f;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize()},u.title="Rectangle marker",u}(Je),ft=function(G){function u(f,N,Q,W){var ye=G.call(this,f,W||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=N,ye.currentWidth=Q,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.flexGrow="2",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){f.setCurrentWidth(Q,W)}),N.appendChild(W);var ye=document.createElement("div");ye.innerText=Q.toString(),ye.style.marginRight="5px",W.appendChild(ye);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var et=document.createElement("hr");et.style.minWidth="20px",et.style.border="0px",et.style.borderTop=Q+"px solid "+f.uiStyleSettings.toolboxColor,et.style.flexGrow="2",He.appendChild(et),W.appendChild(He),f.widthBoxes.push(W)}),N},u.prototype.setCurrentWidth=function(f,N){var Q=this;this.currentWidth=f,this.widthBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},u}(je),rt=function(G){function u(f,N,Q,W){var ye=G.call(this,f,W||'<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 ye.styles=[],ye.styleBoxes=[],ye.styles=N,ye.currentStyle=Q,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/f.styles.length-5+"%",W.style.borderColor=Q===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){f.setCurrentStyle(Q,W)}),N.appendChild(W);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;ye.innerHTML=He,W.appendChild(ye),f.styleBoxes.push(W)}),N},u.prototype.setCurrentStyle=function(f,N){var Q=this;this.currentStyle=f,this.styleBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},u}(je),nt=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ft("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new rt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(u,G),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="FrameMarker",u.title="Frame marker",u.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',u}(Ye),Me=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},dt=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.x1=0,W.y1=0,W.x2=0,W.y2=0,W.defaultLength=50,W.manipulationStartX=0,W.manipulationStartY=0,W.manipulationStartX1=0,W.manipulationStartY1=0,W.manipulationStartX2=0,W.manipulationStartY2=0,W.setupControlBox(),W}return we(u,G),u.prototype.ownsTarget=function(f){return!!G.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},u.prototype.pointerUp=function(f){var N=this.state;G.prototype.pointerUp.call(this,f),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(f),this._state="select",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},u.prototype.adjustVisual=function(){},u.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},u.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},u.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){this.positionGrips()},u.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},u.prototype.createGrip=function(){var f=new tt;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},u.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},u.prototype.positionGrip=function(f,N,Q){var W=f.transform.baseVal.getItem(0);W.setTranslate(N,Q),f.transform.baseVal.replaceItem(W,0)},u.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.x1=this.x1*f,this.y1=this.y1*N,this.x2=this.x2*f,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},u}(Be),lt=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ft("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new rt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},u.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},u.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},u.typeName="LineMarker",u.title="Line marker",u.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',u}(dt),Ue=function(G){function u(f,N,Q,W){var ye=G.call(this,f,W||'<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 ye.fonts=[],ye.fontBoxes=[],ye.fonts=N,ye.currentFont=Q,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(Q){var W=document.createElement("div");W.style.display="inline-block",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/f.fonts.length-5+"%",W.style.borderColor=Q===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){f.setCurrentFont(Q,W)}),N.appendChild(W);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=Q,ye.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ye.appendChild(He),W.appendChild(ye),f.fontBoxes.push(W)}),N},u.prototype.setCurrentFont=function(f,N){var Q=this;this.currentFont=f,this.fontBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},u}(je),Ke=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.color="transparent",W.padding=5,W.DEFAULT_TEXT="your text here",W.text=W.DEFAULT_TEXT,W.isMoved=!1,W.color=Q.defaultColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setColor=W.setColor.bind(W),W.setFont=W.setFont.bind(W),W.renderText=W.renderText.bind(W),W.sizeText=W.sizeText.bind(W),W.textEditDivClicked=W.textEditDivClicked.bind(W),W.showTextEditor=W.showTextEditor.bind(W),W.setSize=W.setSize.bind(W),W.positionTextEditor=W.positionTextEditor.bind(W),W.colorPanel=new We("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.fontFamilyPanel=new Ue("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W}return we(u,G),u.prototype.ownsTarget=function(f){if(G.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(Q){Q===f&&(N=!0)}),N},u.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.renderText=function(){var f=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(N){f.textElement.appendChild(se.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},u.prototype.getTextScale=function(){var f=this.textElement.getBBox(),N=1;if(f.width>0&&f.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/f.width,W=(1*this.height-this.height*this.padding*2/100)/f.height;N=Math.min(Q,W)}return N},u.prototype.getTextPosition=function(f){var N=this.textElement.getBBox(),Q=0,W=0;return N.width>0&&N.height>0&&(Q=(this.width-N.width*f)/2,W=this.height/2-N.height*f/2),{x:Q,y:W}},u.prototype.sizeText=function(){var f=this.textElement.getBBox(),N=this.getTextScale(),Q=this.getTextPosition(N);Q.y-=f.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},u.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},u.prototype.resize=function(f){G.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},u.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},u.prototype.pointerUp=function(f){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,f),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},u.prototype.showTextEditor=function(){var f=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&N>.9;)N-=.1,f.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var Q=N.clipboardData.getData("text"),W=window.getSelection();if(!W.rangeCount)return!1;W.deleteFromDocument(),W.getRangeAt(0).insertNode(document.createTextNode(Q)),N.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},u.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),W={x:Q.width*f,y:Q.height*f};N.x-=W.x/2,N.y-=W.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},u.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},u.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},u.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},u.prototype.dblClick=function(f,N){G.prototype.dblClick.call(this,f,N),this.showTextEditor()},u.prototype.setColor=function(f){this.textElement&&se.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},u.prototype.setFont=function(f){this.textElement&&se.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},u.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},u.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var N=f;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize(),this.sizeText(),this.positionTextEditor()},u.typeName="TextMarker",u.title="Text marker",u.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>',u}(Je),Ee=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.color="transparent",W.lineWidth=3,W.drawing=!1,W.pixelRatio=1,W.color=Q.defaultColor,W.lineWidth=Q.defaultStrokeWidth,W.pixelRatio=Q.freehandPixelRatio,W.setColor=W.setColor.bind(W),W.addCanvas=W.addCanvas.bind(W),W.finishCreation=W.finishCreation.bind(W),W.setLineWidth=W.setLineWidth.bind(W),W.colorPanel=new We("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.lineWidthPanel=new ft("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.lineWidthPanel.onWidthChanged=W.setLineWidth,W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},u.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var f=se.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,N){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(f.x,f.y),this.drawing=!0):G.prototype.pointerDown.call(this,f,N)},u.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){G.prototype.resize.call(this,f),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,f)},u.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)},u.prototype.select=function(){this.state==="creating"&&this.finishCreation(),G.prototype.select.call(this)},u.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},u.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=N[0],W=N[1],ye=N[2],He=N[3],et=!1,yt=0;yt<this.canvasElement.height;yt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)f.data[yt*this.canvasElement.width*4+4*Ge+3]>0&&(et=!0,yt<W&&(W=yt),Ge<Q&&(Q=Ge),yt>He&&(He=yt),Ge>ye&&(ye=Ge));if(et){this.left=Q/this.pixelRatio,this.top=W/this.pixelRatio,this.width=(ye-Q)/this.pixelRatio,this.height=(He-W)/this.pixelRatio;var St=document.createElement("canvas");St.width=ye-Q,St.height=He-W,St.getContext("2d").putImageData(this.canvasContext.getImageData(Q,W,ye-Q,He-W),0,0),this.drawingImgUrl=St.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},u.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},u.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},u.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){this.createVisual(),G.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setDrawingImage()},u.typeName="FreehandMarker",u.title="Freehand marker",u.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>',u}(Je),ve=function(G){function u(f,N,Q){var W=G.call(this,f,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return W.typeBoxes=[],W.currentType=N,W.setCurrentType=W.setCurrentType.bind(W),W}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var Q=function(He){var et="both";switch(He){case 0:et="both";break;case 1:et="start";break;case 2:et="end";break;case 3:et="none"}var yt=document.createElement("div");if(yt.style.display="flex",yt.style.flexGrow="2",yt.style.alignItems="center",yt.style.justifyContent="space-between",yt.style.padding="5px",yt.style.borderWidth="2px",yt.style.borderStyle="solid",yt.style.borderColor=et===W.currentType?W.uiStyleSettings.toolboxAccentColor:"transparent",yt.addEventListener("click",function(){f.setCurrentType(et,yt)}),N.appendChild(yt),et==="both"||et==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.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="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",yt.appendChild(Ge)}var St=document.createElement("div");St.style.display="flex",St.style.alignItems="center",St.style.minHeight="20px",St.style.flexGrow="2";var Ht=document.createElement("hr");if(Ht.style.minWidth="20px",Ht.style.border="0px",Ht.style.borderTop="3px solid "+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee"),Ht.style.flexGrow="2",St.appendChild(Ht),yt.appendChild(St),et==="both"||et==="end"){var Jt=document.createElement("div");Jt.style.display="flex",Jt.style.alignItems="center",Jt.style.minHeight="20px",Jt.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="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Jt.style.marginRight="5px",yt.appendChild(Jt)}W.typeBoxes.push(yt)},W=this,ye=0;ye<4;ye++)Q(ye);return N},u.prototype.setCurrentType=function(f,N){var Q=this;this.currentType=f,this.typeBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},u}(je),be=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.arrowType="end",W.arrowBaseHeight=10,W.arrowBaseWidth=10,W.getArrowPoints=W.getArrowPoints.bind(W),W.setArrowType=W.setArrowType.bind(W),W.arrowTypePanel=new ve("Arrow type","end"),W.arrowTypePanel.onArrowTypeChanged=W.setArrowType,W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},u.prototype.getArrowPoints=function(f,N){var Q=this.arrowBaseWidth+2*this.strokeWidth,W=this.arrowBaseHeight+2*this.strokeWidth;return f-Q/2+","+(N+W/2)+" "+f+","+(N-W/2)+" "+(f+Q/2)+","+(N+W/2)},u.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="creating"&&this.createTips()},u.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},u.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},u.typeName="ArrowMarker",u.title="Arrow marker",u.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',u}(lt),re=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.fillColor=Q.defaultFillColor,W.strokeWidth=0,W.fillPanel=new We("Color",Q.defaultColorSet,Q.defaultFillColor),W.fillPanel.onColorChanged=W.setFillColor,W}return we(u,G),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="CoverMarker",u.title="Cover marker",u.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',u}(Ye),ne=function(G){function u(f,N,Q,W){var ye=G.call(this,f,W||'<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 ye.opacities=[],ye.opacityBoxes=[],ye.opacities=N,ye.currentOpacity=Q,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return we(u,G),u.prototype.getUi=function(){var f=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){f.setCurrentOpacity(Q,W)}),N.appendChild(W);var ye=document.createElement("div");ye.innerText=100*Q+"%",W.appendChild(ye),f.opacityBoxes.push(W)}),N},u.prototype.setCurrentOpacity=function(f,N){var Q=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(W){W.style.borderColor=W===N?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},u}(je),de=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.setOpacity=W.setOpacity.bind(W),W.fillColor=Q.defaultHighlightColor,W.strokeWidth=0,W.opacity=Q.defaultHighlightOpacity,W.fillPanel=new We("Color",Q.defaultColorSet,W.fillColor),W.fillPanel.onColorChanged=W.setFillColor,W.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return we(u,G),u.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="HighlightMarker",u.title="Highlight marker",u.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>',u}(re),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>',fe=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.bgColor="transparent",W.tipPosition={x:0,y:0},W.tipBase1Position={x:0,y:0},W.tipBase2Position={x:0,y:0},W.tipMoving=!1,W.color=Q.defaultStrokeColor,W.bgColor=Q.defaultFillColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setBgColor=W.setBgColor.bind(W),W.getTipPoints=W.getTipPoints.bind(W),W.positionTip=W.positionTip.bind(W),W.setTipPoints=W.setTipPoints.bind(W),W.colorPanel=new We("Text color",Q.defaultColorSet,W.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>'),W.colorPanel.onColorChanged=W.setColor,W.bgColorPanel=new We("Fill color",Q.defaultColorSet,W.bgColor,ue),W.bgColorPanel.onColorChanged=W.setBgColor,W.fontFamilyPanel=new Ue("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W.tipGrip=new tt,W.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),W.controlBox.appendChild(W.tipGrip.visual),W}return we(u,G),u.prototype.ownsTarget=function(f){return G.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},u.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},u.prototype.pointerDown=function(f,N){this.state==="new"&&G.prototype.pointerDown.call(this,f,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,f,N)},u.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,f);else{var N=this.state==="creating";G.prototype.pointerUp.call(this,f),this.setTipPoints(N),this.positionTip()}},u.prototype.manipulate=function(f){if(this.tipMoving){var N=this.unrotatePoint(f);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,f)},u.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",f]]),se.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},u.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},u.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var N=Math.min(this.height/2,15),Q=this.height/5;f&&(this.tipPosition={x:N+Q/2,y:this.height+20});var W=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+Q,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?W<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Q,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-Q},this.tipBase2Position={x:this.width,y:this.height-N}):W<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-Q})},u.prototype.resize=function(f){G.prototype.resize.call(this,f),this.positionTip()},u.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),u.prototype.select=function(){this.positionTip(),G.prototype.select.call(this)},u.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var N=f;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,G.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*N},this.positionTip()},u.typeName="CalloutMarker",u.title="Callout marker",u.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>',u}(Ke),Le=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.fillColor=Q.defaultFillColor,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.setOpacity=W.setOpacity.bind(W),W.createVisual=W.createVisual.bind(W),W.strokePanel=new We("Line color",me(Q.defaultColorSet,["transparent"]),Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.fillPanel=new We("Fill color",me(Q.defaultColorSet,["transparent"]),W.fillColor,ue),W.fillPanel.onColorChanged=W.setFillColor,W.strokeWidthPanel=new ft("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new rt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual)},u.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.manipulate=function(f){G.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){G.prototype.resize.call(this,f),this.setSize()},u.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},u.prototype.pointerUp=function(f){G.prototype.pointerUp.call(this,f),this.setSize()},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},u.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},u.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var N=f;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),G.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,N){G.prototype.scale.call(this,f,N),this.setSize()},u.typeName="EllipseMarker",u.title="Ellipse marker",u.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>',u}(Je),Ne=function(G){function u(f,N,Q){return G.call(this,f,N,Q)||this}return we(u,G),Object.defineProperty(u.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},u.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.state==="creating"&&this.createTips()},u.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},u.typeName="MeasurementMarker",u.title="Measurement marker",u.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>',u}(lt),$e=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.strokePanel.colors=Q.defaultColorSet,W.fillColor="transparent",W}return we(u,G),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=G.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="EllipseFrameMarker",u.title="Ellipse frame marker",u.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>',u}(Le),ht=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.prototype.addUndoStep=function(u){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(u)||(this.undoStack.push(u),JSON.stringify(this.lastRedoStep)!==JSON.stringify(u)&&this.redoStack.splice(0,this.redoStack.length))},G.prototype.replaceLastUndoStep=function(u){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=u)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.prototype.undo=function(){if(this.undoStack.length>1){var u=this.undoStack.pop();return u!==void 0&&this.redoStack.push(u),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),Xe=function(G){function u(f,N,Q){var W=G.call(this,f,N,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.curveX=0,W.curveY=0,W.manipulationStartCurveX=0,W.manipulationStartCurveY=0,W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.positionGrips=W.positionGrips.bind(W),W.addControlGrips=W.addControlGrips.bind(W),W.adjustVisual=W.adjustVisual.bind(W),W.setupControlBox=W.setupControlBox.bind(W),W.resize=W.resize.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new We("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ft("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new rt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(u,G),u.prototype.ownsTarget=function(f){return!(!G.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},u.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},u.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,N){G.prototype.pointerDown.call(this,f,N),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},u.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},u.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,G.prototype.addControlGrips.call(this)},u.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/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()))},u.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),G.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),G.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},u.prototype.scale=function(f,N){this.curveX=this.curveX*f,this.curveY=this.curveY*N,G.prototype.scale.call(this,f,N)},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){G.prototype.restoreState.call(this,f);var N=f;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},u.typeName="CurveMarker",u.title="Curve marker",u.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>',u}(dt),gt=function(){function G(u,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=u,this.cancelable=f}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),st=function(G){function u(f,N,Q){var W=G.call(this,f,!1)||this;return W.dataUrl=N,W.state=Q,W}return we(u,G),u}(gt),qe=function(G){function u(f,N,Q){Q===void 0&&(Q=!1);var W=G.call(this,f,Q)||this;return W.marker=N,W}return we(u,G),u}(gt),Dt=function(){function G(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return G.prototype.addEventListener=function(u,f){this[u].push(f)},G.prototype.removeEventListener=function(u,f){var N=this[u].indexOf(f);N>-1&&this[u].splice(N,1)},G}(),Et=function(){function G(u){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Me,this._isOpen=!1,this.undoRedoManager=new ht,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Dt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=u,this.targetRoot=document.body,this.width=u.clientWidth,this.height=u.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[nt,Ee,be,Ke,$e,Le,de,fe,Ne,re,lt,Xe]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[nt,Ee,be,Ke,Le,de,fe]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[nt,Ee,be,Ke,de]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(u){var f=this;this._availableMarkerTypes.splice(0),u.forEach(function(N){if(typeof N=="string"){var Q=f.ALL_MARKER_TYPES.find(function(W){return W.typeName===N});Q!==void 0&&f._availableMarkerTypes.push(Q)}else f._availableMarkerTypes.push(N)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(u){this._zoomLevel=u,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var u=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new gt(u))})},G.prototype.render=function(){return Te(this,void 0,void 0,function(){var u;return Ce(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(u=new ce).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.markersOnly=this.renderMarkersOnly,u.width=this.renderWidth,u.height=this.renderHeight,[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},G.prototype.close=function(u){var f=this;if(u===void 0&&(u=!1),this.isOpen){var N=!1;u||this.eventListeners.beforeclose.forEach(function(Q){var W=new gt(f,!0);Q(W),W.defaultPrevented&&(N=!0)}),N||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Q){return Q(new gt(f))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var u,f=[],N=0;N<arguments.length;N++)f[N]=arguments[N];(u=this._availableMarkerTypes).push.apply(u,f)},G.prototype.addRenderEventListener=function(u){this.addEventListener("render",function(f){u(f.dataUrl,f.state)})},G.prototype.removeRenderEventListener=function(u){},G.prototype.addCloseEventListener=function(u){this.addEventListener("close",function(){u()})},G.prototype.removeCloseEventListener=function(u){},G.prototype.setupResizeObserver=function(){var u=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){u.resize(u.target.clientWidth,u.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return u.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupTargetResize=function(){var u=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/u>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*u:this.editorCanvas.clientWidth,N=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/u;this.resize(f,N)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(u,f){this._isResizing=!0;var N=u/this.imageWidth,Q=f/this.imageHeight;this.imageWidth=Math.round(u),this.imageHeight=Math.round(f),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(N,Q),this._isResizing=!1},G.prototype.scaleMarkers=function(u,f){var N,Q=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(u,f):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(W){W!==Q._currentMarker&&W.scale(u,f)}),N!==void 0&&this.setCurrentMarker(N)},G.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},G.prototype.setTopLeft=function(){var u=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=u.left-f.left,this.top=u.top-f.top},G.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},G.prototype.addDefs=function(){for(var u,f=[],N=0;N<arguments.length;N++)f[N]=arguments[N];this.defs=se.createDefs(),this.addDefsToImage(),(u=this.defs).append.apply(u,f)},G.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},G.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},G.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},G.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},G.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},G.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},G.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},G.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var u=document.createElement("a");u.href="https://markerjs.com/",u.target="_blank",u.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>',u.title="Powered by marker.js",u.style.display="grid",u.style.alignItems="center",u.style.justifyItems="center",u.style.padding="3px",u.style.width="20px",u.style.height="20px",this.logoUI.appendChild(u),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},G.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},G.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"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 ke(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},G.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.removeMarker=function(u){this.markerImage.removeChild(u.container),this.markers.indexOf(u)>-1&&this.markers.splice(this.markers.indexOf(u),1),u.dispose()},G.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},G.prototype.toolbarButtonClicked=function(u,f){if(u==="marker"&&f!==void 0)this.createNewMarker(f);else if(u==="action")switch(f){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},G.prototype.deleteSelectedMarker=function(){var u=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var W=new qe(u,u._currentMarker,!0);Q(W),W.defaultPrevented&&(f=!0)}),!f){var N=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Q){return Q(new qe(u,N))})}}},G.prototype.clear=function(){var u=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var He=new qe(u,void 0,!0);ye(He),He.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var N=function(ye){var He=Q.markers[ye];Q.setCurrentMarker(Q.markers[ye]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(et){return et(new qe(u,He))})},Q=this,W=this.markers.length-1;W>=0;W--)N(W);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.prototype.showNotesEditor=function(){var u;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=(u=this._currentMarker.notes)!==null&&u!==void 0?u:"",this.overlayContainer.appendChild(this.notesArea))},G.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var u=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===f.width&&N.height===f.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(W){return W(new gt(u))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(W){return W(new gt(u))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var u=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new gt(u))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var u=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new gt(u))}))},G.prototype.stepZoom=function(){var u=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=u<this.zoomSteps.length-1?this.zoomSteps[u+1]:this.zoomSteps[0]},G.prototype.panTo=function(u){this.contentDiv.scrollBy({left:this.prevPanPoint.x-u.x,top:this.prevPanPoint.y-u.y}),this.prevPanPoint=u},G.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var u,f,N=this;return Ce(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return u=Q.sent(),f=this.getState(),this.eventListeners.render.forEach(function(W){return W(new st(N,u,f))}),this.close(!0),[2]}})})},G.prototype.getState=function(u){u===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return f.markers.push(N.getState())}),f},G.prototype.restoreState=function(u){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);u.markers.forEach(function(N){var Q=f._availableMarkerTypes.find(function(ye){return ye.typeName===N.typeName});if(Q!==void 0){var W=f.addNewMarker(Q);W.restoreState(N),f.markers.push(W)}}),u.width&&u.height&&(u.width!==this.imageWidth||u.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/u.width,this.imageHeight/u.height),this.eventListeners.restorestate.forEach(function(N){return N(new gt(f))})},G.prototype.addNewMarker=function(u){var f=se.createGroup();return this.markerImage.appendChild(f),new u(f,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(u){var f,N=this;(f=typeof u=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===u}):u)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),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(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new qe(N,N._currentMarker))}))},G.prototype.markerCreated=function(u){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(u),this.setCurrentMarker(u),u instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new qe(f,f._currentMarker))})},G.prototype.colorChanged=function(u){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=u,this.settings.defaultStrokeColor=u)},G.prototype.fillColorChanged=function(u){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=u)},G.prototype.markerStateChanged=function(u){var f=this;this.eventListeners.markerchange.forEach(function(N){return N(new qe(f,u))})},G.prototype.setCurrentMarker=function(u){var f=this;this._currentMarker!==u&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new qe(f,f._currentMarker))})),this._currentMarker=u,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(N){return N(new qe(f,f._currentMarker))}))},G.prototype.onPointerDown=function(u){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||u.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(N){return N.ownsTarget(u.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(u.clientX,u.clientY),u.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:u.clientX,y:u.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(u.clientX,u.clientY))},G.prototype.onDblClick=function(u){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(N){return N.ownsTarget(u.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(u.clientX,u.clientY),u.target):this.setCurrentMarker()}},G.prototype.onPointerMove=function(u){this.touchPoints!==1&&u.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||u.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(u.clientX,u.clientY)):this.zoomLevel>1&&this.panTo({x:u.clientX,y:u.clientY}))},G.prototype.onPointerUp=function(u){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(u.clientX,u.clientY)),this.isDragging=!1,this.addUndoStep()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(u){this._currentMarker===void 0||this.notesArea!==void 0||u.key!=="Delete"&&u.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(u,f){var N=this.markerImage.getBoundingClientRect();return{x:(u-N.left)/this.zoomLevel,y:(f-N.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},G.prototype.addLicenseKey=function(u){te.addKey(u)},G.prototype.addEventListener=function(u,f){this.eventListeners.addEventListener(u,f)},G.prototype.removeEventListener=function(u,f){this.eventListeners.removeEventListener(u,f)},G.prototype.renderState=function(u){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(u),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.prototype.focus=function(){var u=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new gt(u))}))},G.prototype.blur=function(){var u=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new gt(u))}))},G.instanceCounter=0,G}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var kt=function(G,u){return(kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,N){f.__proto__=N}||function(f,N){for(var Q in N)Object.prototype.hasOwnProperty.call(N,Q)&&(f[Q]=N[Q])})(G,u)};function Ot(G,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function f(){this.constructor=G}kt(G,u),G.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}function Tt(G,u,f,N){return new(f||(f=Promise))(function(Q,W){function ye(yt){try{et(N.next(yt))}catch(Ge){W(Ge)}}function He(yt){try{et(N.throw(yt))}catch(Ge){W(Ge)}}function et(yt){var Ge;yt.done?Q(yt.value):(Ge=yt.value,Ge instanceof f?Ge:new f(function(St){St(Ge)})).then(ye,He)}et((N=N.apply(G,u||[])).next())})}function Zt(G,u){var f,N,Q,W,ye={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function He(et){return function(yt){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ye;)try{if(f=1,N&&(Q=2&Ge[0]?N.return:Ge[0]?N.throw||((Q=N.return)&&Q.call(N),0):N.next)&&!(Q=Q.call(N,Ge[1])).done)return Q;switch(N=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(Q=ye.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<Q[1]){ye.label=Q[1],Q=Ge;break}if(Q&&ye.label<Q[2]){ye.label=Q[2],ye.ops.push(Ge);break}Q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=u.call(G,ye)}catch(St){Ge=[6,St],N=0}finally{f=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,yt])}}}var Qt=function(){function G(){}return G.addKey=function(u){G.key=u},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),vt=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(u,f){for(var N=0,Q=f;N<Q.length;N++){var W=Q[N],ye=W[0],He=W[1];u.setAttribute(ye,He)}},G.createRect=function(u,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",u.toString()),Q.setAttribute("height",f.toString()),N&&G.setAttributes(Q,N),Q},G.createLine=function(u,f,N,Q,W){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",u.toString()),ye.setAttribute("y1",f.toString()),ye.setAttribute("x2",N.toString()),ye.setAttribute("y2",Q.toString()),W&&G.setAttributes(ye,W),ye},G.createPolygon=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",u),f&&G.setAttributes(N,f),N},G.createCircle=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(u/2).toString()),N.setAttribute("cy",(u/2).toString()),N.setAttribute("r",u.toString()),f&&G.setAttributes(N,f),N},G.createEllipse=function(u,f,N){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(u/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(u/2).toString()),Q.setAttribute("ry",(f/2).toString()),N&&G.setAttributes(Q,N),Q},G.createGroup=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return u&&G.setAttributes(f,u),f},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(u,f,N,Q,W,ye,He){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(et,[["id",u],["orient",f],["markerWidth",N.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",ye.toString()]]),et.appendChild(He),et},G.createText=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),u&&G.setAttributes(f,u),f},G.createTSpan=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=u,f&&G.setAttributes(N,f),N},G.createImage=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return u&&G.setAttributes(f,u),f},G.createPoint=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=u,N.y=f,N},G.createPath=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",u),f&&G.setAttributes(N,f),N},G.createElement=function(u,f){var N=document.createElementNS("http://www.w3.org/2000/svg",u);return f&&G.setAttributes(N,f),N},G.getHollowRectanglePath=function(u,f,N,Q,W,ye,He,et){return"M"+u+","+f+"V"+(f+Q)+"H"+(u+N)+"V"+f+"H"+W+"V"+ye+"H"+(W+He)+"V"+(ye+et)+"H"+W+"V"+f+"Z"},G}(),Lt=function(){function G(u){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+u+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(u){return this.styleSheet===void 0&&this.addStyleSheet(),u.name=""+this.classNamePrefix+u.localName,this.classes.push(u),this.styleSheet.sheet.insertRule("."+u.name+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length),u},G.prototype.addRule=function(u){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(u),this.styleSheet.sheet.insertRule(u.selector+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var u;this.styleSheet=document.createElement("style"),((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).appendChild(this.styleSheet),this.addRule(new jt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ut("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ut("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var u;this.styleSheet&&(((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),jt=function(G,u){this.selector=G,this.style=u},Ut=function(G,u){this.localName=G,this.style=u},qt=function(){function G(){this.blocks=[],this.display=""}return G.prototype.addButtonBlock=function(u){u.className=this.blockClassName,u.buttonClassName=this.buttonClassName,u.buttonColorsClassName=this.buttonColorsClassName,u.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(u)},G.prototype.addElementBlock=function(u){u.className===void 0&&(u.className=this.blockClassName),this.blocks.push(u)},G.prototype.getUI=function(){var u=document.createElement("div");return u.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,u.style.display=this.display,this.blocks.forEach(function(f){return u.appendChild(f.getUI())}),u},G}(),ir=function(){function G(){}return G.prototype.getUI=function(){var u=document.createElement("div");if(u.className=this.className,this.minWidth!==void 0&&(u.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":u.style.justifyContent="flex-start";break;case"center":u.style.justifyContent="center";break;case"end":u.style.justifyContent="flex-end"}return u.style.whiteSpace="nowrap",u},G}(),er=function(G){function u(){var f=G!==null&&G.apply(this,arguments)||this;return f.buttons=[],f}return Ot(u,G),u.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},u.prototype.getUI=function(){var f=G.prototype.getUI.call(this);return this.buttons.forEach(function(N){return f.appendChild(N.getUI())}),f},u}(ir),Bt=function(){function G(u,f){this._isActive=!1,this._isHidden=!1,this._icon=u,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(G.prototype,"icon",{get:function(){return this._icon},set:function(u){this._icon=u,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isActive",{get:function(){return this._isActive},set:function(u){this._isActive=u,this.adjustClassName()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){var u=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 u.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},G.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},G.prototype.hide=function(){this._isHidden=!0},G}(),ct=function(G){function u(){var f=G!==null&&G.apply(this,arguments)||this;return f.elements=[],f}return Ot(u,G),u.prototype.addElement=function(f){this.elements.push(f)},u.prototype.getUI=function(){var f=G.prototype.getUI.call(this);return this.elements.forEach(function(N){return f.appendChild(N)}),f},u}(ir),Kr=function(){function G(u,f){this.horizontal=u,this.vertical=f}return Object.defineProperty(G.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),G.prototype.getVerticalLength=function(u){return u/this.ratio},G.prototype.getHorizontalLength=function(u){return u*this.ratio},G}(),ti=function(){function G(){}return G.getIcon=function(u,f){if(u>0&&f>0){var N=new Kr(u,f),Q=N.ratio>=1?20:N.getHorizontalLength(20),W=N.ratio<1?20:N.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var He=vt.createDefs();ye.appendChild(He);var et=vt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(et);var yt=vt.createPath(vt.getHollowRectanglePath((24-Q)/2,(24-W)/2,Q,W,(24-Q)/2+2,(24-W)/2+2,Q-4,W-4));ye.appendChild(yt);var Ge=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(vt.createTSpan(u+":"+f)),ye.appendChild(Ge);var St=Ge.getBBox();vt.setAttributes(Ge,[["x",((24-St.width)/2).toString()],["y",((24-St.height)/2-St.y).toString()]]);var Ht=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(St.width))/2,(24-Math.ceil(St.height))/2,Math.ceil(St.width),Math.ceil(St.height)));return et.appendChild(Ht),vt.setAttributes(yt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},G}(),xr=function(G){function u(f,N,Q){var W=G.call(this,f,N)||this;return W.isDropdownOpen=!1,W.onClick=W.dropdownButtonClicked,W.dropdownButtons=Q,W}return Ot(u,G),u.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=f.className,N.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},u.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},u.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},u.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},u.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},u.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},u}(Bt),Mt=function(){function G(u,f){this.GRIP_SIZE=10,this.color=u,this.fillColor=f,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},G.prototype.setCenter=function(u,f){this.visual.childNodes.forEach(function(N){return vt.setAttributes(N,[["cx",u.toString()],["cy",f.toString()]])})},G}(),Wr=function(){function G(u,f,N,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=u,this.canvasHeight=f,this.margin=N,this.container=Q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(G.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(u){this._aspectRatio=u,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(u){this._zoomFactor=u,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var u=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return u.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return u.gridContainer.appendChild(N)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},G.prototype.setCropRectangle=function(u){this.cropRect=u;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),vt.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var N=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(W,ye){var He=f.y+N*(ye+1);vt.setAttributes(W,[["x1",""+f.x],["y1",""+He],["x2",""+(f.x+f.width)],["y2",""+He]])});var Q=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,ye){var He=f.x+Q*(ye+1);vt.setAttributes(W,[["x1",""+He],["y1",""+f.y],["x2",""+He],["y2",""+(f.y+f.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},G.prototype.clientToLocalCoordinates=function(u,f){var N=this.container.getBoundingClientRect();return{x:u-N.left+this.margin,y:f-N.top+this.margin}},G.prototype.onPointerDown=function(u){this.container.setPointerCapture(u.pointerId),this.previousPoint=this.clientToLocalCoordinates(u.clientX,u.clientY),this.cropRectElement===u.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(u.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(u.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(u.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(u.target)&&(this.activeGrip=this.bottomRightGrip)},G.prototype.onPointerMove=function(u){if(this.isMoving)this.move(this.clientToLocalCoordinates(u.clientX,u.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(u.clientX,u.clientY);this.resize(f)}u.preventDefault()},G.prototype.onPointerUp=function(u){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(u.pointerId)},G.prototype.move=function(u){var f=u.x-this.previousPoint.x,N=u.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=u},G.prototype.resize=function(u){var f=Object.assign({},this.cropRect),N=u.x-this.previousPoint.x,Q=u.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+N<this.margin&&(N=this.margin-f.x),f.x+=N,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-f.width),f.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=Q,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=Q}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=u,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var u=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=N:this.cropRect.height=Q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=u-this.cropRect.width/2,this.cropRect.y=f-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},G.prototype.getRescaledRect=function(u,f,N,Q,W,ye){var He=N/u,et=Q/f;return{x:(W.x-ye)*He+ye,y:(W.y-ye)*et+ye,width:W.width*He,height:W.height*et}},G.prototype.scaleCanvas=function(u,f){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,u,f,this.cropRect,this.margin);this.canvasWidth=u,this.canvasHeight=f,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},G}(),Yr=function(){function G(u){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=u,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(G.prototype,"angle",{get:function(){return this._angle},set:function(u){this._angle=u,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},G.prototype.onPointerDown=function(u){this.controlContainer.setPointerCapture(u.pointerId),this.isDragging=!0,this.previousPoint={x:u.clientX,y:u.clientY}},G.prototype.onPointerMove=function(u){this.isDragging&&(this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.previousPoint.x=u.clientX)},G.prototype.onPointerUp=function(u){this.isDragging&&this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(u.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var u=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-u.width)/2).toString()],["y",(this.height/2).toString()]])}},G.prototype.positionScaleShape=function(){if(this.scaleShape){var u=this.scaleShape.transform.baseVal.getItem(0);u.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(u,0)}},G.prototype.getVisual=function(){var u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.setAttribute("width",this.width+"px"),u.setAttribute("height",this.height+"px"),u.setAttribute("viewBox","0 0 "+this.width+" "+this.height),u.style.flexShrink="0",document.body.appendChild(u);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var Q=N%5==0?this.height/3:this.height/6;f+="h4v"+-Q+"h1v"+Q}f+="v1H0Z",this.scaleShape=vt.createPath(f);var W=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(W),u.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=vt.createTSpan("");return ye.innerHTML="&deg;",this.angleLabelElement.appendChild(ye),u.appendChild(this.angleLabelElement),document.body.removeChild(u),u},G}(),fi=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(u,f,N,Q,W,ye,He){var et=this;return new Promise(function(yt){var Ge=document.createElement("canvas");Ge.width=u.width.baseVal.value-2*Q,Ge.height=u.height.baseVal.value-2*Q;var St=1,Ht=1;et.naturalSize===!0?(St=f.naturalWidth/(u.width.baseVal.value-2*Q)/ye,Ht=f.naturalHeight/(u.height.baseVal.value-2*Q)/He,Ge.width=f.naturalWidth/ye,Ge.height=f.naturalHeight/He):et.width!==void 0&&et.height!==void 0&&(St=et.width/N.width,Ht=et.height/N.height,Ge.width*=St,Ge.height*=Ht);var Jt=Ge.getContext("2d");Jt.translate(Ge.width/2,Ge.height/2),Jt.rotate(W*Math.PI/180),Jt.scale(ye,He),Jt.translate(-Ge.width/2,-Ge.height/2),Jt.drawImage(f,0,0,Ge.width,Ge.height);var Ur=document.createElement("canvas");Ur.width=N.width*St,Ur.height=N.height*Ht,Ur.getContext("2d").putImageData(Jt.getImageData((N.x-Q)*St,(N.y-Q)*Ht,N.width*St,N.height*Ht),0,0),yt(Ur.toDataURL(et.imageType,et.imageQuality))})},G}(),Ve=function(){function G(u){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=G.instanceCounter++,this.styles=new Lt(this.instanceNo),this.target=u,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(u){this._zoomToCropEnabled=u,u?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"gridLines",{get:function(){return this._gridLines},set:function(u){this._gridLines=u,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(u){this._rotationAngle=u,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"aspectRatio",{get:function(){var u;return(u=this._aspectRatio)!==null&&u!==void 0?u:this.aspectRatios[0]},set:function(u){this._aspectRatio=u},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},G.prototype.show=function(){this.showUI(),this.open()},G.prototype.close=function(u){u===void 0&&(u=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),u||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(u){this.renderEventListeners.push(u)},G.prototype.removeRenderEventListener=function(u){this.renderEventListeners.indexOf(u)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(u),1)},G.prototype.addCloseEventListener=function(u){this.closeEventListeners.push(u)},G.prototype.removeCloseEventListener=function(u){this.closeEventListeners.indexOf(u)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(u),1)},G.prototype.setupResizeObserver=function(){var u=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){u.resize(u.target.clientWidth,u.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var u=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/u>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*u:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/u;this.resize(f,N)}},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},G.prototype.resize=function(u,f){this.imageWidth=Math.round(u),this.imageHeight=Math.round(f),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},G.prototype.setEditingTarget=function(){var u=document.createElement("canvas");u.width=this.target.naturalWidth,u.height=this.target.naturalHeight,u.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=u.toDataURL();vt.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},G.prototype.setTopLeft=function(){var u=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=u.left-f.left-this.CANVAS_MARGIN,this.top=u.top-f.top-this.CANVAS_MARGIN},G.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var u=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(u);var f=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=vt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},G.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},G.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Wr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},G.prototype.zoomToCrop=function(){if(this.cropRect){var u=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=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=u+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-u+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},G.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},G.prototype.cropRectChanged=function(u){this.cropRect=u,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},G.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},G.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var u=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>u+this.CANVAS_MARGIN?this.target.offsetTop-(u+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var u=this;this.topToolbar=new qt,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 f=new er;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var N=[];this.aspectRatios.forEach(function(Ht){var Jt=new Bt(ti.getIcon(Ht.horizontal,Ht.vertical),Ht.horizontal===0&&Ht.vertical===0?"FREE":Ht.horizontal+":"+Ht.vertical);Jt.onClick=function(){return u.ratioButtonClicked(Ht)},N.push(Jt)}),this.aspectRatioButton=new xr(ti.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new Bt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){u.isGridVisible=!u.isGridVisible,Q.isActive=u.isGridVisible},f.addButton(Q);var W=new Bt('<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(W.isActive=this.zoomToCropEnabled,W.onClick=function(){u.zoomToCropEnabled=!u.zoomToCropEnabled,W.isActive=u.zoomToCropEnabled},f.addButton(W),!Qt.isLicensed){var ye=new ct;this.topToolbar.addElementBlock(ye);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var et=document.createElement("a");et.style.color="currentColor",et.href="https://markerjs.com/products/cropro",et.target="_blank",et.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>',He.appendChild(et),ye.addElement(He)}var yt=new er;yt.minWidth=3*this.toolbarHeight+"px",yt.contentAlign="end",this.topToolbar.addButtonBlock(yt);var Ge=new Bt('<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");Ge.onClick=this.startRenderAndClose,yt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var St=new Bt('<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");St.onClick=this.close,yt.addButton(St),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(St.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var u=this;this.bottomToolbar=new qt,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 f=new er;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var N=new Bt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");N.onClick=this.rotateLeftButtonClicked,f.addButton(N);var Q=new Bt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Q.onClick=this.rotateRightButtonClicked,f.addButton(Q);var W=new ct;W.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(W),this.straightener=new Yr("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(yt){u.rotateBy(yt),u.straightener.angle=u.rotationAngle},W.addElement(this.straightener.getUI());var ye=new er;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var He=new Bt('<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");He.onClick=this.flipHorizontallyButtonClicked,ye.addButton(He);var et=new Bt('<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");et.onClick=this.flipVerticallyButtonClicked,ye.addButton(et)},G.prototype.ratioButtonClicked=function(u){this.aspectRatio=u,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ti.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Kr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(u){if(u){var f=this.cropLayer.getRescaledRect(u.width,u.height,this.imageWidth,this.imageHeight,u.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=u.flippedHorizontally,this.flippedVertically=u.flippedVertically,this.applyFlip(),this.rotationAngle=u.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(u,f){var N=this.cropImage.getBoundingClientRect();return{x:u-N.left,y:f-N.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var u=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=u+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},G.prototype.rotateLeftButtonClicked=function(){var u=this.rotationAngle-90;this.rotationAngle%90!=0&&(u+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(u)},G.prototype.rotateRightButtonClicked=function(){var u=this.rotationAngle+90;this.rotationAngle%90!=0&&(u-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(u)},G.prototype.rotateTo=function(u){u=(u=u>180?u-360:u)<=-180?u+360:u,this.rotationAngle=u,this.applyRotation()},G.prototype.rotateBy=function(u){this.rotateTo((this.rotationAngle+u)%360)},G.prototype.applyRotation=function(){var u=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=u},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var u,f;return Zt(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return u=N.sent(),f=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(u,f)}),this.close(!0),[2]}})})},G.prototype.render=function(){return Tt(this,void 0,void 0,function(){var u;return Zt(this,function(f){switch(f.label){case 0:return(u=new fi).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.width=this.renderWidth,u.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,u.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 f.sent(),[4,u.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,f.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ut("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var u=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ut("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*u)+`px;
height: `+(this.toolbarHeight-2*u)+`px;
padding: `+u+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*u)+`px;
padding: `+u+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ut("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},G.instanceCounter=0,G}(),_t=ie("8hTe"),pi=ie.n(_t),mi=/<pre[^>]*>/g;function gi(G){var u=document.createElement("div");return u.innerHTML=G,u.childNodes.length===0?"":u.childNodes[0].nodeValue}var vi=it.a=function(G){var u=G.value,f=u===void 0?"":u,N=G.edit,Q=N===void 0?!1:N,W=G.className,ye=G.showTextOnly,He=G.showLines,et=G.replaces,yt=G.zoomImg,Ge=G.hasMask,St=G.style,Ht=St===void 0?{}:St,Jt=G.stylesPrev,Ur=Jt===void 0?{}:Jt,Sr=String(f),Cr=Object(R.useRef)(),$r=Object(R.useRef)(),Ri=Object(R.useState)(""),cr=Object(z.a)(Ri,2),Hr=cr[0],si=cr[1],li=Object(R.useState)("office"),Br=Object(z.a)(li,2),Oi=Br[0],yi=Br[1],zi=function(){var Gt=new Ve($r.current);Gt.displayMode="popup",Gt.addRenderEventListener(function(){var yr=Object(M.a)(U.a.mark(function It(sr){var Vt;return U.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return Cr.current.style.display="none",fr.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr}});case 3:Vt=fr.sent,Vt!=null&&Vt.id&&et($r.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return fr.stop()}},It)}));return function(It){return yr.apply(this,arguments)}}()),Gt.show()},Ki=function(){var Gt=new Et($r.current);Gt.settings.displayMode="popup",Gt.addEventListener("render",function(){var yr=Object(M.a)(U.a.mark(function It(sr){var Vt;return U.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:if(Cr.current.style.display="none",!$r.current){fr.next=6;break}return fr.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr.dataUrl}});case 4:Vt=fr.sent,Vt!=null&&Vt.id&&et($r.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return fr.stop()}},It)}));return function(It){return yr.apply(this,arguments)}}()),Gt.show(),window.markerArea=Gt},Jr=Object(R.useMemo)(function(){Cr.current&&(Cr.current.style.zIndex=-1);try{var ar=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Gt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,yr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Sr=Sr.replace(ar,"("+ee.a.API_SERVER+"/api/attachments/").replace(Gt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(yr,'"'+ee.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(ri){}var It=V(Sr),sr=E();if(Sr.match(/\[TOC\]/)&&(It=It.replace("<p>[TOC]</p>",L()),w()),It=It.replace(/(__special_katext_id_\d+__)/g,function(ri,fr){var Ar=sr[fr],Vi=Ar.type,xi=Ar.expression;return Object(oe.renderToString)(gi(xi)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),It=It.replace(/▁/g,"\u2581\u2581\u2581"),y(),ye){var Vt=document.createElement("div");return Vt.innerHTML=It,Vt.innerText}return setTimeout(function(){return hn()},500),It},[Sr]),Vr=Object(R.useRef)();g.WebkitLineClamp=He,He&&(Ht=Object(O.a)(Object(O.a)({},Ht),g));function bi(ar){var Gt=ar.target;if(Gt.tagName.toUpperCase()==="IMG"){if(yt){var yr=Gt.getAttribute("src");si(yr),yi("image")}}else if(Gt.tagName.toUpperCase()==="A"){var It=Gt.getAttribute("href");if(It.indexOf("office")>-1)ar.preventDefault(),si(It),yi("office");else if(It.indexOf("application/pdf")>-1)ar.preventDefault(),si(It),yi("pdf");else if(It.indexOf("text/html")>-1)ar.preventDefault(),si(It),yi("html");else if(It.startsWith("#")){ar.preventDefault();var sr=document.getElementById(It.replace("#",""));sr&&sr.scrollIntoView(!0)}}}var hn=function(){var Gt,yr=(Gt=Vr.current)===null||Gt===void 0?void 0:Gt.querySelectorAll("video");yr==null||yr.forEach(function(It){if(It.oncontextmenu=function(){return!1},It.src.indexOf(".m3u8")>-1&&!It.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var sr=new Y.a;sr.loadSource(It.src),sr.attachMedia(It)}}})};Object(R.useEffect)(function(){if(Vr.current&&Jr&&(Jr.match(mi)&&window.PR.prettyPrint()),Vr.current)return Vr.current.addEventListener("click",bi),function(){Vr.current.removeEventListener("click",bi),y(),w()}},[Jr,Vr.current,bi]);var Ei=function(Gt){if(!Q)return;Gt.target.nodeName==="IMG"?(Cr.current.style.zIndex=1,Cr.current.style.display="flex",Cr.current.style.width=Gt.target.clientWidth+"px",Cr.current.style.height=Gt.target.clientHeight+"px",Cr.current.style.top=Gt.target.offsetTop+"px",Cr.current.style.left=Gt.target.offsetLeft+"px",$r.current.src=Gt.target.getAttribute("src")):Cr.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:Vr,style:Object(O.a)({},Ht),className:"".concat(W||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:Ei,dangerouslySetInnerHTML:{__html:Jr}}),m.a.createElement("div",{ref:Cr,className:pi.a.button},m.a.createElement(J.a,null,m.a.createElement($.a,{onClick:function(){return zi()}},"\u88C1\u526A"),m.a.createElement($.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:$r,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(pe.a,{close:!0,data:Hr,type:Hr!=null&&Hr.length?Oi:"",style:Object(O.a)({},Ur),onClose:function(){return si("")}}))}},"9VGf":function(pt,it,ie){"use strict";ie.d(it,"a",function(){return k});var le=ie("q1tI"),J=ie.n(le);function k($,O){var M=Object(le.useRef)();Object(le.useEffect)(function(){M.current=$}),Object(le.useEffect)(function(){function z(){M.current()}if(O!==null){var H=setInterval(z,O);return function(){return clearInterval(H)}}},[O])}},Bd2K:function(pt,it,ie){(function(le){le(ie("VrN/"),ie("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(U,R,m){if(m!=le.Init&&m&&U.removeKeyMap("autoCloseTags"),!R)return;var S={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(S["'/'"]=function(D){return M(D)}),(typeof R!="object"||R.whenOpening!==!1)&&(S["'>'"]=function(D){return $(D)}),U.addKeyMap(S)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["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 $(U){if(U.getOption("disableInput"))return le.Pass;for(var R=U.listSelections(),m=[],S=U.getOption("autoCloseTags"),D=0;D<R.length;D++){if(!R[D].empty())return le.Pass;var A=R[D].head,_=U.getTokenAt(A),C=le.innerMode(U.getMode(),_.state),l=C.state,o=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(l),s=o&&o.name;if(!s)return le.Pass;var d=C.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||d&&J,g=typeof S=="object"&&S.indentTags||d&&k;_.end>A.ch&&(s=s.slice(0,s.length-_.end+A.ch));var v=s.toLowerCase();if(!s||_.type=="string"&&(_.end!=A.ch||!/[\"\']/.test(_.string.charAt(_.string.length-1))||_.string.length==1)||_.type=="tag"&&o.close||_.string.indexOf("/")==A.ch-_.start-1||w&&z(w,v)>-1||H(U,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(l)||[],s,A,!0))return le.Pass;var L=typeof S=="object"&&S.emptyTags;if(L&&z(L,s)>-1){m[D]={text:"/>",newPos:le.Pos(A.line,A.ch+2)};continue}var b=g&&z(g,v)>-1;m[D]={indent:b,text:">"+(b?`
`:"")+"</"+s+">",newPos:b?le.Pos(A.line+1,0):le.Pos(A.line,A.ch+1)}}for(var c=typeof S=="object"&&S.dontIndentOnAutoClose,D=R.length-1;D>=0;D--){var p=m[D];U.replaceRange(p.text,R[D].head,R[D].anchor,"+insert");var h=U.listSelections().slice(0);h[D]={head:p.newPos,anchor:p.newPos},U.setSelections(h),!c&&p.indent&&(U.indentLine(p.newPos.line,null,!0),U.indentLine(p.newPos.line+1,null,!0))}}function O(U,R){for(var m=U.listSelections(),S=[],D=R?"/":"</",A=U.getOption("autoCloseTags"),_=typeof A=="object"&&A.dontIndentOnSlash,C=0;C<m.length;C++){if(!m[C].empty())return le.Pass;var l=m[C].head,o=U.getTokenAt(l),s=le.innerMode(U.getMode(),o.state),d=s.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=l.ch-1))return le.Pass;var w,g=s.mode.name!="xml"&&U.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")w=D+"script";else if(g&&s.mode.name=="css")w=D+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!v||v.length&&H(U,v,v[v.length-1],l))return le.Pass;w=D+v[v.length-1]}U.getLine(l.line).charAt(o.end)!=">"&&(w+=">"),S[C]=w}if(U.replaceSelections(S),m=U.listSelections(),!_)for(var C=0;C<m.length;C++)(C==m.length-1||m[C].head.line<m[C+1].head.line)&&U.indentLine(m[C].head.line)}function M(U){return U.getOption("disableInput")?le.Pass:O(U,!0)}le.commands.closeTag=function(U){return O(U)};function z(U,R){if(U.indexOf)return U.indexOf(R);for(var m=0,S=U.length;m<S;++m)if(U[m]==R)return m;return-1}function H(U,R,m,S,D){if(!le.scanForClosingTag)return!1;var A=Math.min(U.lastLine()+1,S.line+500),_=le.scanForClosingTag(U,S,null,A);if(!_||_.tag!=m)return!1;for(var C=D?1:0,l=R.length-1;l>=0&&R[l]==m;l--)++C;S=_.to;for(var l=1;l<C;l++){var o=le.scanForClosingTag(U,S,null,A);if(!o||o.tag!=m)return!1;S=o.to}return!0}})},BjJ7:function(pt,it,ie){"use strict";ie.d(it,"d",function(){return J}),ie.d(it,"c",function(){return k}),ie.d(it,"e",function(){return $}),ie.d(it,"b",function(){return O}),ie.d(it,"a",function(){return z});var le=ie("m3rI");function J(H){var U=!0;if(H.length>0){for(var R=0;R<H.length;R++)if(H[R].compile_success==0||!H[R].compile_success){U=!1;break}}else U=!1;return U}function k(H){for(var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],m=0;m<H.length;m++){var S=H[m],D=U?"".concat(U,"/").concat(S.name):"".concat(S.name);R.push({title:S.name,isLeaf:!(S.type==="tree"),key:D})}return R}function $(H,U,R){for(var m=0;m<H.length;m++){var S=H[m];if(S.key===U){S.children=R;break}S.children&&$(S.children,U,R)}return H}function O(H,U,R){var m;return function(){var S=this,D=arguments,A=function(){m=null,R||H.apply(S,D)},_=R&&!m;clearTimeout(m),m=setTimeout(A,U),_&&H.apply(S,D)}}var M=!0,z=le.a.API_SERVER},"C+DQ":function(pt,it,ie){},DlQD:function(pt,it,ie){(function(le,J){pt.exports=J()})(this,function(){"use strict";function le(Ee,ve){for(var be=0;be<ve.length;be++){var re=ve[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function J(Ee,ve,be){return ve&&le(Ee.prototype,ve),be&&le(Ee,be),Ee}function k(Ee,ve){if(!Ee)return;if(typeof Ee=="string")return $(Ee,ve);var be=Object.prototype.toString.call(Ee).slice(8,-1);if(be==="Object"&&Ee.constructor&&(be=Ee.constructor.name),be==="Map"||be==="Set")return Array.from(Ee);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return $(Ee,ve)}function $(Ee,ve){(ve==null||ve>Ee.length)&&(ve=Ee.length);for(var be=0,re=new Array(ve);be<ve;be++)re[be]=Ee[be];return re}function O(Ee,ve){var be;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(be=k(Ee))||ve&&Ee&&typeof Ee.length=="number"){be&&(Ee=be);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}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 be=Ee[Symbol.iterator](),be.next.bind(be)}function M(Ee,ve){return ve={exports:{}},Ee(ve,ve.exports),ve.exports}var z=M(function(Ee){function ve(){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 be(re){Ee.exports.defaults=re}Ee.exports={defaults:ve(),getDefaults:ve,changeDefaults:be}}),H=z.defaults,U=z.getDefaults,R=z.changeDefaults,m=/[&<>"']/,S=/[&<>"']/g,D=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},C=function(ve){return _[ve]};function l(Ee,ve){if(ve){if(m.test(Ee))return Ee.replace(S,C)}else if(D.test(Ee))return Ee.replace(A,C);return Ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(o,function(ve,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(Ee,ve){Ee=Ee.source||Ee,ve=ve||"";var be={replace:function(ne,de){return de=de.source||de,de=de.replace(d,"$1"),Ee=Ee.replace(ne,de),be},getRegex:function(){return new RegExp(Ee,ve)}};return be}var g=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(Ee,ve,be){if(Ee){var re;try{re=decodeURIComponent(s(be)).replace(g,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ve&&!v.test(be)&&(be=a(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ne){return null}return be}var b={},c=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Ee,ve){b[" "+Ee]||(c.test(Ee)?b[" "+Ee]=Ee+"/":b[" "+Ee]=B(Ee,"/",!0)),Ee=b[" "+Ee];var be=Ee.indexOf(":")===-1;return ve.substring(0,2)==="//"?be?ve:Ee.replace(p,"$1")+ve:ve.charAt(0)==="/"?be?ve:Ee.replace(h,"$1")+ve:Ee+ve}var E={exec:function(){}};function y(Ee){for(var ve=1,be,re;ve<arguments.length;ve++){be=arguments[ve];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(Ee[re]=be[re])}return Ee}function x(Ee,ve){var be=Ee.replace(/\|/g,function(de,ue,fe){for(var Le=!1,Ne=ue;--Ne>=0&&fe[Ne]==="\\";)Le=!Le;return Le?"|":" |"}),re=be.split(/ \|/),ne=0;if(re.length>ve)re.splice(ve);else for(;re.length<ve;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function B(Ee,ve,be){var re=Ee.length;if(re===0)return"";for(var ne=0;ne<re;){var de=Ee.charAt(re-ne-1);if(de===ve&&!be)ne++;else if(de!==ve&&be)ne++;else break}return Ee.substr(0,re-ne)}function F(Ee,ve){if(Ee.indexOf(ve[1])===-1)return-1;for(var be=Ee.length,re=0,ne=0;ne<be;ne++)if(Ee[ne]==="\\")ne++;else if(Ee[ne]===ve[0])re++;else if(Ee[ne]===ve[1]&&(re--,re<0))return ne;return-1}function K(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:l,unescape:s,edit:w,cleanUrl:L,resolveUrl:a,noopTest:E,merge:y,splitCells:x,rtrim:B,findClosingBracket:F,checkSanitizeDeprecation:K},P=z.defaults,I=V.rtrim,Y=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function pe(Ee,ve,be){var re=ve.href,ne=ve.title?ee(ve.title):null,de=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ne,text:de}:{type:"image",raw:be,href:re,title:ne,text:ee(de)}}function Oe(Ee,ve){var be=Ee.match(/^(\s+)(?:```)/);if(be===null)return ve;var re=be[1];return ve.split(`
`).map(function(ne){var de=ne.match(/^\s+/);if(de===null)return ne;var ue=de[0];return ue.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var Se=function(){function Ee(be){this.options=be||P}var ve=Ee.prototype;return ve.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ve.code=function(re,ne){var de=this.rules.block.code.exec(re);if(de){var ue=ne[ne.length-1];if(ue&&ue.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var fe=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:I(fe,`
`)}}},ve.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var de=ne[0],ue=Oe(de,ne[3]||"");return{type:"code",raw:de,lang:ne[2]?ne[2].trim():ne[2],text:ue}}},ve.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ve.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var de={type:"table",header:Y(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(de.header.length===de.align.length){var ue=de.align.length,fe;for(fe=0;fe<ue;fe++)/^ *-+: *$/.test(de.align[fe])?de.align[fe]="right":/^ *:-+: *$/.test(de.align[fe])?de.align[fe]="center":/^ *:-+ *$/.test(de.align[fe])?de.align[fe]="left":de.align[fe]=null;for(ue=de.cells.length,fe=0;fe<ue;fe++)de.cells[fe]=Y(de.cells[fe],de.header.length);return de}}},ve.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},ve.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var de=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:de}}},ve.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var de=ne[0],ue=ne[2],fe=ue.length>1,Le=ue[ue.length-1]===")",Ne={type:"list",raw:de,ordered:fe,start:fe?+ue.slice(0,-1):"",loose:!1,items:[]},$e=ne[0].match(this.rules.block.item),ht=!1,Xe,gt,st,qe,Dt,Et,kt,Ot=$e.length,Tt=0;Tt<Ot;Tt++)Xe=$e[Tt],de=Xe,gt=Xe.length,Xe=Xe.replace(/^ *([*+-]|\d+[.)]) */,""),~Xe.indexOf(`
`)&&(gt-=Xe.length,Xe=this.options.pedantic?Xe.replace(/^ {1,4}/gm,""):Xe.replace(new RegExp("^ {1,"+gt+"}","gm"),"")),Tt!==Ot-1&&(st=this.rules.block.bullet.exec($e[Tt+1])[0],(fe?st.length===1||!Le&&st[st.length-1]===")":st.length>1||this.options.smartLists&&st!==ue)&&(qe=$e.slice(Tt+1).join(`
`),Ne.raw=Ne.raw.substring(0,Ne.raw.length-qe.length),Tt=Ot-1)),Dt=ht||/\n\n(?!\s*$)/.test(Xe),Tt!==Ot-1&&(ht=Xe.charAt(Xe.length-1)===`
`,Dt||(Dt=ht)),Dt&&(Ne.loose=!0),Et=/^\[[ xX]\] /.test(Xe),kt=void 0,Et&&(kt=Xe[1]!==" ",Xe=Xe.replace(/^\[[ xX]\] +/,"")),Ne.items.push({type:"list_item",raw:de,task:Et,checked:kt,loose:Dt,text:Xe});return Ne}},ve.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ee(ne[0]):ne[0]}},ve.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var de=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ne[0],href:ne[2],title:ne[3]}}},ve.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var de={type:"table",header:Y(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=ne[0];var ue=de.align.length,fe;for(fe=0;fe<ue;fe++)/^ *-+: *$/.test(de.align[fe])?de.align[fe]="right":/^ *:-+: *$/.test(de.align[fe])?de.align[fe]="center":/^ *:-+ *$/.test(de.align[fe])?de.align[fe]="left":de.align[fe]=null;for(ue=de.cells.length,fe=0;fe<ue;fe++)de.cells[fe]=Y(de.cells[fe].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ve.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ve.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ve.text=function(re,ne){var de=this.rules.block.text.exec(re);if(de){var ue=ne[ne.length-1];return ue&&ue.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ve.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ee(ne[1])}},ve.tag=function(re,ne,de){var ue=this.rules.inline.tag.exec(re);if(ue)return!ne&&/^<a /i.test(ue[0])?ne=!0:ne&&/^<\/a>/i.test(ue[0])&&(ne=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:ne,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ee(ue[0]):ue[0]}},ve.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var de=oe(ne[2],"()");if(de>-1){var ue=ne[0].indexOf("!")===0?5:4,fe=ue+ne[1].length+de;ne[2]=ne[2].substring(0,de),ne[0]=ne[0].substring(0,fe).trim(),ne[3]=""}var Le=ne[2],Ne="";if(this.options.pedantic){var $e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);$e?(Le=$e[1],Ne=$e[3]):Ne=""}else Ne=ne[3]?ne[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=pe(ne,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Ne&&Ne.replace(this.rules.inline._escapes,"$1")},ne[0]);return ht}},ve.reflink=function(re,ne){var de;if((de=this.rules.inline.reflink.exec(re))||(de=this.rules.inline.nolink.exec(re))){var ue=(de[2]||de[1]).replace(/\s+/g," ");if(ue=ne[ue.toLowerCase()],!ue||!ue.href){var fe=de[0].charAt(0);return{type:"text",raw:fe,text:fe}}var Le=pe(de,ue,de[0]);return Le}},ve.strong=function(re,ne,de){de===void 0&&(de="");var ue=this.rules.inline.strong.start.exec(re);if(ue&&(!ue[1]||ue[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var fe=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var Le;(ue=fe.exec(ne))!=null;)if(Le=this.rules.inline.strong.middle.exec(ne.slice(0,ue.index+3)),Le)return{type:"strong",raw:re.slice(0,Le[0].length),text:re.slice(2,Le[0].length-2)}}},ve.em=function(re,ne,de){de===void 0&&(de="");var ue=this.rules.inline.em.start.exec(re);if(ue&&(!ue[1]||ue[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var fe=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var Le;(ue=fe.exec(ne))!=null;)if(Le=this.rules.inline.em.middle.exec(ne.slice(0,ue.index+2)),Le)return{type:"em",raw:re.slice(0,Le[0].length),text:re.slice(1,Le[0].length-1)}}},ve.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var de=ne[2].replace(/\n/g," "),ue=/[^ ]/.test(de),fe=de.startsWith(" ")&&de.endsWith(" ");return ue&&fe&&(de=de.substring(1,de.length-1)),de=ee(de,!0),{type:"codespan",raw:ne[0],text:de}}},ve.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},ve.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ve.autolink=function(re,ne){var de=this.rules.inline.autolink.exec(re);if(de){var ue,fe;return de[2]==="@"?(ue=ee(this.options.mangle?ne(de[1]):de[1]),fe="mailto:"+ue):(ue=ee(de[1]),fe=ue),{type:"link",raw:de[0],text:ue,href:fe,tokens:[{type:"text",raw:ue,text:ue}]}}},ve.url=function(re,ne){var de;if(de=this.rules.inline.url.exec(re)){var ue,fe;if(de[2]==="@")ue=ee(this.options.mangle?ne(de[0]):de[0]),fe="mailto:"+ue;else{var Le;do Le=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Le!==de[0]);ue=ee(de[0]),de[1]==="www."?fe="http://"+ue:fe=ue}return{type:"link",raw:de[0],text:ue,href:fe,tokens:[{type:"text",raw:ue,text:ue}]}}},ve.inlineText=function(re,ne,de){var ue=this.rules.inline.text.exec(re);if(ue){var fe;return ne?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ee(ue[0]):ue[0]:fe=ee(this.options.smartypants?de(ue[0]):ue[0]),{type:"text",raw:ue[0],text:fe}}},Ee}(),we=V.noopTest,Te=V.edit,Ce=V.merge,me={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:we,table:we,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=Te(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=Te(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Te(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=Te(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Te(me._paragraph).replace("hr",me.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",me._tag).getRegex(),me.blockquote=Te(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ce({},me),me.gfm=Ce({},me.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*|$)"}),me.gfm.nptable=Te(me.gfm.nptable).replace("hr",me.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",me._tag).getRegex(),me.gfm.table=Te(me.gfm.table).replace("hr",me.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",me._tag).getRegex(),me.pedantic=Ce({},me.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._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:we,paragraph:Te(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:we,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:we,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Te(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Te(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Te(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Te(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Te(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Te(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Te(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Te(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Te(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Te(se._blockSkip,"g").getRegex(),se.overlapSkip=Te(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=Te(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Te(se.tag).replace("comment",me._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Te(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Te(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Te(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=Ce({},se),se.pedantic=Ce({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=Ce({},se.normal,{escape:Te(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Te(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=Ce({},se.gfm,{br:Te(se.br).replace("{2,}","*").getRegex(),text:Te(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:se},ce=z.defaults,ae=te.block,Ae=te.inline;function Re(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function xe(Ee){var ve="",be,re,ne=Ee.length;for(be=0;be<ne;be++)re=Ee.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),ve+="&#"+re+";";return ve}var ke=function(){function Ee(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||ce,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:Ae.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=Ae.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=Ae.breaks:re.inline=Ae.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ne){var de=new Ee(ne);return de.lex(re)};var ve=Ee.prototype;return ve.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(re,ne,de){ne===void 0&&(ne=[]),de===void 0&&(de=!0),re=re.replace(/^ +$/gm,"");for(var ue,fe,Le,Ne;re;){if(ue=this.tokenizer.space(re)){re=re.substring(ue.raw.length),ue.type&&ne.push(ue);continue}if(ue=this.tokenizer.code(re,ne)){re=re.substring(ue.raw.length),ue.type?ne.push(ue):(Ne=ne[ne.length-1],Ne.raw+=`
`+ue.raw,Ne.text+=`
`+ue.text);continue}if(ue=this.tokenizer.fences(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.heading(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.nptable(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.hr(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.blockquote(re)){re=re.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],de),ne.push(ue);continue}if(ue=this.tokenizer.list(re)){for(re=re.substring(ue.raw.length),Le=ue.items.length,fe=0;fe<Le;fe++)ue.items[fe].tokens=this.blockTokens(ue.items[fe].text,[],!1);ne.push(ue);continue}if(ue=this.tokenizer.html(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(de&&(ue=this.tokenizer.def(re))){re=re.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(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.lheading(re)){re=re.substring(ue.raw.length),ne.push(ue);continue}if(de&&(ue=this.tokenizer.paragraph(re))){re=re.substring(ue.raw.length),ne.push(ue);continue}if(ue=this.tokenizer.text(re,ne)){re=re.substring(ue.raw.length),ue.type?ne.push(ue):(Ne=ne[ne.length-1],Ne.raw+=`
`+ue.raw,Ne.text+=`
`+ue.text);continue}if(re){var $e="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return ne},ve.inline=function(re){var ne,de,ue,fe,Le,Ne,$e=re.length;for(ne=0;ne<$e;ne++){Ne=re[ne];switch(Ne.type){case"paragraph":case"text":case"heading":{Ne.tokens=[],this.inlineTokens(Ne.text,Ne.tokens);break}case"table":{for(Ne.tokens={header:[],cells:[]},fe=Ne.header.length,de=0;de<fe;de++)Ne.tokens.header[de]=[],this.inlineTokens(Ne.header[de],Ne.tokens.header[de]);for(fe=Ne.cells.length,de=0;de<fe;de++)for(Le=Ne.cells[de],Ne.tokens.cells[de]=[],ue=0;ue<Le.length;ue++)Ne.tokens.cells[de][ue]=[],this.inlineTokens(Le[ue],Ne.tokens.cells[de][ue]);break}case"blockquote":{this.inline(Ne.tokens);break}case"list":{for(fe=Ne.items.length,de=0;de<fe;de++)this.inline(Ne.items[de].tokens);break}}}return re},ve.inlineTokens=function(re,ne,de,ue,fe){ne===void 0&&(ne=[]),de===void 0&&(de=!1),ue===void 0&&(ue=!1),fe===void 0&&(fe="");var Le,Ne=re,$e;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;($e=this.tokenizer.rules.inline.reflinkSearch.exec(Ne))!=null;)ht.includes($e[0].slice($e[0].lastIndexOf("[")+1,-1))&&(Ne=Ne.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($e=this.tokenizer.rules.inline.blockSkip.exec(Ne))!=null;)Ne=Ne.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Le=this.tokenizer.escape(re)){re=re.substring(Le.raw.length),ne.push(Le);continue}if(Le=this.tokenizer.tag(re,de,ue)){re=re.substring(Le.raw.length),de=Le.inLink,ue=Le.inRawBlock,ne.push(Le);continue}if(Le=this.tokenizer.link(re)){re=re.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ue)),ne.push(Le);continue}if(Le=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ue)),ne.push(Le);continue}if(Le=this.tokenizer.strong(re,Ne,fe)){re=re.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],de,ue),ne.push(Le);continue}if(Le=this.tokenizer.em(re,Ne,fe)){re=re.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],de,ue),ne.push(Le);continue}if(Le=this.tokenizer.codespan(re)){re=re.substring(Le.raw.length),ne.push(Le);continue}if(Le=this.tokenizer.br(re)){re=re.substring(Le.raw.length),ne.push(Le);continue}if(Le=this.tokenizer.del(re)){re=re.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],de,ue),ne.push(Le);continue}if(Le=this.tokenizer.autolink(re,xe)){re=re.substring(Le.raw.length),ne.push(Le);continue}if(!de&&(Le=this.tokenizer.url(re,xe))){re=re.substring(Le.raw.length),ne.push(Le);continue}if(Le=this.tokenizer.inlineText(re,ue,Re)){re=re.substring(Le.raw.length),fe=Le.raw.slice(-1),ne.push(Le);continue}if(re){var Xe="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Xe);break}else throw new Error(Xe)}}return ne},J(Ee,null,[{key:"rules",get:function(){return{block:ae,inline:Ae}}}]),Ee}(),Pe=z.defaults,je=V.cleanUrl,We=V.escape,Be=function(){function Ee(be){this.options=be||Pe}var ve=Ee.prototype;return ve.code=function(re,ne,de){var ue=(ne||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight(re,ue);fe!=null&&fe!==re&&(de=!0,re=fe)}return ue?'<pre><code class="'+this.options.langPrefix+We(ue,!0)+'">'+(de?re:We(re,!0))+`</code></pre>
`:"<pre><code>"+(de?re:We(re,!0))+`</code></pre>
`},ve.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ve.html=function(re){return re},ve.heading=function(re,ne,de,ue){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+ue.slug(de)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(re,ne,de){var ue=ne?"ol":"ul",fe=ne&&de!==1?' start="'+de+'"':"";return"<"+ue+fe+`>
`+re+"</"+ue+`>
`},ve.listitem=function(re){return"<li>"+re+`</li>
`},ve.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(re){return"<p>"+re+`</p>
`},ve.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},ve.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ve.tablecell=function(re,ne){var de=ne.header?"th":"td",ue=ne.align?"<"+de+' align="'+ne.align+'">':"<"+de+">";return ue+re+"</"+de+`>
`},ve.strong=function(re){return"<strong>"+re+"</strong>"},ve.em=function(re){return"<em>"+re+"</em>"},ve.codespan=function(re){return"<code>"+re+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(re){return"<del>"+re+"</del>"},ve.link=function(re,ne,de){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ue='<a href="'+We(re)+'"';return ne&&(ue+=' title="'+ne+'"'),ue+=">"+de+"</a>",ue},ve.image=function(re,ne,de){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ue='<img src="'+re+'" alt="'+de+'"';return ne&&(ue+=' title="'+ne+'"'),ue+=this.options.xhtml?"/>":">",ue},ve.text=function(re){return re},Ee}(),Ie=function(){function Ee(){}var ve=Ee.prototype;return ve.strong=function(re){return re},ve.em=function(re){return re},ve.codespan=function(re){return re},ve.del=function(re){return re},ve.html=function(re){return re},ve.text=function(re){return re},ve.link=function(re,ne,de){return""+de},ve.image=function(re,ne,de){return""+de},ve.br=function(){return""},Ee}(),tt=function(){function Ee(){this.seen={}}var ve=Ee.prototype;return ve.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var de=ne;do this.seen[de]++,ne=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},Ee}(),Ze=z.defaults,Je=V.unescape,Ye=function(){function Ee(be){this.options=be||Ze,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ie,this.slugger=new tt}Ee.parse=function(re,ne){var de=new Ee(ne);return de.parse(re)};var ve=Ee.prototype;return ve.parse=function(re,ne){ne===void 0&&(ne=!0);var de="",ue,fe,Le,Ne,$e,ht,Xe,gt,st,qe,Dt,Et,kt,Ot,Tt,Zt,Qt,vt,Lt=re.length;for(ue=0;ue<Lt;ue++){qe=re[ue];switch(qe.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(qe.tokens),qe.depth,Je(this.parseInline(qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(qe.text,qe.lang,qe.escaped);continue}case"table":{for(gt="",Xe="",Ne=qe.header.length,fe=0;fe<Ne;fe++)Xe+=this.renderer.tablecell(this.parseInline(qe.tokens.header[fe]),{header:!0,align:qe.align[fe]});for(gt+=this.renderer.tablerow(Xe),st="",Ne=qe.cells.length,fe=0;fe<Ne;fe++){for(ht=qe.tokens.cells[fe],Xe="",$e=ht.length,Le=0;Le<$e;Le++)Xe+=this.renderer.tablecell(this.parseInline(ht[Le]),{header:!1,align:qe.align[Le]});st+=this.renderer.tablerow(Xe)}de+=this.renderer.table(gt,st);continue}case"blockquote":{st=this.parse(qe.tokens),de+=this.renderer.blockquote(st);continue}case"list":{for(Dt=qe.ordered,Et=qe.start,kt=qe.loose,Ne=qe.items.length,st="",fe=0;fe<Ne;fe++)Tt=qe.items[fe],Zt=Tt.checked,Qt=Tt.task,Ot="",Tt.task&&(vt=this.renderer.checkbox(Zt),kt?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=vt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=vt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:vt}):Ot+=vt),Ot+=this.parse(Tt.tokens,kt),st+=this.renderer.listitem(Ot,Qt,Zt);de+=this.renderer.list(st,Dt,Et);continue}case"html":{de+=this.renderer.html(qe.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(qe.tokens));continue}case"text":{for(st=qe.tokens?this.parseInline(qe.tokens):qe.text;ue+1<Lt&&re[ue+1].type==="text";)qe=re[++ue],st+=`
`+(qe.tokens?this.parseInline(qe.tokens):qe.text);de+=ne?this.renderer.paragraph(st):st;continue}default:{var jt='Token with "'+qe.type+'" type was not found.';if(this.options.silent){console.error(jt);return}else throw new Error(jt)}}}return de},ve.parseInline=function(re,ne){ne=ne||this.renderer;var de="",ue,fe,Le=re.length;for(ue=0;ue<Le;ue++){fe=re[ue];switch(fe.type){case"escape":{de+=ne.text(fe.text);break}case"html":{de+=ne.html(fe.text);break}case"link":{de+=ne.link(fe.href,fe.title,this.parseInline(fe.tokens,ne));break}case"image":{de+=ne.image(fe.href,fe.title,fe.text);break}case"strong":{de+=ne.strong(this.parseInline(fe.tokens,ne));break}case"em":{de+=ne.em(this.parseInline(fe.tokens,ne));break}case"codespan":{de+=ne.codespan(fe.text);break}case"br":{de+=ne.br();break}case"del":{de+=ne.del(this.parseInline(fe.tokens,ne));break}case"text":{de+=ne.text(fe.text);break}default:{var Ne='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Ne);return}else throw new Error(Ne)}}}return de},Ee}(),ft=V.merge,rt=V.checkSanitizeDeprecation,nt=V.escape,Me=z.getDefaults,dt=z.changeDefaults,lt=z.defaults;function Ue(Ee,ve,be){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof ve=="function"&&(be=ve,ve=null),ve=ft({},Ue.defaults,ve||{}),rt(ve),be){var re=ve.highlight,ne;try{ne=ke.lex(Ee,ve)}catch(Le){return be(Le)}var de=function(Ne){var $e;if(!Ne)try{$e=Ye.parse(ne,ve)}catch(ht){Ne=ht}return ve.highlight=re,Ne?be(Ne):be(null,$e)};if(!re||re.length<3)return de();if(delete ve.highlight,!ne.length)return de();var ue=0;Ue.walkTokens(ne,function(Le){Le.type==="code"&&(ue++,setTimeout(function(){re(Le.text,Le.lang,function(Ne,$e){if(Ne)return de(Ne);$e!=null&&$e!==Le.text&&(Le.text=$e,Le.escaped=!0),ue--,ue===0&&de()})},0))}),ue===0&&de();return}try{var fe=ke.lex(Ee,ve);return ve.walkTokens&&Ue.walkTokens(fe,ve.walkTokens),Ye.parse(fe,ve)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+nt(Le.message+"",!0)+"</pre>";throw Le}}Ue.options=Ue.setOptions=function(Ee){return ft(Ue.defaults,Ee),dt(Ue.defaults),Ue},Ue.getDefaults=Me,Ue.defaults=lt,Ue.use=function(Ee){var ve=ft({},Ee);if(Ee.renderer&&function(){var re=Ue.defaults.renderer||new Be,ne=function(fe){var Le=re[fe];re[fe]=function(){for(var Ne=arguments.length,$e=new Array(Ne),ht=0;ht<Ne;ht++)$e[ht]=arguments[ht];var Xe=Ee.renderer[fe].apply(re,$e);return Xe===!1&&(Xe=Le.apply(re,$e)),Xe}};for(var de in Ee.renderer)ne(de);ve.renderer=re}(),Ee.tokenizer&&function(){var re=Ue.defaults.tokenizer||new Se,ne=function(fe){var Le=re[fe];re[fe]=function(){for(var Ne=arguments.length,$e=new Array(Ne),ht=0;ht<Ne;ht++)$e[ht]=arguments[ht];var Xe=Ee.tokenizer[fe].apply(re,$e);return Xe===!1&&(Xe=Le.apply(re,$e)),Xe}};for(var de in Ee.tokenizer)ne(de);ve.tokenizer=re}(),Ee.walkTokens){var be=Ue.defaults.walkTokens;ve.walkTokens=function(re){Ee.walkTokens(re),be&&be(re)}}Ue.setOptions(ve)},Ue.walkTokens=function(Ee,ve){for(var be=O(Ee),re;!(re=be()).done;){var ne=re.value;ve(ne);switch(ne.type){case"table":{for(var de=O(ne.tokens.header),ue;!(ue=de()).done;){var fe=ue.value;Ue.walkTokens(fe,ve)}for(var Le=O(ne.tokens.cells),Ne;!(Ne=Le()).done;)for(var $e=Ne.value,ht=O($e),Xe;!(Xe=ht()).done;){var gt=Xe.value;Ue.walkTokens(gt,ve)}break}case"list":{Ue.walkTokens(ne.items,ve);break}default:ne.tokens&&Ue.walkTokens(ne.tokens,ve)}}},Ue.Parser=Ye,Ue.parser=Ye.parse,Ue.Renderer=Be,Ue.TextRenderer=Ie,Ue.Lexer=ke,Ue.lexer=ke.lex,Ue.Tokenizer=Se,Ue.Slugger=tt,Ue.parse=Ue;var Ke=Ue;return Ke})},EGTK:function(pt,it,ie){"use strict";var le=ie("R9oj"),J=ie("ECub"),k=ie("T2oS"),$=ie("W9HT"),O=ie("5NDa"),M=ie("5rEg"),z=ie("k1fw"),H=ie("9og8"),U=ie("tJVT"),R=ie("WmNS"),m=ie.n(R),S=ie("q1tI"),D=ie.n(S),A=ie("TSYQ"),_=ie.n(A),C=ie("dGDm"),l=ie.n(C),o=ie("Lai7"),s=ie.n(o),d=ie("ErOA"),w=ie("LvDl"),g=ie.n(w),v=function(c){var p=c.className,h=c.dispatch,a=c.skin,E=a===void 0?"white":a,y=c.value,x=y===void 0?null:y,B=c.loading,F=B===void 0?!1:B,K=c.data,V=K===void 0?[]:K,P=c.otherData,I=P===void 0?[]:P,Y=c.tags,ee=Y===void 0?[]:Y,oe=c.onChange,pe=oe===void 0?function(){}:oe,Oe=Object(S.useState)(""),Se=Object(U.a)(Oe,2),we=Se[0],Te=Se[1],Ce=Object(S.useState)(!1),me=Object(U.a)(Ce,2),se=me[0],te=me[1],ce=Object(S.useState)([]),ae=Object(U.a)(ce,2),Ae=ae[0],Re=ae[1],xe=Object(S.useState)(0),ke=Object(U.a)(xe,2),Pe=ke[0],je=ke[1],We=Object(S.useRef)(null),Be=Object(S.useRef)(String(Math.floor(Math.random()*1e6))).current,Ie=Object(S.useRef)(),tt=Object(S.useRef)(null),Ze=Object(S.useRef)(0),Je=Object(S.useRef)([]);Object(S.useEffect)(function(){return window.addEventListener("keydown",Ye),function(){window.removeEventListener("keydown",Ye)}},[we,se,Ae]);var Ye=function(fe){if(!se||fe.keyCode!==40&&fe.keyCode!==38)return;var Le=0;fe.keyCode===40&&se&&(Pe<Ae.length-1?Le=Pe+1:Le=0,console.log("\u4E0B"),Me(Le,"down")),fe.keyCode===38&&se&&(Pe===0?Le=Ae.length-1:Le=Pe-1,Me(Le,"up")),je(Le),rt(we,Le,!0)},ft=function(fe,Le){var Ne=function(Xe){var gt=/[\^\.\\\|\(\)\*\+\-\$\[\]\?]/g,st={};return st["^"]="\\^",st["."]="\\.",st["\\"]="\\\\",st["|"]="\\|",st["("]="\\(",st[")"]="\\)",st["*"]="\\*",st["+"]="\\+",st["-"]="\\-",st.$="$",st["["]="\\[",st["]"]="\\]",st["?"]="\\?",Xe=Xe.replace(gt,function(qe){return st[qe]}),Xe},$e=new RegExp(Ne(Le),"gi");return fe=fe.replace($e,function(ht){return"<span style='color:#0152d9;'>"+ht+"</span>"}),fe},rt=function(){var ue=Object(H.a)(m.a.mark(function fe(Le,Ne,$e){var ht,Xe,gt;return m.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:if(ht=Ze.current+1,Ze.current=ht,Xe=function(Et){var kt=Et==null?void 0:Et.map(function(Ot,Tt){var Zt=Ot.id,Qt=Ot.name,vt=Object(z.a)(Object(z.a)({},Ot),{},{label:D.a.createElement("ul",{id:"search-".concat(Be,"-").concat(Tt),onClick:function(){return Ue(Zt,vt)},className:Tt===Ne?l.a.searchListActive:l.a.searchList},D.a.createElement("li",{className:l.a.name,dangerouslySetInnerHTML:{__html:ft(Qt,Le)}}),Ot.private&&D.a.createElement("li",{className:l.a.tag},"\u79C1\u6709"))});return vt});return kt},!$e){qe.next=7;break}return gt=Xe(Je.current),Re(gt),qe.abrupt("return");case 7:clearTimeout(tt.current),tt.current=setTimeout(Object(H.a)(m.a.mark(function Dt(){var Et,kt,Ot,Tt;return m.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(d.a)("/api/shixuns/search_image.json",{method:"get",params:{keywords:Le,page:1,limit:1e5}});case 2:Et=Qt.sent,(Et==null?void 0:Et.status)===0&&(Ot=Xe((Et==null||((kt=Et.data)===null||kt===void 0)?void 0:kt.mirrors)||[]),ht===Ze.current&&(Re(Ot),Je.current=Object(w.cloneDeep)((Et==null||((Tt=Et.data)===null||Tt===void 0)?void 0:Tt.mirrors)||[])));case 4:case"end":return Qt.stop()}},Dt)})),300);case 9:case"end":return qe.stop()}},fe)}));return function(Le,Ne,$e){return ue.apply(this,arguments)}}(),nt=function(fe){var Le=document.getElementById("scroll-".concat(Be,"-").concat(fe));if(!Le)return;var Ne=document.getElementById("scroll-".concat(Be));Ne.scrollTo(0,Le.offsetTop)},Me=function(fe,Le){var Ne=document.getElementById("search-".concat(Be,"-").concat(fe));if(!Ne)return;var $e=document.getElementById("search-".concat(Be)),ht=Ne.offsetTop-$e.scrollTop>0&&Ne.offsetTop-$e.scrollTop<$e.clientHeight;if(ht)return;Le==="down"?$e.scrollTo(0,Ne.offsetTop-$e.clientHeight+Ne.clientHeight):$e.scrollTo(0,Ne.offsetTop)},dt=function(fe){rt(fe,0),Te(fe)},lt=function(fe){var Le,Ne;if(!Ae.length)return;var $e=Ae==null||((Le=Ae[Pe])===null||Le===void 0)?void 0:Le.id;pe($e),Re([]),je(0),Te(Ae==null||((Ne=Ae[Pe])===null||Ne===void 0)?void 0:Ne.name),nt($e),Ie.current.blur()},Ue=function(fe,Le){pe(fe),Re([]),je(0),Te(Le==null?void 0:Le.name),nt(fe)},Ke=function(){Re([]),Te("")},Ee=function(fe){pe(fe),Re([]),Te("")},ve=function(){return we===""?D.a.createElement("i",{style:{pointerEvents:"none"},className:"iconfont icon-sousuo2 c-grey-c"}):D.a.createElement("i",{onClick:Ke,className:"iconfont icon-shanchu4 c-grey-c"})},be=function(){h({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},re=function(){h({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})},ne=function(){We.current=setTimeout(function(){te(!1),je(0)},200)},de=!(V!=null&&V.length)&&!(I!=null&&I.length);return D.a.createElement("div",{className:_()(E==="night"?l.a.darklySelectEnvironment:l.a.selectEnvironment,p)},!de&&D.a.createElement("div",{className:l.a.search},D.a.createElement(M.a,{suffix:ve(),bordered:!1,ref:Ie,value:we,onKeyDown:function(fe){(fe.keyCode===40||fe.keyCode===38)&&fe.preventDefault()},size:"large",onFocus:function(){clearTimeout(We.current),dt(we),te(!0)},onBlur:ne,onChange:function(fe){return dt(fe.target.value)},placeholder:"\u641C\u7D22\u60A8\u9700\u8981\u7684\u5B9E\u9A8C\u73AF\u5883",onPressEnter:lt}),se&&D.a.createElement("div",{id:"search-".concat(Be),className:l.a.searchListWrap},Ae.map(function(ue,fe){return D.a.createElement(D.a.Fragment,{key:fe}," ",ue.label)}))),F?D.a.createElement($.a,{className:l.a.spin}):D.a.createElement(D.a.Fragment,null,de&&D.a.createElement(J.a,{style:{margin:"60px 0"},image:s.a,description:D.a.createElement("span",{className:"c-grey-999"},"\u6682\u65E0\u5B9E\u9A8C\u73AF\u5883")}),!!ee.length&&D.a.createElement("aside",{className:l.a.common},D.a.createElement("div",{className:l.a.title},"\u63A8\u8350\u73AF\u5883:"),D.a.createElement("ul",{className:l.a.tags},ee.map(function(ue,fe){return D.a.createElement("li",{key:fe,onClick:function(){return Ee(ue.id)},className:x===ue.id?"".concat(l.a.tag," ").concat(l.a.tagActive):l.a.tag},ue.name)}))),D.a.createElement("aside",{className:l.a.wrap,id:"scroll-".concat(Be)},V.map(function(ue,fe){var Le;return ue!=null&&(Le=ue.image)!==null&&Le!==void 0&&Le.length?D.a.createElement(L,{key:fe,data:ue,id:x,handleClick:function($e){return Ee($e)}}):null}),D.a.createElement("ul",{className:l.a.allList},I.map(function(ue){return D.a.createElement("li",{key:"key-".concat(ue.id),id:"scroll-".concat(Be,"-").concat(ue.id),className:ue.id===x?"".concat(l.a.item," ").concat(l.a.itemActive):l.a.item,onClick:function(){return pe(ue.id)}},D.a.createElement("div",{className:l.a.name},ue.name),ue.private&&D.a.createElement("div",{className:l.a.tag},"\u79C1\u6709"))})))),D.a.createElement("div",{className:l.a.apply},D.a.createElement("span",{className:l.a.p1},"\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"),D.a.createElement("span",{className:l.a.p2,onClick:be}," ","\u7533\u8BF7\u65B0\u5EFA"),D.a.createElement("span",{className:l.a.p2,onClick:re}," ","\u5728\u7EBF\u521B\u5EFA")))},L=function(c){var p=c.data,h=c.id,a=c.handleClick,E=Object(S.useState)(!0),y=Object(U.a)(E,2),x=y[0],B=y[1],F=p.name,K=p.image;return D.a.createElement("div",{className:l.a.list},D.a.createElement("header",{onClick:function(){return B(!x)}},D.a.createElement("div",{className:l.a.title},F),D.a.createElement("i",{style:{transition:"0.5s",transform:x?"rotate(0deg)":"rotate(180deg)"},className:"iconfont icon-shangjiantou c-grey-999"})),D.a.createElement("ul",{className:l.a.items,style:{height:x?"auto":0}},K.map(function(V){return D.a.createElement("li",{key:V.id,className:V.id===h?"".concat(l.a.item," ").concat(l.a.itemActive):l.a.item,onClick:function(){return a(V.id)}},D.a.createElement("div",{className:l.a.name},V.name),V.private&&D.a.createElement("div",{className:l.a.tag},"\u79C1\u6709"))}),D.a.createElement("li",{className:l.a.line})))};it.a=v},ELLl:function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=le.Pos;le.defineOption("autoCloseBrackets",!1,function(_,C,l){l&&l!=le.Init&&(_.removeKeyMap(O),_.state.closeBrackets=null),C&&(M($(C,"pairs")),_.state.closeBrackets=C,_.addKeyMap(O))});function $(_,C){return C=="pairs"&&typeof _=="string"?_:typeof _=="object"&&_[C]!=null?_[C]:J[C]}var O={Backspace:U,Enter:R};function M(_){for(var C=0;C<_.length;C++){var l=_.charAt(C),o="'"+l+"'";O[o]||(O[o]=z(l))}}M(J.pairs+"`");function z(_){return function(C){return S(C,_)}}function H(_){var C=_.state.closeBrackets;if(!C||C.override)return C;var l=_.getModeAt(_.getCursor());return l.closeBrackets||C}function U(_){var C=H(_);if(!C||_.getOption("disableInput"))return le.Pass;for(var l=$(C,"pairs"),o=_.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return le.Pass;var d=D(_,o[s].head);if(!d||l.indexOf(d)%2!=0)return le.Pass}for(var s=o.length-1;s>=0;s--){var w=o[s].head;_.replaceRange("",k(w.line,w.ch-1),k(w.line,w.ch+1),"+delete")}}function R(_){var C=H(_),l=C&&$(C,"explode");if(!l||_.getOption("disableInput"))return le.Pass;for(var o=_.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return le.Pass;var d=D(_,o[s].head);if(!d||l.indexOf(d)%2!=0)return le.Pass}_.operation(function(){var w=_.lineSeparator()||`
`;_.replaceSelection(w+w,null),_.execCommand("goCharLeft"),o=_.listSelections();for(var g=0;g<o.length;g++){var v=o[g].head.line;_.indentLine(v,null,!0),_.indentLine(v+1,null,!0)}})}function m(_){var C=le.cmpPos(_.anchor,_.head)>0;return{anchor:new k(_.anchor.line,_.anchor.ch+(C?-1:1)),head:new k(_.head.line,_.head.ch+(C?1:-1))}}function S(_,C){var l=H(_);if(!l||_.getOption("disableInput"))return le.Pass;var o=$(l,"pairs"),s=o.indexOf(C);if(s==-1)return le.Pass;for(var d=$(l,"closeBefore"),w=$(l,"triples"),g=o.charAt(s+1)==C,v=_.listSelections(),L=s%2==0,b,c=0;c<v.length;c++){var p=v[c],h=p.head,a,E=_.getRange(h,k(h.line,h.ch+1));if(L&&!p.empty())a="surround";else if((g||!L)&&E==C)g&&A(_,h)?a="both":w.indexOf(C)>=0&&_.getRange(h,k(h.line,h.ch+3))==C+C+C?a="skipThree":a="skip";else if(g&&h.ch>1&&w.indexOf(C)>=0&&_.getRange(k(h.line,h.ch-2),h)==C+C){if(h.ch>2&&/\bstring/.test(_.getTokenTypeAt(k(h.line,h.ch-2))))return le.Pass;a="addFour"}else if(g){var y=h.ch==0?" ":_.getRange(k(h.line,h.ch-1),h);if(!le.isWordChar(E)&&y!=C&&!le.isWordChar(y))a="both";else return le.Pass}else if(L&&(E.length===0||/\s/.test(E)||d.indexOf(E)>-1))a="both";else return le.Pass;if(!b)b=a;else if(b!=a)return le.Pass}var x=s%2?o.charAt(s-1):C,B=s%2?C:o.charAt(s+1);_.operation(function(){if(b=="skip")_.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)_.execCommand("goCharRight");else if(b=="surround"){for(var K=_.getSelections(),F=0;F<K.length;F++)K[F]=x+K[F]+B;_.replaceSelections(K,"around"),K=_.listSelections().slice();for(var F=0;F<K.length;F++)K[F]=m(K[F]);_.setSelections(K)}else b=="both"?(_.replaceSelection(x+B,null),_.triggerElectric(x+B),_.execCommand("goCharLeft")):b=="addFour"&&(_.replaceSelection(x+x+x+x,"before"),_.execCommand("goCharRight"))})}function D(_,C){var l=_.getRange(k(C.line,C.ch-1),k(C.line,C.ch+1));return l.length==2?l:null}function A(_,C){var l=_.getTokenAt(k(C.line,C.ch+1));return/\bstring/.test(l.type)&&l.start==C.ch&&(C.ch==0||!/\bstring/.test(_.getTokenTypeAt(C)))}})},FPkq:function(pt,it,ie){pt.exports=ie.p+"static/qrCode.dd0fe9b2.png"},FrRK:function(pt,it,ie){"use strict";var le=ie("+L6B"),J=ie("2/Rp"),k=ie("DZo9"),$=ie("8z0m"),O=ie("miYZ"),M=ie("tsqr"),z=ie("9og8"),H=ie("2qtc"),U=ie("kLXV"),R=ie("y8nQ"),m=ie("Vl3Y"),S=ie("tJVT"),D=ie("PpiC"),A=ie("5NDa"),_=ie("5rEg"),C=ie("WmNS"),l=ie.n(C),o=ie("q1tI"),s=ie.n(o),d=ie("9kvl"),w=ie("m3rI"),g=ie("FPkq"),v=ie.n(g),L=ie("qB8g"),b=ie.n(L),c=_.a.TextArea,p=function(a){var E=a.newShixuns,y=a.globalSetting,x=a.loading,B=a.dispatch,F=Object(D.a)(a,["newShixuns","globalSetting","loading","dispatch"]),K=m.a.useForm(),V=Object(S.a)(K,1),P=V[0],I=Object(o.useState)([]),Y=Object(S.a)(I,2),ee=Y[0],oe=Y[1],pe=function(me){var se=["uploading","done","removed"];se.includes(me.file.status)&&oe(me.fileList)},Oe=function(me){if(!me.percent||me.percent==100){var se,te=(se=me.response)===null||se===void 0?void 0:se.id;return U.a.confirm({centered:!0,title:"\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A\u9644\u4EF6\u5417?",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var ce=Object(z.a)(l.a.mark(function Ae(){var Re;return l.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,B({type:"newShixuns/deleteAttachment",payload:{id:te}});case 2:Re=ke.sent,Re&&oe(ee.filter(function(Pe){var je;return((je=Pe.response)===null||je===void 0?void 0:je.id)!==te}));case 4:case"end":return ke.stop()}},Ae)}));function ae(){return ce.apply(this,arguments)}return ae}()}),!1}},Se=function(me){if(ee.length)return!1;var se=me.size/1024/1024>50;return se?(M.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E50MB"),!1):!0},we=function(){var Ce=Object(z.a)(l.a.mark(function me(se){var te,ce,ae,Ae,Re,xe,ke,Pe;return l.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return ae=se||{},Ae=ae.language,Re=ae.env,xe=ae.mode,ke=ae.code,We.next=3,B({type:"newShixuns/applyShixunMirror",payload:{language:Ae,runtime:Re,run_method:xe,attachment_id:ee==null||((te=ee[0])===null||te===void 0||((ce=te.response)===null||ce===void 0))?void 0:ce.id}});case 3:Pe=We.sent,B({type:"newShixuns/setActionTabs",payload:{}}),Pe&&M.b.success("\u65B0\u5EFA\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u5BA1\u6838\u3002");case 6:case"end":return We.stop()}},me)}));return function(se){return Ce.apply(this,arguments)}}(),Te=function(){P.resetFields(),oe([])};return s.a.createElement(U.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:E.actionTabs.key==="NewShixuns-Apply",title:"\u7533\u8BF7\u65B0\u5EFA",width:"1000px",footer:null,afterClose:Te},s.a.createElement("section",{className:b.a.qrCode},s.a.createElement("aside",{className:b.a.a1},s.a.createElement("div",{className:b.a.code},s.a.createElement("img",{width:120,height:120,src:v.a,alt:"\u4E8C\u7EF4\u7801"})),s.a.createElement("div",{className:b.a.group},"\u5B9E\u9A8C\u73AF\u5883\u7533\u8BF7QQ\u7FA4"),s.a.createElement("div",{className:b.a.groupNumber},"\u7FA4\u53F7\uFF1A740157011")),s.a.createElement("aside",{className:b.a.a2},"\u5C0A\u656C\u7684\u8001\u5E08/\u540C\u5B66\u60A8\u597D\uFF0C",s.a.createElement("br",null),"\u5982\u679C\u60A8\u60F3\u65B0\u5EFA\u5B9E\u9A8C\u73AF\u5883\uFF0C\u53EF\u4EE5\u626B\u63CF\u5DE6\u4FA7\u4E8C\u7EF4\u7801\u8FDB\u7FA4\uFF0C\u76F4\u63A5\u5411\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u7533\u8BF7\u54E6~ \u4E5F\u53EF\u4EE5\u63D0\u4EA4\u4E0B\u9762\u7684\u8868\u5355\u7533\u8BF7\uFF0C\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u6536\u5230\u7533\u8BF7\u4FE1\u606F\u5C06\u4F1A\u7B2C\u4E00\u65F6\u95F4\u8054\u7CFB\u60A8\uFF01")),s.a.createElement(m.a,{className:b.a.formWrap,form:P,labelCol:{span:4},wrapperCol:{span:20},onFinish:we},s.a.createElement(m.a.Item,{label:"\u8BED\u8A00\uFF1A",name:"language",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48\u8BED\u8A00\uFF1A\u793A\u4F8B\uFF1APython",rows:4})),s.a.createElement(m.a.Item,{label:"\u7CFB\u7EDF\u73AF\u5883\uFF1A",name:"env",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00\u7CFB\u7EDF\u73AF\u5883"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48linux\u7CFB\u7EDF\u73AF\u5883,\u4EE3\u7801\u8FD0\u884C\u73AF\u5883",rows:4})),s.a.createElement(m.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F\uFF1A",name:"mode",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F"}]},s.a.createElement(c,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u4E2D\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F",rows:4})),s.a.createElement(m.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\uFF1A",name:"code",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u9644\u4EF6"}]},s.a.createElement("div",{className:b.a.upload},s.a.createElement($.a,{fileList:ee,action:"".concat(w.a.API_SERVER,"/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a"),onChange:pe,onRemove:Oe,beforeUpload:Se,withCredentials:!0},s.a.createElement("span",{className:"".concat(b.a.color0152d9," current")},"\u4E0A\u4F20\u9644\u4EF6"),s.a.createElement("span",{className:"".concat(b.a.colorCCC," ml10")},"(\u5355\u4E2A\u6587\u4EF650M\u4EE5\u5185)")))),s.a.createElement("div",{className:b.a.footerWrap},s.a.createElement(m.a.Item,null,s.a.createElement(J.a,{className:"mr5",size:"large",onClick:function(){B({type:"newShixuns/setActionTabs",payload:{}})}},"\u53D6\u6D88"),s.a.createElement(J.a,{size:"large",type:"primary",htmlType:"submit",loading:x["newShixuns/applyShixunMirror"]},"\u4FDD\u5B58")))))};it.a=Object(d.a)(function(h){var a=h.newShixuns,E=h.loading,y=h.globalSetting;return{newShixuns:a,globalSetting:y,loading:E.effects}})(p)},GfqC:function(pt,it,ie){"use strict";var le=ie("q1tI"),J=ie.n(le),k=ie("TSYQ"),$=ie.n(k);function O(V,P){var I="cannot "+V.method+" "+V.action+" "+P.status+"'",Y=new Error(I);return Y.status=P.status,Y.method=V.method,Y.url=V.action,Y}function M(V){var P=V.responseText||V.response;if(!P)return P;try{return JSON.parse(P)}catch(I){return P}}function z(V){var P=new XMLHttpRequest;V.onProgress&&P.upload&&(P.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(pe){I.append(ee+"[]",pe)});return}I.append(ee,V.data[ee])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),P.onerror=function(oe){V.onError(oe)},P.onload=function(){return P.status<200||P.status>=300?V.onError(O(V,P),M(P)):V.onSuccess(M(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var Y=V.headers||{};return Y["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&P.setRequestHeader(ee,Y[ee])}),P.send(I),{abort:function(){P.abort()}}}var H=+new Date,U=0;function R(){return"rc-upload-"+H+"-"+ ++U}function m(V,P){return V.indexOf(P,V.length-P.length)!==-1}var S=function(V,P){if(V&&P){var I=Array.isArray(P)?P:P.split(","),Y=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return I.some(function(pe){var Oe=pe.trim();return Oe.charAt(0)==="."?m(Y.toLowerCase(),Oe.toLowerCase()):/\/\*$/.test(Oe)?oe===Oe.replace(/\/.*$/,""):ee===Oe})}return!0};function D(V,P){var I=V.createReader(),Y=[];function ee(){I.readEntries(function(oe){var pe=Array.prototype.slice.apply(oe);Y=Y.concat(pe);var Oe=!pe.length;Oe?P(Y):ee()})}ee()}var A=function(P,I,Y){var ee=function oe(pe,Oe){Oe=Oe||"",pe.isFile?pe.file(function(Se){Y(Se)&&(pe.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),I([Se]))}):pe.isDirectory&&D(pe,function(Se){Se.forEach(function(we){oe(we,""+Oe+pe.name+"/")})})};P.forEach(function(oe){ee(oe.webkitGetAsEntry())})},_=A,C=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var Y in I)Object.prototype.hasOwnProperty.call(I,Y)&&(V[Y]=I[Y])}return V},l=function(){function V(P,I){var Y=[],ee=!0,oe=!1,pe=void 0;try{for(var Oe=P[Symbol.iterator](),Se;!(ee=(Se=Oe.next()).done)&&!(Y.push(Se.value),I&&Y.length===I);ee=!0);}catch(we){oe=!0,pe=we}finally{try{!ee&&Oe.return&&Oe.return()}finally{if(oe)throw pe}}return Y}return function(P,I){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return V(P,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(P,I){for(var Y=0;Y<I.length;Y++){var ee=I[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(P,ee.key,ee)}}return function(P,I,Y){return I&&V(P.prototype,I),Y&&V(P,Y),P}}();function s(V,P,I){return P in V?Object.defineProperty(V,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):V[P]=I,V}function d(V,P){var I={};for(var Y in V){if(P.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,Y))continue;I[Y]=V[Y]}return I}function w(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function g(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function v(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}var L=function(P){return Object.keys(P).reduce(function(I,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(I[Y]=P[Y]),I},{})},b=function(V){v(P,V);function P(){var I,Y,ee,oe;w(this,P);for(var pe=arguments.length,Oe=Array(pe),Se=0;Se<pe;Se++)Oe[Se]=arguments[Se];return oe=(Y=(ee=g(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Oe))),ee),ee.state={uid:R()},ee.reqs={},ee.onChange=function(we){var Te=we.target.files;ee.uploadFiles(Te),ee.reset()},ee.onClick=function(we){var Te=ee.fileInput;if(!Te)return;var Ce=ee.props,me=Ce.children,se=Ce.onClick;me&&me.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),se&&se(we)},ee.onKeyDown=function(we){we.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(we){var Te=ee.props.multiple;if(we.preventDefault(),we.type==="dragover")return;if(ee.props.directory)_(Array.prototype.slice.call(we.dataTransfer.items),ee.uploadFiles,function(me){return S(me,ee.props.accept)});else{var Ce=Array.prototype.slice.call(we.dataTransfer.files).filter(function(me){return S(me,ee.props.accept)});Te===!1&&(Ce=Ce.slice(0,1)),ee.uploadFiles(Ce)}},ee.uploadFiles=function(we){var Te=Array.prototype.slice.call(we);Te.map(function(Ce){return Ce.uid=R(),Ce}).forEach(function(Ce){ee.upload(Ce,Te)})},ee.saveFileInput=function(we){ee.fileInput=we},Y),g(ee,oe)}return o(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,ee){var oe=this,pe=this.props;if(!pe.beforeUpload)return setTimeout(function(){return oe.post(Y)},0);var Oe=pe.beforeUpload(Y,ee);Oe&&Oe.then?Oe.then(function(Se){var we=Object.prototype.toString.call(Se);return we==="[object File]"||we==="[object Blob]"?oe.post(Se):oe.post(Y)}).catch(function(Se){console.log(Se)}):Oe!==!1&&setTimeout(function(){return oe.post(Y)},0);return}},{key:"post",value:function(Y){var ee=this;if(!this._isMounted)return;var oe=this.props,pe=oe.onStart,Oe=oe.onProgress,Se=oe.transformFile,we=Se===void 0?function(Te){return Te}:Se;new Promise(function(Te){var Ce=oe.action;return typeof Ce=="function"&&(Ce=Ce(Y)),Te(Ce)}).then(function(Te){var Ce=Y.uid,me=oe.customRequest||z,se=Promise.resolve(we(Y)).then(function(te){var ce=oe.data;return typeof ce=="function"&&(ce=ce(te)),Promise.all([te,ce])}).catch(function(te){console.error(te)});se.then(function(te){var ce=l(te,2),ae=ce[0],Ae=ce[1],Re={action:Te,filename:oe.name,data:Ae,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Oe?function(xe){Oe(xe,Y)}:null,onSuccess:function(ke,Pe){delete ee.reqs[Ce],oe.onSuccess(ke,Y,Pe)},onError:function(ke,Pe){delete ee.reqs[Ce],oe.onError(ke,Pe,Y)}};pe(Y),ee.reqs[Ce]=me(Re)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(Y){var ee=this.reqs;if(Y){var oe=Y;Y&&Y.uid&&(oe=Y.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(pe){ee[pe]&&ee[pe].abort&&ee[pe].abort(),delete ee[pe]})}},{key:"render",value:function(){var Y,ee=this.props,oe=ee.component,pe=ee.prefixCls,Oe=ee.className,Se=ee.disabled,we=ee.id,Te=ee.style,Ce=ee.multiple,me=ee.accept,se=ee.children,te=ee.directory,ce=ee.openFileDialogOnClick,ae=ee.onMouseEnter,Ae=ee.onMouseLeave,Re=d(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=$()((Y={},s(Y,pe,!0),s(Y,pe+"-disabled",Se),s(Y,Oe,Oe),Y)),ke=Se?{}:{onClick:ce?this.onClick:function(){},onKeyDown:ce?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:Ae,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(oe,C({},ke,{className:xe,role:"button",style:Te}),J.a.createElement("input",C({},L(Re),{id:we,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Ce,onChange:this.onChange})),se)}}]),P}(le.Component),c=b,p=Object.assign||function(V){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var Y in I)Object.prototype.hasOwnProperty.call(I,Y)&&(V[Y]=I[Y])}return V},h=function(){function V(P,I){for(var Y=0;Y<I.length;Y++){var ee=I[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(P,ee.key,ee)}}return function(P,I,Y){return I&&V(P.prototype,I),Y&&V(P,Y),P}}();function a(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function E(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function y(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}function x(){}var B=function(V){y(P,V);function P(){var I,Y,ee,oe;a(this,P);for(var pe=arguments.length,Oe=Array(pe),Se=0;Se<pe;Se++)Oe[Se]=arguments[Se];return oe=(Y=(ee=E(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Oe))),ee),ee.saveUploader=function(we){ee.uploader=we},Y),E(ee,oe)}return h(P,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return J.a.createElement(c,p({},this.props,{ref:this.saveUploader}))}}]),P}(le.Component);B.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:x,onError:x,onSuccess:x,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=B,K=it.a=F},Gytx:function(pt,it){pt.exports=function(le,J,k,$){var O=k?k.call($,le,J):void 0;if(O!==void 0)return!!O;if(le===J)return!0;if(typeof le!="object"||!le||typeof J!="object"||!J)return!1;var M=Object.keys(le),z=Object.keys(J);if(M.length!==z.length)return!1;for(var H=Object.prototype.hasOwnProperty.bind(J),U=0;U<M.length;U++){var R=M[U];if(!H(R))return!1;var m=le[R],S=J[R];if(O=k?k.call($,m,S,R):void 0,O===!1||O===void 0&&m!==S)return!1}return!0}},HmJG:function(pt,it,ie){},IH3J:function(pt,it,ie){pt.exports={wrapInstallPackageStyle:"wrapInstallPackageStyle___2JdHa",installPackageStyle:"installPackageStyle___3mphi",title:"title___-Mfcd",line:"line___1qKKa",bodyHeight:"bodyHeight___3hV2N"}},Lai7:function(pt,it,ie){pt.exports=ie.p+"static/noEnvData.6108fa6c.png"},LdHM:function(pt,it,ie){"use strict";ie.d(it,"b",function(){return d}),ie.d(it,"a",function(){return g});var le=ie("1OyB"),J=ie("vuIU"),k=ie("Ji7U"),$=ie("LK+K"),O=ie("q1tI"),M=ie("rePB"),z=ie("Ff2n"),H=ie("ODXe"),U=ie("4IlW"),R=ie("bX4T"),m=ie("YrtM"),S=ie("TSYQ"),D=ie.n(S),A=ie("+nKL"),_=ie("8OUc"),C=function(Y,ee){var oe=Y.prefixCls,pe=Y.id,Oe=Y.flattenOptions,Se=Y.childrenAsData,we=Y.values,Te=Y.searchValue,Ce=Y.multiple,me=Y.defaultActiveFirstOption,se=Y.height,te=Y.itemHeight,ce=Y.notFoundContent,ae=Y.open,Ae=Y.menuItemSelectedIcon,Re=Y.virtual,xe=Y.onSelect,ke=Y.onToggleOpen,Pe=Y.onActiveValue,je=Y.onScroll,We=Y.onMouseEnter,Be="".concat(oe,"-item"),Ie=Object(m.a)(function(){return Oe},[ae,Oe],function(Ke,Ee){return Ee[0]&&Ke[1]!==Ee[1]}),tt=O.useRef(null),Ze=function(Ee){Ee.preventDefault()},Je=function(Ee){tt.current&&tt.current.scrollTo({index:Ee})},Ye=function(Ee){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ie.length,re=0;re<be;re+=1){var ne=(Ee+re*ve+be)%be,de=Ie[ne],ue=de.group,fe=de.data;if(!ue&&!fe.disabled)return ne}return-1},ft=O.useState(function(){return Ye(0)}),rt=Object(H.a)(ft,2),nt=rt[0],Me=rt[1],dt=function(Ee){Me(Ee);var ve=Ie[Ee];if(!ve){Pe(null,-1);return}Pe(ve.data.value,Ee)};O.useEffect(function(){dt(me!==!1?Ye(0):-1)},[Ie.length,Te]),O.useEffect(function(){var Ke=setTimeout(function(){if(!Ce&&ae&&we.size===1){var Ee=Array.from(we)[0],ve=Ie.findIndex(function(be){var re=be.data;return re.value===Ee});dt(ve),Je(ve)}});return function(){return clearTimeout(Ke)}},[ae]);var lt=function(Ee){Ee!==void 0&&xe(Ee,{selected:!we.has(Ee)}),Ce||ke(!1)};if(O.useImperativeHandle(ee,function(){return{onKeyDown:function(Ee){var ve=Ee.which;switch(ve){case U.a.UP:case U.a.DOWN:{var be=0;if(ve===U.a.UP?be=-1:ve===U.a.DOWN&&(be=1),be!==0){var re=Ye(nt+be,be);Je(re),dt(re)}break}case U.a.ENTER:{var ne=Ie[nt];ne&&!ne.data.disabled?lt(ne.data.value):lt(void 0),ae&&Ee.preventDefault();break}case U.a.ESC:ke(!1)}},onKeyUp:function(){},scrollTo:function(Ee){Je(Ee)}}}),Ie.length===0)return O.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),className:"".concat(Be,"-empty"),onMouseDown:Ze},ce);function Ue(Ke){var Ee=Ie[Ke];if(!Ee)return null;var ve=Ee.data||{},be=ve.value,re=ve.label,ne=ve.children,de=Object(R.a)(ve,!0),ue=Se?ne:re;return Ee?O.createElement("div",Object.assign({"aria-label":typeof ue=="string"?ue:null},de,{key:Ke,role:"option",id:"".concat(pe,"_list_").concat(Ke),"aria-selected":we.has(be)}),be):null}return O.createElement(O.Fragment,null,O.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ue(nt-1),Ue(nt),Ue(nt+1)),O.createElement(A.a,{itemKey:"key",ref:tt,data:Ie,height:se,itemHeight:te,fullHeight:!1,onMouseDown:Ze,onScroll:je,virtual:Re,onMouseEnter:We},function(Ke,Ee){var ve,be=Ke.group,re=Ke.groupOption,ne=Ke.data,de=ne.label,ue=ne.key;if(be)return O.createElement("div",{className:D()(Be,"".concat(Be,"-group"))},de!==void 0?de:ue);var fe=ne.disabled,Le=ne.value,Ne=ne.title,$e=ne.children,ht=ne.style,Xe=ne.className,gt=Object(z.a)(ne,["disabled","value","title","children","style","className"]),st=we.has(Le),qe="".concat(Be,"-option"),Dt=D()(Be,qe,Xe,(ve={},Object(M.a)(ve,"".concat(qe,"-grouped"),re),Object(M.a)(ve,"".concat(qe,"-active"),nt===Ee&&!fe),Object(M.a)(ve,"".concat(qe,"-disabled"),fe),Object(M.a)(ve,"".concat(qe,"-selected"),st),ve)),Et=Se?$e:de,kt=!Ae||typeof Ae=="function"||st;return O.createElement("div",Object.assign({},gt,{"aria-selected":st,className:Dt,title:Ne,onMouseMove:function(){if(nt===Ee||fe)return;dt(Ee)},onClick:function(){fe||lt(Le)},style:ht}),O.createElement("div",{className:"".concat(qe,"-content")},Et||Le),O.isValidElement(Ae)||st,kt&&O.createElement(_.a,{className:"".concat(Be,"-option-state"),customizeIcon:Ae,customizeIconProps:{isSelected:st}},st?"\u2713":null))}))},l=O.forwardRef(C);l.displayName="OptionList";var o=l,s=function(){return null};s.isSelectOption=!0;var d=s,w=function(){return null};w.isSelectOptGroup=!0;var g=w,v=ie("VTBJ"),L=ie("Zm9Q");function b(I){var Y=I.key,ee=I.props,oe=ee.children,pe=ee.value,Oe=Object(z.a)(ee,["children","value"]);return Object(v.a)({key:Y,value:pe!==void 0?pe:Y,children:oe},Oe)}function c(I){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(I).map(function(ee,oe){if(!O.isValidElement(ee)||!ee.type)return null;var pe=ee.type.isSelectOptGroup,Oe=ee.key,Se=ee.props,we=Se.children,Te=Object(z.a)(Se,["children"]);return Y||!pe?b(ee):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?oe:Oe,"__"),label:Oe},Te),{},{options:c(we)})}).filter(function(ee){return ee})}var p=ie("2Qr1"),h=ie("qNPg"),a=ie("U8pU"),E=ie("Kwbf"),y=ie("WKfj");function x(I){var Y=I.mode,ee=I.options,oe=I.children,pe=I.backfill,Oe=I.allowClear,Se=I.placeholder,we=I.getInputElement,Te=I.showSearch,Ce=I.onSearch,me=I.defaultOpen,se=I.autoFocus,te=I.labelInValue,ce=I.value,ae=I.inputValue,Ae=I.optionLabelProp,Re=Y==="multiple"||Y==="tags",xe=Te!==void 0?Te:Re||Y==="combobox",ke=ee||c(oe);if(Object(E.a)(Y!=="tags"||ke.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Pe=ke.some(function(Be){return Be.options?Be.options.some(function(Ie){return typeof("value"in Ie?Ie.value:Ie.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(E.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(Y!=="combobox"||!Ae,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(Y==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(E.a)(Y==="combobox"||!we,"`getInputElement` only work with `combobox` mode."),Object(E.b)(Y!=="combobox"||!we||!Oe||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ce&&!xe&&Y!=="combobox"&&Y!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!me||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ce!=null){var je=Object(y.d)(ce);Object(E.a)(!te||je.every(function(Be){return Object(a.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!Re||Array.isArray(ce),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var We=null;Object(L.a)(oe).some(function(Be){if(!O.isValidElement(Be)||!Be.type)return!1;var Ie=Be.type;if(Ie.isSelectOption)return!1;if(Ie.isSelectOptGroup){var tt=Object(L.a)(Be.props.children).every(function(Ze){return!O.isValidElement(Ze)||!Be.type||Ze.type.isSelectOption?!0:(We=Ze.type,!1)});return!tt}return We=Ie,!0}),We&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(E.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=x,F=Object(h.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:B,fillOptionsWithMissingValue:p.a}),K=function(I){Object(k.a)(ee,I);var Y=Object($.a)(ee);function ee(){var oe;return Object(le.a)(this,ee),oe=Y.apply(this,arguments),oe.selectRef=O.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(J.a)(ee,[{key:"render",value:function(){return O.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ee}(O.Component);K.Option=d,K.OptGroup=g;var V=K,P=it.c=V},M8RZ:function(pt,it,ie){"use strict";ie.d(it,"a",function(){return U});var le=ie("fWQN"),J=ie("mtLc"),k=ie("yKVA"),$=ie("879j"),O=ie("q1tI"),M=ie.n(O),z=ie("i8i4"),H=ie.n(z),U=function(R){Object(k.a)(S,R);var m=Object($.a)(S);function S(D){var A;Object(le.a)(this,S),A=m.call(this,D);var _=window.document;return A.node=_.createElement("div"),_.body.appendChild(A.node),A}return Object(J.a)(S,[{key:"render",value:function(){var A=this.props.children;return Object(z.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(M.a.Component)},N3QO:function(pt,it,ie){"use strict";var le=ie("2qtc"),J=ie("kLXV"),k=ie("tJVT"),$=ie("q1tI"),O=ie.n($),M=ie("9kvl"),z=ie("FPkq"),H=ie.n(z),U=function(m){var S,D=m.newShixuns,A=m.dispatch,_=m.user,C=Object($.useState)(!1),l=Object(k.a)(C,2),o=l[0],s=l[1];Object($.useEffect)(function(){D.actionTabs.key==="Create-Environment"&&w()},[D==null||((S=D.actionTabs)===null||S===void 0)?void 0:S.key]);var d=function(){A({type:"newShixuns/setActionTabs",payload:{}})},w=function(){var v,L,b;d(),((v=_.userInfo)===null||v===void 0?void 0:v.mirror_marker_status)===0?s(!0):((L=_.userInfo)===null||L===void 0?void 0:L.mirror_marker_status)===1?M.d.push("/shixuns/new/CreateImg"):((b=_.userInfo)===null||b===void 0?void 0:b.mirror_marker_status)===2&&J.a.confirm({title:"\u60A8\u4ECA\u65E5\u5DF2\u8FBE\u5230\u7533\u8BF7\u4E0A\u9650\uFF0C\u662F\u5426\u8DF3\u8F6C\u81F3\u4E91\u4E3B\u673A\u5217\u8868\uFF1F",content:"\u63D0\u793A\uFF1A\u6BCF\u5929\u6700\u591A\u5141\u8BB8\u7533\u8BF7\u4E00\u53F0\u4E91\u4E3B\u673A",okText:"\u8DF3\u8F6C",cancelText:"\u53D6\u6D88",onOk:function(){var p;M.d.push("/users/".concat((p=_.userInfo)===null||p===void 0?void 0:p.login,"/experiment-img"))}})};return O.a.createElement(J.a,{title:"\u52A0\u5165qq\u7FA4\u63D0\u793A",visible:o,footer:null,onCancel:function(){s(!1)}},O.a.createElement("div",{style:{textAlign:"center"}},O.a.createElement("br",null),O.a.createElement("img",{width:120,height:120,style:{marginTop:"20px"},src:H.a,alt:"\u4E8C\u7EF4\u7801"})),O.a.createElement("img",null))};it.a=Object(M.a)(function(R){var m=R.newShixuns,S=R.user,D=R.globalSetting;return{newShixuns:m,globalSetting:D,user:S}})(U)},OLES:function(pt,it,ie){"use strict";var le=ie("U8pU"),J=ie("VTBJ"),k=ie("Ff2n"),$=ie("q1tI"),O=ie("uciX"),M=ie("7ixt"),z=function(D){var A=D.overlay,_=D.prefixCls,C=D.id,l=D.overlayInnerStyle;return $.createElement("div",{className:"".concat(_,"-inner"),id:C,role:"tooltip",style:l},typeof A=="function"?A():A)},H=z,U=function(D,A){var _=D.overlayClassName,C=D.trigger,l=C===void 0?["hover"]:C,o=D.mouseEnterDelay,s=o===void 0?0:o,d=D.mouseLeaveDelay,w=d===void 0?.1:d,g=D.overlayStyle,v=D.prefixCls,L=v===void 0?"rc-tooltip":v,b=D.children,c=D.onVisibleChange,p=D.afterVisibleChange,h=D.transitionName,a=D.animation,E=D.placement,y=E===void 0?"right":E,x=D.align,B=x===void 0?{}:x,F=D.destroyTooltipOnHide,K=F===void 0?!1:F,V=D.defaultVisible,P=D.getTooltipContainer,I=D.overlayInnerStyle,Y=Object(k.a)(D,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ee=Object($.useRef)(null);Object($.useImperativeHandle)(A,function(){return ee.current});var oe=Object(J.a)({},Y);"visible"in D&&(oe.popupVisible=D.visible);var pe=function(){var Ce=D.arrowContent,me=Ce===void 0?null:Ce,se=D.overlay,te=D.id;return[$.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},me),$.createElement(H,{key:"content",prefixCls:L,id:te,overlay:se,overlayInnerStyle:I})]},Oe=!1,Se=!1;if(typeof K=="boolean")Oe=K;else if(K&&Object(le.a)(K)==="object"){var we=K.keepParent;Oe=we===!0,Se=we===!1}return $.createElement(O.a,Object.assign({popupClassName:_,prefixCls:L,popup:pe,action:l,builtinPlacements:M.a,popupPlacement:y,ref:ee,popupAlign:B,getPopupContainer:P,onPopupVisibleChange:c,afterPopupVisibleChange:p,popupTransitionName:h,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Oe,autoDestroy:Se,mouseLeaveDelay:w,popupStyle:g,mouseEnterDelay:s},oe),b)},R=Object($.forwardRef)(U),m=it.a=R},Ot1p:function(pt,it,ie){"use strict";var le=ie("2qtc"),J=ie("kLXV"),k=ie("rAM+"),$=ie("miYZ"),O=ie("tsqr"),M=ie("9og8"),z=ie("tJVT"),H=ie("jrin"),U=ie("WmNS"),R=ie.n(U),m=ie("q1tI"),S=ie.n(m),D=ie("VrN/"),A=ie.n(D),_=ie("bdgK"),C=ie("p77/"),l=ie("Bd2K"),o=ie("ELLl"),s=ie("19Vz"),d=ie("lZu9"),w=ie("+NIl"),g=ie("kSUc"),v=ie("9Bee"),L=function(fe){var Le=fe.value,Ne=Le===void 0?"":Le,$e=fe.className,ht=fe.showTextOnly,Xe=fe.showLines,gt=fe.style,st=gt===void 0?{}:gt,qe=Object(m.useMemo)(function(){return""},[Ne]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:qe}}))},b=ie("0Owb"),c=ie("dejd"),p=ie("C+DQ"),h=ie("1vsH"),a=ie("m3rI"),E=[{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 y(fe){var Le=fe.onActionCallback,Ne=fe.title,$e=fe.icon,ht=fe.actionName,Xe=fe.className,gt=Xe===void 0?"":Xe,st=fe.children;function qe(){Le(ht)}return S.a.createElement("a",{title:Ne,className:gt,onClick:qe},S.a.createElement("i",{className:"md-iconfont ".concat($e)}),st)}var x=function(fe){var Le=fe.watch,Ne=fe.showNullButton,$e=fe.onActionCallback,ht=fe.fullScreen,Xe=fe.insertTemp,gt=fe.hidetoolBar,st=fe.uuid,qe=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.F)("_educoder_session"),"&key=").concat(st,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Dt=[].concat(E,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!gt&&Dt.map(function(Et,kt){return S.a.createElement("li",{key:kt},Et.actionName?S.a.createElement(y,Object(b.a)({},Et,{onActionCallback:$e})):S.a.createElement("span",{className:"v-line"}))}),Ne?S.a.createElement("li",null,S.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$e},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Xe&&S.a.createElement("li",null,S.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Xe),onActionCallback:$e},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(y,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$e})))},B=ie("M8RZ"),F=ie("+L6B"),K=ie("2/Rp"),V=ie("y8nQ"),P=ie("Vl3Y"),I=ie("5NDa"),Y=ie("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(fe){var Le=fe.callback,Ne=fe.onCancel;function $e(ht){Le(ht)}return S.a.createElement(P.a,Object(b.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$e}),S.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(Y.a,null)),S.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(Y.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(K.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))},pe=ie("7ahc"),Oe=ie("HmJG"),Se=ie("BjJ7"),we=P.a.useForm,Te={width:280,marginRight:10},Ce={labelCol:{span:5},wrapperCol:{span:19}},me=function(fe){var Le=fe.callback,Ne=fe.onCancel,$e=we(),ht=Object(z.a)($e,1),Xe=ht[0];function gt(Dt){Le(Dt)}function st(Dt,Et){if(Dt.status===-1){O.b.error(Dt.message);return}Xe.setFieldsValue({src:"/api/attachments/".concat(Dt.id),type:Et.type})}function qe(Dt){var Et=Dt.target.files[0];te(Et,st)}return S.a.createElement(P.a,Object(b.a)({form:Xe},Ce,{className:"upload-image-panel",onFinish:gt}),S.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(Y.a,{style:Te})),S.a.createElement(se,{onFileChange:qe}))),S.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(Y.a,{style:{width:264}})),S.a.createElement(P.a.Item,{style:{textAlign:"right"}},S.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(K.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))};function se(fe){var Le=fe.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:Le}))}function te(fe,Le){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ne=new FormData;Ne.append("editormd-image-file",fe),Ne.append("file_param_name","editormd-image-file"),Ne.append("byxhr","true");var $e=new window.XMLHttpRequest;$e.withCredentials=!0,$e.addEventListener("load",function(ht){Le(JSON.parse(ht.target.responseText),fe)},!1),$e.addEventListener("error",function(ht){console.error(ht)},!1),$e.open("POST","".concat(Se.a,"/api/attachments.json")),$e.send(Ne)}var ce=ie("giR+"),ae=ie("fyUT"),Ae=ie("7Kak"),Re=ie("9yH6"),xe=Re.a.Group,ke={margin:"0 8px"},Pe=function(fe){var Le=fe.callback,Ne=fe.onCancel;function $e(ht){Le(ht)}return S.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$e},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:ke},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:ke},"\u884C\u6570"),S.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(ae.a,null)),S.a.createElement("span",{style:ke},"\u5217\u6570"),S.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(ae.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:ke},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(P.a.Item,{name:"align"},S.a.createElement(xe,null,S.a.createElement(Re.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(Re.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(Re.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(Re.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(K.a,{type:"ghost",onClick:Ne},"\u53D6\u6D88")))},je=ie("ErOA"),We=ie("7Cbv"),Be="link",Ie="upload-image",tt="code-block",Ze="add-table",Je="------------",Ye={default:Je,left:":".concat(Je),center:":".concat(Je,":"),right:"".concat(Je,":")},ft=ie("9VGf"),rt,nt;function Me(){}var dt=0,lt=1e4,Ue="\u2581",Ke=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ee(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=ve?"Cmd":"Ctrl",re=["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"],ne=(rt={},Object(H.a)(rt,be+"-B","bold"),Object(H.a)(rt,be+"-I","italic"),rt),de=(nt={},Object(H.a)(nt,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(nt,tt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(nt,Ie,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(nt,Ze,"\u6DFB\u52A0\u8868\u683C"),nt),ue=it.a=function(fe){var Le=fe.defaultValue,Ne=Le===void 0?"":Le,$e=fe.onChange,ht=fe.width,Xe=ht===void 0?"100%":ht,gt=fe.height,st=gt===void 0?400:gt,qe=fe.miniToolbar,Dt=qe===void 0?!1:qe,Et=fe.isFocus,kt=Et===void 0?!1:Et,Ot=fe.watch,Tt=fe.insertTemp,Zt=fe.mode,Qt=Zt===void 0?"markdown":Zt,vt=fe.id,Lt=vt===void 0?"markdown-editor-id":vt,jt=fe.showResizeBar,Ut=jt===void 0?!1:jt,qt=fe.noStorage,ir=qt===void 0?!1:qt,er=fe.showNullButton,Bt=er===void 0?!1:er,ct=fe.hidetoolBar,Kr=ct===void 0?!1:ct,ti=fe.fullScreen,xr=ti===void 0?!1:ti,Mt=fe.onBlur,Wr=fe.onCMBeforeChange,Yr=fe.onFullScreen,fi=fe.className,Ve=fi===void 0?"":fi,_t=fe.disablePaste,pi=_t===void 0?!1:_t,mi=fe.placeholder,gi=mi===void 0?"":mi,vi=fe.values,G=vi===void 0?"":vi,u=Object(m.useState)(null),f=Object(z.a)(u,2),N=f[0],Q=f[1],W=Object(m.useState)(Ne),ye=Object(z.a)(W,2),He=ye[0],et=ye[1],yt=Object(m.useState)(Ot),Ge=Object(z.a)(yt,2),St=Ge[0],Ht=Ge[1],Jt=Object(m.useState)(xr),Ur=Object(z.a)(Jt,2),Sr=Ur[0],Cr=Ur[1],$r=Object(m.useState)(""),Ri=Object(z.a)($r,2),cr=Ri[0],Hr=Ri[1],si=Object(m.useState)(0),li=Object(z.a)(si,2),Br=li[0],Oi=li[1],yi=Object(m.useState)(st),zi=Object(z.a)(yi,2),Ki=zi[0],Jr=zi[1],Vr=Object(m.useState)(!1),bi=Object(z.a)(Vr,2),hn=bi[0],Ei=bi[1],ar=Object(m.useRef)(Object(We.a)()),Gt=Object(m.useRef)(!1),yr=Object(m.useRef)(),It=Object(m.useRef)(),sr=Object(m.useRef)(),Vt=Object(m.useRef)(),ri=Object(m.useRef)(),fr=function(){var bt=Object(M.a)(R.a.mark(function At(){var Ct,Pt;return R.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ar.current}});case 2:Pt=Yt.sent,Pt!=null&&(Ct=Pt.attachments)!==null&&Ct!==void 0&&Ct.length&&(console.log("cm:",N,It),Pt.attachments.map(function(Ft){Ft.content_type.indexOf("image")>-1?N.replaceSelection("![,](/api/attachments/".concat(Ft.id,"?type=").concat(Ft.content_type,")")):Ft.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ft.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):N.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}));case 4:case"end":return Yt.stop()}},At)}));return function(){return bt.apply(this,arguments)}}();Object(m.useEffect)(function(){et(G),N==null||N.setValue(G)},[G]),Object(m.useEffect)(function(){Yr==null||Yr(Sr)},[Sr]),Object(m.useEffect)(function(){if(It.current){var bt=A.a.fromTextArea(It.current,{mode:Qt,lineNumbers:!Dt,lineWrapping:!0,value:Ne,autoCloseTags:!0,autoCloseBrackets:!0});kt&&bt.focus();function At(Ct,Pt){if(pi){Pt.preventDefault();return}var Wt=Pt.clipboardData;if(Wt){var Yt=Wt.types.toString(),Ft=Wt.items;if(Yt==="Files"||Wt.types.indexOf("Files")>-1){if(Pt.preventDefault(),Qt=="stex")return;try{var dr,kr=Ft[1];((dr=Ft[0])===null||dr===void 0?void 0:dr.kind)==="file"&&(kr=Ft[0]);var Nt=kr.getAsFile(),ui=Nt.name.split(".").pop();te(Nt,function(zt){if(zt.id){var Rr,Tr,Xr;(Nt==null||((Rr=Nt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Nt==null||((Tr=Nt.type)===null||Tr===void 0)?void 0:Tr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Nt==null||((Xr=Nt.type)===null||Xr===void 0)?void 0:Xr.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(ui)?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):bt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){O.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",At),bt.on("dragleave",function(Ct,Pt){sr.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(Ct,Pt){sr.current.classList.add("mouse-hover-md")}),bt.on("drop",function(Ct,Pt){sr.current.classList.add("mouse-hover-md");var Wt;if(Wt=Pt.dataTransfer.files,Wt.length>0){Pt.preventDefault(),Pt.stopPropagation();for(var Yt=function(kr){var Nt=Wt[kr],ui=Nt.name.split(".").pop();te(Nt,function(zt){if(zt.id){var Rr,Tr,Xr;(Nt==null||((Rr=Nt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Nt==null||((Tr=Nt.type)===null||Tr===void 0)?void 0:Tr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Nt==null||((Xr=Nt.type)===null||Xr===void 0)?void 0:Xr.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Nt.type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):re.includes(ui)?bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):bt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Ft=0;Ft<Wt.length;Ft++)Yt(Ft)}}),Q(bt),function(){bt.off("paste",At)}}},[]);var Ar=Object(m.useCallback)(function(){if(sr.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[Ki,sr,Sr]);Object(m.useEffect)(function(){function bt(){var Ct=new _.default(function(Pt){var Wt=Object(k.a)(Pt),Yt;try{for(Wt.s();!(Yt=Wt.n()).done;){var Ft=Yt.value;(Ft.target.offsetHeight>0||Ft.target.offsetWidth>0)&&(Ar(),N.setSize("100%","100%"),N.refresh())}}catch(dr){Wt.e(dr)}finally{Wt.f()}});return Ct.observe(It.current.parentElement),Ct}if(N){var At=bt();return function(){At.unobserve(It.current.parentElement)}}},[N,Ar]),Object(m.useEffect)(function(){if(N){for(var bt=[],At=function(){var Ft=Pt[Ct];Wt=Object(z.a)(Ft,2);var dr=Wt[0],kr=Wt[1],Nt=Object(H.a)({},dr,function(){Vi(kr)});bt.push(Nt),N.addKeyMap(Nt)},Ct=0,Pt=Object.entries(ne);Ct<Pt.length;Ct++){var Wt;At()}return yr.current=setInterval(function(){Gt.current&&fr()},4e3),function(){clearInterval(yr.current);var Yt=Object(k.a)(bt),Ft;try{for(Yt.s();!(Ft=Yt.n()).done;){var dr=Ft.value;N.removeKeyMap(dr)}}catch(kr){Yt.e(kr)}finally{Yt.f()}}}},[N]),Object(m.useEffect)(function(){xr!==Sr&&Cr(xr)},[xr]),Object(ft.a)(function(){if(!ir&&Br>0){var bt=new Date().getTime(),At=window.sessionStorage.getItem(Lt);bt>=Br+lt&&(!At||At!==He)&&(window.sessionStorage.setItem(Lt,He),Ei(!0))}},lt),Object(m.useEffect)(function(){Ht(Ot)},[N,Ot]),Object(m.useEffect)(function(){N&&(kt&&N.focus())},[N,kt]),Object(m.useEffect)(function(){if(St&&N){var bt=N.getScrollerElement();function At(Ct){var Pt=Ct.target;if(ri.current){var Wt=Pt.scrollTop/Pt.scrollHeight;ri.current.scrollTop=ri.current.scrollHeight*Wt}}return bt.addEventListener("scroll",At),function(){bt.removeEventListener("scroll",At)}}},[N,St]),Object(m.useEffect)(function(){if(N&&Wr){function bt(At,Ct){Wr(At,Ct)}return N.on("beforeChange",bt),function(){N.off("beforeChange",bt)}}},[N,Wr]),Object(m.useEffect)(function(){if(N&&Mt){function bt(){Mt(N.getValue())}return N.on("blur",bt),function(){N.off("blur",bt)}}},[N,Mt]),Object(m.useEffect)(function(){if(N){function bt(At){var Ct=At.getValue();et(Ct),Oi(new Date().getTime()),At.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$e&&$e(Ct)}return N.on("change",bt),function(){N.off("change",bt)}}},[N,$e]),Object(m.useEffect)(function(){N&&(Ne==null?(N.setValue(""),et("")):Ne!==N.getValue()&&(N.setValue(Ne),et(Ne),N.setCursor(N.lineCount(),0)))},[N,Ne]);var Vi=Object(m.useCallback)(function(bt){var At=N.getCursor(),Ct=N.getSelection(),Pt=Ct.split(`
`);switch(bt){case"bold":return N.replaceSelection("**"+Ct+"**"),Ct===""&&N.setCursor(At.line,At.ch+2),N.focus();case"italic":return N.replaceSelection("*"+Ct+"*"),Ct===""&&N.setCursor(At.line,At.ch+1),N.focus();case"code":return N.replaceSelection("`"+Ct+"`"),Ct===""&&N.setCursor(At.line,At.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+Ct+"$$`"),Ct===""&&N.setCursor(At.line,At.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+Ct+"\n```"),N.setCursor(At.line+1,Ct.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
`),N.focus();case"list-ul":return Ct===""?N.replaceSelection("- "+Ct):N.replaceSelection(Pt.map(function(Wt){return Wt===""?"":"- ".concat(Wt)}).join(`
`)),N.focus();case"list-ol":return Ct===""?N.replaceSelection("1. "+Ct):N.replaceSelection(Pt.map(function(Wt,Yt){return Wt===""?"":"".concat(Yt+1,". ").concat(Wt)}).join(`
`)),N.focus();case"add-null-ch":return Ct===""&&N.setCursor(At.line,At.ch+1),N.replaceSelection(Ue),N.focus();case"inster-template-1":return Ct===""&&N.setCursor(At.line,At.ch),N.replaceSelection(Ke),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return Ht(!St),N.focus();case"trigger-full-screen":return Cr(!Sr),N.focus();case Be:Hr(Be);return;case tt:Hr(tt);return;case Ie:Hr(Ie);return;case Ze:Hr(Ze);return;default:throw new Error}},[N,St,Sr]),xi=Object(m.useCallback)(function(bt){Hr("");switch(cr){case Be:var At=bt.title,Ct=bt.link;return N.replaceSelection("[".concat(At,"](").concat(Ct,")")),N.focus();case tt:var Pt=bt.language,Wt=bt.content;return N.replaceSelection(["```"+Pt,Wt,"```"].join(`
`)),N.focus();case Ie:var Yt=bt.src,Ft=bt.alt;return Ft?N.replaceSelection("![ ".concat(Ft," ]( ").concat(Yt,' "').concat(Ft,'" )')):N.replaceSelection("![,](".concat(Yt,")")),N.focus();case Ze:for(var dr=bt.row,kr=bt.col,Nt=bt.align,ui=`
`,zt=0;zt<dr;zt++){for(var Rr=[],Tr=[],Xr=0;Xr<kr;Xr++)zt===1&&Tr.push(Ye[Nt]),Rr.push(" ");zt===1&&(ui+="| ".concat(Tr.join(" | "),` |
`)),ui+="| ".concat(Rr.join(kr===1?"":" | "),` |
`)}return N.replaceSelection(ui+`
`),N.focus();default:throw new Error}},[N,cr]),cn=Object(m.useMemo)(function(){switch(cr){case Be:return S.a.createElement(oe,{callback:xi,onCancel:Si});case tt:return S.a.createElement(pe.b,{callback:xi,onCancel:Si});case Ie:return S.a.createElement(me,{callback:xi,onCancel:Si});case Ze:return S.a.createElement(Pe,{callback:xi,onCancel:Si});default:return null}},[cr]);function Si(){Hr("")}Object(m.useEffect)(function(){if(Vt.current){var bt=Vt.current,At=!1,Ct=0;function Pt(Ft){At=!0,Ct=Ft.pageY}function Wt(){At=!1}function Yt(Ft){if(At){var dr=Ft.pageY-Ct;dr<0&&(dr=0),dr>300&&(dr=300);var kr=st+dr+"px";Jr(kr)}}return bt.addEventListener("mousedown",Pt),document.addEventListener("mousemove",Yt),document.addEventListener("mouseup",Wt),function(){bt.removeEventListener("mousedown",Pt),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Wt)}}},[N,Vt]),Object(m.useEffect)(function(){Jr(st)},[st]);var ii=Ee(Xe),fn=Ee(Ki),Zr={width:ii,height:fn},pn=Object(m.useMemo)(function(){if(Br){var bt=new Date(Br),At=bt.getHours(),Ct=bt.getMinutes(),Pt=bt.getSeconds();return At=At<10?"0"+At:At,Ct=Ct<10?"0"+Ct:Ct,Pt=Pt<10?"0"+Pt:Pt,"".concat(At,":").concat(Ct,":").concat(Pt)}return 0},[Br]);function jn(){window.sessionStorage.removeItem(Lt),Ei(!1),Oi(0)}function Pi(){Ei(!1),Oi(0),N.setValue(window.sessionStorage.getItem(Lt))}function ua(bt,At){var Ct=N.getValue();Ct=Ct.replace(bt,At),et(Ct),N==null||N.setValue(Ct)}return S.a.createElement(m.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:sr},S.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(St?"on-preview":""," ").concat(Dt?"mini":""," ").concat(Sr?"full-screen":""),style:Zr},S.a.createElement(x,{insertTemp:Tt,watch:St,fullScreen:Sr,showNullButton:Bt,onActionCallback:Vi,hidetoolBar:Kr,uuid:ar.current,setOpenPhones:function(){Gt.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:It,placeholder:gi})),St?S.a.createElement("div",{ref:ri,className:"preview-container"},Qt==="stex"&&S.a.createElement(L,{value:He}),Qt!=="stex"&&S.a.createElement(v.a,{edit:!0,value:He,replaces:ua})):null))),Ut?S.a.createElement("a",{ref:Vt,className:"editor-resize"}):null,S.a.createElement(B.a,null,de[cr]?S.a.createElement(J.a,{centered:!0,title:de[cr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},QXZ7:function(pt,it,ie){"use strict";var le=ie("2qtc"),J=ie("kLXV"),k=ie("q1tI"),$=ie.n(k),O=ie("9Bee"),M=ie("IH3J"),z=ie.n(M),H=function(R){var m,S,D=R.installPackage,A=R.visible,_=R.setVisible;return Object(k.useEffect)(function(){return A?document.body.setAttribute("class",z.a.bodyHeight):document.body.removeAttribute("class"),function(){document.body.removeAttribute("class")}},[A]),$.a.createElement(J.a,{centered:!0,keyboard:!1,destroyOnClose:!0,visible:A,title:"\u73AF\u5883\u4ECB\u7ECD",width:"1000px",wrapClassName:z.a.wrapInstallPackageStyle,footer:null,onCancel:function(){return _(!1)}},$.a.createElement("div",{className:z.a.installPackageStyle},$.a.createElement("div",{className:"mb30"},$.a.createElement("div",{className:z.a.title},D.mainTypeName),$.a.createElement("div",null,$.a.createElement(O.a,{value:D.mainTypeDescription}))),!!(D!=null&&(m=D.smallType)!==null&&m!==void 0&&m.length)&&$.a.createElement("div",{className:z.a.line}),$.a.createElement("div",null,D==null||((S=D.smallType)===null||S===void 0)?void 0:S.map(function(C,l){return $.a.createElement($.a.Fragment,{key:l},$.a.createElement("div",{className:z.a.title,style:{marginBottom:14}},C.name),$.a.createElement("div",{className:"mb30"},$.a.createElement(O.a,{value:C.des})))}))))};it.a=H},SJMd:function(pt,it){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ie,le,J,k=!1,$,O;window.PR_SHOULD_USE_CONTINUATION=!0;var M,z;(function(){var H=window,U=["break,continue,do,else,for,if,return,while"],R=[U,"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"],m=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[m,"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"],D=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[m,"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"],_="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",C=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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=[U,"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"],s=[U,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[U,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,A,D,C,l,o,s,d],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",L="kwd",b="com",c="typ",p="lit",h="pun",a="pln",E="tag",y="dec",x="src",B="atn",F="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(xe){for(var ke=0,Pe=!1,je=!1,We=0,Be=xe.length;We<Be;++We){var Ie=xe[We];if(Ie.ignoreCase)je=!0;else if(/[a-z]/i.test(Ie.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,je=!1;break}}var tt={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(nt){var Me=nt.charCodeAt(0);if(Me!==92)return Me;var dt=nt.charAt(1);return Me=tt[dt],Me||("0"<=dt&&dt<="7"?parseInt(nt.substring(1),8):dt==="u"||dt==="x"?parseInt(nt.substring(2),16):nt.charCodeAt(1))}function Je(nt){if(nt<32)return(nt<16?"\\x0":"\\x")+nt.toString(16);var Me=String.fromCharCode(nt);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function Ye(nt){var Me=nt.substring(1,nt.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")),dt=[],lt=Me[0]==="^",Ue=["["];lt&&Ue.push("^");for(var Ke=lt?1:0,Ee=Me.length;Ke<Ee;++Ke){var ve=Me[Ke];if(/\\[bdsw]/i.test(ve))Ue.push(ve);else{var be=Ze(ve),re;Ke+2<Ee&&Me[Ke+1]==="-"?(re=Ze(Me[Ke+2]),Ke+=2):re=be,dt.push([be,re]),re<65||be>122||(re<65||be>90||dt.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||dt.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}dt.sort(function(fe,Le){return fe[0]-Le[0]||Le[1]-fe[1]});for(var ne=[],de=[],Ke=0;Ke<dt.length;++Ke){var ue=dt[Ke];ue[0]<=de[1]+1?de[1]=Math.max(de[1],ue[1]):ne.push(de=ue)}for(var Ke=0;Ke<ne.length;++Ke){var ue=ne[Ke];Ue.push(Je(ue[0])),ue[1]>ue[0]&&(ue[1]+1>ue[0]&&Ue.push("-"),Ue.push(Je(ue[1])))}return Ue.push("]"),Ue.join("")}function ft(nt){for(var Me=nt.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")),dt=Me.length,lt=[],Ue=0,Ke=0;Ue<dt;++Ue){var Ee=Me[Ue];if(Ee==="(")++Ke;else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&(ve<=Ke?lt[ve]=-1:Me[Ue]=Je(ve))}}for(var Ue=1;Ue<lt.length;++Ue)lt[Ue]===-1&&(lt[Ue]=++ke);for(var Ue=0,Ke=0;Ue<dt;++Ue){var Ee=Me[Ue];if(Ee==="(")++Ke,lt[Ke]||(Me[Ue]="(?:");else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&ve<=Ke&&(Me[Ue]="\\"+lt[ve])}}for(var Ue=0;Ue<dt;++Ue)Me[Ue]==="^"&&Me[Ue+1]!=="^"&&(Me[Ue]="");if(nt.ignoreCase&&Pe)for(var Ue=0;Ue<dt;++Ue){var Ee=Me[Ue],be=Ee.charAt(0);Ee.length>=2&&be==="["?Me[Ue]=Ye(Ee):be!=="\\"&&(Me[Ue]=Ee.replace(/[a-zA-Z]/g,function(de){var ue=de.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return Me.join("")}for(var rt=[],We=0,Be=xe.length;We<Be;++We){var Ie=xe[We];if(Ie.global||Ie.multiline)throw new Error(""+Ie);rt.push("(?:"+ft(Ie)+")")}return new RegExp(rt.join("|"),je?"gi":"g")}function I(xe,ke){var Pe=/(?:^|\s)nocode(?:\s|$)/,je=[],We=0,Be=[],Ie=0;function tt(Ze){var Je=Ze.nodeType;if(Je==1){if(Pe.test(Ze.className))return;for(var Ye=Ze.firstChild;Ye;Ye=Ye.nextSibling)tt(Ye);var ft=Ze.nodeName.toLowerCase();(ft==="br"||ft==="li")&&(je[Ie]=`
`,Be[Ie<<1]=We++,Be[Ie++<<1|1]=Ze)}else if(Je==3||Je==4){var rt=Ze.nodeValue;rt.length&&(ke?rt=rt.replace(/\r\n?/g,`
`):rt=rt.replace(/[ \t\r\n]+/g," "),je[Ie]=rt,Be[Ie<<1]=We,We+=rt.length,Be[Ie++<<1|1]=Ze)}}return tt(xe),{sourceCode:je.join("").replace(/\n$/,""),spans:Be}}function Y(xe,ke,Pe,je,We){if(!Pe)return;var Be={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:ke,decorations:null};je(Be),We.push.apply(We,Be.decorations)}var ee=/\S/;function oe(xe){for(var ke=void 0,Pe=xe.firstChild;Pe;Pe=Pe.nextSibling){var je=Pe.nodeType;ke=je===1?ke?xe:Pe:je===3&&ee.test(Pe.nodeValue)?xe:ke}return ke===xe?void 0:ke}function pe(xe,ke){var Pe={},je;(function(){for(var Ie=xe.concat(ke),tt=[],Ze={},Je=0,Ye=Ie.length;Je<Ye;++Je){var ft=Ie[Je],rt=ft[3];if(rt)for(var nt=rt.length;--nt>=0;)Pe[rt.charAt(nt)]=ft;var Me=ft[1],dt=""+Me;Ze.hasOwnProperty(dt)||(tt.push(Me),Ze[dt]=null)}tt.push(/[\0-\uffff]/),je=P(tt)})();var We=ke.length,Be=function(Ie){for(var tt=Ie.sourceCode,Ze=Ie.basePos,Je=Ie.sourceNode,Ye=[Ze,a],ft=0,rt=tt.match(je)||[],nt={},Me=0,dt=rt.length;Me<dt;++Me){var lt=rt[Me],Ue=nt[lt],Ke=void 0,Ee;if(typeof Ue=="string")Ee=!1;else{var ve=Pe[lt.charAt(0)];if(ve)Ke=lt.match(ve[1]),Ue=ve[0];else{for(var be=0;be<We;++be)if(ve=ke[be],Ke=lt.match(ve[1]),Ke){Ue=ve[0];break}Ke||(Ue=a)}Ee=Ue.length>=5&&Ue.substring(0,5)==="lang-",Ee&&!(Ke&&typeof Ke[1]=="string")&&(Ee=!1,Ue=x),Ee||(nt[lt]=Ue)}var re=ft;if(ft+=lt.length,!Ee)Ye.push(Ze+re,Ue);else{var ne=Ke[1],de=lt.indexOf(ne),ue=de+ne.length;Ke[2]&&(ue=lt.length-Ke[2].length,de=ue-ne.length);var fe=Ue.substring(5);Y(Je,Ze+re,lt.substring(0,de),Be,Ye),Y(Je,Ze+re+de,ne,se(fe,ne),Ye),Y(Je,Ze+re+ue,lt.substring(ue),Be,Ye)}}Ie.decorations=Ye};return Be}function Oe(xe){var ke=[],Pe=[];xe.tripleQuotedStrings?ke.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?ke.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ke.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Pe.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=xe.hashComments;je&&(xe.cStyleComments?(je>1?ke.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ke.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ke.push([b,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Pe.push([b,/^\/\/[^\r\n]*/,null]),Pe.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=xe.regexLiterals;if(We){var Be=We>1?"":`
\r`,Ie=Be?".":"[\\S\\s]",tt="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Ie+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Ie+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+tt+")")])}var Ze=xe.types;Ze&&Pe.push([c,Ze]);var Je=(""+xe.keywords).replace(/^ | $/g,"");Je.length&&Pe.push([L,new RegExp("^(?:"+Je.replace(/[\s,]+/g,"|")+")\\b"),null]),ke.push([a,/^\s+/,null,` \r
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Ye+="(?!s*/)"),Pe.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[h,new RegExp(Ye),null]),pe(ke,Pe)}var Se=Oe({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function we(xe,ke,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Be=xe.ownerDocument,Ie=Be.createElement("li");xe.firstChild;)Ie.appendChild(xe.firstChild);var tt=[Ie];function Ze(Me){var dt=Me.nodeType;if(dt==1&&!je.test(Me.className))if(Me.nodeName==="br")Je(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var lt=Me.firstChild;lt;lt=lt.nextSibling)Ze(lt);else if((dt==3||dt==4)&&Pe){var Ue=Me.nodeValue,Ke=Ue.match(We);if(Ke){var Ee=Ue.substring(0,Ke.index);Me.nodeValue=Ee;var ve=Ue.substring(Ke.index+Ke[0].length);if(ve){var be=Me.parentNode;be.insertBefore(Be.createTextNode(ve),Me.nextSibling)}Je(Me),Ee||Me.parentNode.removeChild(Me)}}}function Je(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function dt(Ke,Ee){var ve=Ee?Ke.cloneNode(!1):Ke,be=Ke.parentNode;if(be){var re=dt(be,1),ne=Ke.nextSibling;re.appendChild(ve);for(var de=ne;de;de=ne)ne=de.nextSibling,re.appendChild(de)}return ve}for(var lt=dt(Me.nextSibling,0),Ue;(Ue=lt.parentNode)&&Ue.nodeType===1;)lt=Ue;tt.push(lt)}for(var Ye=0;Ye<tt.length;++Ye)Ze(tt[Ye]);ke===(ke|0)&&tt[0].setAttribute("value",ke);var ft=Be.createElement("ol");ft.className="linenums";for(var rt=Math.max(0,ke-1|0)||0,Ye=0,nt=tt.length;Ye<nt;++Ye)Ie=tt[Ye],Ie.className="L"+(Ye+rt)%10,Ie.firstChild||Ie.appendChild(Be.createTextNode("\xA0")),ft.appendChild(Ie);xe.appendChild(ft)}function Te(xe){var ke=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ke=ke&&+ke[1]<=8;var Pe=/\n/g,je=xe.sourceCode,We=je.length,Be=0,Ie=xe.spans,tt=Ie.length,Ze=0,Je=xe.decorations,Ye=Je.length,ft=0;Je[Ye]=We;var rt,nt;for(nt=rt=0;nt<Ye;)Je[nt]!==Je[nt+2]?(Je[rt++]=Je[nt++],Je[rt++]=Je[nt++]):nt+=2;for(Ye=rt,nt=rt=0;nt<Ye;){for(var Me=Je[nt],dt=Je[nt+1],lt=nt+2;lt+2<=Ye&&Je[lt+1]===dt;)lt+=2;Je[rt++]=Me,Je[rt++]=dt,nt=lt}Ye=Je.length=rt;var Ue=xe.sourceNode,Ke="";Ue&&(Ke=Ue.style.display,Ue.style.display="none");try{for(var Ee=null;Ze<tt;){var ve=Ie[Ze],be=Ie[Ze+2]||We,re=Je[ft+2]||We,lt=Math.min(be,re),ne=Ie[Ze+1],de;if(ne.nodeType!==1&&(de=je.substring(Be,lt))){ke&&(de=de.replace(Pe,"\r")),ne.nodeValue=de;var ue=ne.ownerDocument,fe=ue.createElement("span");fe.className=Je[ft+1];var Le=ne.parentNode;Le.replaceChild(fe,ne),fe.appendChild(ne),Be<be&&(Ie[Ze+1]=ne=ue.createTextNode(je.substring(lt,be)),Le.insertBefore(ne,fe.nextSibling))}Be=lt,Be>=be&&(Ze+=2),Be>=re&&(ft+=2)}}finally{Ue&&(Ue.style.display=Ke)}}var Ce={};function me(xe,ke){for(var Pe=ke.length;--Pe>=0;){var je=ke[Pe];Ce.hasOwnProperty(je)?H.console&&console.warn("cannot override language handler %s",je):Ce[je]=xe}}function se(xe,ke){return xe&&Ce.hasOwnProperty(xe)||(xe=/^\s*</.test(ke)?"default-markup":"default-code"),Ce[xe]}me(Se,["default-code"]),me(pe([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(pe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[B,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),me(pe([],[[F,/^[\s\S]+/]]),["uq.val"]),me(Oe({keywords:S,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),me(Oe({keywords:"null,true,false"}),["json"]),me(Oe({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),me(Oe({keywords:D,cStyleComments:!0}),["java"]),me(Oe({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Oe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Oe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Oe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Oe({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Oe({keywords:_,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(pe([],[[v,/^[\s\S]+/]]),["regex"]);function te(xe){var ke=xe.langExtension;try{var Pe=I(xe.sourceNode,xe.pre),je=Pe.sourceCode;xe.sourceCode=je,xe.spans=Pe.spans,xe.basePos=0,se(ke,je)(xe),Te(xe)}catch(We){H.console&&console.log(We&&We.stack||We)}}function ce(xe,ke,Pe){var je=Pe||!1,We=ke||null,Be=document.createElement("div");Be.innerHTML="<pre>"+xe+"</pre>",Be=Be.firstChild,je&&we(Be,je,!0);var Ie={langExtension:We,numberLines:je,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ie),Be.innerHTML}function ae(xe,ke){var Pe=ke||document.body,je=Pe.ownerDocument||document;function We(ve){return Pe.getElementsByTagName(ve)}for(var Be=[We("pre"),We("code"),We("xmp")],Ie=[],tt=0;tt<Be.length;++tt)for(var Ze=0,Je=Be[tt].length;Ze<Je;++Ze)Ie.push(Be[tt][Ze]);Be=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var ft=0,rt=/\blang(?:uage)?-([\w.]+)(?!\S)/,nt=/\bprettyprint\b/,Me=/\bprettyprinted\b/,dt=/pre|xmp/i,lt=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ke={};function Ee(){for(var ve=H.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;ft<Ie.length&&Ye.now()<ve;ft++){for(var be=Ie[ft],re=Ke,ne=be;ne=ne.previousSibling;){var de=ne.nodeType,ue=(de===7||de===8)&&ne.nodeValue;if(ue?!/^\??prettify\b/.test(ue):de!==3||/\S/.test(ne.nodeValue))break;if(ue){re={},ue.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ot,Tt,Zt){re[Tt]=Zt});break}}var fe=be.className;if((re!==Ke||nt.test(fe))&&!Me.test(fe)){for(var Le=!1,Ne=be.parentNode;Ne;Ne=Ne.parentNode){var $e=Ne.tagName;if(Ue.test($e)&&Ne.className&&nt.test(Ne.className)){Le=!0;break}}if(!Le){be.className+=" prettyprinted";var ht=re.lang;if(!ht){ht=fe.match(rt);var Xe;!ht&&(Xe=oe(be))&&lt.test(Xe.tagName)&&(ht=Xe.className.match(rt)),ht&&(ht=ht[1])}var gt;if(dt.test(be.tagName))gt=1;else{var st=be.currentStyle,qe=je.defaultView,Dt=st?st.whiteSpace:qe&&qe.getComputedStyle?qe.getComputedStyle(be,null).getPropertyValue("white-space"):0;gt=Dt&&Dt.substring(0,3)==="pre"}var Et=re.linenums;(Et=Et==="true"||+Et)||(Et=fe.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&we(be,Et,gt);var kt={langExtension:ht,sourceNode:be,numberLines:Et,pre:gt,sourceCode:null,basePos:null,spans:null,decorations:null};te(kt)}}}ft<Ie.length?H.setTimeout(Ee,250):typeof xe=="function"&&xe()}Ee()}var Ae=H.PR={createSimpleLexer:pe,registerLangHandler:me,sourceDecorator:Oe,PR_ATTRIB_NAME:B,PR_ATTRIB_VALUE:F,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:L,PR_LITERAL:p,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:h,PR_SOURCE:x,PR_STRING:v,PR_TAG:E,PR_TYPE:c,prettyPrintOne:k?H.prettyPrintOne=ce:M=ce,prettyPrint:z=k?H.prettyPrint=ae:z=ae},Re=H.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return Ae})})()},"VrN/":function(pt,it,ie){(function(le,J){pt.exports=J()})(this,function(){"use strict";var le=navigator.userAgent,J=navigator.platform,k=/gecko\/\d/i.test(le),$=/MSIE \d/.test(le),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),M=/Edge\/(\d+)/.exec(le),z=$||O||M,H=z&&($?document.documentMode||6:+(M||O)[1]),U=!M&&/WebKit\//.test(le),R=U&&/Qt\/\d+\.\d+/.test(le),m=!M&&/Chrome\//.test(le),S=/Opera\//.test(le),D=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),_=/PhantomJS/.test(le),C=!M&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),l=/Android/.test(le),o=C||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),s=C||/Mac/.test(J),d=/\bCrOS\b/.test(le),w=/win/i.test(J),g=S&&le.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(S=!1,U=!0);var v=s&&(R||S&&(g==null||g<12.11)),L=k||z&&H>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=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 p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return p(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)n.appendChild(t[T]);return n}function E(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var y;document.createRange?y=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:y=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 x(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function B(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var i=e.className;b(t).test(i)||(e.className+=(i?" ":"")+t)}function K(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 V=function(e){e.select()};C?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(V=function(e){try{e.select()}catch(t){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,j=n||0;;){var X=e.indexOf(" ",T);if(X<0||X>=t)return j+(t-T);j+=X-T,j+=i-j%i,T=X+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.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 oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var pe=50,Oe={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},we={origin:"*mouse"},Te={origin:"+move"};function Ce(e,t,i){for(var r=0,n=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var j=T-r;if(T==e.length||n+j>=t)return r+Math.min(j,t-n);if(n+=T-r,n+=i-n%i,r=T+1,n>=t)return r}}var me=[""];function se(e){for(;me.length<=e;)me.push(te(me)+" ");return me[e]}function te(e){return e[e.length-1]}function ce(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ae(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Ae(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(Ae.prototype=e,i=new Ae),t&&I(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ke(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&ke(e)?!0:t.test(e):ke(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 Be(e){return e.charCodeAt(0)>=768&&We.test(e)}function Ie(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function tt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,T=r<0?Math.ceil(n):Math.floor(n);if(T==t)return e(T)?t:i;e(T)?i=T:t=T+r}}function Ze(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,T=0;T<e.length;++T){var j=e[T];(j.from<i&&j.to>t||t==i&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,i),j.level==1?"rtl":"ltr",T),n=!0)}n||r(t,i,"ltr")}var Je=null;function Ye(e,t,i){var r;Je=null;for(var n=0;n<e.length;++n){var T=e[n];if(T.from<t&&T.to>t)return n;T.to==t&&(T.from!=T.to&&i=="before"?r=n:Je=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:Je=n)}return r!=null?r:Je}var ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,j=/[Lb1n]/,X=/[1n]/;function Z(q,he,ge){this.level=q,this.from=he,this.to=ge}return function(q,he){var ge=he=="ltr"?"L":"R";if(q.length==0||he=="ltr"&&!r.test(q))return!1;for(var De=q.length,_e=[],Fe=0;Fe<De;++Fe)_e.push(i(q.charCodeAt(Fe)));for(var ze=0,Qe=ge;ze<De;++ze){var at=_e[ze];at=="m"?_e[ze]=Qe:Qe=at}for(var ut=0,ot=ge;ut<De;++ut){var mt=_e[ut];mt=="1"&&ot=="r"?_e[ut]="n":T.test(mt)&&(ot=mt,mt=="r"&&(_e[ut]="R"))}for(var wt=1,xt=_e[0];wt<De-1;++wt){var Rt=_e[wt];Rt=="+"&&xt=="1"&&_e[wt+1]=="1"?_e[wt]="1":Rt==","&&xt==_e[wt+1]&&(xt=="1"||xt=="n")&&(_e[wt]=xt),xt=Rt}for(var $t=0;$t<De;++$t){var gr=_e[$t];if(gr==",")_e[$t]="N";else if(gr=="%"){var rr=void 0;for(rr=$t+1;rr<De&&_e[rr]=="%";++rr);for(var jr=$t&&_e[$t-1]=="!"||rr<De&&_e[rr]=="1"?"1":"N",Mr=$t;Mr<rr;++Mr)_e[Mr]=jr;$t=rr-1}}for(var lr=0,Ir=ge;lr<De;++lr){var Er=_e[lr];Ir=="L"&&Er=="1"?_e[lr]="L":T.test(Er)&&(Ir=Er)}for(var hr=0;hr<De;++hr)if(n.test(_e[hr])){var ur=void 0;for(ur=hr+1;ur<De&&n.test(_e[ur]);++ur);for(var nr=(hr?_e[hr-1]:ge)=="L",Nr=(ur<De?_e[ur]:ge)=="L",un=nr==Nr?nr?"L":"R":ge,ki=hr;ki<ur;++ki)_e[ki]=un;hr=ur-1}for(var _r=[],oi,vr=0;vr<De;)if(j.test(_e[vr])){var Va=vr;for(++vr;vr<De&&j.test(_e[vr]);++vr);_r.push(new Z(0,Va,vr))}else{var ci=vr,Hi=_r.length,Gi=he=="rtl"?1:0;for(++vr;vr<De&&_e[vr]!="L";++vr);for(var Dr=ci;Dr<vr;)if(X.test(_e[Dr])){ci<Dr&&(_r.splice(Hi,0,new Z(1,ci,Dr)),Hi+=Gi);var dn=Dr;for(++Dr;Dr<vr&&X.test(_e[Dr]);++Dr);_r.splice(Hi,0,new Z(2,dn,Dr)),Hi+=Gi,ci=Dr}else++Dr;ci<vr&&_r.splice(Hi,0,new Z(1,ci,vr))}return he=="ltr"&&(_r[0].level==1&&(oi=q.match(/^\s+/))&&(_r[0].from=oi[0].length,_r.unshift(new Z(0,0,oi[0].length))),te(_r).level==1&&(oi=q.match(/\s+$/))&&(te(_r).to-=oi[0].length,_r.push(new Z(0,De-oi[0].length,De)))),he=="rtl"?_r.reverse():_r}}();function rt(e,t){var i=e.order;return i==null&&(i=e.order=ft(e.text,t)),i}var nt=[],Me=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]||nt).concat(i)}};function dt(e,t){return e._handlers&&e._handlers[t]||nt}function lt(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 T=oe(n,i);T>-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function Ue(e,t){var i=dt(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 Ke(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ue(e,i||t.type,e,t),de(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(i,t[r])==-1&&i.push(t[r])}function ve(e,t){return dt(e,t).length>0}function be(e){e.prototype.on=function(t,i){Me(this,t,i)},e.prototype.off=function(t,i){lt(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){re(e),ne(e)}function fe(e){return e.target||e.srcElement}function Le(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ne=function(){if(z&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),$e;function ht(e){if($e==null){var t=a("span","\u200B");h(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($e=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&H<8))}var i=$e?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Xe;function gt(e){if(Xe!=null)return Xe;var t=h(e,document.createTextNode("A\u062EA")),i=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return p(e),!i||i.left==i.right?!1:Xe=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 T=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),j=T.indexOf("\r");j!=-1?(i.push(T.slice(0,j)),t+=j+1):(i.push(T),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},qe=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},Dt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function kt(e){if(Et!=null)return Et;var t=h(e,a("span","x")),i=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(i.left-r.left)>1}var Ot={},Tt={};function Zt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function Qt(e,t){Tt[e]=t}function vt(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=Re(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Lt(e,t){t=vt(t);var i=Ot[t.name];if(!i)return Lt(e,"text/plain");var r=i(e,t);if(jt.hasOwnProperty(t.name)){var n=jt[t.name];for(var T in n){if(!n.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=n[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var jt={};function Ut(e,t){var i=jt.hasOwnProperty(e)?jt[e]:jt[e]={};I(t,i)}function qt(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 ir(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 er(e,t,i){return e.startState?e.startState(t,i):!0}var Bt=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};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.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},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(j){return i?j.toLowerCase():j},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ct(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],T=n.chunkSize();if(t<T){i=n;break}t-=T}return i.lines[t]}function Kr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(T){var j=T.text;n==i.line&&(j=j.slice(0,i.ch)),n==t.line&&(j=j.slice(t.ch)),r.push(j),++n}),r}function ti(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Mt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(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 Wr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],T=n.height;if(t<T){e=n;continue e}t-=T,i+=n.chunkSize()}return i}while(!e.lines);for(var j=0;j<e.lines.length;++j){var X=e.lines[j],Z=X.height;if(t<Z)break;t-=Z}return i+j}function Yr(e,t){return t>=e.first&&t<e.first+e.size}function fi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function _t(e,t){return e.line-t.line||e.ch-t.ch}function pi(e,t){return e.sticky==t.sticky&&_t(e,t)==0}function mi(e){return Ve(e.line,e.ch)}function gi(e,t){return _t(e,t)<0?t:e}function vi(e,t){return _t(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function u(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,ct(e,i).text.length):f(t,ct(e,t.line).text.length)}function f(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function N(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=u(e,t[r]);return i}var Q=function(e,t){this.state=e,this.lookAhead=t},W=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};W.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},W.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}},W.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},W.fromSaved=function(e,t,i){return t instanceof Q?new W(e,qt(e.mode,t.state),i,t.lookAhead):new W(e,qt(e.mode,t),i)},W.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function ye(e,t,i,r){var n=[e.state.modeGen],T={};Sr(e,t.text,e.doc.mode,i,function(q,he){return n.push(q,he)},T,r);for(var j=i.state,X=function(q){i.baseTokens=n;var he=e.state.overlays[q],ge=1,De=0;i.state=!0,Sr(e,t.text,he.mode,i,function(_e,Fe){for(var ze=ge;De<_e;){var Qe=n[ge];Qe>_e&&n.splice(ge,1,_e,n[ge+1],Qe),ge+=2,De=Math.min(_e,Qe)}if(!Fe)return;if(he.opaque)n.splice(ze,ge-ze,_e,"overlay "+Fe),ge=ze+2;else for(;ze<ge;ze+=2){var at=n[ze+1];n[ze+1]=(at?at+" ":"")+"overlay "+Fe}},T),i.state=j,i.baseTokens=null,i.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)X(Z);return{styles:n,classes:T.bgClass||T.textClass?T:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=et(e,Mt(t)),n=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,r.state),T=ye(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=T.styles,T.classes?t.styleClasses=T.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 et(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new W(r,!0,t);var T=Cr(e,t,i),j=T>r.first&&ct(r,T-1).stateAfter,X=j?W.fromSaved(r,j,T):new W(r,er(r.mode),T);return r.iter(T,t,function(Z){yt(e,Z.text,X);var q=X.line;Z.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?X.save():null,X.nextLine()}),i&&(r.modeFrontier=X.line),X}function yt(e,t,i,r){var n=e.doc.mode,T=new Bt(t,e.options.tabSize,i);for(T.start=T.pos=r||0,t==""&&Ge(n,i.state);!T.eol();)St(n,T,i.state),T.start=T.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=ir(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function St(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=ir(e,i).mode);var T=e.token(t,i);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ht=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Jt(e,t,i,r){var n=e.doc,T=n.mode,j;t=u(n,t);var X=ct(n,t.line),Z=et(e,t.line,i),q=new Bt(X.text,e.options.tabSize,Z),he;for(r&&(he=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,j=St(T,q,Z.state),r&&he.push(new Ht(q,j,qt(n.mode,Z.state)));return r?he:new Ht(q,j,Z.state)}function Ur(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 Sr(e,t,i,r,n,T,j){var X=i.flattenSpans;X==null&&(X=e.options.flattenSpans);var Z=0,q=null,he=new Bt(t,e.options.tabSize,r),ge,De=e.options.addModeClass&&[null];for(t==""&&Ur(Ge(i,r.state),T);!he.eol();){if(he.pos>e.options.maxHighlightLength?(X=!1,j&&yt(e,t,r,he.pos),he.pos=t.length,ge=null):ge=Ur(St(i,he,r.state,De),T),De){var _e=De[0].name;_e&&(ge="m-"+(ge?_e+" "+ge:_e))}if(!X||q!=ge){for(;Z<he.start;)Z=Math.min(he.start,Z+5e3),n(Z,q);q=ge}he.start=he.pos}for(;Z<he.pos;){var Fe=Math.min(he.pos,Z+5e3);n(Fe,q),Z=Fe}}function Cr(e,t,i){for(var r,n,T=e.doc,j=i?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>j;--X){if(X<=T.first)return T.first;var Z=ct(T,X-1),q=Z.stateAfter;if(q&&(!i||X+(q instanceof Q?q.lookAhead:0)<=T.modeFrontier))return X;var he=Y(Z.text,null,e.options.tabSize);(n==null||r>he)&&(n=X-1,r=he)}return n}function $r(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=ct(e,r).stateAfter;if(n&&(!(n instanceof Q)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ri=!1,cr=!1;function Hr(){Ri=!0}function si(){cr=!0}function li(e,t,i){this.marker=e,this.from=t,this.to=i}function Br(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 T=e[n],j=T.marker,X=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);if(X||T.from==t&&j.type=="bookmark"&&(!i||!T.marker.insertLeft)){var Z=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new li(j,T.from,Z?null:T.to))}}return r}function Ki(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],j=T.marker,X=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);if(X||T.from==t&&j.type=="bookmark"&&(!i||T.marker.insertLeft)){var Z=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new li(j,Z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Jr(e,t){if(t.full)return null;var i=Yr(e,t.from.line)&&ct(e,t.from.line).markedSpans,r=Yr(e,t.to.line)&&ct(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,T=t.to.ch,j=_t(t.from,t.to)==0,X=zi(i,n,j),Z=Ki(r,T,j),q=t.text.length==1,he=te(t.text).length+(q?n:0);if(X)for(var ge=0;ge<X.length;++ge){var De=X[ge];if(De.to==null){var _e=Br(Z,De.marker);_e?q&&(De.to=_e.to==null?null:_e.to+he):De.to=n}}if(Z)for(var Fe=0;Fe<Z.length;++Fe){var ze=Z[Fe];if(ze.to!=null&&(ze.to+=he),ze.from==null){var Qe=Br(X,ze.marker);Qe||(ze.from=he,q&&(X||(X=[])).push(ze))}else ze.from+=he,q&&(X||(X=[])).push(ze)}X&&(X=Vr(X)),Z&&Z!=X&&(Z=Vr(Z));var at=[X];if(!q){var ut=t.text.length-2,ot;if(ut>0&&X)for(var mt=0;mt<X.length;++mt)X[mt].to==null&&(ot||(ot=[])).push(new li(X[mt].marker,null,null));for(var wt=0;wt<ut;++wt)at.push(ot);at.push(Z)}return at}function Vr(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(_e){if(_e.markedSpans)for(var Fe=0;Fe<_e.markedSpans.length;++Fe){var ze=_e.markedSpans[Fe].marker;ze.readOnly&&(!r||oe(r,ze)==-1)&&(r||(r=[])).push(ze)}}),!r)return null;for(var n=[{from:t,to:i}],T=0;T<r.length;++T)for(var j=r[T],X=j.find(0),Z=0;Z<n.length;++Z){var q=n[Z];if(_t(q.to,X.from)<0||_t(q.from,X.to)>0)continue;var he=[Z,1],ge=_t(q.from,X.from),De=_t(q.to,X.to);(ge<0||!j.inclusiveLeft&&!ge)&&he.push({from:q.from,to:X.from}),(De>0||!j.inclusiveRight&&!De)&&he.push({from:X.to,to:q.to}),n.splice.apply(n,he),Z+=he.length-3}return n}function hn(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 Ei(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function ar(e){return e.inclusiveLeft?-1:0}function Gt(e){return e.inclusiveRight?1:0}function yr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),T=_t(r.from,n.from)||ar(e)-ar(t);if(T)return-T;var j=_t(r.to,n.to)||Gt(e)-Gt(t);return j||t.id-e.id}function It(e,t){var i=cr&&e.markedSpans,r;if(i)for(var n=void 0,T=0;T<i.length;++T)n=i[T],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||yr(r,n.marker)<0)&&(r=n.marker);return r}function sr(e){return It(e,!0)}function Vt(e){return It(e,!1)}function ri(e,t){var i=cr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var T=i[n];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||yr(r,T.marker)<0)&&(r=T.marker)}return r}function fr(e,t,i,r,n){var T=ct(e,t),j=cr&&T.markedSpans;if(j)for(var X=0;X<j.length;++X){var Z=j[X];if(!Z.marker.collapsed)continue;var q=Z.marker.find(0),he=_t(q.from,i)||ar(Z.marker)-ar(n),ge=_t(q.to,r)||Gt(Z.marker)-Gt(n);if(he>=0&&ge<=0||he<=0&&ge>=0)continue;if(he<=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?_t(q.to,i)>=0:_t(q.to,i)>0)||he>=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?_t(q.from,r)<=0:_t(q.from,r)<0))return!0}}function Ar(e){for(var t;t=sr(e);)e=t.find(-1,!0).line;return e}function Vi(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function xi(e){for(var t,i;t=Vt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function cn(e,t){var i=ct(e,t),r=Ar(i);return i==r?t:Mt(r)}function Si(e,t){if(t>e.lastLine())return t;var i=ct(e,t),r;if(!ii(e,i))return t;for(;r=Vt(i);)i=r.find(1,!0).line;return Mt(i)+1}function ii(e,t){var i=cr&&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,Br(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,T=0;T<t.markedSpans.length;++T)if(n=t.markedSpans[T],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 Zr(e){e=Ar(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 T=i.parent;T;i=T,T=i.parent)for(var j=0;j<T.children.length;++j){var X=T.children[j];if(X==i)break;t+=X.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=sr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Vt(r);){var T=i.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=ct(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,Ei(this,t),this.height=i?i(this):1};Pi.prototype.lineNo=function(){return Mt(this)},be(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),hn(e),Ei(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function bt(e){e.parent=null,hn(e)}var At={},Ct={};function Pt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ct:At;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Wt(e,t){var i=E("span",null,null,U?"padding-right: .1px":null),r={pre:E("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 T=n?t.rest[n-1]:t.line,j=void 0;r.pos=0,r.addToken=Ft,gt(e.display.measure)&&(j=rt(T,e.doc.direction))&&(r.addToken=kr(r.addToken,j)),r.map=[];var X=t!=e.display.externalMeasured&&Mt(T);ui(T,r,He(e,T,X)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=K(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=K(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(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(U){var Z=r.content.lastChild;(/\bcm-tab\b/.test(Z.className)||Z.querySelector&&Z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ue(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Yt(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 Ft(e,t,i,r,n,T,j){if(!t)return;var X=e.splitSpaces?dr(t,e.trailingSpace):t,Z=e.cm.state.specialChars,q=!1,he;if(!Z.test(t))e.col+=t.length,he=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,he),z&&H<9&&(q=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ge=0;;){Z.lastIndex=ge;var De=Z.exec(t),_e=De?De.index-ge:t.length-ge;if(_e){var Fe=document.createTextNode(X.slice(ge,ge+_e));z&&H<9?he.appendChild(a("span",[Fe])):he.appendChild(Fe),e.map.push(e.pos,e.pos+_e,Fe),e.col+=_e,e.pos+=_e}if(!De)break;ge+=_e+1;var ze=void 0;if(De[0]==" "){var Qe=e.cm.options.tabSize,at=Qe-e.col%Qe;ze=he.appendChild(a("span",se(at),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=at}else De[0]=="\r"||De[0]==`
`?(ze=he.appendChild(a("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",De[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(De[0]),ze.setAttribute("cm-text",De[0]),z&&H<9?he.appendChild(a("span",[ze])):he.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,i||r||n||q||T||j){var ut=i||"";r&&(ut+=r),n&&(ut+=n);var ot=a("span",[he],ut,T);if(j)for(var mt in j)j.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&ot.setAttribute(mt,j[mt]);return e.content.appendChild(ot)}e.content.appendChild(he)}function dr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var T=e.charAt(n);T==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(T="\xA0"),r+=T,i=T==" "}return r}function kr(e,t){return function(i,r,n,T,j,X,Z){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,he=q+r.length;;){for(var ge=void 0,De=0;De<t.length&&!(ge=t[De],ge.to>q&&ge.from<=q);De++);if(ge.to>=he)return e(i,r,n,T,j,X,Z);e(i,r.slice(0,ge.to-q),n,T,null,X,Z),T=null,r=r.slice(ge.to-q),q=ge.to}}}function Nt(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 ui(e,t,i){var r=e.markedSpans,n=e.text,T=0;if(!r){for(var j=1;j<i.length;j+=2)t.addToken(t,n.slice(T,T=i[j]),Pt(i[j+1],t.cm.options));return}for(var X=n.length,Z=0,q=1,he="",ge,De,_e=0,Fe,ze,Qe,at,ut;;){if(_e==Z){Fe=ze=Qe=De="",ut=null,at=null,_e=Infinity;for(var ot=[],mt=void 0,wt=0;wt<r.length;++wt){var xt=r[wt],Rt=xt.marker;if(Rt.type=="bookmark"&&xt.from==Z&&Rt.widgetNode)ot.push(Rt);else if(xt.from<=Z&&(xt.to==null||xt.to>Z||Rt.collapsed&&xt.to==Z&&xt.from==Z)){if(xt.to!=null&&xt.to!=Z&&_e>xt.to&&(_e=xt.to,ze=""),Rt.className&&(Fe+=" "+Rt.className),Rt.css&&(De=(De?De+";":"")+Rt.css),Rt.startStyle&&xt.from==Z&&(Qe+=" "+Rt.startStyle),Rt.endStyle&&xt.to==_e&&(mt||(mt=[])).push(Rt.endStyle,xt.to),Rt.title&&((ut||(ut={})).title=Rt.title),Rt.attributes)for(var $t in Rt.attributes)(ut||(ut={}))[$t]=Rt.attributes[$t];Rt.collapsed&&(!at||yr(at.marker,Rt)<0)&&(at=xt)}else xt.from>Z&&_e>xt.from&&(_e=xt.from)}if(mt)for(var gr=0;gr<mt.length;gr+=2)mt[gr+1]==_e&&(ze+=" "+mt[gr]);if(!at||at.from==Z)for(var rr=0;rr<ot.length;++rr)Nt(t,0,ot[rr]);if(at&&(at.from||0)==Z){if(Nt(t,(at.to==null?X+1:at.to)-Z,at.marker,at.from==null),at.to==null)return;at.to==Z&&(at=!1)}}if(Z>=X)break;for(var jr=Math.min(X,_e);;){if(he){var Mr=Z+he.length;if(!at){var lr=Mr>jr?he.slice(0,jr-Z):he;t.addToken(t,lr,ge?ge+Fe:Fe,Qe,Z+lr.length==_e?ze:"",De,ut)}if(Mr>=jr){he=he.slice(jr-Z),Z=jr;break}Z=Mr,Qe=""}he=n.slice(T,T=i[q++]),ge=Pt(i[q++],t.cm.options)}}}function zt(e,t,i){this.line=t,this.rest=xi(t),this.size=this.rest?Mt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ii(e,t)}function Rr(e,t,i){for(var r=[],n,T=t;T<i;T=n){var j=new zt(e.doc,ct(e.doc,T),T);n=T+j.size,r.push(j)}return r}var Tr=null;function Xr(e){Tr?Tr.ops.push(e):e.ownsGroup=Tr={ops:[e],delayedCallbacks:[]}}function ks(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 Rs(e,t){var i=e.ownsGroup;if(!i)return;try{ks(i)}finally{Tr=null,t(i)}}var mn=null;function br(e,t){var i=dt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;Tr?n=Tr.delayedCallbacks:mn?n=mn:(n=mn=[],setTimeout(Os,0));for(var T=function(X){n.push(function(){return i[X].apply(null,r)})},j=0;j<i.length;++j)T(j)}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 T=t.changes[n];T=="text"?Ms(e,t):T=="gutter"?Ja(e,t,i,r):T=="class"?da(e,t):T=="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),z&&H<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):Wt(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,da(e,t)):i&&(t.text.className=i)}function da(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 Ja(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 T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var j=gn(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),j.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",fi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=e.display.gutterSpecs[Z].className,he=T.hasOwnProperty(q)&&T[q];he&&X.appendChild(a("div",[he],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,T=void 0;n;n=T)T=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Za(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),da(e,t),Ja(e,t,i,r),Za(e,t,r),t.node}function Za(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 T=gn(i),j=0,X=t.widgets;j<X.length;++j){var Z=X[j],q=a("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Us(Z,q,i,r),e.display.input.setUneditable(q),n&&Z.above?T.insertBefore(q,i.gutter||i.text):T.appendChild(q),br(Z,"redraw")}}function Us(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(!x(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function di(e,t){for(var i=fe(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 ha(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return pe-e.display.nativeBarWidth}function Mi(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&Mi(e);if(!t.measure.heights||r&&t.measure.width!=n){var T=t.measure.heights=[];if(r){t.measure.width=n;for(var j=t.text.firstChild.getClientRects(),X=0;X<j.length-1;X++){var Z=j[X],q=j[X+1];Math.abs(Z.bottom-q.bottom)>2&&T.push((Z.bottom+q.top)/2-i.top)}}T.push(i.bottom-i.top)}}function eo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Mt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Ar(t);var i=Mt(t),r=e.display.externalMeasured=new zt(e.doc,t,i);r.lineN=i;var n=r.built=Wt(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return ai(e,Xi(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(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=Mt(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Fs(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 ai(e,t,i,r,n){t.before&&(i=-1);var T=i+(r||""),j;return t.cache.hasOwnProperty(T)?j=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,i,r),j.bogus||(t.cache[T]=j)),{left:j.left,right:j.right,top:n?j.rtop:j.top,bottom:n?j.rbottom:j.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,T,j,X,Z,q=0;q<e.length;q+=3)if(X=e[q],Z=e[q+1],t<X?(n=0,T=1,j="left"):t<Z?(n=t-X,T=n+1):(q==e.length-3||t==Z&&e[q+3]>t)&&(T=Z-X,n=T-1,t>=Z&&(j="right")),n!=null){if(r=e[q+2],X==Z&&i==(r.insertLeft?"left":"right")&&(j=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],j="left";if(i=="right"&&n==Z-X)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],j="right";break}return{node:r,start:n,end:T,collapse:j,coverStart:X,coverEnd:Z}}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),T=n.node,j=n.start,X=n.end,Z=n.collapse,q;if(T.nodeType==3){for(var he=0;he<4;he++){for(;j&&Be(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+X<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+X));)++X;if(z&&H<9&&j==0&&X==n.coverEnd-n.coverStart?q=T.parentNode.getBoundingClientRect():q=js(y(T,j,X).getClientRects(),r),q.left||q.right||j==0)break;X=j,j=j-1,Z="right"}z&&H<11&&(q=Hs(e.display.measure,q))}else{j>0&&(Z=r="right");var ge;e.options.lineWrapping&&(ge=T.getClientRects()).length>1?q=ge[r=="right"?ge.length-1:0]:q=T.getBoundingClientRect()}if(z&&H<9&&!j&&(!q||!q.left&&!q.right)){var De=T.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+$i(e.display),top:De.top,bottom:De.bottom}:q=ro}for(var _e=q.top-t.rect.top,Fe=q.bottom-t.rect.top,ze=(_e+Fe)/2,Qe=t.view.measure.heights,at=0;at<Qe.length-1&&!(ze<Qe[at]);at++);var ut=at?Qe[at-1]:0,ot=Qe[at],mt={left:(Z=="right"?q.right:q.left)-t.rect.left,right:(Z=="left"?q.left:q.right)-t.rect.left,top:ut,bottom:ot};return!q.left&&!q.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=_e,mt.rbottom=Fe),mt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function no(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function 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 m&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return m&&l?-(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 T=pa(t);i.top+=T,i.bottom+=T}if(r=="line")return i;r||(r="local");var j=Zr(t);if(r=="local"?j+=Wn(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();j+=X.top+(r=="window"?0:so());var Z=X.left+(r=="window"?0:oo());i.left+=Z,i.right+=Z}return i.top+=j,i.bottom+=j,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var T=e.display.sizer.getBoundingClientRect();r+=T.left,n+=T.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:n-j.top}}function ma(e,t,i,r,n){return r||(r=ct(e.doc,t.line)),Hn(e,r,to(e,r,t.ch,n),i)}function Qr(e,t,i,r,n,T){r=r||ct(e.doc,t.line),n||(n=Xi(e,r));function j(Fe,ze){var Qe=ai(e,n,Fe,ze?"right":"left",T);return ze?Qe.left=Qe.right:Qe.right=Qe.left,Hn(e,r,Qe,i)}var X=rt(r,e.doc.direction),Z=t.ch,q=t.sticky;if(Z>=r.text.length?(Z=r.text.length,q="before"):Z<=0&&(Z=0,q="after"),!X)return j(q=="before"?Z-1:Z,q=="before");function he(Fe,ze,Qe){var at=X[ze],ut=at.level==1;return j(Qe?Fe-1:Fe,ut!=Qe)}var ge=Ye(X,Z,q),De=Je,_e=he(Z,ge,q=="before");return De!=null&&(_e.other=he(Z,De,q!="before")),_e}function uo(e,t){var i=0;t=u(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=ct(e.doc,t.line),n=Zr(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var T=Ve(e,t,i);return T.xRel=n,r&&(T.outside=r),T}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=Wr(r,i),T=r.first+r.size-1;if(n>T)return ga(r.first+r.size-1,ct(r,T).text.length,null,1,1);t<0&&(t=0);for(var j=ct(r,n);;){var X=Gs(e,j,n,t,i),Z=ri(j,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Z)return X;var q=Z.find(1);if(q.line==n)return q;j=ct(r,n=q.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,T=tt(function(j){return ai(e,i,j-1).bottom<=r},n,0);return n=tt(function(j){return ai(e,i,j).top>r},T,n),{begin:T,end:n}}function co(e,t,i,r){i||(i=Xi(e,t));var n=Hn(e,t,ai(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-=Zr(t);var T=Xi(e,t),j=pa(t),X=0,Z=t.text.length,q=!0,he=rt(t,e.doc.direction);if(he){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,T,he,r,n);q=ge.level!=1,X=q?ge.from:ge.to-1,Z=q?ge.to:ge.from-1}var De=null,_e=null,Fe=tt(function(wt){var xt=ai(e,T,wt);return xt.top+=j,xt.bottom+=j,ya(xt,r,n,!1)?(xt.top<=n&&xt.left<=r&&(De=wt,_e=xt),!0):!1},X,Z),ze,Qe,at=!1;if(_e){var ut=r-_e.left<_e.right-r,ot=ut==q;Fe=De+(ot?0:1),Qe=ot?"after":"before",ze=ut?_e.left:_e.right}else{!q&&(Fe==Z||Fe==X)&&Fe++,Qe=Fe==0?"after":Fe==t.text.length?"before":ai(e,T,Fe-(q?1:0)).bottom+j<=n==q?"after":"before";var mt=Qr(e,Ve(i,Fe,Qe),"line",t,T);ze=mt.left,at=n<mt.top?-1:n>=mt.bottom?1:0}return Fe=Ie(t.text,Fe,1),ga(i,Fe,Qe,at,r-ze)}function zs(e,t,i,r,n,T,j){var X=tt(function(ge){var De=n[ge],_e=De.level!=1;return ya(Qr(e,Ve(i,_e?De.to:De.from,_e?"before":"after"),"line",t,r),T,j,!0)},0,n.length-1),Z=n[X];if(X>0){var q=Z.level!=1,he=Qr(e,Ve(i,q?Z.from:Z.to,q?"after":"before"),"line",t,r);ya(he,T,j,!0)&&he.top>j&&(Z=n[X-1])}return Z}function Ks(e,t,i,r,n,T,j){var X=ho(e,t,r,j),Z=X.begin,q=X.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var he=null,ge=null,De=0;De<n.length;De++){var _e=n[De];if(_e.from>=q||_e.to<=Z)continue;var Fe=_e.level!=1,ze=ai(e,r,Fe?Math.min(q,_e.to)-1:Math.max(Z,_e.from)).right,Qe=ze<T?T-ze+1e9:ze-T;(!he||ge>Qe)&&(he=_e,ge=Qe)}return he||(he=n[n.length-1]),he.from<Z&&(he={from:Z,to:he.to,level:he.level}),he.to>q&&(he={from:he.from,to:q,level:he.level}),he}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"))}h(e.measure,Ii);var i=Ii.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),p(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");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,T=t.gutters.firstChild,j=0;T;T=T.nextSibling,++j){var X=e.display.gutterSpecs[j].className;i[X]=T.offsetLeft+T.clientLeft+n,r[X]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(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(ii(e.doc,n))return 0;var T=0;if(n.widgets)for(var j=0;j<n.widgets.length;j++)n.widgets[j].height&&(T+=n.widgets[j].height);return i?T+(Math.ceil(n.text.length/r)||1)*t:T+t}}function xa(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Ni(e,t,i,r){var n=e.display;if(!i&&fe(t).getAttribute("cm-not-content")=="true")return null;var T,j,X=n.lineSpace.getBoundingClientRect();try{T=t.clientX-X.left,j=t.clientY-X.top}catch(ge){return null}var Z=va(e,T,j),q;if(r&&Z.xRel>0&&(q=ct(e.doc,Z.line).text).length==Z.ch){var he=Y(q,q.length,e.options.tabSize)-q.length;Z=Ve(Z.line,Math.max(0,Math.round((T-qa(e.display).left)/$i(e.display))-he))}return Z}function Ui(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 Or(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)cr&&cn(e.doc,t)<n.viewTo&&Ti(e);else if(i<=n.viewFrom)cr&&Si(e.doc,i+r)>n.viewFrom?Ti(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ti(e);else if(t<=n.viewFrom){var T=Gn(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):Ti(e)}else if(i>=n.viewTo){var j=Gn(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):Ti(e)}else{var X=Gn(e,t,t,-1),Z=Gn(e,i,i+r,1);X&&Z?(n.view=n.view.slice(0,X.index).concat(Rr(e,X.lineN,Z.lineN)).concat(n.view.slice(Z.index)),n.viewTo+=r):Ti(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function Ci(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 T=r.view[Ui(e,t)];if(T.node==null)return;var j=T.changes||(T.changes=[]);oe(j,i)==-1&&j.push(i)}function Ti(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=Ui(e,t),T,j=e.display.view;if(!cr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var X=e.display.viewFrom,Z=0;Z<n;Z++)X+=j[Z].size;if(X!=t){if(r>0){if(n==j.length-1)return null;T=X+j[n].size-t,n++}else T=X-t;t+=T,i+=T}for(;cn(e.doc,i)!=i;){if(n==(r<0?0:j.length-1))return null;i+=r*j[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Rr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Rr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Rr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(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(),T=r.selection=document.createDocumentFragment(),j=0;j<i.sel.ranges.length;j++){if(!t&&j==i.sel.primIndex)continue;var X=i.sel.ranges[j];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Z=X.empty();(Z||e.options.showCursorWhenSelecting)&&go(e,X.head,n),Z||Xs(e,X,T)}return r}function go(e,t,i){var r=Qr(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 T=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.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,T=document.createDocumentFragment(),j=qa(e.display),X=j.left,Z=Math.max(r.sizerWidth,Mi(e)-r.sizer.offsetLeft)-j.right,q=n.direction=="ltr";function he(ot,mt,wt,xt){mt<0&&(mt=0),mt=Math.round(mt),xt=Math.round(xt),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ot+`px;
top: `+mt+"px; width: "+(wt==null?Z-ot:wt)+`px;
height: `+(xt-mt)+"px"))}function ge(ot,mt,wt){var xt=ct(n,ot),Rt=xt.text.length,$t,gr;function rr(lr,Ir){return ma(e,Ve(ot,lr),"div",xt,Ir)}function jr(lr,Ir,Er){var hr=co(e,xt,null,lr),ur=Ir=="ltr"==(Er=="after")?"left":"right",nr=Er=="after"?hr.begin:hr.end-(/\s/.test(xt.text.charAt(hr.end-1))?2:1);return rr(nr,ur)[ur]}var Mr=rt(xt,n.direction);return Ze(Mr,mt||0,wt==null?Rt:wt,function(lr,Ir,Er,hr){var ur=Er=="ltr",nr=rr(lr,ur?"left":"right"),Nr=rr(Ir-1,ur?"right":"left"),un=mt==null&&lr==0,ki=wt==null&&Ir==Rt,_r=hr==0,oi=!Mr||hr==Mr.length-1;if(Nr.top-nr.top<=3){var vr=(q?un:ki)&&_r,Va=(q?ki:un)&&oi,ci=vr?X:(ur?nr:Nr).left,Hi=Va?Z:(ur?Nr:nr).right;he(ci,nr.top,Hi-ci,nr.bottom)}else{var Gi,Dr,dn,Xa;ur?(Gi=q&&un&&_r?X:nr.left,Dr=q?Z:jr(lr,Er,"before"),dn=q?X:jr(Ir,Er,"after"),Xa=q&&ki&&oi?Z:Nr.right):(Gi=q?jr(lr,Er,"before"):X,Dr=!q&&un&&_r?Z:nr.right,dn=!q&&ki&&oi?X:Nr.left,Xa=q?jr(Ir,Er,"after"):Z),he(Gi,nr.top,Dr-Gi,nr.bottom),nr.bottom<Nr.top&&he(X,nr.bottom,null,Nr.top),he(dn,Nr.top,Xa-dn,Nr.bottom)}(!$t||zn(nr,$t)<0)&&($t=nr),zn(Nr,$t)<0&&($t=Nr),(!gr||zn(nr,gr)<0)&&(gr=nr),zn(Nr,gr)<0&&(gr=Nr)}),{start:$t,end:gr}}var De=t.from(),_e=t.to();if(De.line==_e.line)ge(De.line,De.ch,_e.ch);else{var Fe=ct(n,De.line),ze=ct(n,_e.line),Qe=Ar(Fe)==Ar(ze),at=ge(De.line,De.ch,Qe?Fe.text.length+1:null).end,ut=ge(_e.line,Qe?0:null,_e.ch).start;Qe&&(at.top<ut.top-2?(he(at.right,at.top,null,at.bottom),he(X,ut.top,ut.left,ut.bottom)):he(at.right,at.top,ut.left-at.right,at.bottom)),at.bottom<ut.top&&he(X,at.bottom,null,ut.top)}i.appendChild(T)}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()||Ji(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(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ji(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),U&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Ji(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ue(e,"blur",e,t),e.state.focused=!1,c(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],T=e.options.lineWrapping,j=void 0,X=0;if(n.hidden)continue;if(z&&H<8){var Z=n.node.offsetTop+n.node.offsetHeight;j=Z-i,i=Z}else{var q=n.node.getBoundingClientRect();j=q.bottom-q.top,!T&&n.text.firstChild&&(X=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var he=n.line.height-j;if((he>.005||he<-.005)&&(xr(n.line,j),bo(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)bo(n.rest[ge]);if(X>e.display.sizerWidth){var De=Math.ceil(X/$i(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,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,T=Wr(t,r),j=Wr(t,n);if(i&&i.ensure){var X=i.ensure.from.line,Z=i.ensure.to.line;X<T?(T=X,j=Wr(t,Zr(ct(t,X))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=j&&(T=Wr(t,Zr(ct(t,Z))-e.wrapper.clientHeight),j=Z)}return{from:T,to:Math.max(j,T+1)}}function Ys(e,t){if(Ke(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&&!_){var T=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(n),e.display.lineSpace.removeChild(T)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var j=!1,X=Qr(e,t),Z=!i||i==t?X:Qr(e,i);n={left:Math.min(X.left,Z.left),top:Math.min(X.top,Z.top)-r,right:Math.max(X.left,Z.left),bottom:Math.max(X.bottom,Z.bottom)+r};var q=Ta(e,n),he=e.doc.scrollTop,ge=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(j=!0)),q.scrollLeft!=null&&(Bi(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(j=!0)),!j)break}return n}function Js(e,t){var i=Ta(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Bi(e,i.scrollLeft)}function Ta(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,T=ca(e),j={};t.bottom-t.top>T&&(t.bottom=t.top+T);var X=e.doc.height+ha(i),Z=t.top<r,q=t.bottom>X-r;if(t.top<n)j.scrollTop=Z?0:t.top;else if(t.bottom>n+T){var he=Math.min(t.top,(q?X:t.bottom)-T);he!=n&&(j.scrollTop=he)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,_e=Mi(e)-i.gutters.offsetWidth,Fe=t.right-t.left>_e;return Fe&&(t.right=t.left+_e),t.left<10?j.scrollLeft=0:t.left<De?j.scrollLeft=Math.max(0,t.left+ge-(Fe?0:10)):t.right>_e+De-3&&(j.scrollLeft=t.right+(Fe?0:10)-_e),j}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 Zi(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function En(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Zs(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);Eo(e,i,r,t.margin)}}function Eo(e,t,i,r){var n=Ta(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});En(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||Aa(e,{top:t}),xo(e,t,!0),k&&Aa(e),Tn(e,100)}function xo(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 Bi(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,_o(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+ha(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+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Fi=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),Me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Me(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fi.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 T=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"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}},Fi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fi.prototype.zeroWidthHack=function(){var e=s&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Fi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),T=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Fi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Cn=function(){};Cn.prototype.update=function(){return{bottom:0,right:0}},Cn.prototype.setScrollLeft=function(){},Cn.prototype.setScrollTop=function(){},Cn.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 Co={native:Fi,null:Cn};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Me(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"?Bi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&F(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},Xr(e.curOp)}function Wi(e){var t=e.curOp;t&&Rs(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 T=0;T<t.length;T++)il(t[T]);for(var j=0;j<t.length;j++)nl(t[j])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&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&&_a(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+ni(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&&Bi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==B();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&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&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Bi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,u(r,e.scrollToPos.from),u(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var T=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(T)for(var X=0;X<T.length;++X)T[X].lines.length||Ue(T[X],"hide");if(j)for(var Z=0;Z<j.length;++Z)j[Z].lines.length&&Ue(j[Z],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Fr(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Wi(e)}}function pr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Wi(e)}}}function Lr(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Wi(this)}}}function mr(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 Tn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=et(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var j=T.styles,X=T.text.length>e.options.maxHighlightLength?qt(t.mode,r.state):null,Z=ye(e,T,r,!0);X&&(r.state=X),T.styles=Z.styles;var q=T.styleClasses,he=Z.classes;he?T.styleClasses=he:q&&(T.styleClasses=null);for(var ge=!j||j.length!=T.styles.length||q!=he&&(!q||!he||q.bgClass!=he.bgClass||q.textClass!=he.textClass),De=0;!ge&&De<j.length;++De)ge=j[De]!=T.styles[De];ge&&n.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&yt(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Fr(e,function(){for(var T=0;T<n.length;T++)Ci(e,n[T],"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){ve(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ue.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=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=B();if(!t||!x(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==B())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(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 _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ti(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;Ao(e)&&(Ti(e),t.dims=ba(e));var n=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<T&&T-i.viewFrom<20&&(T=Math.max(r.first,i.viewFrom)),i.viewTo>j&&i.viewTo-j<20&&(j=Math.min(n,i.viewTo)),cr&&(T=cn(e.doc,T),j=Si(e.doc,j));var X=T!=i.viewFrom||j!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,j),i.viewOffset=Zr(ct(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Z=po(e);if(!X&&Z==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=sl(e);return Z>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Z>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(q),p(i.cursorDiv),p(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,X&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Tn(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+ha(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(!_a(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 Aa(e,t){var i=new Yn(e,t);if(_a(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,T=r.lineDiv,j=T.firstChild;function X(Fe){var ze=Fe.nextSibling;return U&&s&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),ze}for(var Z=r.view,q=r.viewFrom,he=0;he<Z.length;he++){var ge=Z[he];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=T){var De=Ns(e,ge,q,i);T.insertBefore(De,j)}else{for(;j!=ge.node;)j=X(j);var _e=n&&t!=null&&t<=q&&ge.lineNumber;ge.changes&&(oe(ge.changes,"gutter")>-1&&(_e=!1),Ya(e,ge,q,i)),_e&&(p(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fi(e.options,q)))),j=ge.node.nextSibling}q+=ge.size}for(;j;)j=X(j)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+ni(e)+"px"}function _o(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,T=r+"px",j=0;j<i.length;j++)if(!i[j].hidden){e.options.fixedGutter&&(i[j].gutter&&(i[j].gutter.style.left=T),i[j].gutterBackground&&(i[j].gutterBackground.style.left=T));var X=i[j].alignable;if(X)for(var Z=0;Z<X.length;Z++)X[Z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ao(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")),T=n.firstChild.offsetWidth,j=n.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function ka(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var T=e[n],j=null;if(typeof T!="string"&&(j=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:T,style:j})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Lo(e){var t=e.gutters,i=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],T=n.className,j=n.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+T));j&&(X.style.cssText=j),T=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function wn(e){Lo(e.display),Or(e),_o(e)}function dl(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=E("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=E("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var T=E("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[T],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+pe+"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"),z&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!U&&!(k&&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=ka(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var $n=0,Gr=null;z?Gr=-.53:k?Gr=15:m?Gr=-.7:D&&(Gr=-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 hl(e){var t=Do(e);return t.x*=Gr,t.y*=Gr,t}function ko(e,t){var i=Do(t),r=i.x,n=i.y,T=e.display,j=T.scroller,X=j.scrollWidth>j.clientWidth,Z=j.scrollHeight>j.clientHeight;if(!(r&&X||n&&Z))return;if(n&&s&&U){e:for(var q=t.target,he=T.view;q!=j;q=q.parentNode)for(var ge=0;ge<he.length;ge++)if(he[ge].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!k&&!S&&Gr!=null){n&&Z&&xn(e,Math.max(0,j.scrollTop+n*Gr)),Bi(e,Math.max(0,j.scrollLeft+r*Gr)),(!n||n&&Z)&&re(t),T.wheelStartX=null;return}if(n&&Gr!=null){var De=n*Gr,_e=e.doc.scrollTop,Fe=_e+T.wrapper.clientHeight;De<0?_e=Math.max(0,_e+De-50):Fe=Math.min(e.doc.height,Fe+De+50),Aa(e,{top:_e,bottom:Fe})}$n<20&&(T.wheelStartX==null?(T.wheelStartX=j.scrollLeft,T.wheelStartY=j.scrollTop,T.wheelDX=r,T.wheelDY=n,setTimeout(function(){if(T.wheelStartX==null)return;var ze=j.scrollLeft-T.wheelStartX,Qe=j.scrollTop-T.wheelStartY,at=Qe&&T.wheelDY&&Qe/T.wheelDY||ze&&T.wheelDX&&ze/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!at)return;Gr=(Gr*$n+at)/($n+1),++$n},200)):(T.wheelDX+=r,T.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.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},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Kt(mi(this.ranges[t].anchor),mi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(_t(t,r.from())>=0&&_t(e,r.to())<=0)return i}return-1};var Kt=function(e,t){this.anchor=e,this.head=t};Kt.prototype.from=function(){return vi(this.anchor,this.head)},Kt.prototype.to=function(){return gi(this.anchor,this.head)},Kt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,_e){return _t(De.from(),_e.from())}),i=oe(t,n);for(var T=1;T<t.length;T++){var j=t[T],X=t[T-1],Z=_t(X.to(),j.from());if(r&&!j.empty()?Z>0:Z>=0){var q=vi(X.from(),j.from()),he=gi(X.to(),j.to()),ge=X.empty()?j.from()==j.head:X.from()==X.head;T<=i&&--i,t.splice(--T,2,new Kt(ge?he:q,ge?q:he))}}return new zr(t,i)}function wi(e,t){return new zr([new Kt(e,t||e)],0)}function _i(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(_t(e,t.from)<0)return e;if(_t(e,t.to)<=0)return _i(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+=_i(t).ch-t.to.ch),Ve(i,r)}function Ra(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Kt(Ro(n.anchor,t),Ro(n.head,t)))}return qr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),T=n,j=0;j<t.length;j++){var X=t[j],Z=Oo(X.from,n,T),q=Oo(_i(X),n,T);if(n=X.to,T=q,i=="around"){var he=e.sel.ranges[j],ge=_t(he.head,he.anchor)<0;r[j]=new Kt(ge?q:Z,ge?Z:q)}else r[j]=new Kt(Z,Z)}return new zr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=Lt(e.options,e.doc.modeOption),_n(e)}function _n(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,Tn(e,100),e.state.modeGen++,e.curOp&&Or(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(ut){return i?i[ut]:null}function T(ut,ot,mt){ua(ut,ot,mt,r),br(ut,"change",ut,t)}function j(ut,ot){for(var mt=[],wt=ut;wt<ot;++wt)mt.push(new Pi(q[wt],n(wt),r));return mt}var X=t.from,Z=t.to,q=t.text,he=ct(e,X.line),ge=ct(e,Z.line),De=te(q),_e=n(q.length-1),Fe=Z.line-X.line;if(t.full)e.insert(0,j(0,q.length)),e.remove(q.length,e.size-q.length);else if(Po(e,t)){var ze=j(0,q.length-1);T(ge,ge.text,_e),Fe&&e.remove(X.line,Fe),ze.length&&e.insert(X.line,ze)}else if(he==ge)if(q.length==1)T(he,he.text.slice(0,X.ch)+De+he.text.slice(Z.ch),_e);else{var Qe=j(1,q.length-1);Qe.push(new Pi(De+he.text.slice(Z.ch),_e,r)),T(he,he.text.slice(0,X.ch)+q[0],n(0)),e.insert(X.line+1,Qe)}else if(q.length==1)T(he,he.text.slice(0,X.ch)+q[0]+ge.text.slice(Z.ch),n(0)),e.remove(X.line+1,Fe);else{T(he,he.text.slice(0,X.ch)+q[0],n(0)),T(ge,De+ge.text.slice(Z.ch),_e);var at=j(1,q.length-1);Fe>1&&e.remove(X.line+1,Fe-1),e.insert(X.line+1,at)}br(e,"change",e,t)}function Ai(e,t,i){function r(n,T,j){if(n.linked)for(var X=0;X<n.linked.length;++X){var Z=n.linked[X];if(Z.doc==T)continue;var q=j&&Z.sharedHist;if(i&&!q)continue;t(Z.doc,q),r(Z.doc,n,q)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Oa(e),Io(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Or(e)}function Io(e){(e.doc.direction=="rtl"?F:c)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Fr(e,function(){Io(e),Or(e)})}function Jn(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:_i(t),text:Kr(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Uo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,j,X;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(n,n.lastOp==r)))X=te(j.changes),_t(t.from,t.to)==0&&_t(t.from,X.to)==0?X.to=_i(t):j.changes.push(Ma(e,t));else{var Z=te(n.done);for((!Z||!Z.ranges)&&Zn(e.sel,n.done),j={changes:[Ma(e,t)],generation:n.generation},n.done.push(j);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=T,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,X||Ue(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,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,te(n.done),t))?n.done[n.done.length-1]=t:Zn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Zn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(e,t,i,r){var n=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((n||(n=t["spans_"+e.id]={}))[T]=j.markedSpans),++T})}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 Fo(e,t){var i=yl(e,t),r=Jr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var T=i[n],j=r[n];if(T&&j){e:for(var X=0;X<j.length;++X){for(var Z=j[X],q=0;q<T.length;++q)if(T[q].marker==Z.marker)continue e;T.push(Z)}}else j&&(i[n]=j)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var T=e[n];if(T.ranges){r.push(i?zr.prototype.deepCopy.call(T):T);continue}var j=T.changes,X=[];r.push({changes:X});for(var Z=0;Z<j.length;++Z){var q=j[Z],he=void 0;if(X.push({from:q.from,to:q.to,text:q.text}),t)for(var ge in q)(he=ge.match(/^spans_(\d+)$/))&&(oe(t,Number(he[1]))>-1&&(te(X)[ge]=q[ge],delete q[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var T=_t(t,n)<0;T!=_t(i,n)<0?(n=t,t=i):T!=_t(t,i)<0&&(t=i)}return new Kt(n,t)}else return new Kt(i||t,t)}function Qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new zr([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),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,n);var j=qr(e.cm,r,e.sel.primIndex);wr(e,j,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,wr(e,qr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){wr(e,wi(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var T=0;T<n.length;T++)this.ranges[T]=new Kt(u(e,n[T].anchor),u(e,n[T].head))},origin:i&&i.origin};return Ue(e,"beforeSelectionChange",e,r),e.cm&&Ue(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?qr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):wr(e,t,i)}function wr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(_t(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Zi(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),br(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,T=0;T<t.ranges.length;T++){var j=t.ranges[T],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],Z=ea(e,j.anchor,X&&X.anchor,i,r),q=ea(e,j.head,X&&X.head,i,r);(n||Z!=j.anchor||q!=j.head)&&(n||(n=t.ranges.slice(0,T)),n[T]=new Kt(Z,q))}return n?qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var T=ct(e,t.line);if(T.markedSpans)for(var j=0;j<T.markedSpans.length;++j){var X=T.markedSpans[j],Z=X.marker,q="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,he="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((X.from==null||(q?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(he?X.to>=t.ch:X.to>t.ch))){if(n&&(Ue(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(T.markedSpans){--j;continue}else break;if(!Z.atomic)continue;if(i){var ge=Z.find(r<0?1:-1),De=void 0;if((r<0?he:q)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?T:null)),ge&&ge.line==t.line&&(De=_t(ge,i))&&(r<0?De<0:De>0))return en(e,ge,t,r,n)}var _e=Z.find(r<0?-1:1);return(r<0?q:he)&&(_e=Vo(e,_e,r,_e.line==t.line?T:null)),_e?en(e,_e,t,r,n):null}}return t}function ea(e,t,i,r,n){var T=r||1,j=en(e,t,i,T,n)||!n&&en(e,t,i,T,!0)||en(e,t,i,-T,n)||!n&&en(e,t,i,-T,!0);return j||(e.cantEdit=!0,Ve(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?u(e,Ve(t.line-1)):null:i>0&&t.ch==(r||ct(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function Xo(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Se)}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,T,j,X){n&&(r.from=u(e,n)),T&&(r.to=u(e,T)),j&&(r.text=j),X!==void 0&&(r.origin=X)}),Ue(e,"beforeChange",e,r),e.cm&&Ue(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 pr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Ri&&!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]==""&&_t(t.from,t.to)==0)return;var i=Ra(e,t);Uo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Jr(e,t));var r=[];Ai(e,function(n,T){!T&&oe(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),An(n,t,null,Jr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,j=e.sel,X=t=="undo"?n.done:n.undone,Z=t=="undo"?n.undone:n.done,q=0;q<X.length&&!(T=X[q],i?T.ranges&&!T.equals(e.sel):!T.ranges);q++);if(q==X.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(T=X.pop(),T.ranges){if(Zn(T,Z),i&&!T.equals(e.sel)){wr(e,T,{clearRedo:!1});return}j=T}else if(r){X.push(T);return}else break;var he=[];Zn(j,Z),Z.push({changes:he,generation:n.generation}),n.generation=T.generation||++n.maxGeneration;for(var ge=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),De=function(ze){var Qe=T.changes[ze];if(Qe.origin=t,ge&&!Yo(e,Qe,!1))return X.length=0,{};he.push(Ma(e,Qe));var at=ze?Ra(e,Qe):te(X);An(e,Qe,at,Fo(e,Qe)),!ze&&e.cm&&e.cm.scrollIntoView({from:Qe.from,to:_i(Qe)});var ut=[];Ai(e,function(ot,mt){!mt&&oe(ut,ot.history)==-1&&(qo(ot.history,Qe),ut.push(ot.history)),An(ot,Qe,null,Fo(ot,Qe))})},_e=T.changes.length-1;_e>=0;--_e){var Fe=De(_e);if(Fe)return Fe.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(ce(e.sel.ranges,function(n){return new Kt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Or(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Ci(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return pr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Jo(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);Jo(e,n),t={from:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ve(T,ct(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Kr(e,t.from,t.to),i||(i=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),qn(e,i,Se),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,i){var r=e.doc,n=e.display,T=t.from,j=t.to,X=!1,Z=T.line;e.options.lineWrapping||(Z=Mt(Ar(ct(r,T.line))),r.iter(Z,j.line+1,function(_e){if(_e==n.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Z,T.line+t.text.length,function(_e){var Fe=pn(_e);Fe>n.maxLineLength&&(n.maxLine=_e,n.maxLineLength=Fe,n.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),$r(r,T.line),Tn(e,400);var q=t.text.length-(j.line-T.line)-1;t.full?Or(e):T.line==j.line&&t.text.length==1&&!Po(e.doc,t)?Ci(e,T.line,"text"):Or(e,T.line,j.line+1,q);var he=ve(e,"changes"),ge=ve(e,"change");if(ge||he){var De={from:T,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&br(e,"change",e,De),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var T;r||(r=i),_t(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function Zo(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 T=e[n],j=!0;if(T.ranges){T.copied||(T=e[n]=T.deepCopy(),T.copied=!0);for(var X=0;X<T.ranges.length;X++)Zo(T.ranges[X].anchor,t,i,r),Zo(T.ranges[X].head,t,i,r);continue}for(var Z=0;Z<T.changes.length;++Z){var q=T.changes[Z];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){j=!1;break}}j||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,T=t;return typeof t=="number"?T=ct(e,G(e,t)):n=Mt(t),n==null?null:(r(T,n)&&e.cm&&Ci(e.cm,n,i),T)}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,bt(n),br(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 kn(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}kn.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 T=Math.min(t,n-e),j=r.height;if(r.removeInner(e,T),this.height-=j-r.height,n==T&&(this.children.splice(i--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Dn))){var X=[];this.collapse(X),this.children=[new Dn(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],T=n.chunkSize();if(e<=T){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var j=n.lines.length%25+25,X=j;X<n.lines.length;){var Z=new Dn(n.lines.slice(X,X+=25));n.height-=Z.height,this.children.splice(++r,0,Z),Z.parent=this}n.lines=n.lines.slice(0,j),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new kn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new kn(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],T=n.chunkSize();if(e<T){var j=Math.min(t,T-e);if(n.iterN(e,j,i))return!0;if((t-=j)==0)break;e=0}else e-=T}}};var Rn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Rn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Mt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var T=vn(this);xr(i,Math.max(0,i.height-T)),e&&(Fr(e,function(){es(e,i,-T),Ci(e,r,"widget")}),br(e,"lineWidgetCleared",e,this,r))},Rn.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;ii(this.doc,r)||xr(r,r.height+n),i&&Fr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),br(i,"lineWidgetChanged",i,e,Mt(r))})},be(Rn);function es(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function xl(e,t,i,r){var n=new Rn(e,i,r),T=e.cm;return T&&n.noHScroll&&(T.display.alignWidgets=!0),Ln(e,t,"widget",function(j){var X=j.widgets||(j.widgets=[]);if(n.insertAt==null?X.push(n):X.splice(Math.min(X.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,T&&!ii(e,j)){var Z=Zr(j)<e.scrollTop;xr(j,j.height+vn(n)),Z&&wa(T,n.height),T.curOp.forceUpdate=!0}return!0}),T&&br(T,"lineWidgetAdded",T,n,typeof t=="number"?t:Mt(t)),n}var ts=0,Li=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),ve(this,"clear")){var i=this.find();i&&br(this,"clear",i.from,i.to)}for(var r=null,n=null,T=0;T<this.lines.length;++T){var j=this.lines[T],X=Br(j.markedSpans,this);e&&!this.collapsed?Ci(e,Mt(j),"text"):e&&(X.to!=null&&(n=Mt(j)),X.from!=null&&(r=Mt(j))),j.markedSpans=Oi(j.markedSpans,X),X.from==null&&this.collapsed&&!ii(this.doc,j)&&e&&xr(j,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var q=Ar(this.lines[Z]),he=pn(q);he>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Or(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&&br(e,"markerCleared",e,this,r,n),t&&Wi(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var T=this.lines[n],j=Br(T.markedSpans,this);if(j.from!=null&&(i=Ve(t?T:Mt(T),j.from),e==-1))return i;if(j.to!=null&&(r=Ve(t?T:Mt(T),j.to),e==1))return r}return i&&{from:i,to:r}},Li.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Fr(r,function(){var n=t.line,T=Mt(t.line),j=fa(r,T);if(j&&(no(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!ii(i.doc,n)&&i.height!=null){var X=i.height;i.height=null;var Z=vn(i)-X;Z&&xr(n,n.height+Z)}br(r,"markerChanged",r,e)})},Li.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Li.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Li);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 pr(e.cm,nn)(e,t,i,r,n);var T=new Li(e,n),j=_t(t,i);if(r&&I(r,T,!1),j>0||j==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=E("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(fr(e,t.line,t,i,T)||t.line!=i.line&&fr(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");si()}T.addToHistory&&Uo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var X=t.line,Z=e.cm,q;if(e.iter(X,i.line+1,function(ge){Z&&T.collapsed&&!Z.options.lineWrapping&&Ar(ge)==Z.display.maxLine&&(q=!0),T.collapsed&&X!=t.line&&xr(ge,0),yi(ge,new li(T,X==t.line?t.ch:null,X==i.line?i.ch:null)),++X}),T.collapsed&&e.iter(t.line,i.line+1,function(ge){ii(e,ge)&&xr(ge,0)}),T.clearOnEnter&&Me(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Hr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),Z){if(q&&(Z.curOp.updateMaxLine=!0),T.collapsed)Or(Z,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var he=t.line;he<=i.line;he++)Ci(Z,he,"text");T.atomic&&zo(Z.doc),br(Z,"markerAdded",Z,T)}return T}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();br(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},be(On);function Sl(e,t,i,r,n){r=I(r),r.shared=!1;var T=[nn(e,t,i,r,n)],j=T[0],X=r.widgetNode;return Ai(e,function(Z){X&&(r.widgetNode=X.cloneNode(!0)),T.push(nn(Z,u(Z,t),u(Z,i),r,n));for(var q=0;q<Z.linked.length;++q)if(Z.linked[q].isParent)return;j=te(T)}),new On(T,j)}function rs(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),T=e.clipPos(n.from),j=e.clipPos(n.to);if(_t(T,j)){var X=nn(e,T,j,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],T=[n.primary.doc];Ai(n.primary.doc,function(Z){return T.push(Z)});for(var j=0;j<n.markers.length;j++){var X=n.markers[j];oe(T,X.doc)==-1&&(X.parent=null,n.markers.splice(j--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Pr=function(e,t,i,r,n){if(!(this instanceof Pr))return new Pr(e,t,i,r,n);i==null&&(i=0),kn.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 T=Ve(i,0);this.sel=wi(T),this.history=new Jn(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:T,to:T,text:e}),wr(this,wi(T),Se)};Pr.prototype=Re(kn.prototype,{constructor:Pr,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=ti(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:mr(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,ct(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&En(this.cm,0,0),wr(this,wi(t),Se)}),replaceRange:function(e,t,i,r){t=u(this,t),i=i?u(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Kr(this,u(this,e),u(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(Yr(this,e))return ct(this,e)},getLineNumber:function(e){return Mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ct(this,e)),Ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return u(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:mr(function(e,t,i){Wo(this,u(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:mr(function(e,t,i){Wo(this,u(this,e),u(this,t||e),i)}),extendSelection:mr(function(e,t,i){Qn(this,u(this,e),t&&u(this,t),i)}),extendSelections:mr(function(e,t){jo(this,N(this,e),t)}),extendSelectionsBy:mr(function(e,t){var i=ce(this.sel.ranges,e);jo(this,N(this,i),t)}),setSelections:mr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Kt(u(this,e[n].anchor),u(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),wr(this,qr(this.cm,r,t),i)}),addSelection:mr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Kt(u(this,e),u(this,t||e))),wr(this,qr(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=Kr(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=Kr(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:mr(function(e,t,i){for(var r=[],n=this.sel,T=0;T<n.ranges.length;T++){var j=n.ranges[T];r[T]={from:j.from(),to:j.to(),text:this.splitLines(e[T]),origin:i}}for(var X=t&&t!="end"&&cl(this,r,t),Z=r.length-1;Z>=0;Z--)tn(this,r[Z]);X?Ho(this,X):this.cm&&Zi(this.cm)}),undo:mr(function(){ta(this,"undo")}),redo:mr(function(){ta(this,"redo")}),undoSelection:mr(function(){ta(this,"undo",!0)}),redoSelection:mr(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 Jn(this.history.maxGeneration),Ai(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 Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:mr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&je(n)&&(r.gutterMarkers=null),!0})}),clearGutter:mr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,je(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Yr(this,e))return null;if(t=e,e=ct(this,e),!e)return null}else if(t=Mt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:mr(function(e,t,i){return Ln(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:mr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[n];if(T)if(i==null)r[n]=null;else{var j=T.match(b(i));if(!j)return!1;var X=j.index+j[0].length;r[n]=T.slice(0,j.index)+(!j.index||X==T.length?"":" ")+T.slice(X)||null}else return!1;return!0})}),addLineWidget:mr(function(e,t,i){return xl(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,u(this,e),u(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=u(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=u(this,e);var t=[],i=ct(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=u(this,e),t=u(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var j=T.markedSpans;if(j)for(var X=0;X<j.length;X++){var Z=j[X];!(Z.to!=null&&n==e.line&&e.ch>=Z.to||Z.from==null&&n!=e.line||Z.from!=null&&n==t.line&&Z.from>=t.ch)&&(!i||i(Z.marker))&&r.push(Z.marker.parent||Z.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 T=n.text.length+r;if(T>e)return t=e,!0;e-=T,++i}),u(this,Ve(i,t))},indexFromPos:function(e){e=u(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 Pr(ti(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 Pr(ti(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}],Cl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof tr&&(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),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(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:mr(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)})}),Pr.prototype.eachLine=Pr.prototype.iter;var is=0;function _l(e){var t=this;if(ns(t),Ke(t,e)||di(t.display,e))return;re(e),z&&(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,T=Array(n),j=0,X=function(){++j==n&&pr(t,function(){i=u(t.doc,i);var _e={from:i,to:i,text:t.doc.splitLines(T.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,_e),Ho(t.doc,wi(u(t.doc,i),u(t.doc,_i(_e))))})()},Z=function(_e,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,_e.type)==-1){X();return}var ze=new FileReader;ze.onerror=function(){return X()},ze.onload=function(){var Qe=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Qe)){X();return}T[Fe]=Qe,X()},ze.readAsText(_e)},q=0;q<r.length;q++)Z(r[q],q);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 he=e.dataTransfer.getData("Text");if(he){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,wi(i,i)),ge)for(var De=0;De<ge.length;++De)rn(t.doc,"",ge[De].anchor,ge[De].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(_e){}}}function Al(e,t){if(z&&(!e.state.draggingText||+new Date-is<100)){ue(t);return}if(Ke(e,t)||di(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!D){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),S&&i.parentNode.removeChild(i)}}function Ll(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)),h(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var T=0;T<i.length;T++)e(i[T])})}var os=!1;function Dl(){if(os)return;kl(),os=!0}function kl(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Me(window,"blur",function(){return as(Ji)})}function Rl(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=s?hi.macDefault:hi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,T,j=0;j<t.length-1;j++){var X=t[j];if(/^(cmd|meta|m)$/i.test(X))T=!0;else if(/^a(lt)?$/i.test(X))i=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))n=!0;else throw new Error("Unrecognized modifier name: "+X)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(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=ce(i.split(" "),Ol),T=0;T<n.length;T++){var j=void 0,X=void 0;T==n.length-1?(X=n.join(" "),j=r):(X=n.slice(0,T+1).join(" "),j="...");var Z=t[X];if(!Z)t[X]=j;else if(Z!=j)throw new Error("Inconsistent bindings for "+X)}delete e[i]}for(var q in t)e[q]=t[q];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 T=0;T<t.fallthrough.length;T++){var j=an(e,t.fallthrough[T],i,r);if(j)return j}}}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),(v?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(S&&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 T=t(i[n]);r.length&&_t(T.from,te(r).to)<=0;){var j=r.pop();if(_t(j.from,T.from)<0){T.from=j.from;break}}r.push(T)}Fr(e,function(){for(var X=r.length-1;X>=0;X--)rn(e.doc,"",r[X].from,r[X].to,"+delete");Zi(e)})}function Ua(e,t,i){var r=Ie(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ba(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function Fa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=rt(i,t.doc.direction);if(T){var j=n<0?te(T):T[0],X=n<0==(j.level==1),Z=X?"after":"before",q;if(j.level>0||t.doc.direction=="rtl"){var he=Xi(t,i);q=n<0?i.text.length-1:0;var ge=ai(t,he,q).top;q=tt(function(De){return ai(t,he,De).top==ge},n<0==(j.level==1)?j.from:j.to-1,q),Z=="before"&&(q=Ua(i,q,1))}else q=n<0?j.to:j.from;return new Ve(r,q,Z)}}return new Ve(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=rt(t,e.doc.direction);if(!n)return Ba(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 T=Ye(n,i.ch,i.sticky),j=n[T];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>i.ch:j.from<i.ch))return Ba(t,i,r);var X=function(at,ut){return Ua(t,at instanceof Ve?at.ch:at,ut)},Z,q=function(at){return e.options.lineWrapping?(Z=Z||Xi(e,t),co(e,t,Z,at)):{begin:0,end:t.text.length}},he=q(i.sticky=="before"?X(i,-1):i.ch);if(e.doc.direction=="rtl"||j.level==1){var ge=j.level==1==r<0,De=X(i,ge?1:-1);if(De!=null&&(ge?De<=j.to&&De<=he.end:De>=j.from&&De>=he.begin)){var _e=ge?"before":"after";return new Ve(i.line,De,_e)}}var Fe=function(at,ut,ot){for(var mt=function($t,gr){return gr?new Ve(i.line,X($t,1),"before"):new Ve(i.line,$t,"after")};at>=0&&at<n.length;at+=ut){var wt=n[at],xt=ut>0==(wt.level!=1),Rt=xt?ot.begin:X(ot.end,-1);if(wt.from<=Rt&&Rt<wt.to)return mt(Rt,xt);if(Rt=xt?wt.from:X(wt.to,-1),ot.begin<=Rt&&Rt<ot.end)return mt(Rt,xt)}},ze=Fe(T+r,r,he);if(ze)return ze;var Qe=r>0?he.end:X(he.begin,-1);return Qe!=null&&!(r>0&&Qe==t.text.length)&&(ze=Fe(r>0?0:n.length-1,r,q(Qe)),ze)?ze:null}var In={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=ct(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:u(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?hs(e,t.head):r},Te)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var T=i[n].from(),j=Y(e.getLine(T.line),T.ch,r);t.push(se(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Fr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,T=ct(e.doc,n.line).text;if(T){if(n.ch==T.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=ct(e.doc,n.line-1).text;j&&(n=new Ve(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ve(n.line-1,j.length-1),n,"+transpose"))}}i.push(new Kt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Fr(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);Zi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=ct(e.doc,t),r=Ar(i);return r!=i&&(t=Mt(r)),Fa(!0,e,r,t,1)}function Il(e,t){var i=ct(e.doc,t),r=Vi(i);return r!=i&&(t=Mt(r)),Fa(!0,e,i,t,-1)}function hs(e,t){var i=ds(e,t.line),r=ct(e.doc,i.line),n=rt(r,e.doc.direction);if(!n||n[0].level==0){var T=Math.max(i.ch,r.text.search(/\S/)),j=t.line==i.line&&t.ch<=T&&t.ch;return Ve(i.line,j?0:T,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 Ul=new ee;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:Ul.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"&&br(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(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 Bl(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=B(),Ke(t,e))return;z&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);S&&(ja=r?i:null,!r&&i==88&&!Dt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!s&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),lt(document,"keyup",i),lt(document,"mouseover",i))}Me(document,"keyup",i),Me(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(di(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(S&&i==ja){ja=null,re(e);return}if(S&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Bl(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&&_t(t,this.pos)==0&&i==this.button};var Un,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Un=Bn=null,"triple"):Un&&Un.compare(i,e,t)?(Bn=new Wa(i,e,t),Un=null,"double"):(Un=new Wa(i,e,t),Bn=null,"single")}function vs(e){var t=this,i=t.display;if(Ke(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,di(i,e)){U||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Ni(t,e),n=Le(e),T=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,T,e))return;n==1?r?zl(t,r,T,e):fe(e)==i.scroller&&re(e):n==2?(r&&Qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Nn(e,ls(T,n),n,function(j){if(typeof j=="string"&&(j=In[j]),!j)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=j(e,i)!=Oe}finally{e.state.suppressEdits=!1}return X})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var T=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=T?"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=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){z?setTimeout(P(vo,e),0):e.curOp.focus=B();var n=Gl(e,i,r),T=e.doc.sel,j;e.options.dragDrop&&Ne&&!e.isReadOnly()&&i=="single"&&(j=T.contains(t))>-1&&(_t((j=T.ranges[j]).from(),t)<0||t.xRel>0)&&(_t(j.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,T=!1,j=pr(e,function(q){U&&(n.scroller.draggable=!1),e.state.draggingText=!1,lt(n.wrapper.ownerDocument,"mouseup",j),lt(n.wrapper.ownerDocument,"mousemove",X),lt(n.scroller,"dragstart",Z),lt(n.scroller,"drop",j),T||(re(q),r.addNew||Qn(e.doc,i,null,null,r.extend),U&&!D||z&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),X=function(q){T=T||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Z=function(){return T=!0};U&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Me(n.wrapper.ownerDocument,"mouseup",j),Me(n.wrapper.ownerDocument,"mousemove",X),Me(n.scroller,"dragstart",Z),Me(n.scroller,"drop",j),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Kt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Kt(Ve(t.line,0),u(e.doc,Ve(t.line+1,0)));var r=i(e,t);return new Kt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;re(t);var j,X,Z=T.sel,q=Z.ranges;if(r.addNew&&!r.extend?(X=T.sel.contains(i),X>-1?j=q[X]:j=new Kt(i,i)):(j=T.sel.primary(),X=T.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new Kt(i,i)),i=Ni(e,t,!0,!0),X=-1;else{var he=ys(e,i,r.unit);r.extend?j=Ia(j,he.anchor,he.head,r.extend):j=he}r.addNew?X==-1?(X=q.length,wr(T,qr(e,q.concat([j]),X),{scroll:!1,origin:"*mouse"})):q.length>1&&q[X].empty()&&r.unit=="char"&&!r.extend?(wr(T,qr(e,q.slice(0,X).concat(q.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Z=T.sel):Na(T,X,j,we):(X=0,wr(T,new zr([j],0),we),Z=T.sel);var ge=i;function De(ot){if(_t(ge,ot)==0)return;if(ge=ot,r.unit=="rectangle"){for(var mt=[],wt=e.options.tabSize,xt=Y(ct(T,i.line).text,i.ch,wt),Rt=Y(ct(T,ot.line).text,ot.ch,wt),$t=Math.min(xt,Rt),gr=Math.max(xt,Rt),rr=Math.min(i.line,ot.line),jr=Math.min(e.lastLine(),Math.max(i.line,ot.line));rr<=jr;rr++){var Mr=ct(T,rr).text,lr=Ce(Mr,$t,wt);$t==gr?mt.push(new Kt(Ve(rr,lr),Ve(rr,lr))):Mr.length>lr&&mt.push(new Kt(Ve(rr,lr),Ve(rr,Ce(Mr,gr,wt))))}mt.length||mt.push(new Kt(i,i)),wr(T,qr(e,Z.ranges.slice(0,X).concat(mt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ot)}else{var Ir=j,Er=ys(e,ot,r.unit),hr=Ir.anchor,ur;_t(Er.anchor,hr)>0?(ur=Er.head,hr=vi(Ir.from(),Er.anchor)):(ur=Er.anchor,hr=gi(Ir.to(),Er.head));var nr=Z.ranges.slice(0);nr[X]=Xl(e,new Kt(u(T,hr),ur)),wr(T,qr(e,nr,X),we)}}var _e=n.wrapper.getBoundingClientRect(),Fe=0;function ze(ot){var mt=++Fe,wt=Ni(e,ot,!0,r.unit=="rectangle");if(!wt)return;if(_t(wt,ge)!=0){e.curOp.focus=B(),De(wt);var xt=Vn(n,T);(wt.line>=xt.to||wt.line<xt.from)&&setTimeout(pr(e,function(){Fe==mt&&ze(ot)}),150)}else{var Rt=ot.clientY<_e.top?-20:ot.clientY>_e.bottom?20:0;Rt&&setTimeout(pr(e,function(){if(Fe!=mt)return;n.scroller.scrollTop+=Rt,ze(ot)}),50)}}function Qe(ot){e.state.selectingText=!1,Fe=Infinity,ot&&(re(ot),n.input.focus()),lt(n.wrapper.ownerDocument,"mousemove",at),lt(n.wrapper.ownerDocument,"mouseup",ut),T.history.lastSelOrigin=null}var at=pr(e,function(ot){ot.buttons===0||!Le(ot)?Qe(ot):ze(ot)}),ut=pr(e,Qe);e.state.selectingText=ut,Me(n.wrapper.ownerDocument,"mousemove",at),Me(n.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var i=t.anchor,r=t.head,n=ct(e.doc,i.line);if(_t(i,r)==0&&i.sticky==r.sticky)return t;var T=rt(n);if(!T)return t;var j=Ye(T,i.ch,i.sticky),X=T[j];if(X.from!=i.ch&&X.to!=i.ch)return t;var Z=j+(X.from==i.ch==(X.level!=1)?0:1);if(Z==0||Z==T.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=Ye(T,r.ch,r.sticky),ge=he-j||(r.ch-i.ch)*(X.level==1?-1:1);he==Z-1||he==Z?q=ge<0:q=ge>0}var De=T[Z+(q?-1:0)],_e=q==(De.level==1),Fe=_e?De.from:De.to,ze=_e?"after":"before";return i.ch==Fe&&i.sticky==ze?t:new Kt(new Ve(i.line,Fe,ze),r)}function bs(e,t,i,r){var n,T;if(t.touches)n=t.touches[0].clientX,T=t.touches[0].clientY;else try{n=t.clientX,T=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var j=e.display,X=j.lineDiv.getBoundingClientRect();if(T>X.bottom||!ve(e,i))return de(t);T-=X.top-j.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=j.gutters.childNodes[Z];if(q&&q.getBoundingClientRect().right>=n){var he=Wr(e.doc,T),ge=e.display.gutterSpecs[Z];return Ue(e,i,e,he,ge.className,t),de(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(di(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,T,j){e.defaults[r]=n,T&&(t[r]=j?function(X,Z,q){q!=sn&&T(X,Z,q)}:T)}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){_n(r),yn(r),Or(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var T=[],j=r.doc.first;r.doc.iter(function(Z){for(var q=0;;){var he=Z.text.indexOf(n,q);if(he==-1)break;q=he+n.length,T.push(Ve(j,he))}j++});for(var X=T.length-1;X>=0;X--)rn(r.doc,n,T[X],Ve(T[X].line,T[X].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,T){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),T!=sn&&r.refresh()}),i("specialCharPlaceholder",Yt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){xs(r),wn(r)},!0),i("keyMap","default",function(r,n,T){var j=ia(n),X=T!=sn&&ia(T);X&&X.detach&&X.detach(r,j),j.attach&&j.attach(r,X||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Zl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=ka(n,r.options.lineNumbers),wn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){To(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=ka(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"&&(Ji(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,Jl),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,_n,!0),i("addModeClass",!1,_n,!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,_n,!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 Jl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,T=t?Me:lt;T(e.display.scroller,"dragstart",n.start),T(e.display.scroller,"dragenter",n.enter),T(e.display.scroller,"dragover",n.over),T(e.display.scroller,"dragleave",n.leave),T(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),jn(e)),xa(e),Or(e),yn(e),setTimeout(function(){return Qi(e)},100)}function tr(e,t){var i=this;if(!(this instanceof tr))return new tr(e,t);this.options=t=t?I(t):{},I(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Pr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new tr.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,n,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),z&&H<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&&Ca(i)},20):Ji(this);for(var j in aa)aa.hasOwnProperty(j)&&aa[j](this,t[j],sn);Ao(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ga.length;++X)Ga[X](this);Wi(this),U&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}tr.defaults=Ss,tr.optionHandlers=aa;function Ql(e){var t=e.display;Me(t.scroller,"mousedown",pr(e,vs)),z&&H<11?Me(t.scroller,"dblclick",pr(e,function(Z){if(Ke(e,Z))return;var q=Ni(e,Z);if(!q||Ha(e,Z)||di(e.display,Z))return;re(Z);var he=e.findWordAt(q);Qn(e.doc,he.anchor,he.head)})):Me(t.scroller,"dblclick",function(Z){return Ke(e,Z)||re(Z)}),Me(t.scroller,"contextmenu",function(Z){return Es(e,Z)}),Me(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||Es(e,Z)});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 T(Z){if(Z.touches.length!=1)return!1;var q=Z.touches[0];return q.radiusX<=1&&q.radiusY<=1}function j(Z,q){if(q.left==null)return!0;var he=q.left-Z.left,ge=q.top-Z.top;return he*he+ge*ge>20*20}Me(t.scroller,"touchstart",function(Z){if(!Ke(e,Z)&&!T(Z)&&!Ha(e,Z)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(Z){var q=t.activeTouch;if(q&&!di(t,Z)&&q.left!=null&&!q.moved&&new Date-q.start<300){var he=e.coordsChar(t.activeTouch,"page"),ge;!q.prev||j(q,q.prev)?ge=new Kt(he,he):!q.prev.prev||j(q,q.prev.prev)?ge=e.findWordAt(he):ge=new Kt(Ve(he.line,0),u(e.doc,Ve(he.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(Z)}n()}),Me(t.scroller,"touchcancel",n),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Bi(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(Z){return ko(e,Z)}),Me(t.scroller,"DOMMouseScroll",function(Z){return ko(e,Z)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ke(e,Z)||ue(Z)},over:function(Z){Ke(e,Z)||(Ll(e,Z),ue(Z))},start:function(Z){return Al(e,Z)},drop:pr(e,_l),leave:function(Z){Ke(e,Z)||ns(e)}};var X=t.input.getField();Me(X,"keyup",function(Z){return ms.call(e,Z)}),Me(X,"keydown",pr(e,ps)),Me(X,"keypress",pr(e,gs)),Me(X,"focus",function(Z){return Ca(e,Z)}),Me(X,"blur",function(Z){return Ji(e,Z)})}var Ga=[];tr.defineInitHook=function(e){return Ga.push(e)};function Fn(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=et(e,t).state:i="prev");var j=e.options.tabSize,X=ct(n,t),Z=Y(X.text,null,j);X.stateAfter&&(X.stateAfter=null);var q=X.text.match(/^\s*/)[0],he;if(!r&&!/\S/.test(X.text))he=0,i="not";else if(i=="smart"&&(he=n.mode.indent(T,X.text.slice(q.length),X.text),he==Oe||he>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?he=Y(ct(n,t-1).text,null,j):he=0:i=="add"?he=Z+e.options.indentUnit:i=="subtract"?he=Z-e.options.indentUnit:typeof i=="number"&&(he=Z+i),he=Math.max(0,he);var ge="",De=0;if(e.options.indentWithTabs)for(var _e=Math.floor(he/j);_e;--_e)De+=j,ge+=" ";if(De<he&&(ge+=se(he-De)),ge!=q)return rn(n,ge,Ve(t,0),Ve(t,q.length),"+input"),X.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var ze=n.sel.ranges[Fe];if(ze.head.line==t&&ze.head.ch<q.length){var Qe=Ve(t,q.length);Na(n,Fe,new Kt(Qe,Qe));break}}}var ei=null;function oa(e){ei=e}function za(e,t,i,r,n){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var j=+new Date-200,X=n=="paste"||e.state.pasteIncoming>j,Z=st(t),q=null;if(X&&r.ranges.length>1)if(ei&&ei.text.join(`
`)==t){if(r.ranges.length%ei.text.length==0){q=[];for(var he=0;he<ei.text.length;he++)q.push(T.splitLines(ei.text[he]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=ce(Z,function(at){return[at]}));for(var ge=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var _e=r.ranges[De],Fe=_e.from(),ze=_e.to();_e.empty()&&(i&&i>0?Fe=Ve(Fe.line,Fe.ch-i):e.state.overwrite&&!X?ze=Ve(ze.line,Math.min(ct(T,ze.line).text.length,ze.ch+te(Z).length)):X&&ei&&ei.lineWise&&ei.text.join(`
`)==Z.join(`
`)&&(Fe=ze=Ve(Fe.line,0)));var Qe={from:Fe,to:ze,text:q?q[De%q.length]:Z,origin:n||(X?"paste":e.state.cutIncoming>j?"cut":"+input")};tn(e.doc,Qe),br(e,"inputRead",e,Qe)}t&&!X&&Ts(e,t),Zi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Fr(t,function(){return za(t,i,0,null,"paste")}),!0}function Ts(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 T=e.getModeAt(n.head),j=!1;if(T.electricChars){for(var X=0;X<T.electricChars.length;X++)if(t.indexOf(T.electricChars.charAt(X))>-1){j=Fn(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(ct(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=Fn(e,n.head.line,"smart")));j&&br(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,T={anchor:Ve(n,0),head:Ve(n+1,0)};i.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:i}}function _s(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){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 U?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),_s(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 T=this.options,j=T[r];if(T[r]==n&&r!="mode")return;T[r]=n,t.hasOwnProperty(r)&&pr(this,t[r])(this,n,j),Ue(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,T=0;T<n.length;++T)if(n[T]==r||n[T].name==r)return n.splice(T,1),!0},addOverlay:Lr(function(r,n){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:T,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,Or(this)}),removeOverlay:Lr(function(r){for(var n=this.state.overlays,T=0;T<n.length;++T){var j=n[T].modeSpec;if(j==r||typeof r=="string"&&j.name==r){n.splice(T,1),this.state.modeGen++,Or(this);return}}}),indentLine:Lr(function(r,n,T){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Yr(this.doc,r)&&Fn(this,r,n,T)}),indentSelection:Lr(function(r){for(var n=this.doc.sel.ranges,T=-1,j=0;j<n.length;j++){var X=n[j];if(X.empty())X.head.line>T&&(Fn(this,X.head.line,r,!0),T=X.head.line,j==this.doc.sel.primIndex&&Zi(this));else{var Z=X.from(),q=X.to(),he=Math.max(T,Z.line);T=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ge=he;ge<T;++ge)Fn(this,ge,r);var De=this.doc.sel.ranges;Z.ch==0&&n.length==De.length&&De[j].from().ch>0&&Na(this.doc,j,new Kt(Z,De[j].to()),Se)}}}),getTokenAt:function(r,n){return Jt(this,r,n)},getLineTokens:function(r,n){return Jt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=u(this.doc,r);var n=He(this,ct(this.doc,r.line)),T=0,j=(n.length-1)/2,X=r.ch,Z;if(X==0)Z=n[2];else for(;;){var q=T+j>>1;if((q?n[q*2-1]:0)>=X)j=q;else if(n[q*2+1]<X)T=q+1;else{Z=n[q*2+2];break}}var he=Z?Z.indexOf("overlay "):-1;return he<0?Z:he==0?null:Z.slice(0,he-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 T=[];if(!i.hasOwnProperty(n))return T;var j=i[n],X=this.getModeAt(r);if(typeof X[n]=="string")j[X[n]]&&T.push(j[X[n]]);else if(X[n])for(var Z=0;Z<X[n].length;Z++){var q=j[X[n][Z]];q&&T.push(q)}else X.helperType&&j[X.helperType]?T.push(j[X.helperType]):j[X.name]&&T.push(j[X.name]);for(var he=0;he<j._global.length;he++){var ge=j._global[he];ge.pred(X,this)&&oe(T,ge.val)==-1&&T.push(ge.val)}return T},getStateAfter:function(r,n){var T=this.doc;return r=G(T,r==null?T.first+T.size-1:r),et(this,r+1,n).state},cursorCoords:function(r,n){var T,j=this.doc.sel.primary();return r==null?T=j.head:typeof r=="object"?T=u(this.doc,r):T=r?j.from():j.to(),Qr(this,T,n||"page")},charCoords:function(r,n){return ma(this,u(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,Wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,T){var j=!1,X;if(typeof r=="number"){var Z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Z&&(r=Z,j=!0),X=ct(this.doc,r)}else X=r;return Hn(this,X,{top:0,left:0},n||"page",T||j).top+(j?this.doc.height-Zr(X):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,T,j,X){var Z=this.display;r=Qr(this,u(this.doc,r));var q=r.bottom,he=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Z.sizer.appendChild(n),j=="over")q=r.top;else if(j=="above"||j=="near"){var ge=Math.max(Z.wrapper.clientHeight,this.doc.height),De=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(j=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(q=r.bottom),he+n.offsetWidth>De&&(he=De-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",X=="right"?(he=Z.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(X=="left"?he=0:X=="middle"&&(he=(Z.sizer.clientWidth-n.offsetWidth)/2),n.style.left=he+"px"),T&&Js(this,{left:he,top:q,right:he+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:Lr(ps),triggerOnKeyPress:Lr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Lr(vs),execCommand:function(r){if(In.hasOwnProperty(r))return In[r].call(null,this)},triggerElectric:Lr(function(r){Ts(this,r)}),findPosH:function(r,n,T,j){var X=1;n<0&&(X=-1,n=-n);for(var Z=u(this.doc,r),q=0;q<n&&!(Z=Ka(this.doc,Z,X,T,j),Z.hitSide);++q);return Z},moveH:Lr(function(r,n){var T=this;this.extendSelectionsBy(function(j){return T.display.shift||T.doc.extend||j.empty()?Ka(T.doc,j.head,r,n,T.options.rtlMoveVisually):r<0?j.from():j.to()},Te)}),deleteH:Lr(function(r,n){var T=this.doc.sel,j=this.doc;T.somethingSelected()?j.replaceSelection("",null,"+delete"):on(this,function(X){var Z=Ka(j,X.head,r,n,!1);return r<0?{from:Z,to:X.head}:{from:X.head,to:Z}})}),findPosV:function(r,n,T,j){var X=1,Z=j;n<0&&(X=-1,n=-n);for(var q=u(this.doc,r),he=0;he<n;++he){var ge=Qr(this,q,"div");if(Z==null?Z=ge.left:ge.left=Z,q=Ls(this,ge,X,T),q.hitSide)break}return q},moveV:Lr(function(r,n){var T=this,j=this.doc,X=[],Z=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(he){if(Z)return r<0?he.from():he.to();var ge=Qr(T,he.head,"div");he.goalColumn!=null&&(ge.left=he.goalColumn),X.push(ge.left);var De=Ls(T,ge,r,n);return n=="page"&&he==j.sel.primary()&&wa(T,ma(T,De,"div").top-ge.top),De},Te),X.length)for(var q=0;q<j.sel.ranges.length;q++)j.sel.ranges[q].goalColumn=X[q]}),findWordAt:function(r){var n=this.doc,T=ct(n,r.line).text,j=r.ch,X=r.ch;if(T){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||X==T.length)&&j?--j:++X;for(var q=T.charAt(j),he=Pe(q,Z)?function(ge){return Pe(ge,Z)}:/\s/.test(q)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Pe(ge)};j>0&&he(T.charAt(j-1));)--j;for(;X<T.length&&he(T.charAt(X));)++X}return new Kt(Ve(r.line,j),Ve(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==B()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Lr(function(r,n){En(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Mi(this)}},scrollIntoView:Lr(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:Ve(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?Zs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Lr(function(r,n){var T=this,j=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};r!=null&&(this.display.wrapper.style.width=j(r)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&ao(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Z){if(Z.widgets){for(var q=0;q<Z.widgets.length;q++)if(Z.widgets[q].noHScroll){Ci(T,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Ue(this,"refresh",this)}),operation:function(r){return Fr(this,r)},startOperation:function(){return ji(this)},endOperation:function(){return Wi(this)},refresh:Lr(function(){var r=this.display.cachedTextHeight;Or(this),this.curOp.forceUpdate=!0,yn(this),En(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&xa(this),Ue(this,"refresh",this)}),swapDoc:Lr(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(),En(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,br(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}},be(e),e.registerHelper=function(r,n,T){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=T},e.registerGlobalHelper=function(r,n,T,j){e.registerHelper(r,n,j),i[r]._global.push({pred:T,val:j})}}function Ka(e,t,i,r,n){var T=t,j=i,X=ct(e,t.line),Z=n&&e.direction=="rtl"?-i:i;function q(){var ut=t.line+Z;return ut<e.first||ut>=e.first+e.size?!1:(t=new Ve(ut,t.ch,t.sticky),X=ct(e,ut))}function he(ut){var ot;if(r=="codepoint"){var mt=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?ot=null:ot=new Ve(t.line,Math.max(0,Math.min(X.text.length,t.ch+i*(mt>=55296&&mt<56320?2:1))),-i)}else n?ot=Ml(e.cm,X,t,i):ot=Ba(X,t,i);if(ot==null)if(!ut&&q())t=Fa(n,e.cm,X,t.line,Z);else return!1;else t=ot;return!0}if(r=="char"||r=="codepoint")he();else if(r=="column")he(!0);else if(r=="word"||r=="group")for(var ge=null,De=r=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!he(!Fe));Fe=!1){var ze=X.text.charAt(t.ch)||`
`,Qe=Pe(ze,_e)?"w":De&&ze==`
`?"n":!De||/\s/.test(ze)?null:"p";if(De&&!Fe&&!Qe&&(Qe="s"),ge&&ge!=Qe){i<0&&(i=1,he(),t.sticky="after");break}if(Qe&&(ge=Qe),i>0&&!he(!Fe))break}var at=ea(e,t,T,j,!0);return pi(T,at)&&(at.hitSide=!0),at}function Ls(e,t,i,r){var n=e.doc,T=t.left,j;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(X-.5*Yi(e.display),3);j=(i>0?t.bottom:t.top)+i*Z}else r=="line"&&(j=i>0?t.bottom+3:t.top-3);for(var q;!(q=va(e,T,j),!q.outside);){if(i<0?j<=0:j>=n.height){q.hitSide=!0;break}j+=i*5}return q}var Xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Xt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;_s(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(X){for(var Z=X.target;Z;Z=Z.parentNode){if(Z==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}Me(n,"paste",function(X){if(!T(X)||Ke(r,X)||Cs(X,r))return;H<=11&&setTimeout(pr(r,function(){return t.updateFromDOM()}),20)}),Me(n,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Me(n,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Me(n,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(n,"touchstart",function(){return i.forceCompositionEnd()}),Me(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(X){if(!T(X)||Ke(r,X))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Z=ws(r);oa({lineWise:!0,text:Z.text}),X.type=="cut"&&r.operation(function(){r.setSelections(Z.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var q=ei.text.join(`
`);if(X.clipboardData.setData("Text",q),X.clipboardData.getData("Text")==q){X.preventDefault();return}}var he=As(),ge=he.firstChild;r.display.lineSpace.insertBefore(he,r.display.lineSpace.firstChild),ge.value=ei.text.join(`
`);var De=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(he),De.focus(),De==n&&i.showPrimarySelection()},50)}Me(n,"copy",j),Me(n,"cut",j)},Xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Xt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Xt.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 T=sa(t,e.anchorNode,e.anchorOffset),j=sa(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&j&&!j.bad&&_t(vi(T,j),r)==0&&_t(gi(T,j),n)==0)return;var X=t.display.view,Z=r.line>=t.display.viewFrom&&Ds(t,r)||{node:X[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Ds(t,n);if(!q){var he=X[X.length-1].measure,ge=he.maps?he.maps[he.maps.length-1]:he.map;q={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Z||!q){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),_e;try{_e=y(Z.node,Z.offset,q.offset,q.node)}catch(Fe){}_e&&(!k&&t.state.focused?(e.collapse(Z.node,Z.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),De&&e.anchorNode==null?e.addRange(De):k&&this.startGracePeriod()),this.rememberSelection()},Xt.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)},Xt.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Xt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Xt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},Xt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Xt.prototype.blur=function(){this.div.blur()},Xt.prototype.getField=function(){return this.div},Xt.prototype.supportsTouch=function(){return!0},Xt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Fr(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)},Xt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Xt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&m&&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&&Fr(t,function(){wr(t.doc,wi(i,r),Se),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Xt.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=Ve(r.line-1,ct(e.doc,r.line-1).length)),n.ch==ct(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var T,j,X;r.line==t.viewFrom||(T=Ui(e,r.line))==0?(j=Mt(t.view[0].line),X=t.view[0].node):(j=Mt(t.view[T].line),X=t.view[T-1].node.nextSibling);var Z=Ui(e,n.line),q,he;if(Z==t.view.length-1?(q=t.viewTo-1,he=t.lineDiv.lastChild):(q=Mt(t.view[Z+1].line)-1,he=t.view[Z+1].node.previousSibling),!X)return!1;for(var ge=e.doc.splitLines(tu(e,X,he,j,q)),De=Kr(e.doc,Ve(j,0),Ve(q,ct(e.doc,q).text.length));ge.length>1&&De.length>1;)if(te(ge)==te(De))ge.pop(),De.pop(),q--;else if(ge[0]==De[0])ge.shift(),De.shift(),j++;else break;for(var _e=0,Fe=0,ze=ge[0],Qe=De[0],at=Math.min(ze.length,Qe.length);_e<at&&ze.charCodeAt(_e)==Qe.charCodeAt(_e);)++_e;for(var ut=te(ge),ot=te(De),mt=Math.min(ut.length-(ge.length==1?_e:0),ot.length-(De.length==1?_e:0));Fe<mt&&ut.charCodeAt(ut.length-Fe-1)==ot.charCodeAt(ot.length-Fe-1);)++Fe;if(ge.length==1&&De.length==1&&j==r.line)for(;_e&&_e>r.ch&&ut.charCodeAt(ut.length-Fe-1)==ot.charCodeAt(ot.length-Fe-1);)_e--,Fe++;ge[ge.length-1]=ut.slice(0,ut.length-Fe).replace(/^\u200b+/,""),ge[0]=ge[0].slice(_e).replace(/\u200b+$/,"");var wt=Ve(j,_e),xt=Ve(q,De.length?te(De).length-Fe:0);if(ge.length>1||ge[0]||_t(wt,xt))return rn(e.doc,ge,wt,xt,"+input"),!0},Xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Xt.prototype.reset=function(){this.forceCompositionEnd()},Xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Xt.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)},Xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Fr(this.cm,function(){return Or(e.cm)})},Xt.prototype.setUneditable=function(e){e.contentEditable="false"},Xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||pr(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Xt.prototype.onContextMenu=function(){},Xt.prototype.resetPosition=function(){},Xt.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=ct(e.doc,t.line),n=eo(i,r,t.line),T=rt(r,e.doc.direction),j="left";if(T){var X=Ye(T,t.ch);j=X%2?"right":"left"}var Z=io(n.map,t.ch,j);return Z.offset=Z.collapse=="right"?Z.end:Z.start,Z}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 T="",j=!1,X=e.doc.lineSeparator(),Z=!1;function q(_e){return function(Fe){return Fe.id==_e}}function he(){j&&(T+=X,Z&&(T+=X),j=Z=!1)}function ge(_e){_e&&(he(),T+=_e)}function De(_e){if(_e.nodeType==1){var Fe=_e.getAttribute("cm-text");if(Fe){ge(Fe);return}var ze=_e.getAttribute("cm-marker"),Qe;if(ze){var at=e.findMarks(Ve(r,0),Ve(n+1,0),q(+ze));at.length&&(Qe=at[0].find(0))&&ge(Kr(e.doc,Qe.from,Qe.to).join(X));return}if(_e.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;ut&&he();for(var ot=0;ot<_e.childNodes.length;ot++)De(_e.childNodes[ot]);/^(pre|p)$/i.test(_e.nodeName)&&(Z=!0),ut&&(j=!0)}else _e.nodeType==3&&ge(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,Z=!1;return T}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(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 T=e.display.view[n];if(T.node==r)return ru(T,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!x(r,t))return ln(Ve(Mt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var T=e.rest?te(e.rest):e.line;return ln(Ve(Mt(T),T.text.length),n)}var j=t.nodeType==3?t:null,X=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,i&&(i=j.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var Z=e.measure,q=Z.maps;function he(Qe,at,ut){for(var ot=-1;ot<(q?q.length:0);ot++)for(var mt=ot<0?Z.map:q[ot],wt=0;wt<mt.length;wt+=3){var xt=mt[wt+2];if(xt==Qe||xt==at){var Rt=Mt(ot<0?e.line:e.rest[ot]),$t=mt[wt]+ut;return(ut<0||xt!=Qe)&&($t=mt[wt+(ut?1:0)]),Ve(Rt,$t)}}}var ge=he(j,X,i);if(ge)return ln(ge,n);for(var De=X.nextSibling,_e=j?j.nodeValue.length-i:0;De;De=De.nextSibling){if(ge=he(De,De.firstChild,0),ge)return ln(Ve(ge.line,ge.ch-_e),n);_e+=De.textContent.length}for(var Fe=X.previousSibling,ze=i;Fe;Fe=Fe.previousSibling){if(ge=he(Fe,Fe.firstChild,-1),ge)return ln(Ve(ge.line,ge.ch+ze),n);ze+=Fe.textContent.length}}var or=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};or.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),C&&(n.style.width="0px"),Me(n,"input",function(){z&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Me(n,"paste",function(j){if(Ke(r,j)||Cs(j,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(j){if(Ke(r,j))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ws(r);oa({lineWise:!0,text:X.text}),j.type=="cut"?r.setSelections(X.ranges,null,Se):(i.prevInput="",n.value=X.text.join(`
`),V(n))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Me(n,"cut",T),Me(n,"copy",T),Me(e.scroller,"paste",function(j){if(di(e,j)||Ke(r,j))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var X=new Event("paste");X.clipboardData=j.clipboardData,n.dispatchEvent(X)}),Me(e.lineSpace,"selectstart",function(j){di(e,j)||re(j)}),Me(n,"compositionstart",function(){var j=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Me(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},or.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},or.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},or.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Qr(e,i.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+j.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+j.left-T.left))}return r},or.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},or.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),z&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",z&&H>=9&&(this.hasSelection=null))},or.prototype.getField=function(){return this.textarea},or.prototype.supportsTouch=function(){return!1},or.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},or.prototype.blur=function(){this.textarea.blur()},or.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},or.prototype.receivedFocus=function(){this.slowPoll()},or.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()})},or.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)},or.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||qe(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(z&&H>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=n.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,X=Math.min(r.length,n.length);j<X&&r.charCodeAt(j)==n.charCodeAt(j);)++j;return Fr(t,function(){za(t,n.slice(j),r.length-j,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},or.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},or.prototype.onKeyPress=function(){z&&H>=9&&(this.hasSelection=null),this.fastPoll()},or.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=Ni(i,e),j=r.scroller.scrollTop;if(!T||S)return;var X=i.options.resetSelectionOnContextMenu;X&&i.doc.sel.contains(T)==-1&&pr(i,wr)(i.doc,wi(T),Se);var Z=n.style.cssText,q=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.left-5)+`px;
z-index: 1000; background: `+(z?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;U&&(ge=window.scrollY),r.input.focus(),U&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=_e,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var ze=i.somethingSelected(),Qe="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=Qe,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=Qe.length,r.selForContextMenu=i.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=Z,z&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),n.selectionStart!=null){(!z||z&&H<9)&&De();var ze=0,Qe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?pr(i,Xo)(i):ze++<10?r.detectingSelectAll=setTimeout(Qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Qe,200)}}if(z&&H>=9&&De(),L){ue(e);var Fe=function(){lt(window,"mouseup",Fe),setTimeout(_e,20)};Me(window,"mouseup",Fe)}else setTimeout(_e,50)},or.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},or.prototype.setUneditable=function(){},or.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=B();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=X.getValue()}var n;if(e.form&&(Me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;n=T.submit;try{var j=T.submit=function(){r(),T.submit=n,T.submit(),T.submit=j}}catch(Z){}}t.finishInit=function(Z){Z.save=r,Z.getTextArea=function(){return e},Z.toTextArea=function(){Z.toTextArea=isNaN,r(),e.parentNode.removeChild(Z.getWrapperElement()),e.style.display="",e.form&&(lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var X=tr(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return X}function nu(e){e.off=lt,e.on=Me,e.wheelEventPixels=hl,e.Doc=Pr,e.splitLines=st,e.countColumn=Y,e.findColumn=Ce,e.isWordChar=ke,e.Pass=Oe,e.signal=Ue,e.Line=Pi,e.changeEnd=_i,e.scrollbarModel=Co,e.Pos=Ve,e.cmpPos=_t,e.modes=Ot,e.mimeModes=Tt,e.resolveMode=vt,e.getMode=Lt,e.modeExtensions=jt,e.extendMode=Ut,e.copyState=qt,e.startState=er,e.innerMode=ir,e.commands=In,e.keyMap=hi,e.keyName=us,e.isModifierKey=ss,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Bt,e.SharedTextMarker=On,e.TextMarker=Li,e.LineWidget=Rn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=ue,e.addClass=F,e.contains=x,e.rmClass=c,e.keyNames=Di}$l(tr),ql(tr);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Pr.prototype)Pr.prototype.hasOwnProperty(la)&&oe(au,la)<0&&(tr.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pr.prototype[la]));return be(Pr),tr.inputStyles={textarea:or,contenteditable:Xt},tr.defineMode=function(e){!tr.defaults.mode&&e!="null"&&(tr.defaults.mode=e),Zt.apply(this,arguments)},tr.defineMIME=Qt,tr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),tr.defineMIME("text/plain","null"),tr.defineExtension=function(e,t){tr.prototype[e]=t},tr.defineDocExtension=function(e,t){Pr.prototype[e]=t},tr.fromTextArea=iu,nu(tr),tr.version="5.58.2",tr})},Y1PL:function(pt,it,ie){"use strict";ie.r(it),ie.d(it,"ResizableTextArea",function(){return oe});var le=ie("wx14"),J=ie("1OyB"),k=ie("vuIU"),$=ie("Ji7U"),O=ie("LK+K"),M=ie("q1tI"),z=ie("VTBJ"),H=ie("rePB"),U=ie("Zm9Q"),R=ie("Kwbf"),m=ie("c+Xe"),S=ie("m+aA"),D=ie("bdgK"),A=new Map;function _(Se){Se.forEach(function(we){var Te,Ce=we.target;(Te=A.get(Ce))===null||Te===void 0||Te.forEach(function(me){return me(Ce)})})}var C=new D.default(_),l=null,o=null;function s(Se,we){A.has(Se)||(A.set(Se,new Set),C.observe(Se)),A.get(Se).add(we)}function d(Se,we){A.has(Se)&&(A.get(Se).delete(we),A.get(Se).size||(C.unobserve(Se),A.delete(Se)))}var w=function(Se){Object($.a)(Te,Se);var we=Object(O.a)(Te);function Te(){return Object(J.a)(this,Te),we.apply(this,arguments)}return Object(k.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(M.Component),g=M.createContext(null);function v(Se){var we=Se.children,Te=Se.onBatchResize,Ce=M.useRef(0),me=M.useRef([]),se=M.useContext(g),te=M.useCallback(function(ce,ae,Ae){Ce.current+=1;var Re=Ce.current;me.current.push({size:ce,element:ae,data:Ae}),Promise.resolve().then(function(){Re===Ce.current&&(Te==null||Te(me.current),me.current=[])}),se==null||se(ce,ae,Ae)},[Te,se]);return M.createElement(g.Provider,{value:te},we)}function L(Se){var we=Se.children,Te=Se.disabled,Ce=M.useRef(null),me=M.useRef(null),se=M.useContext(g),te=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ce=M.isValidElement(we)&&Object(m.c)(we),ae=ce?we.ref:null,Ae=M.useMemo(function(){return Object(m.a)(ae,Ce)},[ae,Ce]),Re=M.useRef(Se);Re.current=Se;var xe=M.useCallback(function(ke){var Pe=Re.current,je=Pe.onResize,We=Pe.data,Be=ke.getBoundingClientRect(),Ie=Be.width,tt=Be.height,Ze=ke.offsetWidth,Je=ke.offsetHeight,Ye=Math.floor(Ie),ft=Math.floor(tt);if(te.current.width!==Ye||te.current.height!==ft||te.current.offsetWidth!==Ze||te.current.offsetHeight!==Je){var rt={width:Ye,height:ft,offsetWidth:Ze,offsetHeight:Je};te.current=rt;var nt=Ze===Math.round(Ie)?Ie:Ze,Me=Je===Math.round(tt)?tt:Je,dt=Object(z.a)(Object(z.a)({},rt),{},{offsetWidth:nt,offsetHeight:Me});se==null||se(dt,ke,We),je&&Promise.resolve().then(function(){je(dt,ke)})}},[]);return M.useEffect(function(){var ke=Object(S.a)(Ce.current)||Object(S.a)(me.current);return ke&&!Te&&s(ke,xe),function(){return d(ke,xe)}},[Ce.current,Te]),M.createElement(w,{ref:me},ce?M.cloneElement(we,{ref:Ae}):we)}var b="rc-observer-key";function c(Se){var we=Se.children,Te=Object(U.a)(we);return Te.map(function(Ce,me){var se=(Ce==null?void 0:Ce.key)||"".concat(b,"-").concat(me);return M.createElement(L,Object(le.a)({},Se,{key:se}),Ce)})}c.Collection=v;var p=c,h=ie("bT9E"),a=ie("TSYQ"),E=ie.n(a),y=`
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
`,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],B={},F;function K(Se){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(we&&B[Te])return B[Te];var Ce=window.getComputedStyle(Se),me=Ce.getPropertyValue("box-sizing")||Ce.getPropertyValue("-moz-box-sizing")||Ce.getPropertyValue("-webkit-box-sizing"),se=parseFloat(Ce.getPropertyValue("padding-bottom"))+parseFloat(Ce.getPropertyValue("padding-top")),te=parseFloat(Ce.getPropertyValue("border-bottom-width"))+parseFloat(Ce.getPropertyValue("border-top-width")),ce=x.map(function(Ae){return"".concat(Ae,":").concat(Ce.getPropertyValue(Ae))}).join(";"),ae={sizingStyle:ce,paddingSize:se,borderSize:te,boxSizing:me};return we&&Te&&(B[Te]=ae),ae}function V(Se){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),Se.getAttribute("wrap")?F.setAttribute("wrap",Se.getAttribute("wrap")):F.removeAttribute("wrap");var me=K(Se,we),se=me.paddingSize,te=me.borderSize,ce=me.boxSizing,ae=me.sizingStyle;F.setAttribute("style","".concat(ae,";").concat(y)),F.value=Se.value||Se.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,xe=F.scrollHeight,ke;if(ce==="border-box"?xe+=te:ce==="content-box"&&(xe-=se),Te!==null||Ce!==null){F.value=" ";var Pe=F.scrollHeight-se;Te!==null&&(Ae=Pe*Te,ce==="border-box"&&(Ae=Ae+se+te),xe=Math.max(Ae,xe)),Ce!==null&&(Re=Pe*Ce,ce==="border-box"&&(Re=Re+se+te),ke=xe>Re?"":"hidden",xe=Math.min(Re,xe))}return{height:xe,minHeight:Ae,maxHeight:Re,overflowY:ke,resize:"none"}}var P=ie("Gytx"),I=ie.n(P),Y;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(Se){Object($.a)(Te,Se);var we=Object(O.a)(Te);function Te(Ce){var me;return Object(J.a)(this,Te),me=we.call(this,Ce),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(se){me.textArea=se},me.handleResize=function(se){var te=me.state.resizeStatus,ce=me.props,ae=ce.autoSize,Ae=ce.onResize;if(te!==Y.NONE)return;typeof Ae=="function"&&Ae(se),ae&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var se=me.props.autoSize;if(!se||!me.textArea)return;var te=se.minRows,ce=se.maxRows,ae=V(me.textArea,!1,te,ce);me.setState({textareaStyles:ae,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:Y.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var se=me.props,te=se.prefixCls,ce=te===void 0?"rc-textarea":te,ae=se.autoSize,Ae=se.onResize,Re=se.className,xe=se.disabled,ke=me.state,Pe=ke.textareaStyles,je=ke.resizeStatus,We=Object(h.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=E()(ce,Re,Object(H.a)({},"".concat(ce,"-disabled"),xe));"value"in We&&(We.value=We.value||"");var Ie=Object(z.a)(Object(z.a)(Object(z.a)({},me.props.style),Pe),je===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(p,{onResize:me.handleResize,disabled:!(ae||Ae)},M.createElement("textarea",Object(le.a)({},We,{className:Be,style:Ie,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:Y.NONE},me}return Object(k.a)(Te,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!I()(me.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 me=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,se)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(M.Component),oe=ee,pe=function(Se){Object($.a)(Te,Se);var we=Object(O.a)(Te);function Te(Ce){var me;Object(J.a)(this,Te),me=we.call(this,Ce),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var ce=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),ce&&ce(te)},me.handleKeyDown=function(te){var ce=me.props,ae=ce.onPressEnter,Ae=ce.onKeyDown;te.keyCode===13&&ae&&ae(te),Ae&&Ae(te)};var se=typeof Ce.value=="undefined"||Ce.value===null?Ce.defaultValue:Ce.value;return me.state={value:se},me}return Object(k.a)(Te,[{key:"setValue",value:function(me,se){"value"in this.props||this.setState({value:me},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Te}(M.Component),Oe=it.default=pe},YiCM:function(pt,it,ie){pt.exports={flexRow:"flexRow___1gyd-",flexJustifyCenter:"flexJustifyCenter___19NSh",flexAlignEnd:"flexAlignEnd___3THeK",flexAlignCenter:"flexAlignCenter___1yurC",flexColumn:"flexColumn___3l0VS",formWrap:"formWrap___28DyB",JupyterFieldWrapElse:"JupyterFieldWrapElse___9ONZN",button:"button___3DTwc",buttonWrap:"buttonWrap___n_juQ",width240:"width240___3x3F-",difficultyHint:"difficultyHint___bU8gT",color888:"color888___3aAYi",color0152d9:"color0152d9___2qsP8",installPackage:"installPackage___3uqSL",apply:"apply___1rKfU",p1:"p1___tgl6j",p2:"p2___1P24b"}},ZpRC:function(pt,it,ie){"use strict";function le(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function J(m,S){return(!S||m!=="hidden")&&m!=="visible"&&m!=="clip"}function k(m,S){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var D=getComputedStyle(m,null);return J(D.overflowY,S)||J(D.overflowX,S)||function(A){var _=function(C){if(!C.ownerDocument||!C.ownerDocument.defaultView)return null;try{return C.ownerDocument.defaultView.frameElement}catch(l){return null}}(A);return!!_&&(_.clientHeight<A.scrollHeight||_.clientWidth<A.scrollWidth)}(m)}return!1}function $(m,S,D,A,_,C,l,o){return C<m&&l>S||C>m&&l<S?0:C<=m&&o<=D||l>=S&&o>=D?C-m-A:l>S&&o<D||C<m&&o>D?l-S+_:0}var O=function(m,S){var D=window,A=S.scrollMode,_=S.block,C=S.inline,l=S.boundary,o=S.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Pe){return Pe!==l};if(!le(m))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,w=[],g=m;le(g)&&s(g);){if((g=g.parentElement)===d){w.push(g);break}g!=null&&g===document.body&&k(g)&&!k(document.documentElement)||g!=null&&k(g,o)&&w.push(g)}for(var v=D.visualViewport?D.visualViewport.width:innerWidth,L=D.visualViewport?D.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,p=m.getBoundingClientRect(),h=p.height,a=p.width,E=p.top,y=p.right,x=p.bottom,B=p.left,F=_==="start"||_==="nearest"?E:_==="end"?x:E+h/2,K=C==="center"?B+a/2:C==="end"?y:B,V=[],P=0;P<w.length;P++){var I=w[P],Y=I.getBoundingClientRect(),ee=Y.height,oe=Y.width,pe=Y.top,Oe=Y.right,Se=Y.bottom,we=Y.left;if(A==="if-needed"&&E>=0&&B>=0&&x<=L&&y<=v&&E>=pe&&x<=Se&&B>=we&&y<=Oe)return V;var Te=getComputedStyle(I),Ce=parseInt(Te.borderLeftWidth,10),me=parseInt(Te.borderTopWidth,10),se=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),ce=0,ae=0,Ae="offsetWidth"in I?I.offsetWidth-I.clientWidth-Ce-se:0,Re="offsetHeight"in I?I.offsetHeight-I.clientHeight-me-te:0;if(d===I)ce=_==="start"?F:_==="end"?F-L:_==="nearest"?$(c,c+L,L,me,te,c+F,c+F+h,h):F-L/2,ae=C==="start"?K:C==="center"?K-v/2:C==="end"?K-v:$(b,b+v,v,Ce,se,b+K,b+K+a,a),ce=Math.max(0,ce+c),ae=Math.max(0,ae+b);else{ce=_==="start"?F-pe-me:_==="end"?F-Se+te+Re:_==="nearest"?$(pe,Se,ee,me,te+Re,F,F+h,h):F-(pe+ee/2)+Re/2,ae=C==="start"?K-we-Ce:C==="center"?K-(we+oe/2)+Ae/2:C==="end"?K-Oe+se+Ae:$(we,Oe,oe,Ce,se+Ae,K,K+a,a);var xe=I.scrollLeft,ke=I.scrollTop;F+=ke-(ce=Math.max(0,Math.min(ke+ce,I.scrollHeight-ee+Re))),K+=xe-(ae=Math.max(0,Math.min(xe+ae,I.scrollWidth-oe+Ae)))}V.push({el:I,top:ce,left:ae})}return V};function M(m){return m===Object(m)&&Object.keys(m).length!==0}function z(m,S){S===void 0&&(S="auto");var D="scrollBehavior"in document.body.style;m.forEach(function(A){var _=A.el,C=A.top,l=A.left;_.scroll&&D?_.scroll({top:C,left:l,behavior:S}):(_.scrollTop=C,_.scrollLeft=l)})}function H(m){return m===!1?{block:"end",inline:"nearest"}:M(m)?m:{block:"start",inline:"nearest"}}function U(m,S){var D=!m.ownerDocument.documentElement.contains(m);if(M(S)&&typeof S.behavior=="function")return S.behavior(D?[]:O(m,S));if(D)return;var A=H(S);return z(O(m,A),A.behavior)}var R=it.a=U},Zss7:function(pt,it,ie){var le;(function(J){var k=/^\s+/,$=/\s+$/,O=0,M=J.round,z=J.min,H=J.max,U=J.random;function R(te,ce){if(te=te||"",ce=ce||{},te instanceof R)return te;if(!(this instanceof R))return new R(te,ce);var ae=m(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=M(100*this._a)/100,this._format=ce.format||ae.format,this._gradientType=ce.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=ae.ok,this._tc_id=O++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),ce,ae,Ae,Re,xe,ke;return ce=te.r/255,ae=te.g/255,Ae=te.b/255,ce<=.03928?Re=ce/12.92:Re=J.pow((ce+.055)/1.055,2.4),ae<=.03928?xe=ae/12.92:xe=J.pow((ae+.055)/1.055,2.4),Ae<=.03928?ke=Ae/12.92:ke=J.pow((Ae+.055)/1.055,2.4),.2126*Re+.7152*xe+.0722*ke},setAlpha:function(te){return this._a=V(te),this._roundA=M(100*this._a)/100,this},toHsv:function(){var te=_(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=_(this._r,this._g,this._b),ce=M(te.h*360),ae=M(te.s*100),Ae=M(te.v*100);return this._a==1?"hsv("+ce+", "+ae+"%, "+Ae+"%)":"hsva("+ce+", "+ae+"%, "+Ae+"%, "+this._roundA+")"},toHsl:function(){var te=D(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=D(this._r,this._g,this._b),ce=M(te.h*360),ae=M(te.s*100),Ae=M(te.l*100);return this._a==1?"hsl("+ce+", "+ae+"%, "+Ae+"%)":"hsla("+ce+", "+ae+"%, "+Ae+"%, "+this._roundA+")"},toHex:function(te){return l(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(P(this._r,255)*100)+"%",g:M(P(this._g,255)*100)+"%",b:M(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(P(this._b,255)*100)+"%)":"rgba("+M(P(this._r,255)*100)+"%, "+M(P(this._g,255)*100)+"%, "+M(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var ce="#"+s(this._r,this._g,this._b,this._a),ae=ce,Ae=this._gradientType?"GradientType = 1, ":"";if(te){var Re=R(te);ae="#"+s(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ae+"startColorstr="+ce+",endColorstr="+ae+")"},toString:function(te){var ce=!!te;te=te||this._format;var ae=!1,Ae=this._a<1&&this._a>=0,Re=!ce&&Ae&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(te,ce){var ae=te.apply(null,[this].concat([].slice.call(ce)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(te,ce){return te.apply(null,[this].concat([].slice.call(ce)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(te,ce){if(typeof te=="object"){var ae={};for(var Ae in te)te.hasOwnProperty(Ae)&&(Ae==="a"?ae[Ae]=te[Ae]:ae[Ae]=Oe(te[Ae]));te=ae}return R(te,ce)};function m(te){var ce={r:0,g:0,b:0},ae=1,Ae=null,Re=null,xe=null,ke=!1,Pe=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(Ce(te.r)&&Ce(te.g)&&Ce(te.b)?(ce=S(te.r,te.g,te.b),ke=!0,Pe=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Ce(te.h)&&Ce(te.s)&&Ce(te.v)?(Ae=Oe(te.s),Re=Oe(te.v),ce=C(te.h,Ae,Re),ke=!0,Pe="hsv"):Ce(te.h)&&Ce(te.s)&&Ce(te.l)&&(Ae=Oe(te.s),xe=Oe(te.l),ce=A(te.h,Ae,xe),ke=!0,Pe="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:ke,format:te.format||Pe,r:z(255,H(ce.r,0)),g:z(255,H(ce.g,0)),b:z(255,H(ce.b,0)),a:ae}}function S(te,ce,ae){return{r:P(te,255)*255,g:P(ce,255)*255,b:P(ae,255)*255}}function D(te,ce,ae){te=P(te,255),ce=P(ce,255),ae=P(ae,255);var Ae=H(te,ce,ae),Re=z(te,ce,ae),xe,ke,Pe=(Ae+Re)/2;if(Ae==Re)xe=ke=0;else{var je=Ae-Re;ke=Pe>.5?je/(2-Ae-Re):je/(Ae+Re);switch(Ae){case te:xe=(ce-ae)/je+(ce<ae?6:0);break;case ce:xe=(ae-te)/je+2;break;case ae:xe=(te-ce)/je+4;break}xe/=6}return{h:xe,s:ke,l:Pe}}function A(te,ce,ae){var Ae,Re,xe;te=P(te,360),ce=P(ce,100),ae=P(ae,100);function ke(We,Be,Ie){return Ie<0&&(Ie+=1),Ie>1&&(Ie-=1),Ie<1/6?We+(Be-We)*6*Ie:Ie<1/2?Be:Ie<2/3?We+(Be-We)*(2/3-Ie)*6:We}if(ce===0)Ae=Re=xe=ae;else{var Pe=ae<.5?ae*(1+ce):ae+ce-ae*ce,je=2*ae-Pe;Ae=ke(je,Pe,te+1/3),Re=ke(je,Pe,te),xe=ke(je,Pe,te-1/3)}return{r:Ae*255,g:Re*255,b:xe*255}}function _(te,ce,ae){te=P(te,255),ce=P(ce,255),ae=P(ae,255);var Ae=H(te,ce,ae),Re=z(te,ce,ae),xe,ke,Pe=Ae,je=Ae-Re;if(ke=Ae===0?0:je/Ae,Ae==Re)xe=0;else{switch(Ae){case te:xe=(ce-ae)/je+(ce<ae?6:0);break;case ce:xe=(ae-te)/je+2;break;case ae:xe=(te-ce)/je+4;break}xe/=6}return{h:xe,s:ke,v:Pe}}function C(te,ce,ae){te=P(te,360)*6,ce=P(ce,100),ae=P(ae,100);var Ae=J.floor(te),Re=te-Ae,xe=ae*(1-ce),ke=ae*(1-Re*ce),Pe=ae*(1-(1-Re)*ce),je=Ae%6,We=[ae,ke,xe,xe,Pe,ae][je],Be=[Pe,ae,ae,ke,xe,xe][je],Ie=[xe,xe,Pe,ae,ae,ke][je];return{r:We*255,g:Be*255,b:Ie*255}}function l(te,ce,ae,Ae){var Re=[pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16))];return Ae&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function o(te,ce,ae,Ae,Re){var xe=[pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16)),pe(Se(Ae))];return Re&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function s(te,ce,ae,Ae){var Re=[pe(Se(Ae)),pe(M(te).toString(16)),pe(M(ce).toString(16)),pe(M(ae).toString(16))];return Re.join("")}R.equals=function(te,ce){return!te||!ce?!1:R(te).toRgbString()==R(ce).toRgbString()},R.random=function(){return R.fromRatio({r:U(),g:U(),b:U()})};function d(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.s-=ce/100,ae.s=I(ae.s),R(ae)}function w(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.s+=ce/100,ae.s=I(ae.s),R(ae)}function g(te){return R(te).desaturate(100)}function v(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.l+=ce/100,ae.l=I(ae.l),R(ae)}function L(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toRgb();return ae.r=H(0,z(255,ae.r-M(255*-(ce/100)))),ae.g=H(0,z(255,ae.g-M(255*-(ce/100)))),ae.b=H(0,z(255,ae.b-M(255*-(ce/100)))),R(ae)}function b(te,ce){ce=ce===0?0:ce||10;var ae=R(te).toHsl();return ae.l-=ce/100,ae.l=I(ae.l),R(ae)}function c(te,ce){var ae=R(te).toHsl(),Ae=(ae.h+ce)%360;return ae.h=Ae<0?360+Ae:Ae,R(ae)}function p(te){var ce=R(te).toHsl();return ce.h=(ce.h+180)%360,R(ce)}function h(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+120)%360,s:ce.s,l:ce.l}),R({h:(ae+240)%360,s:ce.s,l:ce.l})]}function a(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+90)%360,s:ce.s,l:ce.l}),R({h:(ae+180)%360,s:ce.s,l:ce.l}),R({h:(ae+270)%360,s:ce.s,l:ce.l})]}function E(te){var ce=R(te).toHsl(),ae=ce.h;return[R(te),R({h:(ae+72)%360,s:ce.s,l:ce.l}),R({h:(ae+216)%360,s:ce.s,l:ce.l})]}function y(te,ce,ae){ce=ce||6,ae=ae||30;var Ae=R(te).toHsl(),Re=360/ae,xe=[R(te)];for(Ae.h=(Ae.h-(Re*ce>>1)+720)%360;--ce;)Ae.h=(Ae.h+Re)%360,xe.push(R(Ae));return xe}function x(te,ce){ce=ce||6;for(var ae=R(te).toHsv(),Ae=ae.h,Re=ae.s,xe=ae.v,ke=[],Pe=1/ce;ce--;)ke.push(R({h:Ae,s:Re,v:xe})),xe=(xe+Pe)%1;return ke}R.mix=function(te,ce,ae){ae=ae===0?0:ae||50;var Ae=R(te).toRgb(),Re=R(ce).toRgb(),xe=ae/100,ke={r:(Re.r-Ae.r)*xe+Ae.r,g:(Re.g-Ae.g)*xe+Ae.g,b:(Re.b-Ae.b)*xe+Ae.b,a:(Re.a-Ae.a)*xe+Ae.a};return R(ke)},R.readability=function(te,ce){var ae=R(te),Ae=R(ce);return(J.max(ae.getLuminance(),Ae.getLuminance())+.05)/(J.min(ae.getLuminance(),Ae.getLuminance())+.05)},R.isReadable=function(te,ce,ae){var Ae=R.readability(te,ce),Re,xe;xe=!1,Re=se(ae);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":xe=Ae>=4.5;break;case"AAlarge":xe=Ae>=3;break;case"AAAsmall":xe=Ae>=7;break}return xe},R.mostReadable=function(te,ce,ae){var Ae=null,Re=0,xe,ke,Pe,je;ae=ae||{},ke=ae.includeFallbackColors,Pe=ae.level,je=ae.size;for(var We=0;We<ce.length;We++)xe=R.readability(te,ce[We]),xe>Re&&(Re=xe,Ae=R(ce[We]));return R.isReadable(te,Ae,{level:Pe,size:je})||!ke?Ae:(ae.includeFallbackColors=!1,R.mostReadable(te,["#fff","#000"],ae))};var B=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=R.hexNames=K(B);function K(te){var ce={};for(var ae in te)te.hasOwnProperty(ae)&&(ce[te[ae]]=ae);return ce}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function P(te,ce){ee(te)&&(te="100%");var ae=oe(te);return te=z(ce,H(0,parseFloat(te))),ae&&(te=parseInt(te*ce,10)/100),J.abs(te-ce)<1e-6?1:te%ce/parseFloat(ce)}function I(te){return z(1,H(0,te))}function Y(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function pe(te){return te.length==1?"0"+te:""+te}function Oe(te){return te<=1&&(te=te*100+"%"),te}function Se(te){return J.round(parseFloat(te)*255).toString(16)}function we(te){return Y(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",ce="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+ce+")|(?:"+te+")",Ae="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Re="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+Ae),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+Ae),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+Ae),hsva:new RegExp("hsva"+Re),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ce(te){return!!Te.CSS_UNIT.exec(te)}function me(te){te=te.replace(k,"").replace($,"").toLowerCase();var ce=!1;if(B[te])te=B[te],ce=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Te.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Te.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Te.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Te.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Te.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Te.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Te.hex8.exec(te))?{r:Y(ae[1]),g:Y(ae[2]),b:Y(ae[3]),a:we(ae[4]),format:ce?"name":"hex8"}:(ae=Te.hex6.exec(te))?{r:Y(ae[1]),g:Y(ae[2]),b:Y(ae[3]),format:ce?"name":"hex"}:(ae=Te.hex4.exec(te))?{r:Y(ae[1]+""+ae[1]),g:Y(ae[2]+""+ae[2]),b:Y(ae[3]+""+ae[3]),a:we(ae[4]+""+ae[4]),format:ce?"name":"hex8"}:(ae=Te.hex3.exec(te))?{r:Y(ae[1]+""+ae[1]),g:Y(ae[2]+""+ae[2]),b:Y(ae[3]+""+ae[3]),format:ce?"name":"hex"}:!1}function se(te){var ce,ae;return te=te||{level:"AA",size:"small"},ce=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),ce!=="AA"&&ce!=="AAA"&&(ce="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:ce,size:ae}}pt.exports?pt.exports=R:!(le=function(){return R}.call(it,ie,it,pt),le!==void 0&&(pt.exports=le))})(Math)},bT9E:function(pt,it,ie){"use strict";ie.d(it,"a",function(){return J});var le=ie("VTBJ");function J(k,$){var O=Object(le.a)({},k);return Array.isArray($)&&$.forEach(function(M){delete O[M]}),O}},c5Ni:function(pt,it,ie){},dGDm:function(pt,it,ie){pt.exports={selectEnvironment:"selectEnvironment___1zrTT",search:"search___2Sku-",searchListWrap:"searchListWrap___30F5Q",searchList:"searchList___dxlP6",name:"name___28Ilk",tag:"tag___GYHhS",searchListActive:"searchListActive___1H-dL",spin:"spin___2GYcy",common:"common___JE3ZS",title:"title___11-q3",tags:"tags___3vE7b",tagActive:"tagActive___1c0bT",wrap:"wrap___fFVWs",allList:"allList___2mVBv",item:"item___2NPtB",itemActive:"itemActive___2aQTm",line:"line___yjjYk",apply:"apply___3NyxD",p1:"p1___2xNuY",p2:"p2___uGM8U",list:"list___1jtVf",items:"items___3gafm",darklySelectEnvironment:"darklySelectEnvironment___2KS0W"}},dejd:function(pt,it,ie){},dmUQ:function(pt,it,ie){"use strict";var le=ie("Ff2n"),J=ie("rePB"),k=ie("1OyB"),$=ie("vuIU"),O=ie("Ji7U"),M=ie("md7G"),z=ie("foSv"),H=ie("q1tI"),U=ie.n(H),R=ie("TSYQ"),m=ie.n(R),S=ie("4IlW");function D(h,a){var E=Object.keys(h);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(h);a&&(y=y.filter(function(x){return Object.getOwnPropertyDescriptor(h,x).enumerable})),E.push.apply(E,y)}return E}function A(h){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?D(Object(E),!0).forEach(function(y){Object(J.a)(h,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(E)):D(Object(E)).forEach(function(y){Object.defineProperty(h,y,Object.getOwnPropertyDescriptor(E,y))})}return h}function _(h){var a=C();return function(){var y=Object(z.a)(h),x;if(a){var B=Object(z.a)(this).constructor;x=Reflect.construct(y,arguments,B)}else x=y.apply(this,arguments);return Object(M.a)(this,x)}}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(h){return!1}}function l(){}function o(h){h.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,w=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(a){return a!=null},L=function(a,E){return E===a||typeof E=="number"&&typeof a=="number"&&isNaN(E)&&isNaN(a)},b=function(h){Object(O.a)(E,h);var a=_(E);function E(y){var x;Object(k.a)(this,E),x=a.call(this,y),x.onKeyDown=function(K){var V=x.props,P=V.onKeyDown,I=V.onPressEnter;if(K.keyCode===S.a.UP){var Y=x.getRatio(K);x.up(K,Y,null),x.stop()}else if(K.keyCode===S.a.DOWN){var ee=x.getRatio(K);x.down(K,ee,null),x.stop()}else K.keyCode===S.a.ENTER&&I&&I(K);if(x.recordCursorPosition(),x.lastKeyCode=K.keyCode,P){for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),Oe=1;Oe<oe;Oe++)pe[Oe-1]=arguments[Oe];P.apply(void 0,[K].concat(pe))}},x.onKeyUp=function(K){var V=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),V){for(var P=arguments.length,I=new Array(P>1?P-1:0),Y=1;Y<P;Y++)I[Y-1]=arguments[Y];V.apply(void 0,[K].concat(I))}},x.onChange=function(K){var V=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(K)),x.setState({inputValue:x.rawInput}),V(x.toNumber(x.rawInput))},x.onMouseUp=function(){var K=x.props.onMouseUp;x.recordCursorPosition(),K&&K.apply(void 0,arguments)},x.onFocus=function(){var K;x.setState({focused:!0}),(K=x.props).onFocus.apply(K,arguments)},x.onBlur=function(){var K=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var V=x.getCurrentValidValue(x.state.inputValue),P=x.setValue(V,l);if(K){var I=x.input.value,Y=x.getInputDisplayValue({focus:!1,value:P});x.input.value=Y&&Number(Y),K.apply(void 0,arguments),x.input.value=I}},x.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},x.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},x.getPrecision=function(K){if(v(x.props.precision))return x.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var P=0;return V.indexOf(".")>=0&&(P=V.length-V.indexOf(".")-1),P},x.getInputDisplayValue=function(K){var V=K||x.state,P=V.focused,I=V.inputValue,Y=V.value,ee;P?ee=I:ee=x.toPrecisionAsStep(Y),ee==null&&(ee="");var oe=x.formatWrapper(ee);return v(x.props.decimalSeparator)&&(oe=oe.toString().replace(".",x.props.decimalSeparator)),oe},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(K){}},x.restoreByAfter=function(K){if(K===void 0)return!1;var V=x.input.value,P=V.lastIndexOf(K);if(P===-1)return!1;var I=x.cursorBefore.length;return x.lastKeyCode===S.a.DELETE&&x.cursorBefore.charAt(I-1)===K[0]?(x.fixCaret(I,I),!0):P+K.length===V.length?(x.fixCaret(P,P),!0):!1},x.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,P){var I=K.substring(P);return x.restoreByAfter(I)})},x.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(K,V,P){x.pressingUpOrDown=!0,x.step("down",K,V,P)},x.up=function(K,V,P){x.pressingUpOrDown=!0,x.step("up",K,V,P)},x.saveInput=function(K){x.input=K};var B=y.value;B===void 0&&(B=y.defaultValue),x.state={focused:y.autoFocus};var F=x.getValidValue(x.toNumber(B));return x.state=A(A({},x.state),{},{inputValue:x.toPrecisionAsStep(F),value:F}),x}return Object($.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var B=this.props,F=B.value,K=B.onChange,V=B.max,P=B.min,I=this.state.focused;if(x){if(!L(x.value,F)||!L(x.max,V)||!L(x.min,P)){var Y=I?F:this.getValidValue(F),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var oe="value"in this.props?F:this.state.value;"max"in this.props&&x.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&x.min!==P&&typeof oe=="number"&&oe<P&&K&&K(P)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var pe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?pe=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(pe=this.cursorStart):pe=this.input.value.length,this.fixCaret(pe,pe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.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(x){var B=x;return B===""?B="":this.isNotCompleteNumber(parseFloat(B))?B=this.state.value:B=this.getValidValue(B),this.toNumber(B)}},{key:"getValueFromEvent",value:function(x){var B=x.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(B=B.replace(this.props.decimalSeparator,".")),B}},{key:"getValidValue",value:function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(x);return isNaN(K)?x:(K<B&&(K=B),K>F&&(K=F),K)}},{key:"setValue",value:function(x,B){var F=this.props.precision,K=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),V=this.state.value,P=V===void 0?null:V,I=this.state.inputValue,Y=I===void 0?null:I,ee=typeof K=="number"?K.toFixed(F):"".concat(K),oe=K!==P||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},B)):this.setState({value:K,inputValue:this.toPrecisionAsStep(x)},B),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,K=F.precision,V=F.step;if(v(K))return K;var P=this.getPrecision(B),I=this.getPrecision(V),Y=this.getPrecision(x);return x?Math.max(Y,P+I):P+I}},{key:"getPrecisionFactor",value:function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(x,B);return Math.pow(10,F)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var B=Math.abs(this.getMaxPrecision(x));return isNaN(B)?x.toString():Number(x).toFixed(B)}},{key:"toNumber",value:function(x){var B=this.props.precision,F=this.state.focused,K=x&&x.length>16&&F;return this.isNotCompleteNumber(x)||K?x:v(B)?Math.round(x*Math.pow(10,B))/Math.pow(10,B):Number(x)}},{key:"upStep",value:function(x,B){var F=this.props.step,K=this.getPrecisionFactor(x,B),V=Math.abs(this.getMaxPrecision(x,B)),P=((K*x+K*F*B)/K).toFixed(V);return this.toNumber(P)}},{key:"downStep",value:function(x,B){var F=this.props.step,K=this.getPrecisionFactor(x,B),V=Math.abs(this.getMaxPrecision(x,B)),P=((K*x-K*F*B)/K).toFixed(V);return this.toNumber(P)}},{key:"step",value:function(x,B){var F=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),B&&(B.persist(),B.preventDefault());var P=this.props;if(P.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var Y=this["".concat(x,"Step")](I,K),ee=Y>P.max||Y<P.min;if(Y>P.max?Y=P.max:Y<P.min&&(Y=P.min),this.setValue(Y,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){F[x](B,K,!0)},V?d:w)}},{key:"fixCaret",value:function(x,B){if(x===void 0||B===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,K=this.input.selectionEnd;(x!==F||B!==K)&&this.input.setSelectionRange(x,B)}catch(V){}}},{key:"render",value:function(){var x,B=this.props,F=B.prefixCls,K=B.disabled,V=B.readOnly,P=B.useTouch,I=B.autoComplete,Y=B.upHandler,ee=B.downHandler,oe=B.className,pe=B.max,Oe=B.min,Se=B.style,we=B.title,Te=B.onMouseEnter,Ce=B.onMouseLeave,me=B.onMouseOver,se=B.onMouseOut,te=B.required,ce=B.onClick,ae=B.tabIndex,Ae=B.type,Re=B.placeholder,xe=B.id,ke=B.inputMode,Pe=B.pattern,je=B.step,We=B.maxLength,Be=B.autoFocus,Ie=B.name,tt=B.onPaste,Ze=B.onInput,Je=Object(le.a)(B,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ye=this.state,ft=Ye.value,rt=Ye.focused,nt=m()(F,(x={},Object(J.a)(x,oe,!!oe),Object(J.a)(x,"".concat(F,"-disabled"),K),Object(J.a)(x,"".concat(F,"-focused"),rt),x)),Me={};Object.keys(Je).forEach(function(ue){(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(Me[ue]=Je[ue])});var dt=!V&&!K,lt=this.getInputDisplayValue(null),Ue=(ft||ft===0)&&(isNaN(ft)||Number(ft)>=pe),Ke=(ft||ft===0)&&(isNaN(ft)||Number(ft)<=Oe),Ee=Ue||K||V,ve=Ke||K||V,be=m()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(J.a)({},"".concat(F,"-handler-up-disabled"),Ee)),re=m()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(J.a)({},"".concat(F,"-handler-down-disabled"),ve)),ne=P?{onTouchStart:Ee?l:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=P?{onTouchStart:ve?l:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return U.a.createElement("div",{className:nt,style:Se,title:we,onMouseEnter:Te,onMouseLeave:Ce,onMouseOver:me,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},U.a.createElement("div",{className:"".concat(F,"-handler-wrap")},U.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:be}),Y||U.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),U.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:re}),ee||U.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),U.a.createElement("div",{className:"".concat(F,"-input-wrap")},U.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Oe,"aria-valuemax":pe,"aria-valuenow":ft,required:te,type:Ae,placeholder:Re,onPaste:tt,onClick:ce,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:ae,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:dt?this.onKeyDown:l,onKeyUp:dt?this.onKeyUp:l,autoFocus:Be,maxLength:We,readOnly:V,disabled:K,max:pe,min:Oe,step:je,name:Ie,title:we,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(lt),pattern:Pe,inputMode:ke,onInput:Ze},Me))))}}]),E}(U.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var c=b,p=it.a=c},dugo:function(pt,it,ie){"use strict";ie.r(it);var le=ie("7Kak"),J=ie("9yH6"),k=ie("tJVT"),$=ie("q1tI"),O=ie.n($),M=ie("FrRK"),z=ie("2qtc"),H=ie("kLXV"),U=ie("5Dmo"),R=ie("3S7+"),m=ie("+L6B"),S=ie("2/Rp"),D=ie("R9oj"),A=ie("ECub"),_=ie("miYZ"),C=ie("tsqr"),l=ie("9og8"),o=ie("WmNS"),s=ie.n(o),d=ie("9kvl"),w=ie("HBuW"),g=ie("1vsH"),v=ie("Lai7"),L=ie.n(v),b=ie("9Bee"),c=ie("EGTK"),p=ie("m3rI"),h=ie("mT4J"),a=ie.n(h),E=ie("ErOA"),y=function(xe){var ke=xe.newShixuns,Pe=xe.user,je=xe.dispatch,We=Object($.useState)(null),Be=Object(k.a)(We,2),Ie=Be[0],tt=Be[1],Ze=Object($.useState)(null),Je=Object(k.a)(Ze,2),Ye=Je[0],ft=Je[1],rt=Object($.useState)({}),nt=Object(k.a)(rt,2),Me=nt[0],dt=nt[1],lt=Object($.useState)(!1),Ue=Object(k.a)(lt,2),Ke=Ue[0],Ee=Ue[1],ve=Object($.useState)(!1),be=Object(k.a)(ve,2),re=be[0],ne=be[1],de=ke.environmentData,ue=de.frequence_image,fe=ue===void 0?[]:ue,Le=de.environments,Ne=Le===void 0?[]:Le,$e=de.other_image,ht=$e===void 0?[]:$e,Xe=Me.name,gt=Me.description,st=Me.authorization,qe=Me.template_shixuns,Dt=qe===void 0?[]:qe,Et=Me.recommend_shixuns,kt=Et===void 0?[]:Et;Object($.useEffect)(function(){je({type:"newShixuns/getEnvironmentData"})},[]),Object($.useEffect)(function(){if(Ye===null)return;Ot()},[Ye]);var Ot=function(){var Lt=Object(l.a)(s.a.mark(function jt(){var Ut;return s.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:return ir.next=2,Object(w.S)({mirror_repository_id:Ye});case 2:Ut=ir.sent,dt(Ut.data);case 4:case"end":return ir.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}();Object($.useEffect)(function(){(fe==null?void 0:fe.length)>0&&ft(fe[0].id)},[fe]);var Tt=function(jt){tt(jt),Ee(!0)},Zt=function(){var Lt=Object(l.a)(s.a.mark(function jt(){var Ut,qt;return s.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return ne(!0),er.next=3,Object(E.a)("/api/shixuns/".concat(Ie==null?void 0:Ie.identifier,"/copy.json"),{method:"post",body:{}});case 3:Ut=er.sent,Ut.status===0&&(d.d===null||d.d===void 0||d.d.push("/shixuns/".concat((qt=Ut.data)===null||qt===void 0?void 0:qt.shixun,"/edit")),Ee(!1),C.b.success("\u590D\u5236\u6210\u529F")),ne(!1);case 6:case"end":return er.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}(),Qt=function(){Ee(!1)},vt=function(){var Lt=Object(l.a)(s.a.mark(function jt(){var Ut,qt,ir,er=arguments;return s.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return Ut=er.length>0&&er[0]!==void 0?er[0]:!1,Object(g.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE","\u5168\u5B9E\u8DF5\u9879\u76EE",Ut?"\u6682\u4E0D\u9009\u7528\u955C\u50CF":"\u4F7F\u7528\u5F53\u524D\u955C\u50CF"]),qt=Ye&&!Ut?{image_id:Ye}:{},ct.next=5,Object(E.a)("/api/shixuns/choose_environment_or_skip.json",{method:"post",body:qt});case 5:ir=ct.sent,ir.status===0&&d.d.push("/shixuns/".concat(ir.data.identifier,"/edit"));case 7:case"end":return ct.stop()}},jt)}));return function(){return Lt.apply(this,arguments)}}();return O.a.createElement("div",{className:a.a.practice},O.a.createElement(c.a,{dispatch:je,value:Ye,data:Ne,otherData:ht,tags:fe,onChange:function(jt){return ft(jt)}}),O.a.createElement("div",{className:a.a.right},O.a.createElement("header",null,O.a.createElement("div",{className:a.a.title},"\u5B9E\u9A8C\u73AF\u5883:\xA0",Ye===null?"\u2014 \u2014":Xe)),O.a.createElement("div",{className:a.a.content},Ye===null&&O.a.createElement(O.a.Fragment,null,O.a.createElement(A.a,{image:L.a,description:"\u8BF7\u9009\u62E9\u5B9E\u9A8C\u73AF\u5883"}),O.a.createElement("div",{className:a.a.btns},O.a.createElement(S.a,{size:"large",style:{marginRight:20},onClick:function(){return vt(!0)}}," ","\u6682\u4E0D\u9009\u7528\u955C\u50CF"),O.a.createElement(S.a,{size:"large",type:"primary",disabled:Ye===null,onClick:function(){return vt()}},"\u4F7F\u7528\u5F53\u524D\u955C\u50CF"))),Ye!==null&&O.a.createElement("div",{className:a.a.des},O.a.createElement("div",{className:a.a.mainBody},O.a.createElement(b.a,{value:gt})),O.a.createElement("div",{className:a.a.btns,style:{borderBottom:Dt.length||kt.length?"1px solid #F1F1F1":0}},O.a.createElement(S.a,{size:"large",style:{marginRight:20},onClick:function(){return vt(!0)}}," ","\u6682\u4E0D\u9009\u7528\u955C\u50CF"),O.a.createElement(S.a,{size:"large",type:"primary",disabled:Ye===null,onClick:function(){return vt()}},"\u4F7F\u7528\u5F53\u524D\u955C\u50CF")),!!Dt.length&&O.a.createElement("div",{className:a.a.title},"\u57FA\u4E8E\u6A21\u677F\u521B\u5EFA"),O.a.createElement("ul",{className:a.a.sys},Dt.map(function(Lt,jt){var Ut=Lt.pic,qt=Lt.name,ir=Lt.identifier,er=Lt.template_description,Bt=Lt.id;return O.a.createElement("li",{className:a.a.li,key:jt},O.a.createElement("div",{className:a.a.d1},O.a.createElement("div",{className:a.a.img},O.a.createElement("img",{src:"".concat(p.a.IMG_SERVER,"/").concat(Ut)})),O.a.createElement("div",{className:a.a.btn},O.a.createElement("div",{className:a.a.b1,onClick:function(){return Object(g.S)("/shixuns/".concat(ir,"/challenges"))}},"\u67E5\u770B\u8BE6\u60C5"),O.a.createElement("div",{className:a.a.b2,onClick:function(){return Tt(Lt)}},"\u4F7F\u7528\u6A21\u677F")),O.a.createElement("div",{className:a.a.bot},qt||"--")),er?O.a.createElement(R.a,{title:er},O.a.createElement("div",{className:a.a.d2},er)):O.a.createElement("div",{className:a.a.d2},"--"))})),!!kt.length&&O.a.createElement("div",{className:a.a.title},"\u63A8\u8350\u5B9E\u8DF5\u9879\u76EE\u6837\u4F8B"),O.a.createElement("ul",{className:a.a.sys},kt.map(function(Lt,jt){var Ut=Lt.pic,qt=Lt.name,ir=Lt.identifier,er=Lt.id;return O.a.createElement("li",{className:a.a.li,key:jt},O.a.createElement("div",{className:a.a.d1},O.a.createElement("div",{className:a.a.img},O.a.createElement("img",{src:"".concat(p.a.IMG_SERVER,"/").concat(Ut)})),O.a.createElement("div",{className:a.a.btn},O.a.createElement("div",{className:a.a.b1,onClick:function(){return Object(g.S)("/shixuns/".concat(ir,"/challenges"))}},"\u67E5\u770B\u8BE6\u60C5"),O.a.createElement("div",{className:a.a.b2,onClick:function(){return Tt(Lt)}},"\u4E00\u952E\u590D\u5236")),O.a.createElement("div",{className:a.a.bot},qt)))}))))),O.a.createElement(H.a,{title:"\u4E00\u952E\u65B0\u5EFA",visible:Ke,centered:!0,onCancel:Qt,footer:null,wrapClassName:a.a.practiceModal},st&&O.a.createElement("div",{className:a.a.content},O.a.createElement("p",null,"\u4E00\u952E\u65B0\u5EFA\u540E\uFF0C\u60A8\u53EF\u4EE5\u57FA\u4E8E\u8FD9\u4E2A\u5B9E\u8BAD\u4FEE\u6539\u5F62\u6210\u65B0\u7684\u5B9E\u8BAD"),O.a.createElement(S.a,{className:a.a.btn,loading:re,onClick:Zt},"\u786E\u8BA4\u590D\u5236")),!st&&O.a.createElement("div",{className:a.a.content},O.a.createElement("aside",null,O.a.createElement("p",null,"\u8BE5\u5B9E\u8BAD\u6240\u4F7F\u7528\u7684\u5B9E\u9A8C\u73AF\u5883\u4E3A\u79C1\u6709\u73AF\u5883\uFF1A",O.a.createElement("span",{style:{color:"#0152d9"}},Xe)),O.a.createElement("p",null,"\u60A8\u65E0\u8BE5\u5B9E\u9A8C\u73AF\u5883\u7684\u4F7F\u7528\u6743\u9650\uFF0C\u6240\u4EE5\u65E0\u6CD5\u590D\u5236\u8BE5\u5B9E\u8BAD")),O.a.createElement("div",{onClick:function(){return Ee(!1)}},"\u6211\u77E5\u9053\u4E86"))))},x=Object(d.a)(function(Re){var xe=Re.newShixuns,ke=Re.globalSetting,Pe=Re.user;return{newShixuns:xe,globalSetting:ke,user:Pe}})(y),B=ie("sRBo"),F=ie("kaz8"),K=ie("5NDa"),V=ie("5rEg"),P=ie("k1fw"),I=ie("y8nQ"),Y=ie("Vl3Y"),ee=ie("OaEy"),oe=ie("2fM7"),pe=ie("Ot1p"),Oe=ie("YiCM"),Se=ie.n(Oe),we=ie("QXZ7"),Te=oe.a.Option,Ce=function(xe){var ke,Pe,je,We,Be,Ie=xe.newShixuns,tt=xe.loading,Ze=xe.dispatch,Je=xe.is_jupyter_lab,Ye=xe.user,ft=Y.a.useForm(),rt=Object(k.a)(ft,1),nt=rt[0],Me=Object($.useState)({}),dt=Object(k.a)(Me,2),lt=dt[0],Ue=dt[1],Ke=Object($.useState)(!1),Ee=Object(k.a)(Ke,2),ve=Ee[0],be=Ee[1],re=Object($.useState)({}),ne=Object(k.a)(re,2),de=ne[0],ue=ne[1];Object($.useEffect)(function(){var Xe="newShixuns/getNewShixunsData";Je&&(Xe="newShixuns/getShixunsJupyterLab"),Ze({type:Xe})},[Je]),Object($.useEffect)(function(){var Xe,gt,st,qe=Ie==null||((Xe=Ie.newData)===null||Xe===void 0||((gt=Xe.main_type)===null||gt===void 0||((st=gt[0])===null||st===void 0)))?void 0:st.id;nt.setFieldsValue({mainType:qe}),Ne(qe)},[Ie]);var fe=function(){Ze({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},Le=function(gt,st){Ue(Object(P.a)({},st)),console.log(gt,"changeValues"),"mainType"in gt&&Ne(st.mainType,st.subType),"subType"in gt&&Ne(st.mainType,st.subType)},Ne=function(gt){var st=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],qe=Ie.newData||{},Dt=qe.main_type,Et=qe.small_type,kt=Dt==null?void 0:Dt.find(function(Tt){return Tt.id===gt}),Ot={mainTypeName:kt==null?void 0:kt.type_name,mainTypeDescription:kt==null?void 0:kt.description,smallType:[]};st.map(function(Tt){Et.map(function(Zt){Tt===Zt.id&&!!Zt.description&&Ot.smallType.push({name:Zt.type_name,des:Zt.description})})}),ue(Ot)},$e=function(){var Xe=Object(l.a)(s.a.mark(function gt(st){var qe,Dt,Et,kt,Ot,Tt,Zt,Qt,vt,Lt;return s.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return qe=st||{},Dt=qe.intro,Et=qe.mainType,kt=qe.subType,Ot=qe.name,Tt=qe.number,Zt=qe.difficulty,Qt=qe.jupyter_show_description,vt=Qt===void 0?!1:Qt,Object(g.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",Je?"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE":"JupyterLab\u5B9E\u8DF5\u9879\u76EE","\u4FDD\u5B58"]),Ut.next=4,Ze({type:"newShixuns/submitShixuns",payload:{description:Dt,main_type:Et,sub_type:kt,shixun:{jupyter_show_description:vt,name:Ot,number:Tt,trainee:Zt,is_jupyter:!Je,is_jupyter_lab:Je}}});case 4:Lt=Ut.sent,(Lt==null?void 0:Lt.status)!==-1&&d.d.push("/shixuns/".concat(Lt.shixun_identifier,"/challenges"));case 6:case"end":return Ut.stop()}},gt)}));return function(st){return Xe.apply(this,arguments)}}(),ht=function(){Ze({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})};return O.a.createElement(Y.a,{form:nt,className:Se.a.JupyterFieldWrapElse,scrollToFirstError:!0,layout:"vertical",initialValues:{difficulty:1},onValuesChange:Le,onFinish:$e},O.a.createElement("div",{className:Se.a.fieldWrap},O.a.createElement(Y.a.Item,{name:"name",label:"\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0"},{max:60,message:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"},{whitespace:!0,message:"\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C"}]},O.a.createElement(V.a,{bordered:!1,placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",suffix:"".concat(((ke=lt.name)===null||ke===void 0?void 0:ke.length)||0,"/60")})),O.a.createElement(Y.a.Item,{name:"intro",label:"\u7B80\u4ECB:"},O.a.createElement(pe.a,{watch:!0})),O.a.createElement(Y.a.Item,{name:"jupyter_show_description",valuePropName:"checked"},O.a.createElement(F.a,null,"\u663E\u793A\u4EFB\u52A1\u8981\u6C42\uFF08\u52FE\u9009\u540E\uFF0C\u5C06\u7B80\u4ECB\u4F5C\u4E3A\u4EFB\u52A1\u8981\u6C42\u663E\u793A\u5728\u5B9E\u8DF5\u9879\u76EE\u6311\u6218\u9875\u9762\uFF09")),O.a.createElement("div",{className:"".concat(Se.a.flexRow," ").concat(Se.a.flexAlignCenter)},O.a.createElement(Y.a.Item,{className:Se.a.width180,name:"number",label:"\u5B9E\u9A8C\u7F16\u53F7:"},O.a.createElement(V.a,{bordered:!1,style:{width:500},placeholder:"\u8BF7\u8F93\u5165\u5B9E\u9A8C\u7F16\u53F7\uFF0C\u6700\u591A20\u4E2A\u5B57\u7B26",maxLength:20}))),O.a.createElement("div",{className:"".concat(Se.a.flexRow," ").concat(Se.a.flexAlignCenter)},O.a.createElement(Y.a.Item,{className:Se.a.width180,name:"difficulty",label:"\u96BE\u6613\u5EA6:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6"}]},O.a.createElement(oe.a,{bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6",style:{width:500}},O.a.createElement(Te,{value:1},"\u521D\u7EA7"),O.a.createElement(Te,{value:2},"\u4E2D\u7EA7"),O.a.createElement(Te,{value:3},"\u4E2D\u9AD8\u7EA7"),O.a.createElement(Te,{value:4},"\u9AD8\u7EA7")))),O.a.createElement("div",{className:"".concat(Se.a.flexRow," ").concat(Se.a.flexAlignEnd)},O.a.createElement(Y.a.Item,{className:Se.a.width240,name:"mainType",label:"\u5B9E\u9A8C\u73AF\u5883:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B"}]},O.a.createElement(oe.a,{bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B"},(Pe=Ie.newData)===null||Pe===void 0||((je=Pe.main_type)===null||je===void 0)?void 0:je.map(function(Xe){return O.a.createElement(Te,{value:Xe.id,key:Xe.id,name:Xe.description},Xe.type_name)}))),O.a.createElement(Y.a.Item,{name:"subType",className:"".concat(Se.a.width240," ml20")},O.a.createElement(oe.a,{getPopupContainer:function(gt){return gt.parentNode},bordered:!1,placeholder:"\u8BF7\u9009\u62E9\u5C0F\u7C7B\u522B",mode:"multiple"},(We=Ie.newData)===null||We===void 0||((Be=We.small_type)===null||Be===void 0)?void 0:Be.map(function(Xe){return O.a.createElement(Te,{value:Xe.id,key:Xe.id,name:Xe.description},Xe.type_name)}))),O.a.createElement("div",{className:Se.a.installPackage,onClick:function(){return be(!0)}},"\u73AF\u5883\u4ECB\u7ECD")),O.a.createElement("div",{className:Se.a.apply},O.a.createElement("span",{className:Se.a.p1},"\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"),O.a.createElement("span",{className:Se.a.p2,onClick:fe}," ","\u7533\u8BF7\u65B0\u5EFA"),O.a.createElement("span",{className:Se.a.p2,onClick:ht}," ","\u5728\u7EBF\u521B\u5EFA"))),O.a.createElement(Y.a.Item,null,O.a.createElement("div",{className:Se.a.buttonWrap},O.a.createElement(S.a,{size:"large",className:"".concat(Se.a.button," mr20"),onClick:function(){Object(g.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",Je?"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE":"JupyterLab\u5B9E\u8DF5\u9879\u76EE","\u53D6\u6D88"]),d.d.push("/shixuns")}},"\u53D6\u6D88"),O.a.createElement(S.a,{size:"large",type:"primary",className:"".concat(Se.a.button," mr20"),htmlType:"submit",loading:tt["newShixuns/submitCourses"]},"\u4FDD\u5B58"))),O.a.createElement(we.a,{installPackage:de,visible:ve,setVisible:be}))},me=Object(d.a)(function(Re){var xe=Re.newShixuns,ke=Re.loading,Pe=Re.user;return{newShixuns:xe,loading:ke.effects,user:Pe}})(Ce),se=ie("N3QO"),te=ie("6f40"),ce=ie.n(te),ae=function(){var xe=Object($.useState)("1"),ke=Object(k.a)(xe,2),Pe=ke[0],je=ke[1],We=function(Ie){je(Ie.target.value)};return O.a.createElement("section",{className:ce.a.practicalTraining},O.a.createElement("div",{className:ce.a.titleWrap},O.a.createElement("div",{className:ce.a.title},"\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement("div",{className:ce.a.line}),O.a.createElement(J.a.Group,{value:Pe,onChange:We},O.a.createElement(J.a,{style:{fontSize:16},value:"1"},"\u5168\u6808\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement(J.a,{value:"2",style:{marginLeft:40,fontSize:16}},"Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE"),O.a.createElement(J.a,{value:"3",style:{marginLeft:40,fontSize:16}},"JupyterLab\u5B9E\u8DF5\u9879\u76EE")),O.a.createElement("div",{className:ce.a.dec},Pe==="1"&&"\u591A\u529F\u80FD\u65B0\u578B\u5B9E\u6218\u9879\u76EE\u6A21\u5F0F\uFF0C\u652F\u6301\u56FE\u5F62\u5316\u684C\u9762\u3001Web IDE\u3001\u547D\u4EE4\u884C\u3001\u865A\u62DF\u4EFF\u771F\u7B49\u591A\u79CD\u5B9E\u9A8C\u573A\u666F\uFF0C\u9002\u7528\u4E8E\u5404\u7C7B\u590D\u6742\u5DE5\u7A0B\u9879\u76EE\u7814\u53D1\u3002",Pe==="2"&&"\u591A\u529F\u80FD\u5B9E\u65F6\u4EA4\u4E92\u5B9E\u9A8C\u6A21\u5F0F\uFF0C\u652F\u6301\u5B9E\u65F6\u4EE3\u7801\u3001\u6570\u5B66\u65B9\u7A0B\u3001\u53EF\u89C6\u5316\u548CMarkDown\u7B49\u3002 \u9002\u7528\u4E8E\u6570\u636E\u6E05\u7406\u3001\u6570\u503C\u6A21\u62DF\u3001\u7EDF\u8BA1\u5EFA\u6A21\u3001\u673A\u5668\u5B66\u4E60\u7B49\u7CFB\u5217\u5B9E\u9A8C\u3002",Pe==="3"&&"JupyterLab\u662F\u65B0\u4E00\u4EE3Jupyter Notebook\uFF0C\u914D\u7F6E\u6587\u4EF6\u76EE\u5F55\u548CNotebook\uFF0C\u652F\u6301\u6570\u636E\u79D1\u5B66\u4E2D\u7684\u5404\u79CD\u5DE5\u4F5C\u6D41\u7A0B\uFF0C\u9002\u5408\u4E2D\u5927\u578B\u9879\u76EE\u3002")),Pe==="1"&&O.a.createElement(x,null),(Pe==="2"||Pe==="3")&&O.a.createElement(me,{is_jupyter_lab:!(Pe==="2")}),O.a.createElement(M.a,null),O.a.createElement(se.a,null))},Ae=it.default=ae},h78n:function(pt,it,ie){"use strict";ie.d(it,"a",function(){return x});var le=ie("q1tI"),J=ie.n(le),k=ie("TSYQ"),$=ie.n(k),O={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(K){var V=K.map(function(){return Object(le.useRef)()}),P=Object(le.useRef)();return Object(le.useEffect)(function(){var I=Date.now(),Y=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;Y=!0;var pe=oe.style;pe.transitionDuration=".3s, .3s, .3s, .06s",P.current&&I-P.current<100&&(pe.transitionDuration="0s, 0s")}),Y&&(P.current=Date.now())}),[V]};function z(){return z=Object.assign||function(F){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(F[P]=V[P])}return F},z.apply(this,arguments)}function H(F,K){return D(F)||S(F,K)||R(F,K)||U()}function U(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(F,K){if(!F)return;if(typeof F=="string")return m(F,K);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return m(F,K)}function m(F,K){(K==null||K>F.length)&&(K=F.length);for(var V=0,P=new Array(K);V<K;V++)P[V]=F[V];return P}function S(F,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],P=!0,I=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(P=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);P=!0);}catch(pe){I=!0,Y=pe}finally{try{!P&&ee.return!=null&&ee.return()}finally{if(I)throw Y}}return V}function D(F){if(Array.isArray(F))return F}function A(F,K){if(F==null)return{};var V=_(F,K),P,I;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(I=0;I<Y.length;I++){if(P=Y[I],K.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,P))continue;V[P]=F[P]}}return V}function _(F,K){if(F==null)return{};var V={},P=Object.keys(F),I,Y;for(Y=0;Y<P.length;Y++){if(I=P[Y],K.indexOf(I)>=0)continue;V[I]=F[I]}return V}var C=function(K){var V=K.className,P=K.percent,I=K.prefixCls,Y=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,pe=K.style,Oe=K.trailColor,Se=K.trailWidth,we=K.transition,Te=A(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Ce=Array.isArray(P)?P:[P],me=Array.isArray(Y)?Y:[Y],se=M(Ce),te=H(se,1),ce=te[0],ae=oe/2,Ae=100-oe/2,Re="M ".concat(ee==="round"?ae:0,",").concat(ae,`
L `).concat(ee==="round"?Ae:100,",").concat(ae),xe="0 0 100 ".concat(oe),ke=0;return J.a.createElement("svg",z({className:$()("".concat(I,"-line"),V),viewBox:xe,preserveAspectRatio:"none",style:pe},Te),J.a.createElement("path",{className:"".concat(I,"-line-trail"),d:Re,strokeLinecap:ee,stroke:Oe,strokeWidth:Se||oe,fillOpacity:"0"}),Ce.map(function(Pe,je){var We={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(ke,"px"),transition:we||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=me[je]||me[me.length-1];return ke+=Pe,J.a.createElement("path",{key:je,className:"".concat(I,"-line-path"),d:Re,strokeLinecap:ee,stroke:Be,strokeWidth:oe,fillOpacity:"0",ref:ce[je],style:We})}))};C.defaultProps=O;var l=C;function o(){return o=Object.assign||function(F){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var P in V)Object.prototype.hasOwnProperty.call(V,P)&&(F[P]=V[P])}return F},o.apply(this,arguments)}function s(F,K){return L(F)||v(F,K)||w(F,K)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,K){if(!F)return;if(typeof F=="string")return g(F,K);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return g(F,K)}function g(F,K){(K==null||K>F.length)&&(K=F.length);for(var V=0,P=new Array(K);V<K;V++)P[V]=F[V];return P}function v(F,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],P=!0,I=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(P=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);P=!0);}catch(pe){I=!0,Y=pe}finally{try{!P&&ee.return!=null&&ee.return()}finally{if(I)throw Y}}return V}function L(F){if(Array.isArray(F))return F}function b(F,K){if(F==null)return{};var V=c(F,K),P,I;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(I=0;I<Y.length;I++){if(P=Y[I],K.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,P))continue;V[P]=F[P]}}return V}function c(F,K){if(F==null)return{};var V={},P=Object.keys(F),I,Y;for(Y=0;Y<P.length;Y++){if(I=P[Y],K.indexOf(I)>=0)continue;V[I]=F[I]}return V}var p=0;function h(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function E(F,K,V,P){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,ee=50-P/2,oe=0,pe=-ee,Oe=0,Se=-2*ee;switch(Y){case"left":oe=-ee,pe=0,Oe=2*ee,Se=0;break;case"right":oe=ee,pe=0,Oe=-2*ee,Se=0;break;case"bottom":pe=ee,Se=2*ee;break;default:}var we="M 50,50 m ".concat(oe,",").concat(pe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Oe,",").concat(-Se,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Oe,",").concat(Se),Te=Math.PI*2*ee,Ce={stroke:V,strokeDasharray:"".concat(K/100*(Te-I),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(I/2+F/100*(Te-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:we,pathStyle:Ce}}var y=function(K){var V=K.prefixCls,P=K.strokeWidth,I=K.trailWidth,Y=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,pe=K.strokeLinecap,Oe=K.style,Se=K.className,we=K.strokeColor,Te=K.percent,Ce=b(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(le.useMemo)(function(){return p+=1,p},[]),se=E(0,100,oe,P,Y,ee),te=se.pathString,ce=se.pathStyle,ae=a(Te),Ae=a(we),Re=Ae.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),xe=M(ae),ke=s(xe,1),Pe=ke[0],je=function(){var Be=0;return ae.map(function(Ie,tt){var Ze=Ae[tt]||Ae[Ae.length-1],Je=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",Ye=E(Be,Ie,Ze,P,Y,ee);return Be+=Ie,J.a.createElement("path",{key:tt,className:"".concat(V,"-circle-path"),d:Ye.pathString,stroke:Je,strokeLinecap:pe,strokeWidth:P,opacity:Ie===0?0:1,fillOpacity:"0",style:Ye.pathStyle,ref:Pe[tt]})})};return J.a.createElement("svg",o({className:$()("".concat(V,"-circle"),Se),viewBox:"0 0 100 100",style:Oe},Ce),Re&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(We,Be){return h(We)-h(Be)}).map(function(We,Be){return J.a.createElement("stop",{key:Be,offset:We,stopColor:Re[We]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:pe,strokeWidth:I||P,fillOpacity:"0",style:ce}),je().reverse())};y.defaultProps=O;var x=y,B={Line:l,Circle:x}},kSUc:function(pt,it,ie){},lZu9:function(pt,it,ie){(function(le){le(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(J,k){var $=le.getMode(J,"text/html"),O=$.name=="null";function M(P){if(le.findModeByName){var I=le.findModeByName(P);I&&(P=I.mime||I.mimes[0])}var Y=le.getMode(J,P);return Y.name=="null"?null:Y}k.highlightFormatting===void 0&&(k.highlightFormatting=!1),k.maxBlockquoteDepth===void 0&&(k.maxBlockquoteDepth=0),k.taskLists===void 0&&(k.taskLists=!1),k.strikethrough===void 0&&(k.strikethrough=!1),k.emoji===void 0&&(k.emoji=!1),k.fencedCodeBlockHighlighting===void 0&&(k.fencedCodeBlockHighlighting=!0),k.fencedCodeBlockDefaultMode===void 0&&(k.fencedCodeBlockDefaultMode="text/plain"),k.xml===void 0&&(k.xml=!0),k.tokenTypeOverrides===void 0&&(k.tokenTypeOverrides={});var z={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var H in z)z.hasOwnProperty(H)&&k.tokenTypeOverrides[H]&&(z[H]=k.tokenTypeOverrides[H]);var U=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,S=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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 s(P,I,Y){return I.f=I.inline=Y,Y(P,I)}function d(P,I,Y){return I.f=I.block=Y,Y(P,I)}function w(P){return!P||!/\S/.test(P.string)}function g(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==L){var I=O;if(!I){var Y=le.innerMode($,P.htmlState);I=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}I&&(P.f=h,P.block=v,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function v(P,I){var Y=P.column()===I.indentation,ee=w(I.prevLine.stream),oe=I.indentedCode,pe=I.prevLine.hr,Oe=I.list!==!1,Se=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var we=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,Oe)){for(I.list=null;we<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=we-I.listStack[I.listStack.length-1])}var Te=!ee&&!pe&&!I.prevLine.header&&(!Oe||!oe)&&!I.prevLine.fencedCodeEnd,Ce=(I.list===!1||pe||ee)&&I.indentation<=Se&&P.match(U),me=null;if(I.indentationDiff>=4&&(oe||I.prevLine.fencedCodeEnd||I.prevLine.header||ee))return P.skipToEnd(),I.indentedCode=!0,z.code;if(P.eatSpace())return null;if(Y&&I.indentation<=Se&&(me=P.match(S))&&me[1].length<=6)return I.quote=0,I.header=me[1].length,I.thisLine.header=!0,k.highlightFormatting&&(I.formatting="header"),I.f=I.inline,c(I);if(I.indentation<=Se&&P.eat(">"))return I.quote=Y?1:I.quote+1,k.highlightFormatting&&(I.formatting="quote"),P.eatSpace(),c(I);if(!Ce&&!I.setext&&Y&&I.indentation<=Se&&(me=P.match(R))){var se=me[1]?"ol":"ul";return I.indentation=we+P.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,k.taskLists&&P.match(m,!1)&&(I.taskList=!0),I.f=I.inline,k.highlightFormatting&&(I.formatting=["list","list-"+se]),c(I)}else{if(Y&&I.indentation<=Se&&(me=P.match(_,!0)))return I.quote=0,I.fencedEndRE=new RegExp(me[1]+"+ *$"),I.localMode=k.fencedCodeBlockHighlighting&&M(me[2]||k.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=le.startState(I.localMode)),I.f=I.block=b,k.highlightFormatting&&(I.formatting="code-block"),I.code=-1,c(I);if(I.setext||(!Te||!Oe)&&!I.quote&&I.list===!1&&!I.code&&!Ce&&!C.test(P.string)&&(me=P.lookAhead(1))&&(me=me.match(D)))return I.setext?(I.header=I.setext,I.setext=0,P.skipToEnd(),k.highlightFormatting&&(I.formatting="header")):(I.header=me[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,c(I);if(Ce)return P.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,z.hr;if(P.peek()==="[")return s(P,I,B)}return s(P,I,I.inline)}function L(P,I){var Y=$.token(P,I.htmlState);if(!O){var ee=le.innerMode($,I.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||I.md_inside&&P.current().indexOf(">")>-1)&&(I.f=h,I.block=v,I.htmlState=null)}return Y}function b(P,I){var Y=I.listStack[I.listStack.length-1]||0,ee=I.indentation<Y,oe=Y+3;if(I.fencedEndRE&&I.indentation<=oe&&(ee||P.match(I.fencedEndRE))){k.highlightFormatting&&(I.formatting="code-block");var pe;return ee||(pe=c(I)),I.localMode=I.localState=null,I.block=v,I.f=h,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,ee?d(P,I,I.block):pe}else return I.localMode?I.localMode.token(P,I.localState):(P.skipToEnd(),z.code)}function c(P){var I=[];if(P.formatting){I.push(z.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var Y=0;Y<P.formatting.length;Y++)I.push(z.formatting+"-"+P.formatting[Y]),P.formatting[Y]==="header"&&I.push(z.formatting+"-"+P.formatting[Y]+"-"+P.header),P.formatting[Y]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=P.quote?I.push(z.formatting+"-"+P.formatting[Y]+"-"+P.quote):I.push("error"))}if(P.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(P.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(P.linkHref?I.push(z.linkHref,"url"):(P.strong&&I.push(z.strong),P.em&&I.push(z.em),P.strikethrough&&I.push(z.strikethrough),P.emoji&&I.push(z.emoji),P.linkText&&I.push(z.linkText),P.code&&I.push(z.code),P.image&&I.push(z.image),P.imageAltText&&I.push(z.imageAltText,"link"),P.imageMarker&&I.push(z.imageMarker)),P.header&&I.push(z.header,z.header+"-"+P.header),P.quote&&(I.push(z.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=P.quote?I.push(z.quote+"-"+P.quote):I.push(z.quote+"-"+k.maxBlockquoteDepth)),P.list!==!1){var ee=(P.listStack.length-1)%3;ee?ee===1?I.push(z.list2):I.push(z.list3):I.push(z.list1)}return P.trailingSpaceNewLine?I.push("trailing-space-new-line"):P.trailingSpace&&I.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function p(P,I){return P.match(A,!0)?c(I):void 0}function h(P,I){var Y=I.text(P,I);if(typeof Y!="undefined")return Y;if(I.list)return I.list=null,c(I);if(I.taskList){var ee=P.match(m,!0)[1]===" ";return ee?I.taskOpen=!0:I.taskClosed=!0,k.highlightFormatting&&(I.formatting="task"),I.taskList=!1,c(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&P.match(/^#+$/,!0))return k.highlightFormatting&&(I.formatting="header"),c(I);var oe=P.next();if(I.linkTitle){I.linkTitle=!1;var pe=oe;oe==="("&&(pe=")"),pe=(pe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Oe="^\\s*(?:[^"+pe+"\\\\]+|\\\\\\\\|\\\\.)"+pe;if(P.match(new RegExp(Oe),!0))return z.linkHref}if(oe==="`"){var Se=I.formatting;k.highlightFormatting&&(I.formatting="code"),P.eatWhile("`");var we=P.current().length;if(I.code==0&&(!I.quote||we==1))return I.code=we,c(I);if(we==I.code){var Te=c(I);return I.code=0,Te}else return I.formatting=Se,c(I)}else if(I.code)return c(I);if(oe==="\\"&&(P.next(),k.highlightFormatting)){var Ce=c(I),me=z.formatting+"-escape";return Ce?Ce+" "+me:me}if(oe==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,k.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="["&&I.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,k.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="]"&&I.imageAltText){k.highlightFormatting&&(I.formatting="image");var Ce=c(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=E,Ce}if(oe==="["&&!I.image)return I.linkText&&P.match(/^.*?\]/)||(I.linkText=!0,k.highlightFormatting&&(I.formatting="link")),c(I);if(oe==="]"&&I.linkText){k.highlightFormatting&&(I.formatting="link");var Ce=c(I);return I.linkText=!1,I.inline=I.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?E:h,Ce}if(oe==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,k.highlightFormatting&&(I.formatting="link");var Ce=c(I);return Ce?Ce+=" ":Ce="",Ce+z.linkInline}if(oe==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,k.highlightFormatting&&(I.formatting="link");var Ce=c(I);return Ce?Ce+=" ":Ce="",Ce+z.linkEmail}if(k.xml&&oe==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=P.string.indexOf(">",P.pos);if(se!=-1){var te=P.string.substring(P.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(I.md_inside=!0)}return P.backUp(1),I.htmlState=le.startState($),d(P,I,L)}if(k.xml&&oe==="<"&&P.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var ce=1,ae=P.pos==1?" ":P.string.charAt(P.pos-2);ce<3&&P.eat(oe);)ce++;var Ae=P.peek()||" ",Re=!/\s/.test(Ae)&&(!l.test(Ae)||/\s/.test(ae)||l.test(ae)),xe=!/\s/.test(ae)&&(!l.test(ae)||/\s/.test(Ae)||l.test(Ae)),ke=null,Pe=null;if(ce%2&&(!I.em&&Re&&(oe==="*"||!xe||l.test(ae))?ke=!0:I.em==oe&&xe&&(oe==="*"||!Re||l.test(Ae))&&(ke=!1)),ce>1&&(!I.strong&&Re&&(oe==="*"||!xe||l.test(ae))?Pe=!0:I.strong==oe&&xe&&(oe==="*"||!Re||l.test(Ae))&&(Pe=!1)),Pe!=null||ke!=null){k.highlightFormatting&&(I.formatting=ke==null?"strong":Pe==null?"em":"strong em"),ke===!0&&(I.em=oe),Pe===!0&&(I.strong=oe);var Te=c(I);return ke===!1&&(I.em=!1),Pe===!1&&(I.strong=!1),Te}}else if(oe===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return c(I);P.backUp(1)}if(k.strikethrough){if(oe==="~"&&P.eatWhile(oe)){if(I.strikethrough){k.highlightFormatting&&(I.formatting="strikethrough");var Te=c(I);return I.strikethrough=!1,Te}else if(P.match(/^[^\s]/,!1))return I.strikethrough=!0,k.highlightFormatting&&(I.formatting="strikethrough"),c(I)}else if(oe===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return c(I);P.backUp(2)}}if(k.emoji&&oe===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,k.highlightFormatting&&(I.formatting="emoji");var je=c(I);return I.emoji=!1,je}return oe===" "&&(P.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),c(I)}function a(P,I){var Y=P.next();if(Y===">"){I.f=I.inline=h,k.highlightFormatting&&(I.formatting="link");var ee=c(I);return ee?ee+=" ":ee="",ee+z.linkInline}return P.match(/^[^>]+/,!0),z.linkInline}function E(P,I){if(P.eatSpace())return null;var Y=P.next();return Y==="("||Y==="["?(I.f=I.inline=x(Y==="("?")":"]"),k.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,c(I)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(P){return function(I,Y){var ee=I.next();if(ee===P){Y.f=Y.inline=h,k.highlightFormatting&&(Y.formatting="link-string");var oe=c(Y);return Y.linkHref=!1,oe}return I.match(y[P]),Y.linkHref=!0,c(Y)}}function B(P,I){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=F,P.next(),k.highlightFormatting&&(I.formatting="link"),I.linkText=!0,c(I)):s(P,I,h)}function F(P,I){if(P.match(/^\]:/,!0)){I.f=I.inline=K,k.highlightFormatting&&(I.formatting="link");var Y=c(I);return I.linkText=!1,Y}return P.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function K(P,I){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?I.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=h,z.linkHref+" url")}var V={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&le.copyState($,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?le.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,I){if(I.formatting=!1,P!=I.thisLine.stream){if(I.header=0,I.hr=!1,P.match(/^\s*$/,!0))return g(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:P},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=L)){var Y=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=Y,I.indentationDiff=null,Y>0)return null}}return I.f(P,I)},innerMode:function(P){return P.block==L?{state:P.htmlState,mode:$}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:V}},indent:function(P,I,Y){return P.block==L&&$.indent?$.indent(P.htmlState,I,Y):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,I,Y):le.Pass},blankLine:g,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},mT4J:function(pt,it,ie){pt.exports={practice:"practice___2GgSp",right:"right___2iW-T",title:"title___2wI-Y",content:"content___39urh",des:"des___3lOLJ",mainBody:"mainBody___2O3bf",sys:"sys___9a4Vo",li:"li___1a3_u",d1:"d1___--jU-",img:"img___3TRW8",bot:"bot___3H4-s",btn:"btn___2pVoZ",b1:"b1___3uZem",b2:"b2___3A6em",d2:"d2___2tiq3",btns:"btns___2p8vO",practiceModal:"practiceModal___15Ue6"}},osHv:function(pt,it,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var J=le.Pos;function k(l,o){return l.line-o.line||l.ch-o.ch}var $="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",O=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+$+"]["+O+"]*)","g");function z(l,o,s,d){this.line=o,this.ch=s,this.cm=l,this.text=l.getLine(o),this.min=d?Math.max(d.from,l.firstLine()):l.firstLine(),this.max=d?Math.min(d.to-1,l.lastLine()):l.lastLine()}function H(l,o){var s=l.cm.getTokenTypeAt(J(l.line,o));return s&&/\btag\b/.test(s)}function U(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function R(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function m(l){for(;;){var o=l.text.indexOf(">",l.ch);if(o==-1){if(U(l))continue;return}if(!H(l,o+1)){l.ch=o+1;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function S(l){for(;;){var o=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(o==-1){if(R(l))continue;return}if(!H(l,o+1)){l.ch=o;continue}M.lastIndex=o,l.ch=o;var s=M.exec(l.text);if(s&&s.index==o)return s}}function D(l){for(;;){M.lastIndex=l.ch;var o=M.exec(l.text);if(!o){if(U(l))continue;return}if(!H(l,o.index+1)){l.ch=o.index+1;continue}return l.ch=o.index+o[0].length,o}}function A(l){for(;;){var o=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(o==-1){if(R(l))continue;return}if(!H(l,o+1)){l.ch=o;continue}var s=l.text.lastIndexOf("/",o),d=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,d?"selfClose":"regular"}}function _(l,o){for(var s=[];;){var d=D(l),w,g=l.line,v=l.ch-(d?d[0].length:0);if(!d||!(w=m(l)))return;if(w=="selfClose")continue;if(d[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==d[2]){s.length=L;break}if(L<0&&(!o||o==d[2]))return{tag:d[2],from:J(g,v),to:J(l.line,l.ch)}}else s.push(d[2])}}function C(l,o){for(var s=[];;){var d=A(l);if(!d)return;if(d=="selfClose"){S(l);continue}var w=l.line,g=l.ch,v=S(l);if(!v)return;if(v[1])s.push(v[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==v[2]){s.length=L;break}if(L<0&&(!o||o==v[2]))return{tag:v[2],from:J(l.line,l.ch),to:J(w,g)}}}}le.registerHelper("fold","xml",function(l,o){for(var s=new z(l,o.line,0);;){var d=D(s);if(!d||s.line!=o.line)return;var w=m(s);if(!w)return;if(!d[1]&&w!="selfClose"){var g=J(s.line,s.ch),v=_(s,d[2]);return v&&k(v.from,g)>0?{from:g,to:v.from}:null}}}),le.findMatchingTag=function(l,o,s){var d=new z(l,o.line,o.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=m(d),g=w&&J(d.line,d.ch),v=w&&S(d);if(!w||!v||k(d,o)>0)return;var L={from:J(d.line,d.ch),to:g,tag:v[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:v[1]?{open:C(d,v[2]),close:L,at:"close"}:(d=new z(l,g.line,g.ch,s),{open:L,close:_(d,v[2]),at:"open"})},le.findEnclosingTag=function(l,o,s,d){for(var w=new z(l,o.line,o.ch,s);;){var g=C(w,d);if(!g)break;var v=new z(l,o.line,o.ch,s),L=_(v,g.tag);if(L)return{open:g,close:L}}},le.scanForClosingTag=function(l,o,s,d){var w=new z(l,o.line,o.ch,d?{from:0,to:d}:null);return _(w,s)}})},p5ED:function(pt,it,ie){"use strict";var le=ie("+L6B"),J=ie("2/Rp"),k=ie("5Dmo"),$=ie("3S7+"),O=ie("k1fw"),M=ie("9og8"),z=ie("tJVT"),H=ie("WmNS"),U=ie.n(H),R=ie("q1tI"),m=ie.n(R),S=ie("vHTk"),D=ie.n(S),A=ie("yEEn"),_=ie("ZW9T"),C=ie("1vsH"),l=ie("V0Rq"),o=ie("m3rI");it.a=function(s){var d,w,g,v,L,b,c,p=s.editOffice,h=p===void 0?"view":p,a=s.data,E=s.theme,y=s.type,x=s.filename,B=s.monacoEditor,F=s.className,K=s.style,V=s.close,P=s.onClose,I=s.hasMask,Y=s.disabledDownload,ee=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),oe=Object(z.a)(ee,2),pe=oe[0],Oe=oe[1],Se=Object(R.useState)(""),we=Object(z.a)(Se,2),Te=we[0],Ce=we[1],me=Object(R.useState)(),se=Object(z.a)(me,2),te=se[0],ce=se[1],ae=window.ENV==="build"?"/react/build":"",Ae=o.a.PROXY_SERVER||location.origin,Re,xe=1024*1024,ke=10*xe,Pe=Object(R.useRef)();(d=a)!==null&&d!==void 0&&d.startsWith("/api")&&y!=="txt"&&(a=o.a.API_SERVER+a),y==="office"&&(Re=Object(C.T)(a).filesize,Re>ke&&(y="other")),x&&B&&(B.filename=x),Object(R.useEffect)(function(){var Ie,tt,Ze=(Ie=document.cookie)===null||Ie===void 0||((tt=Ie.replace(/\s/g,""))===null||tt===void 0)?void 0:tt.split(";");Ze==null||Ze.map(function(Je){var Ye=Je.split("=");Ye[0]==="_educoder_session"&&Ce(Ye[1])})},[]),Object(R.useEffect)(function(){y==="office"&&je()},[y,a]);var je=function(){var Ie=Object(M.a)(U.a.mark(function tt(){var Ze,Je,Ye;return U.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:return console.log("data:",a),Ze=a,a.startsWith("http")||(Ze=location.origin+Ze),Je=new URL(Ze).pathname.split("/").pop(),rt.next=6,Object(l.V)({attachment_id:Je});case 6:Ye=rt.sent,ce(Ye);case 8:case"end":return rt.stop()}},tt)}));return function(){return Ie.apply(this,arguments)}}(),We=function(){if(a.startsWith("http")||a.startsWith("blob:")){Be();return}Object(C.z)(x||"educoder",a,x)},Be=function(){Object(C.x)(x||"educoder",decodeURIComponent(a))};return m.a.createElement("div",{style:Object(O.a)({},K||{}),className:"".concat(I&&D.a.bgBlack," ").concat(y?D.a.wrp:"hide")},V&&m.a.createElement("div",{className:D.a.close,ref:Pe},!Y&&m.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Pe.current}},m.a.createElement("span",{onClick:Be},m.a.createElement("i",{className:"icon-quxiaozhiding"}))),m.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Pe.current}},m.a.createElement("span",{className:"",onClick:P},m.a.createElement("i",{className:"icon-guanbi1"})))),m.a.createElement("div",{className:"".concat(D.a[F]," ").concat(F," ").concat(D.a.monaco," ").concat(y==="txt"?"show":"hide")},y==="txt"&&m.a.createElement(_.b,B)),y==="audio"&&m.a.createElement("audio",{src:"".concat(((w=a)===null||w===void 0?void 0:w.indexOf("http://"))>-1||((g=a)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),y==="video"&&m.a.createElement(m.a.Fragment,null,((v=a)===null||v===void 0?void 0:v.indexOf("http"))>-1?m.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):m.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),y==="office"&&te&&m.a.createElement("iframe",{src:"".concat(ae,"/office.html?key=").concat(te.key,"&url=").concat(Ae+te.url,"&callbackUrl=").concat(Ae+te.callbackUrl,"&fileType=").concat(te.fileType,"&title=").concat(te.title,"&model=").concat(h,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!Y)}),y==="html"&&m.a.createElement("iframe",{src:a+"&disposition=inline"}),y==="pdf"&&m.a.createElement("iframe",{src:"".concat(ae,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!Y)}),y==="image"&&m.a.createElement("img",{src:"".concat(((L=a)===null||L===void 0?void 0:L.indexOf("http://"))>-1||((b=a)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(c=a)!==null&&c!==void 0&&c.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),y==="other"&&m.a.createElement("div",null,m.a.createElement(J.a,{type:"primary",size:"large",onClick:We},m.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),y==="download"&&m.a.createElement(J.a,{type:"primary",size:"large",onClick:We},m.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(pt,it,ie){},qB8g:function(pt,it,ie){pt.exports={flexRow:"flexRow___Aj71W",flexColumn:"flexColumn___2jvSr",formWrap:"formWrap___3OxLN",upload:"upload___2lUf4",color0152d9:"color0152d9___10ICR",colorCCC:"colorCCC___2mbRd",footerWrap:"footerWrap___1Ytvb",qrCode:"qrCode___2RFKG",a1:"a1___HdrHw",code:"code___17cwA",group:"group___DUj4t",groupNumber:"groupNumber___3_2zt",a2:"a2___2_e5C"}},rUJ1:function(pt,it){const ie=/[&<>"']/,le=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},O=b=>$[b];function M(b,c){if(c){if(ie.test(b))return b.replace(le,O)}else if(J.test(b))return b.replace(k,O);return b}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(b){return b.replace(z,(c,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const U=/(^|[^\[])\^/g;function R(b,c){b=b.source||b,c=c||"";const p={replace:(h,a)=>(a=a.source||a,a=a.replace(U,"$1"),b=b.replace(h,a),p),getRegex:()=>new RegExp(b,c)};return p}const m=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(b,c,p){if(b){let h;try{h=decodeURIComponent(H(p)).replace(m,"").toLowerCase()}catch(a){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}c&&!S.test(p)&&(p=o(c,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(h){return null}return p}const A={},_=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,c){A[" "+b]||(_.test(b)?A[" "+b]=b+"/":A[" "+b]=g(b,"/",!0)),b=A[" "+b];const p=b.indexOf(":")===-1;return c.substring(0,2)==="//"?p?c:b.replace(C,"$1")+c:c.charAt(0)==="/"?p?c:b.replace(l,"$1")+c:b+c}const s={exec:function(){}};function d(b){let c=1,p,h;for(;c<arguments.length;c++){p=arguments[c];for(h in p)Object.prototype.hasOwnProperty.call(p,h)&&(b[h]=p[h])}return b}function w(b,c){const p=b.replace(/\|/g,(E,y,x)=>{let B=!1,F=y;for(;--F>=0&&x[F]==="\\";)B=!B;return B?"|":" |"}),h=p.split(/ \|/);let a=0;if(h.length>c)h.splice(c);else for(;h.length<c;)h.push("");for(;a<h.length;a++)h[a]=h[a].trim().replace(/\\\|/g,"|");return h}function g(b,c,p){const h=b.length;if(h===0)return"";let a=0;for(;a<h;){const E=b.charAt(h-a-1);if(E===c&&!p)a++;else if(E!==c&&p)a++;else break}return b.substr(0,h-a)}function v(b,c){if(b.indexOf(c[1])===-1)return-1;const p=b.length;let h=0,a=0;for(;a<p;a++)if(b[a]==="\\")a++;else if(b[a]===c[0])h++;else if(b[a]===c[1]&&(h--,h<0))return a;return-1}function L(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")}pt.exports={escape:M,unescape:H,edit:R,cleanUrl:D,resolveUrl:o,noopTest:s,merge:d,splitCells:w,rtrim:g,findClosingBracket:v,checkSanitizeDeprecation:L}},ulZh:function(pt,it,ie){typeof window!="undefined"&&function(J,k){pt.exports=k()}(this,function(){return function(le){var J={};function k($){if(J[$])return J[$].exports;var O=J[$]={i:$,l:!1,exports:{}};return le[$].call(O.exports,O,O.exports,k),O.l=!0,O.exports}return k.m=le,k.c=J,k.d=function($,O,M){k.o($,O)||Object.defineProperty($,O,{enumerable:!0,get:M})},k.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},k.t=function($,O){if(O&1&&($=k($)),O&8)return $;if(O&4&&typeof $=="object"&&$&&$.__esModule)return $;var M=Object.create(null);if(k.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:$}),O&2&&typeof $!="string")for(var z in $)k.d(M,z,function(H){return $[H]}.bind(null,z));return M},k.n=function($){var O=$&&$.__esModule?function(){return $.default}:function(){return $};return k.d(O,"a",O),O},k.o=function($,O){return Object.prototype.hasOwnProperty.call($,O)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,J,k){"use strict";var $=Object.prototype.hasOwnProperty,O="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(O=!1));function z(m,S,D){this.fn=m,this.context=S,this.once=D||!1}function H(m,S,D,A,_){if(typeof D!="function")throw new TypeError("The listener must be a function");var C=new z(D,A||m,_),l=O?O+S:S;return m._events[l]?m._events[l].fn?m._events[l]=[m._events[l],C]:m._events[l].push(C):(m._events[l]=C,m._eventsCount++),m}function U(m,S){--m._eventsCount===0?m._events=new M:delete m._events[S]}function R(){this._events=new M,this._eventsCount=0}R.prototype.eventNames=function(){var S=[],D,A;if(this._eventsCount===0)return S;for(A in D=this._events)$.call(D,A)&&S.push(O?A.slice(1):A);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(D)):S},R.prototype.listeners=function(S){var D=O?O+S:S,A=this._events[D];if(!A)return[];if(A.fn)return[A.fn];for(var _=0,C=A.length,l=new Array(C);_<C;_++)l[_]=A[_].fn;return l},R.prototype.listenerCount=function(S){var D=O?O+S:S,A=this._events[D];return A?A.fn?1:A.length:0},R.prototype.emit=function(S,D,A,_,C,l){var o=O?O+S:S;if(!this._events[o])return!1;var s=this._events[o],d=arguments.length,w,g;if(s.fn){s.once&&this.removeListener(S,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,D),!0;case 3:return s.fn.call(s.context,D,A),!0;case 4:return s.fn.call(s.context,D,A,_),!0;case 5:return s.fn.call(s.context,D,A,_,C),!0;case 6:return s.fn.call(s.context,D,A,_,C,l),!0}for(g=1,w=new Array(d-1);g<d;g++)w[g-1]=arguments[g];s.fn.apply(s.context,w)}else{var v=s.length,L;for(g=0;g<v;g++){s[g].once&&this.removeListener(S,s[g].fn,void 0,!0);switch(d){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,D);break;case 3:s[g].fn.call(s[g].context,D,A);break;case 4:s[g].fn.call(s[g].context,D,A,_);break;default:if(!w)for(L=1,w=new Array(d-1);L<d;L++)w[L-1]=arguments[L];s[g].fn.apply(s[g].context,w)}}}return!0},R.prototype.on=function(S,D,A){return H(this,S,D,A,!1)},R.prototype.once=function(S,D,A){return H(this,S,D,A,!0)},R.prototype.removeListener=function(S,D,A,_){var C=O?O+S:S;if(!this._events[C])return this;if(!D)return U(this,C),this;var l=this._events[C];if(l.fn)l.fn===D&&(!_||l.once)&&(!A||l.context===A)&&U(this,C);else{for(var o=0,s=[],d=l.length;o<d;o++)(l[o].fn!==D||_&&!l[o].once||A&&l[o].context!==A)&&s.push(l[o]);s.length?this._events[C]=s.length===1?s[0]:s:U(this,C)}return this},R.prototype.removeAllListeners=function(S){var D;return S?(D=O?O+S:S,this._events[D]&&U(this,D)):(this._events=new M,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=O,R.EventEmitter=R,le.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,J,k){(function($){var O=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,U={buildAbsoluteURL:function(R,m,S){if(S=S||{},R=R.trim(),m=m.trim(),!m){if(!S.alwaysNormalize)return R;var D=U.parseURL(R);if(!D)throw new Error("Error trying to parse base URL.");return D.path=U.normalizePath(D.path),U.buildURLFromParts(D)}var A=U.parseURL(m);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return S.alwaysNormalize?(A.path=U.normalizePath(A.path),U.buildURLFromParts(A)):m;var _=U.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");if(!_.netLoc&&_.path&&_.path[0]!=="/"){var C=M.exec(_.path);_.netLoc=C[1],_.path=C[2]}_.netLoc&&!_.path&&(_.path="/");var l={scheme:_.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(l.netLoc=_.netLoc,A.path[0]!=="/"))if(!A.path)l.path=_.path,A.params||(l.params=_.params,A.query||(l.query=_.query));else{var o=_.path,s=o.substring(0,o.lastIndexOf("/")+1)+A.path;l.path=U.normalizePath(s)}return l.path===null&&(l.path=S.alwaysNormalize?U.normalizePath(A.path):A.path),U.buildURLFromParts(l)},parseURL:function(R){var m=O.exec(R);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(z,"");R.length!==(R=R.replace(H,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};le.exports=U})(this)},"./node_modules/webworkify-webpack/index.js":function(le,J,k){function $(S){var D={};function A(C){if(D[C])return D[C].exports;var l=D[C]={i:C,l:!1,exports:{}};return S[C].call(l.exports,l,l.exports,A),l.l=!0,l.exports}A.m=S,A.c=D,A.i=function(C){return C},A.d=function(C,l,o){A.o(C,l)||Object.defineProperty(C,l,{configurable:!1,enumerable:!0,get:o})},A.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},A.n=function(C){var l=C&&C.__esModule?function(){return C.default}:function(){return C};return A.d(l,"a",l),l},A.o=function(C,l){return Object.prototype.hasOwnProperty.call(C,l)},A.p="/",A.oe=function(C){throw console.error(C),C};var _=A(A.s=ENTRY_MODULE);return _.default||_}var O="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+O+").*?\\)";function z(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(S){return!isNaN(1*S)}function U(S,D,A){var _={};_[A]=[];var C=D.toString(),l=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return _;for(var o=l[1],s=new RegExp("(\\\\n|\\W)"+z(o)+M,"g"),d;d=s.exec(C);){if(d[3]==="dll-reference")continue;_[A].push(d[3])}for(s=new RegExp("\\("+z(o)+'\\("(dll-reference\\s('+O+'))"\\)\\)'+M,"g");d=s.exec(C);)S[d[2]]||(_[A].push(d[1]),S[d[2]]=k(d[1]).m),_[d[2]]=_[d[2]]||[],_[d[2]].push(d[4]);for(var w=Object.keys(_),g=0;g<w.length;g++)for(var v=0;v<_[w[g]].length;v++)H(_[w[g]][v])&&(_[w[g]][v]=1*_[w[g]][v]);return _}function R(S){var D=Object.keys(S);return D.reduce(function(A,_){return A||S[_].length>0},!1)}function m(S,D){for(var A={main:[D]},_={main:[]},C={main:{}};R(A);)for(var l=Object.keys(A),o=0;o<l.length;o++){var s=l[o],d=A[s],w=d.pop();if(C[s]=C[s]||{},C[s][w]||!S[s][w])continue;C[s][w]=!0,_[s]=_[s]||[],_[s].push(w);for(var g=U(S,S[s][w],s),v=Object.keys(g),L=0;L<v.length;L++)A[v[L]]=A[v[L]]||[],A[v[L]]=A[v[L]].concat(g[v[L]])}return _}le.exports=function(S,D){D=D||{};var A={main:k.m},_=D.all?{main:Object.keys(A.main)}:m(A,S),C="";Object.keys(_).filter(function(w){return w!=="main"}).forEach(function(w){for(var g=0;_[w][g];)g++;_[w].push(g),A[w][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+w+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+_[w].map(function(v){return""+JSON.stringify(v)+": "+A[w][v].toString()}).join(",")+`});
`}),C=C+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+_.main.map(function(w){return""+JSON.stringify(w)+": "+A.main[w].toString()}).join(",")+"}))(self);";var l=new window.Blob([C],{type:"text/javascript"});if(D.bare)return l;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(l),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"hlsDefaultConfig",function(){return L}),k.d(J,"mergeConfig",function(){return c}),k.d(J,"enableStreamingMode",function(){return p});var $=k("./src/controller/abr-controller.ts"),O=k("./src/controller/audio-stream-controller.ts"),M=k("./src/controller/audio-track-controller.ts"),z=k("./src/controller/subtitle-stream-controller.ts"),H=k("./src/controller/subtitle-track-controller.ts"),U=k("./src/controller/buffer-controller.ts"),R=k("./src/controller/timeline-controller.ts"),m=k("./src/controller/cap-level-controller.ts"),S=k("./src/controller/fps-controller.ts"),D=k("./src/controller/eme-controller.ts"),A=k("./src/controller/cmcd-controller.ts"),_=k("./src/utils/xhr-loader.ts"),C=k("./src/utils/fetch-loader.ts"),l=k("./src/utils/cues.ts"),o=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function d(){return d=Object.assign||function(h){for(var a=1;a<arguments.length;a++){var E=arguments[a];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(h[y]=E[y])}return h},d.apply(this,arguments)}function w(h,a){var E=Object.keys(h);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(h);a&&(y=y.filter(function(x){return Object.getOwnPropertyDescriptor(h,x).enumerable})),E.push.apply(E,y)}return E}function g(h){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?w(Object(E),!0).forEach(function(y){v(h,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(E)):w(Object(E)).forEach(function(y){Object.defineProperty(h,y,Object.getOwnPropertyDescriptor(E,y))})}return h}function v(h,a,E){return a in h?Object.defineProperty(h,a,{value:E,enumerable:!0,configurable:!0,writable:!0}):h[a]=E,h}var L=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:_.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:U.default,capLevelController:m.default,fpsController:S.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:z.SubtitleStreamController,subtitleTrackController:H.default,timelineController:R.TimelineController,audioStreamController:O.default,audioTrackController:M.default,emeController:D.default,cmcdController:A.default});function b(){return{cueHandler:l.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 c(h,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},h,a)}function p(h){var a=h.loader;if(a!==C.default&&a!==_.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var E=Object(C.fetchSupported)();E&&(h.loader=C.default,h.progressive=!0,h.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),O=k("./src/utils/ewma-bandwidth-estimator.ts"),M=k("./src/events.ts"),z=k("./src/utils/buffer-helper.ts"),H=k("./src/errors.ts"),U=k("./src/types/loader.ts"),R=k("./src/utils/logger.ts");function m(A,_){for(var C=0;C<_.length;C++){var l=_[C];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(A,l.key,l)}}function S(A,_,C){return _&&m(A.prototype,_),C&&m(A,C),A}var D=function(){function A(C){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=C;var l=C.config;this.bwEstimator=new O.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var _=A.prototype;return _.registerListeners=function(){var l=this.hls;l.on(M.Events.FRAG_LOADING,this.onFragLoading,this),l.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(M.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var l=this.hls;l.off(M.Events.FRAG_LOADING,this.onFragLoading,this),l.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(M.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},_.onFragLoading=function(l,o){var s=o.frag;if(s.type===U.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},_.onLevelLoaded=function(l,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},_._abandonRulesCheck=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,w=s.config,g=s.media;if(!l||!g)return;var v=o?o.stats:l.stats,L=o?o.duration:l.duration;if(v.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||g.paused||!g.playbackRate||!g.readyState)return;var b=performance.now()-v.loading.start,c=Math.abs(g.playbackRate);if(b<=500*L/c)return;var p=s.levels,h=s.minAutoLevel,a=p[l.level],E=v.total||Math.max(v.loaded,Math.round(L*a.maxBitrate/8)),y=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/b),x=(E-v.loaded)/y,B=g.currentTime,F=(z.BufferHelper.bufferInfo(g,B,w.maxBufferHole).end-B)/c;if(F>=2*L/c||x<=F)return;var K=Number.POSITIVE_INFINITY,V;for(V=l.level-1;V>h;V--){var P=p[V].maxBitrate;if(K=L*P/(8*.8*y),K<F)break}if(K>=x)return;var I=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+l.sn+(o?" part "+o.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object($.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+x.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(b,v.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:o,stats:v})},_.onFragLoaded=function(l,o){var s=o.frag,d=o.part;if(s.type===U.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(s.sn)){var w=d?d.stats:s.stats,g=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],L=(v.loaded?v.loaded.bytes:0)+w.loaded,b=(v.loaded?v.loaded.duration:0)+g;v.loaded={bytes:L,duration:b},v.realBitrate=Math.round(8*L/b)}if(s.bitrateTest){var c={stats:w,frag:s,part:d,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},_.onFragBuffered=function(l,o){var s=o.frag,d=o.part,w=d?d.stats:s.stats;if(w.aborted)return;if(s.type!==U.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=w.parsing.end-w.loading.start;this.bwEstimator.sample(g,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},_.onError=function(l,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},_.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},_.getNextABRAutoLevel=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,d=s.maxAutoLevel,w=s.config,g=s.minAutoLevel,v=s.media,L=o?o.duration:l?l.duration:0,b=v?v.currentTime:0,c=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,h=(z.BufferHelper.bufferInfo(v,b,w.maxBufferHole).end-b)/c,a=this.findBestLevel(p,g,d,h,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,y=w.abrBandWidthFactor,x=w.abrBandWidthUpFactor;if(!h){var B=this.bitrateTestDelay;if(B){var F=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;E=F-B,R.logger.trace("bitrate test took "+Math.round(1e3*B)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),y=x=1}}return a=this.findBestLevel(p,g,d,h+E,y,x),Math.max(a,0)},_.findBestLevel=function(l,o,s,d,w,g){for(var v,L=this.fragCurrent,b=this.partCurrent,c=this.lastLoadedFragLevel,p=this.hls.levels,h=p[c],a=!!(h!=null&&(v=h.details)!==null&&v!==void 0&&v.live),E=h==null?void 0:h.codecSet,y=b?b.duration:L?L.duration:0,x=s;x>=o;x--){var B=p[x];if(!B||E&&B.codecSet!==E)continue;var F=B.details,K=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||y,V=void 0;x<=c?V=w*l:V=g*l;var P=p[x].maxBitrate,I=P*K/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(V)+"/"+P+"/"+K+"/"+d+"/"+I),V>P&&(!I||a&&!this.bitrateTestDelay||I<d))return x}return-1},S(A,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,o=this.bwEstimator;if(l!==-1&&(!o||!o.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),A}();J.default=D},"./src/controller/audio-stream-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),O=k("./src/controller/base-stream-controller.ts"),M=k("./src/events.ts"),z=k("./src/utils/buffer-helper.ts"),H=k("./src/controller/fragment-tracker.ts"),U=k("./src/types/level.ts"),R=k("./src/types/loader.ts"),m=k("./src/loader/fragment.ts"),S=k("./src/demux/chunk-cache.ts"),D=k("./src/demux/transmuxer-interface.ts"),A=k("./src/types/transmuxer.ts"),_=k("./src/controller/fragment-finders.ts"),C=k("./src/utils/discontinuities.ts"),l=k("./src/errors.ts"),o=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(L[p]=c[p])}return L},s.apply(this,arguments)}function d(L,b){L.prototype=Object.create(b.prototype),L.prototype.constructor=L,w(L,b)}function w(L,b){return w=Object.setPrototypeOf||function(p,h){return p.__proto__=h,p},w(L,b)}var g=100,v=function(L){d(b,L);function b(p,h){var a;return a=L.call(this,p,h,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var c=b.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var h=this.hls;h.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(M.Events.ERROR,this.onError,this),h.on(M.Events.BUFFER_RESET,this.onBufferReset,this),h.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var h=this.hls;h.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(M.Events.ERROR,this.onError,this),h.off(M.Events.BUFFER_RESET,this.onBufferReset,this),h.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(h,a){var E=a.frag,y=a.id,x=a.initPTS;if(y==="main"){var B=E.cc;this.initPTS[E.cc]=x,this.log("InitPTS for cc: "+B+" found from main: "+x),this.videoTrackCC=B,this.state===O.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=O.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=O.State.IDLE):(this.loadedmetadata=!1,this.state=O.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},c.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_TRACK:{var h,a=this.levels,E=this.trackId,y=a==null||((h=a[E])===null||h===void 0)?void 0:h.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=O.State.WAITING_INIT_PTS}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var x,B=performance.now(),F=this.retryDate;(!F||B>=F||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=O.State.IDLE);break}case O.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,P=K.part,I=K.cache,Y=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.FRAG_LOADING;var ee=I.flush(),oe={frag:V,part:P,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),Y&&L.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var pe=this.getLoadPosition(),Oe=z.BufferHelper.bufferInfo(this.mediaBuffer,pe,this.config.maxBufferHole),Se=Object(_.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,V);Se<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=O.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.IDLE)},c.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:h,E=a.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},c.doTickIdle=function(){var h,a,E=this.hls,y=this.levels,x=this.media,B=this.trackId,F=E.config;if(!y||!y[B])return;if(!x&&(this.startFragRequested||!F.startFragPrefetch))return;var K=y[B],V=K.details;if(!V||V.live&&this.levelLastLoaded!==B||this.waitForCdnTuneIn(V)){this.state=O.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(P===null)return;var I=P.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(I>=Y&&!ee)return;if(!ee&&this._streamEnded(P,V)){E.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=O.State.ENDED;return}var oe=V.fragments,pe=oe[0].start,Oe=P.end;if(ee){var Se=this.getLoadPosition();Oe=Se,V.PTSKnown&&Se<pe&&((P.end>pe||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=pe+.05))}var we=this.getNextFragment(Oe,V);if(!we){this.bufferFlushed=!0;return}((h=we.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((a=we.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(we,V):this.loadFragment(we,V,Oe)},c.getMaxBufferLength=function(){var h=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?h:Math.max(h,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(h,a){var E=a.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(y){return new U.Level(y)})},c.onAudioTrackSwitching=function(h,a){var E=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(g):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=O.State.IDLE):this.state=O.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(h,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(h,a){var E,y=this.levels,x=a.details,B=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+B);return}this.log("Track "+B+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var F=y[B],K=0;if(x.live||(E=F.details)!==null&&E!==void 0&&E.live){var V=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!V)return;!F.details&&x.hasProgramDateTime&&V.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(x,V),K=x.fragments[0].start):K=this.alignPlaylists(x,F.details)}F.details=x,this.levelLastLoaded=B,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(F.details,K),this.state===O.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=O.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(h){var a,E=h.frag,y=h.part,x=h.payload,B=this.config,F=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var V=K[F];console.assert(V,"Audio track is defined on fragment load progress");var P=V.details;console.assert(P,"Audio track details are defined on fragment load progress");var I=B.defaultAudioCodec||V.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new D.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[E.cc],oe=(a=E.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var pe=!1,Oe=y?y.index:-1,Se=Oe!==-1,we=new A.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,x.byteLength,Oe,Se);Y.push(x,oe,I,"",E,y,P.totalduration,pe,we,ee)}else{o.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+F);var Te=this.waitingData=this.waitingData||{frag:E,part:y,cache:new S.default,complete:!1},Ce=Te.cache;Ce.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=O.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,h)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(h,a){var E=a.tracks.audio;E&&(this.mediaBuffer=E.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(h,a){var E=a.frag,y=a.part;if(E.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(y?" p: "+y.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,y)},c.onError=function(h,a){switch(a.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==O.State.ERROR&&this.state!==O.State.STOPPED&&(this.state=a.fatal?O.State.ERROR:O.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var E=!0,y=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);y&&y.len>.5&&(E=!this.reduceMaxBufferLength(y.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(h,a){var E=a.type;E===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(h){var a,E="audio",y=this.hls,x=h.remuxResult,B=h.chunkMeta,F=this.getCurrentContext(B);if(!F){this.warn("The loading context changed while buffering fragment "+B.sn+" of level "+B.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(B.level);return}var K=F.frag,V=F.part,P=x.audio,I=x.text,Y=x.id3,ee=x.initSegment;if(this.fragContextChanged(K))return;if(this.state=O.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,B),y.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:E,tracks:ee.tracks})),P){var oe=P.startPTS,pe=P.endPTS,Oe=P.startDTS,Se=P.endDTS;V&&(V.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:pe,startDTS:Oe,endDTS:Se}),K.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,oe,pe,Oe,Se),this.bufferFragmentData(P,K,V,B)}if(Y!=null&&(a=Y.samples)!==null&&a!==void 0&&a.length){var we=s({frag:K,id:E},Y);y.trigger(M.Events.FRAG_PARSING_METADATA,we)}if(I){var Te=s({frag:K,id:E},I);y.trigger(M.Events.FRAG_PARSING_USERDATA,Te)}},c._bufferInitSegment=function(h,a,E){if(this.state!==O.State.PARSING)return;h.video&&delete h.video;var y=h.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,h);var x=y.initSegment;if(x!=null&&x.byteLength){var B={type:"audio",frag:a,part:null,chunkMeta:E,parent:a.type,data:x};this.hls.trigger(M.Events.BUFFER_APPENDING,B)}this.tick()},c.loadFragment=function(h,a,E){var y=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||y===H.FragmentState.NOT_LOADED||y===H.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):a.live&&!Object($.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=O.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,h,a,E)))},c.completeAudioSwitch=function(){var h=this.hls,a=this.media,E=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:E})},b}(O.default);J.default=v},"./src/controller/audio-track-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),O=k("./src/errors.ts"),M=k("./src/controller/base-playlist-controller.ts"),z=k("./src/types/loader.ts");function H(D,A){for(var _=0;_<A.length;_++){var C=A[_];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(D,C.key,C)}}function U(D,A,_){return A&&H(D.prototype,A),_&&H(D,_),D}function R(D,A){D.prototype=Object.create(A.prototype),D.prototype.constructor=D,m(D,A)}function m(D,A){return m=Object.setPrototypeOf||function(C,l){return C.__proto__=l,C},m(D,A)}var S=function(D){R(A,D);function A(C){var l;return l=D.call(this,C,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var _=A.prototype;return _.registerListeners=function(){var l=this.hls;l.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on($.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var l=this.hls;l.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off($.Events.ERROR,this.onError,this)},_.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,D.prototype.destroy.call(this)},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},_.onManifestParsed=function(l,o){this.tracks=o.audioTracks||[]},_.onAudioTrackLoaded=function(l,o){var s=o.id,d=o.details,w=this.tracksInGroup[s];if(!w){this.warn("Invalid audio track id "+s);return}var g=w.details;w.details=o.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,g))},_.onLevelLoading=function(l,o){this.switchLevel(o.level)},_.onLevelSwitching=function(l,o){this.switchLevel(o.level)},_.switchLevel=function(l){var o=this.hls.levels[l];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var d=this.tracks.filter(function(g){return!s||g.groupId===s});this.selectDefaultTrack&&!d.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},_.onError=function(l,o){if(D.prototype.onError.call(this,l,o),o.fatal||!o.context)return;o.context.type===z.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},_.setAudioTrack=function(l){var o=this.tracksInGroup;if(l<0||l>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+l);var d=o[l],w=d.id,g=d.groupId,v=g===void 0?"":g,L=d.name,b=d.type,c=d.url;if(this.trackId=l,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:v,name:L,type:b,url:c}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(p)},_.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},_.findTrackId=function(l){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var d=o[s];if((!this.selectDefaultTrack||d.default)&&(!l||l===d.name))return d.id}return-1},_.loadPlaylist=function(l){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,d=o.groupId,w=o.url;if(l)try{w=l.addDirectives(w)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:w,id:s,groupId:d,deliveryDirectives:l||null})}},U(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),A}(M.default);J.default=S},"./src/controller/base-playlist-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return U});var $=k("./src/polyfills/number.ts"),O=k("./src/types/level.ts"),M=k("./src/controller/level-helper.ts"),z=k("./src/utils/logger.ts"),H=k("./src/errors.ts"),U=function(){function R(S,D){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=z.logger.log.bind(z.logger,D+":"),this.warn=z.logger.warn.bind(z.logger,D+":"),this.hls=S}var m=R.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(D,A){A.fatal&&A.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(D,A){var _=A==null?void 0:A.renditionReports;if(_)for(var C=0;C<_.length;C++){var l=_[C],o=""+l.URI;if(o===D.substr(-o.length)){var s=parseInt(l["LAST-MSN"]),d=parseInt(l["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var w=Math.min(A.age-A.partTarget,A.targetduration);d!==void 0&&w>A.partTarget&&(d+=1)}if(Object($.isFiniteNumber)(s))return new O.HlsUrlParameters(s,Object($.isFiniteNumber)(d)?d:void 0,O.HlsSkip.No)}}},m.loadPlaylist=function(D){},m.shouldLoadTrack=function(D){return this.canLoad&&D&&!!D.url&&(!D.details||D.details.live)},m.playlistLoaded=function(D,A,_){var C=this,l=A.details,o=A.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||_!=null&&_.live){if(l.reloaded(_),_&&this.log("live playlist "+D+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),_&&l.fragments.length>0&&Object(M.mergeDetails)(_,l),!this.canLoad||!l.live)return;var d,w=void 0,g=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var v=this.hls.config.lowLatencyMode,L=l.lastPartSn,b=l.endSN,c=l.lastPartIndex,p=c!==-1,h=L===b,a=v?0:c;p?(w=h?b+1:L,g=h?a:c+1):w=b+1;var E=l.age,y=E+l.ageHeader,x=Math.min(y-l.partTarget,l.targetduration*1.5);if(x>0){if(_&&x>_.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+_.tuneInGoal+" to: "+x+" with playlist age: "+l.age),x=0;else{var B=Math.floor(x/l.targetduration);if(w+=B,g!==void 0){var F=Math.round(x%l.targetduration/l.partTarget);g+=F}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+x+" skip sn "+B+" to part "+g)}l.tuneInGoal=x}if(d=this.getDeliveryDirectives(l,A.deliveryDirectives,w,g),v||!h){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(l,A.deliveryDirectives,w,g);var K=Object(M.computeReloadInterval)(l,o);w!==void 0&&l.canBlockReload&&(K-=l.partTarget||1),this.log("reload live playlist "+D+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(d)},K)}else this.clearTimer()},m.getDeliveryDirectives=function(D,A,_,C){var l=Object(O.getSkipValue)(D,_);return A!=null&&A.skip&&D.deltaUpdateFailed&&(_=A.msn,C=A.part,l=O.HlsSkip.No),new O.HlsUrlParameters(_,C,l)},m.retryLoadingOrFail=function(D){var A=this,_=this.hls.config,C=this.retryCount<_.levelLoadingMaxRetry;if(C){var l;if(this.retryCount++,D.details.indexOf("LoadTimeOut")>-1&&(l=D.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+D.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*_.levelLoadingRetryDelay,_.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+D.details+'"')}}else this.warn('cannot recover from error "'+D.details+'"'),this.clearTimer(),D.fatal=!0;return C},R}()},"./src/controller/base-stream-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"State",function(){return b}),k.d(J,"default",function(){return c});var $=k("./src/polyfills/number.ts"),O=k("./src/task-loop.ts"),M=k("./src/controller/fragment-tracker.ts"),z=k("./src/utils/buffer-helper.ts"),H=k("./src/utils/logger.ts"),U=k("./src/events.ts"),R=k("./src/errors.ts"),m=k("./src/types/transmuxer.ts"),S=k("./src/utils/mp4-tools.ts"),D=k("./src/utils/discontinuities.ts"),A=k("./src/controller/fragment-finders.ts"),_=k("./src/controller/level-helper.ts"),C=k("./src/loader/fragment-loader.ts"),l=k("./src/crypt/decrypter.ts"),o=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function d(p,h){for(var a=0;a<h.length;a++){var E=h[a];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(p,E.key,E)}}function w(p,h,a){return h&&d(p.prototype,h),a&&d(p,a),p}function g(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function v(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,L(p,h)}function L(p,h){return L=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},L(p,h)}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"},c=function(p){v(h,p);function h(E,y,x){var B;return B=p.call(this)||this,B.hls=void 0,B.fragPrevious=null,B.fragCurrent=null,B.fragmentTracker=void 0,B.transmuxer=null,B._state=b.STOPPED,B.media=void 0,B.mediaBuffer=void 0,B.config=void 0,B.bitrateTest=!1,B.lastCurrentTime=0,B.nextLoadPosition=0,B.startPosition=0,B.loadedmetadata=!1,B.fragLoadError=0,B.retryDate=0,B.levels=null,B.fragmentLoader=void 0,B.levelLastLoaded=null,B.startFragRequested=!1,B.decrypter=void 0,B.initPTS=[],B.onvseeking=null,B.onvended=null,B.logPrefix="",B.log=void 0,B.warn=void 0,B.logPrefix=x,B.log=H.logger.log.bind(H.logger,x+":"),B.warn=H.logger.warn.bind(H.logger,x+":"),B.hls=E,B.fragmentLoader=new C.default(E.config),B.fragmentTracker=y,B.config=E.config,B.decrypter=new l.default(E,E.config),E.on(U.Events.KEY_LOADED,B.onKeyLoaded,g(B)),B}var a=h.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(y,x){var B=this.fragCurrent,F=this.fragmentTracker;if(!x.live&&B&&B.sn===x.endSN&&!y.nextStart){var K=F.getState(B);return K===M.FragmentState.PARTIAL||K===M.FragmentState.OK}return!1},a.onMediaAttached=function(y,x){var B=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),B.addEventListener("seeking",this.onvseeking),B.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.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 y=this.config,x=this.fragCurrent,B=this.media,F=this.mediaBuffer,K=this.state,V=B?B.currentTime:0,P=z.BufferHelper.bufferInfo(F||B,V,y.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===b.ENDED)this.resetLoadingState();else if(x&&!P.len){var I=y.maxFragLookUpTolerance,Y=x.start-I,ee=x.start+x.duration+I,oe=V>ee;(V<Y||oe)&&(oe&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}B&&(this.lastCurrentTime=V),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var B=this.levels[x.frag.level].details;B&&this.loadFragment(x.frag,B,x.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(U.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,p.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(y,x){this.log("Loading key for "+y.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(U.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,x,B){this._loadFragForPlayback(y,x,B)},a._loadFragForPlayback=function(y,x,B){var F=this,K=function(P){if(F.fragContextChanged(y)){F.warn("Fragment "+y.sn+(P.part?" p: "+P.part.index:"")+" of level "+y.level+" was dropped during download."),F.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,F._handleFragmentLoadProgress(P)};this._doFragLoad(y,x,B,K).then(function(V){if(!V)return;F.fragLoadError=0;var P=F.state;if(F.fragContextChanged(y)){(P===b.FRAG_LOADING||P===b.BACKTRACKING||!F.fragCurrent&&P===b.PARSING)&&(F.fragmentTracker.removeFragment(y),F.state=b.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+y.sn+" of level "+y.level),F.hls.trigger(U.Events.FRAG_LOADED,V),F.state===b.BACKTRACKING)){F.fragmentTracker.backtrack(y,V),F.resetFragmentLoading(y);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,x,B){if(B===void 0&&(B=null),!(y-x))return;var F={startOffset:y,endOffset:x,type:B};this.fragLoadError=0,this.hls.trigger(U.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(y){var x=this;this._doFragLoad(y).then(function(B){if(!B||x.fragContextChanged(y)||!x.levels)throw new Error("init load aborted");return B}).then(function(B){var F=x.hls,K=B.payload,V=y.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var P=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(I){var Y=self.performance.now();return F.trigger(U.Events.FRAG_DECRYPTED,{frag:y,payload:I,stats:{tstart:P,tdecrypt:Y}}),B.payload=I,B})}return B}).then(function(B){var F=x.fragCurrent,K=x.hls,V=x.levels;if(!V)throw new Error("init load aborted, missing levels");var P=V[y.level].details;console.assert(P,"Level details are defined when init segment is loaded");var I=y.stats;x.state=b.IDLE,x.fragLoadError=0,y.data=new Uint8Array(B.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),B.frag===F&&K.trigger(U.Events.FRAG_BUFFERED,{stats:I,frag:F,part:null,id:y.type}),x.tick()}).catch(function(B){x.warn(B),x.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var x=this.fragCurrent;return!y||!x||y.level!==x.level||y.sn!==x.sn||y.urlId!==x.urlId},a.fragBufferedComplete=function(y,x){var B=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(z.BufferHelper.getBuffered(B))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var x=this.transmuxer;if(!x)return;var B=y.frag,F=y.part,K=y.partsLoaded,V=!K||K.length===0||K.some(function(I){return!I}),P=new m.ChunkMetadata(B.level,B.sn,B.stats.chunkCount+1,0,F?F.index:-1,!V);x.flush(P)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,x,B,F){var K=this;if(B===void 0&&(B=null),!this.levels)throw new Error("frag load aborted, missing levels");if(B=Math.max(y.start,B||0),this.config.lowLatencyMode&&x){var V=x.partList;if(V&&F){B>y.end&&x.fragmentHint&&(y=x.fragmentHint);var P=this.getNextPart(V,y,B);if(P>-1){var I=V[P];return this.log("Loading part sn: "+y.sn+" p: "+I.index+" cc: "+y.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+P+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(B.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=b.FRAG_LOADING,this.hls.trigger(U.Events.FRAG_LOADING,{frag:y,part:V[P],targetBufferTime:B}),this.doFragPartsLoad(y,V,P,F).catch(function(Y){return K.handleFragLoadError(Y)})}else if(!y.url||this.loadedEndOfParts(V,B))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(B.toFixed(3))),Object($.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(U.Events.FRAG_LOADING,{frag:y,targetBufferTime:B}),this.fragmentLoader.load(y,F).catch(function(Y){return K.handleFragLoadError(Y)})},a.doFragPartsLoad=function(y,x,B,F){var K=this;return new Promise(function(V,P){var I=[],Y=function ee(oe){var pe=x[oe];K.fragmentLoader.loadPart(y,pe,F).then(function(Oe){I[pe.index]=Oe;var Se=Oe.part;K.hls.trigger(U.Events.FRAG_LOADED,Oe);var we=x[oe+1];if(we&&we.fragment===y)ee(oe+1);else return V({frag:y,part:Se,partsLoaded:I})}).catch(P)};Y(B)})},a.handleFragLoadError=function(y){var x=y.data;return x&&x.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(U.Events.ERROR,x),null},a._handleTransmuxerFlush=function(y){var x=this.getCurrentContext(y);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var B=x.frag,F=x.part,K=x.level,V=self.performance.now();B.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(B,F,K,y.partial)},a.getCurrentContext=function(y){var x=this.levels,B=y.level,F=y.sn,K=y.part;if(!x||!x[B])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+B+". The current chunk will not be buffered."),null;var V=x[B],P=K>-1?Object(_.getPartWith)(V,F,K):null,I=P?P.fragment:Object(_.getFragmentWithSN)(V,F,this.fragCurrent);return I?{frag:I,part:P,level:V}:null},a.bufferFragmentData=function(y,x,B,F){if(!y||this.state!==b.PARSING)return;var K=y.data1,V=y.data2,P=K;if(K&&V&&(P=Object(S.appendUint8Array)(K,V)),!P||!P.length)return;var I={type:y.type,frag:x,part:B,chunkMeta:F,parent:x.type,data:P};this.hls.trigger(U.Events.BUFFER_APPENDING,I),y.dropped&&y.independent&&!B&&this.flushBufferGap(x)},a.flushBufferGap=function(y){var x=this.media;if(!x)return;if(!z.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,y.start);return}var B=x.currentTime,F=z.BufferHelper.bufferInfo(x,B,0),K=y.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),P=Math.max(Math.min(y.start-V,F.end-V),B+V);y.start-P>V&&this.flushMainBuffer(P,y.start)},a.getFwdBufferInfo=function(y,x){var B=this.config,F=this.getLoadPosition();if(!Object($.isFiniteNumber)(F))return null;var K=z.BufferHelper.bufferInfo(y,F,B.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,x);if(V&&K.nextStart<V.end)return z.BufferHelper.bufferInfo(y,F,Math.max(K.nextStart,B.maxBufferHole))}return K},a.getMaxBufferLength=function(y){var x=this.config,B;return y?B=Math.max(8*x.maxBufferSize/y,x.maxBufferLength):B=x.maxBufferLength,Math.min(B,x.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var x=this.config,B=y||x.maxBufferLength;return x.maxMaxBufferLength>=B?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,x){var B,F,K=x.fragments,V=K.length;if(!V)return null;var P=this.config,I=K[0].start,Y;if(x.live){var ee=P.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(x,K),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:y)}else y<=I&&(Y=K[0]);if(!Y){var oe=P.lowLatencyMode?x.partEnd:x.fragmentEnd;Y=this.getFragmentAtPosition(y,oe,x)}return(B=Y)!==null&&B!==void 0&&B.initSegment&&!((F=Y)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},a.getNextPart=function(y,x,B){for(var F=-1,K=!1,V=!0,P=0,I=y.length;P<I;P++){var Y=y[P];if(V=V&&!Y.independent,F>-1&&B<Y.start)break;var ee=Y.loaded;!ee&&(K||Y.independent||V)&&Y.fragment===x&&(F=P),K=ee}return F},a.loadedEndOfParts=function(y,x){var B=y[y.length-1];return B&&x>B.start&&B.loaded},a.getInitialLiveFragment=function(y,x){var B=this.fragPrevious,F=null;if(B){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+B.programDateTime),F=Object(A.findFragmentByPDT)(x,B.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var K=B.sn+1;if(K>=y.startSN&&K<=y.endSN){var V=x[K-y.startSN];B.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(A.findFragWithCC)(x,B.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(F=this.getFragmentAtPosition(P,this.bitrateTest?y.fragmentEnd:y.edge,y))}return F},a.getFragmentAtPosition=function(y,x,B){var F=this.config,K=this.fragPrevious,V=B.fragments,P=B.endSN,I=B.fragmentHint,Y=F.maxFragLookUpTolerance,ee=!!(F.lowLatencyMode&&B.partList&&I);ee&&I&&!this.bitrateTest&&(V=V.concat(I),P=I.sn);var oe;if(y<x){var pe=y>x-Y?0:Y;oe=Object(A.findFragmentByPTS)(K,V,y,pe)}else oe=V[V.length-1];if(oe){var Oe=oe.sn-B.startSN,Se=K&&oe.level===K.level,we=V[Oe+1],Te=this.fragmentTracker.getState(oe);if(Te===M.FragmentState.BACKTRACKED){oe=null;for(var Ce=Oe;V[Ce]&&this.fragmentTracker.getState(V[Ce])===M.FragmentState.BACKTRACKED;)K?oe=V[Ce--]:oe=V[--Ce];oe||(oe=we)}else K&&oe.sn===K.sn&&!ee&&(Se&&(oe.sn<P&&this.fragmentTracker.getState(we)!==M.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+we.sn),oe=we):oe=null))}return oe},a.synchronizeToLiveEdge=function(y){var x=this.config,B=this.media;if(!B)return;var F=this.hls.liveSyncPosition,K=B.currentTime,V=y.fragments[0].start,P=y.edge,I=K>=V-x.maxFragLookUpTolerance&&K<=P;if(F!==null&&B.duration>F&&(K<F||!I)){var Y=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*y.targetduration;(!I&&B.readyState<4||K<P-Y)&&(this.loadedmetadata||(this.nextLoadPosition=F),B.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+F.toFixed(3)),B.currentTime=F))}},a.alignPlaylists=function(y,x){var B=this.levels,F=this.levelLastLoaded,K=this.fragPrevious,V=F!==null?B[F]:null,P=y.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var I=y.fragments[0].start,Y=!x,ee=y.alignedSliding&&Object($.isFiniteNumber)(I);if(Y||!ee&&!I){Object(D.alignStream)(K,V,y);var oe=y.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+y.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+P),oe}return I},a.waitForCdnTuneIn=function(y){var x=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*x)},a.setStartPosition=function(y,x){var B=this.startPosition;if(B<x&&(B=-1),B===-1||this.lastCurrentTime===-1){var F=y.startTimeOffset;Object($.isFiniteNumber)(F)?(B=x+F,F<0&&(B+=y.totalduration),B=Math.min(Math.max(x,B),x+y.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+B),this.startPosition=B):y.live?B=this.hls.liveSyncPosition||x:this.startPosition=B=0,this.lastCurrentTime=B}this.nextLoadPosition=B},a.getLoadPosition=function(){var y=this.media,x=0;return this.loadedmetadata&&y?x=y.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},a.handleFragLoadAborted=function(y,x){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(x?" part"+x.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(y,x){if(x.fatal)return;var B=x.frag;if(!B||B.type!==y)return;var F=this.fragCurrent;console.assert(F&&B.sn===F.sn&&B.level===F.level&&B.urlId===F.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(B.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+B.sn+" of "+y+" "+B.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(y===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(H.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(y,x,B){if(!y)return;var F=z.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(x,F,B),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[y].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,x,B,F){var K=this,V=B.details;console.assert(!!V,"level.details must be defined");var P=Object.keys(y.elementaryStreams).reduce(function(I,Y){var ee=y.elementaryStreams[Y];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+y.sn+" "+Y+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),I||!1;var pe=F?0:Object(_.updateFragPTSDTS)(V,y,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(U.Events.LEVEL_PTS_UPDATED,{details:V,level:B,drift:pe,type:Y,frag:y,start:ee.startPTS,end:ee.endPTS}),!0}return I},!1);P?(this.state=b.PARSED,this.hls.trigger(U.Events.FRAG_PARSED,{frag:y,part:x})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(h,[{key:"state",get:function(){return this._state},set:function(y){var x=this._state;x!==y&&(this._state=y,this.log(x+"->"+y))}}]),h}(O.default)},"./src/controller/buffer-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return A});var $=k("./src/polyfills/number.ts"),O=k("./src/events.ts"),M=k("./src/utils/logger.ts"),z=k("./src/errors.ts"),H=k("./src/utils/buffer-helper.ts"),U=k("./src/utils/mediasource-helper.ts"),R=k("./src/loader/fragment.ts"),m=k("./src/controller/buffer-operation-queue.ts"),S=Object(U.getMediaSource)(),D=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function _(l){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 s=o.hls,d=o.media,w=o.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),s.trigger(O.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var C=_.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.registerListeners=function(){var o=this.hls;o.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(O.Events.BUFFER_RESET,this.onBufferReset,this),o.on(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(O.Events.BUFFER_EOS,this.onBufferEos,this),o.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(O.Events.FRAG_PARSED,this.onFragParsed,this),o.on(O.Events.FRAG_CHANGED,this.onFragChanged,this)},C.unregisterListeners=function(){var o=this.hls;o.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(O.Events.BUFFER_RESET,this.onBufferReset,this),o.off(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(O.Events.BUFFER_EOS,this.onBufferEos,this),o.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(O.Events.FRAG_PARSED,this.onFragParsed,this),o.off(O.Events.FRAG_CHANGED,this.onFragChanged,this)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.onManifestParsed=function(o,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},C.onMediaAttaching=function(o,s){var d=this.media=s.media;if(d&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},C.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(w){M.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):M.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(O.Events.MEDIA_DETACHED,void 0)},C.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var d=o.sourceBuffer[s];try{d&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[s]=void 0)}catch(w){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",w)}}),this._initSourceBuffer()},C.onBufferCodecs=function(o,s){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(w){var v=d.tracks[g];if(v&&typeof v.buffer.changeType=="function"){var L=s[g],b=L.codec,c=L.levelCodec,p=L.container,h=(v.levelCodec||v.codec).replace(D,"$1"),a=(c||b).replace(D,"$1");if(h!==a){var E=p+";codecs="+(c||b);d.appendChangeType(g,E)}}}else d.pendingTracks[g]=s[g]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(o,s){var d=this,w=this.operationQueue,g={execute:function(){var L=d.sourceBuffer[o];L&&(M.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),L.changeType(s)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){M.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(g,o)},C.onBufferAppending=function(o,s){var d=this,w=this.hls,g=this.operationQueue,v=this.tracks,L=s.data,b=s.type,c=s.frag,p=s.part,h=s.chunkMeta,a=h.buffering[b],E=self.performance.now();a.start=E;var y=c.stats.buffering,x=p?p.stats.buffering:null;y.start===0&&(y.start=E),x&&x.start===0&&(x.start=E);var B=v.audio,F=b==="audio"&&h.id===1&&(B==null?void 0:B.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),F){var P=d.sourceBuffer[b];if(P){var I=c.start-P.timestampOffset;Math.abs(I)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+I+") sn: "+c.sn+")"),P.timestampOffset=c.start)}}d.appendExecutor(L,b)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,y.first===0&&(y.first=P),x&&x.first===0&&(x.first=P);var I=d.sourceBuffer,Y={};for(var ee in I)Y[ee]=H.BufferHelper.getBuffered(I[ee]);d.appendError=0,d.hls.trigger(O.Events.BUFFER_APPENDED,{type:b,frag:c,part:p,chunkMeta:h,parent:c.type,timeRanges:Y})},onError:function(P){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",P);var I={type:z.ErrorTypes.MEDIA_ERROR,parent:c.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=z.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,I.details=z.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),w.trigger(O.Events.ERROR,I)}};g.append(K,b)},C.onBufferFlushing=function(o,s){var d=this,w=this.operationQueue,g=function(L){return{execute:d.removeExecutor.bind(d,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(O.Events.BUFFER_FLUSHED,{type:L})},onError:function(c){M.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",c)}}};s.type?w.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){w.append(g(v),v)})},C.onFragParsed=function(o,s){var d=this,w=s.frag,g=s.part,v=[],L=g?g.elementaryStreams:w.elementaryStreams;L[R.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(L[R.ElementaryStreamTypes.AUDIO]&&v.push("audio"),L[R.ElementaryStreamTypes.VIDEO]&&v.push("video"));var b=function(){var p=self.performance.now();w.stats.buffering.end=p,g&&(g.stats.buffering.end=p);var h=g?g.stats:w.stats;d.hls.trigger(O.Events.FRAG_BUFFERED,{frag:w,part:g,stats:h,id:w.type})};v.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,v)},C.onFragChanged=function(o,s){this.flushBackBuffer()},C.onBufferEos=function(o,s){var d=this,w=this.getSourceBufferTypes().reduce(function(g,v){var L=d.sourceBuffer[v];return(!s.type||s.type===v)&&(L&&!L.ended&&(L.ended=!0,M.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),g&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var g=d.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},C.onLevelUpdated=function(o,s){var d=s.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},C.flushBackBuffer=function(){var o=this.hls,s=this.details,d=this.media,w=this.sourceBuffer;if(!d||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var v=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object($.isFiniteNumber)(v)||v<0)return;var L=d.currentTime,b=s.levelTargetDuration,c=Math.max(v,b),p=Math.floor(L/b)*b-c;g.forEach(function(h){var a=w[h];if(a){var E=H.BufferHelper.getBuffered(a);E.length>0&&p>E.start(0)&&(o.trigger(O.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),s.live&&o.trigger(O.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(O.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:h}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,d=this.media,w=this.mediaSource,g=o.fragments[0].start+o.totalduration,v=d.duration,L=Object($.isFiniteNumber)(w.duration)?w.duration:0;o.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(g>L&&g>v||!Object($.isFiniteNumber)(v))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),w.duration=g)},C.updateSeekableRange=function(o){var s=this.mediaSource,d=o.fragments,w=d.length;if(w&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,d[0].start),v=Math.max(g,g+o.totalduration);s.setLiveSeekableRange(g,v)}},C.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!o||w===2){this.createSourceBuffers(d),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(O.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(v){s.executeNext(v)})}},C.createSourceBuffers=function(o){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var g in o)if(!s[g]){var v=o[g];if(!v)throw Error("source buffer exists for track "+g+", however track does not");var L=v.levelCodec||v.codec,b=v.container+";codecs="+L;M.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var c=s[g]=d.addSourceBuffer(b),p=g;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[g]={buffer:c,codec:L,container:v.container,levelCodec:v.levelCodec,id:v.id},w++}catch(h){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(O.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:b})}}w&&this.hls.trigger(O.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(o){var s=this.operationQueue,d=s.current(o);d.onStart()},C._onSBUpdateEnd=function(o){var s=this.operationQueue,d=s.current(o);d.onComplete(),s.shiftAndExecuteNext(o)},C._onSBUpdateError=function(o,s){M.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(O.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(s)},C.removeExecutor=function(o,s,d){var w=this.media,g=this.mediaSource,v=this.operationQueue,L=this.sourceBuffer,b=L[o];if(!w||!g||!b){M.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(o);return}var c=Object($.isFiniteNumber)(w.duration)?w.duration:Infinity,p=Object($.isFiniteNumber)(g.duration)?g.duration:Infinity,h=Math.max(0,s),a=Math.min(d,c,p);a>h?(M.logger.log("[buffer-controller]: Removing ["+h+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(h,a)):v.shiftAndExecuteNext(o)},C.appendExecutor=function(o,s){var d=this.operationQueue,w=this.sourceBuffer,g=w[s];if(!g){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(o)},C.blockBuffers=function(o,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,g=s.map(function(v){return w.appendBlocker(v)});Promise.all(g).then(function(){o(),s.forEach(function(v){var L=d.sourceBuffer[v];(!L||!L.updating)&&w.shiftAndExecuteNext(v)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(o,s,d){var w=this.sourceBuffer[o];if(!w)return;var g=d.bind(this,o);this.listeners[o].push({event:s,listener:g}),w.addEventListener(s,g)},C.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(d){s.removeEventListener(d.event,d.listener)})},_}()},"./src/controller/buffer-operation-queue.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return O});var $=k("./src/utils/logger.ts"),O=function(){function M(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var z=M.prototype;return z.append=function(U,R){var m=this.queues[R];m.push(U),m.length===1&&this.buffers[R]&&this.executeNext(R)},z.insertAbort=function(U,R){var m=this.queues[R];m.unshift(U),this.executeNext(R)},z.appendBlocker=function(U){var R,m=new Promise(function(D){R=D}),S={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,U),m},z.executeNext=function(U){var R=this.buffers,m=this.queues,S=R[U],D=m[U];if(D.length){var A=D[0];try{A.execute()}catch(_){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(_),(!S||!S.updating)&&(D.shift(),this.executeNext(U))}}},z.shiftAndExecuteNext=function(U){this.queues[U].shift(),this.executeNext(U)},z.current=function(U){return this.queues[U][0]},M}()},"./src/controller/cap-level-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts");function O(H,U){for(var R=0;R<U.length;R++){var m=U[R];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(H,m.key,m)}}function M(H,U,R){return U&&O(H.prototype,U),R&&O(H,R),H}var z=function(){function H(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var U=H.prototype;return U.setStreamController=function(m){this.streamController=m},U.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},U.registerListeners=function(){var m=this.hls;m.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},U.unregisterListener=function(){var m=this.hls;m.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},U.onFpsDropLevelCapping=function(m,S){H.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},U.onMediaAttaching=function(m,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},U.onManifestParsed=function(m,S){var D=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,D.config.capLevelToPlayerSize&&S.video&&this.startCapping()},U.onBufferCodecs=function(m,S){var D=this.hls;D.config.capLevelToPlayerSize&&S.video&&this.startCapping()},U.onMediaDetaching=function(){this.stopCapping()},U.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(m.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},U.getMaxLevel=function(m){var S=this,D=this.hls.levels;if(!D.length)return-1;var A=D.filter(function(_,C){return H.isLevelAllowed(C,S.restrictedLevels)&&C<=m});return this.clientRect=null,H.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},U.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()},U.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},U.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,S={width:0,height:0};if(m){var D=m.getBoundingClientRect();S.width=D.width,S.height=D.height,!S.width&&!S.height&&(S.width=D.right-D.left||m.width||0,S.height=D.bottom-D.top||m.height||0)}return this.clientRect=S,S},H.isLevelAllowed=function(m,S){return S===void 0&&(S=[]),S.indexOf(m)===-1},H.getMaxLevelByMediaSize=function(m,S,D){if(!m||!m.length)return-1;for(var A=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},_=m.length-1,C=0;C<m.length;C+=1){var l=m[C];if((l.width>=S||l.height>=D)&&A(l,m[C+1])){_=C;break}}return _},M(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(S){}return m}}]),H}();J.default=z},"./src/controller/cmcd-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return A});var $=k("./src/events.ts"),O=k("./src/types/cmcd.ts"),M=k("./src/utils/buffer-helper.ts"),z=k("./src/utils/logger.ts");function H(_,C){for(var l=0;l<C.length;l++){var o=C[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(_,o.key,o)}}function U(_,C,l){return C&&H(_.prototype,C),l&&H(_,l),_}function R(_,C){var l=typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(l)return(l=l.call(_)).next.bind(l);if(Array.isArray(_)||(l=m(_))||C&&_&&typeof _.length=="number"){l&&(_=l);var o=0;return function(){return o>=_.length?{done:!0}:{done:!1,value:_[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 m(_,C){if(!_)return;if(typeof _=="string")return S(_,C);var l=Object.prototype.toString.call(_).slice(8,-1);if(l==="Object"&&_.constructor&&(l=_.constructor.name),l==="Map"||l==="Set")return Array.from(_);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return S(_,C)}function S(_,C){(C==null||C>_.length)&&(C=_.length);for(var l=0,o=new Array(C);l<C;l++)o[l]=_[l];return o}function D(){return D=Object.assign||function(_){for(var C=1;C<arguments.length;C++){var l=arguments[C];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(_[o]=l[o])}return _},D.apply(this,arguments)}var A=function(){function _(l){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:O.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){z.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(w){try{var g=w.frag,v=o.hls.levels[g.level],L=o.getObjectType(g),b={d:g.duration*1e3,ot:L};(L===O.CMCDObjectType.VIDEO||L===O.CMCDObjectType.AUDIO||L==O.CMCDObjectType.MUXED)&&(b.br=v.bitrate/1e3,b.tb=o.getTopBandwidth(L),b.bl=o.getBufferLength(L)),o.apply(w,b)}catch(c){z.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=l;var s=this.config=l.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||_.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var C=_.prototype;return C.registerListeners=function(){var o=this.hls;o.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},C.unregisterListeners=function(){var o=this.hls;o.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(o,s){var d,w;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=s.tracks.video)===null||w===void 0?void 0:w.buffer},C.createData=function(){var o;return{v:O.CMCDVersion,sf:O.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},C.apply=function(o,s){s===void 0&&(s={}),D(s,this.createData());var d=s.ot===O.CMCDObjectType.INIT||s.ot===O.CMCDObjectType.VIDEO||s.ot===O.CMCDObjectType.MUXED;if(this.starved&&d&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var w=_.toHeaders(s);if(!Object.keys(w).length)return;o.headers||(o.headers={}),D(o.headers,w)}else{var g=_.toQuery(s);if(!g)return;o.url=_.appendQueryToUri(o.url,g)}},C.getObjectType=function(o){var s=o.type;return s==="subtitle"?O.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?O.CMCDObjectType.INIT:s==="audio"?O.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?O.CMCDObjectType.VIDEO:O.CMCDObjectType.MUXED:void 0},C.getTopBandwidth=function(o){for(var s=0,d=o===O.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=R(d),g;!(g=w()).done;){var v=g.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},C.getBufferLength=function(o){var s=this.hls.media,d=o===O.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var w=M.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return w.len*1e3},C.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,d=o||this.config.loader;return function(){function w(v){this.loader=void 0,this.loader=new d(v)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,b,c){s(L),this.loader.load(L,b,c)},U(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},C.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,d=o||this.config.loader;return function(){function w(v){this.loader=void 0,this.loader=new d(v)}var g=w.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,b,c){s(L),this.loader.load(L,b,c)},U(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},_.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},_.serialize=function(o){for(var s=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},g=function(F){return w(F/100)*100},v=function(F){return encodeURIComponent(F)},L={br:w,d:w,bl:g,dl:g,mtp:g,nor:v,rtp:g,tb:w},b=Object.keys(o||{}).sort(),c=R(b),p;!(p=c()).done;){var h=p.value,a=o[h];if(!d(a))continue;if(h==="v"&&a===1)continue;if(h=="pr"&&a===1)continue;var E=L[h];E&&(a=E(a));var y=typeof a,x=void 0;h==="ot"||h==="sf"||h==="st"?x=h+"="+a:y==="boolean"?x=h:y==="number"?x=h+"="+a:x=h+"="+JSON.stringify(a),s.push(x)}return s.join(",")},_.toHeaders=function(o){for(var s=Object.keys(o),d={},w=["Object","Request","Session","Status"],g=[{},{},{},{}],v={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,b=s;L<b.length;L++){var c=b[L],p=v[c]!=null?v[c]:1;g[p][c]=o[c]}for(var h=0;h<g.length;h++){var a=_.serialize(g[h]);a&&(d["CMCD-"+w[h]]=a)}return d},_.toQuery=function(o){return"CMCD="+encodeURIComponent(_.serialize(o))},_.appendQueryToUri=function(o,s){if(!s)return o;var d=o.includes("?")?"&":"?";return""+o+d+s},_}()},"./src/controller/eme-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),O=k("./src/errors.ts"),M=k("./src/utils/logger.ts"),z=k("./src/utils/mediakeys-helper.ts");function H(A,_){for(var C=0;C<_.length;C++){var l=_[C];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(A,l.key,l)}}function U(A,_,C){return _&&H(A.prototype,_),C&&H(A,C),A}var R=3,m=function(_,C,l){var o={audioCapabilities:[],videoCapabilities:[]};return _.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),C.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[o]},S=function(_,C,l,o){switch(_){case z.KeySystems.WIDEVINE:return m(C,l,o);default:throw new Error("Unknown key-system: "+_)}},D=function(){function A(C){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=C,this._config=C.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var _=A.prototype;return _.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},_._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},_.getLicenseServerUrl=function(l){switch(l){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},_._attemptKeySystemAccess=function(l,o,s){var d=this,w=S(l,o,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(l,w);this.mediaKeysPromise=g.then(function(v){return d._onMediaKeySystemAccessObtained(l,v)}),g.catch(function(v){M.logger.error('Failed to obtain key-system "'+l+'" access:',v)})},_._onMediaKeySystemAccessObtained=function(l,o){var s=this;M.logger.log('Access for key-system "'+l+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:l};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return d.mediaKeys=g,M.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),g});return w.catch(function(g){M.logger.error("Failed to create media-keys:",g)}),w},_._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),l._onNewMediaKeySession(o.mediaKeysSession))})},_._onNewMediaKeySession=function(l){var o=this;M.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){o._onKeySessionMessage(l,s.message)},!1)},_._onKeySessionMessage=function(l,o){M.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},_.onMediaEncrypted=function(l){var o=this;if(M.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},_._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},_._generateRequestWithPreferredKeySession=function(l,o){var s=this,d=this._mediaKeysList[0];if(!d){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+l+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(l,o).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(g){M.logger.error("Error generating key-session request:",g),s.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},_._createLicenseXhr=function(l,o,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,l,o,s);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,l),w=void 0}catch(g){M.logger.error(g)}try{d.readyState||d.open("POST",l,!0),w&&w.call(this.hls,d,l)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return d},_._onLicenseRequestReadyStageChange=function(l,o,s,d){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var w=l.response,g=this._licenseResponseCallback;if(g)try{w=g.call(this.hls,l,o)}catch(L){M.logger.error(L)}d(w)}else{if(M.logger.error("License Request XHR failed ("+o+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,d)}break}},_._generateLicenseRequestChallenge=function(l,o){switch(l.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},_._requestLicense=function(l,o){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),w=this._createLicenseXhr(d,l,o);M.logger.log("Sending license request to URL: "+d);var g=this._generateLicenseRequestChallenge(s,l);w.send(g)}catch(v){M.logger.error("Failure requesting DRM license: "+v),this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},_.onMediaAttached=function(l,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},_.onMediaDetached=function(){var l=this._media,o=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},_.onManifestParsed=function(l,o){if(!this._emeEnabled)return;var s=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,s,d)},U(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();J.default=D},"./src/controller/fps-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),O=k("./src/utils/logger.ts"),M=function(){function z(U){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=U,this.registerListeners()}var H=z.prototype;return H.setStreamController=function(R){this.streamController=R},H.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(R,m){var S=this.hls.config;if(S.capLevelOnFPSDrop){var D=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=D,D&&typeof D.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(R,m,S){var D=performance.now();if(m){if(this.lastTime){var A=D-this.lastTime,_=S-this.lastDroppedFrames,C=m-this.lastDecodedFrames,l=1e3*_/A,o=this.hls;if(o.trigger($.Events.FPS_DROP,{currentDropped:_,currentDecoded:C,totalDroppedFrames:S}),l>0&&_>o.config.fpsDroppedMonitoringThreshold*C){var s=o.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=D,this.lastDroppedFrames=S,this.lastDecodedFrames=m}},H.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var m=R.getVideoPlaybackQuality();this.checkFPS(R,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},z}();J.default=M},"./src/controller/fragment-finders.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"findFragmentByPDT",function(){return M}),k.d(J,"findFragmentByPTS",function(){return z}),k.d(J,"fragmentWithinToleranceTest",function(){return H}),k.d(J,"pdtWithinToleranceTest",function(){return U}),k.d(J,"findFragWithCC",function(){return R});var $=k("./src/polyfills/number.ts"),O=k("./src/utils/binary-search.ts");function M(m,S,D){if(S===null||!Array.isArray(m)||!m.length||!Object($.isFiniteNumber)(S))return null;var A=m[0].programDateTime;if(S<(A||0))return null;var _=m[m.length-1].endProgramDateTime;if(S>=(_||0))return null;D=D||0;for(var C=0;C<m.length;++C){var l=m[C];if(U(S,D,l))return l}return null}function z(m,S,D,A){D===void 0&&(D=0),A===void 0&&(A=0);var _=null;if(m?_=S[m.sn-S[0].sn+1]||null:D===0&&S[0].start===0&&(_=S[0]),_&&H(D,A,_)===0)return _;var C=O.default.search(S,H.bind(null,D,A));return C||_}function H(m,S,D){m===void 0&&(m=0),S===void 0&&(S=0);var A=Math.min(S,D.duration+(D.deltaPTS?D.deltaPTS:0));return D.start+D.duration-A<=m?1:D.start-A>m&&D.start?-1:0}function U(m,S,D){var A=Math.min(S,D.duration+(D.deltaPTS?D.deltaPTS:0))*1e3,_=D.endProgramDateTime||0;return _-A>m}function R(m,S){return O.default.search(m,function(D){return D.cc<S?1:D.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"FragmentState",function(){return M}),k.d(J,"FragmentTracker",function(){return z});var $=k("./src/events.ts"),O=k("./src/types/loader.ts"),M;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(M||(M={}));var z=function(){function R(S){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=S,this._registerListeners()}var m=R.prototype;return m._registerListeners=function(){var D=this.hls;D.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var D=this.hls;D.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(D,A){if(A===O.PlaylistLevelType.MAIN){var _=this.activeFragment,C=this.activeParts;if(!_)return null;if(C)for(var l=C.length;l--;){var o=C[l],s=o?o.end:_.appendedPTS;if(o.start<=D&&s!==void 0&&D<=s)return l>9&&(this.activeParts=C.slice(l-9)),o}else if(_.start<=D&&_.appendedPTS!==void 0&&D<=_.appendedPTS)return _}return this.getBufferedFrag(D,A)},m.getBufferedFrag=function(D,A){for(var _=this.fragments,C=Object.keys(_),l=C.length;l--;){var o=_[C[l]];if((o==null?void 0:o.body.type)===A&&o.buffered){var s=o.body;if(s.start<=D&&D<=s.end)return s}}return null},m.detectEvictedFragments=function(D,A,_){var C=this;Object.keys(this.fragments).forEach(function(l){var o=C.fragments[l];if(!o)return;if(!o.buffered){o.body.type===_&&C.removeFragment(o.body);return}var s=o.range[D];if(!s)return;s.time.some(function(d){var w=!C.isTimeBuffered(d.startPTS,d.endPTS,A);return w&&C.removeFragment(o.body),w})})},m.detectPartialFragments=function(D){var A=this,_=this.timeRanges,C=D.frag,l=D.part;if(!_||C.sn==="initSegment")return;var o=U(C),s=this.fragments[o];if(!s)return;Object.keys(_).forEach(function(d){var w=C.elementaryStreams[d];if(!w)return;var g=_[d],v=l!==null||w.partial===!0;s.range[d]=A.getBufferedTimes(C,l,v,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},m.fragBuffered=function(D){var A=U(D),_=this.fragments[A];_&&(_.backtrack=_.loaded=null,_.buffered=!0)},m.getBufferedTimes=function(D,A,_,C){for(var l={time:[],partial:_},o=A?A.start:D.start,s=A?A.end:D.end,d=D.minEndPTS||s,w=D.maxStartPTS||o,g=0;g<C.length;g++){var v=C.start(g)-this.bufferPadding,L=C.end(g)+this.bufferPadding;if(w>=v&&d<=L){l.time.push({startPTS:Math.max(o,C.start(g)),endPTS:Math.min(s,C.end(g))});break}else if(o<L&&s>v)l.partial=!0,l.time.push({startPTS:Math.max(o,C.start(g)),endPTS:Math.min(s,C.end(g))});else if(s<=v)break}return l},m.getPartialFragment=function(D){var A=null,_,C,l,o=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var g=d[w];if(!g)return;H(g)&&(C=g.body.start-s,l=g.body.end+s,D>=C&&D<=l&&(_=Math.min(D-C,l-D),o<=_&&(A=g.body,o=_)))}),A},m.getState=function(D){var A=U(D),_=this.fragments[A];return _?_.buffered?H(_)?M.PARTIAL:M.OK:_.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},m.backtrack=function(D,A){var _=U(D),C=this.fragments[_];if(!C||C.backtrack)return null;var l=C.backtrack=A||C.loaded;return C.loaded=null,l},m.getBacktrackData=function(D){var A=U(D),_=this.fragments[A];if(_){var C,l=_.backtrack;if(l!=null&&(C=l.payload)!==null&&C!==void 0&&C.byteLength)return l;this.removeFragment(D)}return null},m.isTimeBuffered=function(D,A,_){for(var C,l,o=0;o<_.length;o++){if(C=_.start(o)-this.bufferPadding,l=_.end(o)+this.bufferPadding,D>=C&&A<=l)return!0;if(A<=C)return!1}return!1},m.onFragLoaded=function(D,A){var _=A.frag,C=A.part;if(_.sn==="initSegment"||_.bitrateTest||C)return;var l=U(_);this.fragments[l]={body:_,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(D,A){var _=this,C=A.frag,l=A.part,o=A.timeRanges;if(C.type===O.PlaylistLevelType.MAIN)if(this.activeFragment=C,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var w=o[d];if(_.detectEvictedFragments(d,w),!l)for(var g=0;g<w.length;g++)C.appendedPTS=Math.max(w.end(g),C.appendedPTS||0)})},m.onFragBuffered=function(D,A){this.detectPartialFragments(A)},m.hasFragment=function(D){var A=U(D);return!!this.fragments[A]},m.removeFragmentsInRange=function(D,A,_){var C=this;Object.keys(this.fragments).forEach(function(l){var o=C.fragments[l];if(!o)return;if(o.buffered){var s=o.body;s.type===_&&s.start<A&&s.end>D&&C.removeFragment(s)}})},m.removeFragment=function(D){var A=U(D);D.stats.loaded=0,D.clearElementaryStreamInfo(),delete this.fragments[A]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function H(R){var m,S;return R.buffered&&(((m=R.range.video)===null||m===void 0?void 0:m.partial)||((S=R.range.audio)===null||S===void 0?void 0:S.partial))}function U(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"STALL_MINIMUM_DURATION_MS",function(){return H}),k.d(J,"MAX_START_GAP_JUMP",function(){return U}),k.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),k.d(J,"SKIP_BUFFER_RANGE_START",function(){return m}),k.d(J,"default",function(){return S});var $=k("./src/utils/buffer-helper.ts"),O=k("./src/errors.ts"),M=k("./src/events.ts"),z=k("./src/utils/logger.ts"),H=250,U=2,R=.1,m=.05,S=function(){function D(_,C,l,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=_,this.media=C,this.fragmentTracker=l,this.hls=o}var A=D.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(C){var l=this.config,o=this.media,s=this.stalled,d=o.currentTime,w=o.seeking,g=this.seeking&&!w,v=!this.seeking&&w;if(this.seeking=w,d!==C){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;z.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!$.BufferHelper.getBuffered(o).length)return;var b=$.BufferHelper.bufferInfo(o,d,0),c=b.len>0,p=b.nextStart||0;if(!c&&!p)return;if(w){var h=b.len>U,a=!p||p-d>U&&!this.fragmentTracker.getPartialFragment(d);if(h||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,y=Math.max(p,b.start||0)-d,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=x==null||((E=x.details)===null||E===void 0)?void 0:E.live,F=B?x.details.targetduration*2:U;if(y>0&&y<=F){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(s===null){this.stalled=K;return}var V=K-s;!w&&V>=H&&this._reportStall(b.len);var P=$.BufferHelper.bufferInfo(o,d,l.maxBufferHole);this._tryFixBufferStall(P,V)},A._tryFixBufferStall=function(C,l){var o=this.config,s=this.fragmentTracker,d=this.media,w=d.currentTime,g=s.getPartialFragment(w);if(g){var v=this._trySkipBufferHole(g);if(v)return}C.len>o.maxBufferHole&&l>o.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(C){var l=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+C+")"),l.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},A._trySkipBufferHole=function(C){for(var l=this.config,o=this.hls,s=this.media,d=s.currentTime,w=0,g=$.BufferHelper.getBuffered(s),v=0;v<g.length;v++){var L=g.start(v);if(d+l.maxBufferHole>=w&&d<L){var b=Math.max(L+m,s.currentTime+R);return z.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,C&&o.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:C}),b}w=g.end(v)}return 0},A._tryNudgeBuffer=function(){var C=this.config,l=this.hls,o=this.media,s=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<C.nudgeMaxRetry){var w=s+d*C.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+s+" to "+w),o.currentTime=w,l.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+C.nudgeMaxRetry+" nudges"),l.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},D}()},"./src/controller/id3-track-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),O=k("./src/utils/texttrack-utils.ts"),M=k("./src/demux/id3.ts"),z=.25,H=function(){function U(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var R=U.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var S=this.hls;S.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var S=this.hls;S.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(S,D){this.media=D.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(O.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(S){if(!this.media)return;for(var D=0;D<S.length;D++){var A=S[D];if(A.kind==="metadata"&&A.label==="id3")return Object(O.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(S,D){if(!this.media)return;var A=D.frag,_=D.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<_.length;l++){var o=M.getID3Frames(_[l].data);if(o){var s=_[l].pts,d=l<_.length-1?_[l+1].pts:A.end,w=d-s;w<=0&&(d=s+z);for(var g=0;g<o.length;g++){var v=o[g];if(!M.isTimeStampFrame(v)){var L=new C(s,d,"");L.value=v,this.id3Track.addCue(L)}}}}},R.onBufferFlushing=function(S,D){var A=D.startOffset,_=D.endOffset,C=D.type;if(!C||C==="audio"){var l=this.id3Track;l&&Object(O.removeCuesInRange)(l,A,_)}},U}();J.default=H},"./src/controller/latency-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return U});var $=k("./src/errors.ts"),O=k("./src/events.ts"),M=k("./src/utils/logger.ts");function z(R,m){for(var S=0;S<m.length;S++){var D=m[S];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(R,D.key,D)}}function H(R,m,S){return m&&z(R.prototype,m),S&&z(R,S),R}var U=function(){function R(S){var D=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 D.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var m=R.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(O.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(O.Events.ERROR,this.onError)},m.onMediaAttached=function(D,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(D,A){var _=A.details;this.levelDetails=_,_.advanced&&this.timeupdate(),!_.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(D,A){if(A.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var D=this.media,A=this.levelDetails;if(!D||!A)return;this.currentTime=D.currentTime;var _=this.computeLatency();if(_===null)return;this._latency=_;var C=this.config,l=C.lowLatencyMode,o=C.maxLiveSyncPlaybackRate;if(!l||o===1)return;var s=this.targetLatency;if(s===null)return;var d=_-s,w=Math.min(this.maxLatency,s+A.targetduration),g=d<w;if(A.live&&g&&d>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;D.playbackRate=Math.min(v,Math.max(1,L))}else D.playbackRate!==1&&D.playbackRate!==0&&(D.playbackRate=1)},m.estimateLiveEdge=function(){var D=this.levelDetails;return D===null?null:D.edge+D.age},m.computeLatency=function(){var D=this.estimateLiveEdge();return D===null?null:D-this.currentTime},H(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var D=this.config,A=this.levelDetails;return D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:A?D.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var D=this.levelDetails;if(D===null)return null;var A=D.holdBack,_=D.partHoldBack,C=D.targetduration,l=this.config,o=l.liveSyncDuration,s=l.liveSyncDurationCount,d=l.lowLatencyMode,w=this.hls.userConfig,g=d&&_||A;(w.liveSyncDuration||w.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:s*C);var v=C,L=1;return g+Math.min(this.stallCount*L,v)}},{key:"liveSyncPosition",get:function(){var D=this.estimateLiveEdge(),A=this.targetLatency,_=this.levelDetails;if(D===null||A===null||_===null)return null;var C=_.edge,l=D-A-this.edgeStalled,o=C-_.totalduration,s=C-(this.config.lowLatencyMode&&_.partTarget||_.targetduration);return Math.min(Math.max(o,l),s)}},{key:"drift",get:function(){var D=this.levelDetails;return D===null?1:D.drift}},{key:"edgeStalled",get:function(){var D=this.levelDetails;if(D===null)return 0;var A=(this.config.lowLatencyMode&&D.partTarget||D.targetduration)*3;return Math.max(D.age-A,0)}},{key:"forwardBufferLength",get:function(){var D=this.media,A=this.levelDetails;if(!D||!A)return 0;var _=D.buffered.length;return _?D.buffered.end(_-1):A.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return l});var $=k("./src/types/level.ts"),O=k("./src/events.ts"),M=k("./src/errors.ts"),z=k("./src/utils/codecs.ts"),H=k("./src/controller/level-helper.ts"),U=k("./src/controller/base-playlist-controller.ts"),R=k("./src/types/loader.ts");function m(){return m=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(o[w]=d[w])}return o},m.apply(this,arguments)}function S(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function D(o,s,d){return s&&S(o.prototype,s),d&&S(o,d),o}function A(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,_(o,s)}function _(o,s){return _=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},_(o,s)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(o){A(s,o);function s(w){var g;return g=o.call(this,w,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var d=s.prototype;return d._registerListeners=function(){var g=this.hls;g.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(O.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var g=this.hls;g.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(O.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var g=this._levels;g.forEach(function(v){v.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(g,v){var L=[],b=[],c=[],p,h={},a,E=!1,y=!1,x=!1;if(v.levels.forEach(function(V){var P=V.attrs;E=E||!!(V.width&&V.height),y=y||!!V.videoCodec,x=x||!!V.audioCodec,C&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var I=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=h[I],a?a.url.push(V.url):(a=new $.Level(V),h[I]=a,L.push(a)),P&&(P.AUDIO&&Object(H.addGroupId)(a,"audio",P.AUDIO),P.SUBTITLES&&Object(H.addGroupId)(a,"text",P.SUBTITLES))}),(E||y)&&x&&(L=L.filter(function(V){var P=V.videoCodec,I=V.width,Y=V.height;return!!P||!!(I&&Y)})),L=L.filter(function(V){var P=V.audioCodec,I=V.videoCodec;return(!P||Object(z.isCodecSupportedInMp4)(P,"audio"))&&(!I||Object(z.isCodecSupportedInMp4)(I,"video"))}),v.audioTracks&&(b=v.audioTracks.filter(function(V){return!V.audioCodec||Object(z.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(b)),v.subtitles&&(c=v.subtitles,Object(H.assignTrackIdsByGroup)(c)),L.length>0){p=L[0].bitrate,L.sort(function(V,P){return V.bitrate-P.bitrate}),this._levels=L;for(var B=0;B<L.length;B++)if(L[B].bitrate===p){this._firstLevel=B,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+p);break}var F=x&&!y,K={levels:L,audioTracks:b,subtitleTracks:c,firstLevel:this._firstLevel,stats:v.stats,audio:x,video:y,altAudio:!F&&b.some(function(V){return!!V.url})};this.hls.trigger(O.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(g,v){if(o.prototype.onError.call(this,g,v),v.fatal)return;var L=v.context,b=this._levels[this.currentLevelIndex];if(L&&(L.type===R.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&L.groupId===b.audioGroupIds[b.urlId]||L.type===R.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&L.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,p=!0,h;switch(v.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var a=this._levels[v.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=v.frag.level)):h=v.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(p=!1),h=L.level),c=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:h=v.level,c=!0;break}h!==void 0&&this.recoverLevel(v,h,c,p)},d.recoverLevel=function(g,v,L,b){var c=g.details,p=this._levels[v];if(p.loadError++,L){var h=this.retryLoadingOrFail(g);if(h)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=p.url.length;if(a>1&&p.loadError<a)g.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var E=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(c+": switch to "+E),g.levelRetry=!0,this.hls.nextAutoLevel=E)}}},d.redundantFailover=function(g){var v=this._levels[g],L=v.url.length;if(L>1){var b=(v.urlId+1)%L;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(c){c.urlId=b}),this.level=g}},d.onFragLoaded=function(g,v){var L=v.frag;if(L!==void 0&&L.type===R.PlaylistLevelType.MAIN){var b=this._levels[L.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(g,v){var L,b=v.level,c=v.details,p=this._levels[b];if(!p){var h;this.warn("Invalid level index "+b),(h=v.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(c.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(b,v,p.details)):(L=v.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(c.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(g,v){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var b=-1,c=this.hls.audioTracks[v.id].groupId,p=0;p<L.audioGroupIds.length;p++)if(L.audioGroupIds[p]===c){b=p;break}b!==L.urlId&&(L.urlId=b,this.startLoad())}},d.loadPlaylist=function(g){var v=this.currentLevelIndex,L=this._levels[v];if(this.canLoad&&L&&L.url.length>0){var b=L.urlId,c=L.url[b];if(g)try{c=g.addDirectives(c)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+v+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+b+" "+c),this.clearTimer(),this.hls.trigger(O.Events.LEVEL_LOADING,{url:c,level:v,id:b,deliveryDirectives:g||null})}},d.removeLevel=function(g,v){var L=function(p,h){return h!==v},b=this._levels.filter(function(c,p){return p!==g?!0:c.url.length>1&&v!==void 0?(c.url=c.url.filter(L),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(L)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(L)),c.urlId=0,!0):!1}).map(function(c,p){var h=c.details;return h!=null&&h.fragments&&h.fragments.forEach(function(a){a.level=p}),c});this._levels=b,this.hls.trigger(O.Events.LEVELS_UPDATED,{levels:b})},D(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var v,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===g&&(v=L[g])!==null&&v!==void 0&&v.details)return;if(g<0||g>=L.length){var b=g<0;if(this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:b,reason:"invalid level idx"}),b)return;g=Math.min(g,L.length-1)}this.clearTimer();var c=this.currentLevelIndex,p=L[c],h=L[g];this.log("switching to level "+g+" from "+c),this.currentLevelIndex=g;var a=m({},h,{level:g,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete a._urlId,this.hls.trigger(O.Events.LEVEL_SWITCHING,a);var E=h.details;if(!E||E.live){var y=this.switchParams(h.uri,p==null?void 0:p.details);this.loadPlaylist(y)}}},{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)}}]),s}(U.default)},"./src/controller/level-helper.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"addGroupId",function(){return M}),k.d(J,"assignTrackIdsByGroup",function(){return z}),k.d(J,"updatePTS",function(){return H}),k.d(J,"updateFragPTSDTS",function(){return R}),k.d(J,"mergeDetails",function(){return m}),k.d(J,"mapPartIntersection",function(){return S}),k.d(J,"mapFragmentIntersection",function(){return D}),k.d(J,"adjustSliding",function(){return A}),k.d(J,"addSliding",function(){return _}),k.d(J,"computeReloadInterval",function(){return C}),k.d(J,"getFragmentWithSN",function(){return l}),k.d(J,"getPartWith",function(){return o});var $=k("./src/polyfills/number.ts"),O=k("./src/utils/logger.ts");function M(s,d,w){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(w);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(w);break}}function z(s){var d={};s.forEach(function(w){var g=w.groupId||"";w.id=d[g]=d[g]||0,d[g]++})}function H(s,d,w){var g=s[d],v=s[w];U(g,v)}function U(s,d){var w=d.startPTS;if(Object($.isFiniteNumber)(w)){var g=0,v;d.sn>s.sn?(g=w-s.start,v=s):(g=s.start-w,v=d),v.duration!==g&&(v.duration=g)}else if(d.sn>s.sn){var L=s.cc===d.cc;L&&s.minEndPTS?d.start=s.start+(s.minEndPTS-s.start):d.start=s.start+s.duration}else d.start=Math.max(s.start-d.duration,0)}function R(s,d,w,g,v,L){var b=g-w;b<=0&&(O.logger.warn("Fragment should have a positive duration",d),g=w+d.duration,L=v+d.duration);var c=w,p=g,h=d.startPTS,a=d.endPTS;if(Object($.isFiniteNumber)(h)){var E=Math.abs(h-w);Object($.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(E,d.deltaPTS):d.deltaPTS=E,c=Math.max(w,h),w=Math.min(w,h),v=Math.min(v,d.startDTS),p=Math.min(g,a),g=Math.max(g,a),L=Math.max(L,d.endDTS)}d.duration=g-w;var y=w-d.start;d.appendedPTS=g,d.start=d.startPTS=w,d.maxStartPTS=c,d.startDTS=v,d.endPTS=g,d.minEndPTS=p,d.endDTS=L;var x=d.sn;if(!s||x<s.startSN||x>s.endSN)return 0;var B,F=x-s.startSN,K=s.fragments;for(K[F]=d,B=F;B>0;B--)U(K[B],K[B-1]);for(B=F;B<K.length-1;B++)U(K[B],K[B+1]);return s.fragmentHint&&U(K[K.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,y}function m(s,d){for(var w=null,g=s.fragments,v=g.length-1;v>=0;v--){var L=g[v].initSegment;if(L){w=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,c;if(D(s,d,function(B,F){B.relurl&&(b=B.cc-F.cc),Object($.isFiniteNumber)(B.startPTS)&&Object($.isFiniteNumber)(B.endPTS)&&(F.start=F.startPTS=B.startPTS,F.startDTS=B.startDTS,F.appendedPTS=B.appendedPTS,F.maxStartPTS=B.maxStartPTS,F.endPTS=B.endPTS,F.endDTS=B.endDTS,F.minEndPTS=B.minEndPTS,F.duration=B.endPTS-B.startPTS,F.duration&&(c=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=B.elementaryStreams,F.loader=B.loader,F.stats=B.stats,F.urlId=B.urlId,B.initSegment&&(F.initSegment=B.initSegment,w=B.initSegment)}),w){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(B){var F;(!B.initSegment||B.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(B.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(B){return!B}),d.deltaUpdateFailed)){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=d.skippedSegments;h--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<a.length;E++)a[E].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),S(s.partList,d.partList,function(B,F){F.elementaryStreams=B.elementaryStreams,F.stats=B.stats}),c?R(d,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):A(s,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var y=d.advancedDateTime;if(d.advanced&&y){var x=d.edge;d.driftStart||(d.driftStartTime=y,d.driftStart=x),d.driftEndTime=y,d.driftEnd=x}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function S(s,d,w){if(s&&d)for(var g=0,v=0,L=s.length;v<=L;v++){var b=s[v],c=d[v+g];b&&c&&b.index===c.index&&b.fragment.sn===c.fragment.sn?w(b,c):g--}}function D(s,d,w){for(var g=d.skippedSegments,v=Math.max(s.startSN,d.startSN)-d.startSN,L=(s.fragmentHint?1:0)+(g?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,b=d.startSN-s.startSN,c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=v;h<=L;h++){var a=p[b+h],E=c[h];g&&!E&&h<g&&(E=d.fragments[h]=a),a&&E&&w(a,E)}}function A(s,d){var w=d.startSN+d.skippedSegments-s.startSN,g=s.fragments;if(w<0||w>=g.length)return;_(d,g[w].start)}function _(s,d){if(d){for(var w=s.fragments,g=s.skippedSegments;g<w.length;g++)w[g].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function C(s,d){var w=1e3*s.levelTargetDuration,g=w/2,v=s.age,L=v>0&&v<w*3,b=d.loading.end-d.loading.start,c,p=s.availabilityDelay;if(s.updated===!1)if(L){var h=333*s.misses;c=Math.max(Math.min(g,b*2),h),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=g;else L?(p=Math.min(p||w/2,v),s.availabilityDelay=p,c=p+w-v):c=w-b;return Math.round(c)}function l(s,d,w){if(!s||!s.details)return null;var g=s.details,v=g.fragments[d-g.startSN];return v||(v=g.fragmentHint,v&&v.sn===d?v:d<g.startSN&&w&&w.sn===d?w:null)}function o(s,d,w){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var v=g.length;v--;){var L=g[v];if(L.index===w&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return g});var $=k("./src/polyfills/number.ts"),O=k("./src/controller/base-stream-controller.ts"),M=k("./src/is-supported.ts"),z=k("./src/events.ts"),H=k("./src/utils/buffer-helper.ts"),U=k("./src/controller/fragment-tracker.ts"),R=k("./src/types/loader.ts"),m=k("./src/loader/fragment.ts"),S=k("./src/demux/transmuxer-interface.ts"),D=k("./src/types/transmuxer.ts"),A=k("./src/controller/gap-controller.ts"),_=k("./src/errors.ts"),C=k("./src/utils/logger.ts");function l(v,L){for(var b=0;b<L.length;b++){var c=L[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(v,c.key,c)}}function o(v,L,b){return L&&l(v.prototype,L),b&&l(v,b),v}function s(v,L){v.prototype=Object.create(L.prototype),v.prototype.constructor=v,d(v,L)}function d(v,L){return d=Object.setPrototypeOf||function(c,p){return c.__proto__=p,c},d(v,L)}var w=100,g=function(v){s(L,v);function L(c,p){var h;return h=v.call(this,c,p,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var b=L.prototype;return b._registerListeners=function(){var p=this.hls;p.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(z.Events.ERROR,this.onError,this),p.on(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var p=this.hls;p.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(z.Events.ERROR,this.onError,this),p.off(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(p){if(this.levels){var h=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=a.startLevel;E===-1&&(a.config.testBandwidth?(E=0,this.bitrateTest=!0):E=a.nextAutoLevel),this.level=a.nextLoadLevel=E,this.loadedmetadata=!1}h>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),p=h),this.state=O.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=O.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_LEVEL:{var p,h=this.levels,a=this.level,E=h==null||((p=h[a])===null||p===void 0)?void 0:p.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=O.State.IDLE;break}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var y,x=self.performance.now(),B=this.retryDate;(!B||x>=B||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=O.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var p,h,a=this.hls,E=this.levelLastLoaded,y=this.levels,x=this.media,B=a.config,F=a.nextLoadLevel;if(E===null||!x&&(this.startFragRequested||!B.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[F])return;var K=y[F];this.level=a.nextLoadLevel=F;var V=K.details;if(!V||this.state===O.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=O.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,R.PlaylistLevelType.MAIN);if(P===null)return;var I=P.len,Y=this.getMaxBufferLength(K.maxBitrate);if(I>=Y)return;if(this._streamEnded(P,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,ee),this.state=O.State.ENDED;return}var oe=P.end,pe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&pe&&pe.sn!=="initSegment"){var Oe=pe.sn-V.startSN;Oe>1&&(pe=V.fragments[Oe-1],this.fragmentTracker.removeFragment(pe))}if(pe&&this.fragmentTracker.getState(pe)===U.FragmentState.OK&&this.nextLoadPosition>oe){var Se=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,Se,R.PlaylistLevelType.MAIN),pe=this.getNextFragment(this.nextLoadPosition,V)}if(!pe)return;pe.initSegment&&!pe.initSegment.data&&!this.bitrateTest&&(pe=pe.initSegment),((p=pe.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((h=pe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(pe,V):this.loadFragment(pe,V,oe)},b.loadFragment=function(p,h,a){var E,y=this.fragmentTracker.getState(p);if(this.fragCurrent=p,y===U.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(p);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else y=U.FragmentState.NOT_LOADED}y===U.FragmentState.NOT_LOADED||y===U.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,p,h,a)):y===U.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(p){var h=this.fragmentTracker.getAppendedFrag(p,R.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},b.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,R.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var p=this.levels,h=this.media;if(h!=null&&h.readyState){var a,E=this.getAppendedFrag(h.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!h.paused&&p){var y=this.hls.nextLoadLevel,x=p[y],B=this.fragLastKbps;B&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*B)+1:a=0}else a=0;var F=this.getBufferedFrag(h.currentTime+a);if(F){var K=this.followingBufferedFrag(F);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,P=K.duration,I=Math.max(F.end,V+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===O.State.KEY_LOADING&&(this.state=O.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(p,h){v.prototype.flushMainBuffer.call(this,p,h,this.altAudio?"video":null)},b.onMediaAttached=function(p,h){v.prototype.onMediaAttached.call(this,p,h);var a=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var p=this.media,h=p?p.currentTime:null;Object($.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(z.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(p,h){var a=!1,E=!1,y;h.levels.forEach(function(x){y=x.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=a&&E&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},b.onLevelLoading=function(p,h){var a=this.levels;if(!a||this.state!==O.State.IDLE)return;var E=a[h.level];(!E.details||E.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(E.details))&&(this.state=O.State.WAITING_LEVEL)},b.onLevelLoaded=function(p,h){var a,E=this.levels,y=h.level,x=h.details,B=x.totalduration;if(!E){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+B);var F=this.fragCurrent;F&&(this.state===O.State.FRAG_LOADING||this.state===O.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==h.level&&F.loader&&(this.state=O.State.IDLE,F.loader.abort()));var K=E[y],V=0;if(x.live||(a=K.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;V=this.alignPlaylists(x,K.details)}if(K.details=x,this.levelLastLoaded=y,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:x,level:y}),this.state===O.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=O.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,V),this.tick()},b._handleFragmentLoadProgress=function(p){var h,a=p.frag,E=p.part,y=p.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var B=x[a.level],F=B.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=B.videoCodec,V=F.PTSKnown||!F.live,P=(h=a.initSegment)===null||h===void 0?void 0:h.data,I=this._getAudioCodec(B),Y=this.transmuxer=this.transmuxer||new S.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=E?E.index:-1,oe=ee!==-1,pe=new D.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,ee,oe),Oe=this.initPTS[a.cc];Y.push(y,P,I,K,a,E,F.totalduration,V,pe,Oe)},b.onAudioTrackSwitching=function(p,h){var a=this.altAudio,E=!!h.url,y=h.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var B=this.hls;a&&B.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),B.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(p,h){var a=h.id,E=!!this.hls.audioTracks[a].url;if(E){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=E,this.tick()},b.onBufferCreated=function(p,h){var a=h.tracks,E,y,x=!1;for(var B in a){var F=a[B];if(F.id==="main"){if(y=B,E=F,B==="video"){var K=a[B];K&&(this.videoBuffer=K.buffer)}}else x=!0}x&&E?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(p,h){var a=h.frag,E=h.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(E?" p: "+E.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===O.State.PARSED&&(this.state=O.State.IDLE);return}var y=E?E.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,E)},b.onError=function(p,h){switch(h.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,h);break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==O.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=O.State.ERROR):!h.levelRetry&&this.state===O.State.WAITING_LEVEL&&(this.state=O.State.IDLE));break;case _.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var a=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(a=!this.reduceMaxBufferLength(E.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 p=this.media,h=this.gapController;if(!p||!h||!p.readyState)return;var a=H.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=O.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(p,h){var a=h.type;if(a!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(a===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,a,R.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(p,h){this.levels=h.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var p=this.media,h=p.currentTime,a=this.startPosition;if(a>=0&&h<a){if(p.seeking){C.logger.log("could not seek to "+a+", already seeking at "+h);return}var E=H.BufferHelper.getBuffered(p),y=E.length?E.start(0):0,x=y-a;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(C.logger.log("adjusting start position by "+x+" to match buffer start"),a+=x,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+h),p.currentTime=a}},b._getAudioCodec=function(p){var h=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},b._loadBitrateTestFrag=function(p){var h=this;this._doFragLoad(p).then(function(a){var E=h.hls;if(!a||E.nextLoadLevel||h.fragContextChanged(p))return;h.fragLoadError=0,h.state=O.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var y=p.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),E.trigger(z.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(p){var h,a="main",E=this.hls,y=p.remuxResult,x=p.chunkMeta,B=this.getCurrentContext(x);if(!B){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var F=B.frag,K=B.part,V=B.level,P=y.video,I=y.text,Y=y.id3,ee=y.initSegment,oe=this.altAudio?void 0:y.audio;if(this.fragContextChanged(F))return;if(this.state=O.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,F,x),E.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:ee.tracks}));var pe=ee.initPTS,Oe=ee.timescale;Object($.isFiniteNumber)(pe)&&(this.initPTS[F.cc]=pe,E.trigger(z.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:pe,timescale:Oe}))}if(P&&y.independent!==!1){if(V.details){var Se=P.startPTS,we=P.endPTS,Te=P.startDTS,Ce=P.endDTS;if(K)K.elementaryStreams[P.type]={startPTS:Se,endPTS:we,startDTS:Te,endDTS:Ce};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Se){this.backtrack(F);return}F.setElementaryStreamInfo(P.type,F.start,we,F.start,Ce,!0)}F.setElementaryStreamInfo(P.type,Se,we,Te,Ce),this.bufferFragmentData(P,F,K,x)}}else if(y.independent===!1){this.backtrack(F);return}if(oe){var se=oe.startPTS,te=oe.endPTS,ce=oe.startDTS,ae=oe.endDTS;K&&(K.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:te,startDTS:ce,endDTS:ae}),F.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,se,te,ce,ae),this.bufferFragmentData(oe,F,K,x)}if(Y!=null&&(h=Y.samples)!==null&&h!==void 0&&h.length){var Ae={frag:F,id:a,samples:Y.samples};E.trigger(z.Events.FRAG_PARSING_METADATA,Ae)}if(I){var Re={frag:F,id:a,samples:I.samples};E.trigger(z.Events.FRAG_PARSING_USERDATA,Re)}},b._bufferInitSegment=function(p,h,a,E){var y=this;if(this.state!==O.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var x=h.audio,B=h.video,F=h.audiovideo;if(x){var K=p.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),x.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),p.audioCodec&&p.audioCodec!==K&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+K+'"'),x.levelCodec=K,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(p.audioCodec||"")+"/"+x.codec+"]")}B&&(B.levelCodec=p.videoCodec,B.id="main",this.log("Init video buffer, container:"+B.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+B.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(P){var I=h[P],Y=I.initSegment;Y!=null&&Y.byteLength&&y.hls.trigger(z.Events.BUFFER_APPENDING,{type:P,data:Y,frag:a,part:null,chunkMeta:E,parent:a.type})}),this.tick()},b.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var h=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,h?this.resetFragmentLoading(p):this.state=O.State.BACKTRACKING},b.checkFragmentChanged=function(){var p=this.media,h=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(H.BufferHelper.isBuffered(p,a)?h=this.getAppendedFrag(a):H.BufferHelper.isBuffered(p,a+.1)&&(h=this.getAppendedFrag(a+.1)),h){var E=this.fragPlaying,y=h.level;(!E||h.sn!==E.sn||E.level!==y||h.urlId!==E.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:h}),(!E||E.level!==y)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=h)}}},o(L,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var h=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(O.default)},"./src/controller/subtitle-stream-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"SubtitleStreamController",function(){return s});var $=k("./src/events.ts"),O=k("./src/utils/logger.ts"),M=k("./src/utils/buffer-helper.ts"),z=k("./src/controller/fragment-finders.ts"),H=k("./src/utils/discontinuities.ts"),U=k("./src/controller/level-helper.ts"),R=k("./src/controller/fragment-tracker.ts"),m=k("./src/controller/base-stream-controller.ts"),S=k("./src/types/loader.ts"),D=k("./src/types/level.ts");function A(d,w){for(var g=0;g<w.length;g++){var v=w[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}function _(d,w,g){return w&&A(d.prototype,w),g&&A(d,g),d}function C(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,l(d,w)}function l(d,w){return l=Object.setPrototypeOf||function(v,L){return v.__proto__=L,v},l(d,w)}var o=500,s=function(d){C(w,d);function w(v,L){var b;return b=d.call(this,v,L,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var g=w.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var L=this.hls;L.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on($.Events.ERROR,this.onError,this),L.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var L=this.hls;L.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off($.Events.ERROR,this.onError,this),L.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(L,b){this.mainDetails=b.details},g.onSubtitleFragProcessed=function(L,b){var c=b.frag,p=b.success;if(this.fragPrevious=c,this.state=m.State.IDLE,!p)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var a,E=c.start,y=0;y<h.length;y++)if(E>=h[y].start&&E<=h[y].end){a=h[y];break}var x=c.start+c.duration;a?a.end=x:(a={start:E,end:x},h.push(a)),this.fragmentTracker.fragBuffered(c)},g.onBufferFlushing=function(L,b){var c=b.startOffset,p=b.endOffset;if(c===0&&p!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var E=a[h].details,y=E.targetduration,x=p-y;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(B){for(var F=0;F<B.length;){if(B[F].end<=x){B.shift();continue}else if(B[F].start<x)B[F].start=x;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(c,x,S.PlaylistLevelType.SUBTITLE)}},g.onError=function(L,b){var c,p=b.frag;if(!p||p.type!==S.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},g.onSubtitleTracksUpdated=function(L,b){var c=this,p=b.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(h){return new D.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){c.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(L,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},g.onSubtitleTrackLoaded=function(L,b){var c,p=b.details,h=b.id,a=this.currentTrackId,E=this.levels;if(!E.length)return;var y=E[a];if(h>=E.length||h!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(c=y.details)!==null&&c!==void 0&&c.live){var x=this.mainDetails;if(p.deltaUpdateFailed||!x)return;var B=x.fragments[0];if(!y.details)p.hasProgramDateTime&&x.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(p,x):B&&Object(U.addSliding)(p,B.start);else{var F=this.alignPlaylists(p,y.details);F===0&&B&&Object(U.addSliding)(p,B.start)}}if(y.details=p,this.levelLastLoaded=h,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var K=Object(z.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},g._handleFragmentLoadComplete=function(L){var b=L.frag,c=L.payload,p=b.decryptdata,h=this.hls;if(this.fragContextChanged(b))return;if(c&&c.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),p.key.buffer,p.iv.buffer).then(function(E){var y=performance.now();h.trigger($.Events.FRAG_DECRYPTED,{frag:b,payload:E,stats:{tstart:a,tdecrypt:y}})})}},g.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var L,b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var p=c[b].details,h=p.targetduration,a=this.config,E=this.media,y=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-h,a.maxBufferHole),x=y.end,B=y.len,F=this.getMaxBufferLength()+h;if(B>F)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var K=p.fragments,V=K.length,P=p.edge,I,Y=this.fragPrevious;if(x<P){var ee=a.maxFragLookUpTolerance;Y&&p.hasProgramDateTime&&(I=Object(z.findFragmentByPDT)(K,Y.endProgramDateTime,ee)),I||(I=Object(z.findFragmentByPTS)(Y,K,x,ee),!I&&Y&&Y.start<K[0].start&&(I=K[0]))}else I=K[V-1];(L=I)!==null&&L!==void 0&&L.encrypted?(O.logger.log("Loading key for "+I.sn),this.state=m.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===R.FragmentState.NOT_LOADED&&this.loadFragment(I,p,x)}},g.loadFragment=function(L,b,c){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,b,c)},_(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(m.default)},"./src/controller/subtitle-track-controller.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),O=k("./src/utils/texttrack-utils.ts"),M=k("./src/controller/base-playlist-controller.ts"),z=k("./src/types/loader.ts");function H(A,_){for(var C=0;C<_.length;C++){var l=_[C];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(A,l.key,l)}}function U(A,_,C){return _&&H(A.prototype,_),C&&H(A,C),A}function R(A,_){A.prototype=Object.create(_.prototype),A.prototype.constructor=A,m(A,_)}function m(A,_){return m=Object.setPrototypeOf||function(l,o){return l.__proto__=o,l},m(A,_)}var S=function(A){R(_,A);function _(l){var o;return o=A.call(this,l,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var C=_.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},C.registerListeners=function(){var o=this.hls;o.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on($.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var o=this.hls;o.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off($.Events.ERROR,this.onError,this)},C.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},C.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},C.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=D(this.media.textTracks);o.forEach(function(s){Object(O.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},C.onSubtitleTrackLoaded=function(o,s){var d=s.id,w=s.details,g=this.trackId,v=this.tracksInGroup[g];if(!v){this.warn("Invalid subtitle track id "+d);return}var L=v.details;v.details=s.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,L))},C.onLevelLoading=function(o,s){this.switchLevel(s.level)},C.onLevelSwitching=function(o,s){this.switchLevel(s.level)},C.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var d=s.textGroupIds[s.urlId];if(this.groupId!==d){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=g;var v=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,L),v!==-1&&this.setSubtitleTrack(v,w)}},C.findTrackId=function(o){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var w=s[d];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},C.onError=function(o,s){if(A.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},C.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,w=s.groupId,g=s.url;if(o)try{g=o.addDirectives(g)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:g,id:d,groupId:w,deliveryDirectives:o||null})}},C.toggleTrackModes=function(o){var s=this,d=this.media,w=this.subtitleDisplay,g=this.trackId;if(!d)return;var v=D(d.textTracks),L=v.filter(function(p){return p.groupId===s.groupId});if(o===-1)[].slice.call(v).forEach(function(p){p.mode="disabled"});else{var b=L[g];b&&(b.mode="disabled")}var c=L[o];c&&(c.mode=w?"showing":"hidden")},C.setSubtitleTrack=function(o,s){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=w[o])!==null&&d!==void 0&&d.details)||o<-1||o>=w.length)return;this.clearTimer();var g=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var v=g.id,L=g.groupId,b=L===void 0?"":L,c=g.name,p=g.type,h=g.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:b,name:c,type:p,url:h});var a=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:o})},C.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=D(this.media.textTracks),d=0;d<s.length;d++)if(s[d].mode==="hidden")o=d;else if(s[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},U(_,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),_}(M.default);function D(A){for(var _=[],C=0;C<A.length;C++){var l=A[C];l.kind==="subtitles"&&l.label&&_.push(A[C])}return _}J.default=S},"./src/controller/timeline-controller.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"TimelineController",function(){return D});var $=k("./src/polyfills/number.ts"),O=k("./src/events.ts"),M=k("./src/utils/cea-608-parser.ts"),z=k("./src/utils/output-filter.ts"),H=k("./src/utils/webvtt-parser.ts"),U=k("./src/utils/texttrack-utils.ts"),R=k("./src/utils/imsc1-ttml-parser.ts"),m=k("./src/types/loader.ts"),S=k("./src/utils/logger.ts"),D=function(){function l(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new z.default(this,"textTrack1"),w=new z.default(this,"textTrack2"),g=new z.default(this,"textTrack3"),v=new z.default(this,"textTrack4");this.cea608Parser1=new M.default(1,d,w),this.cea608Parser2=new M.default(3,g,v)}s.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(O.Events.FRAG_LOADING,this.onFragLoading,this),s.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=l.prototype;return o.destroy=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,w,g,v,L){for(var b=!1,c=L.length;c--;){var p=L[c],h=_(p[0],p[1],w,g);if(h>=0&&(p[0]=Math.min(p[0],w),p[1]=Math.max(p[1],g),b=!0,h/(g-w)>.5))return}if(b||L.push([w,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,w,g,v)}else{var E=this.Cues.newCue(null,w,g,v);this.hls.trigger(O.Events.CUES_PARSED,{type:"captions",cues:E,track:d})}},o.onInitPtsFound=function(d,w){var g=this,v=w.frag,L=w.id,b=w.initPTS,c=w.timescale,p=this.unparsedVttFrags;L==="main"&&(this.initPTS[v.cc]=b,this.timescale[v.cc]=c),p.length&&(this.unparsedVttFrags=[],p.forEach(function(h){g.onFragLoaded(O.Events.FRAG_LOADED,h)}))},o.getExistingTrack=function(d){var w=this.media;if(w)for(var g=0;g<w.textTracks.length;g++){var v=w.textTracks[g];if(v[d])return v}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var w=this.captionsProperties,g=this.captionsTracks,v=this.media,L=w[d],b=L.label,c=L.languageCode,p=this.getExistingTrack(d);if(p)g[d]=p,Object(U.clearCurrentCues)(g[d]),Object(U.sendAddTrackEvent)(g[d],v);else{var h=this.createTextTrack("captions",b,c);h&&(h[d]=!0,g[d]=h)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var g=w.label,v={_id:d,label:g,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=v,this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},o.createTextTrack=function(d,w,g){var v=this.media;return v?v.addTextTrack(d,w,g):void 0},o.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(U.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var g=0;g<w.length;g++)Object(U.clearCurrentCues)(w[g])},o.onSubtitleTracksUpdated=function(d,w){var g=this;this.textTracks=[];var v=w.subtitleTracks||[],L=v.some(function(h){return h.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var b=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,a){var E;if(a<c.length){for(var y=null,x=0;x<c.length;x++)if(A(c[x],h)){y=c[x];break}y&&(E=y)}E?Object(U.clearCurrentCues)(E):(E=g.createTextTrack("subtitles",h.name,h.lang),E&&(E.mode="disabled")),E&&(E.groupId=h.groupId,g.textTracks.push(E))})}else if(!b&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(d,w){var g=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(v){var L=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!L)return;var b="textTrack"+L[1],c=g.captionsProperties[b];if(!c)return;c.label=v.name,v.lang&&(c.languageCode=v.lang),c.media=v})},o.onFragLoading=function(d,w){var g=this.cea608Parser1,v=this.cea608Parser2,L=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(g&&v))return;if(w.frag.type===m.PlaylistLevelType.MAIN){var c,p,h=w.frag.sn,a=(c=w==null||((p=w.part)===null||p===void 0)?void 0:p.index)!=null?c:-1;h===L+1||h===L&&a===b+1||(g.reset(),v.reset()),this.lastSn=h,this.lastPartIndex=a}},o.onFragLoaded=function(d,w){var g=w.frag,v=w.payload,L=this.initPTS,b=this.unparsedVttFrags;if(g.type===m.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object($.isFiniteNumber)(L[g.cc])){b.push(w),L.length&&this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var c=g.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var p=this.tracks[g.level],h=this.vttCCs;h[g.cc]||(h[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),p&&p.textCodec===R.IMSC1_CODEC?this._parseIMSC1(g,v):this._parseVTTs(g,v,h)}}else this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,w){var g=this,v=this.hls;Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(L){g._appendCues(L,d.level),v.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){S.logger.log("Failed to parse IMSC1: "+L),v.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},o._parseVTTs=function(d,w,g){var v=this,L=this.hls;Object(H.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],g,d.cc,d.start,function(b){v._appendCues(b,d.level),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){v._fallbackToIMSC1(d,w),S.logger.log("Failed to parse VTT cue: "+b),L.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,w){var g=this,v=this.tracks[d.level];v.textCodec||Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){v.textCodec=R.IMSC1_CODEC,g._parseIMSC1(d,w)},function(){v.textCodec="wvtt"})},o._appendCues=function(d,w){var g=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[w];if(v.mode==="disabled")return;d.forEach(function(c){return Object(U.addCueToTrack)(v,c)})}else{var L=this.tracks[w],b=L.default?"default":"subtitles"+w;g.trigger(O.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,w){var g=w.frag;if(g.type===m.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(O.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,w){var g=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(g&&v))return;for(var L=0;L<w.samples.length;L++){var b=w.samples[L].bytes;if(b){var c=this.extractCea608Data(b);g.addData(w.samples[L].pts,c[0]),v.addData(w.samples[L].pts,c[1])}}},o.onBufferFlushing=function(d,w){var g=w.startOffset,v=w.endOffset,L=w.endOffsetSubtitles,b=w.type,c=this.media;if(!c||c.currentTime<v)return;if(!b||b==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(a){return Object(U.removeCuesInRange)(p[a],g,v)})}if(this.config.renderTextTracksNatively&&(g===0&&L!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(a){return Object(U.removeCuesInRange)(h[a],g,L)})}},o.extractCea608Data=function(d){for(var w=d[0]&31,g=2,v=[[],[]],L=0;L<w;L++){var b=d[g++],c=127&d[g++],p=127&d[g++],h=(4&b)!==0,a=3&b;if(c===0&&p===0)continue;h&&((a===0||a===1)&&(v[a].push(c),v[a].push(p)))}return v},l}();function A(l,o){return l&&l.label===o.name&&!(l.textTrack1||l.textTrack2)}function _(l,o,s,d){return Math.min(o,d)-Math.max(l,s)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function O(z,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=H}var M=O.prototype;return M.decrypt=function(H,U){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},U,H)},O}()},"./src/crypt/aes-decryptor.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"removePadding",function(){return O}),k.d(J,"default",function(){return M});var $=k("./src/utils/typed-array.ts");function O(z){var H=z.byteLength,U=H&&new DataView(z.buffer).getUint8(H-1);return U?Object($.sliceUint8)(z,0,H-U):z}var M=function(){function z(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=z.prototype;return H.uint8ArrayToUint32Array_=function(R){for(var m=new DataView(R),S=new Uint32Array(4),D=0;D<4;D++)S[D]=m.getUint32(D*4);return S},H.initTable=function(){var R=this.sBox,m=this.invSBox,S=this.subMix,D=S[0],A=S[1],_=S[2],C=S[3],l=this.invSubMix,o=l[0],s=l[1],d=l[2],w=l[3],g=new Uint32Array(256),v=0,L=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 c=L^L<<1^L<<2^L<<3^L<<4;c=c>>>8^c&255^99,R[v]=c,m[c]=v;var p=g[v],h=g[p],a=g[h],E=g[c]*257^c*16843008;D[v]=E<<24|E>>>8,A[v]=E<<16|E>>>16,_[v]=E<<8|E>>>24,C[v]=E,E=a*16843009^h*65537^p*257^v*16843008,o[c]=E<<24|E>>>8,s[c]=E<<16|E>>>16,d[c]=E<<8|E>>>24,w[c]=E,v?(v=p^g[g[g[a^p]]],L^=g[g[L]]):v=L=1}},H.expandKey=function(R){for(var m=this.uint8ArrayToUint32Array_(R),S=!0,D=0;D<m.length&&S;)S=m[D]===this.key[D],D++;if(S)return;this.key=m;var A=this.keySize=m.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var _=this.ksRows=(A+6+1)*4,C,l,o=this.keySchedule=new Uint32Array(_),s=this.invKeySchedule=new Uint32Array(_),d=this.sBox,w=this.rcon,g=this.invSubMix,v=g[0],L=g[1],b=g[2],c=g[3],p,h;for(C=0;C<_;C++){if(C<A){p=o[C]=m[C];continue}h=p,C%A===0?(h=h<<8|h>>>24,h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255],h^=w[C/A|0]<<24):A>6&&C%A===4&&(h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255]),o[C]=p=(o[C-A]^h)>>>0}for(l=0;l<_;l++)C=_-l,l&3?h=o[C]:h=o[C-4],l<4||C<=4?s[l]=h:s[l]=v[d[h>>>24]]^L[d[h>>>16&255]]^b[d[h>>>8&255]]^c[d[h&255]],s[l]=s[l]>>>0},H.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},H.decrypt=function(R,m,S){for(var D=this.keySize+6,A=this.invKeySchedule,_=this.invSBox,C=this.invSubMix,l=C[0],o=C[1],s=C[2],d=C[3],w=this.uint8ArrayToUint32Array_(S),g=w[0],v=w[1],L=w[2],b=w[3],c=new Int32Array(R),p=new Int32Array(c.length),h,a,E,y,x,B,F,K,V,P,I,Y,ee,oe,pe=this.networkToHostOrderSwap;m<c.length;){for(V=pe(c[m]),P=pe(c[m+1]),I=pe(c[m+2]),Y=pe(c[m+3]),x=V^A[0],B=Y^A[1],F=I^A[2],K=P^A[3],ee=4,oe=1;oe<D;oe++)h=l[x>>>24]^o[B>>16&255]^s[F>>8&255]^d[K&255]^A[ee],a=l[B>>>24]^o[F>>16&255]^s[K>>8&255]^d[x&255]^A[ee+1],E=l[F>>>24]^o[K>>16&255]^s[x>>8&255]^d[B&255]^A[ee+2],y=l[K>>>24]^o[x>>16&255]^s[B>>8&255]^d[F&255]^A[ee+3],x=h,B=a,F=E,K=y,ee=ee+4;h=_[x>>>24]<<24^_[B>>16&255]<<16^_[F>>8&255]<<8^_[K&255]^A[ee],a=_[B>>>24]<<24^_[F>>16&255]<<16^_[K>>8&255]<<8^_[x&255]^A[ee+1],E=_[F>>>24]<<24^_[K>>16&255]<<16^_[x>>8&255]<<8^_[B&255]^A[ee+2],y=_[K>>>24]<<24^_[x>>16&255]<<16^_[B>>8&255]<<8^_[F&255]^A[ee+3],p[m]=pe(h^g),p[m+1]=pe(y^v),p[m+2]=pe(E^L),p[m+3]=pe(a^b),g=V,v=P,L=I,b=Y,m=m+4}return p.buffer},z}()},"./src/crypt/decrypter.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return m});var $=k("./src/crypt/aes-crypto.ts"),O=k("./src/crypt/fast-aes-key.ts"),M=k("./src/crypt/aes-decryptor.ts"),z=k("./src/utils/logger.ts"),H=k("./src/utils/mp4-tools.ts"),U=k("./src/utils/typed-array.ts"),R=16,m=function(){function S(A,_,C){var l=C===void 0?{}:C,o=l.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=A,this.config=_,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var D=S.prototype;return D.destroy=function(){this.observer=null},D.isSync=function(){return this.config.enableSoftwareAES},D.flush=function(){var _=this.currentResult;if(!_){this.reset();return}var C=new Uint8Array(_);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(C):C},D.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},D.decrypt=function(_,C,l,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(_),C,l);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(_),C,l).then(o)},D.softwareDecrypt=function(_,C,l){var o=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(_=Object(H.appendUint8Array)(d,_),this.remainderData=null);var w=this.getValidChunk(_);if(!w.length)return null;o&&(l=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new M.default),g.expandKey(C);var v=s;return this.currentResult=g.decrypt(w.buffer,0,l),this.currentIV=Object(U.sliceUint8)(w,-16).buffer,v||null},D.webCryptoDecrypt=function(_,C,l){var o=this,s=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new O.default(s,C)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var w=new $.default(s,l);return w.decrypt(_.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,_,C,l)})},D.onWebCryptoError=function(_,C,l,o){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",_),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,l,o)},D.getValidChunk=function(_){var C=_,l=_.length-_.length%R;return l!==_.length&&(C=Object(U.sliceUint8)(_,0,l),this.remainderData=Object(U.sliceUint8)(_,l)),C},D.logOnce=function(_){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+_),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function O(z,H){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=H}var M=O.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},O}()},"./src/demux/aacdemuxer.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/demux/base-audio-demuxer.ts"),O=k("./src/demux/adts.ts"),M=k("./src/utils/logger.ts"),z=k("./src/demux/id3.ts");function H(m,S){m.prototype=Object.create(S.prototype),m.prototype.constructor=m,U(m,S)}function U(m,S){return U=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},U(m,S)}var R=function(m){H(S,m);function S(A,_){var C;return C=m.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=A,C.config=_,C}var D=S.prototype;return D.resetInitSegment=function(_,C,l){m.prototype.resetInitSegment.call(this,_,C,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:_,duration:l,inputTimeScale:9e4,dropped:0}},S.probe=function(_){if(!_)return!1;for(var C=z.getID3Data(_,0)||[],l=C.length,o=_.length;l<o;l++)if(O.probe(_,l))return M.logger.log("ADTS sync word found !"),!0;return!1},D.canParse=function(_,C){return O.canParse(_,C)},D.appendFrame=function(_,C,l){O.initTrackConfig(_,this.observer,C,l,_.manifestCodec);var o=O.appendFrame(_,C,l,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}($.default);R.minProbeByteLength=9,J.default=R},"./src/demux/adts.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"getAudioConfig",function(){return z}),k.d(J,"isHeaderPattern",function(){return H}),k.d(J,"getHeaderLength",function(){return U}),k.d(J,"getFullFrameLength",function(){return R}),k.d(J,"canGetFrameLength",function(){return m}),k.d(J,"isHeader",function(){return S}),k.d(J,"canParse",function(){return D}),k.d(J,"probe",function(){return A}),k.d(J,"initTrackConfig",function(){return _}),k.d(J,"getFrameDuration",function(){return C}),k.d(J,"parseFrameHeader",function(){return l}),k.d(J,"appendFrame",function(){return o});var $=k("./src/utils/logger.ts"),O=k("./src/errors.ts"),M=k("./src/events.ts");function z(s,d,w,g){var v,L,b,c,p=navigator.userAgent.toLowerCase(),h=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((d[w+2]&192)>>>6)+1;var E=(d[w+2]&60)>>>2;if(E>a.length-1){s.trigger(M.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return b=(d[w+2]&1)<<2,b|=(d[w+3]&192)>>>6,$.logger.log("manifest codec:"+g+", ADTS type:"+v+", samplingIndex:"+E),/firefox/i.test(p)?E>=6?(v=5,c=new Array(4),L=E-3):(v=2,c=new Array(2),L=E):p.indexOf("android")!==-1?(v=2,c=new Array(2),L=E):(v=5,c=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&E>=6?L=E-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(E>=6&&b===1||/vivaldi/i.test(p))||!g&&b===1)&&(v=2,c=new Array(2)),L=E)),c[0]=v<<3,c[0]|=(E&14)>>1,c[1]|=(E&1)<<7,c[1]|=b<<3,v===5&&(c[1]|=(L&14)>>1,c[2]=(L&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[E],channelCount:b,codec:"mp4a.40."+v,manifestCodec:h}}function H(s,d){return s[d]===255&&(s[d+1]&246)===240}function U(s,d){return s[d+1]&1?7:9}function R(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function m(s,d){return d+5<s.length}function S(s,d){return d+1<s.length&&H(s,d)}function D(s,d){return m(s,d)&&H(s,d)&&R(s,d)<=s.length-d}function A(s,d){if(S(s,d)){var w=U(s,d);if(d+w>=s.length)return!1;var g=R(s,d);if(g<=w)return!1;var v=d+g;return v===s.length||S(s,v)}return!1}function _(s,d,w,g,v){if(!s.samplerate){var L=z(d,w,g,v);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,$.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function C(s){return 1024*9e4/s}function l(s,d,w,g,v){var L=U(s,d),b=R(s,d);if(b-=L,b>0){var c=w+g*v;return{headerLength:L,frameLength:b,stamp:c}}}function o(s,d,w,g,v){var L=C(s.samplerate),b=l(d,w,g,v,L);if(b){var c=b.frameLength,p=b.headerLength,h=b.stamp,a=p+c,E=Math.max(0,w+a-d.length),y;E?(y=new Uint8Array(a-p),y.set(d.subarray(w+p,d.length),0)):y=d.subarray(w+p,w+a);var x={unit:y,pts:h};return E||s.samples.push(x),{sample:x,length:a,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"initPTSFn",function(){return R});var $=k("./src/polyfills/number.ts"),O=k("./src/demux/id3.ts"),M=k("./src/demux/dummy-demuxed-track.ts"),z=k("./src/utils/mp4-tools.ts"),H=k("./src/utils/typed-array.ts"),U=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=m.prototype;return S.resetInitSegment=function(A,_,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(A,_){return!1},S.appendFrame=function(A,_,C){},S.demux=function(A,_){this.cachedData&&(A=Object(z.appendUint8Array)(this.cachedData,A),this.cachedData=null);var C=O.getID3Data(A,0),l=C?C.length:0,o,s,d=this._audioTrack,w=this._id3Track,g=C?O.getTimeStamp(C):void 0,v=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(g,_)),C&&C.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),s=this.initPTS;l<v;){if(this.canParse(A,l)){var L=this.appendFrame(d,A,l);L?(this.frameIndex++,s=L.sample.pts,l+=L.length,o=l):l=v}else O.canParse(A,l)?(C=O.getID3Data(A,l),w.samples.push({pts:s,dts:s,data:C}),l+=C.length,o=l):l++;if(l===v&&o!==v){var b=Object(H.sliceUint8)(A,o);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(M.dummyTrack)(),id3Track:w,textTrack:Object(M.dummyTrack)()}},S.demuxSampleAes=function(A,_,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(A){var _=this.cachedData;return _&&(this.cachedData=null,this.demux(_,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},S.destroy=function(){},m}(),R=function(S,D){return Object($.isFiniteNumber)(S)?S*90:D*9e4};J.default=U},"./src/demux/chunk-cache.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function M(){this.chunks=[],this.dataLength=0}var z=M.prototype;return z.push=function(U){this.chunks.push(U),this.dataLength+=U.length},z.flush=function(){var U=this.chunks,R=this.dataLength,m;if(U.length)U.length===1?m=U[0]:m=O(U,R);else return new Uint8Array(0);return this.reset(),m},z.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function O(M,z){for(var H=new Uint8Array(z),U=0,R=0;R<M.length;R++){var m=M[R];H.set(m,U),U+=m.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/utils/logger.ts"),O=function(){function M(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var z=M.prototype;return z.loadWord=function(){var U=this.data,R=this.bytesAvailable,m=U.byteLength-R,S=new Uint8Array(4),D=Math.min(4,R);if(D===0)throw new Error("no bytes available");S.set(U.subarray(m,m+D)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=D*8,this.bytesAvailable-=D},z.skipBits=function(U){var R;this.bitsAvailable>U?(this.word<<=U,this.bitsAvailable-=U):(U-=this.bitsAvailable,R=U>>3,U-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=U,this.bitsAvailable-=U)},z.readBits=function(U){var R=Math.min(this.bitsAvailable,U),m=this.word>>>32-R;return U>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=U-R,R>0&&this.bitsAvailable?m<<R|this.readBits(R):m},z.skipLZ=function(){var U;for(U=0;U<this.bitsAvailable;++U)if((this.word&2147483648>>>U)!==0)return this.word<<=U,this.bitsAvailable-=U,U;return this.loadWord(),U+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var U=this.skipLZ();return this.readBits(U+1)-1},z.readEG=function(){var U=this.readUEG();return 1&U?1+U>>>1:-1*(U>>>1)},z.readBoolean=function(){return this.readBits(1)===1},z.readUByte=function(){return this.readBits(8)},z.readUShort=function(){return this.readBits(16)},z.readUInt=function(){return this.readBits(32)},z.skipScalingList=function(U){for(var R=8,m=8,S,D=0;D<U;D++)m!==0&&(S=this.readEG(),m=(R+S+256)%256),R=m===0?R:m},z.readSPS=function(){var U=0,R=0,m=0,S=0,D,A,_,C=this.readUByte.bind(this),l=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),g=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);C();var L=C();if(l(5),d(3),C(),g(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var b=o();if(b===3&&d(1),g(),g(),d(1),s())for(A=b!==3?8:12,_=0;_<A;_++)s()&&(_<6?v(16):v(64))}g();var c=o();if(c===0)o();else if(c===1)for(d(1),w(),w(),D=o(),_=0;_<D;_++)w();g(),d(1);var p=o(),h=o(),a=l(1);a===0&&d(1),d(1),s()&&(U=o(),R=o(),m=o(),S=o());var E=[1,1];if(s()&&s()){var y=C();switch(y){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((p+1)*16-U*2-R*2),height:(2-a)*(h+1)*16-(a?2:4)*(m+S),pixelRatio:E}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();J.default=O},"./src/demux/id3.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"isHeader",function(){return $}),k.d(J,"isFooter",function(){return O}),k.d(J,"getID3Data",function(){return M}),k.d(J,"canParse",function(){return H}),k.d(J,"getTimeStamp",function(){return U}),k.d(J,"isTimeStampFrame",function(){return R}),k.d(J,"getID3Frames",function(){return S}),k.d(J,"decodeFrame",function(){return D}),k.d(J,"utf8ArrayToStr",function(){return o}),k.d(J,"testables",function(){return s});var $=function(v,L){return L+10<=v.length&&(v[L]===73&&v[L+1]===68&&v[L+2]===51&&(v[L+3]<255&&v[L+4]<255&&(v[L+6]<128&&v[L+7]<128&&v[L+8]<128&&v[L+9]<128)))},O=function(v,L){return L+10<=v.length&&(v[L]===51&&v[L+1]===68&&v[L+2]===73&&(v[L+3]<255&&v[L+4]<255&&(v[L+6]<128&&v[L+7]<128&&v[L+8]<128&&v[L+9]<128)))},M=function(v,L){for(var b=L,c=0;$(v,L);){c+=10;var p=z(v,L+6);c+=p,O(v,L+10)&&(c+=10),L+=c}return c>0?v.subarray(b,b+c):void 0},z=function(v,L){var b=0;return b=(v[L]&127)<<21,b|=(v[L+1]&127)<<14,b|=(v[L+2]&127)<<7,b|=v[L+3]&127,b},H=function(v,L){return $(v,L)&&z(v,L+6)+10<=v.length-L},U=function(v){for(var L=S(v),b=0;b<L.length;b++){var c=L[b];if(R(c))return l(c)}return},R=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},m=function(v){var L=String.fromCharCode(v[0],v[1],v[2],v[3]),b=z(v,4),c=10;return{type:L,size:b,data:v.subarray(c,c+b)}},S=function(v){for(var L=0,b=[];$(v,L);){var c=z(v,L+6);L+=10;for(var p=L+c;L+8<p;){var h=m(v.subarray(L)),a=D(h);a&&b.push(a),L+=h.size+10}O(v,L)&&(L+=10)}return b},D=function(v){return v.type==="PRIV"?A(v):v.type[0]==="W"?C(v):_(v)},A=function(v){if(v.size<2)return;var L=o(v.data,!0),b=new Uint8Array(v.data.subarray(L.length+1));return{key:v.type,info:L,data:b.buffer}},_=function(v){if(v.size<2)return;if(v.type==="TXXX"){var L=1,b=o(v.data.subarray(L),!0);L+=b.length+1;var c=o(v.data.subarray(L));return{key:v.type,info:b,data:c}}var p=o(v.data.subarray(1));return{key:v.type,data:p}},C=function(v){if(v.type==="WXXX"){if(v.size<2)return;var L=1,b=o(v.data.subarray(L),!0);L+=b.length+1;var c=o(v.data.subarray(L));return{key:v.type,info:b,data:c}}var p=o(v.data);return{key:v.type,data:p}},l=function(v){if(v.data.byteLength===8){var L=new Uint8Array(v.data),b=L[3]&1,c=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return c/=45,b&&(c+=4772185884e-2),Math.round(c)}return},o=function(v,L){L===void 0&&(L=!1);var b=w();if(b){var c=b.decode(v);if(L){var p=c.indexOf("\0");return p!==-1?c.substring(0,p):c}return c.replace(/\0/g,"")}for(var h=v.length,a,E,y,x="",B=0;B<h;){if(a=v[B++],a===0&&L)return x;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:x+=String.fromCharCode(a);break;case 12:case 13:E=v[B++],x+=String.fromCharCode((a&31)<<6|E&63);break;case 14:E=v[B++],y=v[B++],x+=String.fromCharCode((a&15)<<12|(E&63)<<6|(y&63)<<0);break;default:}}return x},s={decodeTextFrame:_},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/demux/base-audio-demuxer.ts"),O=k("./src/demux/id3.ts"),M=k("./src/utils/logger.ts"),z=k("./src/demux/mpegaudio.ts");function H(m,S){m.prototype=Object.create(S.prototype),m.prototype.constructor=m,U(m,S)}function U(m,S){return U=Object.setPrototypeOf||function(A,_){return A.__proto__=_,A},U(m,S)}var R=function(m){H(S,m);function S(){return m.apply(this,arguments)||this}var D=S.prototype;return D.resetInitSegment=function(_,C,l){m.prototype.resetInitSegment.call(this,_,C,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:_,duration:l,inputTimeScale:9e4,dropped:0}},S.probe=function(_){if(!_)return!1;for(var C=O.getID3Data(_,0)||[],l=C.length,o=_.length;l<o;l++)if(z.probe(_,l))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},D.canParse=function(_,C){return z.canParse(_,C)},D.appendFrame=function(_,C,l){return this.initPTS===null?void 0:z.appendFrame(_,C,l,this.initPTS,this.frameIndex)},S}($.default);R.minProbeByteLength=4,J.default=R},"./src/demux/mp4demuxer.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/utils/mp4-tools.ts"),O=k("./src/demux/dummy-demuxed-track.ts"),M=function(){function z(U,R){this.remainderData=null,this.config=void 0,this.config=R}var H=z.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},z.probe=function(R){return Object($.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},H.demux=function(R){var m=R,S=Object(O.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object($.appendUint8Array)(this.remainderData,R));var D=Object($.segmentValidRange)(m);this.remainderData=D.remainder,S.samples=D.valid||new Uint8Array}else S.samples=m;return{audioTrack:Object(O.dummyTrack)(),avcTrack:S,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},H.flush=function(){var R=Object(O.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(O.dummyTrack)(),avcTrack:R,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},H.demuxSampleAes=function(R,m,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},z}();M.minProbeByteLength=1024,J.default=M},"./src/demux/mpegaudio.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"appendFrame",function(){return U}),k.d(J,"parseHeader",function(){return R}),k.d(J,"isHeaderPattern",function(){return m}),k.d(J,"isHeader",function(){return S}),k.d(J,"canParse",function(){return D}),k.d(J,"probe",function(){return A});var $=null,O=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],z=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function U(_,C,l,o,s){if(l+24>C.length)return;var d=R(C,l);if(d&&l+d.frameLength<=C.length){var w=d.samplesPerFrame*9e4/d.sampleRate,g=o+s*w,v={unit:C.subarray(l,l+d.frameLength),pts:g,dts:g};return _.config=[],_.channelCount=d.channelCount,_.samplerate=d.sampleRate,_.samples.push(v),{sample:v,length:d.frameLength,missing:0}}}function R(_,C){var l=_[C+1]>>3&3,o=_[C+1]>>1&3,s=_[C+2]>>4&15,d=_[C+2]>>2&3;if(l!==1&&s!==0&&s!==15&&d!==3){var w=_[C+2]>>1&1,g=_[C+3]>>6,v=l===3?3-o:o===3?3:4,L=O[v*14+s-1]*1e3,b=l===3?0:l===2?1:2,c=M[b*3+d],p=g===3?1:2,h=z[l][o],a=H[o],E=h*8*a,y=Math.floor(h*L/c+w)*a;if($===null){var x=navigator.userAgent||"",B=x.match(/Chrome\/(\d+)/i);$=B?parseInt(B[1]):0}var F=!!$&&$<=87;return F&&o===2&&L>=224e3&&g===0&&(_[C+3]=_[C+3]|128),{sampleRate:c,channelCount:p,frameLength:y,samplesPerFrame:E}}}function m(_,C){return _[C]===255&&(_[C+1]&224)===224&&(_[C+1]&6)!==0}function S(_,C){return C+1<_.length&&m(_,C)}function D(_,C){var l=4;return m(_,C)&&l<=_.length-C}function A(_,C){if(C+1<_.length&&m(_,C)){var l=4,o=R(_,C),s=l;o!=null&&o.frameLength&&(s=o.frameLength);var d=C+s;return d===_.length||S(_,d)}return!1}},"./src/demux/sample-aes.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/crypt/decrypter.ts"),O=k("./src/demux/tsdemuxer.ts"),M=function(){function z(U,R,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new $.default(U,R,{removePKCS7Padding:!1})}var H=z.prototype;return H.decryptBuffer=function(R,m){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,m)},H.decryptAacSample=function(R,m,S,D){var A=R[m].unit,_=A.subarray(16,A.length-A.length%16),C=_.buffer.slice(_.byteOffset,_.byteOffset+_.length),l=this;this.decryptBuffer(C,function(o){var s=new Uint8Array(o);A.set(s,16),D||l.decryptAacSamples(R,m+1,S)})},H.decryptAacSamples=function(R,m,S){for(;;m++){if(m>=R.length){S();return}if(R[m].unit.length<32)continue;var D=this.decrypter.isSync();if(this.decryptAacSample(R,m,S,D),!D)return}},H.getAvcEncryptedData=function(R){for(var m=Math.floor((R.length-48)/160)*16+16,S=new Int8Array(m),D=0,A=32;A<=R.length-16;A+=160,D+=16)S.set(R.subarray(A,A+16),D);return S},H.getAvcDecryptedUnit=function(R,m){for(var S=new Uint8Array(m),D=0,A=32;A<=R.length-16;A+=160,D+=16)R.set(S.subarray(D,D+16),A);return R},H.decryptAvcSample=function(R,m,S,D,A,_){var C=Object(O.discardEPB)(A.data),l=this.getAvcEncryptedData(C),o=this;this.decryptBuffer(l.buffer,function(s){A.data=o.getAvcDecryptedUnit(C,s),_||o.decryptAvcSamples(R,m,S+1,D)})},H.decryptAvcSamples=function(R,m,S,D){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,S=0){if(m>=R.length){D();return}for(var A=R[m].units;!(S>=A.length);S++){var _=A[S];if(_.data.length<=48||_.type!==1&&_.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(R,m,S,D,_,C),!C)return}}},z}();J.default=M},"./src/demux/transmuxer-interface.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return A});var $=k("./node_modules/webworkify-webpack/index.js"),O=k.n($),M=k("./src/events.ts"),z=k("./src/demux/transmuxer.ts"),H=k("./src/utils/logger.ts"),U=k("./src/errors.ts"),R=k("./src/utils/mediasource-helper.ts"),m=k("./node_modules/eventemitter3/index.js"),S=k.n(m),D=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function _(l,o,s,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=o,this.onTransmuxComplete=s,this.onFlush=d;var g=l.config,v=function(h,a){a=a||{},a.frag=w.frag,a.id=w.id,l.trigger(h,a)};this.observer=new m.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,v),this.observer.on(M.Events.ERROR,v);var L={mp4:D.isTypeSupported("video/mp4"),mpeg:D.isTypeSupported("audio/mpeg"),mp3:D.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var c;try{c=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(p){l.trigger(M.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},c.postMessage({cmd:"init",typeSupported:L,vendor:b,id:o,config:JSON.stringify(g)})}catch(p){H.logger.warn("Error in worker:",p),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new z.default(this.observer,L,g,b,o),this.worker=null}}else this.transmuxer=new z.default(this.observer,L,g,b,o)}var C=_.prototype;return C.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},C.push=function(o,s,d,w,g,v,L,b,c,p){var h=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,E=this.worker,y=v?v.start:g.start,x=g.decryptdata,B=this.frag,F=!(B&&g.cc===B.cc),K=!(B&&c.level===B.level),V=B?c.sn-B.sn:-1,P=this.part?c.part-this.part.index:1,I=!K&&(V===1||V===0&&P===1),Y=self.performance.now();(K||V||g.stats.parsing.start===0)&&(g.stats.parsing.start=Y),v&&(P||!I)&&(v.stats.parsing.start=Y);var ee=new z.TransmuxState(F,I,b,K,y);if(!I||F){H.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
discontinuity: `+F+`
trackSwitch: `+K+`
contiguous: `+I+`
accurateTimeOffset: `+b+`
timeOffset: `+y);var oe=new z.TransmuxConfig(d,w,s,L,p);this.configureTransmuxer(oe)}if(this.frag=g,this.part=v,E)E.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:c,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var pe=a.push(o,x,c,ee);Object(z.isPromise)(pe)?pe.then(function(Oe){h.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(pe)}},C.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(d){var g=d.flush(o);Object(z.isPromise)(g)?g.then(function(v){s.handleFlushResult(v,o)}):this.handleFlushResult(g,o)}},C.handleFlushResult=function(o,s){var d=this;o.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(s)},C.onWorkerMessage=function(o){var s=o.data,d=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,d.trigger(s.event,s.data);break}}},C.configureTransmuxer=function(o){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},C.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},_}()},"./src/demux/transmuxer-worker.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return U});var $=k("./src/demux/transmuxer.ts"),O=k("./src/events.ts"),M=k("./src/utils/logger.ts"),z=k("./node_modules/eventemitter3/index.js"),H=k.n(z);function U(A){var _=new z.EventEmitter,C=function(o,s){A.postMessage({event:o,data:s})};_.on(O.Events.FRAG_DECRYPTED,C),_.on(O.Events.ERROR,C),A.addEventListener("message",function(l){var o=l.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);A.transmuxer=new $.default(_,o.typeSupported,s,o.vendor,o.id),Object(M.enableLogs)(s.debug),C("init",null);break}case"configure":{A.transmuxer.configure(o.config);break}case"demux":{var d=A.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object($.isPromise)(d)?d.then(function(v){R(A,v)}):R(A,d);break}case"flush":{var w=o.chunkMeta,g=A.transmuxer.flush(w);Object($.isPromise)(g)?g.then(function(v){S(A,v,w)}):S(A,g,w);break}default:break}})}function R(A,_){if(D(_.remuxResult))return;var C=[],l=_.remuxResult,o=l.audio,s=l.video;o&&m(C,o),s&&m(C,s),A.postMessage({event:"transmuxComplete",data:_},C)}function m(A,_){_.data1&&A.push(_.data1.buffer),_.data2&&A.push(_.data2.buffer)}function S(A,_,C){_.forEach(function(l){R(A,l)}),A.postMessage({event:"flush",data:C})}function D(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s}),k.d(J,"isPromise",function(){return g}),k.d(J,"TransmuxConfig",function(){return v}),k.d(J,"TransmuxState",function(){return L});var $=k("./src/events.ts"),O=k("./src/errors.ts"),M=k("./src/crypt/decrypter.ts"),z=k("./src/demux/aacdemuxer.ts"),H=k("./src/demux/mp4demuxer.ts"),U=k("./src/demux/tsdemuxer.ts"),R=k("./src/demux/mp3demuxer.ts"),m=k("./src/remux/mp4-remuxer.ts"),S=k("./src/remux/passthrough-remuxer.ts"),D=k("./src/demux/chunk-cache.ts"),A=k("./src/utils/mp4-tools.ts"),_=k("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(b){_.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var l=[{demux:U.default,remux:m.default},{demux:H.default,remux:S.default},{demux:z.default,remux:m.default},{demux:R.default,remux:m.default}],o=1024;l.forEach(function(b){var c=b.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function b(p,h,a,E,y){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 D.default,this.observer=p,this.typeSupported=h,this.config=a,this.vendor=E,this.id=y}var c=b.prototype;return c.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},c.push=function(h,a,E,y){var x=this,B=E.transmuxing;B.executeStart=C();var F=new Uint8Array(h),K=this.cache,V=this.config,P=this.currentTransmuxState,I=this.transmuxConfig;y&&(this.currentTransmuxState=y);var Y=d(F,a);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(F,Y.key.buffer,Y.iv.buffer);if(!oe)return B.executeEnd=C(),w(E);F=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(F,Y.key.buffer,Y.iv.buffer).then(function(ke){var Pe=x.push(ke,null,E);return x.decryptionPromise=null,Pe}),this.decryptionPromise}var pe=y||P,Oe=pe.contiguous,Se=pe.discontinuity,we=pe.trackSwitch,Te=pe.accurateTimeOffset,Ce=pe.timeOffset,me=I.audioCodec,se=I.videoCodec,te=I.defaultInitPts,ce=I.duration,ae=I.initSegmentData;if((Se||we)&&this.resetInitSegment(ae,me,se,ce),Se&&this.resetInitialTimestamp(te),Oe||this.resetContiguity(),this.needsProbing(F,Se,we)){if(K.dataLength){var Ae=K.flush();F=Object(A.appendUint8Array)(Ae,F)}this.configureTransmuxer(F,I)}var Re=this.transmux(F,Y,Ce,Te,E),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,B.executeEnd=C(),Re},c.flush=function(h){var a=this,E=h.transmuxing;E.executeStart=C();var y=this.decrypter,x=this.cache,B=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(h)});var K=[],V=B.timeOffset;if(y){var P=y.flush();P&&K.push(this.push(P,null,h))}var I=x.dataLength;x.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return I>=o&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=C(),[w(h)];var oe=Y.flush(V);return g(oe)?oe.then(function(pe){return a.flushRemux(K,pe,h),K}):(this.flushRemux(K,oe,h),K)},c.flushRemux=function(h,a,E){var y=a.audioTrack,x=a.avcTrack,B=a.id3Track,F=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,P=K.timeOffset;_.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var I=this.remuxer.remux(y,x,B,F,P,V,!0,this.id);h.push({remuxResult:I,chunkMeta:E}),E.transmuxing.executeEnd=C()},c.resetInitialTimestamp=function(h){var a=this.demuxer,E=this.remuxer;if(!a||!E)return;a.resetTimeStamp(h),E.resetTimeStamp(h)},c.resetContiguity=function(){var h=this.demuxer,a=this.remuxer;if(!h||!a)return;h.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(h,a,E,y){var x=this.demuxer,B=this.remuxer;if(!x||!B)return;x.resetInitSegment(a,E,y),B.resetInitSegment(h,a,E)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(h,a,E,y,x){var B;return a&&a.method==="SAMPLE-AES"?B=this.transmuxSampleAes(h,a,E,y,x):B=this.transmuxUnencrypted(h,E,y,x),B},c.transmuxUnencrypted=function(h,a,E,y){var x=this.demuxer.demux(h,a,!1,!this.config.progressive),B=x.audioTrack,F=x.avcTrack,K=x.id3Track,V=x.textTrack,P=this.remuxer.remux(B,F,K,V,a,E,!1,this.id);return{remuxResult:P,chunkMeta:y}},c.transmuxSampleAes=function(h,a,E,y,x){var B=this;return this.demuxer.demuxSampleAes(h,a,E).then(function(F){var K=B.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,E,y,!1,B.id);return{remuxResult:K,chunkMeta:x}})},c.configureTransmuxer=function(h,a){for(var E=this.config,y=this.observer,x=this.typeSupported,B=this.vendor,F=a.audioCodec,K=a.defaultInitPts,V=a.duration,P=a.initSegmentData,I=a.videoCodec,Y,ee=0,oe=l.length;ee<oe;ee++)if(l[ee].demux.probe(h)){Y=l[ee];break}Y||(_.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:H.default,remux:S.default});var pe=this.demuxer,Oe=this.remuxer,Se=Y.remux,we=Y.demux;(!Oe||!(Oe instanceof Se))&&(this.remuxer=new Se(y,E,x,B)),(!pe||!(pe instanceof we))&&(this.demuxer=new we(y,E,x),this.probe=we.probe),this.resetInitSegment(P,F,I,V),this.resetInitialTimestamp(K)},c.needsProbing=function(h,a,E){return!this.demuxer||!this.remuxer||a||E},c.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new M.default(this.observer,this.config)),h},b}();function d(b,c){var p=null;return b.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(p=c),p}var w=function(c){return{remuxResult:{},chunkMeta:c}};function g(b){return"then"in b&&b.then instanceof Function}var v=function(c,p,h,a,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=p,this.initSegmentData=h,this.duration=a,this.defaultInitPts=E},L=function(c,p,h,a,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=p,this.accurateTimeOffset=h,this.trackSwitch=a,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"discardEPB",function(){return w});var $=k("./src/demux/adts.ts"),O=k("./src/demux/mpegaudio.ts"),M=k("./src/demux/exp-golomb.ts"),z=k("./src/demux/id3.ts"),H=k("./src/demux/sample-aes.ts"),U=k("./src/events.ts"),R=k("./src/utils/mp4-tools.ts"),m=k("./src/utils/logger.ts"),S=k("./src/errors.ts"),D={video:1,audio:2,id3:3,text:4},A=function(){function g(L,b,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=b,this.typeSupported=c}g.probe=function(b){var c=g.syncOffset(b);return c<0?!1:(c&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},g.syncOffset=function(b){for(var c=Math.min(1e3,b.length-3*188),p=0;p<c;){if(b[p]===71&&b[p+188]===71&&b[p+2*188]===71)return p;p++}return-1},g.createTrack=function(b,c){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:D[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?c:void 0}};var v=g.prototype;return v.resetInitSegment=function(b,c,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",p),this._audioTrack=g.createTrack("audio",p),this._id3Track=g.createTrack("id3",p),this._txtTrack=g.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=c,this._duration=p},v.resetTimeStamp=function(){},v.resetContiguity=function(){var b=this._audioTrack,c=this._avcTrack,p=this._id3Track;b&&(b.pesData=null),c&&(c.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(b,c,p,h){p===void 0&&(p=!1),h===void 0&&(h=!1),p||(this.sampleAes=null);var a,E=this._avcTrack,y=this._audioTrack,x=this._id3Track,B=E.pid,F=E.pesData,K=y.pid,V=x.pid,P=y.pesData,I=x.pesData,Y=!1,ee=this.pmtParsed,oe=this._pmtId,pe=b.length;if(this.remainderData&&(b=Object(R.appendUint8Array)(this.remainderData,b),pe=b.length,this.remainderData=null),pe<188&&!h)return this.remainderData=b,{audioTrack:y,avcTrack:E,id3Track:x,textTrack:this._txtTrack};var Oe=Math.max(0,g.syncOffset(b));pe-=(pe+Oe)%188,pe<b.byteLength&&!h&&(this.remainderData=new Uint8Array(b.buffer,pe,b.buffer.byteLength-pe));for(var Se=Oe;Se<pe;Se+=188)if(b[Se]===71){var we=!!(b[Se+1]&64),Te=((b[Se+1]&31)<<8)+b[Se+2],Ce=(b[Se+3]&48)>>4,me=void 0;if(Ce>1){if(me=Se+5+b[Se+4],me===Se+188)continue}else me=Se+4;switch(Te){case B:we&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(me,Se+188)),F.size+=Se+188-me);break;case K:we&&(P&&(a=o(P))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(b.subarray(me,Se+188)),P.size+=Se+188-me);break;case V:we&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(b.subarray(me,Se+188)),I.size+=Se+188-me);break;case 0:we&&(me+=b[me]+1),oe=this._pmtId=C(b,me);break;case oe:{we&&(me+=b[me]+1);var se=l(b,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);B=se.avc,B>0&&(E.pid=B),K=se.audio,K>0&&(y.pid=K,y.isAAC=se.isAAC),V=se.id3,V>0&&(x.pid=V),Y&&!ee&&(m.logger.log("reparse from beginning"),Y=!1,Se=Oe-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=F,y.pesData=P,x.pesData=I;var te={audioTrack:y,avcTrack:E,id3Track:x,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(te),te},v.flush=function(){var b=this.remainderData;this.remainderData=null;var c;return b?c=this.demux(b,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},v.extractRemainingSamples=function(b){var c=b.audioTrack,p=b.avcTrack,h=b.id3Track,a=p.pesData,E=c.pesData,y=h.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),p.pesData=null):p.pesData=a,E&&(x=o(E))?(c.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),c.pesData=null):(E!=null&&E.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=E),y&&(x=o(y))?(this.parseID3PES(x),h.pesData=null):h.pesData=y},v.demuxSampleAes=function(b,c,p){var h=this.demux(b,p,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,c);return this.decrypt(h,a)},v.decrypt=function(b,c){return new Promise(function(p){var h=b.audioTrack,a=b.avcTrack;h.samples&&h.isAAC?c.decryptAacSamples(h.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){p(b)}):p(b)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){p(b)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(b,c){var p=this,h=this._avcTrack,a=this.parseAVCNALu(b.data),E=!1,y=this.avcSample,x,B=!1;b.data=null,y&&a.length&&!h.audFound&&(s(y,h),y=this.avcSample=_(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{x=!0,y||(y=p.avcSample=_(!0,b.pts,b.dts,"")),E&&(y.debug+="NDR "),y.frame=!0;var K=F.data;if(B&&K.length>4){var V=new M.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(y.key=!0)}break}case 5:x=!0,y||(y=p.avcSample=_(!0,b.pts,b.dts,"")),E&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{x=!0,E&&y&&(y.debug+="SEI ");var P=new M.default(w(F.data));P.readUByte();for(var I=0,Y=0,ee=!1,oe=0;!ee&&P.bytesAvailable>1;){I=0;do oe=P.readUByte(),I+=oe;while(oe===255);Y=0;do oe=P.readUByte(),Y+=oe;while(oe===255);if(I===4&&P.bytesAvailable!==0){ee=!0;var pe=P.readUByte();if(pe===181){var Oe=P.readUShort();if(Oe===49){var Se=P.readUInt();if(Se===1195456820){var we=P.readUByte();if(we===3){for(var Te=P.readUByte(),Ce=P.readUByte(),me=31&Te,se=[Te,Ce],te=0;te<me;te++)se.push(P.readUByte()),se.push(P.readUByte()),se.push(P.readUByte());d(p._txtTrack.samples,{type:3,pts:b.pts,bytes:se})}}}}}else if(I===5&&P.bytesAvailable!==0){if(ee=!0,Y>16){for(var ce=[],ae=0;ae<16;ae++)ce.push(P.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&ce.push("-");for(var Ae=Y-16,Re=new Uint8Array(Ae),xe=0;xe<Ae;xe++)Re[xe]=P.readUByte();d(p._txtTrack.samples,{pts:b.pts,payloadType:I,uuid:ce.join(""),userData:Object(z.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if(Y<P.bytesAvailable)for(var ke=0;ke<Y;ke++)P.readUByte()}break}case 7:if(x=!0,B=!0,E&&y&&(y.debug+="SPS "),!h.sps){var Pe=new M.default(F.data),je=Pe.readSPS();h.width=je.width,h.height=je.height,h.pixelRatio=je.pixelRatio,h.sps=[F.data],h.duration=p._duration;for(var We=F.data.subarray(1,4),Be="avc1.",Ie=0;Ie<3;Ie++){var tt=We[Ie].toString(16);tt.length<2&&(tt="0"+tt),Be+=tt}h.codec=Be}break;case 8:x=!0,E&&y&&(y.debug+="PPS "),h.pps||(h.pps=[F.data]);break;case 9:x=!1,h.audFound=!0,y&&s(y,h),y=p.avcSample=_(!1,b.pts,b.dts,E?"AUD ":"");break;case 12:x=!1;break;default:x=!1,y&&(y.debug+="unknown NAL "+F.type+" ");break}if(y&&x){var Ze=y.units;Ze.push(F)}}),c&&y&&(s(y,h),this.avcSample=null)},v.getLastNalUnit=function(){var b,c=this.avcSample,p;if(!c||c.units.length===0){var h=this._avcTrack.samples;c=h[h.length-1]}if((b=c)!==null&&b!==void 0&&b.units){var a=c.units;p=a[a.length-1]}return p},v.parseAVCNALu=function(b){var c=b.byteLength,p=this._avcTrack,h=p.naluState||0,a=h,E=[],y=0,x,B,F,K=-1,V=0;for(h===-1&&(K=0,V=b[0]&31,h=0,y=1);y<c;){if(x=b[y++],!h){h=x?0:1;continue}if(h===1){h=x?0:2;continue}if(!x)h=3;else if(x===1){if(K>=0){var P={data:b.subarray(K,y-h-1),type:V};E.push(P)}else{var I=this.getLastNalUnit();if(I&&(a&&y<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),B=y-h-1,B>0)){var Y=new Uint8Array(I.data.byteLength+B);Y.set(I.data,0),Y.set(b.subarray(0,B),I.data.byteLength),I.data=Y,I.state=0}}y<c?(F=b[y]&31,K=y,V=F,h=0):h=-1}else h=0}if(K>=0&&h>=0){var ee={data:b.subarray(K,c),type:V,state:h};E.push(ee)}if(E.length===0){var oe=this.getLastNalUnit();if(oe){var pe=new Uint8Array(oe.data.byteLength+b.byteLength);pe.set(oe.data,0),pe.set(b,oe.data.byteLength),oe.data=pe}}return p.naluState=h,E},v.parseAACPES=function(b){var c=0,p=this._audioTrack,h=this.aacOverFlow,a=b.data;if(h){this.aacOverFlow=null;var E=h.sample.unit.byteLength,y=Math.min(h.missing,E),x=E-y;h.sample.unit.set(a.subarray(0,y),x),p.samples.push(h.sample),c=h.missing}var B,F;for(B=c,F=a.length;B<F-1&&!$.isHeader(a,B);B++);if(B!==c){var K,V;if(B<F-1?(K="AAC PES did not start with ADTS header,offset:"+B,V=!1):(K="no ADTS header found in AAC PES",V=!0),m.logger.warn("parsing error:"+K),this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}$.initTrackConfig(p,this.observer,a,B,this.audioCodec);var P;if(b.pts!==void 0)P=b.pts;else if(h){var I=$.getFrameDuration(p.samplerate);P=h.sample.pts+I}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;B<F;)if($.isHeader(a,B)){if(B+5<F){var ee=$.appendFrame(p,a,B,P,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{B+=ee.length,Y++;continue}}break}else B++},v.parseMPEGPES=function(b){var c=b.data,p=c.length,h=0,a=0,E=b.pts;if(E===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<p;)if(O.isHeader(c,a)){var y=O.appendFrame(this._audioTrack,c,a,E,h);if(y)a+=y.length,h++;else break}else a++},v.parseID3PES=function(b){if(b.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},g}();A.minProbeByteLength=188;function _(g,v,L,b){return{key:g,frame:!1,pts:v,dts:L,units:[],debug:b,length:0}}function C(g,v){return(g[v+10]&31)<<8|g[v+11]}function l(g,v,L,b){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(g[v+1]&15)<<8|g[v+2],h=v+3+p-4,a=(g[v+10]&15)<<8|g[v+11];for(v+=12+a;v<h;){var E=(g[v+1]&31)<<8|g[v+2];switch(g[v]){case 207:if(!b){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=E);break;case 21:c.id3===-1&&(c.id3=E);break;case 219:if(!b){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=E);break;case 3:case 4:L?c.audio===-1&&(c.audio=E,c.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((g[v+3]&15)<<8|g[v+4])+5}return c}function o(g){var v=0,L,b,c,p,h,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var E=new Uint8Array(a[0].length+a[1].length);E.set(a[0]),E.set(a[1],a[0].length),a[0]=E,a.splice(1,1)}L=a[0];var y=(L[0]<<16)+(L[1]<<8)+L[2];if(y===1){if(b=(L[4]<<8)+L[5],b&&b>g.size-6)return null;var x=L[7];x&192&&(p=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,x&64?(h=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,p-h>60*9e4&&(m.logger.warn(Math.round((p-h)/9e4)+"s delta between PTS and DTS, align them"),p=h)):h=p),c=L[8];var B=c+9;if(g.size<=B)return null;g.size-=B;for(var F=new Uint8Array(g.size),K=0,V=a.length;K<V;K++){L=a[K];var P=L.byteLength;if(B)if(B>P){B-=P;continue}else L=L.subarray(B),P-=B,B=0;F.set(L,v),v+=P}return b&&(b-=c+3),{data:F,pts:p,dts:h,len:b}}return null}function s(g,v){if(g.units.length&&g.frame){if(g.pts===void 0){var L=v.samples,b=L.length;if(b){var c=L[b-1];g.pts=c.pts,g.dts=c.dts}else{v.dropped++;return}}v.samples.push(g)}g.debug.length&&m.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function d(g,v){var L=g.length;if(L>0){if(v.pts>=g[L-1].pts)g.push(v);else for(var b=L-1;b>=0;b--)if(v.pts<g[b].pts){g.splice(b,0,v);break}}else g.push(v)}function w(g){for(var v=g.byteLength,L=[],b=1;b<v-2;)g[b]===0&&g[b+1]===0&&g[b+2]===3?(L.push(b+2),b+=2):b++;if(L.length===0)return g;var c=v-L.length,p=new Uint8Array(c),h=0;for(b=0;b<c;h++,b++)h===L[0]&&(h++,L.shift()),p[b]=g[h];return p}J.default=A},"./src/errors.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"ErrorTypes",function(){return $}),k.d(J,"ErrorDetails",function(){return O});var $;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})($||($={}));var O;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(O||(O={}))},"./src/events.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"Events",function(){return $});var $;(function(O){O.MEDIA_ATTACHING="hlsMediaAttaching",O.MEDIA_ATTACHED="hlsMediaAttached",O.MEDIA_DETACHING="hlsMediaDetaching",O.MEDIA_DETACHED="hlsMediaDetached",O.BUFFER_RESET="hlsBufferReset",O.BUFFER_CODECS="hlsBufferCodecs",O.BUFFER_CREATED="hlsBufferCreated",O.BUFFER_APPENDING="hlsBufferAppending",O.BUFFER_APPENDED="hlsBufferAppended",O.BUFFER_EOS="hlsBufferEos",O.BUFFER_FLUSHING="hlsBufferFlushing",O.BUFFER_FLUSHED="hlsBufferFlushed",O.MANIFEST_LOADING="hlsManifestLoading",O.MANIFEST_LOADED="hlsManifestLoaded",O.MANIFEST_PARSED="hlsManifestParsed",O.LEVEL_SWITCHING="hlsLevelSwitching",O.LEVEL_SWITCHED="hlsLevelSwitched",O.LEVEL_LOADING="hlsLevelLoading",O.LEVEL_LOADED="hlsLevelLoaded",O.LEVEL_UPDATED="hlsLevelUpdated",O.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",O.LEVELS_UPDATED="hlsLevelsUpdated",O.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",O.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",O.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",O.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",O.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",O.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",O.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",O.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",O.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",O.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",O.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",O.CUES_PARSED="hlsCuesParsed",O.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",O.INIT_PTS_FOUND="hlsInitPtsFound",O.FRAG_LOADING="hlsFragLoading",O.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",O.FRAG_LOADED="hlsFragLoaded",O.FRAG_DECRYPTED="hlsFragDecrypted",O.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",O.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",O.FRAG_PARSING_METADATA="hlsFragParsingMetadata",O.FRAG_PARSED="hlsFragParsed",O.FRAG_BUFFERED="hlsFragBuffered",O.FRAG_CHANGED="hlsFragChanged",O.FPS_DROP="hlsFpsDrop",O.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",O.ERROR="hlsError",O.DESTROYING="hlsDestroying",O.KEY_LOADING="hlsKeyLoading",O.KEY_LOADED="hlsKeyLoaded",O.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",O.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return g});var $=k("./node_modules/url-toolkit/src/url-toolkit.js"),O=k.n($),M=k("./src/loader/playlist-loader.ts"),z=k("./src/loader/key-loader.ts"),H=k("./src/controller/id3-track-controller.ts"),U=k("./src/controller/latency-controller.ts"),R=k("./src/controller/level-controller.ts"),m=k("./src/controller/fragment-tracker.ts"),S=k("./src/controller/stream-controller.ts"),D=k("./src/is-supported.ts"),A=k("./src/utils/logger.ts"),_=k("./src/config.ts"),C=k("./node_modules/eventemitter3/index.js"),l=k.n(C),o=k("./src/events.ts"),s=k("./src/errors.ts");function d(v,L){for(var b=0;b<L.length;b++){var c=L[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(v,c.key,c)}}function w(v,L,b){return L&&d(v.prototype,L),b&&d(v,b),v}var g=function(){v.isSupported=function(){return Object(D.isSupported)()};function v(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new C.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var c=this.config=Object(_.mergeConfig)(v.DefaultConfig,b);this.userConfig=b,Object(A.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(_.enableStreamingMode)(c);var p=c.abrController,h=c.bufferController,a=c.capLevelController,E=c.fpsController,y=this.abrController=new p(this),x=this.bufferController=new h(this),B=this.capLevelController=new a(this),F=new E(this),K=new M.default(this),V=new z.default(this),P=new H.default(this),I=this.levelController=new R.default(this),Y=new m.FragmentTracker(this),ee=this.streamController=new S.default(this,Y);B.setStreamController(ee),F.setStreamController(ee);var oe=[I,ee];this.networkControllers=oe;var pe=[K,V,y,x,B,F,P,Y];this.audioTrackController=this.createController(c.audioTrackController,null,oe),this.createController(c.audioStreamController,Y,oe),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,oe),this.createController(c.subtitleStreamController,Y,oe),this.createController(c.timelineController,null,pe),this.emeController=this.createController(c.emeController,null,pe),this.cmcdController=this.createController(c.cmcdController,null,pe),this.latencyController=this.createController(U.default,null,pe),this.coreComponents=pe}var L=v.prototype;return L.createController=function(c,p,h){if(c){var a=p?new c(this,p):new c(this);return h&&h.push(a),a}return null},L.on=function(c,p,h){h===void 0&&(h=this),this._emitter.on(c,p,h)},L.once=function(c,p,h){h===void 0&&(h=this),this._emitter.once(c,p,h)},L.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},L.off=function(c,p,h,a){h===void 0&&(h=this),this._emitter.off(c,p,h,a)},L.listeners=function(c){return this._emitter.listeners(c)},L.emit=function(c,p,h){return this._emitter.emit(c,p,h)},L.trigger=function(c,p){if(this.config.debug)return this.emit(c,c,p);try{return this.emit(c,c,p)}catch(h){A.logger.error("An internal error happened while handling event "+c+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:h})}return!1},L.listenerCount=function(c){return this._emitter.listenerCount(c)},L.destroy=function(){A.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},L.attachMedia=function(c){A.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},L.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(c){this.stopLoad();var p=this.media,h=this.url,a=this.url=$.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});A.logger.log("loadSource:"+a),p&&h&&h!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},L.startLoad=function(c){c===void 0&&(c=-1),A.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(p){p.startLoad(c)})},L.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},L.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){A.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},L.removeLevel=function(c,p){p===void 0&&(p=0),this.levelController.removeLevel(c,p)},w(v,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){A.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){A.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){A.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){A.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){A.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var p=!!c;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(A.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,p=this.config.minAutoBitrate;if(!c)return 0;for(var h=c.length,a=0;a<h;a++)if(c[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,p=this.autoLevelCapping,h;return p===-1&&c&&c.length?h=c.length-1:h=p,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var p=this.audioTrackController;p&&(p.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var p=this.subtitleTrackController;p&&(p.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:_.hlsDefaultConfig},set:function(c){v.defaultConfig=c}}]),v}();g.defaultConfig=void 0},"./src/is-supported.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"isSupported",function(){return M}),k.d(J,"changeTypeSupported",function(){return z});var $=k("./src/utils/mediasource-helper.ts");function O(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var H=Object($.getMediaSource)();if(!H)return!1;var U=O(),R=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!U||U.prototype&&typeof U.prototype.appendBuffer=="function"&&typeof U.prototype.remove=="function";return!!R&&!!m}function z(){var H,U=O();return typeof(U==null||((H=U.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return A}),k.d(J,"LoadError",function(){return C});var $=k("./src/polyfills/number.ts"),O=k("./src/errors.ts");function M(l,o){l.prototype=Object.create(o.prototype),l.prototype.constructor=l,m(l,o)}function z(l){var o=typeof Map=="function"?new Map:void 0;return z=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,w)}function w(){return H(d,arguments,S(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),m(w,d)},z(l)}function H(l,o,s){return U()?H=Reflect.construct:H=function(w,g,v){var L=[null];L.push.apply(L,g);var b=Function.bind.apply(w,L),c=new b;return v&&m(c,v.prototype),c},H.apply(null,arguments)}function U(){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(l){return!1}}function R(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function m(l,o){return m=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},m(l,o)}function S(l){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},S(l)}var D=Math.pow(2,17),A=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=l.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,w){var g=this,v=d.url;if(!v)return Promise.reject(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var L=this.config,b=L.fLoader,c=L.loader;return new Promise(function(p,h){g.loader&&g.loader.destroy();var a=g.loader=d.loader=b?new b(L):new c(L),E=_(d),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:D};d.stats=a.stats,a.load(E,y,{onSuccess:function(B,F,K,V){g.resetLoader(d,a),p({frag:d,part:null,payload:B.data,networkDetails:V})},onError:function(B,F,K){g.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:B,networkDetails:K}))},onAbort:function(B,F,K){g.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:K}))},onTimeout:function(B,F,K){g.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:K}))},onProgress:function(B,F,K,V){w&&w({frag:d,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(d,w,g){var v=this;this.abort();var L=this.config,b=L.fLoader,c=L.loader;return new Promise(function(p,h){v.loader&&v.loader.destroy();var a=v.loader=d.loader=b?new b(L):new c(L),E=_(d,w),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:D};w.stats=a.stats,a.load(E,y,{onSuccess:function(B,F,K,V){v.resetLoader(d,a),v.updateStatsFromPart(d,w);var P={frag:d,part:w,payload:B.data,networkDetails:V};g(P),p(P)},onError:function(B,F,K){v.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:B,networkDetails:K}))},onAbort:function(B,F,K){d.stats.aborted=w.stats.aborted,v.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:K}))},onTimeout:function(B,F,K){v.resetLoader(d,a),h(new C({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:K}))}})})},o.updateStatsFromPart=function(d,w){var g=d.stats,v=w.stats,L=v.total;if(g.loaded+=v.loaded,L){var b=Math.round(d.duration/w.duration),c=Math.min(Math.round(g.loaded/L),b),p=b-c,h=p*Math.round(g.loaded/c);g.total=g.loaded+h}else g.total=Math.max(g.loaded,g.total);var a=g.loading,E=v.loading;a.start?a.first+=E.first-E.start:(a.start=E.start,a.first=E.first),a.end=E.end},o.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},l}();function _(l,o){o===void 0&&(o=null);var s=o||l,d={frag:l,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},w=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object($.isFiniteNumber)(w)&&Object($.isFiniteNumber)(g)&&(d.rangeStart=w,d.rangeEnd=g),d}var C=function(l){M(o,l);function o(s){for(var d,w=arguments.length,g=new Array(w>1?w-1:0),v=1;v<w;v++)g[v-1]=arguments[v];return d=l.call.apply(l,[this].concat(g))||this,d.data=void 0,d.data=s,d}return o}(z(Error))},"./src/loader/fragment.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"ElementaryStreamTypes",function(){return A}),k.d(J,"BaseSegment",function(){return _}),k.d(J,"Fragment",function(){return C}),k.d(J,"Part",function(){return l});var $=k("./src/polyfills/number.ts"),O=k("./node_modules/url-toolkit/src/url-toolkit.js"),M=k.n(O),z=k("./src/utils/logger.ts"),H=k("./src/loader/level-key.ts"),U=k("./src/loader/load-stats.ts");function R(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,m(o,s)}function m(o,s){return m=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},m(o,s)}function S(o,s){for(var d=0;d<s.length;d++){var w=s[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function D(o,s,d){return s&&S(o.prototype,s),d&&S(o,d),o}var A;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(A||(A={}));var _=function(){function o(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[A.AUDIO]=null,w[A.VIDEO]=null,w[A.AUDIOVIDEO]=null,w),this.baseurl=d}var s=o.prototype;return s.setByteRange=function(w,g){var v=w.split("@",2),L=[];v.length===1?L[0]=g?g.byteRangeEndOffset:0:L[0]=parseInt(v[1]),L[1]=parseInt(v[0])+L[0],this._byteRange=L},D(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(O.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),C=function(o){R(s,o);function s(w,g){var v;return v=o.call(this,g)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new U.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=w,v}var d=s.prototype;return d.createInitializationVector=function(g){for(var v=new Uint8Array(16),L=12;L<16;L++)v[L]=g>>8*(15-L)&255;return v},d.setDecryptDataFromLevelKey=function(g,v){var L=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(L=H.LevelKey.fromURI(g.uri),L.method=g.method,L.iv=this.createInitializationVector(v),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(g,v,L,b,c,p){p===void 0&&(p=!1);var h=this.elementaryStreams,a=h[g];if(!a){h[g]={startPTS:v,endPTS:L,startDTS:b,endDTS:c,partial:p};return}a.startPTS=Math.min(a.startPTS,v),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,c)},d.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[A.AUDIO]=null,g[A.VIDEO]=null,g[A.AUDIOVIDEO]=null},D(s,[{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&&z.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($.isFiniteNumber)(this.programDateTime))return null;var g=Object($.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)}}]),s}(_),l=function(o){R(s,o);function s(d,w,g,v,L){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 U.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=w,b.index=v;var c=d.enumeratedString("BYTERANGE");return c&&b.setByteRange(c,L),L&&(b.fragOffset=L.fragOffset+L.duration),b}return D(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),s}(_)},"./src/loader/key-loader.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return z});var $=k("./src/events.ts"),O=k("./src/errors.ts"),M=k("./src/utils/logger.ts"),z=function(){function H(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var U=H.prototype;return U._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},U._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},U.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var S=this.loaders[m];S&&S.destroy()}this.loaders={}},U.onKeyLoading=function(m,S){var D=S.frag,A=D.type,_=this.loaders[A];if(!D.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=D.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(_&&(M.logger.warn("abort previous key loader for type:"+A),_.abort()),!C){M.logger.warn("key uri is falsy");return}var o=l.loader,s=D.loader=this.loaders[A]=new o(l);this.decrypturl=C,this.decryptkey=null;var d={url:C,frag:D,responseType:"arraybuffer"},w={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,w,g)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:D}))},U.loadsuccess=function(m,S,D){var A=D.frag;if(!A.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(m.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger($.Events.KEY_LOADED,{frag:A})},U.loaderror=function(m,S){var D=S.frag,A=D.loader;A&&A.abort(),delete this.loaders[D.type],this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:m})},U.loadtimeout=function(m,S){var D=S.frag,A=D.loader;A&&A.abort(),delete this.loaders[D.type],this.hls.trigger($.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},H}()},"./src/loader/level-details.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"LevelDetails",function(){return H});var $=k("./src/polyfills/number.ts");function O(U,R){for(var m=0;m<R.length;m++){var S=R[m];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(U,S.key,S)}}function M(U,R,m){return R&&O(U.prototype,R),m&&O(U,m),U}var z=10,H=function(){function U(m){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=m}var R=U.prototype;return R.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-S.lastPartSn,A=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!A||!!D,this.advanced=this.endSN>S.endSN||D>0||D===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},M(U,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var D=this.driftEnd-this.driftStart;return D*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),U}()},"./src/loader/level-key.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"LevelKey",function(){return H});var $=k("./node_modules/url-toolkit/src/url-toolkit.js"),O=k.n($);function M(U,R){for(var m=0;m<R.length;m++){var S=R[m];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(U,S.key,S)}}function z(U,R,m){return R&&M(U.prototype,R),m&&M(U,m),U}var H=function(){U.fromURL=function(m,S){return new U(m,S)},U.fromURI=function(m){return new U(m)};function U(R,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object($.buildAbsoluteURL)(R,m,{alwaysNormalize:!0}):this._uri=R}return z(U,[{key:"uri",get:function(){return this._uri}}]),U}()},"./src/loader/load-stats.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"LoadStats",function(){return $});var $=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(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s});var $=k("./src/polyfills/number.ts"),O=k("./node_modules/url-toolkit/src/url-toolkit.js"),M=k.n(O),z=k("./src/loader/fragment.ts"),H=k("./src/loader/level-details.ts"),U=k("./src/loader/level-key.ts"),R=k("./src/utils/attr-list.ts"),m=k("./src/utils/logger.ts"),S=k("./src/utils/codecs.ts"),D=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,_=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),C=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var b,c;return l.test((b=(c=O.parseURL(L))===null||c===void 0?void 0:c.path)!=null?b:"")}var s=function(){function L(){}return L.findGroup=function(c,p){for(var h=0;h<c.length;h++){var a=c[h];if(a.id===p)return a}},L.convertAVC1ToAVCOTI=function(c){var p=c.split(".");if(p.length>2){var h=p.shift()+".";return h+=parseInt(p.shift()).toString(16),h+=("000"+parseInt(p.shift()).toString(16)).substr(-4),h}return c},L.resolve=function(c,p){return O.buildAbsoluteURL(p,c,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(c,p){var h=[],a={},E=!1;D.lastIndex=0;for(var y;(y=D.exec(c))!=null;)if(y[1]){var x=new R.AttrList(y[1]),B={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:L.resolve(y[2],p)},F=x.decimalResolution("RESOLUTION");F&&(B.width=F.width,B.height=F.height),d((x.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),B),B.videoCodec&&B.videoCodec.indexOf("avc1")!==-1&&(B.videoCodec=L.convertAVC1ToAVCOTI(B.videoCodec)),h.push(B)}else if(y[3]){var K=new R.AttrList(y[3]);K["DATA-ID"]&&(E=!0,a[K["DATA-ID"]]=K)}return{levels:h,sessionData:E?a:null}},L.parseMasterPlaylistMedia=function(c,p,h,a){a===void 0&&(a=[]);var E,y=[],x=0;for(A.lastIndex=0;(E=A.exec(c))!==null;){var B=new R.AttrList(E[1]);if(B.TYPE===h){var F={attrs:B,bitrate:0,id:x++,groupId:B["GROUP-ID"],instreamId:B["INSTREAM-ID"],name:B.NAME||B.LANGUAGE||"",type:h,default:B.bool("DEFAULT"),autoselect:B.bool("AUTOSELECT"),forced:B.bool("FORCED"),lang:B.LANGUAGE,url:B.URI?L.resolve(B.URI,p):""};if(a.length){var K=L.findGroup(a,F.groupId)||a[0];w(F,K,"audioCodec"),w(F,K,"textCodec")}y.push(F)}}return y},L.parseLevelPlaylist=function(c,p,h,a,E){var y=new H.LevelDetails(p),x=y.fragments,B=null,F=0,K=0,V=0,P=0,I=null,Y=new z.Fragment(a,p),ee,oe,pe,Oe=-1,Se=!1;for(_.lastIndex=0,y.m3u8=c;(ee=_.exec(c))!==null;){Se&&(Se=!1,Y=new z.Fragment(a,p),Y.start=V,Y.sn=F,Y.cc=P,Y.level=h,B&&(Y.initSegment=B,Y.rawProgramDateTime=B.rawProgramDateTime));var we=ee[1];if(we){Y.duration=parseFloat(we);var Te=(" "+ee[2]).slice(1);Y.title=Te||null,Y.tagList.push(Te?["INF",we,Te]:["INF",we])}else if(ee[3])Object($.isFiniteNumber)(Y.duration)&&(Y.start=V,pe&&(Y.levelkey=pe),Y.sn=F,Y.level=h,Y.cc=P,Y.urlId=E,x.push(Y),Y.relurl=(" "+ee[3]).slice(1),v(Y,I),I=Y,V+=Y.duration,F++,K=0,Se=!0);else if(ee[4]){var Ce=(" "+ee[4]).slice(1);I?Y.setByteRange(Ce,I):Y.setByteRange(Ce)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Oe===-1&&(Oe=x.length);else{if(ee=ee[0].match(C),!ee){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var me=(" "+ee[oe]).slice(1),se=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":y.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":F=y.startSN=parseInt(se);break;case"SKIP":{var ce=new R.AttrList(se),ae=ce.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(ae)){y.skippedSegments=ae;for(var Ae=ae;Ae--;)x.unshift(null);F+=ae}var Re=ce.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(y.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(se);break;case"VERSION":y.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(se||te)&&Y.tagList.push(te?[se,te]:[se]);break;case"DIS":P++;case"GAP":Y.tagList.push([me]);break;case"BITRATE":Y.tagList.push([me,se]);break;case"DISCONTINUITY-SEQ":P=parseInt(se);break;case"KEY":{var xe,ke=new R.AttrList(se),Pe=ke.enumeratedString("METHOD"),je=ke.URI,We=ke.hexadecimalInteger("IV"),Be=ke.enumeratedString("KEYFORMATVERSIONS"),Ie=ke.enumeratedString("KEYID"),tt=(xe=ke.enumeratedString("KEYFORMAT"))!=null?xe:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(tt)>-1){m.logger.warn("Keyformat "+tt+" is not supported from the manifest");continue}else if(tt!=="identity")continue;Pe&&(pe=U.LevelKey.fromURL(p,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(pe.method=Pe,pe.keyFormat=tt,Ie&&(pe.keyID=Ie),Be&&(pe.keyFormatVersions=Be),pe.iv=We));break}case"START":{var Je=new R.AttrList(se),Ye=Je.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(Ye)&&(y.startTimeOffset=Ye);break}case"MAP":{var ft=new R.AttrList(se);Y.relurl=ft.URI,ft.BYTERANGE&&Y.setByteRange(ft.BYTERANGE),Y.level=h,Y.sn="initSegment",pe&&(Y.levelkey=pe),Y.initSegment=null,B=Y,Se=!0;break}case"SERVER-CONTROL":{var rt=new R.AttrList(se);y.canBlockReload=rt.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=rt.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&rt.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=rt.optionalFloat("PART-HOLD-BACK",0),y.holdBack=rt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var nt=new R.AttrList(se);y.partTarget=nt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=y.partList;Me||(Me=y.partList=[]);var dt=K>0?Me[Me.length-1]:void 0,lt=K++,Ue=new z.Part(new R.AttrList(se),Y,p,lt,dt);Me.push(Ue),Y.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ke=new R.AttrList(se);y.preloadHint=Ke;break}case"RENDITION-REPORT":{var Ee=new R.AttrList(se);y.renditionReports=y.renditionReports||[],y.renditionReports.push(Ee);break}default:m.logger.warn("line parsed but not handled: "+ee);break}}}I&&!I.relurl?(x.pop(),V-=I.duration,y.partList&&(y.fragmentHint=I)):y.partList&&(v(Y,I),Y.cc=P,y.fragmentHint=Y);var ve=x.length,be=x[0],re=x[ve-1];if(V+=y.skippedSegments*y.targetduration,V>0&&ve&&re){y.averagetargetduration=V/ve;var ne=re.sn;y.endSN=ne!=="initSegment"?ne:0,be&&(y.startCC=be.cc,be.initSegment||y.fragments.every(function(de){return de.relurl&&o(de.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new z.Fragment(a,p),Y.relurl=re.relurl,Y.level=h,Y.sn="initSegment",be.initSegment=Y,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(V+=y.fragmentHint.duration),y.totalduration=V,y.endCC=P,Oe>0&&g(x,Oe),y},L}();function d(L,b){["video","audio","text"].forEach(function(c){var p=L.filter(function(a){return Object(S.isCodecType)(a,c)});if(p.length){var h=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[c+"Codec"]=h.length>0?h[0]:p[0],L=L.filter(function(a){return p.indexOf(a)===-1})}}),b.unknownCodecs=L}function w(L,b,c){var p=b[c];p&&(L[c]=p)}function g(L,b){for(var c=L[b],p=b;p--;){var h=L[p];if(!h)return;h.programDateTime=c.programDateTime-h.duration*1e3,c=h}}function v(L,b){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):b!=null&&b.programDateTime&&(L.programDateTime=b.endProgramDateTime),Object($.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),O=k("./src/events.ts"),M=k("./src/errors.ts"),z=k("./src/utils/logger.ts"),H=k("./src/utils/mp4-tools.ts"),U=k("./src/loader/m3u8-parser.ts"),R=k("./src/types/loader.ts"),m=k("./src/utils/attr-list.ts");function S(_){var C=_.type;switch(C){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function D(_,C){var l=_.url;return(l===void 0||l.indexOf("data:")===0)&&(l=C.url),l}var A=function(){function _(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var C=_.prototype;return C.registerListeners=function(){var o=this.hls;o.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.unregisterListeners=function(){var o=this.hls;o.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.createInternalLoader=function(o){var s=this.hls.config,d=s.pLoader,w=s.loader,g=d||w,v=new g(s);return o.loader=v,this.loaders[o.type]=v,v},C.getInternalLoader=function(o){return this.loaders[o.type]},C.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},C.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(o,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},C.onLevelLoading=function(o,s){var d=s.id,w=s.level,g=s.url,v=s.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:R.PlaylistContextType.LEVEL,url:g,deliveryDirectives:v})},C.onAudioTrackLoading=function(o,s){var d=s.id,w=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:v})},C.onSubtitleTrackLoading=function(o,s){var d=s.id,w=s.groupId,g=s.url,v=s.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:v})},C.load=function(o){var s,d=this.hls.config,w=this.getInternalLoader(o);if(w){var g=w.context;if(g&&g.url===o.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var v,L,b,c;switch(o.type){case R.PlaylistContextType.MANIFEST:v=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,c=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:v=0,L=d.levelLoadingTimeOut;break;default:v=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,c=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var p;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var h=p.partTarget,a=p.targetduration;h&&a&&(L=Math.min(Math.max(h*3,a*.8)*1e3,L))}}var E={timeout:L,maxRetry:v,retryDelay:b,maxRetryDelay:c,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,E,y)},C.loadsuccess=function(o,s,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,s,d,w);return}this.resetInternalLoader(d.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",w);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,d,w):this.handleMasterPlaylist(o,s,d,w)},C.loaderror=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,o)},C.loadtimeout=function(o,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},C.handleMasterPlaylist=function(o,s,d,w){var g=this.hls,v=o.data,L=D(o,d),b=U.default.parseMasterPlaylist(v,L),c=b.levels,p=b.sessionData;if(!c.length){this.handleManifestParsingError(o,d,"no level found in manifest",w);return}var h=c.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=c.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),E=U.default.parseMasterPlaylistMedia(v,L,"AUDIO",h),y=U.default.parseMasterPlaylistMedia(v,L,"SUBTITLES",a),x=U.default.parseMasterPlaylistMedia(v,L,"CLOSED-CAPTIONS");if(E.length){var B=E.some(function(F){return!F.url});!B&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}g.trigger(O.Events.MANIFEST_LOADED,{levels:c,audioTracks:E,subtitles:y,captions:x,url:L,stats:s,networkDetails:w,sessionData:p})},C.handleTrackOrLevelPlaylist=function(o,s,d,w){var g=this.hls,v=d.id,L=d.level,b=d.type,c=D(o,d),p=Object($.isFiniteNumber)(v)?v:0,h=Object($.isFiniteNumber)(L)?L:p,a=S(d),E=U.default.parseLevelPlaylist(o.data,c,h,a,p);if(!E.fragments.length){g.trigger(O.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===R.PlaylistContextType.MANIFEST){var y={attrs:new m.AttrList({}),bitrate:0,details:E,name:"",url:c};g.trigger(O.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:c,stats:s,networkDetails:w,sessionData:null})}if(s.parsing.end=performance.now(),E.needSidxRanges){var x,B=(x=E.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:B,isSidxRequest:!0,type:b,level:L,levelDetails:E,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=E,this.handlePlaylistLoaded(o,s,d,w)},C.handleSidxRequest=function(o,s){var d=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var w=d.references,g=s.levelDetails;w.forEach(function(v,L){var b=v.info,c=g.fragments[L];c.byteRange.length===0&&c.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),c.initSegment&&c.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(o,s,d,w){this.hls.trigger(O.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:s,networkDetails:w})},C.handleNetworkError=function(o,s,d,w){d===void 0&&(d=!1),z.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=M.ErrorDetails.UNKNOWN,v=!1,L=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:g=d?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case R.PlaylistContextType.LEVEL:g=d?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.AUDIO_TRACK:g=d?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:g=d?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}L&&this.resetInternalLoader(o.type);var b={type:M.ErrorTypes.NETWORK_ERROR,details:g,fatal:v,url:o.url,loader:L,context:o,networkDetails:s};w&&(b.response=w),this.hls.trigger(O.Events.ERROR,b)},C.handlePlaylistLoaded=function(o,s,d,w){var g=d.type,v=d.level,L=d.id,b=d.groupId,c=d.loader,p=d.levelDetails,h=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",w);return}if(!c)return;p.live&&(c.getCacheAge&&(p.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(g){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(O.Events.LEVEL_LOADED,{details:p,level:v||0,id:L||0,stats:s,networkDetails:w,deliveryDirectives:h});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(O.Events.AUDIO_TRACK_LOADED,{details:p,id:L||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:h});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADED,{details:p,id:L||0,groupId:b||"",stats:s,networkDetails:w,deliveryDirectives:h});break}},_}();J.default=A},"./src/polyfills/number.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"isFiniteNumber",function(){return $}),k.d(J,"MAX_SAFE_INTEGER",function(){return O});var $=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},O=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,J,k){"use strict";k.r(J);var $=function(){function O(){}return O.getSilentFrame=function(z,H){switch(z){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(H===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(H===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},O}();J.default=$},"./src/remux/mp4-generator.ts":function(le,J,k){"use strict";k.r(J);var $=Math.pow(2,32)-1,O=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var H;for(H in M.types)M.types.hasOwnProperty(H)&&(M.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var U=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:U,audio:R};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=S,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,D,_,D,A),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,m))},M.box=function(H){for(var U=8,R=arguments.length,m=new Array(R>1?R-1:0),S=1;S<R;S++)m[S-1]=arguments[S];for(var D=m.length,A=D;D--;)U+=m[D].byteLength;var _=new Uint8Array(U);for(_[0]=U>>24&255,_[1]=U>>16&255,_[2]=U>>8&255,_[3]=U&255,_.set(H,4),D=0,U=8;D<A;D++)_.set(m[D],U),U+=m[D].byteLength;return _},M.hdlr=function(H){return M.box(M.types.hdlr,M.HDLR_TYPES[H])},M.mdat=function(H){return M.box(M.types.mdat,H)},M.mdhd=function(H,U){U*=H;var R=Math.floor(U/($+1)),m=Math.floor(U%($+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},M.mdia=function(H){return M.box(M.types.mdia,M.mdhd(H.timescale,H.duration),M.hdlr(H.type),M.minf(H))},M.mfhd=function(H){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},M.minf=function(H){return H.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(H)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(H))},M.moof=function(H,U,R){return M.box(M.types.moof,M.mfhd(H),M.traf(R,U))},M.moov=function(H){for(var U=H.length,R=[];U--;)R[U]=M.trak(H[U]);return M.box.apply(null,[M.types.moov,M.mvhd(H[0].timescale,H[0].duration)].concat(R).concat(M.mvex(H)))},M.mvex=function(H){for(var U=H.length,R=[];U--;)R[U]=M.trex(H[U]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(H,U){U*=H;var R=Math.floor(U/($+1)),m=Math.floor(U%($+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,m>>24,m>>16&255,m>>8&255,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,S)},M.sdtp=function(H){var U=H.samples||[],R=new Uint8Array(4+U.length),m,S;for(m=0;m<U.length;m++)S=U[m].flags,R[m+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return M.box(M.types.sdtp,R)},M.stbl=function(H){return M.box(M.types.stbl,M.stsd(H),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(H){var U=[],R=[],m,S,D;for(m=0;m<H.sps.length;m++)S=H.sps[m],D=S.byteLength,U.push(D>>>8&255),U.push(D&255),U=U.concat(Array.prototype.slice.call(S));for(m=0;m<H.pps.length;m++)S=H.pps[m],D=S.byteLength,R.push(D>>>8&255),R.push(D&255),R=R.concat(Array.prototype.slice.call(S));var A=M.box(M.types.avcC,new Uint8Array([1,U[3],U[4],U[5],252|3,224|H.sps.length].concat(U).concat([H.pps.length]).concat(R))),_=H.width,C=H.height,l=H.pixelRatio[0],o=H.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,_>>8&255,_&255,C>>8&255,C&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,o>>24,o>>16&255,o>>8&255,o&255])))},M.esds=function(H){var U=H.config.length;return new Uint8Array([0,0,0,0,3,23+U,0,1,0,4,15+U,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([U]).concat(H.config).concat([6,1,2]))},M.mp4a=function(H){var U=H.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,U>>8&255,U&255,0,0]),M.box(M.types.esds,M.esds(H)))},M.mp3=function(H){var U=H.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,U>>8&255,U&255,0,0]))},M.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(H)):M.box(M.types.stsd,M.STSD,M.mp4a(H)):M.box(M.types.stsd,M.STSD,M.avc1(H))},M.tkhd=function(H){var U=H.id,R=H.duration*H.timescale,m=H.width,S=H.height,D=Math.floor(R/($+1)),A=Math.floor(R%($+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,m>>8&255,m&255,0,0,S>>8&255,S&255,0,0]))},M.traf=function(H,U){var R=M.sdtp(H),m=H.id,S=Math.floor(U/($+1)),D=Math.floor(U%($+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,D>>24,D>>16&255,D>>8&255,D&255])),M.trun(H,R.length+16+20+8+16+8+8),R)},M.trak=function(H){return H.duration=H.duration||4294967295,M.box(M.types.trak,M.tkhd(H),M.mdia(H))},M.trex=function(H){var U=H.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(H,U){var R=H.samples||[],m=R.length,S=12+16*m,D=new Uint8Array(S),A,_,C,l,o,s;for(U+=8+S,D.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,U>>>24&255,U>>>16&255,U>>>8&255,U&255],0),A=0;A<m;A++)_=R[A],C=_.duration,l=_.size,o=_.flags,s=_.cts,D.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*A);return M.box(M.types.trun,D)},M.initSegment=function(H){M.types||M.init();var U=M.moov(H),R=new Uint8Array(M.FTYP.byteLength+U.byteLength);return R.set(M.FTYP),R.set(U,M.FTYP.byteLength),R},M}();O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0,J.default=O},"./src/remux/mp4-remuxer.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s}),k.d(J,"normalizePts",function(){return d});var $=k("./src/polyfills/number.ts"),O=k("./src/remux/aac-helper.ts"),M=k("./src/remux/mp4-generator.ts"),z=k("./src/events.ts"),H=k("./src/errors.ts"),U=k("./src/utils/logger.ts"),R=k("./src/types/loader.ts"),m=k("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(L[p]=c[p])}return L},S.apply(this,arguments)}var D=10*1e3,A=1024,_=1152,C=null,l=null,o=!1,s=function(){function L(c,p,h,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=p,this.typeSupported=h,this.ISGenerated=!1,C===null){var E=navigator.userAgent||"",y=E.match(/Chrome\/(\d+)/i);C=y?parseInt(y[1]):0}if(l===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);l=x?parseInt(x[1]):0}o=!!C&&C<75||!!l&&l<600}var b=L.prototype;return b.destroy=function(){},b.resetTimeStamp=function(p){U.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},b.resetNextTimestamp=function(){U.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){U.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(p){var h=!1,a=p.reduce(function(E,y){var x=y.pts-E;return x<-4294967296?(h=!0,d(E,y.pts)):x>0?E:y.pts},p[0].pts);return h&&U.logger.debug("PTS rollover detected"),a},b.remux=function(p,h,a,E,y,x,B,F){var K,V,P,I,Y,ee,oe=y,pe=y,Oe=p.pid>-1,Se=h.pid>-1,we=h.samples.length,Te=p.samples.length>0,Ce=we>1,me=(!Oe||Te)&&(!Se||Ce)||this.ISGenerated||B;if(me){this.ISGenerated||(P=this.generateIS(p,h,y));var se=this.isVideoContiguous,te=-1;if(Ce&&(te=w(h.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){U.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+we+" video samples due to a missing keyframe");var ce=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(te),h.dropped+=te,pe+=(h.samples[0].pts-ce)/(h.timescale||9e4)}else te===-1&&(U.logger.warn("[mp4-remuxer]: No keyframe found out of "+we+" video samples"),ee=!1);if(this.ISGenerated){if(Te&&Ce){var ae=this.getVideoStartPts(h.samples),Ae=d(p.samples[0].pts,ae)-ae,Re=Ae/h.inputTimeScale;oe+=Math.max(0,Re),pe+=Math.max(0,-Re)}if(Te){if(p.samplerate||(U.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(p,h,y)),V=this.remuxAudio(p,oe,this.isAudioContiguous,x,Se||Ce||F===R.PlaylistLevelType.AUDIO?pe:void 0),Ce){var xe=V?V.endPTS-V.startPTS:0;h.inputTimeScale||(U.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(p,h,y)),K=this.remuxVideo(h,pe,se,xe)}}else Ce&&(K=this.remuxVideo(h,pe,se,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&(Y=this.remuxID3(a,y)),E.samples.length&&(I=this.remuxText(E,y))),{audio:V,video:K,initSegment:P,independent:ee,text:I,id3:Y}},b.generateIS=function(p,h,a){var E=p.samples,y=h.samples,x=this.typeSupported,B={},F=!Object($.isFiniteNumber)(this._initPTS),K="audio/mp4",V,P,I;if(F&&(V=P=Infinity),p.config&&E.length&&(p.timescale=p.samplerate,p.isAAC||(x.mpeg?(K="audio/mpeg",p.codec=""):x.mp3&&(p.codec="mp3")),B.audio={id:"audio",container:K,codec:p.codec,initSegment:!p.isAAC&&x.mpeg?new Uint8Array(0):M.default.initSegment([p]),metadata:{channelCount:p.channelCount}},F&&(I=p.inputTimeScale,V=P=E[0].pts-Math.round(I*a))),h.sps&&h.pps&&y.length&&(h.timescale=h.inputTimeScale,B.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:M.default.initSegment([h]),metadata:{width:h.width,height:h.height}},F)){I=h.inputTimeScale;var Y=this.getVideoStartPts(y),ee=Math.round(I*a);P=Math.min(P,d(y[0].dts,Y)-ee),V=Math.min(V,Y-ee)}if(Object.keys(B).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=P),{tracks:B,initPTS:V,timescale:I}},b.remuxVideo=function(p,h,a,E){var y=p.inputTimeScale,x=p.samples,B=[],F=x.length,K=this._initPTS,V=this.nextAvcDts,P=8,I,Y,ee,oe=Number.POSITIVE_INFINITY,pe=Number.NEGATIVE_INFINITY,Oe=0,Se=!1;if(!a||V===null){var we=h*y,Te=x[0].pts-d(x[0].dts,x[0].pts);V=we-Te}for(var Ce=0;Ce<F;Ce++){var me=x[Ce];if(me.pts=d(me.pts-K,V),me.dts=d(me.dts-K,V),me.dts>me.pts){var se=9e4*.2;Oe=Math.max(Math.min(Oe,me.pts-me.dts),-1*se)}me.dts<x[Ce>0?Ce-1:Ce].dts&&(Se=!0)}Se&&x.sort(function(gt,st){var qe=gt.dts-st.dts,Dt=gt.pts-st.pts;return qe||Dt}),Y=x[0].dts,ee=x[x.length-1].dts;var te=Math.round((ee-Y)/(F-1));if(Oe<0){if(Oe<te*-2){U.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-te,!0)+" ms");for(var ce=Oe,ae=0;ae<F;ae++)x[ae].dts=ce=Math.max(ce,x[ae].pts-te),x[ae].pts=Math.max(ce,x[ae].pts)}else{U.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var Ae=0;Ae<F;Ae++)x[Ae].dts=x[Ae].dts+Oe}Y=x[0].dts}if(a){var Re=Y-V,xe=Re>te,ke=Re<-1;if(xe||ke){xe?U.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):U.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),Y=V;var Pe=x[0].pts-Re;x[0].dts=Y,x[0].pts=Pe,U.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(m.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(Re,!0)+" ms")}}o&&(Y=Math.max(0,Y));for(var je=0,We=0,Be=0;Be<F;Be++){for(var Ie=x[Be],tt=Ie.units,Ze=tt.length,Je=0,Ye=0;Ye<Ze;Ye++)Je+=tt[Ye].data.length;We+=Je,je+=Ze,Ie.length=Je,Ie.dts=Math.max(Ie.dts,Y),Ie.pts=Math.max(Ie.pts,Ie.dts,0),oe=Math.min(Ie.pts,oe),pe=Math.max(Ie.pts,pe)}ee=x[F-1].dts;var ft=We+4*je+8,rt;try{rt=new Uint8Array(ft)}catch(gt){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ft,reason:"fail allocating video mdat "+ft});return}var nt=new DataView(rt.buffer);nt.setUint32(0,ft),rt.set(M.default.types.mdat,4);for(var Me=0;Me<F;Me++){for(var dt=x[Me],lt=dt.units,Ue=0,Ke=0,Ee=lt.length;Ke<Ee;Ke++){var ve=lt[Ke],be=ve.data,re=ve.data.byteLength;nt.setUint32(P,re),P+=4,rt.set(be,P),P+=re,Ue+=4+re}if(Me<F-1)I=x[Me+1].dts-dt.dts;else{var ne=this.config,de=dt.dts-x[Me>0?Me-1:Me].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(ne.maxBufferHole*y),fe=(E?oe+E*y:this.nextAudioPts)-dt.pts;fe>ue?(I=fe-de,I<0&&(I=de),U.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=de}else I=de}var Le=Math.round(dt.pts-dt.dts);B.push(new g(dt.key,I,Ue,Le))}if(B.length&&C&&C<70){var Ne=B[0].flags;Ne.dependsOn=2,Ne.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+I,this.isVideoContiguous=!0;var $e=M.default.moof(p.sequenceNumber++,Y,S({},p,{samples:B})),ht="video",Xe={data1:$e,data2:rt,startPTS:oe/y,endPTS:(pe+I)/y,startDTS:Y/y,endDTS:V/y,type:ht,hasAudio:!1,hasVideo:!0,nb:B.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(rt.length,"MDAT length must not be zero"),Xe},b.remuxAudio=function(p,h,a,E,y){var x=p.inputTimeScale,B=p.samplerate?p.samplerate:x,F=x/B,K=p.isAAC?A:_,V=K*F,P=this._initPTS,I=!p.isAAC&&this.typeSupported.mpeg,Y=[],ee=p.samples,oe=I?0:8,pe=this.nextAudioPts||-1,Oe=h*x;if(this.isAudioContiguous=a=a||ee.length&&pe>0&&(E&&Math.abs(Oe-pe)<9e3||Math.abs(d(ee[0].pts-P,Oe)-pe)<20*V),ee.forEach(function(be){be.pts=d(be.pts-P,Oe)}),!a||pe<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;y===0?pe=0:E?pe=Math.max(0,Oe):pe=ee[0].pts}if(p.isAAC)for(var Se=y!==void 0,we=this.config.maxAudioFramesDrift,Te=0,Ce=pe;Te<ee.length;Te++){var me=ee[Te],se=me.pts,te=se-Ce,ce=Math.abs(1e3*te/x);if(te<=-we*V&&Se)Te===0&&(U.logger.warn("Audio frame @ "+(se/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/x)+" ms."),this.nextAudioPts=pe=Ce=se);else if(te>=we*V&&ce<D&&Se){var ae=Math.round(te/V);Ce=se-ae*V,Ce<0&&(ae--,Ce+=V),Te===0&&(this.nextAudioPts=pe=Ce),U.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(Ce/x).toFixed(3)+"s due to "+Math.round(1e3*te/x)+" ms gap.");for(var Ae=0;Ae<ae;Ae++){var Re=Math.max(Ce,0),xe=O.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);xe||(U.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=me.unit.subarray()),ee.splice(Te,0,{unit:xe,pts:Re}),Ce+=V,Te++}}me.pts=Ce,Ce+=V}for(var ke=null,Pe=null,je,We=0,Be=ee.length;Be--;)We+=ee[Be].unit.byteLength;for(var Ie=0,tt=ee.length;Ie<tt;Ie++){var Ze=ee[Ie],Je=Ze.unit,Ye=Ze.pts;if(Pe!==null){var ft=Y[Ie-1];ft.duration=Math.round((Ye-Pe)/F)}else if(a&&p.isAAC&&(Ye=pe),ke=Ye,We>0){We+=oe;try{je=new Uint8Array(We)}catch(be){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!I){var rt=new DataView(je.buffer);rt.setUint32(0,We),je.set(M.default.types.mdat,4)}}else return;je.set(Je,oe);var nt=Je.byteLength;oe+=nt,Y.push(new g(!0,K,nt,0)),Pe=Ye}var Me=Y.length;if(!Me)return;var dt=Y[Y.length-1];this.nextAudioPts=pe=Pe+F*dt.duration;var lt=I?new Uint8Array(0):M.default.moof(p.sequenceNumber++,ke/F,S({},p,{samples:Y}));p.samples=[];var Ue=ke/x,Ke=pe/x,Ee="audio",ve={data1:lt,data2:je,startPTS:Ue,endPTS:Ke,startDTS:Ue,endDTS:Ke,type:Ee,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ve},b.remuxEmptyAudio=function(p,h,a,E){var y=p.inputTimeScale,x=p.samplerate?p.samplerate:y,B=y/x,F=this.nextAudioPts,K=(F!==null?F:E.startDTS*y)+this._initDTS,V=E.endDTS*y+this._initDTS,P=B*A,I=Math.ceil((V-K)/P),Y=O.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(U.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){U.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<I;oe++){var pe=K+oe*P;ee.push({unit:Y,pts:pe,dts:pe})}return p.samples=ee,this.remuxAudio(p,h,a,!1)},b.remuxID3=function(p,h){var a=p.samples.length;if(!a)return;for(var E=p.inputTimeScale,y=this._initPTS,x=this._initDTS,B=0;B<a;B++){var F=p.samples[B];F.pts=d(F.pts-y,h*E)/E,F.dts=d(F.dts-x,h*E)/E}var K=p.samples;return p.samples=[],{samples:K}},b.remuxText=function(p,h){var a=p.samples.length;if(!a)return;for(var E=p.inputTimeScale,y=this._initPTS,x=0;x<a;x++){var B=p.samples[x];B.pts=d(B.pts-y,h*E)/E}p.samples.sort(function(K,V){return K.pts-V.pts});var F=p.samples;return p.samples=[],{samples:F}},L}();function d(L,b){var c;if(b===null)return L;for(b<L?c=-8589934592:c=8589934592;Math.abs(L-b)>4294967296;)L+=c;return L}function w(L){for(var b=0;b<L.length;b++)if(L[b].key)return b;return-1}var g=function(b,c,p,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=p,this.cts=h,this.flags=new v(b)},v=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(le,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),O=k("./src/utils/mp4-tools.ts"),M=k("./src/loader/fragment.ts"),z=k("./src/utils/logger.ts"),H=function(){function m(){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 S=m.prototype;return S.destroy=function(){},S.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(A,_,C){this.audioCodec=_,this.videoCodec=C,this.generateInitSegment(A),this.emitInitSegment=!0},S.generateInitSegment=function(A){var _=this.audioCodec,C=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(O.parseInitSegment)(A);_||(_=R(l.audio,M.ElementaryStreamTypes.AUDIO)),C||(C=R(l.video,M.ElementaryStreamTypes.VIDEO));var o={};l.audio&&l.video?o.audiovideo={container:"video/mp4",codec:_+","+C,initSegment:A,id:"main"}:l.audio?o.audio={container:"audio/mp4",codec:_,initSegment:A,id:"audio"}:l.video?o.video={container:"video/mp4",codec:C,initSegment:A,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(A,_,C,l,o){var s=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:l,id3:C,initSegment:void 0};Object($.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var g=_.samples;if(!g||!g.length)return w;var v={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(g),L=this.initData),!L||!L.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=U(L,g,d));var b=Object(O.getDuration)(g,L),c=d,p=b+c;Object(O.offsetStartDTS)(L,g,s),b>0?this.lastEndDTS=p:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!L.audio,a=!!L.video,E="";h&&(E+="audio"),a&&(E+="video");var y={data1:g,startPTS:c,startDTS:c,endPTS:p,endDTS:p,type:E,hasAudio:h,hasVideo:a,nb:1,dropped:0};return w.audio=y.type==="audio"?y:void 0,w.video=y.type!=="audio"?y:void 0,w.text=l,w.id3=C,w.initSegment=v,w},m}(),U=function(S,D,A){return Object(O.getStartDTS)(S,D)-A};function R(m,S){var D=m==null?void 0:m.codec;return D&&D.length>4?D:D==="hvc1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||S===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=H},"./src/task-loop.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function O(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=O.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},O}()},"./src/types/cmcd.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"CMCDVersion",function(){return $}),k.d(J,"CMCDObjectType",function(){return O}),k.d(J,"CMCDStreamingFormat",function(){return M}),k.d(J,"CMCDStreamType",function(){return z});var $=1,O;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(O||(O={}));var M;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(M||(M={}));var z;(function(H){H.VOD="v",H.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"HlsSkip",function(){return M}),k.d(J,"getSkipValue",function(){return z}),k.d(J,"HlsUrlParameters",function(){return H}),k.d(J,"Level",function(){return U});function $(R,m){for(var S=0;S<m.length;S++){var D=m[S];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(R,D.key,D)}}function O(R,m,S){return m&&$(R.prototype,m),S&&$(R,S),R}var M;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(M||(M={}));function z(R,m){var S=R.canSkipUntil,D=R.canSkipDateRanges,A=R.endSN,_=m!==void 0?m-A:0;return S&&_<S?D?M.v2:M.Yes:M.No}var H=function(){function R(S,D,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=D,this.skip=A}var m=R.prototype;return m.addDirectives=function(D){var A=new self.URL(D);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},R}(),U=function(){function R(m){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=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return O(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(S){var D=S%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),R}()},"./src/types/loader.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"PlaylistContextType",function(){return $}),k.d(J,"PlaylistLevelType",function(){return O});var $;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var O;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(O||(O={}))},"./src/types/transmuxer.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"ChunkMetadata",function(){return $});var $=function(z,H,U,R,m,S){R===void 0&&(R=0),m===void 0&&(m=-1),S===void 0&&(S=!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=O(),this.buffering={audio:O(),video:O(),audiovideo:O()},this.level=z,this.sn=H,this.id=U,this.size=R,this.part=m,this.partial=S};function O(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"AttrList",function(){return M});var $=/^(\d+)x(\d+)$/,O=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function z(U){typeof U=="string"&&(U=z.parseAttrList(U));for(var R in U)U.hasOwnProperty(R)&&(this[R]=U[R])}var H=z.prototype;return H.decimalInteger=function(R){var m=parseInt(this[R],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},H.hexadecimalInteger=function(R){if(this[R]){var m=(this[R]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var S=new Uint8Array(m.length/2),D=0;D<m.length/2;D++)S[D]=parseInt(m.slice(D*2,D*2+2),16);return S}else return null},H.hexadecimalIntegerAsNumber=function(R){var m=parseInt(this[R],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},H.decimalFloatingPoint=function(R){return parseFloat(this[R])},H.optionalFloat=function(R,m){var S=this[R];return S?parseFloat(S):m},H.enumeratedString=function(R){return this[R]},H.bool=function(R){return this[R]==="YES"},H.decimalResolution=function(R){var m=$.exec(this[R]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},z.parseAttrList=function(R){var m,S={},D='"';for(O.lastIndex=0;(m=O.exec(R))!==null;){var A=m[2];A.indexOf(D)===0&&A.lastIndexOf(D)===A.length-1&&(A=A.slice(1,-1)),S[m[1]]=A}return S},z}()},"./src/utils/binary-search.ts":function(le,J,k){"use strict";k.r(J);var $={search:function(M,z){for(var H=0,U=M.length-1,R=null,m=null;H<=U;){R=(H+U)/2|0,m=M[R];var S=z(m);if(S>0)H=R+1;else if(S<0)U=R-1;else return m}return null}};J.default=$},"./src/utils/buffer-helper.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"BufferHelper",function(){return M});var $=k("./src/utils/logger.ts"),O={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function z(){}return z.isBuffered=function(U,R){try{if(U){for(var m=z.getBuffered(U),S=0;S<m.length;S++)if(R>=m.start(S)&&R<=m.end(S))return!0}}catch(D){}return!1},z.bufferInfo=function(U,R,m){try{if(U){var S=z.getBuffered(U),D=[],A;for(A=0;A<S.length;A++)D.push({start:S.start(A),end:S.end(A)});return this.bufferedInfo(D,R,m)}}catch(_){}return{len:0,start:R,end:R,nextStart:void 0}},z.bufferedInfo=function(U,R,m){R=Math.max(0,R),U.sort(function(v,L){var b=v.start-L.start;return b||L.end-v.end});var S=[];if(m)for(var D=0;D<U.length;D++){var A=S.length;if(A){var _=S[A-1].end;U[D].start-_<m?U[D].end>_&&(S[A-1].end=U[D].end):S.push(U[D])}else S.push(U[D])}else S=U;for(var C=0,l,o=R,s=R,d=0;d<S.length;d++){var w=S[d].start,g=S[d].end;if(R+m>=w&&R<g)o=w,s=g,C=s-R;else if(R+m<w){l=w;break}}return{len:C,start:o||0,end:s||0,nextStart:l}},z.getBuffered=function(U){try{return U.buffered}catch(R){return $.logger.log("failed to get media.buffered",R),O}},z}()},"./src/utils/cea-608-parser.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"Row",function(){return s}),k.d(J,"CaptionScreen",function(){return d});var $=k("./src/utils/logger.ts"),O={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},M=function(p){var h=p;return O.hasOwnProperty(p)&&(h=O[p]),String.fromCharCode(h)},z=15,H=100,U={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(A||(A={}));var _=function(){function c(){this.time=null,this.verboseLevel=A.ERROR}var p=c.prototype;return p.log=function(a,E){this.verboseLevel>=a&&$.logger.log(this.time+" ["+a+"] "+E)},c}(),C=function(p){for(var h=[],a=0;a<p.length;a++)h.push(p[a].toString(16));return h},l=function(){function c(h,a,E,y,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=a||!1,this.italics=E||!1,this.background=y||"black",this.flash=x||!1}var p=c.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(a){for(var E=["foreground","underline","italics","background","flash"],y=0;y<E.length;y++){var x=E[y];a.hasOwnProperty(x)&&(this[x]=a[x])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},p.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),o=function(){function c(h,a,E,y,x,B){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new l(a,E,y,x,B)}var p=c.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(a,E){this.uchar=a,this.penState.copy(E)},p.setPenState=function(a){this.penState.copy(a)},p.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},p.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<H;a++)this.chars.push(new o);this.logger=h,this.pos=0,this.currPenState=new l}var p=c.prototype;return p.equals=function(a){for(var E=!0,y=0;y<H;y++)if(!this.chars[y].equals(a.chars[y])){E=!1;break}return E},p.copy=function(a){for(var E=0;E<H;E++)this.chars[E].copy(a.chars[E])},p.isEmpty=function(){for(var a=!0,E=0;E<H;E++)if(!this.chars[E].isEmpty()){a=!1;break}return a},p.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},p.moveCursor=function(a){var E=this.pos+a;if(a>1)for(var y=this.pos+1;y<E+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(E)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(a){a>=144&&this.backSpace();var E=M(a);if(this.pos>=H){this.logger.log(A.ERROR,"Cannot insert "+a.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var E;for(E=a;E<H;E++)this.chars[E].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var a=[],E=!0,y=0;y<H;y++){var x=this.chars[y].uchar;x!==" "&&(E=!1),a.push(x)}return E?"":a.join("")},p.setPenStyles=function(a){this.currPenState.setStyles(a);var E=this.chars[this.pos];E.setPenState(this.currPenState)},c}(),d=function(){function c(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<z;a++)this.rows.push(new s(h));this.logger=h,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=c.prototype;return p.reset=function(){for(var a=0;a<z;a++)this.rows[a].clear();this.currRow=z-1},p.equals=function(a){for(var E=!0,y=0;y<z;y++)if(!this.rows[y].equals(a.rows[y])){E=!1;break}return E},p.copy=function(a){for(var E=0;E<z;E++)this.rows[E].copy(a.rows[E])},p.isEmpty=function(){for(var a=!0,E=0;E<z;E++)if(!this.rows[E].isEmpty()){a=!1;break}return a},p.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},p.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},p.insertChar=function(a){var E=this.rows[this.currRow];E.insertChar(a)},p.setPen=function(a){var E=this.rows[this.currRow];E.setPenStyles(a)},p.moveCursor=function(a){var E=this.rows[this.currRow];E.moveCursor(a)},p.setCursor=function(a){this.logger.log(A.INFO,"setCursor: "+a);var E=this.rows[this.currRow];E.setCursor(a)},p.setPAC=function(a){this.logger.log(A.INFO,"pacData = "+JSON.stringify(a));var E=a.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var y=0;y<z;y++)this.rows[y].clear();var x=this.currRow+1-this.nrRollUpRows,B=this.lastOutputScreen;if(B){var F=B.rows[x].cueStartTime,K=this.logger.time;if(F&&K!==null&&F<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[E-this.nrRollUpRows+V+1].copy(B.rows[x+V])}}this.currRow=E;var P=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,Y=Math.max(I-1,0);P.setCursor(a.indent),a.color=P.chars[Y].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},p.setBkgData=function(a){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},p.setRollUpRows=function(a){this.nrRollUpRows=a},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(a,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(A.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var E=[],y="",x=-1,B=0;B<z;B++){var F=this.rows[B].getTextString();F&&(x=B+1,a?E.push("Row "+x+": '"+F+"'"):E.push(F.trim()))}return E.length>0&&(a?y="["+E.join(" | ")+"]":y=E.join(`
`)),y},p.getTextAndFormat=function(){return this.rows},c}(),w=function(){function c(h,a,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(E),this.nonDisplayedMemory=new d(E),this.lastOutputScreen=new d(E),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var p=c.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(a){this.outputFilter=a},p.setPAC=function(a){this.writeScreen.setPAC(a)},p.setBkgData=function(a){this.writeScreen.setBkgData(a)},p.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(A.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},p.insertChars=function(a){for(var E=0;E<a.length;E++)this.writeScreen.insertChar(a[E]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(A.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(A.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(A.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(A.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},p.ccMIDROW=function(a){var E={flash:!1};if(E.underline=a%2===1,E.italics=a>=46,E.italics)E.foreground="white";else{var y=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=x[y]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},c}(),g=function(){function c(h,a,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new _;this.channels=[null,new w(h,a,y),new w(h+1,E,y)],this.cmdHistory=b(),this.logger=y}var p=c.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,E){this.channels[a].setHandler(E)},p.addData=function(a,E){var y,x,B,F=!1;this.logger.time=a;for(var K=0;K<E.length;K+=2){if(x=E[K]&127,B=E[K+1]&127,x===0&&B===0)continue;if(this.logger.log(A.DATA,"["+C([E[K],E[K+1]])+"] -> ("+C([x,B])+")"),y=this.parseCmd(x,B),y||(y=this.parseMidrow(x,B)),y||(y=this.parsePAC(x,B)),y||(y=this.parseBackgroundAttributes(x,B)),!y&&(F=this.parseChars(x,B),F)){var V=this.currentChannel;if(V&&V>0){var P=this.channels[V];P.insertChars(F)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!F&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+C([x,B])+" orig: "+C([E[K],E[K+1]]))}},p.parseCmd=function(a,E){var y=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&E>=32&&E<=47,B=(a===23||a===31)&&E>=33&&E<=35;if(!(x||B))return!1;if(L(a,E,y))return v(null,null,y),this.logger.log(A.DEBUG,"Repeated command ("+C([a,E])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,K=this.channels[F];return a===20||a===21||a===28||a===29?E===32?K.ccRCL():E===33?K.ccBS():E===34?K.ccAOF():E===35?K.ccAON():E===36?K.ccDER():E===37?K.ccRU(2):E===38?K.ccRU(3):E===39?K.ccRU(4):E===40?K.ccFON():E===41?K.ccRDC():E===42?K.ccTR():E===43?K.ccRTD():E===44?K.ccEDM():E===45?K.ccCR():E===46?K.ccENM():E===47&&K.ccEOC():K.ccTO(E-32),v(a,E,y),this.currentChannel=F,!0},p.parseMidrow=function(a,E){var y=0;if((a===17||a===25)&&E>=32&&E<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[y];return x?(x.ccMIDROW(E),this.logger.log(A.DEBUG,"MIDROW ("+C([a,E])+")"),!0):!1}return!1},p.parsePAC=function(a,E){var y,x=this.cmdHistory,B=(a>=17&&a<=23||a>=25&&a<=31)&&E>=64&&E<=127,F=(a===16||a===24)&&E>=64&&E<=95;if(!(B||F))return!1;if(L(a,E,x))return v(null,null,x),!0;var K=a<=23?1:2;E>=64&&E<=95?y=K===1?U[a]:m[a]:y=K===1?R[a]:S[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(y,E)),v(a,E,x),this.currentChannel=K,!0):!1},p.interpretPAC=function(a,E){var y,x={color:null,italics:!1,indent:null,underline:!1,row:a};return E>95?y=E-96:y=E-64,x.underline=(y&1)===1,y<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((y-16)/2)*4,x},p.parseChars=function(a,E){var y,x=null,B=null;if(a>=25?(y=2,B=a-8):(y=1,B=a),B>=17&&B<=19){var F;B===17?F=E+80:B===18?F=E+112:F=E+144,this.logger.log(A.INFO,"Special char '"+M(F)+"' in channel "+y),x=[F]}else a>=32&&a<=127&&(x=E===0?[a]:[a,E]);if(x){var K=C(x);this.logger.log(A.DEBUG,"Char codes = "+K.join(",")),v(a,E,this.cmdHistory)}return x},p.parseBackgroundAttributes=function(a,E){var y=(a===16||a===24)&&E>=32&&E<=47,x=(a===23||a===31)&&E>=45&&E<=47;if(!(y||x))return!1;var B,F={};a===16||a===24?(B=Math.floor((E-32)/2),F.background=D[B],E%2===1&&(F.background=F.background+"_semi")):E===45?F.background="transparent":(F.foreground="black",E===47&&(F.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(F),v(a,E,this.cmdHistory),!0},p.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var E=this.channels[a];E&&E.reset()}this.cmdHistory=b()},p.cueSplitAtTime=function(a){for(var E=0;E<this.channels.length;E++){var y=this.channels[E];y&&y.cueSplitAtTime(a)}},c}();function v(c,p,h){h.a=c,h.b=p}function L(c,p,h){return h.a===c&&h.b===p}function b(){return{a:null,b:null}}J.default=g},"./src/utils/codecs.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"isCodecType",function(){return O}),k.d(J,"isCodecSupportedInMp4",function(){return M});var $={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 O(z,H){var U=$[H];return!!U&&U[z.slice(0,4)]===!0}function M(z,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/utils/vttparser.ts"),O=k("./src/utils/webvtt-parser.ts"),M=k("./src/utils/texttrack-utils.ts"),z=/\s/,H={newCue:function(R,m,S,D){for(var A=[],_,C,l,o,s,d=self.VTTCue||self.TextTrackCue,w=0;w<D.rows.length;w++)if(_=D.rows[w],l=!0,o=0,s="",!_.isEmpty()){for(var g=0;g<_.chars.length;g++)z.test(_.chars[g].uchar)&&l?o++:(s+=_.chars[g].uchar,l=!1);_.cueStartTime=m,m===S&&(S+=1e-4),o>=16?o--:o++;var v=Object($.fixLineBreaks)(s.trim()),L=Object(O.generateCueId)(m,S,v);(!R||!R.cues||!R.cues.getCueById(L))&&(C=new d(m,S,v),C.id=L,C.line=w+1,C.align="left",C.position=10+Math.min(80,Math.floor(o*8/32)*10),A.push(C))}return R&&A.length&&(A.sort(function(b,c){return b.line==="auto"||c.line==="auto"?0:b.line>8&&c.line>8?c.line-b.line:b.line-c.line}),A.forEach(function(b){return Object(M.addCueToTrack)(R,b)})),A}};J.default=H},"./src/utils/discontinuities.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"findFirstFragWithCC",function(){return z}),k.d(J,"shouldAlignOnDiscontinuities",function(){return H}),k.d(J,"findDiscontinuousReferenceFrag",function(){return U}),k.d(J,"adjustSlidingStart",function(){return m}),k.d(J,"alignStream",function(){return S}),k.d(J,"alignPDT",function(){return A}),k.d(J,"alignFragmentByPDTDelta",function(){return _}),k.d(J,"alignMediaPlaylistByPDT",function(){return C});var $=k("./src/polyfills/number.ts"),O=k("./src/utils/logger.ts"),M=k("./src/controller/level-helper.ts");function z(l,o){for(var s=null,d=0,w=l.length;d<w;d++){var g=l[d];if(g&&g.cc===o){s=g;break}}return s}function H(l,o,s){return!!(o.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function U(l,o){var s=l.fragments,d=o.fragments;if(!d.length||!s.length){O.logger.log("No fragments to align");return}var w=z(s,d[0].cc);if(!w||w&&!w.startPTS){O.logger.log("No frag in previous level to align on");return}return w}function R(l,o){if(l){var s=l.start+o;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function m(l,o){for(var s=o.fragments,d=0,w=s.length;d<w;d++)R(s[d],l);o.fragmentHint&&R(o.fragmentHint,l),o.alignedSliding=!0}function S(l,o,s){if(!o)return;D(l,s,o),!s.alignedSliding&&o.details&&A(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(M.adjustSliding)(o.details,s)}function D(l,o,s){if(H(l,s,o)){var d=U(s.details,o);d&&Object($.isFiniteNumber)(d.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),m(d.start,o))}}function A(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=l.fragments[0].programDateTime,w=(d-s)/1e3+o.fragments[0].start;w&&Object($.isFiniteNumber)(w)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+w.toFixed(3)+" "+l.url+" "),m(w,l))}function _(l,o){var s=l.programDateTime;if(!s)return;var d=(s-o)/1e3;l.start=l.startPTS=d,l.endPTS=d+l.duration}function C(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,d=o.fragments[0].start,w=s-d*1e3;l.fragments.forEach(function(g){_(g,w)}),l.fragmentHint&&_(l.fragmentHint,w),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/utils/ewma.ts"),O=function(){function M(H,U,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(H),this.fast_=new $.default(U)}var z=M.prototype;return z.update=function(U,R){var m=this.slow_,S=this.fast_;this.slow_.halfLife!==U&&(this.slow_=new $.default(U,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new $.default(R,S.getEstimate(),S.getTotalWeight()))},z.sample=function(U,R){U=Math.max(U,this.minDelayMs_);var m=8*R,S=U/1e3,D=m/S;this.fast_.sample(S,D),this.slow_.sample(S,D)},z.canEstimate=function(){var U=this.fast_;return U&&U.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},M}();J.default=O},"./src/utils/ewma.ts":function(le,J,k){"use strict";k.r(J);var $=function(){function O(z,H,U){H===void 0&&(H=0),U===void 0&&(U=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=z,this.alpha_=z?Math.exp(Math.log(.5)/z):0,this.estimate_=H,this.totalWeight_=U}var M=O.prototype;return M.sample=function(H,U){var R=Math.pow(this.alpha_,H);this.estimate_=U*(1-R)+R*this.estimate_,this.totalWeight_+=H},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},O}();J.default=$},"./src/utils/fetch-loader.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"fetchSupported",function(){return _});var $=k("./src/polyfills/number.ts"),O=k("./src/loader/load-stats.ts"),M=k("./src/demux/chunk-cache.ts");function z(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,S(d,w)}function H(d){var w=typeof Map=="function"?new Map:void 0;return H=function(v){if(v===null||!m(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(v))return w.get(v);w.set(v,L)}function L(){return U(v,arguments,D(this).constructor)}return L.prototype=Object.create(v.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),S(L,v)},H(d)}function U(d,w,g){return R()?U=Reflect.construct:U=function(L,b,c){var p=[null];p.push.apply(p,b);var h=Function.bind.apply(L,p),a=new h;return c&&S(a,c.prototype),a},U.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function m(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function S(d,w){return S=Object.setPrototypeOf||function(v,L){return v.__proto__=L,v},S(d,w)}function D(d){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},D(d)}function A(){return A=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var g=arguments[w];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(d[v]=g[v])}return d},A.apply(this,arguments)}function _(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var C=function(){function d(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new O.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(v,L,b){var c=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var h=l(v,this.controller.signal),a=b.onProgress,E=v.responseType==="arraybuffer",y=E?"byteLength":"length";this.context=v,this.config=L,this.callbacks=b,this.request=this.fetchSetup(v,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),b.onTimeout(p,v,c.response)},L.timeout),self.fetch(this.request).then(function(x){if(c.response=c.loader=x,!x.ok){var B=x.status,F=x.statusText;throw new s(F||"fetch, bad network response",B,x)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(x.headers.get("Content-Length")||"0"),a&&Object($.isFiniteNumber)(L.highWaterMark)?c.loadProgressively(x,p,v,L.highWaterMark,a):E?x.arrayBuffer():x.text()}).then(function(x){var B=c.response;self.clearTimeout(c.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=x[y];var F={url:B.url,data:x};a&&!Object($.isFiniteNumber)(L.highWaterMark)&&a(p,v,x,B),b.onSuccess(F,p,v,B)}).catch(function(x){if(self.clearTimeout(c.requestTimeout),p.aborted)return;var B=x.code||0;b.onError({code:B,text:x.message},v,x.details)})},w.getCacheAge=function(){var v=null;if(this.response){var L=this.response.headers.get("age");v=L?parseFloat(L):null}return v},w.loadProgressively=function(v,L,b,c,p){c===void 0&&(c=0);var h=new M.default,a=v.body.getReader(),E=function y(){return a.read().then(function(x){if(x.done)return h.dataLength&&p(L,b,h.flush(),v),Promise.resolve(new ArrayBuffer(0));var B=x.value,F=B.length;return L.loaded+=F,F<c||h.dataLength?(h.push(B),h.dataLength>=c&&p(L,b,h.flush(),v)):p(L,b,B,v),y()}).catch(function(){return Promise.reject()})};return E()},d}();function l(d,w){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(A({},d.headers))};return d.rangeEnd&&g.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),g}function o(d,w){return new self.Request(d.url,w)}var s=function(d){z(w,d);function w(g,v,L){var b;return b=d.call(this,g)||this,b.code=void 0,b.details=void 0,b.code=v,b.details=L,b}return w}(H(Error));J.default=C},"./src/utils/imsc1-ttml-parser.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"IMSC1_CODEC",function(){return m}),k.d(J,"parseIMSC1",function(){return _});var $=k("./src/utils/mp4-tools.ts"),O=k("./src/utils/vttparser.ts"),M=k("./src/utils/vttcue.ts"),z=k("./src/demux/id3.ts"),H=k("./src/utils/timescale-conversion.ts"),U=k("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(c){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var a in h)Object.prototype.hasOwnProperty.call(h,a)&&(c[a]=h[a])}return c},R.apply(this,arguments)}var m="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,D=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function _(c,p,h,a,E){var y=Object($.findBox)(new Uint8Array(c),["mdat"]);if(y.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var x=y[0],B=Object(z.utf8ArrayToStr)(new Uint8Array(c,x.start,x.end-x.start)),F=Object(H.toTimescaleFromScale)(p,1,h);try{a(C(B,F))}catch(K){E(K)}}function C(c,p){var h=new DOMParser,a=h.parseFromString(c,"text/xml"),E=a.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(y).reduce(function(P,I){return P[I]=E.getAttribute("ttp:"+I)||y[I],P},{}),B=E.getAttribute("xml:space")!=="preserve",F=o(l(E,"styling","style")),K=o(l(E,"layout","region")),V=l(E,"body","[begin]");return[].map.call(V,function(P){var I=s(P,B);if(!I||!P.hasAttribute("begin"))return null;var Y=v(P.getAttribute("begin"),x),ee=v(P.getAttribute("dur"),x),oe=v(P.getAttribute("end"),x);if(Y===null)throw g(P);if(oe===null){if(ee===null)throw g(P);oe=Y+ee}var pe=new M.default(Y-p,oe-p,I);pe.id=Object(U.generateCueId)(pe.startTime,pe.endTime,pe.text);var Oe=K[P.getAttribute("region")],Se=F[P.getAttribute("style")];pe.position=10,pe.size=80;var we=d(Oe,Se),Te=we.textAlign;if(Te){var Ce=A[Te];Ce&&(pe.lineAlign=Ce),pe.align=Te}return R(pe,we),pe}).filter(function(P){return P!==null})}function l(c,p,h){var a=c.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(h)):[]}function o(c){return c.reduce(function(p,h){var a=h.getAttribute("xml:id");return a&&(p[a]=h),p},{})}function s(c,p){return[].slice.call(c.childNodes).reduce(function(h,a,E){var y;return a.nodeName==="br"&&E?h+`
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?s(a,p):p?h+a.textContent.trim().replace(/\s+/g," "):h+a.textContent},"")}function d(c,p){var h="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(E,y){var x=w(p,h,y)||w(c,h,y);return x&&(E[y]=x),E},{})}function w(c,p,h){return c.hasAttributeNS(p,h)?c.getAttributeNS(p,h):null}function g(c){return new Error("Could not parse ttml timestamp "+c)}function v(c,p){if(!c)return null;var h=Object(O.parseTimeStamp)(c);return h===null&&(S.test(c)?h=L(c,p):D.test(c)&&(h=b(c,p))),h}function L(c,p){var h=S.exec(c),a=(h[4]|0)+(h[5]|0)/p.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+a/p.frameRate}function b(c,p){var h=D.exec(c),a=Number(h[1]),E=h[2];switch(E){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/p.frameRate;case"t":return a/p.tickRate}return a}},"./src/utils/logger.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"enableLogs",function(){return U}),k.d(J,"logger",function(){return R});var $=function(){},O={trace:$,debug:$,log:$,warn:$,info:$,error:$},M=O;function z(m){var S=self.console[m];return S?S.bind(self.console,"["+m+"] >"):$}function H(m){for(var S=arguments.length,D=new Array(S>1?S-1:0),A=1;A<S;A++)D[A-1]=arguments[A];D.forEach(function(_){M[_]=m[_]?m[_].bind(m):z(_)})}function U(m){if(self.console&&m===!0||typeof m=="object"){H(m,"debug","log","info","warn","error");try{M.log()}catch(S){M=O}}else M=O}var R=M},"./src/utils/mediakeys-helper.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"KeySystems",function(){return $}),k.d(J,"requestMediaKeySystemAccess",function(){return O});var $;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})($||($={}));var O=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"bin2str",function(){return H}),k.d(J,"readUint16",function(){return U}),k.d(J,"readUint32",function(){return R}),k.d(J,"writeUint32",function(){return m}),k.d(J,"findBox",function(){return S}),k.d(J,"parseSegmentIndex",function(){return D}),k.d(J,"parseInitSegment",function(){return A}),k.d(J,"getStartDTS",function(){return _}),k.d(J,"getDuration",function(){return C}),k.d(J,"computeRawDurationFromSamples",function(){return l}),k.d(J,"offsetStartDTS",function(){return o}),k.d(J,"segmentValidRange",function(){return s}),k.d(J,"appendUint8Array",function(){return d});var $=k("./src/utils/typed-array.ts"),O=k("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,z=[].push;function H(w){return String.fromCharCode.apply(null,w)}function U(w,g){"data"in w&&(g+=w.start,w=w.data);var v=w[g]<<8|w[g+1];return v<0?65536+v:v}function R(w,g){"data"in w&&(g+=w.start,w=w.data);var v=w[g]<<24|w[g+1]<<16|w[g+2]<<8|w[g+3];return v<0?4294967296+v:v}function m(w,g,v){"data"in w&&(g+=w.start,w=w.data),w[g]=v>>24,w[g+1]=v>>16&255,w[g+2]=v>>8&255,w[g+3]=v&255}function S(w,g){var v=[];if(!g.length)return v;var L,b,c;"data"in w?(L=w.data,b=w.start,c=w.end):(L=w,b=0,c=L.byteLength);for(var p=b;p<c;){var h=R(L,p),a=H(L.subarray(p+4,p+8)),E=h>1?p+h:c;if(a===g[0])if(g.length===1)v.push({data:L,start:p+8,end:E});else{var y=S({data:L,start:p+8,end:E},g.slice(1));y.length&&z.apply(v,y)}p=E}return v}function D(w){var g=S(w,["moov"]),v=g[0],L=v?v.end:null,b=S(w,["sidx"]);if(!b||!b[0])return null;var c=[],p=b[0],h=p.data[0],a=h===0?8:16,E=R(p,a);a+=4;var y=0,x=0;h===0?a+=8:a+=16,a+=2;var B=p.end+x,F=U(p,a);a+=2;for(var K=0;K<F;K++){var V=a,P=R(p,V);V+=4;var I=P&2147483647,Y=(P&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=R(p,V);V+=4,c.push({referenceSize:I,subsegmentDuration:ee,info:{duration:ee/E,start:B,end:B+I-1}}),B+=I,V+=4,a=V}return{earliestPresentationTime:y,timescale:E,version:h,referencesCount:F,references:c,moovEndOffset:L}}function A(w){for(var g=[],v=S(w,["moov","trak"]),L=0;L<v.length;L++){var b=v[L],c=S(b,["tkhd"])[0];if(c){var p=c.data[c.start],h=p===0?12:20,a=R(c,h),E=S(b,["mdia","mdhd"])[0];if(E){p=E.data[E.start],h=p===0?12:20;var y=R(E,h),x=S(b,["mdia","hdlr"])[0];if(x){var B=H(x.data.subarray(x.start+8,x.start+12)),F={soun:O.ElementaryStreamTypes.AUDIO,vide:O.ElementaryStreamTypes.VIDEO}[B];if(F){var K=S(b,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=H(K.data.subarray(K.start+12,K.start+16))),g[a]={timescale:y,type:F},g[F]={timescale:y,id:a,codec:V}}}}}}var P=S(w,["moov","mvex","trex"]);return P.forEach(function(I){var Y=R(I,4),ee=g[Y];ee&&(ee.default={duration:R(I,12),flags:R(I,20)})}),g}function _(w,g){return S(g,["moof","traf"]).reduce(function(v,L){var b=S(L,["tfdt"])[0],c=b.data[b.start],p=S(L,["tfhd"]).reduce(function(h,a){var E=R(a,4),y=w[E];if(y){var x=R(b,4);c===1&&(x*=Math.pow(2,32),x+=R(b,8));var B=y.timescale||9e4,F=x/B;if(isFinite(F)&&(h===null||F<h))return F}return h},null);return p!==null&&isFinite(p)&&(v===null||p<v)?p:v},null)||0}function C(w,g){for(var v=0,L=0,b=0,c=S(w,["moof","traf"]),p=0;p<c.length;p++){var h=c[p],a=S(h,["tfhd"])[0],E=R(a,4),y=g[E];if(!y)continue;var x=y.default,B=R(a,0)|(x==null?void 0:x.flags),F=x==null?void 0:x.duration;B&8&&(B&2?F=R(a,12):F=R(a,8));for(var K=y.timescale||9e4,V=S(h,["trun"]),P=0;P<V.length;P++){if(F){var I=R(V[P],4);v=F*I}else v=l(V[P]);y.type===O.ElementaryStreamTypes.VIDEO?L+=v/K:y.type===O.ElementaryStreamTypes.AUDIO&&(b+=v/K)}}if(L===0&&b===0){var Y=D(w);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return L||b}function l(w){var g=R(w,0),v=8;g&1&&(v+=4),g&4&&(v+=4);for(var L=0,b=R(w,4),c=0;c<b;c++){if(g&256){var p=R(w,v);L+=p,v+=4}g&512&&(v+=4),g&1024&&(v+=4),g&2048&&(v+=4)}return L}function o(w,g,v){S(g,["moof","traf"]).forEach(function(L){S(L,["tfhd"]).forEach(function(b){var c=R(b,4),p=w[c];if(!p)return;var h=p.timescale||9e4;S(L,["tfdt"]).forEach(function(a){var E=a.data[a.start],y=R(a,4);if(E===0)m(a,4,y-v*h);else{y*=Math.pow(2,32),y+=R(a,8),y-=v*h,y=Math.max(y,0);var x=Math.floor(y/(M+1)),B=Math.floor(y%(M+1));m(a,4,x),m(a,8,B)}})})})}function s(w){var g={valid:null,remainder:null},v=S(w,["moof"]);if(v){if(v.length<2)return g.remainder=w,g}else return g;var L=v[v.length-1];return g.valid=Object($.sliceUint8)(w,0,L.start-8),g.remainder=Object($.sliceUint8)(w,L.start-8),g}function d(w,g){var v=new Uint8Array(w.length+g.length);return v.set(w),v.set(g,w.length),v}},"./src/utils/output-filter.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function O(z,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=H}var M=O.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(H,U,R){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=U,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},O}()},"./src/utils/texttrack-utils.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"sendAddTrackEvent",function(){return O}),k.d(J,"addCueToTrack",function(){return M}),k.d(J,"clearCurrentCues",function(){return z}),k.d(J,"removeCuesInRange",function(){return H}),k.d(J,"getCuesInRange",function(){return R});var $=k("./src/utils/logger.ts");function O(m,S){var D;try{D=new Event("addtrack")}catch(A){D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=m,S.dispatchEvent(D)}function M(m,S){var D=m.mode;if(D==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(S.id))try{if(m.addCue(S),!m.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(_){$.logger.debug("[texttrack-utils]: "+_);var A=new self.TextTrackCue(S.startTime,S.endTime,S.text);A.id=S.id,m.addCue(A)}D==="disabled"&&(m.mode=D)}function z(m){var S=m.mode;if(S==="disabled"&&(m.mode="hidden"),m.cues)for(var D=m.cues.length;D--;)m.removeCue(m.cues[D]);S==="disabled"&&(m.mode=S)}function H(m,S,D){var A=m.mode;if(A==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var _=R(m.cues,S,D),C=0;C<_.length;C++)m.removeCue(_[C]);A==="disabled"&&(m.mode=A)}function U(m,S){if(S<m[0].startTime)return 0;var D=m.length-1;if(S>m[D].endTime)return-1;for(var A=0,_=D;A<=_;){var C=Math.floor((_+A)/2);if(S<m[C].startTime)_=C-1;else if(S>m[C].startTime&&A<D)A=C+1;else return C}return m[A].startTime-S<S-m[_].startTime?A:_}function R(m,S,D){var A=[],_=U(m,S);if(_>-1)for(var C=_,l=m.length;C<l;C++){var o=m[C];if(o.startTime>=S&&o.endTime<=D)A.push(o);else if(o.startTime>D)return A}return A}},"./src/utils/time-ranges.ts":function(le,J,k){"use strict";k.r(J);var $={toString:function(M){for(var z="",H=M.length,U=0;U<H;U++)z+="["+M.start(U).toFixed(3)+","+M.end(U).toFixed(3)+"]";return z}};J.default=$},"./src/utils/timescale-conversion.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"toTimescaleFromBase",function(){return O}),k.d(J,"toTimescaleFromScale",function(){return M}),k.d(J,"toMsFromMpegTsClock",function(){return z}),k.d(J,"toMpegTsClockFromTimescale",function(){return H});var $=9e4;function O(U,R,m,S){m===void 0&&(m=1),S===void 0&&(S=!1);var D=U*R*m;return S?Math.round(D):D}function M(U,R,m,S){return m===void 0&&(m=1),S===void 0&&(S=!1),O(U,R,1/m,S)}function z(U,R){return R===void 0&&(R=!1),O(U,1e3,1/$,R)}function H(U,R){return R===void 0&&(R=1),O(U,$,1/R)}},"./src/utils/typed-array.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"sliceUint8",function(){return $});function $(O,M,z){return Uint8Array.prototype.slice?O.slice(M,z):new Uint8Array(Array.prototype.slice.call(O,M,z))}},"./src/utils/vttcue.ts":function(le,J,k){"use strict";k.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],O=["start","middle","end","left","right"];function M(m,S){if(typeof S!="string")return!1;if(!Array.isArray(m))return!1;var D=S.toLowerCase();return~m.indexOf(D)?D:!1}function z(m){return M($,m)}function H(m){return M(O,m)}function U(m){for(var S=arguments.length,D=new Array(S>1?S-1:0),A=1;A<S;A++)D[A-1]=arguments[A];for(var _=1;_<arguments.length;_++){var C=arguments[_];for(var l in C)m[l]=C[l]}return m}function R(m,S,D){var A=this,_={enumerable:!0};A.hasBeenReset=!1;var C="",l=!1,o=m,s=S,d=D,w=null,g="",v=!0,L="auto",b="start",c=50,p="middle",h=50,a="middle";Object.defineProperty(A,"id",U({},_,{get:function(){return C},set:function(y){C=""+y}})),Object.defineProperty(A,"pauseOnExit",U({},_,{get:function(){return l},set:function(y){l=!!y}})),Object.defineProperty(A,"startTime",U({},_,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",U({},_,{get:function(){return s},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");s=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",U({},_,{get:function(){return d},set:function(y){d=""+y,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",U({},_,{get:function(){return w},set:function(y){w=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",U({},_,{get:function(){return g},set:function(y){var x=z(y);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",U({},_,{get:function(){return v},set:function(y){v=!!y,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",U({},_,{get:function(){return L},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",U({},_,{get:function(){return b},set:function(y){var x=H(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",U({},_,{get:function(){return c},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",U({},_,{get:function(){return p},set:function(y){var x=H(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");p=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",U({},_,{get:function(){return h},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",U({},_,{get:function(){return a},set:function(y){var x=H(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),A.displayState=void 0}return R.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"parseTimeStamp",function(){return M}),k.d(J,"fixLineBreaks",function(){return S}),k.d(J,"VTTParser",function(){return D});var $=k("./src/utils/vttcue.ts"),O=function(){function A(){}var _=A.prototype;return _.decode=function(l,o){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},A}();function M(A){function _(l,o,s,d){return(l|0)*3600+(o|0)*60+(s|0)+parseFloat(d||0)}var C=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?_(C[2],C[3],0,C[4]):_(C[1],C[2],C[3],C[4]):null}var z=function(){function A(){this.values=Object.create(null)}var _=A.prototype;return _.set=function(l,o){!this.get(l)&&o!==""&&(this.values[l]=o)},_.get=function(l,o,s){return s?this.has(l)?this.values[l]:o[s]:this.has(l)?this.values[l]:o},_.has=function(l){return l in this.values},_.alt=function(l,o,s){for(var d=0;d<s.length;++d)if(o===s[d]){this.set(l,o);break}},_.integer=function(l,o){/^-?\d+$/.test(o)&&this.set(l,parseInt(o,10))},_.percent=function(l,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},A}();function H(A,_,C,l){var o=l?A.split(l):[A];for(var s in o){if(typeof o[s]!="string")continue;var d=o[s].split(C);if(d.length!==2)continue;var w=d[0],g=d[1];_(w,g)}}var U=new $.default(0,0,""),R=U.align==="middle"?"middle":"center";function m(A,_,C){var l=A;function o(){var w=M(A);if(w===null)throw new Error("Malformed timestamp: "+l);return A=A.replace(/^[^\sa-zA-Z-]+/,""),w}function s(w,g){var v=new z;H(w,function(c,p){var h;switch(c){case"region":for(var a=C.length-1;a>=0;a--)if(C[a].id===p){v.set(c,C[a].region);break}break;case"vertical":v.alt(c,p,["rl","lr"]);break;case"line":h=p.split(","),v.integer(c,h[0]),v.percent(c,h[0])&&v.set("snapToLines",!1),v.alt(c,h[0],["auto"]),h.length===2&&v.alt("lineAlign",h[1],["start",R,"end"]);break;case"position":h=p.split(","),v.percent(c,h[0]),h.length===2&&v.alt("positionAlign",h[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":v.percent(c,p);break;case"align":v.alt(c,p,["start",R,"end","left","right"]);break}},/:/,/\s/),g.region=v.get("region",null),g.vertical=v.get("vertical","");var L=v.get("line","auto");L==="auto"&&U.line===-1&&(L=-1),g.line=L,g.lineAlign=v.get("lineAlign","start"),g.snapToLines=v.get("snapToLines",!0),g.size=v.get("size",100),g.align=v.get("align",R);var b=v.get("position","auto");b==="auto"&&U.position===50&&(b=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=b}function d(){A=A.replace(/^\s+/,"")}if(d(),_.startTime=o(),d(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);A=A.substr(3),d(),_.endTime=o(),d(),s(A,_)}function S(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var D=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new O,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var _=A.prototype;return _.parse=function(l){var o=this;l&&(o.buffer+=o.decoder.decode(l,{stream:!0}));function s(){var b=o.buffer,c=0;for(b=S(b);c<b.length&&b[c]!=="\r"&&b[c]!==`
`;)++c;var p=b.substr(0,c);return b[c]==="\r"&&++c,b[c]===`
`&&++c,o.buffer=b.substr(c),p}function d(b){H(b,function(c,p){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=s();var g=w.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var v=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;v?v=!1:w=s();switch(o.state){case"HEADER":/:/.test(w)?d(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new $.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{m(w,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(v=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},_.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){l.onparsingerror&&l.onparsingerror(o)}return l.onflush&&l.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(le,J,k){"use strict";k.r(J),k.d(J,"generateCueId",function(){return D}),k.d(J,"parseWebVTT",function(){return _});var $=k("./src/polyfills/number.ts"),O=k("./src/utils/vttparser.ts"),M=k("./src/demux/id3.ts"),z=k("./src/utils/timescale-conversion.ts"),H=k("./src/remux/mp4-remuxer.ts"),U=/\r\n|\n\r|\n|\r/g,R=function(l,o,s){return s===void 0&&(s=0),l.substr(s,o.length)===o},m=function(l){var o=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),d=parseInt(l.substr(-9,2)),w=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object($.isFiniteNumber)(o)||!Object($.isFiniteNumber)(s)||!Object($.isFiniteNumber)(d)||!Object($.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return o+=1e3*s,o+=60*1e3*d,o+=60*60*1e3*w,o},S=function(l){for(var o=5381,s=l.length;s;)o=o*33^l.charCodeAt(--s);return(o>>>0).toString()};function D(C,l,o){return S(C.toString())+S(l.toString())+S(o)}var A=function(l,o,s){var d=l[o],w=l[d.prevCC];if(!w||!w.new&&d.new){l.ccOffset=l.presentationOffset=d.start,d.new=!1;return}for(;(g=w)!==null&&g!==void 0&&g.new;){var g;l.ccOffset+=d.start-w.start,d.new=!1,d=w,w=l[d.prevCC]}l.presentationOffset=s};function _(C,l,o,s,d,w,g,v){var L=new O.VTTParser,b=Object(M.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(U,`
`).split(`
`),c=[],p=Object(z.toMpegTsClockFromTimescale)(l,o),h="00:00.000",a=0,E=0,y,x=!0,B=!1;L.oncue=function(F){var K=s[d],V=s.ccOffset,P=(a-p)/9e4;if(K!=null&&K.new&&(E!==void 0?V=s.ccOffset=K.start:A(s,d,P)),P&&(V=P-s.presentationOffset),B){var I=F.endTime-F.startTime,Y=Object(H.normalizePts)((F.startTime+V-E)*9e4,w*9e4)/9e4;F.startTime=Y,F.endTime=Y+I}var ee=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ee)),F.id||(F.id=D(F.startTime,F.endTime,ee)),F.endTime>0&&c.push(F)},L.onparsingerror=function(F){y=F},L.onflush=function(){if(y){v(y);return}g(c)},b.forEach(function(F){if(x)if(R(F,"X-TIMESTAMP-MAP=")){x=!1,B=!0,F.substr(16).split(",").forEach(function(K){R(K,"LOCAL:")?h=K.substr(6):R(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{E=m(h)/1e3}catch(K){B=!1,y=K}return}else F===""&&(x=!1);L.parse(F+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(le,J,k){"use strict";k.r(J);var $=k("./src/utils/logger.ts"),O=k("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,z=function(){function H(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new O.LoadStats,this.retryDelay=0}var U=H.prototype;return U.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},U.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},U.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},U.load=function(m,S,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=S,this.callbacks=D,this.retryDelay=S.retryDelay,this.loadInternal()},U.loadInternal=function(){var m=this.config,S=this.context;if(!m)return;var D=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var _=this.xhrSetup;try{if(_)try{_(D,S.url)}catch(o){D.open("GET",S.url,!0),_(D,S.url)}D.readyState||D.open("GET",S.url,!0);var C=this.context.headers;if(C)for(var l in C)D.setRequestHeader(l,C[l])}catch(o){this.callbacks.onError({code:D.status,text:o.message},S,D);return}S.rangeEnd&&D.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),D.send()},U.readystatechange=function(){var m=this.context,S=this.loader,D=this.stats;if(!m||!S)return;var A=S.readyState,_=this.config;if(D.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),A===4){S.onreadystatechange=null,S.onprogress=null;var C=S.status;if(C>=200&&C<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var l,o;if(m.responseType==="arraybuffer"?(l=S.response,o=l.byteLength):(l=S.responseText,o=l.length),D.loaded=D.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(D,m,l,S),!this.callbacks)return;var d={url:S.responseURL,data:l};this.callbacks.onSuccess(d,D,m,S)}else D.retry>=_.maxRetry||C>=400&&C<499?($.logger.error(C+" while loading "+m.url),this.callbacks.onError({code:C,text:S.statusText},m,S)):($.logger.warn(C+" while loading "+m.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,_.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout)},U.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},U.loadprogress=function(m){var S=this.stats;S.loaded=m.loaded,m.lengthComputable&&(S.total=m.total)},U.getCacheAge=function(){var m=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");m=S?parseFloat(S):null}return m},H}();J.default=z}}).default})},vHTk:function(pt,it,ie){pt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);