You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
366 lines
931 KiB
366 lines
931 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[206,6,7,8,11],{"+NIl":function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){"use strict";fe.defineMode("stex",function(Z,O){"use strict";function J(k,w){k.cmdState.push(w)}function U(k){return k.cmdState.length>0?k.cmdState[k.cmdState.length-1]:null}function R(k){var w=k.cmdState.pop();w&&w.closeBracket()}function G(k){for(var w=k.cmdState,C=w.length-1;C>=0;C--){var d=w[C];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function H(k,w,C){return function(){this.name=k,this.bracketNo=0,this.style=w,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 M={};M.importmodule=H("importmodule","tag",["string","builtin"]),M.documentclass=H("documentclass","tag",["","atom"]),M.usepackage=H("usepackage","tag",["atom"]),M.begin=H("begin","tag",["atom"]),M.end=H("end","tag",["atom"]),M.label=H("label","tag",["atom"]),M.ref=H("ref","tag",["atom"]),M.eqref=H("eqref","tag",["atom"]),M.cite=H("cite","tag",["atom"]),M.bibitem=H("bibitem","tag",["atom"]),M.Bibitem=H("Bibitem","tag",["atom"]),M.RBibitem=H("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(k,w){k.f=w}function b(k,w){var C;if(k.match(/^\\[a-zA-Z@]+/)){var d=k.current().slice(1);return C=M.hasOwnProperty(d)?M[d]:M.DEFAULT,C=new C,J(w,C),_(w,I),C.style}if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/\\]/))return"tag";if(k.match("\\["))return _(w,function(l,h){return A(l,h,"\\]")}),"keyword";if(k.match("\\("))return _(w,function(l,h){return A(l,h,"\\)")}),"keyword";if(k.match("$$"))return _(w,function(l,h){return A(l,h,"$$")}),"keyword";if(k.match("$"))return _(w,function(l,h){return A(l,h,"$")}),"keyword";var o=k.next();if(o=="%")return k.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=U(w),C)C.closeBracket(o),_(w,I);else return"error";return"bracket"}else return o=="{"||o=="["?(C=M.DEFAULT,C=new C,J(w,C),"bracket"):/\d/.test(o)?(k.eatWhile(/[\w.%]/),"atom"):(k.eatWhile(/[\w\-_]/),C=G(w),C.name=="begin"&&(C.argument=k.current()),C.styleIdentifier())}function A(k,w,C){if(k.eatSpace())return null;if(C&&k.match(C))return _(w,b),"keyword";if(k.match(/^\\[a-zA-Z@]+/))return"tag";if(k.match(/^[a-zA-Z]+/))return"variable-2";if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/]/))return"tag";if(k.match(/^[\^_&]/))return"tag";if(k.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(k.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=k.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(k.skipToEnd(),"comment"):"error"}function I(k,w){var C=k.peek(),d;return C=="{"||C=="["?(d=U(w),d.openBracket(C),k.eat(C),_(w,b),"bracket"):/[ \t\r]/.test(C)?(k.eat(C),null):(_(w,b),R(w),b(k,w))}return{startState:function(){var k=O.inMathMode?function(w,C){return A(w,C)}:b;return{cmdState:[],f:k}},copyState:function(k){return{cmdState:k.cmdState.slice(),f:k.f}},token:function(k,w){return w.f(k,w)},blankLine:function(k){k.f=b,k.cmdState.length=0},lineComment:"%"}}),fe.defineMIME("text/x-stex","stex"),fe.defineMIME("text/x-latex","stex")})},"19Vz":function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){fe.defineOption("placeholder","",function(H,M,_){var b=_&&_!=fe.Init;if(M&&!b)H.on("blur",U),H.on("change",R),H.on("swapDoc",R),fe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){J(H)}),R(H);else if(!M&&b){H.off("blur",U),H.off("change",R),H.off("swapDoc",R),fe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var A=H.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}M&&!H.hasFocus()&&U(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function O(H){Z(H);var M=H.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=H.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var _=H.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),M.appendChild(_),H.display.lineSpace.insertBefore(M,H.display.lineSpace.firstChild)}function J(H){setTimeout(function(){var M=!1,_=H.getInputField();_.nodeName=="TEXTAREA"?M=!_.value:H.lineCount()==1&&(M=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),M?O(H):Z(H)},20)}function U(H){G(H)&&O(H)}function R(H){var M=H.getWrapperElement(),_=G(H);M.className=M.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?O(H):Z(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};fe.defineMode("xml",function(J,U){var R=J.indentUnit,G={},H=U.htmlMode?Z:O;for(var M in H)G[M]=H[M];for(var M in U)G[M]=U[M];var _,b;function A(a,y){function m(W){return y.tokenize=W,W(a,y)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(w("atom","]]>")):null:a.match("--")?m(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),y.tokenize=w("meta","?>"),"meta"):(_=a.eat("/")?"closeTag":"openTag",y.tokenize=I,"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}A.isInText=!0;function I(a,y){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return y.tokenize=A,_=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return _="equals",null;if(m=="<"){y.tokenize=A,y.state=h,y.tagName=y.tagStart=null;var x=y.tokenize(a,y);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=k(m),y.stringStartCol=a.column(),y.tokenize(a,y)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function k(a){var y=function(m,x){for(;!m.eol();)if(m.next()==a){x.tokenize=I;break}return"string"};return y.isInAttribute=!0,y}function w(a,y){return function(m,x){for(;!m.eol();){if(m.match(y)){x.tokenize=A;break}m.next()}return a}}function C(a){return function(y,m){for(var x;(x=y.next())!=null;){if(x=="<")return m.tokenize=C(a+1),m.tokenize(y,m);if(x==">")if(a==1){m.tokenize=A;break}else return m.tokenize=C(a-1),m.tokenize(y,m)}return"meta"}}function d(a,y,m){this.prev=a.context,this.tagName=y,this.indent=a.indented,this.startOfLine=m,(G.doNotIndent.hasOwnProperty(y)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,y){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!G.contextGrabbers.hasOwnProperty(m)||!G.contextGrabbers[m].hasOwnProperty(y))return;o(a)}}function h(a,y,m){return a=="openTag"?(m.tagStart=y.column(),T):a=="closeTag"?v:h}function T(a,y,m){return a=="word"?(m.tagName=y.current(),b="tag",E):G.allowMissingTagName&&a=="endTag"?(b="tag bracket",E(a,y,m)):(b="error",T)}function v(a,y,m){if(a=="word"){var x=y.current();return m.context&&m.context.tagName!=x&&G.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==x||G.matchClosing===!1?(b="tag",g):(b="tag error",L)}else return G.allowMissingTagName&&a=="endTag"?(b="tag bracket",g(a,y,m)):(b="error",L)}function g(a,y,m){return a!="endTag"?(b="error",g):(o(m),h)}function L(a,y,m){return b="error",g(a,y,m)}function E(a,y,m){if(a=="word")return b="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var x=m.tagName,B=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(x)?l(m,x):(l(m,x),m.context=new d(m,x,B==m.indented)),h}return b="error",E}function p(a,y,m){return a=="equals"?c:(G.allowMissing||(b="error"),E(a,y,m))}function c(a,y,m){return a=="string"?u:a=="word"&&G.allowUnquoted?(b="string",E):(b="error",E(a,y,m))}function u(a,y,m){return a=="string"?u:E(a,y,m)}return{startState:function(a){var y={tokenize:A,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(y.baseIndent=a),y},token:function(a,y){if(!y.tagName&&a.sol()&&(y.indented=a.indentation()),a.eatSpace())return null;_=null;var m=y.tokenize(a,y);return(m||_)&&m!="comment"&&(b=null,y.state=y.state(_||m,a,y),b&&(m=b=="error"?m+" error":b)),m},indent:function(a,y,m){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(x&&x.noIndent)return fe.Pass;if(a.tokenize!=I&&a.tokenize!=A)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var B=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(B&&B[1])for(;x;)if(x.tagName==B[2]){x=x.prev;break}else if(G.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(B)for(;x;){var W=G.contextGrabbers[x.tagName];if(W&&W.hasOwnProperty(B[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=E)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var y=[],m=a.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),fe.defineMIME("text/xml","xml"),fe.defineMIME("application/xml","xml"),fe.mimeModes.hasOwnProperty("text/html")||fe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(dt,Je,de){"use strict";de.d(Je,"a",function(){return l});var fe=de("Ty5D"),Z=de("dI71"),O=de("q1tI"),J=de.n(O),U=de("YS25"),R=de("17x9"),G=de.n(R),H=de("wx14"),M=de("zLVn"),_=de("9R94"),b=function(c){Object(Z.a)(u,c);function u(){for(var y,m=arguments.length,x=new Array(m),B=0;B<m;B++)x[B]=arguments[B];return y=c.call.apply(c,[this].concat(x))||this,y.history=Object(U.a)(y.props),y}var a=u.prototype;return a.render=function(){return J.a.createElement(fe.c,{history:this.history,children:this.props.children})},u}(J.a.Component),A=function(c){Object(Z.a)(u,c);function u(){for(var y,m=arguments.length,x=new Array(m),B=0;B<m;B++)x[B]=arguments[B];return y=c.call.apply(c,[this].concat(x))||this,y.history=Object(U.b)(y.props),y}var a=u.prototype;return a.render=function(){return J.a.createElement(fe.c,{history:this.history,children:this.props.children})},u}(J.a.Component),I=function(u,a){return typeof u=="function"?u(a):u},k=function(u,a){return typeof u=="string"?Object(U.c)(u,null,null,a):u},w=function(u){return u},C=J.a.forwardRef;typeof C=="undefined"&&(C=w);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=C(function(c,u){var a=c.innerRef,y=c.navigate,m=c.onClick,x=Object(M.a)(c,["innerRef","navigate","onClick"]),B=x.target,W=Object(H.a)({},x,{onClick:function(K){try{m&&m(K)}catch(P){throw K.preventDefault(),P}!K.defaultPrevented&&K.button===0&&(!B||B==="_self")&&!d(K)&&(K.preventDefault(),y())}});return w!==C?W.ref=u||a:W.ref=a,J.a.createElement("a",W)}),l=C(function(c,u){var a=c.component,y=a===void 0?o:a,m=c.replace,x=c.to,B=c.innerRef,W=Object(M.a)(c,["component","replace","to","innerRef"]);return J.a.createElement(fe.e.Consumer,null,function(V){V||Object(_.a)(!1);var K=V.history,P=k(I(x,V.location),V.location),N=P?K.createHref(P):"",$=Object(H.a)({},W,{href:N,navigate:function(){var ue=I(x,V.location),me=m?K.replace:K.push;me(ue)}});return w!==C?$.ref=u||B:$.innerRef=B,J.a.createElement(y,$)})});if(!1)var h,T;var v=function(u){return u},g=J.a.forwardRef;typeof g=="undefined"&&(g=v);function L(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(y){return y}).join(" ")}var E=g(function(c,u){var a=c["aria-current"],y=a===void 0?"page":a,m=c.activeClassName,x=m===void 0?"active":m,B=c.activeStyle,W=c.className,V=c.exact,K=c.isActive,P=c.location,N=c.sensitive,$=c.strict,ne=c.style,ue=c.to,me=c.innerRef,ke=Object(M.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return J.a.createElement(fe.e.Consumer,null,function(xe){xe||Object(_.a)(!1);var Re=P||xe.location,Se=k(I(ue,Re),Re),Te=Se.pathname,ye=Te&&Te.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),z=ye?Object(fe.f)(Re.pathname,{path:ye,exact:V,sensitive:N,strict:$}):null,s=!!(K?K(z,Re):z),f=s?L(W,x):W,D=s?Object(H.a)({},ne,{},B):ne,X=Object(H.a)({"aria-current":s&&y||null,className:f,style:D,to:Se},ke);return v!==g?X.ref=u||me:X.innerRef=me,J.a.createElement(l,X)})});if(!1)var p},"7Cbv":function(dt,Je,de){"use strict";var fe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function O(){if(!fe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fe(Z)}var J=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(I){return typeof I=="string"&&J.test(I)}for(var R=U,G=[],H=0;H<256;++H)G.push((H+256).toString(16).substr(1));function M(I){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(G[I[k+0]]+G[I[k+1]]+G[I[k+2]]+G[I[k+3]]+"-"+G[I[k+4]]+G[I[k+5]]+"-"+G[I[k+6]]+G[I[k+7]]+"-"+G[I[k+8]]+G[I[k+9]]+"-"+G[I[k+10]]+G[I[k+11]]+G[I[k+12]]+G[I[k+13]]+G[I[k+14]]+G[I[k+15]]).toLowerCase();if(!R(w))throw TypeError("Stringified UUID is invalid");return w}var _=M;function b(I,k,w){I=I||{};var C=I.random||(I.rng||O)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,k){w=w||0;for(var d=0;d<16;++d)k[w+d]=C[d];return k}return _(C)}var A=Je.a=b},"7ahc":function(dt,Je,de){"use strict";de.d(Je,"a",function(){return T});var fe=de("k1fw"),Z=de("0Owb"),O=de("+L6B"),J=de("2/Rp"),U=de("y8nQ"),R=de("Vl3Y"),G=de("tJVT"),H=de("OaEy"),M=de("2fM7"),_=de("q1tI"),b=de.n(_),A=de("VrN/"),I=de.n(A),k=de("p77/"),w=de.n(k),C=de("c5Ni"),d=de.n(C),o=M.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Je.b=function(v){var g=v.callback,L=v.onCancel,E=Object(_.useState)("python"),p=Object(G.a)(E,2),c=p[0],u=p[1];function a(m){u(h[m][1])}function y(m){g(m)}return b.a.createElement(R.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),b.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(M.a,{onChange:a},Object.keys(h).map(function(m){return b.a.createElement(o,{key:m,value:m},h[m][0])}))),b.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(T,{mode:c})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(J.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(J.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function T(v){var g=v.value,L=v.onChange,E=v.mode,p=v.options,c=p===void 0?{}:p,u=Object(_.useRef)(),a=Object(_.useState)(),y=Object(G.a)(a,2),m=y[0],x=y[1];return Object(_.useEffect)(function(){if(m){function B(W){var V=W.getValue();L&&L(V)}return m.on("change",B),function(){m.off("change",B)}}},[m,L]),Object(_.useEffect)(function(){m&&m.setOption("mode",E)},[m,E]),Object(_.useEffect)(function(){m&&((g!==m.getValue()||g==="")&&setTimeout(function(){m.setValue(g||" ")},300))},[m,g]),Object(_.useEffect)(function(){if(u.current&&!m){var B=I.a.fromTextArea(u.current,Object(fe.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));x(B)}},[u.current,m]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:u}))}},"8EBN":function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){"use strict";fe.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Z=0;Z<fe.modeInfo.length;Z++){var O=fe.modeInfo[Z];O.mimes&&(O.mime=O.mimes[0])}fe.findModeByMIME=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var R=fe.modeInfo[U];if(R.mime==J)return R;if(R.mimes){for(var G=0;G<R.mimes.length;G++)if(R.mimes[G]==J)return R}}if(/\+xml$/.test(J))return fe.findModeByMIME("application/xml");if(/\+json$/.test(J))return fe.findModeByMIME("application/json")},fe.findModeByExtension=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var R=fe.modeInfo[U];if(R.ext){for(var G=0;G<R.ext.length;G++)if(R.ext[G]==J)return R}}},fe.findModeByFileName=function(J){for(var U=0;U<fe.modeInfo.length;U++){var R=fe.modeInfo[U];if(R.file&&R.file.test(J))return R}var G=J.lastIndexOf("."),H=G>-1&&J.substring(G+1,J.length);if(H)return fe.findModeByExtension(H)},fe.findModeByName=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var R=fe.modeInfo[U];if(R.name.toLowerCase()==J)return R;if(R.alias){for(var G=0;G<R.alias.length;G++)if(R.alias[G].toLowerCase()==J)return R}}}})},"8hTe":function(dt,Je,de){dt.exports={button:"button___1wy9m"}},"9Bee":function(dt,Je,de){"use strict";var fe=de("DYRE"),Z=de("zeV3"),O=de("+L6B"),J=de("2/Rp"),U=de("k1fw"),R=de("9og8"),G=de("tJVT"),H=de("WmNS"),M=de.n(H),_=de("q1tI"),b=de.n(_),A=de("vg9a"),I=de("DlQD"),k=de.n(I),w=de("rUJ1");function C(se,ee){var q=se.match(/^(\s+)(?:```)/);if(q===null)return ee;var ae=q[1];return ee.split(`
|
|
`).map(function(le){var te=le.match(/^\s+/);if(te===null)return le;var ie=Object(G.a)(te,1),he=ie[0];return he.length>=ae.length?le.slice(ae.length):le}).join(`
|
|
`)}var d=[],o=["<ul>"],l=new k.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){d.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(se,ee,q,ae){if(ee>=se.length||se[ee].level<=q)return ee;var le=se[ee];ae.push("<li><a href='#"+le.anchor+"'>"+le.text+"</a>"),ee++;var te=[];return ee=g(se,ee,le.level,te),te.length>0&&(ae.push("<ul>"),te.forEach(function(ie){ae.push(ie)}),ae.push("</ul>")),ae.push("</li>"),ee=g(se,ee,q,ae),ee}function L(){return g(d,0,0,o),o.push("</ul>"),o.join("")}var E={heading:function(ee){var q=h.exec(ee);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences:function(ee){var q=this.rules.block.fences.exec(ee);if(q){var ae=q[0],le=C(ae,q[3]||""),te=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(te)>=0){var ie=u(),he=le;le=ie,a[ie]={type:"block",expression:he}}return{type:"code",raw:ae,lang:te,text:le}}}},p=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function y(){return a}function m(){c=0,a={}}function x(se){return se=se.replace(p,function(ee,q){var ae=u();return a[ae]={type:"inline",expression:q},ae}),se}var B=l.listitem;l.listitem=function(se){return B(x(se))};var W=l.paragraph;l.paragraph=function(se){return W(x(se))};var V=l.tablecell;l.tablecell=function(se,ee){return V(x(se),ee)},l.code=function(se,ee,q){var ae=(ee||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(se,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ee,'">').concat(q?se:Object(w.escape)(se,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(q?se:Object(w.escape)(se,!0))+"</code></pre>"},l.heading=function(se,ee,q){var ae=this.options.headerPrefix+q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ae,level:ee,text:se}),"<h"+ee+' id="'+ae+'">'+se+"</h"+ee+">"},k.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),k.a.use({tokenizer:E,renderer:l});var K=k.a,P=de("SJMd"),N=de("ulZh"),$=de.n(N),ne=de("m3rI"),ue=de("Oy/b"),me=de("p5ED"),ke=de("ErOA"),xe=de("STEk");/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Re=function(se,ee){return(Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(q,ae){q.__proto__=ae}||function(q,ae){for(var le in ae)Object.prototype.hasOwnProperty.call(ae,le)&&(q[le]=ae[le])})(se,ee)};function Se(se,ee){if(typeof ee!="function"&&ee!==null)throw new TypeError("Class extends value "+String(ee)+" is not a constructor or null");function q(){this.constructor=se}Re(se,ee),se.prototype=ee===null?Object.create(ee):(q.prototype=ee.prototype,new q)}function Te(se,ee,q,ae){return new(q||(q=Promise))(function(le,te){function ie(ve){try{ce(ae.next(ve))}catch(Ee){te(Ee)}}function he(ve){try{ce(ae.throw(ve))}catch(Ee){te(Ee)}}function ce(ve){var Ee;ve.done?le(ve.value):(Ee=ve.value,Ee instanceof q?Ee:new q(function(Me){Me(Ee)})).then(ie,he)}ce((ae=ae.apply(se,ee||[])).next())})}function ye(se,ee){var q,ae,le,te,ie={label:0,sent:function(){if(1&le[0])throw le[1];return le[1]},trys:[],ops:[]};return te={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function he(ce){return function(ve){return function(Ee){if(q)throw new TypeError("Generator is already executing.");for(;ie;)try{if(q=1,ae&&(le=2&Ee[0]?ae.return:Ee[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ee[1])).done)return le;switch(ae=0,le&&(Ee=[2&Ee[0],le.value]),Ee[0]){case 0:case 1:le=Ee;break;case 4:return ie.label++,{value:Ee[1],done:!1};case 5:ie.label++,ae=Ee[1],Ee=[0];continue;case 7:Ee=ie.ops.pop(),ie.trys.pop();continue;default:if(!(le=ie.trys,(le=le.length>0&&le[le.length-1])||Ee[0]!==6&&Ee[0]!==2)){ie=0;continue}if(Ee[0]===3&&(!le||Ee[1]>le[0]&&Ee[1]<le[3])){ie.label=Ee[1];break}if(Ee[0]===6&&ie.label<le[1]){ie.label=le[1],le=Ee;break}if(le&&ie.label<le[2]){ie.label=le[2],ie.ops.push(Ee);break}le[2]&&ie.ops.pop(),ie.trys.pop();continue}Ee=ee.call(se,ie)}catch(Me){Ee=[6,Me],ae=0}finally{q=le=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([ce,ve])}}}var z=function(){function se(){}return se.addKey=function(ee){se.key=ee},Object.defineProperty(se,"isLicensed",{get:function(){return!!se.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(se.key)},enumerable:!1,configurable:!0}),se}(),s=function(){function se(){}return se.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},se.setAttributes=function(ee,q){for(var ae=0,le=q;ae<le.length;ae++){var te=le[ae],ie=te[0],he=te[1];ee.setAttribute(ie,he)}},se.createRect=function(ee,q,ae){var le=document.createElementNS("http://www.w3.org/2000/svg","rect");return le.setAttribute("width",ee.toString()),le.setAttribute("height",q.toString()),ae&&se.setAttributes(le,ae),le},se.createLine=function(ee,q,ae,le,te){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",ee.toString()),ie.setAttribute("y1",q.toString()),ie.setAttribute("x2",ae.toString()),ie.setAttribute("y2",le.toString()),te&&se.setAttributes(ie,te),ie},se.createPolygon=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",ee),q&&se.setAttributes(ae,q),ae},se.createCircle=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(ee/2).toString()),ae.setAttribute("cy",(ee/2).toString()),ae.setAttribute("r",ee.toString()),q&&se.setAttributes(ae,q),ae},se.createEllipse=function(ee,q,ae){var le=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return le.setAttribute("cx",(ee/2).toString()),le.setAttribute("cy",(q/2).toString()),le.setAttribute("rx",(ee/2).toString()),le.setAttribute("ry",(q/2).toString()),ae&&se.setAttributes(le,ae),le},se.createGroup=function(ee){var q=document.createElementNS("http://www.w3.org/2000/svg","g");return ee&&se.setAttributes(q,ee),q},se.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},se.createMarker=function(ee,q,ae,le,te,ie,he){var ce=document.createElementNS("http://www.w3.org/2000/svg","marker");return se.setAttributes(ce,[["id",ee],["orient",q],["markerWidth",ae.toString()],["markerHeight",le.toString()],["refX",te.toString()],["refY",ie.toString()]]),ce.appendChild(he),ce},se.createText=function(ee){var q=document.createElementNS("http://www.w3.org/2000/svg","text");return q.setAttribute("x","0"),q.setAttribute("y","0"),ee&&se.setAttributes(q,ee),q},se.createTSpan=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=ee,q&&se.setAttributes(ae,q),ae},se.createImage=function(ee){var q=document.createElementNS("http://www.w3.org/2000/svg","image");return ee&&se.setAttributes(q,ee),q},se.createPoint=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=ee,ae.y=q,ae},se.createPath=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",ee),q&&se.setAttributes(ae,q),ae},se.createElement=function(ee,q){var ae=document.createElementNS("http://www.w3.org/2000/svg",ee);return q&&se.setAttributes(ae,q),ae},se.getHollowRectanglePath=function(ee,q,ae,le,te,ie,he,ce){return"M"+ee+","+q+"V"+(q+le)+"H"+(ee+ae)+"V"+q+"H"+te+"V"+ie+"H"+(te+he)+"V"+(ie+ce)+"H"+te+"V"+q+"Z"},se}(),f=function(){function se(ee){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+ee+"_"}return Object.defineProperty(se.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(se.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(se.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),se.prototype.addClass=function(ee){return this.styleSheet===void 0&&this.addStyleSheet(),ee.name=""+this.classNamePrefix+ee.localName,this.classes.push(ee),this.styleSheet.sheet.insertRule("."+ee.name+" {"+ee.style+"}",this.styleSheet.sheet.cssRules.length),ee},se.prototype.addRule=function(ee){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(ee),this.styleSheet.sheet.insertRule(ee.selector+" {"+ee.style+"}",this.styleSheet.sheet.cssRules.length)},se.prototype.addStyleSheet=function(){var ee;this.styleSheet=document.createElement("style"),((ee=this.styleSheetRoot)!==null&&ee!==void 0?ee:document.head).appendChild(this.styleSheet),this.addRule(new D("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new D("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new D("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new X("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new X("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},se.prototype.removeStyleSheet=function(){var ee;this.styleSheet&&(((ee=this.styleSheetRoot)!==null&&ee!==void 0?ee:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},se}(),D=function(se,ee){this.selector=se,this.style=ee},X=function(se,ee){this.localName=se,this.style=ee},F=function(){function se(){this.blocks=[],this.display=""}return se.prototype.addButtonBlock=function(ee){ee.className=this.blockClassName,ee.buttonClassName=this.buttonClassName,ee.buttonColorsClassName=this.buttonColorsClassName,ee.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(ee)},se.prototype.addElementBlock=function(ee){ee.className===void 0&&(ee.className=this.blockClassName),this.blocks.push(ee)},se.prototype.getUI=function(){var ee=document.createElement("div");return ee.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,ee.style.display=this.display,this.blocks.forEach(function(q){return ee.appendChild(q.getUI())}),ee},se}(),oe=function(){function se(){}return se.prototype.getUI=function(){var ee=document.createElement("div");if(ee.className=this.className,this.minWidth!==void 0&&(ee.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":ee.style.justifyContent="flex-start";break;case"center":ee.style.justifyContent="center";break;case"end":ee.style.justifyContent="flex-end"}return ee.style.whiteSpace="nowrap",ee},se}(),be=function(se){function ee(){var q=se!==null&&se.apply(this,arguments)||this;return q.buttons=[],q}return Se(ee,se),ee.prototype.addButton=function(q){q.className=this.buttonClassName,q.colorsClassName=this.buttonColorsClassName,q.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(q)},ee.prototype.getUI=function(){var q=se.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return q.appendChild(ae.getUI())}),q},ee}(oe),we=function(){function se(ee,q){this._isActive=!1,this._isHidden=!1,this._icon=ee,this.title=q,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(se.prototype,"icon",{get:function(){return this._icon},set:function(ee){this._icon=ee,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isActive",{get:function(){return this._isActive},set:function(ee){this._isActive=ee,this.adjustClassName()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){var ee=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 ee.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},se.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,"")))},se.prototype.hide=function(){this._isHidden=!0},se}(),Oe=function(se){function ee(){var q=se!==null&&se.apply(this,arguments)||this;return q.elements=[],q}return Se(ee,se),ee.prototype.addElement=function(q){this.elements.push(q)},ee.prototype.getUI=function(){var q=se.prototype.getUI.call(this);return this.elements.forEach(function(ae){return q.appendChild(ae)}),q},ee}(oe),Le=function(){function se(ee,q){this.horizontal=ee,this.vertical=q}return Object.defineProperty(se.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),se.prototype.getVerticalLength=function(ee){return ee/this.ratio},se.prototype.getHorizontalLength=function(ee){return ee*this.ratio},se}(),De=function(){function se(){}return se.getIcon=function(ee,q){if(ee>0&&q>0){var ae=new Le(ee,q),le=ae.ratio>=1?20:ae.getHorizontalLength(20),te=ae.ratio<1?20:ae.getVerticalLength(20),ie=document.createElementNS("http://www.w3.org/2000/svg","svg");ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),ie.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ie);var he=s.createDefs();ie.appendChild(he);var ce=s.createElement("clipPath",[["id","text-bg-clip"]]);he.appendChild(ce);var ve=s.createPath(s.getHollowRectanglePath((24-le)/2,(24-te)/2,le,te,(24-le)/2+2,(24-te)/2+2,le-4,te-4));ie.appendChild(ve);var Ee=s.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(s.createTSpan(ee+":"+q)),ie.appendChild(Ee);var Me=Ee.getBBox();s.setAttributes(Ee,[["x",((24-Me.width)/2).toString()],["y",((24-Me.height)/2-Me.y).toString()]]);var We=s.createPath(s.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Me.width))/2,(24-Math.ceil(Me.height))/2,Math.ceil(Me.width),Math.ceil(Me.height)));return ce.appendChild(We),s.setAttributes(ve,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ie),ie.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},se}(),_e=function(se){function ee(q,ae,le){var te=se.call(this,q,ae)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=le,te}return Se(ee,se),ee.prototype.setupDropdown=function(){var q=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=q.className,ae.colorsClassName=q.colorsClassName,q.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},ee.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},ee.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},ee.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},ee.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},ee.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},ee}(we),Ne=function(){function se(ee,q){this.GRIP_SIZE=10,this.color=ee,this.fillColor=q,this.visual=s.createGroup(),this.visual.appendChild(s.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(s.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return se.prototype.ownsTarget=function(ee){return ee===this.visual||ee===this.visual.childNodes[0]||ee===this.visual.childNodes[1]},se.prototype.setCenter=function(ee,q){this.visual.childNodes.forEach(function(ae){return s.setAttributes(ae,[["cx",ee.toString()],["cy",q.toString()]])})},se}(),Ge=function(){function se(ee,q,ae,le){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=ee,this.canvasHeight=q,this.margin=ae,this.container=le,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(se.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(ee){this._aspectRatio=ee,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(ee){this._isGridVisible=ee,this.gridContainer&&s.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(ee){this._zoomFactor=ee,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),se.prototype.open=function(){var ee=this;this.cropShadeElement=s.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=s.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var q=0;q<this.numberOfGridLines;q++)this.horizontalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return ee.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return ee.gridContainer.appendChild(ae)}),this.cropRectElement=s.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ne(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},se.prototype.setCropRectangle=function(ee){this.cropRect=ee;var q=Object.assign({},this.cropRect);this.zoomFactor!==1&&(q.width=this.cropRect.width*this.zoomFactor,q.height=this.cropRect.height*this.zoomFactor,q.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-q.width/2,q.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-q.height/2),s.setAttributes(this.cropRectElement,[["x",q.x.toString()],["y",q.y.toString()],["width",q.width.toString()],["height",q.height.toString()]]);var ae=q.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ie){var he=q.y+ae*(ie+1);s.setAttributes(te,[["x1",""+q.x],["y1",""+he],["x2",""+(q.x+q.width)],["y2",""+he]])});var le=q.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ie){var he=q.x+le*(ie+1);s.setAttributes(te,[["x1",""+he],["y1",""+q.y],["x2",""+he],["y2",""+(q.y+q.height)]])}),s.setAttributes(this.cropShadeElement,[["d",s.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,q.x,q.y,q.width,q.height)]]),this.topLeftGrip.setCenter(q.x,q.y),this.topRightGrip.setCenter(q.x+q.width,q.y),this.bottomLeftGrip.setCenter(q.x,q.y+q.height),this.bottomRightGrip.setCenter(q.x+q.width,q.y+q.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},se.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)},se.prototype.clientToLocalCoordinates=function(ee,q){var ae=this.container.getBoundingClientRect();return{x:ee-ae.left+this.margin,y:q-ae.top+this.margin}},se.prototype.onPointerDown=function(ee){this.container.setPointerCapture(ee.pointerId),this.previousPoint=this.clientToLocalCoordinates(ee.clientX,ee.clientY),this.cropRectElement===ee.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(ee.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(ee.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(ee.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(ee.target)&&(this.activeGrip=this.bottomRightGrip)},se.prototype.onPointerMove=function(ee){if(this.isMoving)this.move(this.clientToLocalCoordinates(ee.clientX,ee.clientY));else if(this.activeGrip){var q=this.clientToLocalCoordinates(ee.clientX,ee.clientY);this.resize(q)}ee.preventDefault()},se.prototype.onPointerUp=function(ee){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(ee.pointerId)},se.prototype.move=function(ee){var q=ee.x-this.previousPoint.x,ae=ee.y-this.previousPoint.y;this.zoomFactor!==1&&(q=-q/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+q),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=ee},se.prototype.resize=function(ee){var q=Object.assign({},this.cropRect),ae=ee.x-this.previousPoint.x,le=ee.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:q.x+ae<this.margin&&(ae=this.margin-q.x),q.x+=ae,q.width=this.cropRect.x+this.cropRect.width-q.x;break;case this.bottomRightGrip:case this.topRightGrip:q.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-q.width),q.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(q.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),q.height=this.aspectRatio.getVerticalLength(q.width)):(q.y+=le,q.height=this.cropRect.y+this.cropRect.height-q.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?q.height=this.aspectRatio.getVerticalLength(q.width):q.height+=le}q.width<10&&(q.x=this.cropRect.x,q.width=10),q.height<10&&(q.y=this.cropRect.y,q.height=10),this.previousPoint=ee,q.x>=this.margin&&q.y>=this.margin&&q.x-this.margin+q.width<=this.canvasWidth&&q.y-this.margin+q.height<=this.canvasHeight&&(this.cropRect=q,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},se.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var ee=this.cropRect.x+this.cropRect.width/2,q=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<le/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=le,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=ee-this.cropRect.width/2,this.cropRect.y=q-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)}},se.prototype.getRescaledRect=function(ee,q,ae,le,te,ie){var he=ae/ee,ce=le/q;return{x:(te.x-ie)*he+ie,y:(te.y-ie)*ce+ie,width:te.width*he,height:te.height*ce}},se.prototype.scaleCanvas=function(ee,q){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,ee,q,this.cropRect,this.margin);this.canvasWidth=ee,this.canvasHeight=q,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},se}(),He=function(){function se(ee){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=ee,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(se.prototype,"angle",{get:function(){return this._angle},set:function(ee){this._angle=ee,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),se.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},se.prototype.onPointerDown=function(ee){this.controlContainer.setPointerCapture(ee.pointerId),this.isDragging=!0,this.previousPoint={x:ee.clientX,y:ee.clientY}},se.prototype.onPointerMove=function(ee){this.isDragging&&(this.onAngleChange&&this.onAngleChange((ee.clientX-this.previousPoint.x)/5),this.previousPoint.x=ee.clientX)},se.prototype.onPointerUp=function(ee){this.isDragging&&this.onAngleChange&&this.onAngleChange((ee.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(ee.pointerId)},se.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var ee=this.angleLabelText.getBBox();s.setAttributes(this.angleLabelElement,[["x",((this.width-ee.width)/2).toString()],["y",(this.height/2).toString()]])}},se.prototype.positionScaleShape=function(){if(this.scaleShape){var ee=this.scaleShape.transform.baseVal.getItem(0);ee.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(ee,0)}},se.prototype.getVisual=function(){var ee=document.createElementNS("http://www.w3.org/2000/svg","svg");ee.setAttribute("xmlns","http://www.w3.org/2000/svg"),ee.setAttribute("width",this.width+"px"),ee.setAttribute("height",this.height+"px"),ee.setAttribute("viewBox","0 0 "+this.width+" "+this.height),ee.style.flexShrink="0",document.body.appendChild(ee);for(var q="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var le=ae%5==0?this.height/3:this.height/6;q+="h4v"+-le+"h1v"+le}q+="v1H0Z",this.scaleShape=s.createPath(q);var te=s.createTransform();this.scaleShape.transform.baseVal.appendItem(te),ee.appendChild(this.scaleShape),this.angleLabelElement=s.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=s.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ie=s.createTSpan("");return ie.innerHTML="°",this.angleLabelElement.appendChild(ie),ee.appendChild(this.angleLabelElement),document.body.removeChild(ee),ee},se}(),ze=function(){function se(){this.naturalSize=!1,this.imageType="image/png"}return se.prototype.rasterize=function(ee,q,ae,le,te,ie,he){var ce=this;return new Promise(function(ve){var Ee=document.createElement("canvas");Ee.width=ee.width.baseVal.value-2*le,Ee.height=ee.height.baseVal.value-2*le;var Me=1,We=1;ce.naturalSize===!0?(Me=q.naturalWidth/(ee.width.baseVal.value-2*le)/ie,We=q.naturalHeight/(ee.height.baseVal.value-2*le)/he,Ee.width=q.naturalWidth/ie,Ee.height=q.naturalHeight/he):ce.width!==void 0&&ce.height!==void 0&&(Me=ce.width/ae.width,We=ce.height/ae.height,Ee.width*=Me,Ee.height*=We);var qe=Ee.getContext("2d");qe.translate(Ee.width/2,Ee.height/2),qe.rotate(te*Math.PI/180),qe.scale(ie,he),qe.translate(-Ee.width/2,-Ee.height/2),qe.drawImage(q,0,0,Ee.width,Ee.height);var tt=document.createElement("canvas");tt.width=ae.width*Me,tt.height=ae.height*We,tt.getContext("2d").putImageData(qe.getImageData((ae.x-le)*Me,(ae.y-le)*We,ae.width*Me,ae.height*We),0,0),ve(tt.toDataURL(ce.imageType,ce.imageQuality))})},se}(),nt=function(){function se(ee){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=se.instanceCounter++,this.styles=new f(this.instanceNo),this.target=ee,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(se.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(ee){this._zoomToCropEnabled=ee,ee?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(ee){this._isGridVisible=ee,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"gridLines",{get:function(){return this._gridLines},set:function(ee){this._gridLines=ee,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(ee){this._rotationAngle=ee,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"aspectRatio",{get:function(){var ee;return(ee=this._aspectRatio)!==null&&ee!==void 0?ee:this.aspectRatios[0]},set:function(ee){this._aspectRatio=ee},enumerable:!1,configurable:!0}),se.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},se.prototype.show=function(){this.showUI(),this.open()},se.prototype.close=function(ee){ee===void 0&&(ee=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),ee||this.closeEventListeners.forEach(function(q){return q()}),this._isOpen=!1)},se.prototype.addRenderEventListener=function(ee){this.renderEventListeners.push(ee)},se.prototype.removeRenderEventListener=function(ee){this.renderEventListeners.indexOf(ee)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(ee),1)},se.prototype.addCloseEventListener=function(ee){this.closeEventListeners.push(ee)},se.prototype.removeCloseEventListener=function(ee){this.closeEventListeners.indexOf(ee)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(ee),1)},se.prototype.setupResizeObserver=function(){var ee=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){ee.resize(ee.target.clientWidth,ee.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))},se.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var ee=1*this.target.clientWidth/this.target.clientHeight,q=this.contentDiv.clientWidth/ee>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*ee:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=q+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/ee;this.resize(q,ae)}},se.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},se.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",s.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},se.prototype.resize=function(ee,q){this.imageWidth=Math.round(ee),this.imageHeight=Math.round(q),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()},se.prototype.setEditingTarget=function(){var ee=document.createElement("canvas");ee.width=this.target.naturalWidth,ee.height=this.target.naturalHeight,ee.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var q=ee.toDataURL();s.setAttributes(this.editingTarget,[["href",q]]),this.setEditingTargetSize()},se.prototype.setTopLeft=function(){var ee=this.target.getBoundingClientRect(),q=this.editorCanvas.getBoundingClientRect();this.left=ee.left-q.left-this.CANVAS_MARGIN,this.top=ee.top-q.top-this.CANVAS_MARGIN},se.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=s.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=s.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=s.createGroup(),this.editingTargetRotationScaleContainer=s.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var ee=s.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(ee);var q=s.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(q),this.editingTargetContainer=s.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},se.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},se.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=s.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ge(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},se.prototype.zoomToCrop=function(){if(this.cropRect){var ee=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,q=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=ee+"px "+q+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-ee+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-q+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},se.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)},se.prototype.cropRectChanged=function(ee){this.cropRect=ee,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},se.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},se.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"},se.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},se.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 ee=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,q=this.target.offsetTop>ee+this.CANVAS_MARGIN?this.target.offsetTop-(ee+this.CANVAS_MARGIN):0;this.coverDiv.style.top=q+"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},se.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},se.prototype.addTopToolbar=function(){var ee=this;this.topToolbar=new F,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 q=new be;q.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(q);var ae=[];this.aspectRatios.forEach(function(We){var qe=new we(De.getIcon(We.horizontal,We.vertical),We.horizontal===0&&We.vertical===0?"FREE":We.horizontal+":"+We.vertical);qe.onClick=function(){return ee.ratioButtonClicked(We)},ae.push(qe)}),this.aspectRatioButton=new _e(De.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,q.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var le=new we('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");le.isActive=this.isGridVisible,le.onClick=function(){ee.isGridVisible=!ee.isGridVisible,le.isActive=ee.isGridVisible},q.addButton(le);var te=new we('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(te.isActive=this.zoomToCropEnabled,te.onClick=function(){ee.zoomToCropEnabled=!ee.zoomToCropEnabled,te.isActive=ee.zoomToCropEnabled},q.addButton(te),!z.isLicensed){var ie=new Oe;this.topToolbar.addElementBlock(ie);var he=document.createElement("div");he.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ce=document.createElement("a");ce.style.color="currentColor",ce.href="https://markerjs.com/products/cropro",ce.target="_blank",ce.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',he.appendChild(ce),ie.addElement(he)}var ve=new be;ve.minWidth=3*this.toolbarHeight+"px",ve.contentAlign="end",this.topToolbar.addButtonBlock(ve);var Ee=new we('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ee.onClick=this.startRenderAndClose,ve.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Me=new we('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Me.onClick=this.close,ve.addButton(Me),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},se.prototype.addBottomToolbar=function(){var ee=this;this.bottomToolbar=new F,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 q=new be;q.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(q);var ae=new we('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");ae.onClick=this.rotateLeftButtonClicked,q.addButton(ae);var le=new we('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");le.onClick=this.rotateRightButtonClicked,q.addButton(le);var te=new Oe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new He("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ve){ee.rotateBy(ve),ee.straightener.angle=ee.rotationAngle},te.addElement(this.straightener.getUI());var ie=new be;ie.minWidth=2*this.toolbarHeight+"px",ie.contentAlign="end",this.bottomToolbar.addButtonBlock(ie);var he=new we('<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,ie.addButton(he);var ce=new we('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");ce.onClick=this.flipVerticallyButtonClicked,ie.addButton(ce)},se.prototype.ratioButtonClicked=function(ee){this.aspectRatio=ee,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},se.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=De.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},se.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Le(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},se.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},se.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},se.prototype.restoreState=function(ee){if(ee){var q=this.cropLayer.getRescaledRect(ee.width,ee.height,this.imageWidth,this.imageHeight,ee.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(q),this.cropRectChanged(q),this.flippedHorizontally=ee.flippedHorizontally,this.flippedVertically=ee.flippedVertically,this.applyFlip(),this.rotationAngle=ee.rotationAngle,this.applyRotation()}},se.prototype.clientToLocalCoordinates=function(ee,q){var ae=this.cropImage.getBoundingClientRect();return{x:ee-ae.left,y:q-ae.top}},se.prototype.onWindowResize=function(){this.positionUI()},se.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var ee=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=ee+"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()},se.prototype.rotateLeftButtonClicked=function(){var ee=this.rotationAngle-90;this.rotationAngle%90!=0&&(ee+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(ee)},se.prototype.rotateRightButtonClicked=function(){var ee=this.rotationAngle+90;this.rotationAngle%90!=0&&(ee-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(ee)},se.prototype.rotateTo=function(ee){ee=(ee=ee>180?ee-360:ee)<=-180?ee+360:ee,this.rotationAngle=ee,this.applyRotation()},se.prototype.rotateBy=function(ee){this.rotateTo((this.rotationAngle+ee)%360)},se.prototype.applyRotation=function(){var ee=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var q=this.editingTargetRotationContainer.transform.baseVal.getItem(0);q.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(q,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=ee},se.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},se.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},se.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},se.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var ee,q;return ye(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return ee=ae.sent(),q=this.getState(),this.renderEventListeners.forEach(function(le){return le(ee,q)}),this.close(!0),[2]}})})},se.prototype.render=function(){return Te(this,void 0,void 0,function(){var ee;return ye(this,function(q){switch(q.label){case 0:return(ee=new ze).naturalSize=this.renderAtNaturalSize,ee.imageType=this.renderImageType,ee.imageQuality=this.renderImageQuality,ee.width=this.renderWidth,ee.height=this.renderHeight,this.unzoomFromCrop(),s.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,ee.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 q.sent(),[4,ee.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,q.sent()]}})})},se.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new X("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 X("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new X("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var ee=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new X("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*ee)+`px;
|
|
height: `+(this.toolbarHeight-2*ee)+`px;
|
|
padding: `+ee+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new X("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new D("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new D("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new X("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 X("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new X("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 X("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*ee)+`px;
|
|
padding: `+ee+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new X("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},se.instanceCounter=0,se}(),Ye=de("8hTe"),Xe=de.n(Ye),Pe=/<pre[^>]*>/g;function rt(se){var ee=document.createElement("div");return ee.innerHTML=se,ee.childNodes.length===0?"":ee.childNodes[0].nodeValue}var Qe=Je.a=function(se){var ee=se.value,q=ee===void 0?"":ee,ae=se.edit,le=ae===void 0?!1:ae,te=se.className,ie=se.showTextOnly,he=se.showLines,ce=se.replaces,ve=se.zoomImg,Ee=se.hasMask,Me=se.style,We=Me===void 0?{}:Me,qe=se.stylesPrev,tt=qe===void 0?{}:qe,vt=String(q),ot=Object(_.useRef)(),it=Object(_.useRef)(),wt=Object(_.useState)(""),xt=Object(G.a)(wt,2),It=xt[0],_t=xt[1],Et=Object(_.useState)("office"),mr=Object(G.a)(Et,2),Tr=mr[0],Yt=mr[1],gr=function(){var Tt=new nt(it.current);Tt.displayMode="popup",Tt.addRenderEventListener(function(){var Zt=Object(R.a)(M.a.mark(function mt(pt){var At;return M.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return ot.current.style.display="none",Ut.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt}});case 3:At=Ut.sent,At!=null&&At.id&&ce(it.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 5:case"end":return Ut.stop()}},mt)}));return function(mt){return Zt.apply(this,arguments)}}()),Tt.show()},cr=function(){var Tt=new xe.a(it.current);Tt.settings.displayMode="popup",Tt.addEventListener("render",function(){var Zt=Object(R.a)(M.a.mark(function mt(pt){var At;return M.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(ot.current.style.display="none",!it.current){Ut.next=6;break}return Ut.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt.dataUrl}});case 4:At=Ut.sent,At!=null&&At.id&&ce(it.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 6:case"end":return Ut.stop()}},mt)}));return function(mt){return Zt.apply(this,arguments)}}()),Tt.show(),window.markerArea=Tt},zr=Object(_.useMemo)(function(){ot.current&&(ot.current.style.zIndex=-1);try{var $e=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Tt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Zt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;vt=vt.replace($e,"("+ne.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+ne.a.API_SERVER+"/api/attachments/").replace(Zt,'"'+ne.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(vr){}var mt=K(vt),pt=y();if(vt.match(/\[TOC\]/)&&(mt=mt.replace("<p>[TOC]</p>",L()),T()),mt=mt.replace(/(__special_katext_id_\d+__)/g,function(vr,Ut){var Be=pt[Ut],ht=Be.type,ri=Be.expression;return Object(ue.renderToString)(rt(ri)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),mt=mt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ie){var At=document.createElement("div");return At.innerHTML=mt,At.innerText}return setTimeout(function(){return ti()},500),mt},[vt]),$t=Object(_.useRef)();v.WebkitLineClamp=he,he&&(We=Object(U.a)(Object(U.a)({},We),v));function Nr($e){var Tt=$e.target;if(Tt.tagName.toUpperCase()==="IMG"){if(ve){var Zt=Tt.getAttribute("src");_t(Zt),Yt("image")}}else if(Tt.tagName.toUpperCase()==="A"){var mt=Tt.getAttribute("href");if(mt.indexOf("office")>-1)$e.preventDefault(),_t(mt),Yt("office");else if(mt.indexOf("application/pdf")>-1)$e.preventDefault(),_t(mt),Yt("pdf");else if(mt.indexOf("text/html")>-1)$e.preventDefault(),_t(mt),Yt("html");else if(mt.startsWith("#")){$e.preventDefault();var pt=document.getElementById(mt.replace("#",""));pt&&pt.scrollIntoView(!0)}}}var ti=function(){var Tt,Zt=(Tt=$t.current)===null||Tt===void 0?void 0:Tt.querySelectorAll("video");Zt==null||Zt.forEach(function(mt){if(mt.oncontextmenu=function(){return!1},mt.src.indexOf(".m3u8")>-1&&!mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var pt=new $.a;pt.loadSource(mt.src),pt.attachMedia(mt)}}})};Object(_.useEffect)(function(){if($t.current&&zr&&(zr.match(Pe)&&window.PR.prettyPrint()),$t.current)return $t.current.addEventListener("click",Nr),function(){$t.current.removeEventListener("click",Nr),m(),T()}},[zr,$t.current,Nr]);var Pt=function(Tt){if(!le)return;Tt.target.nodeName==="IMG"?(ot.current.style.zIndex=1,ot.current.style.display="flex",ot.current.style.width=Tt.target.clientWidth+"px",ot.current.style.height=Tt.target.clientHeight+"px",ot.current.style.top=Tt.target.offsetTop+"px",ot.current.style.left=Tt.target.offsetLeft+"px",it.current.src=Tt.target.getAttribute("src")):ot.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:$t,style:Object(U.a)({},We),className:"".concat(te||""," markdown-body ").concat(Xe.a.mdBody),onMouseOver:Pt,dangerouslySetInnerHTML:{__html:zr}}),b.a.createElement("div",{ref:ot,className:Xe.a.button},b.a.createElement(Z.a,null,b.a.createElement(J.a,{onClick:function(){return gr()}},"\u88C1\u526A"),b.a.createElement(J.a,{onClick:function(){return cr()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:it,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(me.a,{close:!0,data:It,type:It!=null&&It.length?Tr:"",style:Object(U.a)({},tt),onClose:function(){return _t("")}}))}},"9VGf":function(dt,Je,de){"use strict";de.d(Je,"a",function(){return O});var fe=de("q1tI"),Z=de.n(fe);function O(J,U){var R=Object(fe.useRef)();Object(fe.useEffect)(function(){R.current=J}),Object(fe.useEffect)(function(){function G(){R.current()}if(U!==null){var H=setInterval(G,U);return function(){return clearInterval(H)}}},[U])}},Bd2K:function(dt,Je,de){(function(fe){fe(de("VrN/"),de("osHv"))})(function(fe){fe.defineOption("autoCloseTags",!1,function(M,_,b){if(b!=fe.Init&&b&&M.removeKeyMap("autoCloseTags"),!_)return;var A={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(A["'/'"]=function(I){return R(I)}),(typeof _!="object"||_.whenOpening!==!1)&&(A["'>'"]=function(I){return J(I)}),M.addKeyMap(A)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function J(M){if(M.getOption("disableInput"))return fe.Pass;for(var _=M.listSelections(),b=[],A=M.getOption("autoCloseTags"),I=0;I<_.length;I++){if(!_[I].empty())return fe.Pass;var k=_[I].head,w=M.getTokenAt(k),C=fe.innerMode(M.getMode(),w.state),d=C.state,o=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return fe.Pass;var h=C.mode.configuration=="html",T=typeof A=="object"&&A.dontCloseTags||h&&Z,v=typeof A=="object"&&A.indentTags||h&&O;w.end>k.ch&&(l=l.slice(0,l.length-w.end+k.ch));var g=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=k.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==k.ch-w.start-1||T&&G(T,g)>-1||H(M,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(d)||[],l,k,!0))return fe.Pass;var L=typeof A=="object"&&A.emptyTags;if(L&&G(L,l)>-1){b[I]={text:"/>",newPos:fe.Pos(k.line,k.ch+2)};continue}var E=v&&G(v,g)>-1;b[I]={indent:E,text:">"+(E?`
|
|
|
|
`:"")+"</"+l+">",newPos:E?fe.Pos(k.line+1,0):fe.Pos(k.line,k.ch+1)}}for(var p=typeof A=="object"&&A.dontIndentOnAutoClose,I=_.length-1;I>=0;I--){var c=b[I];M.replaceRange(c.text,_[I].head,_[I].anchor,"+insert");var u=M.listSelections().slice(0);u[I]={head:c.newPos,anchor:c.newPos},M.setSelections(u),!p&&c.indent&&(M.indentLine(c.newPos.line,null,!0),M.indentLine(c.newPos.line+1,null,!0))}}function U(M,_){for(var b=M.listSelections(),A=[],I=_?"/":"</",k=M.getOption("autoCloseTags"),w=typeof k=="object"&&k.dontIndentOnSlash,C=0;C<b.length;C++){if(!b[C].empty())return fe.Pass;var d=b[C].head,o=M.getTokenAt(d),l=fe.innerMode(M.getMode(),o.state),h=l.state;if(_&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return fe.Pass;var T,v=l.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")T=I+"script";else if(v&&l.mode.name=="css")T=I+"style";else{var g=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!g||g.length&&H(M,g,g[g.length-1],d))return fe.Pass;T=I+g[g.length-1]}M.getLine(d.line).charAt(o.end)!=">"&&(T+=">"),A[C]=T}if(M.replaceSelections(A),b=M.listSelections(),!w)for(var C=0;C<b.length;C++)(C==b.length-1||b[C].head.line<b[C+1].head.line)&&M.indentLine(b[C].head.line)}function R(M){return M.getOption("disableInput")?fe.Pass:U(M,!0)}fe.commands.closeTag=function(M){return U(M)};function G(M,_){if(M.indexOf)return M.indexOf(_);for(var b=0,A=M.length;b<A;++b)if(M[b]==_)return b;return-1}function H(M,_,b,A,I){if(!fe.scanForClosingTag)return!1;var k=Math.min(M.lastLine()+1,A.line+500),w=fe.scanForClosingTag(M,A,null,k);if(!w||w.tag!=b)return!1;for(var C=I?1:0,d=_.length-1;d>=0&&_[d]==b;d--)++C;A=w.to;for(var d=1;d<C;d++){var o=fe.scanForClosingTag(M,A,null,k);if(!o||o.tag!=b)return!1;A=o.to}return!0}})},BjJ7:function(dt,Je,de){"use strict";de.d(Je,"d",function(){return Z}),de.d(Je,"c",function(){return O}),de.d(Je,"e",function(){return J}),de.d(Je,"b",function(){return U}),de.d(Je,"a",function(){return G});var fe=de("m3rI");function Z(H){var M=!0;if(H.length>0){for(var _=0;_<H.length;_++)if(H[_].compile_success==0||!H[_].compile_success){M=!1;break}}else M=!1;return M}function O(H){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],b=0;b<H.length;b++){var A=H[b],I=M?"".concat(M,"/").concat(A.name):"".concat(A.name);_.push({title:A.name,isLeaf:!(A.type==="tree"),key:I})}return _}function J(H,M,_){for(var b=0;b<H.length;b++){var A=H[b];if(A.key===M){A.children=_;break}A.children&&J(A.children,M,_)}return H}function U(H,M,_){var b;return function(){var A=this,I=arguments,k=function(){b=null,_||H.apply(A,I)},w=_&&!b;clearTimeout(b),b=setTimeout(k,M),w&&H.apply(A,I)}}var R=!0,G=fe.a.API_SERVER},"C+DQ":function(dt,Je,de){},DlQD:function(dt,Je,de){(function(fe,Z){dt.exports=Z()})(this,function(){"use strict";function fe(q,ae){for(var le=0;le<ae.length;le++){var te=ae[le];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(q,te.key,te)}}function Z(q,ae,le){return ae&&fe(q.prototype,ae),le&&fe(q,le),q}function O(q,ae){if(!q)return;if(typeof q=="string")return J(q,ae);var le=Object.prototype.toString.call(q).slice(8,-1);if(le==="Object"&&q.constructor&&(le=q.constructor.name),le==="Map"||le==="Set")return Array.from(q);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return J(q,ae)}function J(q,ae){(ae==null||ae>q.length)&&(ae=q.length);for(var le=0,te=new Array(ae);le<ae;le++)te[le]=q[le];return te}function U(q,ae){var le;if(typeof Symbol=="undefined"||q[Symbol.iterator]==null){if(Array.isArray(q)||(le=O(q))||ae&&q&&typeof q.length=="number"){le&&(q=le);var te=0;return function(){return te>=q.length?{done:!0}:{done:!1,value:q[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return le=q[Symbol.iterator](),le.next.bind(le)}function R(q,ae){return ae={exports:{}},q(ae,ae.exports),ae.exports}var G=R(function(q){function ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function le(te){q.exports.defaults=te}q.exports={defaults:ae(),getDefaults:ae,changeDefaults:le}}),H=G.defaults,M=G.getDefaults,_=G.changeDefaults,b=/[&<>"']/,A=/[&<>"']/g,I=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},C=function(ae){return w[ae]};function d(q,ae){if(ae){if(b.test(q))return q.replace(A,C)}else if(I.test(q))return q.replace(k,C);return q}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(q){return q.replace(o,function(ae,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var h=/(^|[^\[])\^/g;function T(q,ae){q=q.source||q,ae=ae||"";var le={replace:function(ie,he){return he=he.source||he,he=he.replace(h,"$1"),q=q.replace(ie,he),le},getRegex:function(){return new RegExp(q,ae)}};return le}var v=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(q,ae,le){if(q){var te;try{te=decodeURIComponent(l(le)).replace(v,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ae&&!g.test(le)&&(le=a(ae,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ie){return null}return le}var E={},p=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(q,ae){E[" "+q]||(p.test(q)?E[" "+q]=q+"/":E[" "+q]=B(q,"/",!0)),q=E[" "+q];var le=q.indexOf(":")===-1;return ae.substring(0,2)==="//"?le?ae:q.replace(c,"$1")+ae:ae.charAt(0)==="/"?le?ae:q.replace(u,"$1")+ae:q+ae}var y={exec:function(){}};function m(q){for(var ae=1,le,te;ae<arguments.length;ae++){le=arguments[ae];for(te in le)Object.prototype.hasOwnProperty.call(le,te)&&(q[te]=le[te])}return q}function x(q,ae){var le=q.replace(/\|/g,function(he,ce,ve){for(var Ee=!1,Me=ce;--Me>=0&&ve[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=le.split(/ \|/),ie=0;if(te.length>ae)te.splice(ae);else for(;te.length<ae;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function B(q,ae,le){var te=q.length;if(te===0)return"";for(var ie=0;ie<te;){var he=q.charAt(te-ie-1);if(he===ae&&!le)ie++;else if(he!==ae&&le)ie++;else break}return q.substr(0,te-ie)}function W(q,ae){if(q.indexOf(ae[1])===-1)return-1;for(var le=q.length,te=0,ie=0;ie<le;ie++)if(q[ie]==="\\")ie++;else if(q[ie]===ae[0])te++;else if(q[ie]===ae[1]&&(te--,te<0))return ie;return-1}function V(q){q&&q.sanitize&&!q.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 K={escape:d,unescape:l,edit:T,cleanUrl:L,resolveUrl:a,noopTest:y,merge:m,splitCells:x,rtrim:B,findClosingBracket:W,checkSanitizeDeprecation:V},P=G.defaults,N=K.rtrim,$=K.splitCells,ne=K.escape,ue=K.findClosingBracket;function me(q,ae,le){var te=ae.href,ie=ae.title?ne(ae.title):null,he=q[1].replace(/\\([\[\]])/g,"$1");return q[0].charAt(0)!=="!"?{type:"link",raw:le,href:te,title:ie,text:he}:{type:"image",raw:le,href:te,title:ie,text:ne(he)}}function ke(q,ae){var le=q.match(/^(\s+)(?:```)/);if(le===null)return ae;var te=le[1];return ae.split(`
|
|
`).map(function(ie){var he=ie.match(/^\s+/);if(he===null)return ie;var ce=he[0];return ce.length>=te.length?ie.slice(te.length):ie}).join(`
|
|
`)}var xe=function(){function q(le){this.options=le||P}var ae=q.prototype;return ae.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},ae.code=function(te,ie){var he=this.rules.block.code.exec(te);if(he){var ce=ie[ie.length-1];if(ce&&ce.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var ve=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?ve:N(ve,`
|
|
`)}}},ae.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var he=ie[0],ce=ke(he,ie[3]||"");return{type:"code",raw:he,lang:ie[2]?ie[2].trim():ie[2],text:ce}}},ae.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ae.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var he={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ie[0]};if(he.header.length===he.align.length){var ce=he.align.length,ve;for(ve=0;ve<ce;ve++)/^ *-+: *$/.test(he.align[ve])?he.align[ve]="right":/^ *:-+: *$/.test(he.align[ve])?he.align[ve]="center":/^ *:-+ *$/.test(he.align[ve])?he.align[ve]="left":he.align[ve]=null;for(ce=he.cells.length,ve=0;ve<ce;ve++)he.cells[ve]=$(he.cells[ve],he.header.length);return he}}},ae.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},ae.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var he=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:he}}},ae.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var he=ie[0],ce=ie[2],ve=ce.length>1,Ee=ce[ce.length-1]===")",Me={type:"list",raw:he,ordered:ve,start:ve?+ce.slice(0,-1):"",loose:!1,items:[]},We=ie[0].match(this.rules.block.item),qe=!1,tt,vt,ot,it,wt,xt,It,_t=We.length,Et=0;Et<_t;Et++)tt=We[Et],he=tt,vt=tt.length,tt=tt.replace(/^ *([*+-]|\d+[.)]) */,""),~tt.indexOf(`
|
|
`)&&(vt-=tt.length,tt=this.options.pedantic?tt.replace(/^ {1,4}/gm,""):tt.replace(new RegExp("^ {1,"+vt+"}","gm"),"")),Et!==_t-1&&(ot=this.rules.block.bullet.exec(We[Et+1])[0],(ve?ot.length===1||!Ee&&ot[ot.length-1]===")":ot.length>1||this.options.smartLists&&ot!==ce)&&(it=We.slice(Et+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-it.length),Et=_t-1)),wt=qe||/\n\n(?!\s*$)/.test(tt),Et!==_t-1&&(qe=tt.charAt(tt.length-1)===`
|
|
`,wt||(wt=qe)),wt&&(Me.loose=!0),xt=/^\[[ xX]\] /.test(tt),It=void 0,xt&&(It=tt[1]!==" ",tt=tt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:he,task:xt,checked:It,loose:wt,text:tt});return Me}},ae.html=function(te){var ie=this.rules.block.html.exec(te);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ne(ie[0]):ie[0]}},ae.def=function(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var he=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ie[0],href:ie[2],title:ie[3]}}},ae.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var he={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(he.header.length===he.align.length){he.raw=ie[0];var ce=he.align.length,ve;for(ve=0;ve<ce;ve++)/^ *-+: *$/.test(he.align[ve])?he.align[ve]="right":/^ *:-+: *$/.test(he.align[ve])?he.align[ve]="center":/^ *:-+ *$/.test(he.align[ve])?he.align[ve]="left":he.align[ve]=null;for(ce=he.cells.length,ve=0;ve<ce;ve++)he.cells[ve]=$(he.cells[ve].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},ae.lheading=function(te){var ie=this.rules.block.lheading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ae.paragraph=function(te){var ie=this.rules.block.paragraph.exec(te);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
|
|
`?ie[1].slice(0,-1):ie[1]}},ae.text=function(te,ie){var he=this.rules.block.text.exec(te);if(he){var ce=ie[ie.length-1];return ce&&ce.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},ae.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ne(ie[1])}},ae.tag=function(te,ie,he){var ce=this.rules.inline.tag.exec(te);if(ce)return!ie&&/^<a /i.test(ce[0])?ie=!0:ie&&/^<\/a>/i.test(ce[0])&&(ie=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:ie,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]}},ae.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var he=ue(ie[2],"()");if(he>-1){var ce=ie[0].indexOf("!")===0?5:4,ve=ce+ie[1].length+he;ie[2]=ie[2].substring(0,he),ie[0]=ie[0].substring(0,ve).trim(),ie[3]=""}var Ee=ie[2],Me="";if(this.options.pedantic){var We=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);We?(Ee=We[1],Me=We[3]):Me=""}else Me=ie[3]?ie[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var qe=me(ie,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},ie[0]);return qe}},ae.reflink=function(te,ie){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var ce=(he[2]||he[1]).replace(/\s+/g," ");if(ce=ie[ce.toLowerCase()],!ce||!ce.href){var ve=he[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Ee=me(he,ce,he[0]);return Ee}},ae.strong=function(te,ie,he){he===void 0&&(he="");var ce=this.rules.inline.strong.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ie=ie.slice(-1*te.length);var ve=ce[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Ee;(ce=ve.exec(ie))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ie.slice(0,ce.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ae.em=function(te,ie,he){he===void 0&&(he="");var ce=this.rules.inline.em.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ie=ie.slice(-1*te.length);var ve=ce[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Ee;(ce=ve.exec(ie))!=null;)if(Ee=this.rules.inline.em.middle.exec(ie.slice(0,ce.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ae.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var he=ie[2].replace(/\n/g," "),ce=/[^ ]/.test(he),ve=he.startsWith(" ")&&he.endsWith(" ");return ce&&ve&&(he=he.substring(1,he.length-1)),he=ne(he,!0),{type:"codespan",raw:ie[0],text:he}}},ae.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},ae.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ae.autolink=function(te,ie){var he=this.rules.inline.autolink.exec(te);if(he){var ce,ve;return he[2]==="@"?(ce=ne(this.options.mangle?ie(he[1]):he[1]),ve="mailto:"+ce):(ce=ne(he[1]),ve=ce),{type:"link",raw:he[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},ae.url=function(te,ie){var he;if(he=this.rules.inline.url.exec(te)){var ce,ve;if(he[2]==="@")ce=ne(this.options.mangle?ie(he[0]):he[0]),ve="mailto:"+ce;else{var Ee;do Ee=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Ee!==he[0]);ce=ne(he[0]),he[1]==="www."?ve="http://"+ce:ve=ce}return{type:"link",raw:he[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},ae.inlineText=function(te,ie,he){var ce=this.rules.inline.text.exec(te);if(ce){var ve;return ie?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]:ve=ne(this.options.smartypants?he(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ve}}},q}(),Re=K.noopTest,Se=K.edit,Te=K.merge,ye={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Re,table:Re,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ye._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ye._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ye.def=Se(ye.def).replace("label",ye._label).replace("title",ye._title).getRegex(),ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,ye.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ye.item=Se(ye.item,"gm").replace(/bull/g,ye.bullet).getRegex(),ye.list=Se(ye.list).replace(/bull/g,ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ye.def.source+")").getRegex(),ye._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ye._comment=/<!--(?!-?>)[\s\S]*?-->/,ye.html=Se(ye.html,"i").replace("comment",ye._comment).replace("tag",ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye.paragraph=Se(ye._paragraph).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.blockquote=Se(ye.blockquote).replace("paragraph",ye.paragraph).getRegex(),ye.normal=Te({},ye),ye.gfm=Te({},ye.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ye.gfm.nptable=Se(ye.gfm.nptable).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.gfm.table=Se(ye.gfm.table).replace("hr",ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ye._tag).getRegex(),ye.pedantic=Te({},ye.normal,{html:Se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Re,paragraph:Se(ye.normal._paragraph).replace("hr",ye.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,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:Re,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",z.punctuation=Se(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=Se(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=Se(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=Se(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=Se(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=Se(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=Se(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=Se(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=Se(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=Se(z._blockSkip,"g").getRegex(),z.overlapSkip=Se(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,z.autolink=Se(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=Se(z.tag).replace("comment",ye._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=Se(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=Se(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=Se(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=Te({},z),z.pedantic=Te({},z.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=Te({},z.normal,{escape:Se(z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),z.gfm.url=Se(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=Te({},z.gfm,{br:Se(z.br).replace("{2,}","*").getRegex(),text:Se(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var s={block:ye,inline:z},f=G.defaults,D=s.block,X=s.inline;function F(q){return q.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 oe(q){var ae="",le,te,ie=q.length;for(le=0;le<ie;le++)te=q.charCodeAt(le),Math.random()>.5&&(te="x"+te.toString(16)),ae+="&#"+te+";";return ae}var be=function(){function q(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||f,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:D.normal,inline:X.normal};this.options.pedantic?(te.block=D.pedantic,te.inline=X.pedantic):this.options.gfm&&(te.block=D.gfm,this.options.breaks?te.inline=X.breaks:te.inline=X.gfm),this.tokenizer.rules=te}q.lex=function(te,ie){var he=new q(ie);return he.lex(te)};var ae=q.prototype;return ae.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(te,ie,he){ie===void 0&&(ie=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var ce,ve,Ee,Me;te;){if(ce=this.tokenizer.space(te)){te=te.substring(ce.raw.length),ce.type&&ie.push(ce);continue}if(ce=this.tokenizer.code(te,ie)){te=te.substring(ce.raw.length),ce.type?ie.push(ce):(Me=ie[ie.length-1],Me.raw+=`
|
|
`+ce.raw,Me.text+=`
|
|
`+ce.text);continue}if(ce=this.tokenizer.fences(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.heading(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.nptable(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.hr(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.blockquote(te)){te=te.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],he),ie.push(ce);continue}if(ce=this.tokenizer.list(te)){for(te=te.substring(ce.raw.length),Ee=ce.items.length,ve=0;ve<Ee;ve++)ce.items[ve].tokens=this.blockTokens(ce.items[ve].text,[],!1);ie.push(ce);continue}if(ce=this.tokenizer.html(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(he&&(ce=this.tokenizer.def(te))){te=te.substring(ce.raw.length),this.tokens.links[ce.tag]||(this.tokens.links[ce.tag]={href:ce.href,title:ce.title});continue}if(ce=this.tokenizer.table(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.lheading(te)){te=te.substring(ce.raw.length),ie.push(ce);continue}if(he&&(ce=this.tokenizer.paragraph(te))){te=te.substring(ce.raw.length),ie.push(ce);continue}if(ce=this.tokenizer.text(te,ie)){te=te.substring(ce.raw.length),ce.type?ie.push(ce):(Me=ie[ie.length-1],Me.raw+=`
|
|
`+ce.raw,Me.text+=`
|
|
`+ce.text);continue}if(te){var We="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return ie},ae.inline=function(te){var ie,he,ce,ve,Ee,Me,We=te.length;for(ie=0;ie<We;ie++){Me=te[ie];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},ve=Me.header.length,he=0;he<ve;he++)Me.tokens.header[he]=[],this.inlineTokens(Me.header[he],Me.tokens.header[he]);for(ve=Me.cells.length,he=0;he<ve;he++)for(Ee=Me.cells[he],Me.tokens.cells[he]=[],ce=0;ce<Ee.length;ce++)Me.tokens.cells[he][ce]=[],this.inlineTokens(Ee[ce],Me.tokens.cells[he][ce]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(ve=Me.items.length,he=0;he<ve;he++)this.inline(Me.items[he].tokens);break}}}return te},ae.inlineTokens=function(te,ie,he,ce,ve){ie===void 0&&(ie=[]),he===void 0&&(he=!1),ce===void 0&&(ce=!1),ve===void 0&&(ve="");var Ee,Me=te,We;if(this.tokens.links){var qe=Object.keys(this.tokens.links);if(qe.length>0)for(;(We=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)qe.includes(We[0].slice(We[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(We=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ee=this.tokenizer.escape(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.tag(te,he,ce)){te=te.substring(Ee.raw.length),he=Ee.inLink,ce=Ee.inRawBlock,ie.push(Ee);continue}if(Ee=this.tokenizer.link(te)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ce)),ie.push(Ee);continue}if(Ee=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ce)),ie.push(Ee);continue}if(Ee=this.tokenizer.strong(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ie.push(Ee);continue}if(Ee=this.tokenizer.em(te,Me,ve)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ie.push(Ee);continue}if(Ee=this.tokenizer.codespan(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.br(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.del(te)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ie.push(Ee);continue}if(Ee=this.tokenizer.autolink(te,oe)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(!he&&(Ee=this.tokenizer.url(te,oe))){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.inlineText(te,ce,F)){te=te.substring(Ee.raw.length),ve=Ee.raw.slice(-1),ie.push(Ee);continue}if(te){var tt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return ie},Z(q,null,[{key:"rules",get:function(){return{block:D,inline:X}}}]),q}(),we=G.defaults,Oe=K.cleanUrl,Le=K.escape,De=function(){function q(le){this.options=le||we}var ae=q.prototype;return ae.code=function(te,ie,he){var ce=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(te,ce);ve!=null&&ve!==te&&(he=!0,te=ve)}return ce?'<pre><code class="'+this.options.langPrefix+Le(ce,!0)+'">'+(he?te:Le(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(he?te:Le(te,!0))+`</code></pre>
|
|
`},ae.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},ae.html=function(te){return te},ae.heading=function(te,ie,he,ce){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+ce.slug(he)+'">'+te+"</h"+ie+`>
|
|
`:"<h"+ie+">"+te+"</h"+ie+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(te,ie,he){var ce=ie?"ol":"ul",ve=ie&&he!==1?' start="'+he+'"':"";return"<"+ce+ve+`>
|
|
`+te+"</"+ce+`>
|
|
`},ae.listitem=function(te){return"<li>"+te+`</li>
|
|
`},ae.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},ae.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+ie+`</table>
|
|
`},ae.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},ae.tablecell=function(te,ie){var he=ie.header?"th":"td",ce=ie.align?"<"+he+' align="'+ie.align+'">':"<"+he+">";return ce+te+"</"+he+`>
|
|
`},ae.strong=function(te){return"<strong>"+te+"</strong>"},ae.em=function(te){return"<em>"+te+"</em>"},ae.codespan=function(te){return"<code>"+te+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(te){return"<del>"+te+"</del>"},ae.link=function(te,ie,he){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ce='<a href="'+Le(te)+'"';return ie&&(ce+=' title="'+ie+'"'),ce+=">"+he+"</a>",ce},ae.image=function(te,ie,he){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ce='<img src="'+te+'" alt="'+he+'"';return ie&&(ce+=' title="'+ie+'"'),ce+=this.options.xhtml?"/>":">",ce},ae.text=function(te){return te},q}(),_e=function(){function q(){}var ae=q.prototype;return ae.strong=function(te){return te},ae.em=function(te){return te},ae.codespan=function(te){return te},ae.del=function(te){return te},ae.html=function(te){return te},ae.text=function(te){return te},ae.link=function(te,ie,he){return""+he},ae.image=function(te,ie,he){return""+he},ae.br=function(){return""},q}(),Ne=function(){function q(){this.seen={}}var ae=q.prototype;return ae.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var he=ie;do this.seen[he]++,ie=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},q}(),Ge=G.defaults,He=K.unescape,ze=function(){function q(le){this.options=le||Ge,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new _e,this.slugger=new Ne}q.parse=function(te,ie){var he=new q(ie);return he.parse(te)};var ae=q.prototype;return ae.parse=function(te,ie){ie===void 0&&(ie=!0);var he="",ce,ve,Ee,Me,We,qe,tt,vt,ot,it,wt,xt,It,_t,Et,mr,Tr,Yt,gr=te.length;for(ce=0;ce<gr;ce++){it=te[ce];switch(it.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(it.tokens),it.depth,He(this.parseInline(it.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(it.text,it.lang,it.escaped);continue}case"table":{for(vt="",tt="",Me=it.header.length,ve=0;ve<Me;ve++)tt+=this.renderer.tablecell(this.parseInline(it.tokens.header[ve]),{header:!0,align:it.align[ve]});for(vt+=this.renderer.tablerow(tt),ot="",Me=it.cells.length,ve=0;ve<Me;ve++){for(qe=it.tokens.cells[ve],tt="",We=qe.length,Ee=0;Ee<We;Ee++)tt+=this.renderer.tablecell(this.parseInline(qe[Ee]),{header:!1,align:it.align[Ee]});ot+=this.renderer.tablerow(tt)}he+=this.renderer.table(vt,ot);continue}case"blockquote":{ot=this.parse(it.tokens),he+=this.renderer.blockquote(ot);continue}case"list":{for(wt=it.ordered,xt=it.start,It=it.loose,Me=it.items.length,ot="",ve=0;ve<Me;ve++)Et=it.items[ve],mr=Et.checked,Tr=Et.task,_t="",Et.task&&(Yt=this.renderer.checkbox(mr),It?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=Yt+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=Yt+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:Yt}):_t+=Yt),_t+=this.parse(Et.tokens,It),ot+=this.renderer.listitem(_t,Tr,mr);he+=this.renderer.list(ot,wt,xt);continue}case"html":{he+=this.renderer.html(it.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(it.tokens));continue}case"text":{for(ot=it.tokens?this.parseInline(it.tokens):it.text;ce+1<gr&&te[ce+1].type==="text";)it=te[++ce],ot+=`
|
|
`+(it.tokens?this.parseInline(it.tokens):it.text);he+=ie?this.renderer.paragraph(ot):ot;continue}default:{var cr='Token with "'+it.type+'" type was not found.';if(this.options.silent){console.error(cr);return}else throw new Error(cr)}}}return he},ae.parseInline=function(te,ie){ie=ie||this.renderer;var he="",ce,ve,Ee=te.length;for(ce=0;ce<Ee;ce++){ve=te[ce];switch(ve.type){case"escape":{he+=ie.text(ve.text);break}case"html":{he+=ie.html(ve.text);break}case"link":{he+=ie.link(ve.href,ve.title,this.parseInline(ve.tokens,ie));break}case"image":{he+=ie.image(ve.href,ve.title,ve.text);break}case"strong":{he+=ie.strong(this.parseInline(ve.tokens,ie));break}case"em":{he+=ie.em(this.parseInline(ve.tokens,ie));break}case"codespan":{he+=ie.codespan(ve.text);break}case"br":{he+=ie.br();break}case"del":{he+=ie.del(this.parseInline(ve.tokens,ie));break}case"text":{he+=ie.text(ve.text);break}default:{var Me='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return he},q}(),nt=K.merge,Ye=K.checkSanitizeDeprecation,Xe=K.escape,Pe=G.getDefaults,rt=G.changeDefaults,Qe=G.defaults;function se(q,ae,le){if(typeof q=="undefined"||q===null)throw new Error("marked(): input parameter is undefined or null");if(typeof q!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(q)+", string expected");if(typeof ae=="function"&&(le=ae,ae=null),ae=nt({},se.defaults,ae||{}),Ye(ae),le){var te=ae.highlight,ie;try{ie=be.lex(q,ae)}catch(Ee){return le(Ee)}var he=function(Me){var We;if(!Me)try{We=ze.parse(ie,ae)}catch(qe){Me=qe}return ae.highlight=te,Me?le(Me):le(null,We)};if(!te||te.length<3)return he();if(delete ae.highlight,!ie.length)return he();var ce=0;se.walkTokens(ie,function(Ee){Ee.type==="code"&&(ce++,setTimeout(function(){te(Ee.text,Ee.lang,function(Me,We){if(Me)return he(Me);We!=null&&We!==Ee.text&&(Ee.text=We,Ee.escaped=!0),ce--,ce===0&&he()})},0))}),ce===0&&he();return}try{var ve=be.lex(q,ae);return ae.walkTokens&&se.walkTokens(ve,ae.walkTokens),ze.parse(ve,ae)}catch(Ee){if(Ee.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Xe(Ee.message+"",!0)+"</pre>";throw Ee}}se.options=se.setOptions=function(q){return nt(se.defaults,q),rt(se.defaults),se},se.getDefaults=Pe,se.defaults=Qe,se.use=function(q){var ae=nt({},q);if(q.renderer&&function(){var te=se.defaults.renderer||new De,ie=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,We=new Array(Me),qe=0;qe<Me;qe++)We[qe]=arguments[qe];var tt=q.renderer[ve].apply(te,We);return tt===!1&&(tt=Ee.apply(te,We)),tt}};for(var he in q.renderer)ie(he);ae.renderer=te}(),q.tokenizer&&function(){var te=se.defaults.tokenizer||new xe,ie=function(ve){var Ee=te[ve];te[ve]=function(){for(var Me=arguments.length,We=new Array(Me),qe=0;qe<Me;qe++)We[qe]=arguments[qe];var tt=q.tokenizer[ve].apply(te,We);return tt===!1&&(tt=Ee.apply(te,We)),tt}};for(var he in q.tokenizer)ie(he);ae.tokenizer=te}(),q.walkTokens){var le=se.defaults.walkTokens;ae.walkTokens=function(te){q.walkTokens(te),le&&le(te)}}se.setOptions(ae)},se.walkTokens=function(q,ae){for(var le=U(q),te;!(te=le()).done;){var ie=te.value;ae(ie);switch(ie.type){case"table":{for(var he=U(ie.tokens.header),ce;!(ce=he()).done;){var ve=ce.value;se.walkTokens(ve,ae)}for(var Ee=U(ie.tokens.cells),Me;!(Me=Ee()).done;)for(var We=Me.value,qe=U(We),tt;!(tt=qe()).done;){var vt=tt.value;se.walkTokens(vt,ae)}break}case"list":{se.walkTokens(ie.items,ae);break}default:ie.tokens&&se.walkTokens(ie.tokens,ae)}}},se.Parser=ze,se.parser=ze.parse,se.Renderer=De,se.TextRenderer=_e,se.Lexer=be,se.lexer=be.lex,se.Tokenizer=xe,se.Slugger=Ne,se.parse=se;var ee=se;return ee})},ELLl:function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=fe.Pos;fe.defineOption("autoCloseBrackets",!1,function(w,C,d){d&&d!=fe.Init&&(w.removeKeyMap(U),w.state.closeBrackets=null),C&&(R(J(C,"pairs")),w.state.closeBrackets=C,w.addKeyMap(U))});function J(w,C){return C=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[C]!=null?w[C]:Z[C]}var U={Backspace:M,Enter:_};function R(w){for(var C=0;C<w.length;C++){var d=w.charAt(C),o="'"+d+"'";U[o]||(U[o]=G(d))}}R(Z.pairs+"`");function G(w){return function(C){return A(C,w)}}function H(w){var C=w.state.closeBrackets;if(!C||C.override)return C;var d=w.getModeAt(w.getCursor());return d.closeBrackets||C}function M(w){var C=H(w);if(!C||w.getOption("disableInput"))return fe.Pass;for(var d=J(C,"pairs"),o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var h=I(w,o[l].head);if(!h||d.indexOf(h)%2!=0)return fe.Pass}for(var l=o.length-1;l>=0;l--){var T=o[l].head;w.replaceRange("",O(T.line,T.ch-1),O(T.line,T.ch+1),"+delete")}}function _(w){var C=H(w),d=C&&J(C,"explode");if(!d||w.getOption("disableInput"))return fe.Pass;for(var o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var h=I(w,o[l].head);if(!h||d.indexOf(h)%2!=0)return fe.Pass}w.operation(function(){var T=w.lineSeparator()||`
|
|
`;w.replaceSelection(T+T,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var v=0;v<o.length;v++){var g=o[v].head.line;w.indentLine(g,null,!0),w.indentLine(g+1,null,!0)}})}function b(w){var C=fe.cmpPos(w.anchor,w.head)>0;return{anchor:new O(w.anchor.line,w.anchor.ch+(C?-1:1)),head:new O(w.head.line,w.head.ch+(C?1:-1))}}function A(w,C){var d=H(w);if(!d||w.getOption("disableInput"))return fe.Pass;var o=J(d,"pairs"),l=o.indexOf(C);if(l==-1)return fe.Pass;for(var h=J(d,"closeBefore"),T=J(d,"triples"),v=o.charAt(l+1)==C,g=w.listSelections(),L=l%2==0,E,p=0;p<g.length;p++){var c=g[p],u=c.head,a,y=w.getRange(u,O(u.line,u.ch+1));if(L&&!c.empty())a="surround";else if((v||!L)&&y==C)v&&k(w,u)?a="both":T.indexOf(C)>=0&&w.getRange(u,O(u.line,u.ch+3))==C+C+C?a="skipThree":a="skip";else if(v&&u.ch>1&&T.indexOf(C)>=0&&w.getRange(O(u.line,u.ch-2),u)==C+C){if(u.ch>2&&/\bstring/.test(w.getTokenTypeAt(O(u.line,u.ch-2))))return fe.Pass;a="addFour"}else if(v){var m=u.ch==0?" ":w.getRange(O(u.line,u.ch-1),u);if(!fe.isWordChar(y)&&m!=C&&!fe.isWordChar(m))a="both";else return fe.Pass}else if(L&&(y.length===0||/\s/.test(y)||h.indexOf(y)>-1))a="both";else return fe.Pass;if(!E)E=a;else if(E!=a)return fe.Pass}var x=l%2?o.charAt(l-1):C,B=l%2?C:o.charAt(l+1);w.operation(function(){if(E=="skip")w.execCommand("goCharRight");else if(E=="skipThree")for(var W=0;W<3;W++)w.execCommand("goCharRight");else if(E=="surround"){for(var V=w.getSelections(),W=0;W<V.length;W++)V[W]=x+V[W]+B;w.replaceSelections(V,"around"),V=w.listSelections().slice();for(var W=0;W<V.length;W++)V[W]=b(V[W]);w.setSelections(V)}else E=="both"?(w.replaceSelection(x+B,null),w.triggerElectric(x+B),w.execCommand("goCharLeft")):E=="addFour"&&(w.replaceSelection(x+x+x+x,"before"),w.execCommand("goCharRight"))})}function I(w,C){var d=w.getRange(O(C.line,C.ch-1),O(C.line,C.ch+1));return d.length==2?d:null}function k(w,C){var d=w.getTokenAt(O(C.line,C.ch+1));return/\bstring/.test(d.type)&&d.start==C.ch&&(C.ch==0||!/\bstring/.test(w.getTokenTypeAt(C)))}})},GfqC:function(dt,Je,de){"use strict";var fe=de("q1tI"),Z=de.n(fe),O=de("TSYQ"),J=de.n(O);function U(K,P){var N="cannot "+K.method+" "+K.action+" "+P.status+"'",$=new Error(N);return $.status=P.status,$.method=K.method,$.url=K.action,$}function R(K){var P=K.responseText||K.response;if(!P)return P;try{return JSON.parse(P)}catch(N){return P}}function G(K){var P=new XMLHttpRequest;K.onProgress&&P.upload&&(P.upload.onprogress=function(ue){ue.total>0&&(ue.percent=ue.loaded/ue.total*100),K.onProgress(ue)});var N=new FormData;K.data&&Object.keys(K.data).forEach(function(ne){var ue=K.data[ne];if(Array.isArray(ue)){ue.forEach(function(me){N.append(ne+"[]",me)});return}N.append(ne,K.data[ne])}),K.file instanceof Blob?N.append(K.filename,K.file,K.file.name):N.append(K.filename,K.file),P.onerror=function(ue){K.onError(ue)},P.onload=function(){return P.status<200||P.status>=300?K.onError(U(K,P),R(P)):K.onSuccess(R(P),P)},P.open(K.method,K.action,!0),K.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var $=K.headers||{};return $["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ne){$[ne]!==null&&P.setRequestHeader(ne,$[ne])}),P.send(N),{abort:function(){P.abort()}}}var H=+new Date,M=0;function _(){return"rc-upload-"+H+"-"+ ++M}function b(K,P){return K.indexOf(P,K.length-P.length)!==-1}var A=function(K,P){if(K&&P){var N=Array.isArray(P)?P:P.split(","),$=K.name||"",ne=K.type||"",ue=ne.replace(/\/.*$/,"");return N.some(function(me){var ke=me.trim();return ke.charAt(0)==="."?b($.toLowerCase(),ke.toLowerCase()):/\/\*$/.test(ke)?ue===ke.replace(/\/.*$/,""):ne===ke})}return!0};function I(K,P){var N=K.createReader(),$=[];function ne(){N.readEntries(function(ue){var me=Array.prototype.slice.apply(ue);$=$.concat(me);var ke=!me.length;ke?P($):ne()})}ne()}var k=function(P,N,$){var ne=function ue(me,ke){ke=ke||"",me.isFile?me.file(function(xe){$(xe)&&(me.fullPath&&!xe.webkitRelativePath&&(Object.defineProperties(xe,{webkitRelativePath:{writable:!0}}),xe.webkitRelativePath=me.fullPath.replace(/^\//,""),Object.defineProperties(xe,{webkitRelativePath:{writable:!1}})),N([xe]))}):me.isDirectory&&I(me,function(xe){xe.forEach(function(Re){ue(Re,""+ke+me.name+"/")})})};P.forEach(function(ue){ne(ue.webkitGetAsEntry())})},w=k,C=Object.assign||function(K){for(var P=1;P<arguments.length;P++){var N=arguments[P];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(K[$]=N[$])}return K},d=function(){function K(P,N){var $=[],ne=!0,ue=!1,me=void 0;try{for(var ke=P[Symbol.iterator](),xe;!(ne=(xe=ke.next()).done)&&!($.push(xe.value),N&&$.length===N);ne=!0);}catch(Re){ue=!0,me=Re}finally{try{!ne&&ke.return&&ke.return()}finally{if(ue)throw me}}return $}return function(P,N){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return K(P,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function K(P,N){for(var $=0;$<N.length;$++){var ne=N[$];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(P,ne.key,ne)}}return function(P,N,$){return N&&K(P.prototype,N),$&&K(P,$),P}}();function l(K,P,N){return P in K?Object.defineProperty(K,P,{value:N,enumerable:!0,configurable:!0,writable:!0}):K[P]=N,K}function h(K,P){var N={};for(var $ in K){if(P.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(K,$))continue;N[$]=K[$]}return N}function T(K,P){if(!(K instanceof P))throw new TypeError("Cannot call a class as a function")}function v(K,P){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:K}function g(K,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);K.prototype=Object.create(P&&P.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(K,P):K.__proto__=P)}var L=function(P){return Object.keys(P).reduce(function(N,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(N[$]=P[$]),N},{})},E=function(K){g(P,K);function P(){var N,$,ne,ue;T(this,P);for(var me=arguments.length,ke=Array(me),xe=0;xe<me;xe++)ke[xe]=arguments[xe];return ue=($=(ne=v(this,(N=P.__proto__||Object.getPrototypeOf(P)).call.apply(N,[this].concat(ke))),ne),ne.state={uid:_()},ne.reqs={},ne.onChange=function(Re){var Se=Re.target.files;ne.uploadFiles(Se),ne.reset()},ne.onClick=function(Re){var Se=ne.fileInput;if(!Se)return;var Te=ne.props,ye=Te.children,z=Te.onClick;ye&&ye.type==="button"&&(Se.parentNode.focus(),Se.parentNode.querySelector("button").blur()),Se.click(),z&&z(Re)},ne.onKeyDown=function(Re){Re.key==="Enter"&&ne.onClick()},ne.onFileDrop=function(Re){var Se=ne.props.multiple;if(Re.preventDefault(),Re.type==="dragover")return;if(ne.props.directory)w(Array.prototype.slice.call(Re.dataTransfer.items),ne.uploadFiles,function(ye){return A(ye,ne.props.accept)});else{var Te=Array.prototype.slice.call(Re.dataTransfer.files).filter(function(ye){return A(ye,ne.props.accept)});Se===!1&&(Te=Te.slice(0,1)),ne.uploadFiles(Te)}},ne.uploadFiles=function(Re){var Se=Array.prototype.slice.call(Re);Se.map(function(Te){return Te.uid=_(),Te}).forEach(function(Te){ne.upload(Te,Se)})},ne.saveFileInput=function(Re){ne.fileInput=Re},$),v(ne,ue)}return o(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ne){var ue=this,me=this.props;if(!me.beforeUpload)return setTimeout(function(){return ue.post($)},0);var ke=me.beforeUpload($,ne);ke&&ke.then?ke.then(function(xe){var Re=Object.prototype.toString.call(xe);return Re==="[object File]"||Re==="[object Blob]"?ue.post(xe):ue.post($)}).catch(function(xe){console.log(xe)}):ke!==!1&&setTimeout(function(){return ue.post($)},0);return}},{key:"post",value:function($){var ne=this;if(!this._isMounted)return;var ue=this.props,me=ue.onStart,ke=ue.onProgress,xe=ue.transformFile,Re=xe===void 0?function(Se){return Se}:xe;new Promise(function(Se){var Te=ue.action;return typeof Te=="function"&&(Te=Te($)),Se(Te)}).then(function(Se){var Te=$.uid,ye=ue.customRequest||G,z=Promise.resolve(Re($)).then(function(s){var f=ue.data;return typeof f=="function"&&(f=f(s)),Promise.all([s,f])}).catch(function(s){console.error(s)});z.then(function(s){var f=d(s,2),D=f[0],X=f[1],F={action:Se,filename:ue.name,data:X,file:D,headers:ue.headers,withCredentials:ue.withCredentials,method:ue.method||"post",onProgress:ke?function(oe){ke(oe,$)}:null,onSuccess:function(be,we){delete ne.reqs[Te],ue.onSuccess(be,$,we)},onError:function(be,we){delete ne.reqs[Te],ue.onError(be,we,$)}};me($),ne.reqs[Te]=ye(F)})})}},{key:"reset",value:function(){this.setState({uid:_()})}},{key:"abort",value:function($){var ne=this.reqs;if($){var ue=$;$&&$.uid&&(ue=$.uid),ne[ue]&&ne[ue].abort&&ne[ue].abort(),delete ne[ue]}else Object.keys(ne).forEach(function(me){ne[me]&&ne[me].abort&&ne[me].abort(),delete ne[me]})}},{key:"render",value:function(){var $,ne=this.props,ue=ne.component,me=ne.prefixCls,ke=ne.className,xe=ne.disabled,Re=ne.id,Se=ne.style,Te=ne.multiple,ye=ne.accept,z=ne.children,s=ne.directory,f=ne.openFileDialogOnClick,D=ne.onMouseEnter,X=ne.onMouseLeave,F=h(ne,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),oe=J()(($={},l($,me,!0),l($,me+"-disabled",xe),l($,ke,ke),$)),be=xe?{}:{onClick:f?this.onClick:function(){},onKeyDown:f?this.onKeyDown:function(){},onMouseEnter:D,onMouseLeave:X,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(ue,C({},be,{className:oe,role:"button",style:Se}),Z.a.createElement("input",C({},L(F),{id:Re,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ye,directory:s?"directory":null,webkitdirectory:s?"webkitdirectory":null,multiple:Te,onChange:this.onChange})),z)}}]),P}(fe.Component),p=E,c=Object.assign||function(K){for(var P=1;P<arguments.length;P++){var N=arguments[P];for(var $ in N)Object.prototype.hasOwnProperty.call(N,$)&&(K[$]=N[$])}return K},u=function(){function K(P,N){for(var $=0;$<N.length;$++){var ne=N[$];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(P,ne.key,ne)}}return function(P,N,$){return N&&K(P.prototype,N),$&&K(P,$),P}}();function a(K,P){if(!(K instanceof P))throw new TypeError("Cannot call a class as a function")}function y(K,P){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:K}function m(K,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);K.prototype=Object.create(P&&P.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(K,P):K.__proto__=P)}function x(){}var B=function(K){m(P,K);function P(){var N,$,ne,ue;a(this,P);for(var me=arguments.length,ke=Array(me),xe=0;xe<me;xe++)ke[xe]=arguments[xe];return ue=($=(ne=y(this,(N=P.__proto__||Object.getPrototypeOf(P)).call.apply(N,[this].concat(ke))),ne),ne.saveUploader=function(Re){ne.uploader=Re},$),y(ne,ue)}return u(P,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Z.a.createElement(p,c({},this.props,{ref:this.saveUploader}))}}]),P}(fe.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 W=B,V=Je.a=W},HmJG:function(dt,Je,de){},LdHM:function(dt,Je,de){"use strict";de.d(Je,"b",function(){return h}),de.d(Je,"a",function(){return v});var fe=de("1OyB"),Z=de("vuIU"),O=de("Ji7U"),J=de("LK+K"),U=de("q1tI"),R=de("rePB"),G=de("Ff2n"),H=de("ODXe"),M=de("4IlW"),_=de("bX4T"),b=de("YrtM"),A=de("TSYQ"),I=de.n(A),k=de("+nKL"),w=de("8OUc"),C=function($,ne){var ue=$.prefixCls,me=$.id,ke=$.flattenOptions,xe=$.childrenAsData,Re=$.values,Se=$.searchValue,Te=$.multiple,ye=$.defaultActiveFirstOption,z=$.height,s=$.itemHeight,f=$.notFoundContent,D=$.open,X=$.menuItemSelectedIcon,F=$.virtual,oe=$.onSelect,be=$.onToggleOpen,we=$.onActiveValue,Oe=$.onScroll,Le=$.onMouseEnter,De="".concat(ue,"-item"),_e=Object(b.a)(function(){return ke},[D,ke],function(ee,q){return q[0]&&ee[1]!==q[1]}),Ne=U.useRef(null),Ge=function(q){q.preventDefault()},He=function(q){Ne.current&&Ne.current.scrollTo({index:q})},ze=function(q){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=_e.length,te=0;te<le;te+=1){var ie=(q+te*ae+le)%le,he=_e[ie],ce=he.group,ve=he.data;if(!ce&&!ve.disabled)return ie}return-1},nt=U.useState(function(){return ze(0)}),Ye=Object(H.a)(nt,2),Xe=Ye[0],Pe=Ye[1],rt=function(q){Pe(q);var ae=_e[q];if(!ae){we(null,-1);return}we(ae.data.value,q)};U.useEffect(function(){rt(ye!==!1?ze(0):-1)},[_e.length,Se]),U.useEffect(function(){var ee=setTimeout(function(){if(!Te&&D&&Re.size===1){var q=Array.from(Re)[0],ae=_e.findIndex(function(le){var te=le.data;return te.value===q});rt(ae),He(ae)}});return function(){return clearTimeout(ee)}},[D]);var Qe=function(q){q!==void 0&&oe(q,{selected:!Re.has(q)}),Te||be(!1)};if(U.useImperativeHandle(ne,function(){return{onKeyDown:function(q){var ae=q.which;switch(ae){case M.a.UP:case M.a.DOWN:{var le=0;if(ae===M.a.UP?le=-1:ae===M.a.DOWN&&(le=1),le!==0){var te=ze(Xe+le,le);He(te),rt(te)}break}case M.a.ENTER:{var ie=_e[Xe];ie&&!ie.data.disabled?Qe(ie.data.value):Qe(void 0),D&&q.preventDefault();break}case M.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(q){He(q)}}}),_e.length===0)return U.createElement("div",{role:"listbox",id:"".concat(me,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ge},f);function se(ee){var q=_e[ee];if(!q)return null;var ae=q.data||{},le=ae.value,te=ae.label,ie=ae.children,he=Object(_.a)(ae,!0),ce=xe?ie:te;return q?U.createElement("div",Object.assign({"aria-label":typeof ce=="string"?ce:null},he,{key:ee,role:"option",id:"".concat(me,"_list_").concat(ee),"aria-selected":Re.has(le)}),le):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(me,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(Xe-1),se(Xe),se(Xe+1)),U.createElement(k.a,{itemKey:"key",ref:Ne,data:_e,height:z,itemHeight:s,fullHeight:!1,onMouseDown:Ge,onScroll:Oe,virtual:F,onMouseEnter:Le},function(ee,q){var ae,le=ee.group,te=ee.groupOption,ie=ee.data,he=ie.label,ce=ie.key;if(le)return U.createElement("div",{className:I()(De,"".concat(De,"-group"))},he!==void 0?he:ce);var ve=ie.disabled,Ee=ie.value,Me=ie.title,We=ie.children,qe=ie.style,tt=ie.className,vt=Object(G.a)(ie,["disabled","value","title","children","style","className"]),ot=Re.has(Ee),it="".concat(De,"-option"),wt=I()(De,it,tt,(ae={},Object(R.a)(ae,"".concat(it,"-grouped"),te),Object(R.a)(ae,"".concat(it,"-active"),Xe===q&&!ve),Object(R.a)(ae,"".concat(it,"-disabled"),ve),Object(R.a)(ae,"".concat(it,"-selected"),ot),ae)),xt=xe?We:he,It=!X||typeof X=="function"||ot;return U.createElement("div",Object.assign({},vt,{"aria-selected":ot,className:wt,title:Me,onMouseMove:function(){if(Xe===q||ve)return;rt(q)},onClick:function(){ve||Qe(Ee)},style:qe}),U.createElement("div",{className:"".concat(it,"-content")},xt||Ee),U.isValidElement(X)||ot,It&&U.createElement(w.a,{className:"".concat(De,"-option-state"),customizeIcon:X,customizeIconProps:{isSelected:ot}},ot?"\u2713":null))}))},d=U.forwardRef(C);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var h=l,T=function(){return null};T.isSelectOptGroup=!0;var v=T,g=de("VTBJ"),L=de("Zm9Q");function E(N){var $=N.key,ne=N.props,ue=ne.children,me=ne.value,ke=Object(G.a)(ne,["children","value"]);return Object(g.a)({key:$,value:me!==void 0?me:$,children:ue},ke)}function p(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(N).map(function(ne,ue){if(!U.isValidElement(ne)||!ne.type)return null;var me=ne.type.isSelectOptGroup,ke=ne.key,xe=ne.props,Re=xe.children,Se=Object(G.a)(xe,["children"]);return $||!me?E(ne):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(ke===null?ue:ke,"__"),label:ke},Se),{},{options:p(Re)})}).filter(function(ne){return ne})}var c=de("2Qr1"),u=de("qNPg"),a=de("U8pU"),y=de("Kwbf"),m=de("WKfj");function x(N){var $=N.mode,ne=N.options,ue=N.children,me=N.backfill,ke=N.allowClear,xe=N.placeholder,Re=N.getInputElement,Se=N.showSearch,Te=N.onSearch,ye=N.defaultOpen,z=N.autoFocus,s=N.labelInValue,f=N.value,D=N.inputValue,X=N.optionLabelProp,F=$==="multiple"||$==="tags",oe=Se!==void 0?Se:F||$==="combobox",be=ne||p(ue);if(Object(y.a)($!=="tags"||be.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var we=be.some(function(De){return De.options?De.options.some(function(_e){return typeof("value"in _e?_e.value:_e.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(y.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)($!=="combobox"||!X,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)($==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(y.a)($==="combobox"||!Re,"`getInputElement` only work with `combobox` mode."),Object(y.b)($!=="combobox"||!Re||!ke||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!oe&&$!=="combobox"&&$!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ye||z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),f!=null){var Oe=Object(m.d)(f);Object(y.a)(!s||Oe.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!F||Array.isArray(f),"`value` should be array when `mode` is `multiple` or `tags`")}if(ue){var Le=null;Object(L.a)(ue).some(function(De){if(!U.isValidElement(De)||!De.type)return!1;var _e=De.type;if(_e.isSelectOption)return!1;if(_e.isSelectOptGroup){var Ne=Object(L.a)(De.props.children).every(function(Ge){return!U.isValidElement(Ge)||!De.type||Ge.type.isSelectOption?!0:(Le=Ge.type,!1)});return!Ne}return Le=_e,!0}),Le&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Le.displayName||Le.name||Le,"`.")),Object(y.a)(D===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=x,W=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:p,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:B,fillOptionsWithMissingValue:c.a}),V=function(N){Object(O.a)(ne,N);var $=Object(J.a)(ne);function ne(){var ue;return Object(fe.a)(this,ne),ue=$.apply(this,arguments),ue.selectRef=U.createRef(),ue.focus=function(){ue.selectRef.current.focus()},ue.blur=function(){ue.selectRef.current.blur()},ue}return Object(Z.a)(ne,[{key:"render",value:function(){return U.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ne}(U.Component);V.Option=h,V.OptGroup=v;var K=V,P=Je.c=K},M8RZ:function(dt,Je,de){"use strict";de.d(Je,"a",function(){return M});var fe=de("fWQN"),Z=de("mtLc"),O=de("yKVA"),J=de("879j"),U=de("q1tI"),R=de.n(U),G=de("i8i4"),H=de.n(G),M=function(_){Object(O.a)(A,_);var b=Object(J.a)(A);function A(I){var k;Object(fe.a)(this,A),k=b.call(this,I);var w=window.document;return k.node=w.createElement("div"),w.body.appendChild(k.node),k}return Object(Z.a)(A,[{key:"render",value:function(){var k=this.props.children;return Object(G.createPortal)(k,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(R.a.Component)},Ot1p:function(dt,Je,de){"use strict";var fe=de("2qtc"),Z=de("kLXV"),O=de("rAM+"),J=de("miYZ"),U=de("tsqr"),R=de("9og8"),G=de("tJVT"),H=de("jrin"),M=de("WmNS"),_=de.n(M),b=de("q1tI"),A=de.n(b),I=de("VrN/"),k=de.n(I),w=de("bdgK"),C=de("p77/"),d=de("Bd2K"),o=de("ELLl"),l=de("19Vz"),h=de("lZu9"),T=de("+NIl"),v=de("kSUc"),g=de("9Bee"),L=function(ve){var Ee=ve.value,Me=Ee===void 0?"":Ee,We=ve.className,qe=ve.showTextOnly,tt=ve.showLines,vt=ve.style,ot=vt===void 0?{}:vt,it=Object(b.useMemo)(function(){return""},[Me]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:it}}))},E=de("0Owb"),p=de("dejd"),c=de("C+DQ"),u=de("1vsH"),a=de("m3rI"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ve){var Ee=ve.onActionCallback,Me=ve.title,We=ve.icon,qe=ve.actionName,tt=ve.className,vt=tt===void 0?"":tt,ot=ve.children;function it(){Ee(qe)}return A.a.createElement("a",{title:Me,className:vt,onClick:it},A.a.createElement("i",{className:"md-iconfont ".concat(We)}),ot)}var x=function(ve){var Ee=ve.watch,Me=ve.showNullButton,We=ve.onActionCallback,qe=ve.fullScreen,tt=ve.insertTemp,vt=ve.hidetoolBar,ot=ve.uuid,it=ve.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.F)("_educoder_session"),"&key=").concat(ot,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var wt=[].concat(y,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!vt&&wt.map(function(xt,It){return A.a.createElement("li",{key:It},xt.actionName?A.a.createElement(m,Object(E.a)({},xt,{onActionCallback:We})):A.a.createElement("span",{className:"v-line"}))}),Me?A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:We},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,tt&&A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(tt),onActionCallback:We},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(m,{icon:"".concat(qe?"icon-shrink":"icon-enlarge"),title:qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:We})))},B=de("M8RZ"),W=de("+L6B"),V=de("2/Rp"),K=de("y8nQ"),P=de("Vl3Y"),N=de("5NDa"),$=de("5rEg"),ne={labelCol:{span:4},wrapperCol:{span:20}},ue=function(ve){var Ee=ve.callback,Me=ve.onCancel;function We(qe){Ee(qe)}return A.a.createElement(P.a,Object(E.a)({},ne,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:We}),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement($.a,null)),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement($.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},me=de("7ahc"),ke=de("HmJG"),xe=de("BjJ7"),Re=P.a.useForm,Se={width:280,marginRight:10},Te={labelCol:{span:5},wrapperCol:{span:19}},ye=function(ve){var Ee=ve.callback,Me=ve.onCancel,We=Re(),qe=Object(G.a)(We,1),tt=qe[0];function vt(wt){Ee(wt)}function ot(wt,xt){if(wt.status===-1){U.b.error(wt.message);return}tt.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:xt.type})}function it(wt){var xt=wt.target.files[0];s(xt,ot)}return A.a.createElement(P.a,Object(E.a)({form:tt},Te,{className:"upload-image-panel",onFinish:vt}),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement($.a,{style:Se})),A.a.createElement(z,{onFileChange:it}))),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement($.a,{style:{width:264}})),A.a.createElement(P.a.Item,{style:{textAlign:"right"}},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function z(ve){var Ee=ve.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ee}))}function s(ve,Ee){if(!ve)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",ve),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var We=new window.XMLHttpRequest;We.withCredentials=!0,We.addEventListener("load",function(qe){Ee(JSON.parse(qe.target.responseText),ve)},!1),We.addEventListener("error",function(qe){console.error(qe)},!1),We.open("POST","".concat(xe.a,"/api/attachments.json")),We.send(Me)}var f=de("giR+"),D=de("fyUT"),X=de("7Kak"),F=de("9yH6"),oe=F.a.Group,be={margin:"0 8px"},we=function(ve){var Ee=ve.callback,Me=ve.onCancel;function We(qe){Ee(qe)}return A.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:We},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:be},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:be},"\u884C\u6570"),A.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(D.a,null)),A.a.createElement("span",{style:be},"\u5217\u6570"),A.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(D.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(P.a.Item,{name:"align"},A.a.createElement(oe,null,A.a.createElement(F.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(F.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(F.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(F.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Oe=de("ErOA"),Le=de("7Cbv"),De="link",_e="upload-image",Ne="code-block",Ge="add-table",He="------------",ze={default:He,left:":".concat(He),center:":".concat(He,":"),right:"".concat(He,":")},nt=de("9VGf"),Ye,Xe;function Pe(){}var rt=0,Qe=1e4,se="\u2581",ee=`
|
|
**\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 q(ve){return/^\d+$/.test(ve)?"".concat(ve,"px"):ve}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ae?"Cmd":"Ctrl",te=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ie=(Ye={},Object(H.a)(Ye,le+"-B","bold"),Object(H.a)(Ye,le+"-I","italic"),Ye),he=(Xe={},Object(H.a)(Xe,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Xe,Ne,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Xe,_e,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Xe,Ge,"\u6DFB\u52A0\u8868\u683C"),Xe),ce=Je.a=function(ve){var Ee=ve.defaultValue,Me=Ee===void 0?"":Ee,We=ve.onChange,qe=ve.width,tt=qe===void 0?"100%":qe,vt=ve.height,ot=vt===void 0?400:vt,it=ve.miniToolbar,wt=it===void 0?!1:it,xt=ve.isFocus,It=xt===void 0?!1:xt,_t=ve.watch,Et=ve.insertTemp,mr=ve.mode,Tr=mr===void 0?"markdown":mr,Yt=ve.id,gr=Yt===void 0?"markdown-editor-id":Yt,cr=ve.showResizeBar,zr=cr===void 0?!1:cr,$t=ve.noStorage,Nr=$t===void 0?!1:$t,ti=ve.showNullButton,Pt=ti===void 0?!1:ti,$e=ve.hidetoolBar,Tt=$e===void 0?!1:$e,Zt=ve.fullScreen,mt=Zt===void 0?!1:Zt,pt=ve.onBlur,At=ve.onCMBeforeChange,vr=ve.onFullScreen,Ut=ve.className,Be=Ut===void 0?"":Ut,ht=ve.disablePaste,ri=ht===void 0?!1:ht,bi=ve.placeholder,xi=bi===void 0?"":bi,ii=ve.values,Ei=ii===void 0?"":ii,ft=Object(b.useState)(null),Ln=Object(G.a)(ft,2),Ue=Ln[0],Si=Ln[1],Er=Object(b.useState)(Me),Ki=Object(G.a)(Er,2),ni=Ki[0],Cr=Ki[1],Vi=Object(b.useState)(_t),Xi=Object(G.a)(Vi,2),wr=Xi[0],Yi=Xi[1],kn=Object(b.useState)(mt),$i=Object(G.a)(kn,2),Ar=$i[0],Rn=$i[1],aa=Object(b.useState)(""),Zi=Object(G.a)(aa,2),rr=Zi[0],Kr=Zi[1],oa=Object(b.useState)(0),ai=Object(G.a)(oa,2),Lr=ai[0],Ji=ai[1],sa=Object(b.useState)(ot),Dn=Object(G.a)(sa,2),On=Dn[0],Ti=Dn[1],_n=Object(b.useState)(!1),Pn=Object(G.a)(_n,2),la=Pn[0],Ci=Pn[1],oi=Object(b.useRef)(Object(Le.a)()),si=Object(b.useRef)(!1),wi=Object(b.useRef)(),Fr=Object(b.useRef)(),Br=Object(b.useRef)(),Ur=Object(b.useRef)(),Ai=Object(b.useRef)(),Mn=function(){var at=Object(R.a)(_.a.mark(function ct(){var lt,yt;return _.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return Dt.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:yt=Dt.sent,yt!=null&&(lt=yt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Ue,Fr),yt.attachments.map(function(St){St.content_type.indexOf("image")>-1?Ue.replaceSelection(".concat(St.content_type,")")):St.content_type.indexOf("video")>-1?Ue.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):St.content_type.indexOf("pdf")>-1?Ue.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):Ue.replaceSelection("[".concat(St.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}));case 4:case"end":return Dt.stop()}},ct)}));return function(){return at.apply(this,arguments)}}();Object(b.useEffect)(function(){Cr(Ei),Ue==null||Ue.setValue(Ei)},[Ei]),Object(b.useEffect)(function(){vr==null||vr(Ar)},[Ar]),Object(b.useEffect)(function(){if(Fr.current){var at=k.a.fromTextArea(Fr.current,{mode:Tr,lineNumbers:!wt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});It&&at.focus();function ct(lt,yt){if(ri){yt.preventDefault();return}var Ct=yt.clipboardData;if(Ct){var Dt=Ct.types.toString(),St=Ct.items;if(Dt==="Files"||Ct.types.indexOf("Files")>-1){if(yt.preventDefault(),Tr=="stex")return;try{var Ht,ar=St[1];((Ht=St[0])===null||Ht===void 0?void 0:Ht.kind)==="file"&&(ar=St[0]);var bt=ar.getAsFile(),jr=bt.name.split(".").pop();s(bt,function(Lt){if(Lt.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?at.replaceSelection(".concat(Lt.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):te.includes(jr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):at.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})}catch(Lt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",ct),at.on("dragleave",function(lt,yt){Br.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(lt,yt){Br.current.classList.add("mouse-hover-md")}),at.on("drop",function(lt,yt){Br.current.classList.add("mouse-hover-md");var Ct;if(Ct=yt.dataTransfer.files,Ct.length>0){yt.preventDefault(),yt.stopPropagation();for(var Dt=function(ar){var bt=Ct[ar],jr=bt.name.split(".").pop();s(bt,function(Lt){if(Lt.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?at.replaceSelection(".concat(Lt.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):te.includes(jr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):at.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})},St=0;St<Ct.length;St++)Dt(St)}}),Si(at),function(){at.off("paste",ct)}}},[]);var yr=Object(b.useCallback)(function(){if(Br.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[On,Br,Ar]);Object(b.useEffect)(function(){function at(){var lt=new w.default(function(yt){var Ct=Object(O.a)(yt),Dt;try{for(Ct.s();!(Dt=Ct.n()).done;){var St=Dt.value;(St.target.offsetHeight>0||St.target.offsetWidth>0)&&(yr(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(Ht){Ct.e(Ht)}finally{Ct.f()}});return lt.observe(Fr.current.parentElement),lt}if(Ue){var ct=at();return function(){ct.unobserve(Fr.current.parentElement)}}},[Ue,yr]),Object(b.useEffect)(function(){if(Ue){for(var at=[],ct=function(){var St=yt[lt];Ct=Object(G.a)(St,2);var Ht=Ct[0],ar=Ct[1],bt=Object(H.a)({},Ht,function(){In(ar)});at.push(bt),Ue.addKeyMap(bt)},lt=0,yt=Object.entries(ie);lt<yt.length;lt++){var Ct;ct()}return wi.current=setInterval(function(){si.current&&Mn()},4e3),function(){clearInterval(wi.current);var Dt=Object(O.a)(at),St;try{for(Dt.s();!(St=Dt.n()).done;){var Ht=St.value;Ue.removeKeyMap(Ht)}}catch(ar){Dt.e(ar)}finally{Dt.f()}}}},[Ue]),Object(b.useEffect)(function(){mt!==Ar&&Rn(mt)},[mt]),Object(nt.a)(function(){if(!Nr&&Lr>0){var at=new Date().getTime(),ct=window.sessionStorage.getItem(gr);at>=Lr+Qe&&(!ct||ct!==ni)&&(window.sessionStorage.setItem(gr,ni),Ci(!0))}},Qe),Object(b.useEffect)(function(){Yi(_t)},[Ue,_t]),Object(b.useEffect)(function(){Ue&&(It&&Ue.focus())},[Ue,It]),Object(b.useEffect)(function(){if(wr&&Ue){var at=Ue.getScrollerElement();function ct(lt){var yt=lt.target;if(Ai.current){var Ct=yt.scrollTop/yt.scrollHeight;Ai.current.scrollTop=Ai.current.scrollHeight*Ct}}return at.addEventListener("scroll",ct),function(){at.removeEventListener("scroll",ct)}}},[Ue,wr]),Object(b.useEffect)(function(){if(Ue&&At){function at(ct,lt){At(ct,lt)}return Ue.on("beforeChange",at),function(){Ue.off("beforeChange",at)}}},[Ue,At]),Object(b.useEffect)(function(){if(Ue&&pt){function at(){pt(Ue.getValue())}return Ue.on("blur",at),function(){Ue.off("blur",at)}}},[Ue,pt]),Object(b.useEffect)(function(){if(Ue){function at(ct){var lt=ct.getValue();Cr(lt),Ji(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),We&&We(lt)}return Ue.on("change",at),function(){Ue.off("change",at)}}},[Ue,We]),Object(b.useEffect)(function(){Ue&&(Me==null?(Ue.setValue(""),Cr("")):Me!==Ue.getValue()&&(Ue.setValue(Me),Cr(Me),Ue.setCursor(Ue.lineCount(),0)))},[Ue,Me]);var In=Object(b.useCallback)(function(at){var ct=Ue.getCursor(),lt=Ue.getSelection(),yt=lt.split(`
|
|
`);switch(at){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(ct.line,ct.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(ct.line,ct.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(ct.line+1,lt.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`<br/>
|
|
`),Ue.focus();case"list-ul":return lt===""?Ue.replaceSelection("- "+lt):Ue.replaceSelection(yt.map(function(Ct){return Ct===""?"":"- ".concat(Ct)}).join(`
|
|
`)),Ue.focus();case"list-ol":return lt===""?Ue.replaceSelection("1. "+lt):Ue.replaceSelection(yt.map(function(Ct,Dt){return Ct===""?"":"".concat(Dt+1,". ").concat(Ct)}).join(`
|
|
`)),Ue.focus();case"add-null-ch":return lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.replaceSelection(se),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(ct.line,ct.ch),Ue.replaceSelection(ee),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return Yi(!wr),Ue.focus();case"trigger-full-screen":return Rn(!Ar),Ue.focus();case De:Kr(De);return;case Ne:Kr(Ne);return;case _e:Kr(_e);return;case Ge:Kr(Ge);return;default:throw new Error}},[Ue,wr,Ar]),Li=Object(b.useCallback)(function(at){Kr("");switch(rr){case De:var ct=at.title,lt=at.link;return Ue.replaceSelection("[".concat(ct,"](").concat(lt,")")),Ue.focus();case Ne:var yt=at.language,Ct=at.content;return Ue.replaceSelection(["```"+yt,Ct,"```"].join(`
|
|
`)),Ue.focus();case _e:var Dt=at.src,St=at.alt;return St?Ue.replaceSelection(".concat(Dt,' "').concat(St,'" )')):Ue.replaceSelection("")),Ue.focus();case Ge:for(var Ht=at.row,ar=at.col,bt=at.align,jr=`
|
|
`,Lt=0;Lt<Ht;Lt++){for(var or=[],qt=[],Sr=0;Sr<ar;Sr++)Lt===1&&qt.push(ze[bt]),or.push(" ");Lt===1&&(jr+="| ".concat(qt.join(" | "),` |
|
|
`)),jr+="| ".concat(or.join(ar===1?"":" | "),` |
|
|
`)}return Ue.replaceSelection(jr+`
|
|
`),Ue.focus();default:throw new Error}},[Ue,rr]),Qi=Object(b.useMemo)(function(){switch(rr){case De:return A.a.createElement(ue,{callback:Li,onCancel:Vr});case Ne:return A.a.createElement(me.b,{callback:Li,onCancel:Vr});case _e:return A.a.createElement(ye,{callback:Li,onCancel:Vr});case Ge:return A.a.createElement(we,{callback:Li,onCancel:Vr});default:return null}},[rr]);function Vr(){Kr("")}Object(b.useEffect)(function(){if(Ur.current){var at=Ur.current,ct=!1,lt=0;function yt(St){ct=!0,lt=St.pageY}function Ct(){ct=!1}function Dt(St){if(ct){var Ht=St.pageY-lt;Ht<0&&(Ht=0),Ht>300&&(Ht=300);var ar=ot+Ht+"px";Ti(ar)}}return at.addEventListener("mousedown",yt),document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Ct),function(){at.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Ct)}}},[Ue,Ur]),Object(b.useEffect)(function(){Ti(ot)},[ot]);var _r=q(tt),qi=q(On),kr={width:_r,height:qi},en=Object(b.useMemo)(function(){if(Lr){var at=new Date(Lr),ct=at.getHours(),lt=at.getMinutes(),yt=at.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,yt=yt<10?"0"+yt:yt,"".concat(ct,":").concat(lt,":").concat(yt)}return 0},[Lr]);function Nn(){window.sessionStorage.removeItem(gr),Ci(!1),Ji(0)}function li(){Ci(!1),Ji(0),Ue.setValue(window.sessionStorage.getItem(gr))}function ua(at,ct){var lt=Ue.getValue();lt=lt.replace(at,ct),Cr(lt),Ue==null||Ue.setValue(lt)}return A.a.createElement(b.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Br},A.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(wr?"on-preview":""," ").concat(wt?"mini":""," ").concat(Ar?"full-screen":""),style:kr},A.a.createElement(x,{insertTemp:Et,watch:wr,fullScreen:Ar,showNullButton:Pt,onActionCallback:In,hidetoolBar:Tt,uuid:oi.current,setOpenPhones:function(){si.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Fr,placeholder:xi})),wr?A.a.createElement("div",{ref:Ai,className:"preview-container"},Tr==="stex"&&A.a.createElement(L,{value:ni}),Tr!=="stex"&&A.a.createElement(g.a,{edit:!0,value:ni,replaces:ua})):null))),zr?A.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,A.a.createElement(B.a,null,he[rr]?A.a.createElement(Z.a,{centered:!0,title:he[rr],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Qi):null))}},SJMd:function(dt,Je){/**
|
|
* @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 de,fe,Z,O=!1,J,U;window.PR_SHOULD_USE_CONTINUATION=!0;var R,G;(function(){var H=window,M=["break,continue,do,else,for,if,return,while"],_=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],b=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],I=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",C=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[A,k,I,C,d,o,l,h],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",L="kwd",E="com",p="typ",c="lit",u="pun",a="pln",y="tag",m="dec",x="src",B="atn",W="atv",V="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(oe){for(var be=0,we=!1,Oe=!1,Le=0,De=oe.length;Le<De;++Le){var _e=oe[Le];if(_e.ignoreCase)Oe=!0;else if(/[a-z]/i.test(_e.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,Oe=!1;break}}var Ne={b:8,t:9,n:10,v:11,f:12,r:13};function Ge(Xe){var Pe=Xe.charCodeAt(0);if(Pe!==92)return Pe;var rt=Xe.charAt(1);return Pe=Ne[rt],Pe||("0"<=rt&&rt<="7"?parseInt(Xe.substring(1),8):rt==="u"||rt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function He(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Pe=String.fromCharCode(Xe);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function ze(Xe){var Pe=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),rt=[],Qe=Pe[0]==="^",se=["["];Qe&&se.push("^");for(var ee=Qe?1:0,q=Pe.length;ee<q;++ee){var ae=Pe[ee];if(/\\[bdsw]/i.test(ae))se.push(ae);else{var le=Ge(ae),te;ee+2<q&&Pe[ee+1]==="-"?(te=Ge(Pe[ee+2]),ee+=2):te=le,rt.push([le,te]),te<65||le>122||(te<65||le>90||rt.push([Math.max(65,le)|32,Math.min(te,90)|32]),te<97||le>122||rt.push([Math.max(97,le)&~32,Math.min(te,122)&~32]))}}rt.sort(function(ve,Ee){return ve[0]-Ee[0]||Ee[1]-ve[1]});for(var ie=[],he=[],ee=0;ee<rt.length;++ee){var ce=rt[ee];ce[0]<=he[1]+1?he[1]=Math.max(he[1],ce[1]):ie.push(he=ce)}for(var ee=0;ee<ie.length;++ee){var ce=ie[ee];se.push(He(ce[0])),ce[1]>ce[0]&&(ce[1]+1>ce[0]&&se.push("-"),se.push(He(ce[1])))}return se.push("]"),se.join("")}function nt(Xe){for(var Pe=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),rt=Pe.length,Qe=[],se=0,ee=0;se<rt;++se){var q=Pe[se];if(q==="(")++ee;else if(q.charAt(0)==="\\"){var ae=+q.substring(1);ae&&(ae<=ee?Qe[ae]=-1:Pe[se]=He(ae))}}for(var se=1;se<Qe.length;++se)Qe[se]===-1&&(Qe[se]=++be);for(var se=0,ee=0;se<rt;++se){var q=Pe[se];if(q==="(")++ee,Qe[ee]||(Pe[se]="(?:");else if(q.charAt(0)==="\\"){var ae=+q.substring(1);ae&&ae<=ee&&(Pe[se]="\\"+Qe[ae])}}for(var se=0;se<rt;++se)Pe[se]==="^"&&Pe[se+1]!=="^"&&(Pe[se]="");if(Xe.ignoreCase&&we)for(var se=0;se<rt;++se){var q=Pe[se],le=q.charAt(0);q.length>=2&&le==="["?Pe[se]=ze(q):le!=="\\"&&(Pe[se]=q.replace(/[a-zA-Z]/g,function(he){var ce=he.charCodeAt(0);return"["+String.fromCharCode(ce&~32,ce|32)+"]"}))}return Pe.join("")}for(var Ye=[],Le=0,De=oe.length;Le<De;++Le){var _e=oe[Le];if(_e.global||_e.multiline)throw new Error(""+_e);Ye.push("(?:"+nt(_e)+")")}return new RegExp(Ye.join("|"),Oe?"gi":"g")}function N(oe,be){var we=/(?:^|\s)nocode(?:\s|$)/,Oe=[],Le=0,De=[],_e=0;function Ne(Ge){var He=Ge.nodeType;if(He==1){if(we.test(Ge.className))return;for(var ze=Ge.firstChild;ze;ze=ze.nextSibling)Ne(ze);var nt=Ge.nodeName.toLowerCase();(nt==="br"||nt==="li")&&(Oe[_e]=`
|
|
`,De[_e<<1]=Le++,De[_e++<<1|1]=Ge)}else if(He==3||He==4){var Ye=Ge.nodeValue;Ye.length&&(be?Ye=Ye.replace(/\r\n?/g,`
|
|
`):Ye=Ye.replace(/[ \t\r\n]+/g," "),Oe[_e]=Ye,De[_e<<1]=Le,Le+=Ye.length,De[_e++<<1|1]=Ge)}}return Ne(oe),{sourceCode:Oe.join("").replace(/\n$/,""),spans:De}}function $(oe,be,we,Oe,Le){if(!we)return;var De={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:be,decorations:null};Oe(De),Le.push.apply(Le,De.decorations)}var ne=/\S/;function ue(oe){for(var be=void 0,we=oe.firstChild;we;we=we.nextSibling){var Oe=we.nodeType;be=Oe===1?be?oe:we:Oe===3&&ne.test(we.nodeValue)?oe:be}return be===oe?void 0:be}function me(oe,be){var we={},Oe;(function(){for(var _e=oe.concat(be),Ne=[],Ge={},He=0,ze=_e.length;He<ze;++He){var nt=_e[He],Ye=nt[3];if(Ye)for(var Xe=Ye.length;--Xe>=0;)we[Ye.charAt(Xe)]=nt;var Pe=nt[1],rt=""+Pe;Ge.hasOwnProperty(rt)||(Ne.push(Pe),Ge[rt]=null)}Ne.push(/[\0-\uffff]/),Oe=P(Ne)})();var Le=be.length,De=function(_e){for(var Ne=_e.sourceCode,Ge=_e.basePos,He=_e.sourceNode,ze=[Ge,a],nt=0,Ye=Ne.match(Oe)||[],Xe={},Pe=0,rt=Ye.length;Pe<rt;++Pe){var Qe=Ye[Pe],se=Xe[Qe],ee=void 0,q;if(typeof se=="string")q=!1;else{var ae=we[Qe.charAt(0)];if(ae)ee=Qe.match(ae[1]),se=ae[0];else{for(var le=0;le<Le;++le)if(ae=be[le],ee=Qe.match(ae[1]),ee){se=ae[0];break}ee||(se=a)}q=se.length>=5&&se.substring(0,5)==="lang-",q&&!(ee&&typeof ee[1]=="string")&&(q=!1,se=x),q||(Xe[Qe]=se)}var te=nt;if(nt+=Qe.length,!q)ze.push(Ge+te,se);else{var ie=ee[1],he=Qe.indexOf(ie),ce=he+ie.length;ee[2]&&(ce=Qe.length-ee[2].length,he=ce-ie.length);var ve=se.substring(5);$(He,Ge+te,Qe.substring(0,he),De,ze),$(He,Ge+te+he,ie,z(ve,ie),ze),$(He,Ge+te+ce,Qe.substring(ce),De,ze)}}_e.decorations=ze};return De}function ke(oe){var be=[],we=[];oe.tripleQuotedStrings?be.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?be.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&we.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=oe.hashComments;Oe&&(oe.cStyleComments?(Oe>1?be.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([E,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(we.push([E,/^\/\/[^\r\n]*/,null]),we.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Le=oe.regexLiterals;if(Le){var De=Le>1?"":`
|
|
\r`,_e=De?".":"[\\S\\s]",Ne="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+_e+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+_e+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+K+"("+Ne+")")])}var Ge=oe.types;Ge&&we.push([p,Ge]);var He=(""+oe.keywords).replace(/^ | $/g,"");He.length&&we.push([L,new RegExp("^(?:"+He.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var ze="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(ze+="(?!s*/)"),we.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(ze),null]),me(be,we)}var xe=ke({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Re(oe,be,we){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,Le=/\r\n?|\n/,De=oe.ownerDocument,_e=De.createElement("li");oe.firstChild;)_e.appendChild(oe.firstChild);var Ne=[_e];function Ge(Pe){var rt=Pe.nodeType;if(rt==1&&!Oe.test(Pe.className))if(Pe.nodeName==="br")He(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var Qe=Pe.firstChild;Qe;Qe=Qe.nextSibling)Ge(Qe);else if((rt==3||rt==4)&&we){var se=Pe.nodeValue,ee=se.match(Le);if(ee){var q=se.substring(0,ee.index);Pe.nodeValue=q;var ae=se.substring(ee.index+ee[0].length);if(ae){var le=Pe.parentNode;le.insertBefore(De.createTextNode(ae),Pe.nextSibling)}He(Pe),q||Pe.parentNode.removeChild(Pe)}}}function He(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function rt(ee,q){var ae=q?ee.cloneNode(!1):ee,le=ee.parentNode;if(le){var te=rt(le,1),ie=ee.nextSibling;te.appendChild(ae);for(var he=ie;he;he=ie)ie=he.nextSibling,te.appendChild(he)}return ae}for(var Qe=rt(Pe.nextSibling,0),se;(se=Qe.parentNode)&&se.nodeType===1;)Qe=se;Ne.push(Qe)}for(var ze=0;ze<Ne.length;++ze)Ge(Ne[ze]);be===(be|0)&&Ne[0].setAttribute("value",be);var nt=De.createElement("ol");nt.className="linenums";for(var Ye=Math.max(0,be-1|0)||0,ze=0,Xe=Ne.length;ze<Xe;++ze)_e=Ne[ze],_e.className="L"+(ze+Ye)%10,_e.firstChild||_e.appendChild(De.createTextNode("\xA0")),nt.appendChild(_e);oe.appendChild(nt)}function Se(oe){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var we=/\n/g,Oe=oe.sourceCode,Le=Oe.length,De=0,_e=oe.spans,Ne=_e.length,Ge=0,He=oe.decorations,ze=He.length,nt=0;He[ze]=Le;var Ye,Xe;for(Xe=Ye=0;Xe<ze;)He[Xe]!==He[Xe+2]?(He[Ye++]=He[Xe++],He[Ye++]=He[Xe++]):Xe+=2;for(ze=Ye,Xe=Ye=0;Xe<ze;){for(var Pe=He[Xe],rt=He[Xe+1],Qe=Xe+2;Qe+2<=ze&&He[Qe+1]===rt;)Qe+=2;He[Ye++]=Pe,He[Ye++]=rt,Xe=Qe}ze=He.length=Ye;var se=oe.sourceNode,ee="";se&&(ee=se.style.display,se.style.display="none");try{for(var q=null;Ge<Ne;){var ae=_e[Ge],le=_e[Ge+2]||Le,te=He[nt+2]||Le,Qe=Math.min(le,te),ie=_e[Ge+1],he;if(ie.nodeType!==1&&(he=Oe.substring(De,Qe))){be&&(he=he.replace(we,"\r")),ie.nodeValue=he;var ce=ie.ownerDocument,ve=ce.createElement("span");ve.className=He[nt+1];var Ee=ie.parentNode;Ee.replaceChild(ve,ie),ve.appendChild(ie),De<le&&(_e[Ge+1]=ie=ce.createTextNode(Oe.substring(Qe,le)),Ee.insertBefore(ie,ve.nextSibling))}De=Qe,De>=le&&(Ge+=2),De>=te&&(nt+=2)}}finally{se&&(se.style.display=ee)}}var Te={};function ye(oe,be){for(var we=be.length;--we>=0;){var Oe=be[we];Te.hasOwnProperty(Oe)?H.console&&console.warn("cannot override language handler %s",Oe):Te[Oe]=oe}}function z(oe,be){return oe&&Te.hasOwnProperty(oe)||(oe=/^\s*</.test(be)?"default-markup":"default-code"),Te[oe]}ye(xe,["default-code"]),ye(me([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[E,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ye(me([[a,/^[\s]+/,null,` \r
|
|
`],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[B,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ye(me([],[[W,/^[\s\S]+/]]),["uq.val"]),ye(ke({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ye(ke({keywords:"null,true,false"}),["json"]),ye(ke({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ye(ke({keywords:I,cStyleComments:!0}),["java"]),ye(ke({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(ke({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(ke({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(ke({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(ke({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(ke({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ye(me([],[[g,/^[\s\S]+/]]),["regex"]);function s(oe){var be=oe.langExtension;try{var we=N(oe.sourceNode,oe.pre),Oe=we.sourceCode;oe.sourceCode=Oe,oe.spans=we.spans,oe.basePos=0,z(be,Oe)(oe),Se(oe)}catch(Le){H.console&&console.log(Le&&Le.stack||Le)}}function f(oe,be,we){var Oe=we||!1,Le=be||null,De=document.createElement("div");De.innerHTML="<pre>"+oe+"</pre>",De=De.firstChild,Oe&&Re(De,Oe,!0);var _e={langExtension:Le,numberLines:Oe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return s(_e),De.innerHTML}function D(oe,be){var we=be||document.body,Oe=we.ownerDocument||document;function Le(ae){return we.getElementsByTagName(ae)}for(var De=[Le("pre"),Le("code"),Le("xmp")],_e=[],Ne=0;Ne<De.length;++Ne)for(var Ge=0,He=De[Ne].length;Ge<He;++Ge)_e.push(De[Ne][Ge]);De=null;var ze=Date;ze.now||(ze={now:function(){return+new Date}});var nt=0,Ye=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,rt=/pre|xmp/i,Qe=/^code$/i,se=/^(?:pre|code|xmp)$/i,ee={};function q(){for(var ae=H.PR_SHOULD_USE_CONTINUATION?ze.now()+250:Infinity;nt<_e.length&&ze.now()<ae;nt++){for(var le=_e[nt],te=ee,ie=le;ie=ie.previousSibling;){var he=ie.nodeType,ce=(he===7||he===8)&&ie.nodeValue;if(ce?!/^\??prettify\b/.test(ce):he!==3||/\S/.test(ie.nodeValue))break;if(ce){te={},ce.replace(/\b(\w+)=([\w:.%+-]+)/g,function(_t,Et,mr){te[Et]=mr});break}}var ve=le.className;if((te!==ee||Xe.test(ve))&&!Pe.test(ve)){for(var Ee=!1,Me=le.parentNode;Me;Me=Me.parentNode){var We=Me.tagName;if(se.test(We)&&Me.className&&Xe.test(Me.className)){Ee=!0;break}}if(!Ee){le.className+=" prettyprinted";var qe=te.lang;if(!qe){qe=ve.match(Ye);var tt;!qe&&(tt=ue(le))&&Qe.test(tt.tagName)&&(qe=tt.className.match(Ye)),qe&&(qe=qe[1])}var vt;if(rt.test(le.tagName))vt=1;else{var ot=le.currentStyle,it=Oe.defaultView,wt=ot?ot.whiteSpace:it&&it.getComputedStyle?it.getComputedStyle(le,null).getPropertyValue("white-space"):0;vt=wt&&wt.substring(0,3)==="pre"}var xt=te.linenums;(xt=xt==="true"||+xt)||(xt=ve.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&Re(le,xt,vt);var It={langExtension:qe,sourceNode:le,numberLines:xt,pre:vt,sourceCode:null,basePos:null,spans:null,decorations:null};s(It)}}}nt<_e.length?H.setTimeout(q,250):typeof oe=="function"&&oe()}q()}var X=H.PR={createSimpleLexer:me,registerLangHandler:ye,sourceDecorator:ke,PR_ATTRIB_NAME:B,PR_ATTRIB_VALUE:W,PR_COMMENT:E,PR_DECLARATION:m,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:V,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:x,PR_STRING:g,PR_TAG:y,PR_TYPE:p,prettyPrintOne:O?H.prettyPrintOne=f:R=f,prettyPrint:G=O?H.prettyPrint=D:G=D},F=H.define;typeof F=="function"&&F.amd&&F("google-code-prettify",[],function(){return X})})()},STEk:function(dt,Je,de){"use strict";de.d(Je,"a",function(){return ye});/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var fe=function(z,s){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,D){f.__proto__=D}||function(f,D){for(var X in D)Object.prototype.hasOwnProperty.call(D,X)&&(f[X]=D[X])})(z,s)};function Z(z,s){function f(){this.constructor=z}fe(z,s),z.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}function O(z,s,f,D){return new(f||(f=Promise))(function(X,F){function oe(Oe){try{we(D.next(Oe))}catch(Le){F(Le)}}function be(Oe){try{we(D.throw(Oe))}catch(Le){F(Le)}}function we(Oe){var Le;Oe.done?X(Oe.value):(Le=Oe.value,Le instanceof f?Le:new f(function(De){De(Le)})).then(oe,be)}we((D=D.apply(z,s||[])).next())})}function J(z,s){var f,D,X,F,oe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return F={next:be(0),throw:be(1),return:be(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function be(we){return function(Oe){return function(Le){if(f)throw new TypeError("Generator is already executing.");for(;oe;)try{if(f=1,D&&(X=2&Le[0]?D.return:Le[0]?D.throw||((X=D.return)&&X.call(D),0):D.next)&&!(X=X.call(D,Le[1])).done)return X;switch(D=0,X&&(Le=[2&Le[0],X.value]),Le[0]){case 0:case 1:X=Le;break;case 4:return oe.label++,{value:Le[1],done:!1};case 5:oe.label++,D=Le[1],Le=[0];continue;case 7:Le=oe.ops.pop(),oe.trys.pop();continue;default:if(!(X=oe.trys,(X=X.length>0&&X[X.length-1])||Le[0]!==6&&Le[0]!==2)){oe=0;continue}if(Le[0]===3&&(!X||Le[1]>X[0]&&Le[1]<X[3])){oe.label=Le[1];break}if(Le[0]===6&&oe.label<X[1]){oe.label=X[1],X=Le;break}if(X&&oe.label<X[2]){oe.label=X[2],oe.ops.push(Le);break}X[2]&&oe.ops.pop(),oe.trys.pop();continue}Le=s.call(z,oe)}catch(De){Le=[6,De],D=0}finally{f=X=0}if(5&Le[0])throw Le[1];return{value:Le[0]?Le[1]:void 0,done:!0}}([we,Oe])}}}function U(){for(var z=0,s=0,f=arguments.length;s<f;s++)z+=arguments[s].length;var D=Array(z),X=0;for(s=0;s<f;s++)for(var F=arguments[s],oe=0,be=F.length;oe<be;oe++,X++)D[X]=F[oe];return D}var R=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,f){for(var D=0,X=f;D<X.length;D++){var F=X[D],oe=F[0],be=F[1];s.setAttribute(oe,be)}},z.createRect=function(s,f,D){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",f.toString()),D&&z.setAttributes(X,D),X},z.createLine=function(s,f,D,X,F){var oe=document.createElementNS("http://www.w3.org/2000/svg","line");return oe.setAttribute("x1",s.toString()),oe.setAttribute("y1",f.toString()),oe.setAttribute("x2",D.toString()),oe.setAttribute("y2",X.toString()),F&&z.setAttributes(oe,F),oe},z.createPolygon=function(s,f){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",s),f&&z.setAttributes(D,f),D},z.createCircle=function(s,f){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(s/2).toString()),D.setAttribute("cy",(s/2).toString()),D.setAttribute("r",s.toString()),f&&z.setAttributes(D,f),D},z.createEllipse=function(s,f,D){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(f/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(f/2).toString()),D&&z.setAttributes(X,D),X},z.createGroup=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(f,s),f},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,f,D,X,F,oe,be){var we=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(we,[["id",s],["orient",f],["markerWidth",D.toString()],["markerHeight",X.toString()],["refX",F.toString()],["refY",oe.toString()]]),we.appendChild(be),we},z.createText=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),s&&z.setAttributes(f,s),f},z.createTSpan=function(s,f){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=s,f&&z.setAttributes(D,f),D},z.createImage=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(f,s),f},z.createPoint=function(s,f){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=s,D.y=f,D},z.createPath=function(s,f){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",s),f&&z.setAttributes(D,f),D},z}(),G=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),H=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,f,D){var X=this;return new Promise(function(F){var oe=D!==void 0?D:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("width",f.width.baseVal.valueAsString),be.setAttribute("height",f.height.baseVal.valueAsString),be.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),be.innerHTML=f.innerHTML,X.naturalSize===!0?(be.width.baseVal.value=s.naturalWidth,be.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(be.width.baseVal.value=X.width,be.height.baseVal.value=X.height),oe.width=be.width.baseVal.value,oe.height=be.height.baseVal.value;var we=be.outerHTML,Oe=oe.getContext("2d");X.markersOnly!==!0&&Oe.drawImage(s,0,0,oe.width,oe.height);var Le=window.URL,De=new Image(oe.width,oe.height);De.setAttribute("crossOrigin","anonymous");var _e=new Blob([we],{type:"image/svg+xml"}),Ne=Le.createObjectURL(_e);De.onload=function(){Oe.drawImage(De,0,0),Le.revokeObjectURL(Ne);var Ge=oe.toDataURL(X.imageType,X.imageQuality);F(Ge)},De.src=Ne})},z}(),M=function(){},_=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new b("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new A("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new A("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),b=function(z,s){this.selector=z,this.style=s},A=function(z,s){this.localName=z,this.style=s},I=function(){function z(s,f,D,X,F){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=f,this.markerItems=D,this.uiStyleSettings=X,this.styles=F,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(s){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(F){var oe=document.createElement("div");oe.className=""+f.toolbarButtonStyleClass.name,oe.setAttribute("data-type-name",F.typeName),oe.innerHTML=F.icon,oe.addEventListener("click",function(){f.markerToolbarButtonClicked(oe,F)}),f.buttons.push(oe),f.markerButtons.push(oe)}),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 X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<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(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<s||f===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},z.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},z.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(f){f.className=f.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,f,D){var X=this,F=document.createElement("div");switch(F.className=""+this.toolbarButtonStyleClass.name,F.innerHTML=f,F.setAttribute("data-action",D),F.addEventListener("click",function(){X.actionToolbarButtonClicked(F,D)}),D){case"select":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":F.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":F.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":F.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(F),this.buttons.push(F)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new A("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 A("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new A("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new A("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 A("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new A("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new A("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new A("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},z.prototype.markerToolbarButtonClicked=function(s,f){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var f=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===s});f&&this.setActiveButton(f)},z.prototype.setCurrentMarker=function(s){var f=this;this.currentMarker=s,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){f.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},z}(),k=function(){function z(s,f,D,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=f,this.uiStyleSettings=D,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new A("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 A("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new A("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new A("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new A("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 A("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new A("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 A("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new A("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},z.prototype.show=function(s){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var f,D,X=this;this.panels=s,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+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var oe;F.uiStyleSettings=X.uiStyleSettings;var be=document.createElement("div");be.className=X.toolboxButtonStyleClass.name+" "+((oe=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&oe!==void 0?oe:X.toolboxButtonStyleColorsClass.name),be.innerHTML=F.icon,be.title=F.title,be.addEventListener("click",function(){X.panelButtonClick(F)}),X.panelButtons.push(be),X.buttonRow.appendChild(be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var f=this,D=-1;if(s!==this.activePanel){D=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(F,oe){var be,we;F.className=f.toolboxButtonStyleClass.name+" "+(oe===D?""+((be=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&be!==void 0?be:f.toolboxActiveButtonStyleColorsClass.name):""+((we=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&we!==void 0?we:f.toolboxButtonStyleColorsClass.name))})},z}(),w=function(z,s){this.title=z,this.icon=s},C=function(z){function s(f,D,X,F){var oe=z.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return oe.colors=[],oe.addTransparent=!1,oe.colorBoxes=[],oe.colors=D,oe.currentColor=X,oe.setCurrentColor=oe.setCurrentColor.bind(oe),oe.getColorBox=oe.getColorBox.bind(oe),oe}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(X){var F=f.getColorBox(X);D.appendChild(F),f.colorBoxes.push(F)}),D},s.prototype.getColorBox=function(f){var D=this,X=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-X,oe=document.createElement("div");oe.style.display="inline-block",oe.style.boxSizing="content-box",oe.style.width=F-2+"px",oe.style.height=F-2+"px",oe.style.padding="1px",oe.style.marginRight="2px",oe.style.marginBottom="2px",oe.style.borderWidth="2px",oe.style.borderStyle="solid",oe.style.borderRadius=(F+2)/2+"px",oe.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",oe.addEventListener("click",function(){D.setCurrentColor(f,oe)});var be=document.createElement("div");return be.style.display="inline-block",be.style.width=F-2+"px",be.style.height=F-2+"px",be.style.backgroundColor=f,be.style.borderRadius=F/2+"px",f==="transparent"&&(be.style.fill=this.uiStyleSettings.toolboxAccentColor,be.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),oe.appendChild(be),oe},s.prototype.setCurrentColor=function(f,D){var X=this;this.currentColor=f,this.colorBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},s}(w),d=function(){function z(s,f,D){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=f,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(s){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(s,f){},z.prototype.dblClick=function(s,f){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,f){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),o=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),l=function(){function z(){this.GRIP_SIZE=10,this.visual=R.createGroup(),this.visual.appendChild(R.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(R.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),h=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,f){return s.a=f.a,s.b=f.b,s.c=f.c,s.d=f.d,s.e=f.e,s.f=f.f,s},z}(),T=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(R.createTransform()),F.setupControlBox(),F}return Z(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var D=R.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),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 X=this.unrotatePoint(f);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var oe=this.container.transform.baseVal.getItem(0);oe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(oe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(f){var D=this.state;z.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",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},s.prototype.manipulate=function(f){var D=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(f)},s.prototype.resize=function(f){var D=this.manipulationStartLeft,X=this.manipulationStartWidth,F=this.manipulationStartTop,oe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+f.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+f.y-this.manipulationStartY,oe=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:oe=this.manipulationStartHeight+f.y-this.manipulationStartY}X>=0?(this.left=D,this.width=X):(this.left=D+X,this.width=-X),oe>=0?(this.top=F,this.height=oe):(this.top=F+oe,this.height=-oe),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var D=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},s.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)},s.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var D=this.container.getCTM(),X=R.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},s.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var D=this.container.getCTM();D=D.inverse();var X=R.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=R.createGroup();var f=R.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=R.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=R.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new o,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var 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()},s.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var f=new l;return f.visual.transform.baseVal.appendItem(R.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,D=-f/2,X=D,F=(this.width+this.CB_DISTANCE)/2-f/2,oe=(this.height+this.CB_DISTANCE)/2-f/2,be=this.height+this.CB_DISTANCE-f/2,we=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,D,X),this.positionGrip(this.controlGrips.topCenter.visual,F,X),this.positionGrip(this.controlGrips.topRight.visual,we,X),this.positionGrip(this.controlGrips.centerLeft.visual,D,oe),this.positionGrip(this.controlGrips.centerRight.visual,we,oe),this.positionGrip(this.controlGrips.bottomLeft.visual,D,be),this.positionGrip(this.controlGrips.bottomCenter.visual,F,be),this.positionGrip(this.controlGrips.bottomRight.visual,we,be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(f,D,X){var F=f.transform.baseVal.getItem(0);F.setTranslate(D,X),f.transform.baseVal.replaceItem(F,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:h.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:h.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(h.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(h.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D);var X=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:X.x*f,y:X.y*D});this.left=F.x,this.top=F.y,this.width=this.width*f,this.height=this.height*D,this.adjustControlBox()},s}(d),v=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=R.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){z.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&R.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&R.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&R.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&R.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){var D=f;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setSize()},s.title="Rectangle marker",s}(T),g=function(z){function s(f,D,X,F){var oe=z.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return oe.widths=[],oe.widthBoxes=[],oe.widths=D,oe.currentWidth=X,oe.setCurrentWidth=oe.setCurrentWidth.bind(oe),oe}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(X){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=X===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentWidth(X,F)}),D.appendChild(F);var oe=document.createElement("div");oe.innerText=X.toString(),oe.style.marginRight="5px",F.appendChild(oe);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.display="flex",be.style.alignItems="center";var we=document.createElement("hr");we.style.minWidth="20px",we.style.border="0px",we.style.borderTop=X+"px solid "+f.uiStyleSettings.toolboxColor,we.style.flexGrow="2",be.appendChild(we),F.appendChild(be),f.widthBoxes.push(F)}),D},s.prototype.setCurrentWidth=function(f,D){var X=this;this.currentWidth=f,this.widthBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(w),L=function(z){function s(f,D,X,F){var oe=z.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return oe.styles=[],oe.styleBoxes=[],oe.styles=D,oe.currentStyle=X,oe.setCurrentStyle=oe.setCurrentStyle.bind(oe),oe}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(X){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/f.styles.length-5+"%",F.style.borderColor=X===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentStyle(X,F)}),D.appendChild(F);var oe=document.createElement("div");oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.overflow="hidden";var be=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
|
|
</svg>`;oe.innerHTML=be,F.appendChild(oe),f.styleBoxes.push(F)}),D},s.prototype.setCurrentStyle=function(f,D){var X=this;this.currentStyle=f,this.styleBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(w),E=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.strokeColor=X.defaultColor,F.strokeWidth=X.defaultStrokeWidth,F.strokeDasharray=X.defaultStrokeDasharray,F.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new g("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(v),p=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},c=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return Z(s,z),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),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(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(f){var D=this.state;z.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",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.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)},s.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()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=R.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var f=new l;return f.visual.transform.baseVal.appendItem(R.createTransform()),this.controlBox.appendChild(f.visual),f},s.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)},s.prototype.positionGrip=function(f,D,X){var F=f.transform.baseVal.getItem(0);F.setTranslate(D,X),f.transform.baseVal.replaceItem(F,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.x1=this.x1*f,this.y1=this.y1*D,this.x2=this.x2*f,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},s}(d),u=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=X.defaultColor,F.strokeWidth=X.defaultStrokeWidth,F.strokeDasharray=X.defaultStrokeDasharray,F.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new g("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=R.createGroup(),this.selectorLine=R.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=R.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),R.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),R.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),R.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(c),a=function(z){function s(f,D,X,F){var oe=z.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return oe.fonts=[],oe.fontBoxes=[],oe.fonts=D,oe.currentFont=X,oe.setCurrentFont=oe.setCurrentFont.bind(oe),oe}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(X){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/f.fonts.length-5+"%",F.style.borderColor=X===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentFont(X,F)}),D.appendChild(F);var oe=document.createElement("div");oe.style.display="flex",oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.fontFamily=X,oe.style.overflow="hidden";var be=document.createElement("div");be.style.whiteSpace="nowrap",be.style.overflow="hidden",be.style.textOverflow="ellipsis",be.innerHTML="The quick brown fox jumps over the lazy dog",oe.appendChild(be),F.appendChild(oe),f.fontBoxes.push(F)}),D},s.prototype.setCurrentFont=function(f,D){var X=this;this.currentFont=f,this.fontBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(w),y=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=X.defaultColor,F.fontFamily=X.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new C("Color",X.defaultColorSet,X.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return Z(s,z),s.prototype.ownsTarget=function(f){if(z.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(X){X===f&&(D=!0)}),D},s.prototype.createVisual=function(){this.visual=R.createGroup(),this.bgRectangle=R.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=R.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(R.createTransform()),this.textElement.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.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(D){f.textElement.appendChild(R.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var f=this.textElement.getBBox(),D=1;if(f.width>0&&f.height>0){var X=(1*this.width-this.width*this.padding*2/100)/f.width,F=(1*this.height-this.height*this.padding*2/100)/f.height;D=Math.min(X,F)}return D},s.prototype.getTextPosition=function(f){var D=this.textElement.getBBox(),X=0,F=0;return D.width>0&&D.height>0&&(X=(this.width-D.width*f)/2,F=this.height/2-D.height*f/2),{x:X,y:F}},s.prototype.sizeText=function(){var f=this.textElement.getBBox(),D=this.getTextScale(),X=this.getTextPosition(D);X.y-=f.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},s.prototype.manipulate=function(f){z.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)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(f){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,f),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.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(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&D>.9;)D-=.1,f.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var X=D.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode(X)),D.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")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),F={x:X.width*f,y:X.height*f};D.x-=F.x/2,D.y-=F.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},s.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()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(f,D){z.prototype.dblClick.call(this,f,D),this.showTextEditor()},s.prototype.setColor=function(f){this.textElement&&R.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},s.prototype.setFont=function(f){this.textElement&&R.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var D=f;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',s}(T),m=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=X.defaultColor,F.lineWidth=X.defaultStrokeWidth,F.pixelRatio=X.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new C("Color",X.defaultColorSet,X.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new g("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=R.createGroup(),this.drawingImage=R.createImage(),this.visual.appendChild(this.drawingImage);var f=R.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){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):z.prototype.pointerDown.call(this,f,D)},s.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,f)},s.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=D[0],F=D[1],oe=D[2],be=D[3],we=!1,Oe=0;Oe<this.canvasElement.height;Oe++)for(var Le=0;Le<this.canvasElement.width;Le++)f.data[Oe*this.canvasElement.width*4+4*Le+3]>0&&(we=!0,Oe<F&&(F=Oe),Le<X&&(X=Le),Oe>be&&(be=Oe),Le>oe&&(oe=Le));if(we){this.left=X/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(oe-X)/this.pixelRatio,this.height=(be-F)/this.pixelRatio;var De=document.createElement("canvas");De.width=oe-X,De.height=be-F,De.getContext("2d").putImageData(this.canvasContext.getImageData(X,F,oe-X,be-F),0,0),this.drawingImgUrl=De.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){R.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},s.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){this.createVisual(),z.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',s}(T),x=function(z){function s(f,D,X){var F=z.call(this,f,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return F.typeBoxes=[],F.currentType=D,F.setCurrentType=F.setCurrentType.bind(F),F}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var X=function(be){var we="both";switch(be){case 0:we="both";break;case 1:we="start";break;case 2:we="end";break;case 3:we="none"}var Oe=document.createElement("div");if(Oe.style.display="flex",Oe.style.flexGrow="2",Oe.style.alignItems="center",Oe.style.justifyContent="space-between",Oe.style.padding="5px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderColor=we===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){f.setCurrentType(we,Oe)}),D.appendChild(Oe),we==="both"||we==="start"){var Le=document.createElement("div");Le.style.display="flex",Le.style.alignItems="center",Le.style.minHeight="20px",Le.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Le.style.marginLeft="5px",Oe.appendChild(Le)}var De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.style.flexGrow="2";var _e=document.createElement("hr");if(_e.style.minWidth="20px",_e.style.border="0px",_e.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),_e.style.flexGrow="2",De.appendChild(_e),Oe.appendChild(De),we==="both"||we==="end"){var Ne=document.createElement("div");Ne.style.display="flex",Ne.style.alignItems="center",Ne.style.minHeight="20px",Ne.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ne.style.marginRight="5px",Oe.appendChild(Ne)}F.typeBoxes.push(Oe)},F=this,oe=0;oe<4;oe++)X(oe);return D},s.prototype.setCurrentType=function(f,D){var X=this;this.currentType=f,this.typeBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(w),B=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new x("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},s.prototype.getArrowPoints=function(f,D){var X=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return f-X/2+","+(D+F/2)+" "+f+","+(D-F/2)+" "+(f+X/2)+","+(D+F/2)},s.prototype.createTips=function(){this.arrow1=R.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=R.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",R.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),R.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),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(u),W=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.fillColor=X.defaultFillColor,F.strokeWidth=0,F.fillPanel=new C("Color",X.defaultColorSet,X.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(v),V=function(z){function s(f,D,X,F){var oe=z.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return oe.opacities=[],oe.opacityBoxes=[],oe.opacities=D,oe.currentOpacity=X,oe.setCurrentOpacity=oe.setCurrentOpacity.bind(oe),oe}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(X){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=X===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentOpacity(X,F)}),D.appendChild(F);var oe=document.createElement("div");oe.innerText=100*X+"%",F.appendChild(oe),f.opacityBoxes.push(F)}),D},s.prototype.setCurrentOpacity=function(f,D){var X=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(w),K=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=X.defaultHighlightColor,F.strokeWidth=0,F.opacity=X.defaultHighlightOpacity,F.fillPanel=new C("Color",X.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new V("Opacity",X.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Z(s,z),s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&R.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',s}(W),P='<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>',N=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=X.defaultStrokeColor,F.bgColor=X.defaultFillColor,F.fontFamily=X.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new C("Text color",X.defaultColorSet,F.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new C("Fill color",X.defaultColorSet,F.bgColor,P),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new l,F.tipGrip.visual.transform.baseVal.appendItem(R.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return Z(s,z),s.prototype.ownsTarget=function(f){return z.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},s.prototype.createTip=function(){R.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=R.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(f,D){this.state==="new"&&z.prototype.pointerDown.call(this,f,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,f,D)},s.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,f);else{var D=this.state==="creating";z.prototype.pointerUp.call(this,f),this.setTipPoints(D),this.positionTip()}},s.prototype.manipulate=function(f){if(this.tipMoving){var D=this.unrotatePoint(f);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,f)},s.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(R.setAttributes(this.bgRectangle,[["fill",f]]),R.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var D=Math.min(this.height/2,15),X=this.height/5;f&&(this.tipPosition={x:D+X/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+X,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-X,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?F<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-X,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-X},this.tipBase2Position={x:this.width,y:this.height-D}):F<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-X})},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.positionTip()},s.prototype.positionTip=function(){R.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(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var D=f;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,z.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*D},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',s}(y),$=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.strokeColor=X.defaultColor,F.strokeWidth=X.defaultStrokeWidth,F.strokeDasharray=X.defaultStrokeDasharray,F.fillColor=X.defaultFillColor,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.setOpacity=F.setOpacity.bind(F),F.createVisual=F.createVisual.bind(F),F.strokePanel=new C("Line color",U(X.defaultColorSet,["transparent"]),X.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.fillPanel=new C("Fill color",U(X.defaultColorSet,["transparent"]),F.fillColor,P),F.fillPanel.onColorChanged=F.setFillColor,F.strokeWidthPanel=new g("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F.opacityPanel=new V("Opacity",X.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=R.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),R.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(f){z.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&R.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&R.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&R.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&R.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&R.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var D=f;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(T),ne=function(z){function s(f,D,X){return z.call(this,f,D,X)||this}return Z(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},s.prototype.createTips=function(){this.tip1=R.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(R.createTransform()),this.visual.appendChild(this.tip1),this.tip2=R.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(R.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(R.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()]]),R.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),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(u),ue=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.strokePanel.colors=X.defaultColorSet,F.fillColor="transparent",F}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}($),me=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),ke=function(z){function s(f,D,X){var F=z.call(this,f,D,X)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=X.defaultColor,F.strokeWidth=X.defaultStrokeWidth,F.strokeDasharray=X.defaultStrokeDasharray,F.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new g("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=R.createGroup(),this.selectorCurve=R.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=R.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),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(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),R.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),R.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),R.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=R.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=R.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var 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()))},s.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),z.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)},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},s.prototype.scale=function(f,D){this.curveX=this.curveX*f,this.curveY=this.curveY*D,z.prototype.scale.call(this,f,D)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',s}(c),xe=function(){function z(s,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=f}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Re=function(z){function s(f,D,X){var F=z.call(this,f,!1)||this;return F.dataUrl=D,F.state=X,F}return Z(s,z),s}(xe),Se=function(z){function s(f,D,X){X===void 0&&(X=!1);var F=z.call(this,f,X)||this;return F.marker=D,F}return Z(s,z),s}(xe),Te=function(){function z(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return z.prototype.addEventListener=function(s,f){this[s].push(f)},z.prototype.removeEventListener=function(s,f){var D=this[s].indexOf(f);D>-1&&this[s].splice(D,1)},z}(),ye=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new p,this._isOpen=!1,this.undoRedoManager=new me,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Te,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new _(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[E,m,B,y,ue,$,K,N,ne,W,u,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[E,m,B,y,$,K,N]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[E,m,B,y,K]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var f=this;this._availableMarkerTypes.splice(0),s.forEach(function(D){if(typeof D=="string"){var X=f.ALL_MARKER_TYPES.find(function(F){return F.typeName===D});X!==void 0&&f._availableMarkerTypes.push(X)}else f._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),G.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&M.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=M.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new xe(s))})},z.prototype.render=function(){return O(this,void 0,void 0,function(){var s;return J(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(s=new H).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},z.prototype.close=function(s){var f=this;if(s===void 0&&(s=!1),this.isOpen){var D=!1;s||this.eventListeners.beforeclose.forEach(function(X){var F=new xe(f,!0);X(F),F.defaultPrevented&&(D=!0)}),D||(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(X){return X(new xe(f))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,f=[],D=0;D<arguments.length;D++)f[D]=arguments[D];(s=this._availableMarkerTypes).push.apply(s,f)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(f){s(f.dataUrl,f.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,D=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(f,D)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,f){this._isResizing=!0;var D=s/this.imageWidth,X=f/this.imageHeight;this.imageWidth=Math.round(s),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(D,X),this._isResizing=!1},z.prototype.scaleMarkers=function(s,f){var D,X=this;this._currentMarker&&this._currentMarker instanceof y?this._currentMarker.scale(s,f):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(F){F!==X._currentMarker&&F.scale(s,f)}),D!==void 0&&this.setCurrentMarker(D)},z.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},z.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=s.left-f.left,this.top=s.top-f.top},z.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},z.prototype.addDefs=function(){for(var s,f=[],D=0;D<arguments.length;D++)f[D]=arguments[D];this.defs=R.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,f)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},z.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new I(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new k(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},z.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},z.prototype.toolbarButtonClicked=function(s,f){if(s==="marker"&&f!==void 0)this.createNewMarker(f);else if(s==="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()}},z.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var F=new Se(s,s._currentMarker,!0);X(F),F.defaultPrevented&&(f=!0)}),!f){var D=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(X){return X(new Se(s,D))})}}},z.prototype.clear=function(){var s=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(oe){var be=new Se(s,void 0,!0);oe(be),be.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var D=function(oe){var be=X.markers[oe];X.setCurrentMarker(X.markers[oe]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(we){return we(new Se(s,be))})},X=this,F=this.markers.length-1;F>=0;F--)D(F);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===f.width&&D.height===f.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(F){return F(new xe(s))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(F){return F(new xe(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new xe(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new xe(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return O(this,void 0,void 0,function(){var s,f,D=this;return J(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),f=this.getState(),this.eventListeners.render.forEach(function(F){return F(new Re(D,s,f))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return f.markers.push(D.getState())}),f},z.prototype.restoreState=function(s){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(D){var X=f._availableMarkerTypes.find(function(oe){return oe.typeName===D.typeName});if(X!==void 0){var F=f.addNewMarker(X);F.restoreState(D),f.markers.push(F)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(D){return D(new xe(f))})},z.prototype.addNewMarker=function(s){var f=R.createGroup();return this.markerImage.appendChild(f),new s(f,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var f,D=this;(f=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(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(X){return X(new Se(D,D._currentMarker))}))},z.prototype.markerCreated=function(s){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof m&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(m):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new Se(f,f._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var f=this;this.eventListeners.markerchange.forEach(function(D){return D(new Se(f,s))})},z.prototype.setCurrentMarker=function(s){var f=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new Se(f,f._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(D){return D(new Se(f,f._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(D){return D.ownsTarget(s.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(D){return D.ownsTarget(s.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,f){var D=this.markerImage.getBoundingClientRect();return{x:(s-D.left)/this.zoomLevel,y:(f-D.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},z.prototype.addLicenseKey=function(s){G.addKey(s)},z.prototype.addEventListener=function(s,f){this.eventListeners.addEventListener(s,f)},z.prototype.removeEventListener=function(s,f){this.eventListeners.removeEventListener(s,f)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new xe(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new xe(s))}))},z.instanceCounter=0,z}()},"VrN/":function(dt,Je,de){(function(fe,Z){dt.exports=Z()})(this,function(){"use strict";var fe=navigator.userAgent,Z=navigator.platform,O=/gecko\/\d/i.test(fe),J=/MSIE \d/.test(fe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe),R=/Edge\/(\d+)/.exec(fe),G=J||U||R,H=G&&(J?document.documentMode||6:+(R||U)[1]),M=!R&&/WebKit\//.test(fe),_=M&&/Qt\/\d+\.\d+/.test(fe),b=!R&&/Chrome\//.test(fe),A=/Opera\//.test(fe),I=/Apple Computer/.test(navigator.vendor),k=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fe),w=/PhantomJS/.test(fe),C=!R&&/AppleWebKit/.test(fe)&&/Mobile\/\w+/.test(fe),d=/Android/.test(fe),o=C||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fe),l=C||/Mac/.test(Z),h=/\bCrOS\b/.test(fe),T=/win/i.test(Z),v=A&&fe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,M=!0);var g=l&&(_||A&&(v==null||v<12.11)),L=O||G&&H>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=function(e,t){var i=e.className,r=E(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 c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)n.appendChild(t[S]);return n}function y(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var m;document.createRange?m=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:m=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function 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 W(e,t){var i=e.className;E(t).test(i)||(e.className+=(i?" ":"")+t)}function V(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!E(i[r]).test(t)&&(t+=" "+i[r]);return t}var K=function(e){e.select()};C?K=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(K=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 N(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,j=n||0;;){var Y=e.indexOf(" ",S);if(Y<0||Y>=t)return j+(t-S);j+=Y-S,j+=i-j%i,S=Y+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};ne.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ne.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ue(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var me=50,ke={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},Re={origin:"*mouse"},Se={origin:"+move"};function Te(e,t,i){for(var r=0,n=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var j=S-r;if(S==e.length||n+j>=t)return r+Math.min(j,t-n);if(n+=S-r,n+=i-n%i,r=S+1,n>=t)return r}}var ye=[""];function z(e){for(;ye.length<=e;)ye.push(s(ye)+" ");return ye[e]}function s(e){return e[e.length-1]}function f(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function D(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function X(){}function F(e,t){var i;return Object.create?i=Object.create(e):(X.prototype=e,i=new X),t&&N(t,i),i}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Le=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Le.test(e)}function _e(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Ne(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,S=r<0?Math.ceil(n):Math.floor(n);if(S==t)return e(S)?t:i;e(S)?i=S:t=S+r}}function Ge(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,S=0;S<e.length;++S){var j=e[S];(j.from<i&&j.to>t||t==i&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,i),j.level==1?"rtl":"ltr",S),n=!0)}n||r(t,i,"ltr")}var He=null;function ze(e,t,i){var r;He=null;for(var n=0;n<e.length;++n){var S=e[n];if(S.from<t&&S.to>t)return n;S.to==t&&(S.from!=S.to&&i=="before"?r=n:He=n),S.from==t&&(S.from!=S.to&&i!="before"?r=n:He=n)}return r!=null?r:He}var nt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,S=/[LRr]/,j=/[Lb1n]/,Y=/[1n]/;function Q(re,pe,ge){this.level=re,this.from=pe,this.to=ge}return function(re,pe){var ge=pe=="ltr"?"L":"R";if(re.length==0||pe=="ltr"&&!r.test(re))return!1;for(var Ae=re.length,Ce=[],Ie=0;Ie<Ae;++Ie)Ce.push(i(re.charCodeAt(Ie)));for(var Fe=0,je=ge;Fe<Ae;++Fe){var Ke=Ce[Fe];Ke=="m"?Ce[Fe]=je:je=Ke}for(var Ze=0,Ve=ge;Ze<Ae;++Ze){var et=Ce[Ze];et=="1"&&Ve=="r"?Ce[Ze]="n":S.test(et)&&(Ve=et,et=="r"&&(Ce[Ze]="R"))}for(var ut=1,st=Ce[0];ut<Ae-1;++ut){var gt=Ce[ut];gt=="+"&&st=="1"&&Ce[ut+1]=="1"?Ce[ut]="1":gt==","&&st==Ce[ut+1]&&(st=="1"||st=="n")&&(Ce[ut]=st),st=gt}for(var Ot=0;Ot<Ae;++Ot){var Vt=Ce[Ot];if(Vt==",")Ce[Ot]="N";else if(Vt=="%"){var Nt=void 0;for(Nt=Ot+1;Nt<Ae&&Ce[Nt]=="%";++Nt);for(var pr=Ot&&Ce[Ot-1]=="!"||Nt<Ae&&Ce[Nt]=="1"?"1":"N",ur=Ot;ur<Nt;++ur)Ce[ur]=pr;Ot=Nt-1}}for(var jt=0,hr=ge;jt<Ae;++jt){var Qt=Ce[jt];hr=="L"&&Qt=="1"?Ce[jt]="L":S.test(Qt)&&(hr=Qt)}for(var Gt=0;Gt<Ae;++Gt)if(n.test(Ce[Gt])){var Wt=void 0;for(Wt=Gt+1;Wt<Ae&&n.test(Ce[Wt]);++Wt);for(var Ft=(Gt?Ce[Gt-1]:ge)=="L",dr=(Wt<Ae?Ce[Wt]:ge)=="L",Gi=Ft==dr?Ft?"L":"R":ge,ei=Gt;ei<Wt;++ei)Ce[ei]=Gi;Gt=Wt-1}for(var tr=[],Ir,Xt=0;Xt<Ae;)if(j.test(Ce[Xt])){var Va=Xt;for(++Xt;Xt<Ae&&j.test(Ce[Xt]);++Xt);tr.push(new Q(0,Va,Xt))}else{var Gr=Xt,vi=tr.length,yi=pe=="rtl"?1:0;for(++Xt;Xt<Ae&&Ce[Xt]!="L";++Xt);for(var nr=Gr;nr<Xt;)if(Y.test(Ce[nr])){Gr<nr&&(tr.splice(vi,0,new Q(1,Gr,nr)),vi+=yi);var zi=nr;for(++nr;nr<Xt&&Y.test(Ce[nr]);++nr);tr.splice(vi,0,new Q(2,zi,nr)),vi+=yi,Gr=nr}else++nr;Gr<Xt&&tr.splice(vi,0,new Q(1,Gr,Xt))}return pe=="ltr"&&(tr[0].level==1&&(Ir=re.match(/^\s+/))&&(tr[0].from=Ir[0].length,tr.unshift(new Q(0,0,Ir[0].length))),s(tr).level==1&&(Ir=re.match(/\s+$/))&&(s(tr).to-=Ir[0].length,tr.push(new Q(0,Ae-Ir[0].length,Ae)))),pe=="rtl"?tr.reverse():tr}}();function Ye(e,t){var i=e.order;return i==null&&(i=e.order=nt(e.text,t)),i}var Xe=[],Pe=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]||Xe).concat(i)}};function rt(e,t){return e._handlers&&e._handlers[t]||Xe}function Qe(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var S=ue(n,i);S>-1&&(r[t]=n.slice(0,S).concat(n.slice(S+1)))}}}function se(e,t){var i=rt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function ee(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),se(e,i||t.type,e,t),he(t)||t.codemirrorIgnore}function q(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)ue(i,t[r])==-1&&i.push(t[r])}function ae(e,t){return rt(e,t).length>0}function le(e){e.prototype.on=function(t,i){Pe(this,t,i)},e.prototype.off=function(t,i){Qe(this,t,i)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ce(e){te(e),ie(e)}function ve(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(G&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),We;function qe(e){if(We==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(We=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&H<8))}var i=We?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var tt;function vt(e){if(tt!=null)return tt;var t=u(e,document.createTextNode("A\u062EA")),i=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:tt=r.right-i.right<3}var ot=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
|
|
`,t);n==-1&&(n=e.length);var S=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),j=S.indexOf("\r");j!=-1?(i.push(S.slice(0,j)),t+=j+1):(i.push(S),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},it=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},wt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function It(e){if(xt!=null)return xt;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return xt=Math.abs(i.left-r.left)>1}var _t={},Et={};function mr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),_t[e]=t}function Tr(e,t){Et[e]=t}function Yt(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=F(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=Yt(t);var i=_t[t.name];if(!i)return gr(e,"text/plain");var r=i(e,t);if(cr.hasOwnProperty(t.name)){var n=cr[t.name];for(var S in n){if(!n.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=n[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var cr={};function zr(e,t){var i=cr.hasOwnProperty(e)?cr[e]:cr[e]={};N(t,i)}function $t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Nr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function ti(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(j){return i?j.toLowerCase():j},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function $e(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],S=n.chunkSize();if(t<S){i=n;break}t-=S}return i.lines[t]}function Tt(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(S){var j=S.text;n==i.line&&(j=j.slice(0,i.ch)),n==t.line&&(j=j.slice(t.ch)),r.push(j),++n}),r}function Zt(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function mt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function pt(e){if(e.parent==null)return null;for(var t=e.parent,i=ue(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 At(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],S=n.height;if(t<S){e=n;continue e}t-=S,i+=n.chunkSize()}return i}while(!e.lines);for(var j=0;j<e.lines.length;++j){var Y=e.lines[j],Q=Y.height;if(t<Q)break;t-=Q}return i+j}function vr(e,t){return t>=e.first&&t<e.first+e.size}function Ut(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Be(e,t,i){if(i===void 0&&(i=null),!(this instanceof Be))return new Be(e,t,i);this.line=e,this.ch=t,this.sticky=i}function ht(e,t){return e.line-t.line||e.ch-t.ch}function ri(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function bi(e){return Be(e.line,e.ch)}function xi(e,t){return ht(e,t)<0?t:e}function ii(e,t){return ht(e,t)<0?e:t}function Ei(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return Be(e.first,0);var i=e.first+e.size-1;return t.line>i?Be(i,$e(e,i).text.length):Ln(t,$e(e,t.line).text.length)}function Ln(e,t){var i=e.ch;return i==null||i>t?Be(e.line,t):i<0?Be(e.line,0):e}function Ue(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=ft(e,t[r]);return i}var Si=function(e,t){this.state=e,this.lookAhead=t},Er=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Er.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Er.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Er.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Er.fromSaved=function(e,t,i){return t instanceof Si?new Er(e,$t(e.mode,t.state),i,t.lookAhead):new Er(e,$t(e.mode,t),i)},Er.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Si(t,this.maxLookAhead):t};function Ki(e,t,i,r){var n=[e.state.modeGen],S={};Ar(e,t.text,e.doc.mode,i,function(re,pe){return n.push(re,pe)},S,r);for(var j=i.state,Y=function(re){i.baseTokens=n;var pe=e.state.overlays[re],ge=1,Ae=0;i.state=!0,Ar(e,t.text,pe.mode,i,function(Ce,Ie){for(var Fe=ge;Ae<Ce;){var je=n[ge];je>Ce&&n.splice(ge,1,Ce,n[ge+1],je),ge+=2,Ae=Math.min(Ce,je)}if(!Ie)return;if(pe.opaque)n.splice(Fe,ge-Fe,Ce,"overlay "+Ie),ge=Fe+2;else for(;Fe<ge;Fe+=2){var Ke=n[Fe+1];n[Fe+1]=(Ke?Ke+" ":"")+"overlay "+Ie}},S),i.state=j,i.baseTokens=null,i.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:n,classes:S.bgClass||S.textClass?S:null}}function ni(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Cr(e,pt(t)),n=t.text.length>e.options.maxHighlightLength&&$t(e.doc.mode,r.state),S=Ki(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Cr(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Er(r,!0,t);var S=Rn(e,t,i),j=S>r.first&&$e(r,S-1).stateAfter,Y=j?Er.fromSaved(r,j,S):new Er(r,ti(r.mode),S);return r.iter(S,t,function(Q){Vi(e,Q.text,Y);var re=Y.line;Q.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&re<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function Vi(e,t,i,r){var n=e.doc.mode,S=new Pt(t,e.options.tabSize,i);for(S.start=S.pos=r||0,t==""&&Xi(n,i.state);!S.eol();)wr(n,S,i.state),S.start=S.pos}function Xi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Nr(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function wr(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Nr(e,i).mode);var S=e.token(t,i);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yi=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function kn(e,t,i,r){var n=e.doc,S=n.mode,j;t=ft(n,t);var Y=$e(n,t.line),Q=Cr(e,t.line,i),re=new Pt(Y.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,j=wr(S,re,Q.state),r&&pe.push(new Yi(re,j,$t(n.mode,Q.state)));return r?pe:new Yi(re,j,Q.state)}function $i(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Ar(e,t,i,r,n,S,j){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,re=null,pe=new Pt(t,e.options.tabSize,r),ge,Ae=e.options.addModeClass&&[null];for(t==""&&$i(Xi(i,r.state),S);!pe.eol();){if(pe.pos>e.options.maxHighlightLength?(Y=!1,j&&Vi(e,t,r,pe.pos),pe.pos=t.length,ge=null):ge=$i(wr(i,pe,r.state,Ae),S),Ae){var Ce=Ae[0].name;Ce&&(ge="m-"+(ge?Ce+" "+ge:Ce))}if(!Y||re!=ge){for(;Q<pe.start;)Q=Math.min(pe.start,Q+5e3),n(Q,re);re=ge}pe.start=pe.pos}for(;Q<pe.pos;){var Ie=Math.min(pe.pos,Q+5e3);n(Ie,re),Q=Ie}}function Rn(e,t,i){for(var r,n,S=e.doc,j=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>j;--Y){if(Y<=S.first)return S.first;var Q=$e(S,Y-1),re=Q.stateAfter;if(re&&(!i||Y+(re instanceof Si?re.lookAhead:0)<=S.modeFrontier))return Y;var pe=$(Q.text,null,e.options.tabSize);(n==null||r>pe)&&(n=Y-1,r=pe)}return n}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=$e(e,r).stateAfter;if(n&&(!(n instanceof Si)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Zi=!1,rr=!1;function Kr(){Zi=!0}function oa(){rr=!0}function ai(e,t,i){this.marker=e,this.from=t,this.to=i}function Lr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Ji(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Dn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],j=S.marker,Y=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);if(Y||S.from==t&&j.type=="bookmark"&&(!i||!S.marker.insertLeft)){var Q=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new ai(j,S.from,Q?null:S.to))}}return r}function On(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],j=S.marker,Y=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);if(Y||S.from==t&&j.type=="bookmark"&&(!i||S.marker.insertLeft)){var Q=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new ai(j,Q?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Ti(e,t){if(t.full)return null;var i=vr(e,t.from.line)&&$e(e,t.from.line).markedSpans,r=vr(e,t.to.line)&&$e(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,S=t.to.ch,j=ht(t.from,t.to)==0,Y=Dn(i,n,j),Q=On(r,S,j),re=t.text.length==1,pe=s(t.text).length+(re?n:0);if(Y)for(var ge=0;ge<Y.length;++ge){var Ae=Y[ge];if(Ae.to==null){var Ce=Lr(Q,Ae.marker);Ce?re&&(Ae.to=Ce.to==null?null:Ce.to+pe):Ae.to=n}}if(Q)for(var Ie=0;Ie<Q.length;++Ie){var Fe=Q[Ie];if(Fe.to!=null&&(Fe.to+=pe),Fe.from==null){var je=Lr(Y,Fe.marker);je||(Fe.from=pe,re&&(Y||(Y=[])).push(Fe))}else Fe.from+=pe,re&&(Y||(Y=[])).push(Fe)}Y&&(Y=_n(Y)),Q&&Q!=Y&&(Q=_n(Q));var Ke=[Y];if(!re){var Ze=t.text.length-2,Ve;if(Ze>0&&Y)for(var et=0;et<Y.length;++et)Y[et].to==null&&(Ve||(Ve=[])).push(new ai(Y[et].marker,null,null));for(var ut=0;ut<Ze;++ut)Ke.push(Ve);Ke.push(Q)}return Ke}function _n(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Pn(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ce){if(Ce.markedSpans)for(var Ie=0;Ie<Ce.markedSpans.length;++Ie){var Fe=Ce.markedSpans[Ie].marker;Fe.readOnly&&(!r||ue(r,Fe)==-1)&&(r||(r=[])).push(Fe)}}),!r)return null;for(var n=[{from:t,to:i}],S=0;S<r.length;++S)for(var j=r[S],Y=j.find(0),Q=0;Q<n.length;++Q){var re=n[Q];if(ht(re.to,Y.from)<0||ht(re.from,Y.to)>0)continue;var pe=[Q,1],ge=ht(re.from,Y.from),Ae=ht(re.to,Y.to);(ge<0||!j.inclusiveLeft&&!ge)&&pe.push({from:re.from,to:Y.from}),(Ae>0||!j.inclusiveRight&&!Ae)&&pe.push({from:Y.to,to:re.to}),n.splice.apply(n,pe),Q+=pe.length-3}return n}function la(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Ci(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function oi(e){return e.inclusiveLeft?-1:0}function si(e){return e.inclusiveRight?1:0}function wi(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),S=ht(r.from,n.from)||oi(e)-oi(t);if(S)return-S;var j=ht(r.to,n.to)||si(e)-si(t);return j||t.id-e.id}function Fr(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=void 0,S=0;S<i.length;++S)n=i[S],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||wi(r,n.marker)<0)&&(r=n.marker);return r}function Br(e){return Fr(e,!0)}function Ur(e){return Fr(e,!1)}function Ai(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var S=i[n];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||wi(r,S.marker)<0)&&(r=S.marker)}return r}function Mn(e,t,i,r,n){var S=$e(e,t),j=rr&&S.markedSpans;if(j)for(var Y=0;Y<j.length;++Y){var Q=j[Y];if(!Q.marker.collapsed)continue;var re=Q.marker.find(0),pe=ht(re.from,i)||oi(Q.marker)-oi(n),ge=ht(re.to,r)||si(Q.marker)-si(n);if(pe>=0&&ge<=0||pe<=0&&ge>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ht(re.to,i)>=0:ht(re.to,i)>0)||pe>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ht(re.from,r)<=0:ht(re.from,r)<0))return!0}}function yr(e){for(var t;t=Br(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function Li(e){for(var t,i;t=Ur(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Qi(e,t){var i=$e(e,t),r=yr(i);return i==r?t:pt(r)}function Vr(e,t){if(t>e.lastLine())return t;var i=$e(e,t),r;if(!_r(e,i))return t;for(;r=Ur(i);)i=r.find(1,!0).line;return pt(i)+1}function _r(e,t){var i=rr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qi(e,t,r))return!0}}function qi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return qi(e,r.line,Lr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,S=0;S<t.markedSpans.length;++S)if(n=t.markedSpans[S],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&qi(e,t,n))return!0}function kr(e){e=yr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var S=i.parent;S;i=S,S=i.parent)for(var j=0;j<S.children.length;++j){var Y=S.children[j];if(Y==i)break;t+=Y.height}return t}function en(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Br(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ur(r);){var S=i.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Nn(e){var t=e.display,i=e.doc;t.maxLine=$e(i,i.first),t.maxLineLength=en(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=en(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var li=function(e,t,i){this.text=e,Ci(this,t),this.height=i?i(this):1};li.prototype.lineNo=function(){return pt(this)},le(li);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Ci(e,i);var n=r?r(e):1;n!=e.height&&mt(e,n)}function at(e){e.parent=null,la(e)}var ct={},lt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?lt:ct;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Ct(e,t){var i=y("span",null,null,M?"padding-right: .1px":null),r={pre:y("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var S=n?t.rest[n-1]:t.line,j=void 0;r.pos=0,r.addToken=St,vt(e.display.measure)&&(j=Ye(S,e.doc.direction))&&(r.addToken=ar(r.addToken,j)),r.map=[];var Y=t!=e.display.externalMeasured&&pt(S);jr(S,r,ni(e,S,Y)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=V(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=V(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(qe(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(M){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return se(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=V(r.pre.className,r.textClass||"")),r}function Dt(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 St(e,t,i,r,n,S,j){if(!t)return;var Y=e.splitSpaces?Ht(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,pe),G&&H<9&&(re=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ge=0;;){Q.lastIndex=ge;var Ae=Q.exec(t),Ce=Ae?Ae.index-ge:t.length-ge;if(Ce){var Ie=document.createTextNode(Y.slice(ge,ge+Ce));G&&H<9?pe.appendChild(a("span",[Ie])):pe.appendChild(Ie),e.map.push(e.pos,e.pos+Ce,Ie),e.col+=Ce,e.pos+=Ce}if(!Ae)break;ge+=Ce+1;var Fe=void 0;if(Ae[0]==" "){var je=e.cm.options.tabSize,Ke=je-e.col%je;Fe=pe.appendChild(a("span",z(Ke),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=Ke}else Ae[0]=="\r"||Ae[0]==`
|
|
`?(Fe=pe.appendChild(a("span",Ae[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",Ae[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(Ae[0]),Fe.setAttribute("cm-text",Ae[0]),G&&H<9?pe.appendChild(a("span",[Fe])):pe.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||re||S||j){var Ze=i||"";r&&(Ze+=r),n&&(Ze+=n);var Ve=a("span",[pe],Ze,S);if(j)for(var et in j)j.hasOwnProperty(et)&&et!="style"&&et!="class"&&Ve.setAttribute(et,j[et]);return e.content.appendChild(Ve)}e.content.appendChild(pe)}function Ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var S=e.charAt(n);S==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(S="\xA0"),r+=S,i=S==" "}return r}function ar(e,t){return function(i,r,n,S,j,Y,Q){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,pe=re+r.length;;){for(var ge=void 0,Ae=0;Ae<t.length&&!(ge=t[Ae],ge.to>re&&ge.from<=re);Ae++);if(ge.to>=pe)return e(i,r,n,S,j,Y,Q);e(i,r.slice(0,ge.to-re),n,S,null,Y,Q),S=null,r=r.slice(ge.to-re),re=ge.to}}}function bt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function jr(e,t,i){var r=e.markedSpans,n=e.text,S=0;if(!r){for(var j=1;j<i.length;j+=2)t.addToken(t,n.slice(S,S=i[j]),yt(i[j+1],t.cm.options));return}for(var Y=n.length,Q=0,re=1,pe="",ge,Ae,Ce=0,Ie,Fe,je,Ke,Ze;;){if(Ce==Q){Ie=Fe=je=Ae="",Ze=null,Ke=null,Ce=Infinity;for(var Ve=[],et=void 0,ut=0;ut<r.length;++ut){var st=r[ut],gt=st.marker;if(gt.type=="bookmark"&&st.from==Q&>.widgetNode)Ve.push(gt);else if(st.from<=Q&&(st.to==null||st.to>Q||gt.collapsed&&st.to==Q&&st.from==Q)){if(st.to!=null&&st.to!=Q&&Ce>st.to&&(Ce=st.to,Fe=""),gt.className&&(Ie+=" "+gt.className),gt.css&&(Ae=(Ae?Ae+";":"")+gt.css),gt.startStyle&&st.from==Q&&(je+=" "+gt.startStyle),gt.endStyle&&st.to==Ce&&(et||(et=[])).push(gt.endStyle,st.to),gt.title&&((Ze||(Ze={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(Ze||(Ze={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!Ke||wi(Ke.marker,gt)<0)&&(Ke=st)}else st.from>Q&&Ce>st.from&&(Ce=st.from)}if(et)for(var Vt=0;Vt<et.length;Vt+=2)et[Vt+1]==Ce&&(Fe+=" "+et[Vt]);if(!Ke||Ke.from==Q)for(var Nt=0;Nt<Ve.length;++Nt)bt(t,0,Ve[Nt]);if(Ke&&(Ke.from||0)==Q){if(bt(t,(Ke.to==null?Y+1:Ke.to)-Q,Ke.marker,Ke.from==null),Ke.to==null)return;Ke.to==Q&&(Ke=!1)}}if(Q>=Y)break;for(var pr=Math.min(Y,Ce);;){if(pe){var ur=Q+pe.length;if(!Ke){var jt=ur>pr?pe.slice(0,pr-Q):pe;t.addToken(t,jt,ge?ge+Ie:Ie,je,Q+jt.length==Ce?Fe:"",Ae,Ze)}if(ur>=pr){pe=pe.slice(pr-Q),Q=pr;break}Q=ur,je=""}pe=n.slice(S,S=i[re++]),ge=yt(i[re++],t.cm.options)}}}function Lt(e,t,i){this.line=t,this.rest=Li(t),this.size=this.rest?pt(s(this.rest))-i+1:1,this.node=this.text=null,this.hidden=_r(e,t)}function or(e,t,i){for(var r=[],n,S=t;S<i;S=n){var j=new Lt(e.doc,$e(e.doc,S),S);n=S+j.size,r.push(j)}return r}var qt=null;function Sr(e){qt?qt.ops.push(e):e.ownsGroup=qt={ops:[e],delayedCallbacks:[]}}function Ds(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Os(e,t){var i=e.ownsGroup;if(!i)return;try{Ds(i)}finally{qt=null,t(i)}}var tn=null;function Jt(e,t){var i=rt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;qt?n=qt.delayedCallbacks:tn?n=tn:(n=tn=[],setTimeout(_s,0));for(var S=function(Y){n.push(function(){return i[Y].apply(null,r)})},j=0;j<i.length;++j)S(j)}function _s(){var e=tn;tn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,i,r){for(var n=0;n<t.changes.length;n++){var S=t.changes[n];S=="text"?Ms(e,t):S=="gutter"?Za(e,t,i,r):S=="class"?ha(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function rn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&H<8&&(e.node.style.zIndex=2)),e.node}function 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=rn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Ct(e,t)}function Ms(e,t){var i=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):i&&(t.text.className=i)}function ha(e,t){Ps(e,t),t.line.wrapClass?rn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Za(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=rn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var j=rn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),j.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",Ut(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=e.display.gutterSpecs[Q].className,pe=S.hasOwnProperty(re)&&S[re];pe&&Y.appendChild(a("div",[pe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=E("CodeMirror-linewidget"),n=t.node.firstChild,S=void 0;n;n=S)S=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Ja(e,t,i)}function Ns(e,t,i,r){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Za(e,t,i,r),Ja(e,t,r),t.node}function Ja(e,t,i){if(Qa(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,i,!1)}function Qa(e,t,i,r,n){if(!t.widgets)return;for(var S=rn(i),j=0,Y=t.widgets;j<Y.length;++j){var Q=Y[j],re=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Fs(Q,re,i,r),e.display.input.setUneditable(re),n&&Q.above?S.insertBefore(re,i.gutter||i.text):S.appendChild(re),Jt(Q,"redraw")}}function Fs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function nn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!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;"),u(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Wr(e,t){for(var i=ve(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Fn(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(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 Pr(e){return me-e.display.nativeBarWidth}function ui(e){return e.display.scroller.clientWidth-Pr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Pr(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&ui(e);if(!t.measure.heights||r&&t.measure.width!=n){var S=t.measure.heights=[];if(r){t.measure.width=n;for(var j=t.text.firstChild.getClientRects(),Y=0;Y<j.length-1;Y++){var Q=j[Y],re=j[Y+1];Math.abs(Q.bottom-re.bottom)>2&&S.push((Q.bottom+re.top)/2-i.top)}}S.push(i.bottom-i.top)}}function eo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(pt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=yr(t);var i=pt(t),r=e.display.externalMeasured=new Lt(e.doc,t,i);r.lineN=i;var n=r.built=Ct(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Mr(e,ki(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ci(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function ki(e,t){var i=pt(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=eo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Mr(e,t,i,r,n){t.before&&(i=-1);var S=i+(r||""),j;return t.cache.hasOwnProperty(S)?j=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,i,r),j.bogus||(t.cache[S]=j)),{left:j.left,right:j.right,top:n?j.rtop:j.top,bottom:n?j.rbottom:j.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,S,j,Y,Q,re=0;re<e.length;re+=3)if(Y=e[re],Q=e[re+1],t<Y?(n=0,S=1,j="left"):t<Q?(n=t-Y,S=n+1):(re==e.length-3||t==Q&&e[re+3]>t)&&(S=Q-Y,n=S-1,t>=Q&&(j="right")),n!=null){if(r=e[re+2],Y==Q&&i==(r.insertLeft?"left":"right")&&(j=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],j="left";if(i=="right"&&n==Q-Y)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],j="right";break}return{node:r,start:n,end:S,collapse:j,coverStart:Y,coverEnd:Q}}function js(e,t){var i=ro;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=io(t.map,i,r),S=n.node,j=n.start,Y=n.end,Q=n.collapse,re;if(S.nodeType==3){for(var pe=0;pe<4;pe++){for(;j&&De(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+Y<n.coverEnd&&De(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&H<9&&j==0&&Y==n.coverEnd-n.coverStart?re=S.parentNode.getBoundingClientRect():re=js(m(S,j,Y).getClientRects(),r),re.left||re.right||j==0)break;Y=j,j=j-1,Q="right"}G&&H<11&&(re=Hs(e.display.measure,re))}else{j>0&&(Q=r="right");var ge;e.options.lineWrapping&&(ge=S.getClientRects()).length>1?re=ge[r=="right"?ge.length-1:0]:re=S.getBoundingClientRect()}if(G&&H<9&&!j&&(!re||!re.left&&!re.right)){var Ae=S.parentNode.getClientRects()[0];Ae?re={left:Ae.left,right:Ae.left+Di(e.display),top:Ae.top,bottom:Ae.bottom}:re=ro}for(var Ce=re.top-t.rect.top,Ie=re.bottom-t.rect.top,Fe=(Ce+Ie)/2,je=t.view.measure.heights,Ke=0;Ke<je.length-1&&!(Fe<je[Ke]);Ke++);var Ze=Ke?je[Ke-1]:0,Ve=je[Ke],et={left:(Q=="right"?re.right:re.left)-t.rect.left,right:(Q=="left"?re.left:re.right)-t.rect.left,top:Ze,bottom:Ve};return!re.left&&!re.right&&(et.bogus=!0),e.options.singleCursorHeightPerLine||(et.rtop=Ce,et.rbottom=Ie),et}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!It(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,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function an(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return b&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=nn(e.widgets[i]));return t}function Bn(e,t,i,r,n){if(!n){var S=pa(t);i.top+=S,i.bottom+=S}if(r=="line")return i;r||(r="local");var j=kr(t);if(r=="local"?j+=Fn(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();j+=Y.top+(r=="window"?0:so());var Q=Y.left+(r=="window"?0:oo());i.left+=Q,i.right+=Q}return i.top+=j,i.bottom+=j,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var S=e.display.sizer.getBoundingClientRect();r+=S.left,n+=S.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:n-j.top}}function ma(e,t,i,r,n){return r||(r=$e(e.doc,t.line)),Bn(e,r,to(e,r,t.ch,n),i)}function Rr(e,t,i,r,n,S){r=r||$e(e.doc,t.line),n||(n=ki(e,r));function j(Ie,Fe){var je=Mr(e,n,Ie,Fe?"right":"left",S);return Fe?je.left=je.right:je.right=je.left,Bn(e,r,je,i)}var Y=Ye(r,e.doc.direction),Q=t.ch,re=t.sticky;if(Q>=r.text.length?(Q=r.text.length,re="before"):Q<=0&&(Q=0,re="after"),!Y)return j(re=="before"?Q-1:Q,re=="before");function pe(Ie,Fe,je){var Ke=Y[Fe],Ze=Ke.level==1;return j(je?Ie-1:Ie,Ze!=je)}var ge=ze(Y,Q,re),Ae=He,Ce=pe(Q,ge,re=="before");return Ae!=null&&(Ce.other=pe(Q,Ae,re!="before")),Ce}function uo(e,t){var i=0;t=ft(e.doc,t),e.options.lineWrapping||(i=Di(e.display)*t.ch);var r=$e(e.doc,t.line),n=kr(r)+Fn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var S=Be(e,t,i);return S.xRel=n,r&&(S.outside=r),S}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=At(r,i),S=r.first+r.size-1;if(n>S)return ga(r.first+r.size-1,$e(r,S).text.length,null,1,1);t<0&&(t=0);for(var j=$e(r,n);;){var Y=Gs(e,j,n,t,i),Q=Ai(j,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var re=Q.find(1);if(re.line==n)return re;j=$e(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,S=Ne(function(j){return Mr(e,i,j-1).bottom<=r},n,0);return n=Ne(function(j){return Mr(e,i,j).top>r},S,n),{begin:S,end:n}}function co(e,t,i,r){i||(i=ki(e,t));var n=Bn(e,t,Mr(e,i,r),"line").top;return ho(e,t,i,n)}function ya(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=kr(t);var S=ki(e,t),j=pa(t),Y=0,Q=t.text.length,re=!0,pe=Ye(t,e.doc.direction);if(pe){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,S,pe,r,n);re=ge.level!=1,Y=re?ge.from:ge.to-1,Q=re?ge.to:ge.from-1}var Ae=null,Ce=null,Ie=Ne(function(ut){var st=Mr(e,S,ut);return st.top+=j,st.bottom+=j,ya(st,r,n,!1)?(st.top<=n&&st.left<=r&&(Ae=ut,Ce=st),!0):!1},Y,Q),Fe,je,Ke=!1;if(Ce){var Ze=r-Ce.left<Ce.right-r,Ve=Ze==re;Ie=Ae+(Ve?0:1),je=Ve?"after":"before",Fe=Ze?Ce.left:Ce.right}else{!re&&(Ie==Q||Ie==Y)&&Ie++,je=Ie==0?"after":Ie==t.text.length?"before":Mr(e,S,Ie-(re?1:0)).bottom+j<=n==re?"after":"before";var et=Rr(e,Be(i,Ie,je),"line",t,S);Fe=et.left,Ke=n<et.top?-1:n>=et.bottom?1:0}return Ie=_e(t.text,Ie,1),ga(i,Ie,je,Ke,r-Fe)}function zs(e,t,i,r,n,S,j){var Y=Ne(function(ge){var Ae=n[ge],Ce=Ae.level!=1;return ya(Rr(e,Be(i,Ce?Ae.to:Ae.from,Ce?"before":"after"),"line",t,r),S,j,!0)},0,n.length-1),Q=n[Y];if(Y>0){var re=Q.level!=1,pe=Rr(e,Be(i,re?Q.from:Q.to,re?"after":"before"),"line",t,r);ya(pe,S,j,!0)&&pe.top>j&&(Q=n[Y-1])}return Q}function Ks(e,t,i,r,n,S,j){var Y=ho(e,t,r,j),Q=Y.begin,re=Y.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var pe=null,ge=null,Ae=0;Ae<n.length;Ae++){var Ce=n[Ae];if(Ce.from>=re||Ce.to<=Q)continue;var Ie=Ce.level!=1,Fe=Mr(e,r,Ie?Math.min(re,Ce.to)-1:Math.max(Q,Ce.from)).right,je=Fe<S?S-Fe+1e9:Fe-S;(!pe||ge>je)&&(pe=Ce,ge=je)}return pe||(pe=n[n.length-1]),pe.from<Q&&(pe={from:Q,to:pe.to,level:pe.level}),pe.to>re&&(pe={from:pe.from,to:re,level:pe.level}),pe}var hi;function Ri(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hi==null){hi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hi.appendChild(document.createTextNode("x")),hi.appendChild(a("br"));hi.appendChild(document.createTextNode("x"))}u(e.measure,hi);var i=hi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Di(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,S=t.gutters.firstChild,j=0;S;S=S.nextSibling,++j){var Y=e.display.gutterSpecs[j].className;i[Y]=S.offsetLeft+S.clientLeft+n,r[Y]=S.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Ri(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Di(e.display)-3);return function(n){if(_r(e.doc,n))return 0;var S=0;if(n.widgets)for(var j=0;j<n.widgets.length;j++)n.widgets[j].height&&(S+=n.widgets[j].height);return i?S+(Math.ceil(n.text.length/r)||1)*t:S+t}}function Ea(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&mt(r,n)})}function di(e,t,i,r){var n=e.display;if(!i&&ve(t).getAttribute("cm-not-content")=="true")return null;var S,j,Y=n.lineSpace.getBoundingClientRect();try{S=t.clientX-Y.left,j=t.clientY-Y.top}catch(ge){return null}var Q=va(e,S,j),re;if(r&&Q.xRel>0&&(re=$e(e.doc,Q.line).text).length==Q.ch){var pe=$(re,re.length,e.options.tabSize)-re.length;Q=Be(Q.line,Math.max(0,Math.round((S-qa(e.display).left)/Di(e.display))-pe))}return Q}function ci(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function sr(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)rr&&Qi(e.doc,t)<n.viewTo&&Yr(e);else if(i<=n.viewFrom)rr&&Vr(e.doc,i+r)>n.viewFrom?Yr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Yr(e);else if(t<=n.viewFrom){var S=Un(e,i,i+r,1);S?(n.view=n.view.slice(S.index),n.viewFrom=S.lineN,n.viewTo+=r):Yr(e)}else if(i>=n.viewTo){var j=Un(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):Yr(e)}else{var Y=Un(e,t,t,-1),Q=Un(e,i,i+r,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(or(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=r):Yr(e)}var re=n.externalMeasured;re&&(i<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(n.externalMeasured=null))}function Xr(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[ci(e,t)];if(S.node==null)return;var j=S.changes||(S.changes=[]);ue(j,i)==-1&&j.push(i)}function Yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,i,r){var n=ci(e,t),S,j=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Q=0;Q<n;Q++)Y+=j[Q].size;if(Y!=t){if(r>0){if(n==j.length-1)return null;S=Y+j[n].size-t,n++}else S=Y-t;t+=S,i+=S}for(;Qi(e.doc,i)!=i;){if(n==(r<0?0:j.length-1))return null;i+=r*j[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=or(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=or(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ci(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(or(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ci(e,i)))),r.viewTo=i}function po(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function on(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),j=0;j<i.sel.ranges.length;j++){if(!t&&j==i.sel.primIndex)continue;var Y=i.sel.ranges[j];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,Y.head,n),Q||Xs(e,Y,S)}return r}function go(e,t,i){var r=Rr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function jn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,S=document.createDocumentFragment(),j=qa(e.display),Y=j.left,Q=Math.max(r.sizerWidth,ui(e)-r.sizer.offsetLeft)-j.right,re=n.direction=="ltr";function pe(Ve,et,ut,st){et<0&&(et=0),et=Math.round(et),st=Math.round(st),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
|
|
top: `+et+"px; width: "+(ut==null?Q-Ve:ut)+`px;
|
|
height: `+(st-et)+"px"))}function ge(Ve,et,ut){var st=$e(n,Ve),gt=st.text.length,Ot,Vt;function Nt(jt,hr){return ma(e,Be(Ve,jt),"div",st,hr)}function pr(jt,hr,Qt){var Gt=co(e,st,null,jt),Wt=hr=="ltr"==(Qt=="after")?"left":"right",Ft=Qt=="after"?Gt.begin:Gt.end-(/\s/.test(st.text.charAt(Gt.end-1))?2:1);return Nt(Ft,Wt)[Wt]}var ur=Ye(st,n.direction);return Ge(ur,et||0,ut==null?gt:ut,function(jt,hr,Qt,Gt){var Wt=Qt=="ltr",Ft=Nt(jt,Wt?"left":"right"),dr=Nt(hr-1,Wt?"right":"left"),Gi=et==null&&jt==0,ei=ut==null&&hr==gt,tr=Gt==0,Ir=!ur||Gt==ur.length-1;if(dr.top-Ft.top<=3){var Xt=(re?Gi:ei)&&tr,Va=(re?ei:Gi)&&Ir,Gr=Xt?Y:(Wt?Ft:dr).left,vi=Va?Q:(Wt?dr:Ft).right;pe(Gr,Ft.top,vi-Gr,Ft.bottom)}else{var yi,nr,zi,Xa;Wt?(yi=re&&Gi&&tr?Y:Ft.left,nr=re?Q:pr(jt,Qt,"before"),zi=re?Y:pr(hr,Qt,"after"),Xa=re&&ei&&Ir?Q:dr.right):(yi=re?pr(jt,Qt,"before"):Y,nr=!re&&Gi&&tr?Q:Ft.right,zi=!re&&ei&&Ir?Y:dr.left,Xa=re?pr(hr,Qt,"after"):Q),pe(yi,Ft.top,nr-yi,Ft.bottom),Ft.bottom<dr.top&&pe(Y,Ft.bottom,null,dr.top),pe(zi,dr.top,Xa-zi,dr.bottom)}(!Ot||jn(Ft,Ot)<0)&&(Ot=Ft),jn(dr,Ot)<0&&(Ot=dr),(!Vt||jn(Ft,Vt)<0)&&(Vt=Ft),jn(dr,Vt)<0&&(Vt=dr)}),{start:Ot,end:Vt}}var Ae=t.from(),Ce=t.to();if(Ae.line==Ce.line)ge(Ae.line,Ae.ch,Ce.ch);else{var Ie=$e(n,Ae.line),Fe=$e(n,Ce.line),je=yr(Ie)==yr(Fe),Ke=ge(Ae.line,Ae.ch,je?Ie.text.length+1:null).end,Ze=ge(Ce.line,je?0:null,Ce.ch).start;je&&(Ke.top<Ze.top-2?(pe(Ke.right,Ke.top,null,Ke.bottom),pe(Y,Ze.top,Ze.left,Ze.bottom)):pe(Ke.right,Ke.top,Ze.left-Ke.right,Ke.bottom)),Ke.bottom<Ze.top&&pe(Y,Ke.bottom,null,Ze.top)}i.appendChild(S)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Oi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(se(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Oi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(se(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],S=e.options.lineWrapping,j=void 0,Y=0;if(n.hidden)continue;if(G&&H<8){var Q=n.node.offsetTop+n.node.offsetHeight;j=Q-i,i=Q}else{var re=n.node.getBoundingClientRect();j=re.bottom-re.top,!S&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var pe=n.line.height-j;if((pe>.005||pe<-.005)&&(mt(n.line,j),bo(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)bo(n.rest[ge]);if(Y>e.display.sizerWidth){var Ae=Math.ceil(Y/Di(e.display));Ae>e.display.maxLineLength&&(e.display.maxLineLength=Ae,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Hn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Fn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,S=At(t,r),j=At(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Q=i.ensure.to.line;Y<S?(S=Y,j=At(t,kr($e(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=j&&(S=At(t,kr($e(t,Q))-e.wrapper.clientHeight),j=Q)}return{from:S,to:Math.max(j,S+1)}}function Ys(e,t){if(ee(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!w){var S=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Fn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Pr(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(n),e.display.lineSpace.removeChild(S)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var j=!1,Y=Rr(e,t),Q=!i||i==t?Y:Rr(e,i);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var re=Ca(e,n),pe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(j=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(j=!0)),!j)break}return n}function Zs(e,t){var i=Ca(e,t);i.scrollTop!=null&&ln(e,i.scrollTop),i.scrollLeft!=null&&fi(e,i.scrollLeft)}function Ca(e,t){var i=e.display,r=Ri(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,S=ca(e),j={};t.bottom-t.top>S&&(t.bottom=t.top+S);var Y=e.doc.height+da(i),Q=t.top<r,re=t.bottom>Y-r;if(t.top<n)j.scrollTop=Q?0:t.top;else if(t.bottom>n+S){var pe=Math.min(t.top,(re?Y:t.bottom)-S);pe!=n&&(j.scrollTop=pe)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,Ae=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ce=ui(e)-i.gutters.offsetWidth,Ie=t.right-t.left>Ce;return Ie&&(t.right=t.left+Ce),t.left<10?j.scrollLeft=0:t.left<Ae?j.scrollLeft=Math.max(0,t.left+ge-(Ie?0:10)):t.right>Ce+Ae-3&&(j.scrollLeft=t.right+(Ie?0:10)-Ce),j}function wa(e,t){if(t==null)return;Gn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _i(e){Gn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sn(e,t,i){(t!=null||i!=null)&&Gn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Gn(e),e.curOp.scrollToPos=t}function Gn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);xo(e,i,r,t.margin)}}function xo(e,t,i,r){var n=Ca(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});sn(e,n.scrollLeft,n.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||La(e,{top:t}),Eo(e,t,!0),O&&La(e),dn(e,100)}function Eo(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+da(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Pr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var pi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Pe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=l&&!k?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ne,this.disableVert=new ne},pi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),S=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hn=function(){};hn.prototype.update=function(){return{bottom:0,right:0}},hn.prototype.setScrollLeft=function(){},hn.prototype.setScrollTop=function(){},hn.prototype.clear=function(){};function Pi(e,t){t||(t=un(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Wn(e),So(e,un(e)),i=e.display.barWidth,r=e.display.barHeight}function So(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var To={native:pi,null:hn};function Co(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new To[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?fi(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function mi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},Sr(e.curOp)}function gi(e){var t=e.curOp;t&&Os(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var S=0;S<t.length;S++)il(t[S]);for(var j=0;j<t.length;j++)nl(t[j])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Nn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new zn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Wn(t),e.barMeasure=un(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Pr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-ui(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==B();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pi(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&vo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var S=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(S)for(var Y=0;Y<S.length;++Y)S[Y].lines.length||se(S[Y],"hide");if(j)for(var Q=0;Q<j.length;++Q)j[Q].lines.length&&se(j[Q],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function fr(e,t){if(e.curOp)return t();mi(e);try{return t()}finally{gi(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mi(e);try{return t.apply(e,arguments)}finally{gi(e)}}}function ir(e){return function(){if(this.curOp)return e.apply(this,arguments);mi(this);try{return e.apply(this,arguments)}finally{gi(this)}}}function Kt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mi(t);try{return e.apply(this,arguments)}finally{gi(t)}}}function dn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,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=Cr(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var j=S.styles,Y=S.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,Q=Ki(e,S,r,!0);Y&&(r.state=Y),S.styles=Q.styles;var re=S.styleClasses,pe=Q.classes;pe?S.styleClasses=pe:re&&(S.styleClasses=null);for(var ge=!j||j.length!=S.styles.length||re!=pe&&(!re||!pe||re.bgClass!=pe.bgClass||re.textClass!=pe.textClass),Ae=0;!ge&&Ae<j.length;++Ae)ge=j[Ae]!=S.styles[Ae];ge&&n.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&Vi(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return dn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&fr(e,function(){for(var S=0;S<n.length;S++)Xr(e,n[S],"text")})}var zn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Hn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ui(e),this.force=i,this.dims=ba(e),this.events=[]};zn.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},zn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)se.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=Pr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Pr(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 Aa(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Yr(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&po(e)==0)return!1;Lo(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<S&&S-i.viewFrom<20&&(S=Math.max(r.first,i.viewFrom)),i.viewTo>j&&i.viewTo-j<20&&(j=Math.min(n,i.viewTo)),rr&&(S=Qi(e.doc,S),j=Vr(e.doc,j));var Y=S!=i.viewFrom||j!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,S,j),i.viewOffset=kr($e(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Q=po(e);if(!Y&&Q==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return Q>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Q>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,dn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+da(e.display)-ca(e),i.top)}),t.visible=Hn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hn(e.display,e.doc,i));if(!Aa(e,t))break;Wn(e);var n=un(e);on(e),Pi(e,n),Ra(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var i=new zn(e,t);if(Aa(e,i)){Wn(e),wo(e,i);var r=un(e);on(e),Pi(e,r),Ra(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,S=r.lineDiv,j=S.firstChild;function Y(Ie){var Fe=Ie.nextSibling;return M&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Fe}for(var Q=r.view,re=r.viewFrom,pe=0;pe<Q.length;pe++){var ge=Q[pe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=S){var Ae=Ns(e,ge,re,i);S.insertBefore(Ae,j)}else{for(;j!=ge.node;)j=Y(j);var Ce=n&&t!=null&&t<=re&&ge.lineNumber;ge.changes&&(ue(ge.changes,"gutter")>-1&&(Ce=!1),Ya(e,ge,re,i)),Ce&&(c(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(Ut(e.options,re)))),j=ge.node.nextSibling}re+=ge.size}for(;j;)j=Y(j)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+Pr(e)+"px"}function Ao(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,S=r+"px",j=0;j<i.length;j++)if(!i[j].hidden){e.options.fixedGutter&&(i[j].gutter&&(i[j].gutter.style.left=S),i[j].gutterBackground&&(i[j].gutterBackground.style.left=S));var Y=i[j].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Ut(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=n.firstChild.offsetWidth,j=n.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Da(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var S=e[n],j=null;if(typeof S!="string"&&(j=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:S,style:j})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ko(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],S=n.className,j=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+S));j&&(Y.style.cssText=j),S=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function cn(e){ko(e.display),sr(e),Ao(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=y("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=y("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var S=y("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[S],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!M&&!(O&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Da(r.gutters,r.lineNumbers),ko(n),i.init(n)}var Kn=0,br=null;G?br=-.53:O?br=15:b?br=-.7:I&&(br=-1/3);function Ro(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Ro(e);return t.x*=br,t.y*=br,t}function Do(e,t){var i=Ro(t),r=i.x,n=i.y,S=e.display,j=S.scroller,Y=j.scrollWidth>j.clientWidth,Q=j.scrollHeight>j.clientHeight;if(!(r&&Y||n&&Q))return;if(n&&l&&M){e:for(var re=t.target,pe=S.view;re!=j;re=re.parentNode)for(var ge=0;ge<pe.length;ge++)if(pe[ge].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!O&&!A&&br!=null){n&&Q&&ln(e,Math.max(0,j.scrollTop+n*br)),fi(e,Math.max(0,j.scrollLeft+r*br)),(!n||n&&Q)&&te(t),S.wheelStartX=null;return}if(n&&br!=null){var Ae=n*br,Ce=e.doc.scrollTop,Ie=Ce+S.wrapper.clientHeight;Ae<0?Ce=Math.max(0,Ce+Ae-50):Ie=Math.min(e.doc.height,Ie+Ae+50),La(e,{top:Ce,bottom:Ie})}Kn<20&&(S.wheelStartX==null?(S.wheelStartX=j.scrollLeft,S.wheelStartY=j.scrollTop,S.wheelDX=r,S.wheelDY=n,setTimeout(function(){if(S.wheelStartX==null)return;var Fe=j.scrollLeft-S.wheelStartX,je=j.scrollTop-S.wheelStartY,Ke=je&&S.wheelDY&&je/S.wheelDY||Fe&&S.wheelDX&&Fe/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!Ke)return;br=(br*Kn+Ke)/(Kn+1),++Kn},200)):(S.wheelDX+=r,S.wheelDY+=n))}var xr=function(e,t){this.ranges=e,this.primIndex=t};xr.prototype.primary=function(){return this.ranges[this.primIndex]},xr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!ri(i.anchor,r.anchor)||!ri(i.head,r.head))return!1}return!0},xr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new kt(bi(this.ranges[t].anchor),bi(this.ranges[t].head));return new xr(e,this.primIndex)},xr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},xr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return i}return-1};var kt=function(e,t){this.anchor=e,this.head=t};kt.prototype.from=function(){return ii(this.anchor,this.head)},kt.prototype.to=function(){return xi(this.anchor,this.head)},kt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Dr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Ae,Ce){return ht(Ae.from(),Ce.from())}),i=ue(t,n);for(var S=1;S<t.length;S++){var j=t[S],Y=t[S-1],Q=ht(Y.to(),j.from());if(r&&!j.empty()?Q>0:Q>=0){var re=ii(Y.from(),j.from()),pe=xi(Y.to(),j.to()),ge=Y.empty()?j.from()==j.head:Y.from()==Y.head;S<=i&&--i,t.splice(--S,2,new kt(ge?pe:re,ge?re:pe))}}return new xr(t,i)}function $r(e,t){return new xr([new kt(e,t||e)],0)}function Zr(e){return e.text?Be(e.from.line+e.text.length-1,s(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Oo(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Zr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Zr(t).ch-t.to.ch),Be(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new kt(Oo(n.anchor,t),Oo(n.head,t)))}return Dr(e.cm,i,e.sel.primIndex)}function _o(e,t,i){return e.line==t.line?Be(i.line,e.ch-t.ch+i.ch):Be(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Be(e.first,0),S=n,j=0;j<t.length;j++){var Y=t[j],Q=_o(Y.from,n,S),re=_o(Zr(Y),n,S);if(n=Y.to,S=re,i=="around"){var pe=e.sel.ranges[j],ge=ht(pe.head,pe.anchor)<0;r[j]=new kt(ge?re:Q,ge?Q:re)}else r[j]=new kt(Q,Q)}return new xr(r,e.sel.primIndex)}function _a(e){e.doc.mode=gr(e.options,e.doc.modeOption),fn(e)}function fn(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,dn(e,100),e.state.modeGen++,e.curOp&&sr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&s(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(Ze){return i?i[Ze]:null}function S(Ze,Ve,et){ua(Ze,Ve,et,r),Jt(Ze,"change",Ze,t)}function j(Ze,Ve){for(var et=[],ut=Ze;ut<Ve;++ut)et.push(new li(re[ut],n(ut),r));return et}var Y=t.from,Q=t.to,re=t.text,pe=$e(e,Y.line),ge=$e(e,Q.line),Ae=s(re),Ce=n(re.length-1),Ie=Q.line-Y.line;if(t.full)e.insert(0,j(0,re.length)),e.remove(re.length,e.size-re.length);else if(Po(e,t)){var Fe=j(0,re.length-1);S(ge,ge.text,Ce),Ie&&e.remove(Y.line,Ie),Fe.length&&e.insert(Y.line,Fe)}else if(pe==ge)if(re.length==1)S(pe,pe.text.slice(0,Y.ch)+Ae+pe.text.slice(Q.ch),Ce);else{var je=j(1,re.length-1);je.push(new li(Ae+pe.text.slice(Q.ch),Ce,r)),S(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),e.insert(Y.line+1,je)}else if(re.length==1)S(pe,pe.text.slice(0,Y.ch)+re[0]+ge.text.slice(Q.ch),n(0)),e.remove(Y.line+1,Ie);else{S(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),S(ge,Ae+ge.text.slice(Q.ch),Ce);var Ke=j(1,re.length-1);Ie>1&&e.remove(Y.line+1,Ie-1),e.insert(Y.line+1,Ke)}Jt(e,"change",e,t)}function Jr(e,t,i){function r(n,S,j){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Q=n.linked[Y];if(Q.doc==S)continue;var re=j&&Q.sharedHist;if(i&&!re)continue;t(Q.doc,re),r(Q.doc,n,re)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),_a(e),Io(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,sr(e)}function Io(e){(e.doc.direction=="rtl"?W:p)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){fr(e,function(){Io(e),sr(e)})}function Vn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var i={from:bi(t.from),to:Zr(t),text:Tt(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Jr(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=s(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),s(e.done);if(e.done.length&&!s(e.done).ranges)return s(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),s(e.done)}function Fo(e,t,i,r){var n=e.history;n.undone.length=0;var S=+new Date,j,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(n,n.lastOp==r)))Y=s(j.changes),ht(t.from,t.to)==0&&ht(t.from,Y.to)==0?Y.to=Zr(t):j.changes.push(Ma(e,t));else{var Q=s(n.done);for((!Q||!Q.ranges)&&Xn(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=S,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||se(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,S=r&&r.origin;i==n.lastSelOp||S&&n.lastSelOrigin==S&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==S||ml(e,S,s(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=S,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Xn(e,t){var i=s(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(e,t,i,r){var n=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((n||(n=t["spans_"+e.id]={}))[S]=j.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Uo(e,t){var i=yl(e,t),r=Ti(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var S=i[n],j=r[n];if(S&&j){e:for(var Y=0;Y<j.length;++Y){for(var Q=j[Y],re=0;re<S.length;++re)if(S[re].marker==Q.marker)continue e;S.push(Q)}}else j&&(i[n]=j)}return i}function Mi(e,t,i){for(var r=[],n=0;n<e.length;++n){var S=e[n];if(S.ranges){r.push(i?xr.prototype.deepCopy.call(S):S);continue}var j=S.changes,Y=[];r.push({changes:Y});for(var Q=0;Q<j.length;++Q){var re=j[Q],pe=void 0;if(Y.push({from:re.from,to:re.to,text:re.text}),t)for(var ge in re)(pe=ge.match(/^spans_(\d+)$/))&&(ue(t,Number(pe[1]))>-1&&(s(Y)[ge]=re[ge],delete re[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var S=ht(t,n)<0;S!=ht(i,n)<0?(n=t,t=i):S!=ht(t,i)<0&&(t=i)}return new kt(n,t)}else return new kt(i||t,t)}function Yn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),er(e,new xr([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Ia(e.sel.ranges[S],t[S],null,n);var j=Dr(e.cm,r,e.sel.primIndex);er(e,j,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,er(e,Dr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){er(e,$r(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var S=0;S<n.length;S++)this.ranges[S]=new kt(ft(e,n[S].anchor),ft(e,n[S].head))},origin:i&&i.origin};return se(e,"beforeSelectionChange",e,r),e.cm&&se(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Dr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=s(r);n&&n.ranges?(r[r.length-1]=t,$n(e,t,i)):er(e,t,i)}function er(e,t,i){$n(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function $n(e,t,i){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&_i(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,q(e.cm)),Jt(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,S=0;S<t.ranges.length;S++){var j=t.ranges[S],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],Q=Zn(e,j.anchor,Y&&Y.anchor,i,r),re=Zn(e,j.head,Y&&Y.head,i,r);(n||Q!=j.anchor||re!=j.head)&&(n||(n=t.ranges.slice(0,S)),n[S]=new kt(Q,re))}return n?Dr(e.cm,n,t.primIndex):t}function Ii(e,t,i,r,n){var S=$e(e,t.line);if(S.markedSpans)for(var j=0;j<S.markedSpans.length;++j){var Y=S.markedSpans[j],Q=Y.marker,re="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,pe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(re?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(pe?Y.to>=t.ch:Y.to>t.ch))){if(n&&(se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(S.markedSpans){--j;continue}else break;if(!Q.atomic)continue;if(i){var ge=Q.find(r<0?1:-1),Ae=void 0;if((r<0?pe:re)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?S:null)),ge&&ge.line==t.line&&(Ae=ht(ge,i))&&(r<0?Ae<0:Ae>0))return Ii(e,ge,t,r,n)}var Ce=Q.find(r<0?-1:1);return(r<0?re:pe)&&(Ce=Vo(e,Ce,r,Ce.line==t.line?S:null)),Ce?Ii(e,Ce,t,r,n):null}}return t}function Zn(e,t,i,r,n){var S=r||1,j=Ii(e,t,i,S,n)||!n&&Ii(e,t,i,S,!0)||Ii(e,t,i,-S,n)||!n&&Ii(e,t,i,-S,!0);return j||(e.cantEdit=!0,Be(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ft(e,Be(t.line-1)):null:i>0&&t.ch==(r||$e(e,t.line)).text.length?t.line<e.first+e.size-1?Be(t.line+1,0):null:new Be(t.line,t.ch+i)}function Xo(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),xe)}function Yo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,S,j,Y){n&&(r.from=ft(e,n)),S&&(r.to=ft(e,S)),j&&(r.text=j),Y!==void 0&&(r.origin=Y)}),se(e,"beforeChange",e,r),e.cm&&se(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ni(e,t,i){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Ni)(e,t,i);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Zi&&!i&&Pn(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)$o(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var i=Oa(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),pn(e,t,i,Ti(e,t));var r=[];Jr(e,function(n,S){!S&&ue(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),pn(n,t,null,Ti(n,t))})}function Jn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,S,j=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,re=0;re<Y.length&&!(S=Y[re],i?S.ranges&&!S.equals(e.sel):!S.ranges);re++);if(re==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(S=Y.pop(),S.ranges){if(Xn(S,Q),i&&!S.equals(e.sel)){er(e,S,{clearRedo:!1});return}j=S}else if(r){Y.push(S);return}else break;var pe=[];Xn(j,Q),Q.push({changes:pe,generation:n.generation}),n.generation=S.generation||++n.maxGeneration;for(var ge=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),Ae=function(Fe){var je=S.changes[Fe];if(je.origin=t,ge&&!Yo(e,je,!1))return Y.length=0,{};pe.push(Ma(e,je));var Ke=Fe?Oa(e,je):s(Y);pn(e,je,Ke,Uo(e,je)),!Fe&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Zr(je)});var Ze=[];Jr(e,function(Ve,et){!et&&ue(Ze,Ve.history)==-1&&(qo(Ve.history,je),Ze.push(Ve.history)),pn(Ve,je,null,Uo(Ve,je))})},Ce=S.changes.length-1;Ce>=0;--Ce){var Ie=Ae(Ce);if(Ie)return Ie.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new xr(f(e.sel.ranges,function(n){return new kt(Be(n.anchor.line+t,n.anchor.ch),Be(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){sr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Xr(e.cm,r,"gutter")}}function pn(e,t,i,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,pn)(e,t,i,r);if(t.to.line<e.first){Zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Zo(e,n),t={from:Be(e.first,0),to:Be(t.to.line+n,t.to.ch),text:[s(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Be(S,$e(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Tt(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),$n(e,i,xe),e.cantEdit&&Zn(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,S=t.from,j=t.to,Y=!1,Q=S.line;e.options.lineWrapping||(Q=pt(yr($e(r,S.line))),r.iter(Q,j.line+1,function(Ce){if(Ce==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&q(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Q,S.line+t.text.length,function(Ce){var Ie=en(Ce);Ie>n.maxLineLength&&(n.maxLine=Ce,n.maxLineLength=Ie,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),aa(r,S.line),dn(e,400);var re=t.text.length-(j.line-S.line)-1;t.full?sr(e):S.line==j.line&&t.text.length==1&&!Po(e.doc,t)?Xr(e,S.line,"text"):sr(e,S.line,j.line+1,re);var pe=ae(e,"changes"),ge=ae(e,"change");if(ge||pe){var Ae={from:S,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&Jt(e,"change",e,Ae),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ae)}e.display.selForContextMenu=null}function Fi(e,t,i,r,n){var S;r||(r=i),ht(r,i)<0&&(S=[r,i],i=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:i,to:r,text:t,origin:n})}function Jo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,i,r){for(var n=0;n<e.length;++n){var S=e[n],j=!0;if(S.ranges){S.copied||(S=e[n]=S.deepCopy(),S.copied=!0);for(var Y=0;Y<S.ranges.length;Y++)Jo(S.ranges[Y].anchor,t,i,r),Jo(S.ranges[Y].head,t,i,r);continue}for(var Q=0;Q<S.changes.length;++Q){var re=S.changes[Q];if(i<re.from.line)re.from=Be(re.from.line+r,re.from.ch),re.to=Be(re.to.line+r,re.to.ch);else if(t<=re.to.line){j=!1;break}}j||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function mn(e,t,i,r){var n=t,S=t;return typeof t=="number"?S=$e(e,Ei(e,t)):n=pt(t),n==null?null:(r(S,n)&&e.cm&&Xr(e.cm,n,i),S)}function gn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}gn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,at(n),Jt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function vn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}vn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var S=Math.min(t,n-e),j=r.height;if(r.removeInner(e,S),this.height-=j-r.height,n==S&&(this.children.splice(i--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gn))){var Y=[];this.collapse(Y),this.children=[new gn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<=S){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var j=n.lines.length%25+25,Y=j;Y<n.lines.length;){var Q=new gn(n.lines.slice(Y,Y+=25));n.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}n.lines=n.lines.slice(0,j),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new vn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ue(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new vn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<S){var j=Math.min(t,S-e);if(n.iterN(e,j,i))return!0;if((t-=j)==0)break;e=0}else e-=S}}};var yn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};yn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=pt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var S=nn(this);mt(i,Math.max(0,i.height-S)),e&&(fr(e,function(){es(e,i,-S),Xr(e,r,"widget")}),Jt(e,"lineWidgetCleared",e,this,r))},yn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=nn(this)-t;if(!n)return;_r(this.doc,r)||mt(r,r.height+n),i&&fr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),Jt(i,"lineWidgetChanged",i,e,pt(r))})},le(yn);function es(e,t,i){kr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function El(e,t,i,r){var n=new yn(e,i,r),S=e.cm;return S&&n.noHScroll&&(S.display.alignWidgets=!0),mn(e,t,"widget",function(j){var Y=j.widgets||(j.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,S&&!_r(e,j)){var Q=kr(j)<e.scrollTop;mt(j,j.height+nn(n)),Q&&wa(S,n.height),S.curOp.forceUpdate=!0}return!0}),S&&Jt(S,"lineWidgetAdded",S,n,typeof t=="number"?t:pt(t)),n}var ts=0,Qr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Qr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mi(e),ae(this,"clear")){var i=this.find();i&&Jt(this,"clear",i.from,i.to)}for(var r=null,n=null,S=0;S<this.lines.length;++S){var j=this.lines[S],Y=Lr(j.markedSpans,this);e&&!this.collapsed?Xr(e,pt(j),"text"):e&&(Y.to!=null&&(n=pt(j)),Y.from!=null&&(r=pt(j))),j.markedSpans=Ji(j.markedSpans,Y),Y.from==null&&this.collapsed&&!_r(this.doc,j)&&e&&mt(j,Ri(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var re=yr(this.lines[Q]),pe=en(re);pe>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&sr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&Jt(e,"markerCleared",e,this,r,n),t&&gi(e),this.parent&&this.parent.clear()},Qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var S=this.lines[n],j=Lr(S.markedSpans,this);if(j.from!=null&&(i=Be(t?S:pt(S),j.from),e==-1))return i;if(j.to!=null&&(r=Be(t?S:pt(S),j.to),e==1))return r}return i&&{from:i,to:r}},Qr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;fr(r,function(){var n=t.line,S=pt(t.line),j=fa(r,S);if(j&&(no(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_r(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Q=nn(i)-Y;Q&&mt(n,n.height+Q)}Jt(r,"markerChanged",r,e)})},Qr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ue(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Qr.prototype.detachLine=function(e){if(this.lines.splice(ue(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},le(Qr);function Bi(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return zt(e.cm,Bi)(e,t,i,r,n);var S=new Qr(e,n),j=ht(t,i);if(r&&N(r,S,!1),j>0||j==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=y("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Mn(e,t.line,t,i,S)||t.line!=i.line&&Mn(e,i.line,t,i,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}S.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,re;if(e.iter(Y,i.line+1,function(ge){Q&&S.collapsed&&!Q.options.lineWrapping&&yr(ge)==Q.display.maxLine&&(re=!0),S.collapsed&&Y!=t.line&&mt(ge,0),sa(ge,new ai(S,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),S.collapsed&&e.iter(t.line,i.line+1,function(ge){_r(e,ge)&&mt(ge,0)}),S.clearOnEnter&&Pe(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++ts,S.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),S.collapsed)sr(Q,t.line,i.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var pe=t.line;pe<=i.line;pe++)Xr(Q,pe,"text");S.atomic&&zo(Q.doc),Jt(Q,"markerAdded",Q,S)}return S}var bn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};bn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Jt(this,"clear")},bn.prototype.find=function(e,t){return this.primary.find(e,t)},le(bn);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var S=[Bi(e,t,i,r,n)],j=S[0],Y=r.widgetNode;return Jr(e,function(Q){Y&&(r.widgetNode=Y.cloneNode(!0)),S.push(Bi(Q,ft(Q,t),ft(Q,i),r,n));for(var re=0;re<Q.linked.length;++re)if(Q.linked[re].isParent)return;j=s(S)}),new bn(S,j)}function rs(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),S=e.clipPos(n.from),j=e.clipPos(n.to);if(ht(S,j)){var Y=Bi(e,S,j,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],S=[n.primary.doc];Jr(n.primary.doc,function(Q){return S.push(Q)});for(var j=0;j<n.markers.length;j++){var Y=n.markers[j];ue(S,Y.doc)==-1&&(Y.parent=null,n.markers.splice(j--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,lr=function(e,t,i,r,n){if(!(this instanceof lr))return new lr(e,t,i,r,n);i==null&&(i=0),vn.call(this,[new gn([new li("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var S=Be(i,0);this.sel=$r(S),this.history=new Vn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:S,to:S,text:e}),er(this,$r(S),xe)};lr.prototype=F(vn.prototype,{constructor:lr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Zt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Kt(function(e){var t=Be(this.first,0),i=this.first+this.size-1;Ni(this,{from:t,to:Be(i,$e(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&sn(this.cm,0,0),er(this,$r(t),xe)}),replaceRange:function(e,t,i,r){t=ft(this,t),i=i?ft(this,i):t,Fi(this,e,t,i,r)},getRange:function(e,t,i){var r=Tt(this,ft(this,e),ft(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(vr(this,e))return $e(this,e)},getLineNumber:function(e){return pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=$e(this,e)),yr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Kt(function(e,t,i){Wo(this,ft(this,typeof e=="number"?Be(e,t||0):e),null,i)}),setSelection:Kt(function(e,t,i){Wo(this,ft(this,e),ft(this,t||e),i)}),extendSelection:Kt(function(e,t,i){Yn(this,ft(this,e),t&&ft(this,t),i)}),extendSelections:Kt(function(e,t){jo(this,Ue(this,e),t)}),extendSelectionsBy:Kt(function(e,t){var i=f(this.sel.ranges,e);jo(this,Ue(this,i),t)}),setSelections:Kt(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new kt(ft(this,e[n].anchor),ft(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),er(this,Dr(this.cm,r,t),i)}),addSelection:Kt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new kt(ft(this,e),ft(this,t||e))),er(this,Dr(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=Tt(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=Tt(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:Kt(function(e,t,i){for(var r=[],n=this.sel,S=0;S<n.ranges.length;S++){var j=n.ranges[S];r[S]={from:j.from(),to:j.to(),text:this.splitLines(e[S]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)Ni(this,r[Q]);Y?Ho(this,Y):this.cm&&_i(this.cm)}),undo:Kt(function(){Jn(this,"undo")}),redo:Kt(function(){Jn(this,"redo")}),undoSelection:Kt(function(){Jn(this,"undo",!0)}),redoSelection:Kt(function(){Jn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Vn(this.history.maxGeneration),Jr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Mi(this.history.done),undone:Mi(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=Mi(e.done.slice(0),null,!0),t.undone=Mi(e.undone.slice(0),null,!0)},setGutterMarker:Kt(function(e,t,i){return mn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Oe(n)&&(r.gutterMarkers=null),!0})}),clearGutter:Kt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&mn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Oe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!vr(this,e))return null;if(t=e,e=$e(this,e),!e)return null}else if(t=pt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(E(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[n];if(S)if(i==null)r[n]=null;else{var j=S.match(E(i));if(!j)return!1;var Y=j.index+j[0].length;r[n]=S.slice(0,j.index)+(!j.index||Y==S.length?"":" ")+S.slice(Y)||null}else return!1;return!0})}),addLineWidget:Kt(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Bi(this,ft(this,e),ft(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ft(this,e),Bi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],i=$e(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ft(this,e),t=ft(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(S){var j=S.markedSpans;if(j)for(var Y=0;Y<j.length;Y++){var Q=j[Y];!(Q.to!=null&&n==e.line&&e.ch>=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!i||i(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var S=n.text.length+r;if(S>e)return t=e,!0;e-=S,++i}),ft(this,Be(i,t))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new lr(Zt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new lr(Zt(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Mt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Cl(rs(this));break}if(e.history==this.history){var r=[e.id];Jr(e,function(n){return r.push(n.id)},!0),e.history=new Vn(null),e.history.done=Mi(this.history.done,r),e.history.undone=Mi(this.history.undone,r)}},iterLinkedDocs:function(e){Jr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ot(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Kt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),lr.prototype.eachLine=lr.prototype.iter;var is=0;function Al(e){var t=this;if(ns(t),ee(t,e)||Wr(t.display,e))return;te(e),G&&(is=+new Date);var i=di(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,S=Array(n),j=0,Y=function(){++j==n&&zt(t,function(){i=ft(t.doc,i);var Ce={from:i,to:i,text:t.doc.splitLines(S.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ni(t.doc,Ce),Ho(t.doc,$r(ft(t.doc,i),ft(t.doc,Zr(Ce))))})()},Q=function(Ce,Ie){if(t.options.allowDropFileTypes&&ue(t.options.allowDropFileTypes,Ce.type)==-1){Y();return}var Fe=new FileReader;Fe.onerror=function(){return Y()},Fe.onload=function(){var je=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){Y();return}S[Ie]=je,Y()},Fe.readAsText(Ce)},re=0;re<r.length;re++)Q(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),$n(t.doc,$r(i,i)),ge)for(var Ae=0;Ae<ge.length;++Ae)Fi(t.doc,"",ge[Ae].anchor,ge[Ae].head,"drag");t.replaceSelection(pe,"around","paste"),t.display.input.focus()}}catch(Ce){}}}function Ll(e,t){if(G&&(!e.state.draggingText||+new Date-is<100)){ce(t);return}if(ee(e,t)||Wr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!I){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function kl(e,t){var i=di(e,t);if(!i)return;var r=document.createDocumentFragment();go(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var S=0;S<i.length;S++)e(i[S])})}var os=!1;function Rl(){if(os)return;Dl(),os=!0}function Dl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Ol)},100))}),Pe(window,"blur",function(){return as(Oi)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},xn=0;xn<10;xn++)qr[xn+48]=qr[xn+96]=String(xn);for(var Qn=65;Qn<=90;Qn++)qr[Qn]=String.fromCharCode(Qn);for(var En=1;En<=12;En++)qr[En+111]=qr[En+63235]="F"+En;var Hr={};Hr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Hr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Hr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Hr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Hr.default=l?Hr.macDefault:Hr.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,S,j=0;j<t.length-1;j++){var Y=t[j];if(/^(cmd|meta|m)$/i.test(Y))S=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(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=f(i.split(" "),_l),S=0;S<n.length;S++){var j=void 0,Y=void 0;S==n.length-1?(Y=n.join(" "),j=r):(Y=n.slice(0,S+1).join(" "),j="...");var Q=t[Y];if(!Q)t[Y]=j;else if(Q!=j)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var re in t)e[re]=t[re];return e}function Ui(e,t,i,r){t=qn(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ui(e,t.fallthrough,i,r);for(var S=0;S<t.fallthrough.length;S++){var j=Ui(e,t.fallthrough[S],i,r);if(j)return j}}}function ss(e){var t=typeof e=="string"?e:qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=qr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function qn(e){return typeof e=="string"?Hr[e]:e}function ji(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var S=t(i[n]);r.length&&ht(S.from,s(r).to)<=0;){var j=r.pop();if(ht(j.from,S.from)<0){S.from=j.from;break}}r.push(S)}fr(e,function(){for(var Y=r.length-1;Y>=0;Y--)Fi(e.doc,"",r[Y].from,r[Y].to,"+delete");_i(e)})}function Fa(e,t,i){var r=_e(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ba(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Be(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var S=Ye(i,t.doc.direction);if(S){var j=n<0?s(S):S[0],Y=n<0==(j.level==1),Q=Y?"after":"before",re;if(j.level>0||t.doc.direction=="rtl"){var pe=ki(t,i);re=n<0?i.text.length-1:0;var ge=Mr(t,pe,re).top;re=Ne(function(Ae){return Mr(t,pe,Ae).top==ge},n<0==(j.level==1)?j.from:j.to-1,re),Q=="before"&&(re=Fa(i,re,1))}else re=n<0?j.to:j.from;return new Be(r,re,Q)}}return new Be(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Ye(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 S=ze(n,i.ch,i.sticky),j=n[S];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>i.ch:j.from<i.ch))return Ba(t,i,r);var Y=function(Ke,Ze){return Fa(t,Ke instanceof Be?Ke.ch:Ke,Ze)},Q,re=function(Ke){return e.options.lineWrapping?(Q=Q||ki(e,t),co(e,t,Q,Ke)):{begin:0,end:t.text.length}},pe=re(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||j.level==1){var ge=j.level==1==r<0,Ae=Y(i,ge?1:-1);if(Ae!=null&&(ge?Ae<=j.to&&Ae<=pe.end:Ae>=j.from&&Ae>=pe.begin)){var Ce=ge?"before":"after";return new Be(i.line,Ae,Ce)}}var Ie=function(Ke,Ze,Ve){for(var et=function(Ot,Vt){return Vt?new Be(i.line,Y(Ot,1),"before"):new Be(i.line,Ot,"after")};Ke>=0&&Ke<n.length;Ke+=Ze){var ut=n[Ke],st=Ze>0==(ut.level!=1),gt=st?Ve.begin:Y(Ve.end,-1);if(ut.from<=gt&><ut.to)return et(gt,st);if(gt=st?ut.from:Y(ut.to,-1),Ve.begin<=gt&><Ve.end)return et(gt,st)}},Fe=Ie(S+r,r,pe);if(Fe)return Fe;var je=r>0?pe.end:Y(pe.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Fe=Ie(r>0?0:n.length-1,r,re(je)),Fe)?Fe:null}var Sn={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return ji(e,function(t){if(t.empty()){var i=$e(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Be(t.head.line+1,0)}:{from:t.head,to:Be(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ji(e,function(t){return{from:Be(t.from().line,0),to:ft(e.doc,Be(t.to().line+1,0))}})},delLineLeft:function(e){return ji(e,function(t){return{from:Be(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Se)},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")},Se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ds(e,t.head):r},Se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var S=i[n].from(),j=$(e.getLine(S.line),S.ch,r);t.push(z(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return 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,S=$e(e.doc,n.line).text;if(S){if(n.ch==S.length&&(n=new Be(n.line,n.ch-1)),n.ch>0)n=new Be(n.line,n.ch+1),e.replaceRange(S.charAt(n.ch-1)+S.charAt(n.ch-2),Be(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=$e(e.doc,n.line-1).text;j&&(n=new Be(n.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Be(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);_i(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var i=$e(e.doc,t),r=yr(i);return r!=i&&(t=pt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=$e(e.doc,t),r=In(i);return r!=i&&(t=pt(r)),Ua(!0,e,i,t,-1)}function ds(e,t){var i=hs(e,t.line),r=$e(e.doc,i.line),n=Ye(r,e.doc.direction);if(!n||n[0].level==0){var S=Math.max(i.ch,r.text.search(/\S/)),j=t.line==i.line&&t.ch<=S&&t.ch;return Be(i.line,j?0:S,i.sticky)}return i}function ea(e,t,i){if(typeof t=="string"&&(t=Sn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=Ui(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&Ui(t,e.options.extraKeys,i,e)||Ui(t,e.options.keyMap,i,e)}var Fl=new ne;function Tn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),cs(e,n+" "+t,i,r))return!0}return cs(e,t,i,r)}function cs(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Jt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(te(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Tn(e,"Shift-"+i,t,function(r){return ea(e,r,!0)})||Tn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Tn(e,i,t,function(r){return ea(e,r)}):!1}function Bl(e,t,i){return Tn(e,"'"+i+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=B(),ee(t,e))return;G&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);A&&(ja=r?i:null,!r&&i==88&&!wt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(p(t,"CodeMirror-crosshair"),Qe(document,"keyup",i),Qe(document,"mouseover",i))}Pe(document,"keyup",i),Pe(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),ee(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Wr(t.display,e)||ee(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==ja){ja=null,te(e);return}if(A&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(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&&ht(t,this.pos)==0&&i==this.button};var Cn,wn;function Wl(e,t){var i=+new Date;return wn&&wn.compare(i,e,t)?(Cn=wn=null,"triple"):Cn&&Cn.compare(i,e,t)?(wn=new Wa(i,e,t),Cn=null,"double"):(Cn=new Wa(i,e,t),wn=null,"single")}function vs(e){var t=this,i=t.display;if(ee(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Wr(i,e)){M||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=di(t,e),n=Ee(e),S=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,S,e))return;n==1?r?zl(t,r,S,e):ve(e)==i.scroller&&te(e):n==2?(r&&Yn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Tn(e,ls(S,n),n,function(j){if(typeof j=="string"&&(j=Sn[j]),!j)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=j(e,i)!=ke}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var S=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(P(vo,e),0):e.curOp.focus=B();var n=Gl(e,i,r),S=e.doc.sel,j;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(j=S.contains(t))>-1&&(ht((j=S.ranges[j]).from(),t)<0||t.xRel>0)&&(ht(j.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,S=!1,j=zt(e,function(re){M&&(n.scroller.draggable=!1),e.state.draggingText=!1,Qe(n.wrapper.ownerDocument,"mouseup",j),Qe(n.wrapper.ownerDocument,"mousemove",Y),Qe(n.scroller,"dragstart",Q),Qe(n.scroller,"drop",j),S||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),M&&!I||G&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(re){S=S||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return S=!0};M&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Pe(n.wrapper.ownerDocument,"mouseup",j),Pe(n.wrapper.ownerDocument,"mousemove",Y),Pe(n.scroller,"dragstart",Q),Pe(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(Be(t.line,0),ft(e.doc,Be(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,S=e.doc;te(t);var j,Y,Q=S.sel,re=Q.ranges;if(r.addNew&&!r.extend?(Y=S.sel.contains(i),Y>-1?j=re[Y]:j=new kt(i,i)):(j=S.sel.primary(),Y=S.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new kt(i,i)),i=di(e,t,!0,!0),Y=-1;else{var pe=ys(e,i,r.unit);r.extend?j=Ia(j,pe.anchor,pe.head,r.extend):j=pe}r.addNew?Y==-1?(Y=re.length,er(S,Dr(e,re.concat([j]),Y),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Y].empty()&&r.unit=="char"&&!r.extend?(er(S,Dr(e,re.slice(0,Y).concat(re.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=S.sel):Na(S,Y,j,Re):(Y=0,er(S,new xr([j],0),Re),Q=S.sel);var ge=i;function Ae(Ve){if(ht(ge,Ve)==0)return;if(ge=Ve,r.unit=="rectangle"){for(var et=[],ut=e.options.tabSize,st=$($e(S,i.line).text,i.ch,ut),gt=$($e(S,Ve.line).text,Ve.ch,ut),Ot=Math.min(st,gt),Vt=Math.max(st,gt),Nt=Math.min(i.line,Ve.line),pr=Math.min(e.lastLine(),Math.max(i.line,Ve.line));Nt<=pr;Nt++){var ur=$e(S,Nt).text,jt=Te(ur,Ot,ut);Ot==Vt?et.push(new kt(Be(Nt,jt),Be(Nt,jt))):ur.length>jt&&et.push(new kt(Be(Nt,jt),Be(Nt,Te(ur,Vt,ut))))}et.length||et.push(new kt(i,i)),er(S,Dr(e,Q.ranges.slice(0,Y).concat(et),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var hr=j,Qt=ys(e,Ve,r.unit),Gt=hr.anchor,Wt;ht(Qt.anchor,Gt)>0?(Wt=Qt.head,Gt=ii(hr.from(),Qt.anchor)):(Wt=Qt.anchor,Gt=xi(hr.to(),Qt.head));var Ft=Q.ranges.slice(0);Ft[Y]=Xl(e,new kt(ft(S,Gt),Wt)),er(S,Dr(e,Ft,Y),Re)}}var Ce=n.wrapper.getBoundingClientRect(),Ie=0;function Fe(Ve){var et=++Ie,ut=di(e,Ve,!0,r.unit=="rectangle");if(!ut)return;if(ht(ut,ge)!=0){e.curOp.focus=B(),Ae(ut);var st=Hn(n,S);(ut.line>=st.to||ut.line<st.from)&&setTimeout(zt(e,function(){Ie==et&&Fe(Ve)}),150)}else{var gt=Ve.clientY<Ce.top?-20:Ve.clientY>Ce.bottom?20:0;gt&&setTimeout(zt(e,function(){if(Ie!=et)return;n.scroller.scrollTop+=gt,Fe(Ve)}),50)}}function je(Ve){e.state.selectingText=!1,Ie=Infinity,Ve&&(te(Ve),n.input.focus()),Qe(n.wrapper.ownerDocument,"mousemove",Ke),Qe(n.wrapper.ownerDocument,"mouseup",Ze),S.history.lastSelOrigin=null}var Ke=zt(e,function(Ve){Ve.buttons===0||!Ee(Ve)?je(Ve):Fe(Ve)}),Ze=zt(e,je);e.state.selectingText=Ze,Pe(n.wrapper.ownerDocument,"mousemove",Ke),Pe(n.wrapper.ownerDocument,"mouseup",Ze)}function Xl(e,t){var i=t.anchor,r=t.head,n=$e(e.doc,i.line);if(ht(i,r)==0&&i.sticky==r.sticky)return t;var S=Ye(n);if(!S)return t;var j=ze(S,i.ch,i.sticky),Y=S[j];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Q=j+(Y.from==i.ch==(Y.level!=1)?0:1);if(Q==0||Q==S.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=ze(S,r.ch,r.sticky),ge=pe-j||(r.ch-i.ch)*(Y.level==1?-1:1);pe==Q-1||pe==Q?re=ge<0:re=ge>0}var Ae=S[Q+(re?-1:0)],Ce=re==(Ae.level==1),Ie=Ce?Ae.from:Ae.to,Fe=Ce?"after":"before";return i.ch==Ie&&i.sticky==Fe?t:new kt(new Be(i.line,Ie,Fe),r)}function bs(e,t,i,r){var n,S;if(t.touches)n=t.touches[0].clientX,S=t.touches[0].clientY;else try{n=t.clientX,S=t.clientY}catch(Ae){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var j=e.display,Y=j.lineDiv.getBoundingClientRect();if(S>Y.bottom||!ae(e,i))return he(t);S-=Y.top-j.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=j.gutters.childNodes[Q];if(re&&re.getBoundingClientRect().right>=n){var pe=At(e.doc,S),ge=e.display.gutterSpecs[Q];return se(e,i,e,pe,ge.className,t),he(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Wr(e.display,t)||Yl(e,t))return;if(ee(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Wi={toString:function(){return"CodeMirror.Init"}},Ss={},ta={};function $l(e){var t=e.optionHandlers;function i(r,n,S,j){e.defaults[r]=n,S&&(t[r]=j?function(Y,Q,re){re!=Wi&&S(Y,Q,re)}:S)}e.defineOption=i,e.Init=Wi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,_a(r)},!0),i("indentUnit",2,_a,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){fn(r),an(r),sr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var S=[],j=r.doc.first;r.doc.iter(function(Q){for(var re=0;;){var pe=Q.text.indexOf(n,re);if(pe==-1)break;re=pe+n.length,S.push(Be(j,pe))}j++});for(var Y=S.length-1;Y>=0;Y--)Fi(r.doc,n,S[Y],Be(S[Y].line,S[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,S){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),S!=Wi&&r.refresh()}),i("specialCharPlaceholder",Dt,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",!T),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),cn(r)},!0),i("keyMap","default",function(r,n,S){var j=qn(n),Y=S!=Wi&&qn(S);Y&&Y.detach&&Y.detach(r,j),j.attach&&j.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Da(n,r.options.lineNumbers),cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?xa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pi(r)},!0),i("scrollbarStyle","native",function(r){Co(r),Pi(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=Da(r.options.gutters,n),cn(r)},!0),i("firstLineNumber",1,cn,!0),i("lineNumberFormatter",function(r){return r},cn,!0),i("showCursorWhenSelecting",!1,on,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,on,!0),i("singleCursorHeightPerLine",!0,on,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,fn,!0),i("addModeClass",!1,fn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,fn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=Wi;if(!t!=!r){var n=e.display.dragFunctions,S=t?Pe:Qe;S(e.display.scroller,"dragstart",n.start),S(e.display.scroller,"dragenter",n.enter),S(e.display.scroller,"dragover",n.over),S(e.display.scroller,"dragleave",n.leave),S(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Ea(e),sr(e),an(e),setTimeout(function(){return Pi(e)},100)}function Mt(e,t){var i=this;if(!(this instanceof Mt))return new Mt(e,t);this.options=t=t?N(t):{},N(Ss,t,!1);var r=t.value;typeof r=="string"?r=new lr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Mt.inputStyles[t.inputStyle](this),S=this.display=new hl(e,r,n,t);S.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Co(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ne,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),G&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),Rl(),mi(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Oi(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Wi);Lo(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);gi(this),M&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Mt.defaults=Ss,Mt.optionHandlers=ta;function Ql(e){var t=e.display;Pe(t.scroller,"mousedown",zt(e,vs)),G&&H<11?Pe(t.scroller,"dblclick",zt(e,function(Q){if(ee(e,Q))return;var re=di(e,Q);if(!re||Ha(e,Q)||Wr(e.display,Q))return;te(Q);var pe=e.findWordAt(re);Yn(e.doc,pe.anchor,pe.head)})):Pe(t.scroller,"dblclick",function(Q){return ee(e,Q)||te(Q)}),Pe(t.scroller,"contextmenu",function(Q){return xs(e,Q)}),Pe(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||xs(e,Q)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(Q){if(Q.touches.length!=1)return!1;var re=Q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function j(Q,re){if(re.left==null)return!0;var pe=re.left-Q.left,ge=re.top-Q.top;return pe*pe+ge*ge>20*20}Pe(t.scroller,"touchstart",function(Q){if(!ee(e,Q)&&!S(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!Wr(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ge;!re.prev||j(re,re.prev)?ge=new kt(pe,pe):!re.prev.prev||j(re,re.prev.prev)?ge=e.findWordAt(pe):ge=new kt(Be(pe.line,0),ft(e.doc,Be(pe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(Q)}n()}),Pe(t.scroller,"touchcancel",n),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),se(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(Q){return Do(e,Q)}),Pe(t.scroller,"DOMMouseScroll",function(Q){return Do(e,Q)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){ee(e,Q)||ce(Q)},over:function(Q){ee(e,Q)||(kl(e,Q),ce(Q))},start:function(Q){return Ll(e,Q)},drop:zt(e,Al),leave:function(Q){ee(e,Q)||ns(e)}};var Y=t.input.getField();Pe(Y,"keyup",function(Q){return ms.call(e,Q)}),Pe(Y,"keydown",zt(e,ps)),Pe(Y,"keypress",zt(e,gs)),Pe(Y,"focus",function(Q){return Ta(e,Q)}),Pe(Y,"blur",function(Q){return Oi(e,Q)})}var Ga=[];Mt.defineInitHook=function(e){return Ga.push(e)};function An(e,t,i,r){var n=e.doc,S;i==null&&(i="add"),i=="smart"&&(n.mode.indent?S=Cr(e,t).state:i="prev");var j=e.options.tabSize,Y=$e(n,t),Q=$(Y.text,null,j);Y.stateAfter&&(Y.stateAfter=null);var re=Y.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(Y.text))pe=0,i="not";else if(i=="smart"&&(pe=n.mode.indent(S,Y.text.slice(re.length),Y.text),pe==ke||pe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?pe=$($e(n,t-1).text,null,j):pe=0:i=="add"?pe=Q+e.options.indentUnit:i=="subtract"?pe=Q-e.options.indentUnit:typeof i=="number"&&(pe=Q+i),pe=Math.max(0,pe);var ge="",Ae=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(pe/j);Ce;--Ce)Ae+=j,ge+=" ";if(Ae<pe&&(ge+=z(pe-Ae)),ge!=re)return Fi(n,ge,Be(t,0),Be(t,re.length),"+input"),Y.stateAfter=null,!0;for(var Ie=0;Ie<n.sel.ranges.length;Ie++){var Fe=n.sel.ranges[Ie];if(Fe.head.line==t&&Fe.head.ch<re.length){var je=Be(t,re.length);Na(n,Ie,new kt(je,je));break}}}var Or=null;function ra(e){Or=e}function za(e,t,i,r,n){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var j=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>j,Q=ot(t),re=null;if(Y&&r.ranges.length>1)if(Or&&Or.text.join(`
|
|
`)==t){if(r.ranges.length%Or.text.length==0){re=[];for(var pe=0;pe<Or.text.length;pe++)re.push(S.splitLines(Or.text[pe]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=f(Q,function(Ke){return[Ke]}));for(var ge=e.curOp.updateInput,Ae=r.ranges.length-1;Ae>=0;Ae--){var Ce=r.ranges[Ae],Ie=Ce.from(),Fe=Ce.to();Ce.empty()&&(i&&i>0?Ie=Be(Ie.line,Ie.ch-i):e.state.overwrite&&!Y?Fe=Be(Fe.line,Math.min($e(S,Fe.line).text.length,Fe.ch+s(Q).length)):Y&&Or&&Or.lineWise&&Or.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(Ie=Fe=Be(Ie.line,0)));var je={from:Ie,to:Fe,text:re?re[Ae%re.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>j?"cut":"+input")};Ni(e.doc,je),Jt(e,"inputRead",e,je)}t&&!Y&&Cs(e,t),_i(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ts(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&fr(t,function(){return za(t,i,0,null,"paste")}),!0}function Cs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var S=e.getModeAt(n.head),j=!1;if(S.electricChars){for(var Y=0;Y<S.electricChars.length;Y++)if(t.indexOf(S.electricChars.charAt(Y))>-1){j=An(e,n.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test($e(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=An(e,n.head.line,"smart")));j&&Jt(e,"electricInput",e,n.head.line)}}function ws(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,S={anchor:Be(n,0),head:Be(n+1,0)};i.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:i}}function As(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),As(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var S=this.options,j=S[r];if(S[r]==n&&r!="mode")return;S[r]=n,t.hasOwnProperty(r)&&zt(this,t[r])(this,n,j),se(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](qn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,S=0;S<n.length;++S)if(n[S]==r||n[S].name==r)return n.splice(S,1),!0},addOverlay:ir(function(r,n){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");D(this.state.overlays,{mode:S,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,sr(this)}),removeOverlay:ir(function(r){for(var n=this.state.overlays,S=0;S<n.length;++S){var j=n[S].modeSpec;if(j==r||typeof r=="string"&&j.name==r){n.splice(S,1),this.state.modeGen++,sr(this);return}}}),indentLine:ir(function(r,n,S){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),vr(this.doc,r)&&An(this,r,n,S)}),indentSelection:ir(function(r){for(var n=this.doc.sel.ranges,S=-1,j=0;j<n.length;j++){var Y=n[j];if(Y.empty())Y.head.line>S&&(An(this,Y.head.line,r,!0),S=Y.head.line,j==this.doc.sel.primIndex&&_i(this));else{var Q=Y.from(),re=Y.to(),pe=Math.max(S,Q.line);S=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ge=pe;ge<S;++ge)An(this,ge,r);var Ae=this.doc.sel.ranges;Q.ch==0&&n.length==Ae.length&&Ae[j].from().ch>0&&Na(this.doc,j,new kt(Q,Ae[j].to()),xe)}}}),getTokenAt:function(r,n){return kn(this,r,n)},getLineTokens:function(r,n){return kn(this,Be(r),n,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var n=ni(this,$e(this.doc,r.line)),S=0,j=(n.length-1)/2,Y=r.ch,Q;if(Y==0)Q=n[2];else for(;;){var re=S+j>>1;if((re?n[re*2-1]:0)>=Y)j=re;else if(n[re*2+1]<Y)S=re+1;else{Q=n[re*2+2];break}}var pe=Q?Q.indexOf("overlay "):-1;return pe<0?Q:pe==0?null:Q.slice(0,pe-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var S=[];if(!i.hasOwnProperty(n))return S;var j=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")j[Y[n]]&&S.push(j[Y[n]]);else if(Y[n])for(var Q=0;Q<Y[n].length;Q++){var re=j[Y[n][Q]];re&&S.push(re)}else Y.helperType&&j[Y.helperType]?S.push(j[Y.helperType]):j[Y.name]&&S.push(j[Y.name]);for(var pe=0;pe<j._global.length;pe++){var ge=j._global[pe];ge.pred(Y,this)&&ue(S,ge.val)==-1&&S.push(ge.val)}return S},getStateAfter:function(r,n){var S=this.doc;return r=Ei(S,r==null?S.first+S.size-1:r),Cr(this,r+1,n).state},cursorCoords:function(r,n){var S,j=this.doc.sel.primary();return r==null?S=j.head:typeof r=="object"?S=ft(this.doc,r):S=r?j.from():j.to(),Rr(this,S,n||"page")},charCoords:function(r,n){return ma(this,ft(this.doc,r),n||"page")},coordsChar:function(r,n){return r=lo(this,r,n||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,n){return r=lo(this,{top:r,left:0},n||"page").top,At(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,S){var j=!1,Y;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,j=!0),Y=$e(this.doc,r)}else Y=r;return Bn(this,Y,{top:0,left:0},n||"page",S||j).top+(j?this.doc.height-kr(Y):0)},defaultTextHeight:function(){return Ri(this.display)},defaultCharWidth:function(){return Di(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,S,j,Y){var Q=this.display;r=Rr(this,ft(this.doc,r));var re=r.bottom,pe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),j=="over")re=r.top;else if(j=="above"||j=="near"){var ge=Math.max(Q.wrapper.clientHeight,this.doc.height),Ae=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(j=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(re=r.bottom),pe+n.offsetWidth>Ae&&(pe=Ae-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",Y=="right"?(pe=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?pe=0:Y=="middle"&&(pe=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=pe+"px"),S&&Zs(this,{left:pe,top:re,right:pe+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:ir(ps),triggerOnKeyPress:ir(gs),triggerOnKeyUp:ms,triggerOnMouseDown:ir(vs),execCommand:function(r){if(Sn.hasOwnProperty(r))return Sn[r].call(null,this)},triggerElectric:ir(function(r){Cs(this,r)}),findPosH:function(r,n,S,j){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=ft(this.doc,r),re=0;re<n&&!(Q=Ka(this.doc,Q,Y,S,j),Q.hitSide);++re);return Q},moveH:ir(function(r,n){var S=this;this.extendSelectionsBy(function(j){return S.display.shift||S.doc.extend||j.empty()?Ka(S.doc,j.head,r,n,S.options.rtlMoveVisually):r<0?j.from():j.to()},Se)}),deleteH:ir(function(r,n){var S=this.doc.sel,j=this.doc;S.somethingSelected()?j.replaceSelection("",null,"+delete"):ji(this,function(Y){var Q=Ka(j,Y.head,r,n,!1);return r<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(r,n,S,j){var Y=1,Q=j;n<0&&(Y=-1,n=-n);for(var re=ft(this.doc,r),pe=0;pe<n;++pe){var ge=Rr(this,re,"div");if(Q==null?Q=ge.left:ge.left=Q,re=ks(this,ge,Y,S),re.hitSide)break}return re},moveV:ir(function(r,n){var S=this,j=this.doc,Y=[],Q=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(pe){if(Q)return r<0?pe.from():pe.to();var ge=Rr(S,pe.head,"div");pe.goalColumn!=null&&(ge.left=pe.goalColumn),Y.push(ge.left);var Ae=ks(S,ge,r,n);return n=="page"&&pe==j.sel.primary()&&wa(S,ma(S,Ae,"div").top-ge.top),Ae},Se),Y.length)for(var re=0;re<j.sel.ranges.length;re++)j.sel.ranges[re].goalColumn=Y[re]}),findWordAt:function(r){var n=this.doc,S=$e(n,r.line).text,j=r.ch,Y=r.ch;if(S){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==S.length)&&j?--j:++Y;for(var re=S.charAt(j),pe=we(re,Q)?function(ge){return we(ge,Q)}:/\s/.test(re)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!we(ge)};j>0&&pe(S.charAt(j-1));)--j;for(;Y<S.length&&pe(S.charAt(Y));)++Y}return new kt(Be(r.line,j),Be(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):p(this.display.cursorDiv,"CodeMirror-overwrite"),se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==B()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ir(function(r,n){sn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Pr(this)-this.display.barHeight,width:r.scrollWidth-Pr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:ui(this)}},scrollIntoView:ir(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:Be(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):xo(this,r.from,r.to,r.margin)}),setSize:ir(function(r,n){var S=this,j=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=j(r)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&ao(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var re=0;re<Q.widgets.length;re++)if(Q.widgets[re].noHScroll){Xr(S,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,se(this,"refresh",this)}),operation:function(r){return fr(this,r)},startOperation:function(){return mi(this)},endOperation:function(){return gi(this)},refresh:ir(function(){var r=this.display.cachedTextHeight;sr(this),this.curOp.forceUpdate=!0,an(this),sn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Ri(this.display))>.5||this.options.lineWrapping)&&Ea(this),se(this,"refresh",this)}),swapDoc:ir(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),an(this),this.display.input.reset(),sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Jt(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},le(e),e.registerHelper=function(r,n,S){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=S},e.registerGlobalHelper=function(r,n,S,j){e.registerHelper(r,n,j),i[r]._global.push({pred:S,val:j})}}function Ka(e,t,i,r,n){var S=t,j=i,Y=$e(e,t.line),Q=n&&e.direction=="rtl"?-i:i;function re(){var Ze=t.line+Q;return Ze<e.first||Ze>=e.first+e.size?!1:(t=new Be(Ze,t.ch,t.sticky),Y=$e(e,Ze))}function pe(Ze){var Ve;if(r=="codepoint"){var et=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(et)?Ve=null:Ve=new Be(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(et>=55296&&et<56320?2:1))),-i)}else n?Ve=Ml(e.cm,Y,t,i):Ve=Ba(Y,t,i);if(Ve==null)if(!Ze&&re())t=Ua(n,e.cm,Y,t.line,Q);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ge=null,Ae=r=="group",Ce=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(i<0&&!pe(!Ie));Ie=!1){var Fe=Y.text.charAt(t.ch)||`
|
|
`,je=we(Fe,Ce)?"w":Ae&&Fe==`
|
|
`?"n":!Ae||/\s/.test(Fe)?null:"p";if(Ae&&!Ie&&!je&&(je="s"),ge&&ge!=je){i<0&&(i=1,pe(),t.sticky="after");break}if(je&&(ge=je),i>0&&!pe(!Ie))break}var Ke=Zn(e,t,S,j,!0);return ri(S,Ke)&&(Ke.hitSide=!0),Ke}function ks(e,t,i,r){var n=e.doc,S=t.left,j;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*Ri(e.display),3);j=(i>0?t.bottom:t.top)+i*Q}else r=="line"&&(j=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,S,j),!re.outside);){if(i<0?j<=0:j>=n.height){re.hitSide=!0;break}j+=i*5}return re}var Rt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ne,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Rt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;As(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Pe(n,"paste",function(Y){if(!S(Y)||ee(r,Y)||Ts(Y,r))return;H<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),Pe(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Pe(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Pe(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(n,"touchstart",function(){return i.forceCompositionEnd()}),Pe(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(Y){if(!S(Y)||ee(r,Y))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);ra({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var re=Or.text.join(`
|
|
`);if(Y.clipboardData.setData("Text",re),Y.clipboardData.getData("Text")==re){Y.preventDefault();return}}var pe=Ls(),ge=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ge.value=Or.text.join(`
|
|
`);var Ae=document.activeElement;K(ge),setTimeout(function(){r.display.lineSpace.removeChild(pe),Ae.focus(),Ae==n&&i.showPrimarySelection()},50)}Pe(n,"copy",j),Pe(n,"cut",j)},Rt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Rt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Rt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Rt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Rt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var S=ia(t,e.anchorNode,e.anchorOffset),j=ia(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&j&&!j.bad&&ht(ii(S,j),r)==0&&ht(xi(S,j),n)==0)return;var Y=t.display.view,Q=r.line>=t.display.viewFrom&&Rs(t,r)||{node:Y[0].measure.map[2],offset:0},re=n.line<t.display.viewTo&&Rs(t,n);if(!re){var pe=Y[Y.length-1].measure,ge=pe.maps?pe.maps[pe.maps.length-1]:pe.map;re={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Q||!re){e.removeAllRanges();return}var Ae=e.rangeCount&&e.getRangeAt(0),Ce;try{Ce=m(Q.node,Q.offset,re.offset,re.node)}catch(Ie){}Ce&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),Ce.collapsed||(e.removeAllRanges(),e.addRange(Ce))):(e.removeAllRanges(),e.addRange(Ce)),Ae&&e.anchorNode==null?e.addRange(Ae):O&&this.startGracePeriod()),this.rememberSelection()},Rt.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)},Rt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Rt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Rt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},Rt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Rt.prototype.blur=function(){this.div.blur()},Rt.prototype.getField=function(){return this.div},Rt.prototype.supportsTouch=function(){return!0},Rt.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)},Rt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Rt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&b&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=ia(t,e.anchorNode,e.anchorOffset),r=ia(t,e.focusNode,e.focusOffset);i&&r&&fr(t,function(){er(t.doc,$r(i,r),xe),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Rt.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=Be(r.line-1,$e(e.doc,r.line-1).length)),n.ch==$e(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Be(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var S,j,Y;r.line==t.viewFrom||(S=ci(e,r.line))==0?(j=pt(t.view[0].line),Y=t.view[0].node):(j=pt(t.view[S].line),Y=t.view[S-1].node.nextSibling);var Q=ci(e,n.line),re,pe;if(Q==t.view.length-1?(re=t.viewTo-1,pe=t.lineDiv.lastChild):(re=pt(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!Y)return!1;for(var ge=e.doc.splitLines(tu(e,Y,pe,j,re)),Ae=Tt(e.doc,Be(j,0),Be(re,$e(e.doc,re).text.length));ge.length>1&&Ae.length>1;)if(s(ge)==s(Ae))ge.pop(),Ae.pop(),re--;else if(ge[0]==Ae[0])ge.shift(),Ae.shift(),j++;else break;for(var Ce=0,Ie=0,Fe=ge[0],je=Ae[0],Ke=Math.min(Fe.length,je.length);Ce<Ke&&Fe.charCodeAt(Ce)==je.charCodeAt(Ce);)++Ce;for(var Ze=s(ge),Ve=s(Ae),et=Math.min(Ze.length-(ge.length==1?Ce:0),Ve.length-(Ae.length==1?Ce:0));Ie<et&&Ze.charCodeAt(Ze.length-Ie-1)==Ve.charCodeAt(Ve.length-Ie-1);)++Ie;if(ge.length==1&&Ae.length==1&&j==r.line)for(;Ce&&Ce>r.ch&&Ze.charCodeAt(Ze.length-Ie-1)==Ve.charCodeAt(Ve.length-Ie-1);)Ce--,Ie++;ge[ge.length-1]=Ze.slice(0,Ze.length-Ie).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ce).replace(/\u200b+$/,"");var ut=Be(j,Ce),st=Be(re,Ae.length?s(Ae).length-Ie:0);if(ge.length>1||ge[0]||ht(ut,st))return Fi(e.doc,ge,ut,st,"+input"),!0},Rt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Rt.prototype.reset=function(){this.forceCompositionEnd()},Rt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Rt.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)},Rt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&fr(this.cm,function(){return sr(e.cm)})},Rt.prototype.setUneditable=function(e){e.contentEditable="false"},Rt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Rt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Rt.prototype.onContextMenu=function(){},Rt.prototype.resetPosition=function(){},Rt.prototype.needsContentAttribute=!0;function Rs(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=$e(e.doc,t.line),n=eo(i,r,t.line),S=Ye(r,e.doc.direction),j="left";if(S){var Y=ze(S,t.ch);j=Y%2?"right":"left"}var Q=io(n.map,t.ch,j);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var S="",j=!1,Y=e.doc.lineSeparator(),Q=!1;function re(Ce){return function(Ie){return Ie.id==Ce}}function pe(){j&&(S+=Y,Q&&(S+=Y),j=Q=!1)}function ge(Ce){Ce&&(pe(),S+=Ce)}function Ae(Ce){if(Ce.nodeType==1){var Ie=Ce.getAttribute("cm-text");if(Ie){ge(Ie);return}var Fe=Ce.getAttribute("cm-marker"),je;if(Fe){var Ke=e.findMarks(Be(r,0),Be(n+1,0),re(+Fe));Ke.length&&(je=Ke[0].find(0))&&ge(Tt(e.doc,je.from,je.to).join(Y));return}if(Ce.getAttribute("contenteditable")=="false")return;var Ze=/^(pre|div|p|li|table|br)$/i.test(Ce.nodeName);if(!/^br$/i.test(Ce.nodeName)&&Ce.textContent.length==0)return;Ze&&pe();for(var Ve=0;Ve<Ce.childNodes.length;Ve++)Ae(Ce.childNodes[Ve]);/^(pre|p)$/i.test(Ce.nodeName)&&(Q=!0),Ze&&(j=!0)}else Ce.nodeType==3&&ge(Ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ae(t),t==i);)t=t.nextSibling,Q=!1;return S}function ia(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Hi(e.clipPos(Be(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var S=e.display.view[n];if(S.node==r)return ru(S,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!x(r,t))return Hi(Be(pt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var S=e.rest?s(e.rest):e.line;return Hi(Be(pt(S),S.text.length),n)}var j=t.nodeType==3?t:null,Y=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,i&&(i=j.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Q=e.measure,re=Q.maps;function pe(je,Ke,Ze){for(var Ve=-1;Ve<(re?re.length:0);Ve++)for(var et=Ve<0?Q.map:re[Ve],ut=0;ut<et.length;ut+=3){var st=et[ut+2];if(st==je||st==Ke){var gt=pt(Ve<0?e.line:e.rest[Ve]),Ot=et[ut]+Ze;return(Ze<0||st!=je)&&(Ot=et[ut+(Ze?1:0)]),Be(gt,Ot)}}}var ge=pe(j,Y,i);if(ge)return Hi(ge,n);for(var Ae=Y.nextSibling,Ce=j?j.nodeValue.length-i:0;Ae;Ae=Ae.nextSibling){if(ge=pe(Ae,Ae.firstChild,0),ge)return Hi(Be(ge.line,ge.ch-Ce),n);Ce+=Ae.textContent.length}for(var Ie=Y.previousSibling,Fe=i;Ie;Ie=Ie.previousSibling){if(ge=pe(Ie,Ie.firstChild,-1),ge)return Hi(Be(ge.line,ge.ch+Fe),n);Fe+=Ie.textContent.length}}var Bt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ne,this.hasSelection=!1,this.composing=null};Bt.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"),Pe(n,"input",function(){G&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Pe(n,"paste",function(j){if(ee(r,j)||Ts(j,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function S(j){if(ee(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ws(r);ra({lineWise:!0,text:Y.text}),j.type=="cut"?r.setSelections(Y.ranges,null,xe):(i.prevInput="",n.value=Y.text.join(`
|
|
`),K(n))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Pe(n,"cut",S),Pe(n,"copy",S),Pe(e.scroller,"paste",function(j){if(Wr(e,j)||ee(r,j))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=j.clipboardData,n.dispatchEvent(Y)}),Pe(e.lineSpace,"selectstart",function(j){Wr(e,j)||te(j)}),Pe(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"})}}),Pe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Bt.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Bt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Bt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Rr(e,i.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+j.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+j.left-S.left))}return r},Bt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Bt.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&&K(this.textarea),G&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&H>=9&&(this.hasSelection=null))},Bt.prototype.getField=function(){return this.textarea},Bt.prototype.supportsTouch=function(){return!1},Bt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},Bt.prototype.blur=function(){this.textarea.blur()},Bt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Bt.prototype.receivedFocus=function(){this.slowPoll()},Bt.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()})},Bt.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)},Bt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||it(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(G&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=n.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,Y=Math.min(r.length,n.length);j<Y&&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},Bt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Bt.prototype.onKeyPress=function(){G&&H>=9&&(this.hasSelection=null),this.fastPoll()},Bt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=di(i,e),j=r.scroller.scrollTop;if(!S||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(S)==-1&&zt(i,er)(i.doc,$r(S),xe);var Q=n.style.cssText,re=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.left-5)+`px;
|
|
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;M&&(ge=window.scrollY),r.input.focus(),M&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ce,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Ae(){if(n.selectionStart!=null){var Fe=i.somethingSelected(),je="\u200B"+(Fe?n.value:"");n.value="\u21DA",n.value=je,t.prevInput=Fe?"":"\u200B",n.selectionStart=1,n.selectionEnd=je.length,r.selForContextMenu=i.doc.sel}}function Ce(){if(t.contextMenuPending!=Ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=Q,G&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),n.selectionStart!=null){(!G||G&&H<9)&&Ae();var Fe=0,je=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?zt(i,Xo)(i):Fe++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(G&&H>=9&&Ae(),L){ce(e);var Ie=function(){Qe(window,"mouseup",Ie),setTimeout(Ce,20)};Pe(window,"mouseup",Ie)}else setTimeout(Ce,50)},Bt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Bt.prototype.setUneditable=function(){},Bt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?N(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=Y.getValue()}var n;if(e.form&&(Pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;n=S.submit;try{var j=S.submit=function(){r(),S.submit=n,S.submit(),S.submit=j}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Mt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=Qe,e.on=Pe,e.wheelEventPixels=dl,e.Doc=lr,e.splitLines=ot,e.countColumn=$,e.findColumn=Te,e.isWordChar=be,e.Pass=ke,e.signal=se,e.Line=li,e.changeEnd=Zr,e.scrollbarModel=To,e.Pos=Be,e.cmpPos=ht,e.modes=_t,e.mimeModes=Et,e.resolveMode=Yt,e.getMode=gr,e.modeExtensions=cr,e.extendMode=zr,e.copyState=$t,e.startState=ti,e.innerMode=Nr,e.commands=Sn,e.keyMap=Hr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Ui,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=bn,e.TextMarker=Qr,e.LineWidget=yn,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=ce,e.addClass=W,e.contains=x,e.rmClass=p,e.keyNames=qr}$l(Mt),ql(Mt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in lr.prototype)lr.prototype.hasOwnProperty(na)&&ue(au,na)<0&&(Mt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(lr.prototype[na]));return le(lr),Mt.inputStyles={textarea:Bt,contenteditable:Rt},Mt.defineMode=function(e){!Mt.defaults.mode&&e!="null"&&(Mt.defaults.mode=e),mr.apply(this,arguments)},Mt.defineMIME=Tr,Mt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Mt.defineMIME("text/plain","null"),Mt.defineExtension=function(e,t){Mt.prototype[e]=t},Mt.defineDocExtension=function(e,t){lr.prototype[e]=t},Mt.fromTextArea=iu,nu(Mt),Mt.version="5.58.2",Mt})},X0ci:function(dt,Je,de){},Y1PL:function(dt,Je,de){"use strict";de.r(Je),de.d(Je,"ResizableTextArea",function(){return ue});var fe=de("wx14"),Z=de("1OyB"),O=de("vuIU"),J=de("Ji7U"),U=de("LK+K"),R=de("q1tI"),G=de("VTBJ"),H=de("rePB"),M=de("Zm9Q"),_=de("Kwbf"),b=de("c+Xe"),A=de("m+aA"),I=de("bdgK"),k=new Map;function w(xe){xe.forEach(function(Re){var Se,Te=Re.target;(Se=k.get(Te))===null||Se===void 0||Se.forEach(function(ye){return ye(Te)})})}var C=new I.default(w),d=null,o=null;function l(xe,Re){k.has(xe)||(k.set(xe,new Set),C.observe(xe)),k.get(xe).add(Re)}function h(xe,Re){k.has(xe)&&(k.get(xe).delete(Re),k.get(xe).size||(C.unobserve(xe),k.delete(xe)))}var T=function(xe){Object(J.a)(Se,xe);var Re=Object(U.a)(Se);function Se(){return Object(Z.a)(this,Se),Re.apply(this,arguments)}return Object(O.a)(Se,[{key:"render",value:function(){return this.props.children}}]),Se}(R.Component),v=R.createContext(null);function g(xe){var Re=xe.children,Se=xe.onBatchResize,Te=R.useRef(0),ye=R.useRef([]),z=R.useContext(v),s=R.useCallback(function(f,D,X){Te.current+=1;var F=Te.current;ye.current.push({size:f,element:D,data:X}),Promise.resolve().then(function(){F===Te.current&&(Se==null||Se(ye.current),ye.current=[])}),z==null||z(f,D,X)},[Se,z]);return R.createElement(v.Provider,{value:s},Re)}function L(xe){var Re=xe.children,Se=xe.disabled,Te=R.useRef(null),ye=R.useRef(null),z=R.useContext(v),s=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),f=R.isValidElement(Re)&&Object(b.c)(Re),D=f?Re.ref:null,X=R.useMemo(function(){return Object(b.a)(D,Te)},[D,Te]),F=R.useRef(xe);F.current=xe;var oe=R.useCallback(function(be){var we=F.current,Oe=we.onResize,Le=we.data,De=be.getBoundingClientRect(),_e=De.width,Ne=De.height,Ge=be.offsetWidth,He=be.offsetHeight,ze=Math.floor(_e),nt=Math.floor(Ne);if(s.current.width!==ze||s.current.height!==nt||s.current.offsetWidth!==Ge||s.current.offsetHeight!==He){var Ye={width:ze,height:nt,offsetWidth:Ge,offsetHeight:He};s.current=Ye;var Xe=Ge===Math.round(_e)?_e:Ge,Pe=He===Math.round(Ne)?Ne:He,rt=Object(G.a)(Object(G.a)({},Ye),{},{offsetWidth:Xe,offsetHeight:Pe});z==null||z(rt,be,Le),Oe&&Promise.resolve().then(function(){Oe(rt,be)})}},[]);return R.useEffect(function(){var be=Object(A.a)(Te.current)||Object(A.a)(ye.current);return be&&!Se&&l(be,oe),function(){return h(be,oe)}},[Te.current,Se]),R.createElement(T,{ref:ye},f?R.cloneElement(Re,{ref:X}):Re)}var E="rc-observer-key";function p(xe){var Re=xe.children,Se=Object(M.a)(Re);return Se.map(function(Te,ye){var z=(Te==null?void 0:Te.key)||"".concat(E,"-").concat(ye);return R.createElement(L,Object(fe.a)({},xe,{key:z}),Te)})}p.Collection=g;var c=p,u=de("bT9E"),a=de("TSYQ"),y=de.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,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={},W;function V(xe){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Re&&B[Se])return B[Se];var Te=window.getComputedStyle(xe),ye=Te.getPropertyValue("box-sizing")||Te.getPropertyValue("-moz-box-sizing")||Te.getPropertyValue("-webkit-box-sizing"),z=parseFloat(Te.getPropertyValue("padding-bottom"))+parseFloat(Te.getPropertyValue("padding-top")),s=parseFloat(Te.getPropertyValue("border-bottom-width"))+parseFloat(Te.getPropertyValue("border-top-width")),f=x.map(function(X){return"".concat(X,":").concat(Te.getPropertyValue(X))}).join(";"),D={sizingStyle:f,paddingSize:z,borderSize:s,boxSizing:ye};return Re&&Se&&(B[Se]=D),D}function K(xe){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),xe.getAttribute("wrap")?W.setAttribute("wrap",xe.getAttribute("wrap")):W.removeAttribute("wrap");var ye=V(xe,Re),z=ye.paddingSize,s=ye.borderSize,f=ye.boxSizing,D=ye.sizingStyle;W.setAttribute("style","".concat(D,";").concat(m)),W.value=xe.value||xe.placeholder||"";var X=Number.MIN_SAFE_INTEGER,F=Number.MAX_SAFE_INTEGER,oe=W.scrollHeight,be;if(f==="border-box"?oe+=s:f==="content-box"&&(oe-=z),Se!==null||Te!==null){W.value=" ";var we=W.scrollHeight-z;Se!==null&&(X=we*Se,f==="border-box"&&(X=X+z+s),oe=Math.max(X,oe)),Te!==null&&(F=we*Te,f==="border-box"&&(F=F+z+s),be=oe>F?"":"hidden",oe=Math.min(F,oe))}return{height:oe,minHeight:X,maxHeight:F,overflowY:be,resize:"none"}}var P=de("Gytx"),N=de.n(P),$;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})($||($={}));var ne=function(xe){Object(J.a)(Se,xe);var Re=Object(U.a)(Se);function Se(Te){var ye;return Object(Z.a)(this,Se),ye=Re.call(this,Te),ye.nextFrameActionId=void 0,ye.resizeFrameId=void 0,ye.textArea=void 0,ye.saveTextArea=function(z){ye.textArea=z},ye.handleResize=function(z){var s=ye.state.resizeStatus,f=ye.props,D=f.autoSize,X=f.onResize;if(s!==$.NONE)return;typeof X=="function"&&X(z),D&&ye.resizeOnNextFrame()},ye.resizeOnNextFrame=function(){cancelAnimationFrame(ye.nextFrameActionId),ye.nextFrameActionId=requestAnimationFrame(ye.resizeTextarea)},ye.resizeTextarea=function(){var z=ye.props.autoSize;if(!z||!ye.textArea)return;var s=z.minRows,f=z.maxRows,D=K(ye.textArea,!1,s,f);ye.setState({textareaStyles:D,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ye.resizeFrameId),ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.RESIZED},function(){ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:$.NONE}),ye.fixFirefoxAutoScroll()})})})})},ye.renderTextArea=function(){var z=ye.props,s=z.prefixCls,f=s===void 0?"rc-textarea":s,D=z.autoSize,X=z.onResize,F=z.className,oe=z.disabled,be=ye.state,we=be.textareaStyles,Oe=be.resizeStatus,Le=Object(u.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=y()(f,F,Object(H.a)({},"".concat(f,"-disabled"),oe));"value"in Le&&(Le.value=Le.value||"");var _e=Object(G.a)(Object(G.a)(Object(G.a)({},ye.props.style),we),Oe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ye.handleResize,disabled:!(D||X)},R.createElement("textarea",Object(fe.a)({},Le,{className:De,style:_e,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:$.NONE},ye}return Object(O.a)(Se,[{key:"componentDidUpdate",value:function(ye){(ye.value!==this.props.value||!N()(ye.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ye=this.textArea.selectionStart,z=this.textArea.selectionEnd;this.textArea.setSelectionRange(ye,z)}}catch(s){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Se}(R.Component),ue=ne,me=function(xe){Object(J.a)(Se,xe);var Re=Object(U.a)(Se);function Se(Te){var ye;Object(Z.a)(this,Se),ye=Re.call(this,Te),ye.resizableTextArea=void 0,ye.focus=function(){ye.resizableTextArea.textArea.focus()},ye.saveTextArea=function(s){ye.resizableTextArea=s},ye.handleChange=function(s){var f=ye.props.onChange;ye.setValue(s.target.value,function(){ye.resizableTextArea.resizeTextarea()}),f&&f(s)},ye.handleKeyDown=function(s){var f=ye.props,D=f.onPressEnter,X=f.onKeyDown;s.keyCode===13&&D&&D(s),X&&X(s)};var z=typeof Te.value=="undefined"||Te.value===null?Te.defaultValue:Te.value;return ye.state={value:z},ye}return Object(O.a)(Se,[{key:"setValue",value:function(ye,z){"value"in this.props||this.setState({value:ye},z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ue,Object(fe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ye){return"value"in ye?{value:ye.value}:null}}]),Se}(R.Component),ke=Je.default=me},Zss7:function(dt,Je,de){var fe;(function(Z){var O=/^\s+/,J=/\s+$/,U=0,R=Z.round,G=Z.min,H=Z.max,M=Z.random;function _(s,f){if(s=s||"",f=f||{},s instanceof _)return s;if(!(this instanceof _))return new _(s,f);var D=b(s);this._originalInput=s,this._r=D.r,this._g=D.g,this._b=D.b,this._a=D.a,this._roundA=R(100*this._a)/100,this._format=f.format||D.format,this._gradientType=f.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=D.ok,this._tc_id=U++}_.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),f,D,X,F,oe,be;return f=s.r/255,D=s.g/255,X=s.b/255,f<=.03928?F=f/12.92:F=Z.pow((f+.055)/1.055,2.4),D<=.03928?oe=D/12.92:oe=Z.pow((D+.055)/1.055,2.4),X<=.03928?be=X/12.92:be=Z.pow((X+.055)/1.055,2.4),.2126*F+.7152*oe+.0722*be},setAlpha:function(s){return this._a=K(s),this._roundA=R(100*this._a)/100,this},toHsv:function(){var s=w(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=w(this._r,this._g,this._b),f=R(s.h*360),D=R(s.s*100),X=R(s.v*100);return this._a==1?"hsv("+f+", "+D+"%, "+X+"%)":"hsva("+f+", "+D+"%, "+X+"%, "+this._roundA+")"},toHsl:function(){var s=I(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=I(this._r,this._g,this._b),f=R(s.h*360),D=R(s.s*100),X=R(s.l*100);return this._a==1?"hsl("+f+", "+D+"%, "+X+"%)":"hsla("+f+", "+D+"%, "+X+"%, "+this._roundA+")"},toHex:function(s){return d(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return o(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(P(this._r,255)*100)+"%",g:R(P(this._g,255)*100)+"%",b:R(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(P(this._r,255)*100)+"%, "+R(P(this._g,255)*100)+"%, "+R(P(this._b,255)*100)+"%)":"rgba("+R(P(this._r,255)*100)+"%, "+R(P(this._g,255)*100)+"%, "+R(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:W[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var f="#"+l(this._r,this._g,this._b,this._a),D=f,X=this._gradientType?"GradientType = 1, ":"";if(s){var F=_(s);D="#"+l(F._r,F._g,F._b,F._a)}return"progid:DXImageTransform.Microsoft.gradient("+X+"startColorstr="+f+",endColorstr="+D+")"},toString:function(s){var f=!!s;s=s||this._format;var D=!1,X=this._a<1&&this._a>=0,F=!f&&X&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return F?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(D=this.toRgbString()),s==="prgb"&&(D=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(D=this.toHexString()),s==="hex3"&&(D=this.toHexString(!0)),s==="hex4"&&(D=this.toHex8String(!0)),s==="hex8"&&(D=this.toHex8String()),s==="name"&&(D=this.toName()),s==="hsl"&&(D=this.toHslString()),s==="hsv"&&(D=this.toHsvString()),D||this.toHexString())},clone:function(){return _(this.toString())},_applyModification:function(s,f){var D=s.apply(null,[this].concat([].slice.call(f)));return this._r=D._r,this._g=D._g,this._b=D._b,this.setAlpha(D._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(E,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(T,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(s,f){return s.apply(null,[this].concat([].slice.call(f)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},_.fromRatio=function(s,f){if(typeof s=="object"){var D={};for(var X in s)s.hasOwnProperty(X)&&(X==="a"?D[X]=s[X]:D[X]=ke(s[X]));s=D}return _(s,f)};function b(s){var f={r:0,g:0,b:0},D=1,X=null,F=null,oe=null,be=!1,we=!1;return typeof s=="string"&&(s=ye(s)),typeof s=="object"&&(Te(s.r)&&Te(s.g)&&Te(s.b)?(f=A(s.r,s.g,s.b),be=!0,we=String(s.r).substr(-1)==="%"?"prgb":"rgb"):Te(s.h)&&Te(s.s)&&Te(s.v)?(X=ke(s.s),F=ke(s.v),f=C(s.h,X,F),be=!0,we="hsv"):Te(s.h)&&Te(s.s)&&Te(s.l)&&(X=ke(s.s),oe=ke(s.l),f=k(s.h,X,oe),be=!0,we="hsl"),s.hasOwnProperty("a")&&(D=s.a)),D=K(D),{ok:be,format:s.format||we,r:G(255,H(f.r,0)),g:G(255,H(f.g,0)),b:G(255,H(f.b,0)),a:D}}function A(s,f,D){return{r:P(s,255)*255,g:P(f,255)*255,b:P(D,255)*255}}function I(s,f,D){s=P(s,255),f=P(f,255),D=P(D,255);var X=H(s,f,D),F=G(s,f,D),oe,be,we=(X+F)/2;if(X==F)oe=be=0;else{var Oe=X-F;be=we>.5?Oe/(2-X-F):Oe/(X+F);switch(X){case s:oe=(f-D)/Oe+(f<D?6:0);break;case f:oe=(D-s)/Oe+2;break;case D:oe=(s-f)/Oe+4;break}oe/=6}return{h:oe,s:be,l:we}}function k(s,f,D){var X,F,oe;s=P(s,360),f=P(f,100),D=P(D,100);function be(Le,De,_e){return _e<0&&(_e+=1),_e>1&&(_e-=1),_e<1/6?Le+(De-Le)*6*_e:_e<1/2?De:_e<2/3?Le+(De-Le)*(2/3-_e)*6:Le}if(f===0)X=F=oe=D;else{var we=D<.5?D*(1+f):D+f-D*f,Oe=2*D-we;X=be(Oe,we,s+1/3),F=be(Oe,we,s),oe=be(Oe,we,s-1/3)}return{r:X*255,g:F*255,b:oe*255}}function w(s,f,D){s=P(s,255),f=P(f,255),D=P(D,255);var X=H(s,f,D),F=G(s,f,D),oe,be,we=X,Oe=X-F;if(be=X===0?0:Oe/X,X==F)oe=0;else{switch(X){case s:oe=(f-D)/Oe+(f<D?6:0);break;case f:oe=(D-s)/Oe+2;break;case D:oe=(s-f)/Oe+4;break}oe/=6}return{h:oe,s:be,v:we}}function C(s,f,D){s=P(s,360)*6,f=P(f,100),D=P(D,100);var X=Z.floor(s),F=s-X,oe=D*(1-f),be=D*(1-F*f),we=D*(1-(1-F)*f),Oe=X%6,Le=[D,be,oe,oe,we,D][Oe],De=[we,D,D,be,oe,oe][Oe],_e=[oe,oe,we,D,D,be][Oe];return{r:Le*255,g:De*255,b:_e*255}}function d(s,f,D,X){var F=[me(R(s).toString(16)),me(R(f).toString(16)),me(R(D).toString(16))];return X&&F[0].charAt(0)==F[0].charAt(1)&&F[1].charAt(0)==F[1].charAt(1)&&F[2].charAt(0)==F[2].charAt(1)?F[0].charAt(0)+F[1].charAt(0)+F[2].charAt(0):F.join("")}function o(s,f,D,X,F){var oe=[me(R(s).toString(16)),me(R(f).toString(16)),me(R(D).toString(16)),me(xe(X))];return F&&oe[0].charAt(0)==oe[0].charAt(1)&&oe[1].charAt(0)==oe[1].charAt(1)&&oe[2].charAt(0)==oe[2].charAt(1)&&oe[3].charAt(0)==oe[3].charAt(1)?oe[0].charAt(0)+oe[1].charAt(0)+oe[2].charAt(0)+oe[3].charAt(0):oe.join("")}function l(s,f,D,X){var F=[me(xe(X)),me(R(s).toString(16)),me(R(f).toString(16)),me(R(D).toString(16))];return F.join("")}_.equals=function(s,f){return!s||!f?!1:_(s).toRgbString()==_(f).toRgbString()},_.random=function(){return _.fromRatio({r:M(),g:M(),b:M()})};function h(s,f){f=f===0?0:f||10;var D=_(s).toHsl();return D.s-=f/100,D.s=N(D.s),_(D)}function T(s,f){f=f===0?0:f||10;var D=_(s).toHsl();return D.s+=f/100,D.s=N(D.s),_(D)}function v(s){return _(s).desaturate(100)}function g(s,f){f=f===0?0:f||10;var D=_(s).toHsl();return D.l+=f/100,D.l=N(D.l),_(D)}function L(s,f){f=f===0?0:f||10;var D=_(s).toRgb();return D.r=H(0,G(255,D.r-R(255*-(f/100)))),D.g=H(0,G(255,D.g-R(255*-(f/100)))),D.b=H(0,G(255,D.b-R(255*-(f/100)))),_(D)}function E(s,f){f=f===0?0:f||10;var D=_(s).toHsl();return D.l-=f/100,D.l=N(D.l),_(D)}function p(s,f){var D=_(s).toHsl(),X=(D.h+f)%360;return D.h=X<0?360+X:X,_(D)}function c(s){var f=_(s).toHsl();return f.h=(f.h+180)%360,_(f)}function u(s){var f=_(s).toHsl(),D=f.h;return[_(s),_({h:(D+120)%360,s:f.s,l:f.l}),_({h:(D+240)%360,s:f.s,l:f.l})]}function a(s){var f=_(s).toHsl(),D=f.h;return[_(s),_({h:(D+90)%360,s:f.s,l:f.l}),_({h:(D+180)%360,s:f.s,l:f.l}),_({h:(D+270)%360,s:f.s,l:f.l})]}function y(s){var f=_(s).toHsl(),D=f.h;return[_(s),_({h:(D+72)%360,s:f.s,l:f.l}),_({h:(D+216)%360,s:f.s,l:f.l})]}function m(s,f,D){f=f||6,D=D||30;var X=_(s).toHsl(),F=360/D,oe=[_(s)];for(X.h=(X.h-(F*f>>1)+720)%360;--f;)X.h=(X.h+F)%360,oe.push(_(X));return oe}function x(s,f){f=f||6;for(var D=_(s).toHsv(),X=D.h,F=D.s,oe=D.v,be=[],we=1/f;f--;)be.push(_({h:X,s:F,v:oe})),oe=(oe+we)%1;return be}_.mix=function(s,f,D){D=D===0?0:D||50;var X=_(s).toRgb(),F=_(f).toRgb(),oe=D/100,be={r:(F.r-X.r)*oe+X.r,g:(F.g-X.g)*oe+X.g,b:(F.b-X.b)*oe+X.b,a:(F.a-X.a)*oe+X.a};return _(be)},_.readability=function(s,f){var D=_(s),X=_(f);return(Z.max(D.getLuminance(),X.getLuminance())+.05)/(Z.min(D.getLuminance(),X.getLuminance())+.05)},_.isReadable=function(s,f,D){var X=_.readability(s,f),F,oe;oe=!1,F=z(D);switch(F.level+F.size){case"AAsmall":case"AAAlarge":oe=X>=4.5;break;case"AAlarge":oe=X>=3;break;case"AAAsmall":oe=X>=7;break}return oe},_.mostReadable=function(s,f,D){var X=null,F=0,oe,be,we,Oe;D=D||{},be=D.includeFallbackColors,we=D.level,Oe=D.size;for(var Le=0;Le<f.length;Le++)oe=_.readability(s,f[Le]),oe>F&&(F=oe,X=_(f[Le]));return _.isReadable(s,X,{level:we,size:Oe})||!be?X:(D.includeFallbackColors=!1,_.mostReadable(s,["#fff","#000"],D))};var B=_.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},W=_.hexNames=V(B);function V(s){var f={};for(var D in s)s.hasOwnProperty(D)&&(f[s[D]]=D);return f}function K(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function P(s,f){ne(s)&&(s="100%");var D=ue(s);return s=G(f,H(0,parseFloat(s))),D&&(s=parseInt(s*f,10)/100),Z.abs(s-f)<1e-6?1:s%f/parseFloat(f)}function N(s){return G(1,H(0,s))}function $(s){return parseInt(s,16)}function ne(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function ue(s){return typeof s=="string"&&s.indexOf("%")!=-1}function me(s){return s.length==1?"0"+s:""+s}function ke(s){return s<=1&&(s=s*100+"%"),s}function xe(s){return Z.round(parseFloat(s)*255).toString(16)}function Re(s){return $(s)/255}var Se=function(){var s="[-\\+]?\\d+%?",f="[-\\+]?\\d*\\.\\d+%?",D="(?:"+f+")|(?:"+s+")",X="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",F="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?";return{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+F),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+F),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+F),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 Te(s){return!!Se.CSS_UNIT.exec(s)}function ye(s){s=s.replace(O,"").replace(J,"").toLowerCase();var f=!1;if(B[s])s=B[s],f=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var D;return(D=Se.rgb.exec(s))?{r:D[1],g:D[2],b:D[3]}:(D=Se.rgba.exec(s))?{r:D[1],g:D[2],b:D[3],a:D[4]}:(D=Se.hsl.exec(s))?{h:D[1],s:D[2],l:D[3]}:(D=Se.hsla.exec(s))?{h:D[1],s:D[2],l:D[3],a:D[4]}:(D=Se.hsv.exec(s))?{h:D[1],s:D[2],v:D[3]}:(D=Se.hsva.exec(s))?{h:D[1],s:D[2],v:D[3],a:D[4]}:(D=Se.hex8.exec(s))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),a:Re(D[4]),format:f?"name":"hex8"}:(D=Se.hex6.exec(s))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),format:f?"name":"hex"}:(D=Se.hex4.exec(s))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),a:Re(D[4]+""+D[4]),format:f?"name":"hex8"}:(D=Se.hex3.exec(s))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),format:f?"name":"hex"}:!1}function z(s){var f,D;return s=s||{level:"AA",size:"small"},f=(s.level||"AA").toUpperCase(),D=(s.size||"small").toLowerCase(),f!=="AA"&&f!=="AAA"&&(f="AA"),D!=="small"&&D!=="large"&&(D="small"),{level:f,size:D}}dt.exports?dt.exports=_:!(fe=function(){return _}.call(Je,de,Je,dt),fe!==void 0&&(dt.exports=fe))})(Math)},bT9E:function(dt,Je,de){"use strict";de.d(Je,"a",function(){return Z});var fe=de("VTBJ");function Z(O,J){var U=Object(fe.a)({},O);return Array.isArray(J)&&J.forEach(function(R){delete U[R]}),U}},c5Ni:function(dt,Je,de){},dejd:function(dt,Je,de){},dmUQ:function(dt,Je,de){"use strict";var fe=de("Ff2n"),Z=de("rePB"),O=de("1OyB"),J=de("vuIU"),U=de("Ji7U"),R=de("md7G"),G=de("foSv"),H=de("q1tI"),M=de.n(H),_=de("TSYQ"),b=de.n(_),A=de("4IlW");function I(u,a){var y=Object.keys(u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(u);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),y.push.apply(y,m)}return y}function k(u){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?I(Object(y),!0).forEach(function(m){Object(Z.a)(u,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(y)):I(Object(y)).forEach(function(m){Object.defineProperty(u,m,Object.getOwnPropertyDescriptor(y,m))})}return u}function w(u){var a=C();return function(){var m=Object(G.a)(u),x;if(a){var B=Object(G.a)(this).constructor;x=Reflect.construct(m,arguments,B)}else x=m.apply(this,arguments);return Object(R.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(u){return!1}}function d(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},h=200,T=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(a){return a!=null},L=function(a,y){return y===a||typeof y=="number"&&typeof a=="number"&&isNaN(y)&&isNaN(a)},E=function(u){Object(U.a)(y,u);var a=w(y);function y(m){var x;Object(O.a)(this,y),x=a.call(this,m),x.onKeyDown=function(V){var K=x.props,P=K.onKeyDown,N=K.onPressEnter;if(V.keyCode===A.a.UP){var $=x.getRatio(V);x.up(V,$,null),x.stop()}else if(V.keyCode===A.a.DOWN){var ne=x.getRatio(V);x.down(V,ne,null),x.stop()}else V.keyCode===A.a.ENTER&&N&&N(V);if(x.recordCursorPosition(),x.lastKeyCode=V.keyCode,P){for(var ue=arguments.length,me=new Array(ue>1?ue-1:0),ke=1;ke<ue;ke++)me[ke-1]=arguments[ke];P.apply(void 0,[V].concat(me))}},x.onKeyUp=function(V){var K=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),K){for(var P=arguments.length,N=new Array(P>1?P-1:0),$=1;$<P;$++)N[$-1]=arguments[$];K.apply(void 0,[V].concat(N))}},x.onChange=function(V){var K=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(V)),x.setState({inputValue:x.rawInput}),K(x.toNumber(x.rawInput))},x.onMouseUp=function(){var V=x.props.onMouseUp;x.recordCursorPosition(),V&&V.apply(void 0,arguments)},x.onFocus=function(){var V;x.setState({focused:!0}),(V=x.props).onFocus.apply(V,arguments)},x.onBlur=function(){var V=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var K=x.getCurrentValidValue(x.state.inputValue),P=x.setValue(K,d);if(V){var N=x.input.value,$=x.getInputDisplayValue({focus:!1,value:P});x.input.value=$&&Number($),V.apply(void 0,arguments),x.input.value=N}},x.getRatio=function(V){var K=1;return V.metaKey||V.ctrlKey?K=.1:V.shiftKey&&(K=10),K},x.getFullNum=function(V){return isNaN(V)?V:/e/i.test(String(V))?Number(V).toFixed(18).replace(/\.?0+$/,""):V},x.getPrecision=function(V){if(g(x.props.precision))return x.props.precision;var K=String(V);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var P=0;return K.indexOf(".")>=0&&(P=K.length-K.indexOf(".")-1),P},x.getInputDisplayValue=function(V){var K=V||x.state,P=K.focused,N=K.inputValue,$=K.value,ne;P?ne=N:ne=x.toPrecisionAsStep($),ne==null&&(ne="");var ue=x.formatWrapper(ne);return g(x.props.decimalSeparator)&&(ue=ue.toString().replace(".",x.props.decimalSeparator)),ue},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(V){}},x.restoreByAfter=function(V){if(V===void 0)return!1;var K=x.input.value,P=K.lastIndexOf(V);if(P===-1)return!1;var N=x.cursorBefore.length;return x.lastKeyCode===A.a.DELETE&&x.cursorBefore.charAt(N-1)===V[0]?(x.fixCaret(N,N),!0):P+V.length===K.length?(x.fixCaret(P,P),!0):!1},x.partRestoreByAfter=function(V){return V===void 0?!1:Array.prototype.some.call(V,function(K,P){var N=V.substring(P);return x.restoreByAfter(N)})},x.isNotCompleteNumber=function(V){return isNaN(V)||V===""||V===null||V&&V.toString().indexOf(".")===V.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(V,K,P){x.pressingUpOrDown=!0,x.step("down",V,K,P)},x.up=function(V,K,P){x.pressingUpOrDown=!0,x.step("up",V,K,P)},x.saveInput=function(V){x.input=V};var B=m.value;B===void 0&&(B=m.defaultValue),x.state={focused:m.autoFocus};var W=x.getValidValue(x.toNumber(B));return x.state=k(k({},x.state),{},{inputValue:x.toPrecisionAsStep(W),value:W}),x}return Object(J.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var B=this.props,W=B.value,V=B.onChange,K=B.max,P=B.min,N=this.state.focused;if(x){if(!L(x.value,W)||!L(x.max,K)||!L(x.min,P)){var $=N?W:this.getValidValue(W),ne;this.pressingUpOrDown?ne=$:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ne})}var ue="value"in this.props?W:this.state.value;"max"in this.props&&x.max!==K&&typeof ue=="number"&&ue>K&&V&&V(K),"min"in this.props&&x.min!==P&&typeof ue=="number"&&ue<P&&V&&V(P)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var me=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?me=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(me=this.cursorStart):me=this.input.value.length,this.fixCaret(me,me)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ke){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(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 g(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,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,V=parseFloat(x);return isNaN(V)?x:(V<B&&(V=B),V>W&&(V=W),V)}},{key:"setValue",value:function(x,B){var W=this.props.precision,V=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),K=this.state.value,P=K===void 0?null:K,N=this.state.inputValue,$=N===void 0?null:N,ne=typeof V=="number"?V.toFixed(W):"".concat(V),ue=V!==P||ne!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},B)):this.setState({value:V,inputValue:this.toPrecisionAsStep(x)},B),ue&&this.props.onChange(V),V}},{key:"getMaxPrecision",value:function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,V=W.precision,K=W.step;if(g(V))return V;var P=this.getPrecision(B),N=this.getPrecision(K),$=this.getPrecision(x);return x?Math.max($,P+N):P+N}},{key:"getPrecisionFactor",value:function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(x,B);return Math.pow(10,W)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(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,W=this.state.focused,V=x&&x.length>16&&W;return this.isNotCompleteNumber(x)||V?x:g(B)?Math.round(x*Math.pow(10,B))/Math.pow(10,B):Number(x)}},{key:"upStep",value:function(x,B){var W=this.props.step,V=this.getPrecisionFactor(x,B),K=Math.abs(this.getMaxPrecision(x,B)),P=((V*x+V*W*B)/V).toFixed(K);return this.toNumber(P)}},{key:"downStep",value:function(x,B){var W=this.props.step,V=this.getPrecisionFactor(x,B),K=Math.abs(this.getMaxPrecision(x,B)),P=((V*x-V*W*B)/V).toFixed(K);return this.toNumber(P)}},{key:"step",value:function(x,B){var W=this,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),B&&(B.persist(),B.preventDefault());var P=this.props;if(P.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var $=this["".concat(x,"Step")](N,V),ne=$>P.max||$<P.min;if($>P.max?$=P.max:$<P.min&&($=P.min),this.setValue($,null),this.setState({focused:!0},function(){W.pressingUpOrDown=!1}),ne)return;this.autoStepTimer=setTimeout(function(){W[x](B,V,!0)},K?h:T)}},{key:"fixCaret",value:function(x,B){if(x===void 0||B===void 0||!this.input||!this.input.value)return;try{var W=this.input.selectionStart,V=this.input.selectionEnd;(x!==W||B!==V)&&this.input.setSelectionRange(x,B)}catch(K){}}},{key:"render",value:function(){var x,B=this.props,W=B.prefixCls,V=B.disabled,K=B.readOnly,P=B.useTouch,N=B.autoComplete,$=B.upHandler,ne=B.downHandler,ue=B.className,me=B.max,ke=B.min,xe=B.style,Re=B.title,Se=B.onMouseEnter,Te=B.onMouseLeave,ye=B.onMouseOver,z=B.onMouseOut,s=B.required,f=B.onClick,D=B.tabIndex,X=B.type,F=B.placeholder,oe=B.id,be=B.inputMode,we=B.pattern,Oe=B.step,Le=B.maxLength,De=B.autoFocus,_e=B.name,Ne=B.onPaste,Ge=B.onInput,He=Object(fe.a)(B,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),ze=this.state,nt=ze.value,Ye=ze.focused,Xe=b()(W,(x={},Object(Z.a)(x,ue,!!ue),Object(Z.a)(x,"".concat(W,"-disabled"),V),Object(Z.a)(x,"".concat(W,"-focused"),Ye),x)),Pe={};Object.keys(He).forEach(function(ce){(ce.substr(0,5)==="data-"||ce.substr(0,5)==="aria-"||ce==="role")&&(Pe[ce]=He[ce])});var rt=!K&&!V,Qe=this.getInputDisplayValue(null),se=(nt||nt===0)&&(isNaN(nt)||Number(nt)>=me),ee=(nt||nt===0)&&(isNaN(nt)||Number(nt)<=ke),q=se||V||K,ae=ee||V||K,le=b()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object(Z.a)({},"".concat(W,"-handler-up-disabled"),q)),te=b()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object(Z.a)({},"".concat(W,"-handler-down-disabled"),ae)),ie=P?{onTouchStart:q?d:this.up,onTouchEnd:this.stop}:{onMouseDown:q?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=P?{onTouchStart:ae?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:Xe,style:xe,title:Re,onMouseEnter:Se,onMouseLeave:Te,onMouseOver:ye,onMouseOut:z,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(W,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":q,className:le}),$||M.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:o})),M.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:te}),ne||M.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:o}))),M.a.createElement("div",{className:"".concat(W,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":me,"aria-valuenow":nt,required:s,type:X,placeholder:F,onPaste:Ne,onClick:f,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:D,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:rt?this.onKeyDown:d,onKeyUp:rt?this.onKeyUp:d,autoFocus:De,maxLength:Le,readOnly:K,disabled:V,max:me,min:ke,step:Oe,name:_e,title:Re,id:oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Qe),pattern:we,inputMode:be,onInput:Ge},Pe))))}}]),y}(M.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var p=E,c=Je.a=p},h78n:function(dt,Je,de){"use strict";de.d(Je,"a",function(){return x});var fe=de("q1tI"),Z=de.n(fe),O=de("TSYQ"),J=de.n(O),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(V){var K=V.map(function(){return Object(fe.useRef)()}),P=Object(fe.useRef)();return Object(fe.useEffect)(function(){var N=Date.now(),$=!1;Object.keys(K).forEach(function(ne){var ue=K[ne].current;if(!ue)return;$=!0;var me=ue.style;me.transitionDuration=".3s, .3s, .3s, .06s",P.current&&N-P.current<100&&(me.transitionDuration="0s, 0s")}),$&&(P.current=Date.now())}),[K]};function G(){return G=Object.assign||function(W){for(var V=1;V<arguments.length;V++){var K=arguments[V];for(var P in K)Object.prototype.hasOwnProperty.call(K,P)&&(W[P]=K[P])}return W},G.apply(this,arguments)}function H(W,V){return I(W)||A(W,V)||_(W,V)||M()}function M(){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,V){if(!W)return;if(typeof W=="string")return b(W,V);var K=Object.prototype.toString.call(W).slice(8,-1);if(K==="Object"&&W.constructor&&(K=W.constructor.name),K==="Map"||K==="Set")return Array.from(W);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return b(W,V)}function b(W,V){(V==null||V>W.length)&&(V=W.length);for(var K=0,P=new Array(V);K<V;K++)P[K]=W[K];return P}function A(W,V){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var K=[],P=!0,N=!1,$=void 0;try{for(var ne=W[Symbol.iterator](),ue;!(P=(ue=ne.next()).done)&&!(K.push(ue.value),V&&K.length===V);P=!0);}catch(me){N=!0,$=me}finally{try{!P&&ne.return!=null&&ne.return()}finally{if(N)throw $}}return K}function I(W){if(Array.isArray(W))return W}function k(W,V){if(W==null)return{};var K=w(W,V),P,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(N=0;N<$.length;N++){if(P=$[N],V.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,P))continue;K[P]=W[P]}}return K}function w(W,V){if(W==null)return{};var K={},P=Object.keys(W),N,$;for($=0;$<P.length;$++){if(N=P[$],V.indexOf(N)>=0)continue;K[N]=W[N]}return K}var C=function(V){var K=V.className,P=V.percent,N=V.prefixCls,$=V.strokeColor,ne=V.strokeLinecap,ue=V.strokeWidth,me=V.style,ke=V.trailColor,xe=V.trailWidth,Re=V.transition,Se=k(V,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Se.gapPosition;var Te=Array.isArray(P)?P:[P],ye=Array.isArray($)?$:[$],z=R(Te),s=H(z,1),f=s[0],D=ue/2,X=100-ue/2,F="M ".concat(ne==="round"?D:0,",").concat(D,`
|
|
L `).concat(ne==="round"?X:100,",").concat(D),oe="0 0 100 ".concat(ue),be=0;return Z.a.createElement("svg",G({className:J()("".concat(N,"-line"),K),viewBox:oe,preserveAspectRatio:"none",style:me},Se),Z.a.createElement("path",{className:"".concat(N,"-line-trail"),d:F,strokeLinecap:ne,stroke:ke,strokeWidth:xe||ue,fillOpacity:"0"}),Te.map(function(we,Oe){var Le={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:Re||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ye[Oe]||ye[ye.length-1];return be+=we,Z.a.createElement("path",{key:Oe,className:"".concat(N,"-line-path"),d:F,strokeLinecap:ne,stroke:De,strokeWidth:ue,fillOpacity:"0",ref:f[Oe],style:Le})}))};C.defaultProps=U;var d=C;function o(){return o=Object.assign||function(W){for(var V=1;V<arguments.length;V++){var K=arguments[V];for(var P in K)Object.prototype.hasOwnProperty.call(K,P)&&(W[P]=K[P])}return W},o.apply(this,arguments)}function l(W,V){return L(W)||g(W,V)||T(W,V)||h()}function h(){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 T(W,V){if(!W)return;if(typeof W=="string")return v(W,V);var K=Object.prototype.toString.call(W).slice(8,-1);if(K==="Object"&&W.constructor&&(K=W.constructor.name),K==="Map"||K==="Set")return Array.from(W);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return v(W,V)}function v(W,V){(V==null||V>W.length)&&(V=W.length);for(var K=0,P=new Array(V);K<V;K++)P[K]=W[K];return P}function g(W,V){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var K=[],P=!0,N=!1,$=void 0;try{for(var ne=W[Symbol.iterator](),ue;!(P=(ue=ne.next()).done)&&!(K.push(ue.value),V&&K.length===V);P=!0);}catch(me){N=!0,$=me}finally{try{!P&&ne.return!=null&&ne.return()}finally{if(N)throw $}}return K}function L(W){if(Array.isArray(W))return W}function E(W,V){if(W==null)return{};var K=p(W,V),P,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(N=0;N<$.length;N++){if(P=$[N],V.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,P))continue;K[P]=W[P]}}return K}function p(W,V){if(W==null)return{};var K={},P=Object.keys(W),N,$;for($=0;$<P.length;$++){if(N=P[$],V.indexOf(N)>=0)continue;K[N]=W[N]}return K}var c=0;function u(W){return+W.replace("%","")}function a(W){return Array.isArray(W)?W:[W]}function y(W,V,K,P){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ne=50-P/2,ue=0,me=-ne,ke=0,xe=-2*ne;switch($){case"left":ue=-ne,me=0,ke=2*ne,xe=0;break;case"right":ue=ne,me=0,ke=-2*ne,xe=0;break;case"bottom":me=ne,xe=2*ne;break;default:}var Re="M 50,50 m ".concat(ue,",").concat(me,`
|
|
a `).concat(ne,",").concat(ne," 0 1 1 ").concat(ke,",").concat(-xe,`
|
|
a `).concat(ne,",").concat(ne," 0 1 1 ").concat(-ke,",").concat(xe),Se=Math.PI*2*ne,Te={stroke:K,strokeDasharray:"".concat(V/100*(Se-N),"px ").concat(Se,"px"),strokeDashoffset:"-".concat(N/2+W/100*(Se-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Re,pathStyle:Te}}var m=function(V){var K=V.prefixCls,P=V.strokeWidth,N=V.trailWidth,$=V.gapDegree,ne=V.gapPosition,ue=V.trailColor,me=V.strokeLinecap,ke=V.style,xe=V.className,Re=V.strokeColor,Se=V.percent,Te=E(V,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ye=Object(fe.useMemo)(function(){return c+=1,c},[]),z=y(0,100,ue,P,$,ne),s=z.pathString,f=z.pathStyle,D=a(Se),X=a(Re),F=X.find(function(Le){return Object.prototype.toString.call(Le)==="[object Object]"}),oe=R(D),be=l(oe,1),we=be[0],Oe=function(){var De=0;return D.map(function(_e,Ne){var Ge=X[Ne]||X[X.length-1],He=Object.prototype.toString.call(Ge)==="[object Object]"?"url(#".concat(K,"-gradient-").concat(ye,")"):"",ze=y(De,_e,Ge,P,$,ne);return De+=_e,Z.a.createElement("path",{key:Ne,className:"".concat(K,"-circle-path"),d:ze.pathString,stroke:He,strokeLinecap:me,strokeWidth:P,opacity:_e===0?0:1,fillOpacity:"0",style:ze.pathStyle,ref:we[Ne]})})};return Z.a.createElement("svg",o({className:J()("".concat(K,"-circle"),xe),viewBox:"0 0 100 100",style:ke},Te),F&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(K,"-gradient-").concat(ye),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(F).sort(function(Le,De){return u(Le)-u(De)}).map(function(Le,De){return Z.a.createElement("stop",{key:De,offset:Le,stopColor:F[Le]})}))),Z.a.createElement("path",{className:"".concat(K,"-circle-trail"),d:s,stroke:ue,strokeLinecap:me,strokeWidth:N||P,fillOpacity:"0",style:f}),Oe().reverse())};m.defaultProps=U;var x=m,B={Line:d,Circle:x}},iIVh:function(dt,Je,de){},kSUc:function(dt,Je,de){},lZu9:function(dt,Je,de){(function(fe){fe(de("VrN/"),de("1eCo"),de("8EBN"))})(function(fe){"use strict";fe.defineMode("markdown",function(Z,O){var J=fe.getMode(Z,"text/html"),U=J.name=="null";function R(P){if(fe.findModeByName){var N=fe.findModeByName(P);N&&(P=N.mime||N.mimes[0])}var $=fe.getMode(Z,P);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var G={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var H in G)G.hasOwnProperty(H)&&O.tokenTypeOverrides[H]&&(G[H]=O.tokenTypeOverrides[H]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,A=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,I=/^ {0,3}(?:\={1,}|-{2,})\s*$/,k=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(P,N,$){return N.f=N.inline=$,$(P,N)}function h(P,N,$){return N.f=N.block=$,$(P,N)}function T(P){return!P||!/\S/.test(P.string)}function v(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==L){var N=U;if(!N){var $=fe.innerMode(J,P.htmlState);N=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}N&&(P.f=u,P.block=g,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function g(P,N){var $=P.column()===N.indentation,ne=T(N.prevLine.stream),ue=N.indentedCode,me=N.prevLine.hr,ke=N.list!==!1,xe=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Re=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,ke)){for(N.list=null;Re<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Re-N.listStack[N.listStack.length-1])}var Se=!ne&&!me&&!N.prevLine.header&&(!ke||!ue)&&!N.prevLine.fencedCodeEnd,Te=(N.list===!1||me||ne)&&N.indentation<=xe&&P.match(M),ye=null;if(N.indentationDiff>=4&&(ue||N.prevLine.fencedCodeEnd||N.prevLine.header||ne))return P.skipToEnd(),N.indentedCode=!0,G.code;if(P.eatSpace())return null;if($&&N.indentation<=xe&&(ye=P.match(A))&&ye[1].length<=6)return N.quote=0,N.header=ye[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,p(N);if(N.indentation<=xe&&P.eat(">"))return N.quote=$?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),P.eatSpace(),p(N);if(!Te&&!N.setext&&$&&N.indentation<=xe&&(ye=P.match(_))){var z=ye[1]?"ol":"ul";return N.indentation=Re+P.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&P.match(b,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+z]),p(N)}else{if($&&N.indentation<=xe&&(ye=P.match(w,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ye[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&R(ye[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=fe.startState(N.localMode)),N.f=N.block=E,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,p(N);if(N.setext||(!Se||!ke)&&!N.quote&&N.list===!1&&!N.code&&!Te&&!C.test(P.string)&&(ye=P.lookAhead(1))&&(ye=ye.match(I)))return N.setext?(N.header=N.setext,N.setext=0,P.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=ye[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,p(N);if(Te)return P.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,G.hr;if(P.peek()==="[")return l(P,N,B)}return l(P,N,N.inline)}function L(P,N){var $=J.token(P,N.htmlState);if(!U){var ne=fe.innerMode(J,N.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||N.md_inside&&P.current().indexOf(">")>-1)&&(N.f=u,N.block=g,N.htmlState=null)}return $}function E(P,N){var $=N.listStack[N.listStack.length-1]||0,ne=N.indentation<$,ue=$+3;if(N.fencedEndRE&&N.indentation<=ue&&(ne||P.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var me;return ne||(me=p(N)),N.localMode=N.localState=null,N.block=g,N.f=u,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ne?h(P,N,N.block):me}else return N.localMode?N.localMode.token(P,N.localState):(P.skipToEnd(),G.code)}function p(P){var N=[];if(P.formatting){N.push(G.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var $=0;$<P.formatting.length;$++)N.push(G.formatting+"-"+P.formatting[$]),P.formatting[$]==="header"&&N.push(G.formatting+"-"+P.formatting[$]+"-"+P.header),P.formatting[$]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=P.quote?N.push(G.formatting+"-"+P.formatting[$]+"-"+P.quote):N.push("error"))}if(P.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(P.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(P.linkHref?N.push(G.linkHref,"url"):(P.strong&&N.push(G.strong),P.em&&N.push(G.em),P.strikethrough&&N.push(G.strikethrough),P.emoji&&N.push(G.emoji),P.linkText&&N.push(G.linkText),P.code&&N.push(G.code),P.image&&N.push(G.image),P.imageAltText&&N.push(G.imageAltText,"link"),P.imageMarker&&N.push(G.imageMarker)),P.header&&N.push(G.header,G.header+"-"+P.header),P.quote&&(N.push(G.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=P.quote?N.push(G.quote+"-"+P.quote):N.push(G.quote+"-"+O.maxBlockquoteDepth)),P.list!==!1){var ne=(P.listStack.length-1)%3;ne?ne===1?N.push(G.list2):N.push(G.list3):N.push(G.list1)}return P.trailingSpaceNewLine?N.push("trailing-space-new-line"):P.trailingSpace&&N.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(P,N){return P.match(k,!0)?p(N):void 0}function u(P,N){var $=N.text(P,N);if(typeof $!="undefined")return $;if(N.list)return N.list=null,p(N);if(N.taskList){var ne=P.match(b,!0)[1]===" ";return ne?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,p(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&P.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),p(N);var ue=P.next();if(N.linkTitle){N.linkTitle=!1;var me=ue;ue==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(P.match(new RegExp(ke),!0))return G.linkHref}if(ue==="`"){var xe=N.formatting;O.highlightFormatting&&(N.formatting="code"),P.eatWhile("`");var Re=P.current().length;if(N.code==0&&(!N.quote||Re==1))return N.code=Re,p(N);if(Re==N.code){var Se=p(N);return N.code=0,Se}else return N.formatting=xe,p(N)}else if(N.code)return p(N);if(ue==="\\"&&(P.next(),O.highlightFormatting)){var Te=p(N),ye=G.formatting+"-escape";return Te?Te+" "+ye:ye}if(ue==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),p(N);if(ue==="["&&N.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),p(N);if(ue==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var Te=p(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=y,Te}if(ue==="["&&!N.image)return N.linkText&&P.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),p(N);if(ue==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var Te=p(N);return N.linkText=!1,N.inline=N.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?y:u,Te}if(ue==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var Te=p(N);return Te?Te+=" ":Te="",Te+G.linkInline}if(ue==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var Te=p(N);return Te?Te+=" ":Te="",Te+G.linkEmail}if(O.xml&&ue==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var z=P.string.indexOf(">",P.pos);if(z!=-1){var s=P.string.substring(P.start,z);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(s)&&(N.md_inside=!0)}return P.backUp(1),N.htmlState=fe.startState(J),h(P,N,L)}if(O.xml&&ue==="<"&&P.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ue==="*"||ue==="_"){for(var f=1,D=P.pos==1?" ":P.string.charAt(P.pos-2);f<3&&P.eat(ue);)f++;var X=P.peek()||" ",F=!/\s/.test(X)&&(!d.test(X)||/\s/.test(D)||d.test(D)),oe=!/\s/.test(D)&&(!d.test(D)||/\s/.test(X)||d.test(X)),be=null,we=null;if(f%2&&(!N.em&&F&&(ue==="*"||!oe||d.test(D))?be=!0:N.em==ue&&oe&&(ue==="*"||!F||d.test(X))&&(be=!1)),f>1&&(!N.strong&&F&&(ue==="*"||!oe||d.test(D))?we=!0:N.strong==ue&&oe&&(ue==="*"||!F||d.test(X))&&(we=!1)),we!=null||be!=null){O.highlightFormatting&&(N.formatting=be==null?"strong":we==null?"em":"strong em"),be===!0&&(N.em=ue),we===!0&&(N.strong=ue);var Se=p(N);return be===!1&&(N.em=!1),we===!1&&(N.strong=!1),Se}}else if(ue===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return p(N);P.backUp(1)}if(O.strikethrough){if(ue==="~"&&P.eatWhile(ue)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var Se=p(N);return N.strikethrough=!1,Se}else if(P.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),p(N)}else if(ue===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return p(N);P.backUp(2)}}if(O.emoji&&ue===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var Oe=p(N);return N.emoji=!1,Oe}return ue===" "&&(P.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),p(N)}function a(P,N){var $=P.next();if($===">"){N.f=N.inline=u,O.highlightFormatting&&(N.formatting="link");var ne=p(N);return ne?ne+=" ":ne="",ne+G.linkInline}return P.match(/^[^>]+/,!0),G.linkInline}function y(P,N){if(P.eatSpace())return null;var $=P.next();return $==="("||$==="["?(N.f=N.inline=x($==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,p(N)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(P){return function(N,$){var ne=N.next();if(ne===P){$.f=$.inline=u,O.highlightFormatting&&($.formatting="link-string");var ue=p($);return $.linkHref=!1,ue}return N.match(m[P]),$.linkHref=!0,p($)}}function B(P,N){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=W,P.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,p(N)):l(P,N,u)}function W(P,N){if(P.match(/^\]:/,!0)){N.f=N.inline=V,O.highlightFormatting&&(N.formatting="link");var $=p(N);return N.linkText=!1,$}return P.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function V(P,N){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?N.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=u,G.linkHref+" url")}var K={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:u,text:c,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&&fe.copyState(J,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?fe.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,N){if(N.formatting=!1,P!=N.thisLine.stream){if(N.header=0,N.hr=!1,P.match(/^\s*$/,!0))return v(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:P},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=L)){var $=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(N.indentation=$,N.indentationDiff=null,$>0)return null}}return N.f(P,N)},innerMode:function(P){return P.block==L?{state:P.htmlState,mode:J}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:K}},indent:function(P,N,$){return P.block==L&&J.indent?J.indent(P.htmlState,N,$):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,N,$):fe.Pass},blankLine:v,getType:p,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml"),fe.defineMIME("text/markdown","markdown"),fe.defineMIME("text/x-markdown","markdown")})},nojB:function(dt,Je,de){"use strict";de.r(Je);var fe=de("T2oS"),Z=de("W9HT"),O=de("9og8"),J=de("tJVT"),U=de("k1fw"),R=de("WmNS"),G=de.n(R),H=de("q1tI"),M=de.n(H),_=de("X0ci"),b=de("iIVh"),A=de("Ty5D"),I=de("55Ip"),k=de("+L6B"),w=de("2/Rp"),C=de("5NDa"),d=de("5rEg"),o=de("2qtc"),l=de("kLXV"),h=de("miYZ"),T=de("tsqr"),v=de("PpiC"),g=de("y8nQ"),L=de("Vl3Y"),E=de("DZo9"),p=de("8z0m"),c=de("sRBo"),u=de("kaz8"),a=de("LtfV"),y=de("m3rI"),m=de("Ot1p"),x=u.a.Group,B=p.a.Dragger;function W(ue,me){var ke=new FileReader;ke.addEventListener("load",function(){return me(ke.result)}),ke.readAsDataURL(ue)}var V=function(ue){var me=ue.callback,ke=ue.tags,xe=ke===void 0?[]:ke,Re=ue.initialValues,Se=Re===void 0?{}:Re,Te=ue.removeAttachment,ye=Object(H.useState)(""),z=Object(J.a)(ye,2),s=z[0],f=z[1],D=L.a.useForm(),X=Object(J.a)(D,1),F=X[0];function oe(De){var _e=De.cover_id,Ne=De.attachment_ids,Ge=Object(v.a)(De,["cover_id","attachment_ids"]);me(Object(U.a)(Object(U.a)({},Ge),{},{cover_id:_e==null?void 0:_e.map(function(He){return He.response?He.response.id:He.uid})[(_e==null?void 0:_e.length)-1],attachment_ids:Ne?Ne==null?void 0:Ne.map(function(He){return He.response?He.response.id:He.uid}):[]}))}function be(De){return Array.isArray(De)?De:De&&De.fileList}var we={multiple:!0,beforeUpload:function(_e){var Ne=_e.size/1024/1024<100;if(!Ne)return T.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(100MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20"),Ne},action:"".concat(y.a.API_SERVER,"/api/attachments.json"),onRemove:function(_e){l.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){return Te(_e.response?_e.response.id:_e.uid)},onCancel:function(){return!1}})}};function Oe(De){De.file.status==="done"&&W(De.file.originFileObj,function(_e){return f(_e)})}var Le={showUploadList:!1,withCredentials:!0,action:"".concat(y.a.API_SERVER,"/api/attachments.json"),onChange:Oe};return Object(H.useEffect)(function(){Se.title&&(F.setFieldsValue(Se),Se.cover_id.length>0&&f(y.a.IMG_SERVER+Se.cover_id[0].url))},[Se]),M.a.createElement(L.a,{form:F,initialValues:Se,className:"moop-panel",onFinish:oe},M.a.createElement(L.a.Item,{label:"\u6807\u9898",name:"title",extra:M.a.createElement("p",{className:"tip"},"\u7B80\u660E\u627C\u8981\u4ECB\u7ECD\u6587\u6863/\u89C6\u9891\u6240\u5305\u542B\u7684\u4E3B\u8981\u7684\u5185\u5BB9"),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},M.a.createElement(d.a,{placeholder:"\u4F8B\u5982\uFF1A\u8F6F\u4EF6\u5DE5\u7A0B\u6559\u5B66\u6848\u4F8B"})),M.a.createElement("div",{className:"flex-container"},M.a.createElement(L.a.Item,{label:"\u4F5C\u8005",name:"author_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u540D\u79F0"}]},M.a.createElement(d.a,{placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",style:{marginRight:20,width:200}})),M.a.createElement(L.a.Item,{name:"author_school_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0"}]},M.a.createElement(d.a,{placeholder:"\u8BF7\u8F93\u5165\u4F5C\u8005\u5355\u4F4D\u540D\u79F0",style:{width:200}}))),M.a.createElement(L.a.Item,{name:"tag_ids",label:"\u6807\u7B7E",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u6807\u7B7E"}]},M.a.createElement(x,null,xe.map(function(De){return M.a.createElement(u.a,{key:De.id,value:De.id}," ",De.name," ")}))),M.a.createElement(L.a.Item,{name:"publish",valuePropName:"checked"},M.a.createElement(u.a,null,"\u662F\u5426\u7533\u8BF7\u53D1\u5E03")),M.a.createElement(L.a.Item,{name:"content",label:"\u63CF\u8FF0",valuePropName:"defaultValue",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0\u5185\u5BB9"}]},M.a.createElement(m.a,{id:"moop_cases_content",height:400})),M.a.createElement(L.a.Item,{name:"attachment_ids",valuePropName:"fileList",getValueFromEvent:be},M.a.createElement(B,we,M.a.createElement("p",{className:"c-blue",style:{marginBottom:10,fontSize:18}},"\u4E0A\u4F20\u9644\u4EF6"),M.a.createElement("p",{className:"c-grey-c"},"\u4ECE\u6211\u7684\u7535\u8111\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u6863\uFF1A\u6309\u4F4FCTRL\u53EF\u4EE5\u4E0A\u4F20\u591A\u4EFD\u6587\u6863\u3002\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\uFF1A100MB"))),M.a.createElement(L.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",extra:"\u4E0A\u4F20\u5C3A\u5BF8\uFF1A120*90 px",getValueFromEvent:be,valuePropName:"fileList",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u5C01\u9762\u56FE"}]},M.a.createElement(p.a,Le,s?M.a.createElement("img",{src:s,width:120}):M.a.createElement("a",{title:"\u4E0A\u4F20\u5C01\u9762\u56FE",className:"upload-cover"}," ",M.a.createElement(a.a,null)," "))),M.a.createElement("div",{className:"desc"},M.a.createElement("h3",null,"\u5BA1\u6838\u8BF4\u660E"),M.a.createElement("p",null," ","\u5E73\u53F0\u7BA1\u7406\u5458\u5C06\u5BF9\u6BCF\u5929\u65B0\u4E0A\u4F20\u7684\u6587\u6863\u8FDB\u884C\u5BA1\u6838\uFF0C\u5BA1\u6838\u901A\u8FC7\u7684\u6587\u6863\u5C06\u516C\u5F00\u663E\u793A\uFF0C\u5426\u5219\u5C06\u79C1\u6709\u5316\u6216\u79FB\u9664"," ")),M.a.createElement("div",{className:"desc"},M.a.createElement("h3",null,"\u6E29\u99A8\u63D0\u793A"),M.a.createElement("ul",{style:{padding:0}},M.a.createElement("li",null,"1.\u8BF7\u52FF\u4E0A\u4F20\u5DF2\u8BBE\u7F6E\u52A0\u5BC6\u53E3\u4EE4\u7684\u6587\u6863\u8D44\u6E90\uFF1B"),M.a.createElement("li",null,"2.\u53EF\u4EE5\u4E0A\u4F20\u7B26\u5408\u6559\u5B66\u6848\u4F8B\u6807\u51C6\u7684\u6587\u6863\u8D44\u6599\uFF0C\u5982",M.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34799",target:"_blank"}," ","\u6848\u4F8B\u5165\u5E93\u6807\u51C6"," ")," ","\u3001",M.a.createElement("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34798",target:"_blank"},"\u6848\u4F8B\u4F7F\u7528\u8BF4\u660E\u4E66"),"\u4EE5\u53CA\u5176\u4ED6\u8D44\u6599\u7B49\uFF0C\u4E0A\u4F20\u652F\u6301\u7684\u6587\u4EF6\u6700\u5927\u5BB9\u91CF\uFF1A100MB\uFF1B"),M.a.createElement("li",null,"3.\u8BF7\u786E\u4FDD\u4E0A\u4F20\u5185\u5BB9\u65E0\u4FB5\u6743\u6216\u8FDD\u53CD\u56FD\u5BB6\u5173\u4E8E\u4E92\u8054\u7F51\u653F\u7B56\u7684\u4E0D\u826F\u884C\u4E3A\uFF1B"),M.a.createElement("li",null,"4.\u8BF7\u4F7F\u7528Chrome\uFF0CFirefox\uFF0CSafari\uFF0CIE11\uFF08\u53CA\u4EE5\u4E0A\u7248\u672C\uFF09\u6D4F\u89C8\u5668\uFF1B"))),M.a.createElement(L.a.Item,{style:{marginTop:10}},M.a.createElement(w.a,{type:"primary",htmlType:"submit"},"\u63D0\u4EA4")))},K=de("wzkS"),P={loading:!1,data:{},tags:[]},N;(function(ue){ue[ue.GET_DATA=0]="GET_DATA",ue[ue.SET_LOADING=1]="SET_LOADING",ue[ue.GET_TAGS=2]="GET_TAGS"})(N||(N={}));function $(ue,me){switch(me.type){case N.GET_DATA:return Object(U.a)(Object(U.a)({},ue),me.payload);case N.GET_TAGS:return Object(U.a)(Object(U.a)({},ue),{},{tags:me.payload});case N.SET_LOADING:return Object(U.a)(Object(U.a)({},ue),{},{loading:me.payload});default:throw new Error}}var ne=Je.default=function(){var ue=Object(A.i)(),me=ue.caseId,ke=Object(A.g)(),xe=Object(H.useReducer)($,P),Re=Object(J.a)(xe,2),Se=Re[0],Te=Re[1],ye=Se.loading,z=Se.tags,s=Se.data;Object(H.useEffect)(function(){function F(){return oe.apply(this,arguments)}function oe(){return oe=Object(O.a)(G.a.mark(function be(){var we;return G.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return Le.next=2,Object(K.b)();case 2:we=Le.sent,Te({type:N.GET_TAGS,payload:we.library_tags});case 4:case"end":return Le.stop()}},be)})),oe.apply(this,arguments)}F()},[]),Object(H.useEffect)(function(){var F=!1;function oe(){return be.apply(this,arguments)}function be(){return be=Object(O.a)(G.a.mark(function we(){var Oe,Le,De,_e,Ne,Ge,He,ze,nt;return G.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Te({type:N.SET_LOADING,payload:!1}),Xe.next=3,Object(K.c)(me);case 3:Oe=Xe.sent,Le=Oe.author_name,De=Oe.author_school_name,_e=Oe.content,Ne=Oe.cover,Ge=Oe.attachments,He=Oe.status,ze=Oe.title,nt=Oe.tags,F||(Oe.status===404?ke.push("/moop_cases"):Te({type:N.GET_DATA,payload:{data:{title:ze,author_name:Le,author_school_name:De,content:_e,tag_ids:nt.map(function(Pe){return Pe.id}),publish:He==="published",attachment_ids:Ge.map(function(Pe){return{uid:Pe.id,id:Pe.id,name:Pe.title,url:Pe.url,filesize:Pe.filesize,status:"done"}}),cover_id:Ne!=null&&Ne.id?[{uid:Ne==null?void 0:Ne.id,id:Ne==null?void 0:Ne.id,name:Ne==null?void 0:Ne.title,url:Ne==null?void 0:Ne.url,filesize:Ne==null?void 0:Ne.filesize,status:"done"}]:[]},loading:!1}}));case 6:case"end":return Xe.stop()}},we)})),be.apply(this,arguments)}return!F&&me&&oe(),function(){F=!0}},[me]);function f(F){return D.apply(this,arguments)}function D(){return D=Object(O.a)(G.a.mark(function F(oe){var be,we;return G.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:if(!me){Le.next=6;break}return Le.next=3,Object(K.e)(me,oe);case 3:ke.push("/moop_cases/".concat(me,"/publish-success")),Le.next=11;break;case 6:return Le.next=8,Object(K.a)(oe);case 8:be=Le.sent,we=be.id,we&&ke.push("/moop_cases/".concat(we,"/publish-success"));case 11:case"end":return Le.stop()}},F)})),D.apply(this,arguments)}var X={initialValues:s,tags:z,removeAttachment:K.d,callback:f};return M.a.createElement(Z.a,{spinning:ye,delay:500},M.a.createElement("div",{className:"moop-info"},M.a.createElement("div",{className:"crumb"},M.a.createElement(I.a,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),M.a.createElement("span",null,"\u65B0\u5EFA")),M.a.createElement("div",{className:"title"},M.a.createElement("h2",null,"\u4E0A\u4F20\u6559\u5B66\u6848\u4F8B"),M.a.createElement(I.a,{to:"/moop_cases"},"\u8FD4\u56DE")),M.a.createElement(V,X)))}},osHv:function(dt,Je,de){(function(fe){fe(de("VrN/"))})(function(fe){"use strict";var Z=fe.Pos;function O(d,o){return d.line-o.line||d.ch-o.ch}var J="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=J+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+J+"]["+U+"]*)","g");function G(d,o,l,h){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function H(d,o){var l=d.cm.getTokenTypeAt(Z(d.line,o));return l&&/\btag\b/.test(l)}function M(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function _(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function b(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(M(d))continue;return}if(!H(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(_(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var l=R.exec(d.text);if(l&&l.index==o)return l}}function I(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(M(d))continue;return}if(!H(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function k(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(_(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function w(d,o){for(var l=[];;){var h=I(d),T,v=d.line,g=d.ch-(h?h[0].length:0);if(!h||!(T=b(d)))return;if(T=="selfClose")continue;if(h[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==h[2]){l.length=L;break}if(L<0&&(!o||o==h[2]))return{tag:h[2],from:Z(v,g),to:Z(d.line,d.ch)}}else l.push(h[2])}}function C(d,o){for(var l=[];;){var h=k(d);if(!h)return;if(h=="selfClose"){A(d);continue}var T=d.line,v=d.ch,g=A(d);if(!g)return;if(g[1])l.push(g[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==g[2]){l.length=L;break}if(L<0&&(!o||o==g[2]))return{tag:g[2],from:Z(d.line,d.ch),to:Z(T,v)}}}}fe.registerHelper("fold","xml",function(d,o){for(var l=new G(d,o.line,0);;){var h=I(l);if(!h||l.line!=o.line)return;var T=b(l);if(!T)return;if(!h[1]&&T!="selfClose"){var v=Z(l.line,l.ch),g=w(l,h[2]);return g&&O(g.from,v)>0?{from:v,to:g.from}:null}}}),fe.findMatchingTag=function(d,o,l){var h=new G(d,o.line,o.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var T=b(h),v=T&&Z(h.line,h.ch),g=T&&A(h);if(!T||!g||O(h,o)>0)return;var L={from:Z(h.line,h.ch),to:v,tag:g[2]};return T=="selfClose"?{open:L,close:null,at:"open"}:g[1]?{open:C(h,g[2]),close:L,at:"close"}:(h=new G(d,v.line,v.ch,l),{open:L,close:w(h,g[2]),at:"open"})},fe.findEnclosingTag=function(d,o,l,h){for(var T=new G(d,o.line,o.ch,l);;){var v=C(T,h);if(!v)break;var g=new G(d,o.line,o.ch,l),L=w(g,v.tag);if(L)return{open:v,close:L}}},fe.scanForClosingTag=function(d,o,l,h){var T=new G(d,o.line,o.ch,h?{from:0,to:h}:null);return w(T,l)}})},p5ED:function(dt,Je,de){"use strict";var fe=de("+L6B"),Z=de("2/Rp"),O=de("5Dmo"),J=de("3S7+"),U=de("k1fw"),R=de("9og8"),G=de("tJVT"),H=de("WmNS"),M=de.n(H),_=de("q1tI"),b=de.n(_),A=de("vHTk"),I=de.n(A),k=de("yEEn"),w=de("ZW9T"),C=de("1vsH"),d=de("V0Rq"),o=de("m3rI");Je.a=function(l){var h,T,v,g,L,E,p,c=l.editOffice,u=c===void 0?"view":c,a=l.data,y=l.theme,m=l.type,x=l.filename,B=l.monacoEditor,W=l.className,V=l.style,K=l.close,P=l.onClose,N=l.hasMask,$=l.disabledDownload,ne=Object(_.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ue=Object(G.a)(ne,2),me=ue[0],ke=ue[1],xe=Object(_.useState)(""),Re=Object(G.a)(xe,2),Se=Re[0],Te=Re[1],ye=Object(_.useState)(),z=Object(G.a)(ye,2),s=z[0],f=z[1],D=window.ENV==="build"?"/react/build":"",X=o.a.PROXY_SERVER||location.origin,F,oe=1024*1024,be=10*oe,we=Object(_.useRef)();(h=a)!==null&&h!==void 0&&h.startsWith("/api")&&m!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),m==="office"&&(F=Object(C.T)(a).filesize,F>be&&(m="other")),x&&B&&(B.filename=x),Object(_.useEffect)(function(){var _e,Ne,Ge=(_e=document.cookie)===null||_e===void 0||((Ne=_e.replace(/\s/g,""))===null||Ne===void 0)?void 0:Ne.split(";");Ge==null||Ge.map(function(He){var ze=He.split("=");ze[0]==="_educoder_session"&&Te(ze[1])})},[]),Object(_.useEffect)(function(){m==="office"&&Oe()},[m,a]);var Oe=function(){var _e=Object(R.a)(M.a.mark(function Ne(){var Ge,He,ze;return M.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return console.log("data:",a),Ge=a,a.startsWith("http")||(Ge=location.origin+Ge),He=new URL(Ge).pathname.split("/").pop(),Ye.next=6,Object(d.V)({attachment_id:He});case 6:ze=Ye.sent,f(ze);case 8:case"end":return Ye.stop()}},Ne)}));return function(){return _e.apply(this,arguments)}}(),Le=function(){if(a.startsWith("http")||a.startsWith("blob:")){De();return}Object(C.z)(x||"educoder",a,x)},De=function(){Object(C.x)(x||"educoder",decodeURIComponent(a))};return b.a.createElement("div",{style:Object(U.a)({},V||{}),className:"".concat(N&&I.a.bgBlack," ").concat(m?I.a.wrp:"hide")},K&&b.a.createElement("div",{className:I.a.close,ref:we},!$&&b.a.createElement(J.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return we.current}},b.a.createElement("span",{onClick:De},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(J.a,{title:"\u5173\u95ED",getPopupContainer:function(){return we.current}},b.a.createElement("span",{className:"",onClick:P},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(I.a[W]," ").concat(W," ").concat(I.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&b.a.createElement(w.b,B)),m==="audio"&&b.a.createElement("audio",{src:"".concat(((T=a)===null||T===void 0?void 0:T.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&b.a.createElement(b.a.Fragment,null,((g=a)===null||g===void 0?void 0:g.indexOf("http"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&s&&b.a.createElement("iframe",{src:"".concat(D,"/office.html?key=").concat(s.key,"&url=").concat(X+s.url,"&callbackUrl=").concat(X+s.callbackUrl,"&fileType=").concat(s.fileType,"&title=").concat(s.title,"&model=").concat(u,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),m==="html"&&b.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&b.a.createElement("iframe",{src:"".concat(D,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!$)}),m==="image"&&b.a.createElement("img",{src:"".concat(((L=a)===null||L===void 0?void 0:L.indexOf("http://"))>-1||((E=a)===null||E===void 0?void 0:E.indexOf("https://"))>-1||(p=a)!==null&&p!==void 0&&p.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&b.a.createElement("div",null,b.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},b.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&b.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},b.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(dt,Je,de){},rUJ1:function(dt,Je){const de=/[&<>"']/,fe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,J={"&":"&","<":"<",">":">",'"':""","'":"'"},U=E=>J[E];function R(E,p){if(p){if(de.test(E))return E.replace(fe,U)}else if(Z.test(E))return E.replace(O,U);return E}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(E){return E.replace(G,(p,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const M=/(^|[^\[])\^/g;function _(E,p){E=E.source||E,p=p||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(M,"$1"),E=E.replace(u,a),c),getRegex:()=>new RegExp(E,p)};return c}const b=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function I(E,p,c){if(E){let u;try{u=decodeURIComponent(H(c)).replace(b,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}p&&!A.test(c)&&(c=o(p,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const k={},w=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(E,p){k[" "+E]||(w.test(E)?k[" "+E]=E+"/":k[" "+E]=v(E,"/",!0)),E=k[" "+E];const c=E.indexOf(":")===-1;return p.substring(0,2)==="//"?c?p:E.replace(C,"$1")+p:p.charAt(0)==="/"?c?p:E.replace(d,"$1")+p:E+p}const l={exec:function(){}};function h(E){let p=1,c,u;for(;p<arguments.length;p++){c=arguments[p];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(E[u]=c[u])}return E}function T(E,p){const c=E.replace(/\|/g,(y,m,x)=>{let B=!1,W=m;for(;--W>=0&&x[W]==="\\";)B=!B;return B?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>p)u.splice(p);else for(;u.length<p;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function v(E,p,c){const u=E.length;if(u===0)return"";let a=0;for(;a<u;){const y=E.charAt(u-a-1);if(y===p&&!c)a++;else if(y!==p&&c)a++;else break}return E.substr(0,u-a)}function g(E,p){if(E.indexOf(p[1])===-1)return-1;const c=E.length;let u=0,a=0;for(;a<c;a++)if(E[a]==="\\")a++;else if(E[a]===p[0])u++;else if(E[a]===p[1]&&(u--,u<0))return a;return-1}function L(E){E&&E.sanitize&&!E.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")}dt.exports={escape:R,unescape:H,edit:_,cleanUrl:I,resolveUrl:o,noopTest:l,merge:h,splitCells:T,rtrim:v,findClosingBracket:g,checkSanitizeDeprecation:L}},ulZh:function(dt,Je,de){typeof window!="undefined"&&function(Z,O){dt.exports=O()}(this,function(){return function(fe){var Z={};function O(J){if(Z[J])return Z[J].exports;var U=Z[J]={i:J,l:!1,exports:{}};return fe[J].call(U.exports,U,U.exports,O),U.l=!0,U.exports}return O.m=fe,O.c=Z,O.d=function(J,U,R){O.o(J,U)||Object.defineProperty(J,U,{enumerable:!0,get:R})},O.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},O.t=function(J,U){if(U&1&&(J=O(J)),U&8)return J;if(U&4&&typeof J=="object"&&J&&J.__esModule)return J;var R=Object.create(null);if(O.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:J}),U&2&&typeof J!="string")for(var G in J)O.d(R,G,function(H){return J[H]}.bind(null,G));return R},O.n=function(J){var U=J&&J.__esModule?function(){return J.default}:function(){return J};return O.d(U,"a",U),U},O.o=function(J,U){return Object.prototype.hasOwnProperty.call(J,U)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(fe,Z,O){"use strict";var J=Object.prototype.hasOwnProperty,U="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(U=!1));function G(b,A,I){this.fn=b,this.context=A,this.once=I||!1}function H(b,A,I,k,w){if(typeof I!="function")throw new TypeError("The listener must be a function");var C=new G(I,k||b,w),d=U?U+A:A;return b._events[d]?b._events[d].fn?b._events[d]=[b._events[d],C]:b._events[d].push(C):(b._events[d]=C,b._eventsCount++),b}function M(b,A){--b._eventsCount===0?b._events=new R:delete b._events[A]}function _(){this._events=new R,this._eventsCount=0}_.prototype.eventNames=function(){var A=[],I,k;if(this._eventsCount===0)return A;for(k in I=this._events)J.call(I,k)&&A.push(U?k.slice(1):k);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(I)):A},_.prototype.listeners=function(A){var I=U?U+A:A,k=this._events[I];if(!k)return[];if(k.fn)return[k.fn];for(var w=0,C=k.length,d=new Array(C);w<C;w++)d[w]=k[w].fn;return d},_.prototype.listenerCount=function(A){var I=U?U+A:A,k=this._events[I];return k?k.fn?1:k.length:0},_.prototype.emit=function(A,I,k,w,C,d){var o=U?U+A:A;if(!this._events[o])return!1;var l=this._events[o],h=arguments.length,T,v;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,I),!0;case 3:return l.fn.call(l.context,I,k),!0;case 4:return l.fn.call(l.context,I,k,w),!0;case 5:return l.fn.call(l.context,I,k,w,C),!0;case 6:return l.fn.call(l.context,I,k,w,C,d),!0}for(v=1,T=new Array(h-1);v<h;v++)T[v-1]=arguments[v];l.fn.apply(l.context,T)}else{var g=l.length,L;for(v=0;v<g;v++){l[v].once&&this.removeListener(A,l[v].fn,void 0,!0);switch(h){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,I);break;case 3:l[v].fn.call(l[v].context,I,k);break;case 4:l[v].fn.call(l[v].context,I,k,w);break;default:if(!T)for(L=1,T=new Array(h-1);L<h;L++)T[L-1]=arguments[L];l[v].fn.apply(l[v].context,T)}}}return!0},_.prototype.on=function(A,I,k){return H(this,A,I,k,!1)},_.prototype.once=function(A,I,k){return H(this,A,I,k,!0)},_.prototype.removeListener=function(A,I,k,w){var C=U?U+A:A;if(!this._events[C])return this;if(!I)return M(this,C),this;var d=this._events[C];if(d.fn)d.fn===I&&(!w||d.once)&&(!k||d.context===k)&&M(this,C);else{for(var o=0,l=[],h=d.length;o<h;o++)(d[o].fn!==I||w&&!d[o].once||k&&d[o].context!==k)&&l.push(d[o]);l.length?this._events[C]=l.length===1?l[0]:l:M(this,C)}return this},_.prototype.removeAllListeners=function(A){var I;return A?(I=U?U+A:A,this._events[I]&&M(this,I)):(this._events=new R,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=U,_.EventEmitter=_,fe.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(fe,Z,O){(function(J){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(_,b,A){if(A=A||{},_=_.trim(),b=b.trim(),!b){if(!A.alwaysNormalize)return _;var I=M.parseURL(_);if(!I)throw new Error("Error trying to parse base URL.");return I.path=M.normalizePath(I.path),M.buildURLFromParts(I)}var k=M.parseURL(b);if(!k)throw new Error("Error trying to parse relative URL.");if(k.scheme)return A.alwaysNormalize?(k.path=M.normalizePath(k.path),M.buildURLFromParts(k)):b;var w=M.parseURL(_);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var C=R.exec(w.path);w.netLoc=C[1],w.path=C[2]}w.netLoc&&!w.path&&(w.path="/");var d={scheme:w.scheme,netLoc:k.netLoc,path:null,params:k.params,query:k.query,fragment:k.fragment};if(!k.netLoc&&(d.netLoc=w.netLoc,k.path[0]!=="/"))if(!k.path)d.path=w.path,k.params||(d.params=w.params,k.query||(d.query=w.query));else{var o=w.path,l=o.substring(0,o.lastIndexOf("/")+1)+k.path;d.path=M.normalizePath(l)}return d.path===null&&(d.path=A.alwaysNormalize?M.normalizePath(k.path):k.path),M.buildURLFromParts(d)},parseURL:function(_){var b=U.exec(_);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(G,"");_.length!==(_=_.replace(H,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};fe.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(fe,Z,O){function J(A){var I={};function k(C){if(I[C])return I[C].exports;var d=I[C]={i:C,l:!1,exports:{}};return A[C].call(d.exports,d,d.exports,k),d.l=!0,d.exports}k.m=A,k.c=I,k.i=function(C){return C},k.d=function(C,d,o){k.o(C,d)||Object.defineProperty(C,d,{configurable:!1,enumerable:!0,get:o})},k.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},k.n=function(C){var d=C&&C.__esModule?function(){return C.default}:function(){return C};return k.d(d,"a",d),d},k.o=function(C,d){return Object.prototype.hasOwnProperty.call(C,d)},k.p="/",k.oe=function(C){throw console.error(C),C};var w=k(k.s=ENTRY_MODULE);return w.default||w}var U="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function G(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(A){return!isNaN(1*A)}function M(A,I,k){var w={};w[k]=[];var C=I.toString(),d=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return w;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+G(o)+R,"g"),h;h=l.exec(C);){if(h[3]==="dll-reference")continue;w[k].push(h[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+R,"g");h=l.exec(C);)A[h[2]]||(w[k].push(h[1]),A[h[2]]=O(h[1]).m),w[h[2]]=w[h[2]]||[],w[h[2]].push(h[4]);for(var T=Object.keys(w),v=0;v<T.length;v++)for(var g=0;g<w[T[v]].length;g++)H(w[T[v]][g])&&(w[T[v]][g]=1*w[T[v]][g]);return w}function _(A){var I=Object.keys(A);return I.reduce(function(k,w){return k||A[w].length>0},!1)}function b(A,I){for(var k={main:[I]},w={main:[]},C={main:{}};_(k);)for(var d=Object.keys(k),o=0;o<d.length;o++){var l=d[o],h=k[l],T=h.pop();if(C[l]=C[l]||{},C[l][T]||!A[l][T])continue;C[l][T]=!0,w[l]=w[l]||[],w[l].push(T);for(var v=M(A,A[l][T],l),g=Object.keys(v),L=0;L<g.length;L++)k[g[L]]=k[g[L]]||[],k[g[L]]=k[g[L]].concat(v[g[L]])}return w}fe.exports=function(A,I){I=I||{};var k={main:O.m},w=I.all?{main:Object.keys(k.main)}:b(k,A),C="";Object.keys(w).filter(function(T){return T!=="main"}).forEach(function(T){for(var v=0;w[T][v];)v++;w[T].push(v),k[T][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+T+" = ("+J.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+w[T].map(function(g){return""+JSON.stringify(g)+": "+k[T][g].toString()}).join(",")+`});
|
|
`}),C=C+"new (("+J.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+w.main.map(function(T){return""+JSON.stringify(T)+": "+k.main[T].toString()}).join(",")+"}))(self);";var d=new window.Blob([C],{type:"text/javascript"});if(I.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"hlsDefaultConfig",function(){return L}),O.d(Z,"mergeConfig",function(){return p}),O.d(Z,"enableStreamingMode",function(){return c});var J=O("./src/controller/abr-controller.ts"),U=O("./src/controller/audio-stream-controller.ts"),R=O("./src/controller/audio-track-controller.ts"),G=O("./src/controller/subtitle-stream-controller.ts"),H=O("./src/controller/subtitle-track-controller.ts"),M=O("./src/controller/buffer-controller.ts"),_=O("./src/controller/timeline-controller.ts"),b=O("./src/controller/cap-level-controller.ts"),A=O("./src/controller/fps-controller.ts"),I=O("./src/controller/eme-controller.ts"),k=O("./src/controller/cmcd-controller.ts"),w=O("./src/utils/xhr-loader.ts"),C=O("./src/utils/fetch-loader.ts"),d=O("./src/utils/cues.ts"),o=O("./src/utils/mediakeys-helper.ts"),l=O("./src/utils/logger.ts");function h(){return h=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var y=arguments[a];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(u[m]=y[m])}return u},h.apply(this,arguments)}function T(u,a){var y=Object.keys(u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(u);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),y.push.apply(y,m)}return y}function v(u){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?T(Object(y),!0).forEach(function(m){g(u,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(y)):T(Object(y)).forEach(function(m){Object.defineProperty(u,m,Object.getOwnPropertyDescriptor(y,m))})}return u}function g(u,a,y){return a in u?Object.defineProperty(u,a,{value:y,enumerable:!0,configurable:!0,writable:!0}):u[a]=y,u}var L=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:J.default,bufferController:M.default,capLevelController:b.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},E()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:H.default,timelineController:_.TimelineController,audioStreamController:U.default,audioTrackController:R.default,emeController:I.default,cmcdController:k.default});function E(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function p(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},u,a)}function c(u){var a=u.loader;if(a!==C.default&&a!==w.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var y=Object(C.fetchSupported)();y&&(u.loader=C.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/utils/ewma-bandwidth-estimator.ts"),R=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/errors.ts"),M=O("./src/types/loader.ts"),_=O("./src/utils/logger.ts");function b(k,w){for(var C=0;C<w.length;C++){var d=w[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(k,d.key,d)}}function A(k,w,C){return w&&b(k.prototype,w),C&&b(k,C),k}var I=function(){function k(C){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=C;var d=C.config;this.bwEstimator=new U.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var w=k.prototype;return w.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(d,o){var l=o.frag;if(l.type===M.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=o.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,T=l.config,v=l.media;if(!d||!v)return;var g=o?o.stats:d.stats,L=o?o.duration:d.duration;if(g.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||v.paused||!v.playbackRate||!v.readyState)return;var E=performance.now()-g.loading.start,p=Math.abs(v.playbackRate);if(E<=500*L/p)return;var c=l.levels,u=l.minAutoLevel,a=c[d.level],y=g.total||Math.max(g.loaded,Math.round(L*a.maxBitrate/8)),m=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/E),x=(y-g.loaded)/m,B=v.currentTime,W=(G.BufferHelper.bufferInfo(v,B,T.maxBufferHole).end-B)/p;if(W>=2*L/p||x<=W)return;var V=Number.POSITIVE_INFINITY,K;for(K=d.level-1;K>u;K--){var P=c[K].maxBitrate;if(V=L*P/(8*.8*m),V<W)break}if(V>=x)return;var N=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
|
|
Current BW estimate: `+(Object(J.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+V.toFixed(3)+` s
|
|
Time to underbuffer: `+W.toFixed(3)+" s"),l.nextLoadLevel=K,this.bwEstimator.sample(E,g.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:g})},w.onFragLoaded=function(d,o){var l=o.frag,h=o.part;if(l.type===M.PlaylistLevelType.MAIN&&Object(J.isFiniteNumber)(l.sn)){var T=h?h.stats:l.stats,v=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[l.level],L=(g.loaded?g.loaded.bytes:0)+T.loaded,E=(g.loaded?g.loaded.duration:0)+v;g.loaded={bytes:L,duration:E},g.realBitrate=Math.round(8*L/E)}if(l.bitrateTest){var p={stats:T,frag:l,part:h,id:l.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,p),l.bitrateTest=!1}}},w.onFragBuffered=function(d,o){var l=o.frag,h=o.part,T=h?h.stats:l.stats;if(T.aborted)return;if(l.type!==M.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=T.parsing.end-T.loading.start;this.bwEstimator.sample(v,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},w.onError=function(d,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.maxAutoLevel,T=l.config,v=l.minAutoLevel,g=l.media,L=o?o.duration:d?d.duration:0,E=g?g.currentTime:0,p=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,u=(G.BufferHelper.bufferInfo(g,E,T.maxBufferHole).end-E)/p,a=this.findBestLevel(c,v,h,u,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;_.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=L?Math.min(L,T.maxStarvationDelay):T.maxStarvationDelay,m=T.abrBandWidthFactor,x=T.abrBandWidthUpFactor;if(!u){var B=this.bitrateTestDelay;if(B){var W=L?Math.min(L,T.maxLoadingDelay):T.maxLoadingDelay;y=W-B,_.logger.trace("bitrate test took "+Math.round(1e3*B)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),m=x=1}}return a=this.findBestLevel(c,v,h,u+y,m,x),Math.max(a,0)},w.findBestLevel=function(d,o,l,h,T,v){for(var g,L=this.fragCurrent,E=this.partCurrent,p=this.lastLoadedFragLevel,c=this.hls.levels,u=c[p],a=!!(u!=null&&(g=u.details)!==null&&g!==void 0&&g.live),y=u==null?void 0:u.codecSet,m=E?E.duration:L?L.duration:0,x=l;x>=o;x--){var B=c[x];if(!B||y&&B.codecSet!==y)continue;var W=B.details,V=(E?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||m,K=void 0;x<=p?K=T*d:K=v*d;var P=c[x].maxBitrate,N=P*V/K;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(K)+"/"+P+"/"+V+"/"+h+"/"+N),K>P&&(!N||a&&!this.bitrateTestDelay||N<h))return x}return-1},A(k,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),k}();Z.default=I},"./src/controller/audio-stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),R=O("./src/events.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-tracker.ts"),M=O("./src/types/level.ts"),_=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),A=O("./src/demux/chunk-cache.ts"),I=O("./src/demux/transmuxer-interface.ts"),k=O("./src/types/transmuxer.ts"),w=O("./src/controller/fragment-finders.ts"),C=O("./src/utils/discontinuities.ts"),d=O("./src/errors.ts"),o=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var E=1;E<arguments.length;E++){var p=arguments[E];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(L[c]=p[c])}return L},l.apply(this,arguments)}function h(L,E){L.prototype=Object.create(E.prototype),L.prototype.constructor=L,T(L,E)}function T(L,E){return T=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},T(L,E)}var v=100,g=function(L){h(E,L);function E(c,u){var a;return a=L.call(this,c,u,"[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 p=E.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var u=this.hls;u.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(R.Events.ERROR,this.onError,this),u.on(R.Events.BUFFER_RESET,this.onBufferReset,this),u.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var u=this.hls;u.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(R.Events.ERROR,this.onError,this),u.off(R.Events.BUFFER_RESET,this.onBufferReset,this),u.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(u,a){var y=a.frag,m=a.id,x=a.initPTS;if(m==="main"){var B=y.cc;this.initPTS[y.cc]=x,this.log("InitPTS for cc: "+B+" found from main: "+x),this.videoTrackCC=B,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},p.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var u,a=this.levels,y=this.trackId,m=a==null||((u=a[y])===null||u===void 0)?void 0:u.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var x,B=performance.now(),W=this.retryDate;(!W||B>=W||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var V=this.waitingData;if(V){var K=V.frag,P=V.part,N=V.cache,$=V.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ne=N.flush(),ue={frag:K,part:P,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(ue),$&&L.prototype._handleFragmentLoadComplete.call(this,ue)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var me=this.getLoadPosition(),ke=G.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),xe=Object(w.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,K);xe<0&&(o.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},p.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,y=a.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},p.doTickIdle=function(){var u,a,y=this.hls,m=this.levels,x=this.media,B=this.trackId,W=y.config;if(!m||!m[B])return;if(!x&&(this.startFragRequested||!W.startFragPrefetch))return;var V=m[B],K=V.details;if(!K||K.live&&this.levelLastLoaded!==B||this.waitForCdnTuneIn(K)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(P===null)return;var N=P.len,$=this.getMaxBufferLength(),ne=this.audioSwitch;if(N>=$&&!ne)return;if(!ne&&this._streamEnded(P,K)){y.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ue=K.fragments,me=ue[0].start,ke=P.end;if(ne){var xe=this.getLoadPosition();ke=xe,K.PTSKnown&&xe<me&&((P.end>me||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=me+.05))}var Re=this.getNextFragment(ke,K);if(!Re){this.bufferFlushed=!0;return}((u=Re.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Re.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Re,K):this.loadFragment(Re,K,ke)},p.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(u,a){var y=a.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new M.Level(m)})},p.onAudioTrackSwitching=function(u,a){var y=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(v):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(u,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(u,a){var y,m=this.levels,x=a.details,B=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+B);return}this.log("Track "+B+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var W=m[B],V=0;if(x.live||(y=W.details)!==null&&y!==void 0&&y.live){var K=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!K)return;!W.details&&x.hasProgramDateTime&&K.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(x,K),V=x.fragments[0].start):V=this.alignPlaylists(x,W.details)}W.details=x,this.levelLastLoaded=B,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(W.details,V),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=U.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(u){var a,y=u.frag,m=u.part,x=u.payload,B=this.config,W=this.trackId,V=this.levels;if(!V){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var K=V[W];console.assert(K,"Audio track is defined on fragment load progress");var P=K.details;console.assert(P,"Audio track details are defined on fragment load progress");var N=B.defaultAudioCodec||K.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new I.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[y.cc],ue=(a=y.initSegment)===null||a===void 0?void 0:a.data;if(ne!==void 0){var me=!1,ke=m?m.index:-1,xe=ke!==-1,Re=new k.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,x.byteLength,ke,xe);$.push(x,ue,N,"",y,m,P.totalduration,me,Re,ne)}else{o.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+W);var Se=this.waitingData=this.waitingData||{frag:y,part:m,cache:new A.default,complete:!1},Te=Se.cache;Te.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(u,a){var y=a.tracks.audio;y&&(this.mediaBuffer=y.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(u,a){var y=a.frag,m=a.part;if(y.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(m?" p: "+m.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,m)},p.onError=function(u,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var y=!0,m=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);m&&m.len>.5&&(y=!this.reduceMaxBufferLength(m.len)),y&&(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}},p.onBufferFlushed=function(u,a){var y=a.type;y===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(u){var a,y="audio",m=this.hls,x=u.remuxResult,B=u.chunkMeta,W=this.getCurrentContext(B);if(!W){this.warn("The loading context changed while buffering fragment "+B.sn+" of level "+B.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(B.level);return}var V=W.frag,K=W.part,P=x.audio,N=x.text,$=x.id3,ne=x.initSegment;if(this.fragContextChanged(V))return;if(this.state=U.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,V,B),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:V,id:y,tracks:ne.tracks})),P){var ue=P.startPTS,me=P.endPTS,ke=P.startDTS,xe=P.endDTS;K&&(K.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:me,startDTS:ke,endDTS:xe}),V.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,ue,me,ke,xe),this.bufferFragmentData(P,V,K,B)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Re=l({frag:V,id:y},$);m.trigger(R.Events.FRAG_PARSING_METADATA,Re)}if(N){var Se=l({frag:V,id:y},N);m.trigger(R.Events.FRAG_PARSING_USERDATA,Se)}},p._bufferInitSegment=function(u,a,y){if(this.state!==U.State.PARSING)return;u.video&&delete u.video;var m=u.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,u);var x=m.initSegment;if(x!=null&&x.byteLength){var B={type:"audio",frag:a,part:null,chunkMeta:y,parent:a.type,data:x};this.hls.trigger(R.Events.BUFFER_APPENDING,B)}this.tick()},p.loadFragment=function(u,a,y){var m=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||m===H.FragmentState.NOT_LOADED||m===H.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(J.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,a,y)))},p.completeAudioSwitch=function(){var u=this.hls,a=this.media,y=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:y})},E}(U.default);Z.default=g},"./src/controller/audio-track-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/errors.ts"),R=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(I,k){for(var w=0;w<k.length;w++){var C=k[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(I,C.key,C)}}function M(I,k,w){return k&&H(I.prototype,k),w&&H(I,w),I}function _(I,k){I.prototype=Object.create(k.prototype),I.prototype.constructor=I,b(I,k)}function b(I,k){return b=Object.setPrototypeOf||function(C,d){return C.__proto__=d,C},b(I,k)}var A=function(I){_(k,I);function k(C){var d;return d=I.call(this,C,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var w=k.prototype;return w.registerListeners=function(){var d=this.hls;d.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(J.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(J.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,I.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(d,o){var l=o.id,h=o.details,T=this.tracksInGroup[l];if(!T){this.warn("Invalid audio track id "+l);return}var v=T.details;T.details=o.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,v))},w.onLevelLoading=function(d,o){this.switchLevel(o.level)},w.onLevelSwitching=function(d,o){this.switchLevel(o.level)},w.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!h.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var T={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(J.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},w.onError=function(d,o){if(I.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var h=o[d],T=h.id,v=h.groupId,g=v===void 0?"":v,L=h.name,E=h.type,p=h.url;if(this.trackId=d,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(J.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:g,name:L,type:E,url:p}),h.details&&!h.details.live)return;var c=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(c)},w.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var h=o[l];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},w.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,h=o.groupId,T=o.url;if(d)try{T=d.addDirectives(T)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(J.Events.AUDIO_TRACK_LOADING,{url:T,id:l,groupId:h,deliveryDirectives:d||null})}},M(k,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),k}(R.default);Z.default=A},"./src/controller/base-playlist-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return M});var J=O("./src/polyfills/number.ts"),U=O("./src/types/level.ts"),R=O("./src/controller/level-helper.ts"),G=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),M=function(){function _(A,I){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,I+":"),this.warn=G.logger.warn.bind(G.logger,I+":"),this.hls=A}var b=_.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(I,k){k.fatal&&k.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(I,k){var w=k==null?void 0:k.renditionReports;if(w)for(var C=0;C<w.length;C++){var d=w[C],o=""+d.URI;if(o===I.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(k&&this.hls.config.lowLatencyMode){var T=Math.min(k.age-k.partTarget,k.targetduration);h!==void 0&&T>k.partTarget&&(h+=1)}if(Object(J.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(J.isFiniteNumber)(h)?h:void 0,U.HlsSkip.No)}}},b.loadPlaylist=function(I){},b.shouldLoadTrack=function(I){return this.canLoad&&I&&!!I.url&&(!I.details||I.details.live)},b.playlistLoaded=function(I,k,w){var C=this,d=k.details,o=k.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||w!=null&&w.live){if(d.reloaded(w),w&&this.log("live playlist "+I+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),w&&d.fragments.length>0&&Object(R.mergeDetails)(w,d),!this.canLoad||!d.live)return;var h,T=void 0,v=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var g=this.hls.config.lowLatencyMode,L=d.lastPartSn,E=d.endSN,p=d.lastPartIndex,c=p!==-1,u=L===E,a=g?0:p;c?(T=u?E+1:L,v=u?a:p+1):T=E+1;var y=d.age,m=y+d.ageHeader,x=Math.min(m-d.partTarget,d.targetduration*1.5);if(x>0){if(w&&x>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+x+" with playlist age: "+d.age),x=0;else{var B=Math.floor(x/d.targetduration);if(T+=B,v!==void 0){var W=Math.round(x%d.targetduration/d.partTarget);v+=W}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+x+" skip sn "+B+" to part "+v)}d.tuneInGoal=x}if(h=this.getDeliveryDirectives(d,k.deliveryDirectives,T,v),g||!u){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,k.deliveryDirectives,T,v);var V=Object(R.computeReloadInterval)(d,o);T!==void 0&&d.canBlockReload&&(V-=d.partTarget||1),this.log("reload live playlist "+I+" in "+Math.round(V)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(h)},V)}else this.clearTimer()},b.getDeliveryDirectives=function(I,k,w,C){var d=Object(U.getSkipValue)(I,w);return k!=null&&k.skip&&I.deltaUpdateFailed&&(w=k.msn,C=k.part,d=U.HlsSkip.No),new U.HlsUrlParameters(w,C,d)},b.retryLoadingOrFail=function(I){var k=this,w=this.hls.config,C=this.retryCount<w.levelLoadingMaxRetry;if(C){var d;if(this.retryCount++,I.details.indexOf("LoadTimeOut")>-1&&(d=I.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+I.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return k.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+I.details+'"')}}else this.warn('cannot recover from error "'+I.details+'"'),this.clearTimer(),I.fatal=!0;return C},_}()},"./src/controller/base-stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"State",function(){return E}),O.d(Z,"default",function(){return p});var J=O("./src/polyfills/number.ts"),U=O("./src/task-loop.ts"),R=O("./src/controller/fragment-tracker.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts"),M=O("./src/events.ts"),_=O("./src/errors.ts"),b=O("./src/types/transmuxer.ts"),A=O("./src/utils/mp4-tools.ts"),I=O("./src/utils/discontinuities.ts"),k=O("./src/controller/fragment-finders.ts"),w=O("./src/controller/level-helper.ts"),C=O("./src/loader/fragment-loader.ts"),d=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function h(c,u){for(var a=0;a<u.length;a++){var y=u[a];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(c,y.key,y)}}function T(c,u,a){return u&&h(c.prototype,u),a&&h(c,a),c}function v(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function g(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,L(c,u)}function L(c,u){return L=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},L(c,u)}var E={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"},p=function(c){g(u,c);function u(y,m,x){var B;return B=c.call(this)||this,B.hls=void 0,B.fragPrevious=null,B.fragCurrent=null,B.fragmentTracker=void 0,B.transmuxer=null,B._state=E.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=y,B.fragmentLoader=new C.default(y.config),B.fragmentTracker=m,B.config=y.config,B.decrypter=new d.default(y,y.config),y.on(M.Events.KEY_LOADED,B.onKeyLoaded,v(B)),B}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},a._streamEnded=function(m,x){var B=this.fragCurrent,W=this.fragmentTracker;if(!x.live&&B&&B.sn===x.endSN&&!m.nextStart){var V=W.getState(B);return V===R.FragmentState.PARTIAL||V===R.FragmentState.OK}return!1},a.onMediaAttached=function(m,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 W=this.config;this.levels&&W.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(W.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,x=this.fragCurrent,B=this.media,W=this.mediaBuffer,V=this.state,K=B?B.currentTime:0,P=G.BufferHelper.bufferInfo(W||B,K,m.maxBufferHole);if(this.log("media seeking to "+(Object(J.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+V),V===E.ENDED)this.resetLoadingState();else if(x&&!P.len){var N=m.maxFragLookUpTolerance,$=x.start-N,ne=x.start+x.duration+N,ue=K>ne;(K<$||ue)&&(ue&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}B&&(this.lastCurrentTime=K),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,x){if(this.state!==E.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=E.IDLE;var B=this.levels[x.frag.level].details;B&&this.loadFragment(x.frag,B,x.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,x){this.log("Loading key for "+m.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=E.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(M.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,x,B){this._loadFragForPlayback(m,x,B)},a._loadFragForPlayback=function(m,x,B){var W=this,V=function(P){if(W.fragContextChanged(m)){W.warn("Fragment "+m.sn+(P.part?" p: "+P.part.index:"")+" of level "+m.level+" was dropped during download."),W.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,W._handleFragmentLoadProgress(P)};this._doFragLoad(m,x,B,V).then(function(K){if(!K)return;W.fragLoadError=0;var P=W.state;if(W.fragContextChanged(m)){(P===E.FRAG_LOADING||P===E.BACKTRACKING||!W.fragCurrent&&P===E.PARSING)&&(W.fragmentTracker.removeFragment(m),W.state=E.IDLE);return}if("payload"in K&&(W.log("Loaded fragment "+m.sn+" of level "+m.level),W.hls.trigger(M.Events.FRAG_LOADED,K),W.state===E.BACKTRACKING)){W.fragmentTracker.backtrack(m,K),W.resetFragmentLoading(m);return}W._handleFragmentLoadComplete(K)}).catch(function(K){W.warn(K),W.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,x,B){if(B===void 0&&(B=null),!(m-x))return;var W={startOffset:m,endOffset:x,type:B};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,W)},a._loadInitSegment=function(m){var x=this;this._doFragLoad(m).then(function(B){if(!B||x.fragContextChanged(m)||!x.levels)throw new Error("init load aborted");return B}).then(function(B){var W=x.hls,V=B.payload,K=m.decryptdata;if(V&&V.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var P=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(V),K.key.buffer,K.iv.buffer).then(function(N){var $=self.performance.now();return W.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:N,stats:{tstart:P,tdecrypt:$}}),B.payload=N,B})}return B}).then(function(B){var W=x.fragCurrent,V=x.hls,K=x.levels;if(!K)throw new Error("init load aborted, missing levels");var P=K[m.level].details;console.assert(P,"Level details are defined when init segment is loaded");var N=m.stats;x.state=E.IDLE,x.fragLoadError=0,m.data=new Uint8Array(B.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),B.frag===W&&V.trigger(M.Events.FRAG_BUFFERED,{stats:N,frag:W,part:null,id:m.type}),x.tick()}).catch(function(B){x.warn(B),x.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var x=this.fragCurrent;return!m||!x||m.level!==x.level||m.sn!==x.sn||m.urlId!==x.urlId},a.fragBufferedComplete=function(m,x){var B=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(G.BufferHelper.getBuffered(B))),this.state=E.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var x=this.transmuxer;if(!x)return;var B=m.frag,W=m.part,V=m.partsLoaded,K=!V||V.length===0||V.some(function(N){return!N}),P=new b.ChunkMetadata(B.level,B.sn,B.stats.chunkCount+1,0,W?W.index:-1,!K);x.flush(P)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,x,B,W){var V=this;if(B===void 0&&(B=null),!this.levels)throw new Error("frag load aborted, missing levels");if(B=Math.max(m.start,B||0),this.config.lowLatencyMode&&x){var K=x.partList;if(K&&W){B>m.end&&x.fragmentHint&&(m=x.fragmentHint);var P=this.getNextPart(K,m,B);if(P>-1){var N=K[P];return this.log("Loading part sn: "+m.sn+" p: "+N.index+" cc: "+m.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+P+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(B.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=E.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:K[P],targetBufferTime:B}),this.doFragPartsLoad(m,K,P,W).catch(function($){return V.handleFragLoadError($)})}else if(!m.url||this.loadedEndOfParts(K,B))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(B.toFixed(3))),Object(J.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=E.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:B}),this.fragmentLoader.load(m,W).catch(function($){return V.handleFragLoadError($)})},a.doFragPartsLoad=function(m,x,B,W){var V=this;return new Promise(function(K,P){var N=[],$=function ne(ue){var me=x[ue];V.fragmentLoader.loadPart(m,me,W).then(function(ke){N[me.index]=ke;var xe=ke.part;V.hls.trigger(M.Events.FRAG_LOADED,ke);var Re=x[ue+1];if(Re&&Re.fragment===m)ne(ue+1);else return K({frag:m,part:xe,partsLoaded:N})}).catch(P)};$(B)})},a.handleFragLoadError=function(m){var x=m.data;return x&&x.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(M.Events.ERROR,x),null},a._handleTransmuxerFlush=function(m){var x=this.getCurrentContext(m);if(!x||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var B=x.frag,W=x.part,V=x.level,K=self.performance.now();B.stats.parsing.end=K,W&&(W.stats.parsing.end=K),this.updateLevelTiming(B,W,V,m.partial)},a.getCurrentContext=function(m){var x=this.levels,B=m.level,W=m.sn,V=m.part;if(!x||!x[B])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+B+". The current chunk will not be buffered."),null;var K=x[B],P=V>-1?Object(w.getPartWith)(K,W,V):null,N=P?P.fragment:Object(w.getFragmentWithSN)(K,W,this.fragCurrent);return N?{frag:N,part:P,level:K}:null},a.bufferFragmentData=function(m,x,B,W){if(!m||this.state!==E.PARSING)return;var V=m.data1,K=m.data2,P=V;if(V&&K&&(P=Object(A.appendUint8Array)(V,K)),!P||!P.length)return;var N={type:m.type,frag:x,part:B,chunkMeta:W,parent:x.type,data:P};this.hls.trigger(M.Events.BUFFER_APPENDING,N),m.dropped&&m.independent&&!B&&this.flushBufferGap(x)},a.flushBufferGap=function(m){var x=this.media;if(!x)return;if(!G.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,m.start);return}var B=x.currentTime,W=G.BufferHelper.bufferInfo(x,B,0),V=m.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,V*.25),P=Math.max(Math.min(m.start-K,W.end-K),B+K);m.start-P>K&&this.flushMainBuffer(P,m.start)},a.getFwdBufferInfo=function(m,x){var B=this.config,W=this.getLoadPosition();if(!Object(J.isFiniteNumber)(W))return null;var V=G.BufferHelper.bufferInfo(m,W,B.maxBufferHole);if(V.len===0&&V.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(W,x);if(K&&V.nextStart<K.end)return G.BufferHelper.bufferInfo(m,W,Math.max(V.nextStart,B.maxBufferHole))}return V},a.getMaxBufferLength=function(m){var x=this.config,B;return m?B=Math.max(8*x.maxBufferSize/m,x.maxBufferLength):B=x.maxBufferLength,Math.min(B,x.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var x=this.config,B=m||x.maxBufferLength;return x.maxMaxBufferLength>=B?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,x){var B,W,V=x.fragments,K=V.length;if(!K)return null;var P=this.config,N=V[0].start,$;if(x.live){var ne=P.initialLiveManifestSize;if(K<ne)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+ne+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(x,V),this.startPosition=$?this.hls.liveSyncPosition||$.start:m)}else m<=N&&($=V[0]);if(!$){var ue=P.lowLatencyMode?x.partEnd:x.fragmentEnd;$=this.getFragmentAtPosition(m,ue,x)}return(B=$)!==null&&B!==void 0&&B.initSegment&&!((W=$)!==null&&W!==void 0&&W.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(m,x,B){for(var W=-1,V=!1,K=!0,P=0,N=m.length;P<N;P++){var $=m[P];if(K=K&&!$.independent,W>-1&&B<$.start)break;var ne=$.loaded;!ne&&(V||$.independent||K)&&$.fragment===x&&(W=P),V=ne}return W},a.loadedEndOfParts=function(m,x){var B=m[m.length-1];return B&&x>B.start&&B.loaded},a.getInitialLiveFragment=function(m,x){var B=this.fragPrevious,W=null;if(B){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+B.programDateTime),W=Object(k.findFragmentByPDT)(x,B.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var V=B.sn+1;if(V>=m.startSN&&V<=m.endSN){var K=x[V-m.startSN];B.cc===K.cc&&(W=K,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(k.findFragWithCC)(x,B.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(W=this.getFragmentAtPosition(P,this.bitrateTest?m.fragmentEnd:m.edge,m))}return W},a.getFragmentAtPosition=function(m,x,B){var W=this.config,V=this.fragPrevious,K=B.fragments,P=B.endSN,N=B.fragmentHint,$=W.maxFragLookUpTolerance,ne=!!(W.lowLatencyMode&&B.partList&&N);ne&&N&&!this.bitrateTest&&(K=K.concat(N),P=N.sn);var ue;if(m<x){var me=m>x-$?0:$;ue=Object(k.findFragmentByPTS)(V,K,m,me)}else ue=K[K.length-1];if(ue){var ke=ue.sn-B.startSN,xe=V&&ue.level===V.level,Re=K[ke+1],Se=this.fragmentTracker.getState(ue);if(Se===R.FragmentState.BACKTRACKED){ue=null;for(var Te=ke;K[Te]&&this.fragmentTracker.getState(K[Te])===R.FragmentState.BACKTRACKED;)V?ue=K[Te--]:ue=K[--Te];ue||(ue=Re)}else V&&ue.sn===V.sn&&!ne&&(xe&&(ue.sn<P&&this.fragmentTracker.getState(Re)!==R.FragmentState.OK?(this.log("SN "+ue.sn+" just loaded, load next one: "+Re.sn),ue=Re):ue=null))}return ue},a.synchronizeToLiveEdge=function(m){var x=this.config,B=this.media;if(!B)return;var W=this.hls.liveSyncPosition,V=B.currentTime,K=m.fragments[0].start,P=m.edge,N=V>=K-x.maxFragLookUpTolerance&&V<=P;if(W!==null&&B.duration>W&&(V<W||!N)){var $=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*m.targetduration;(!N&&B.readyState<4||V<P-$)&&(this.loadedmetadata||(this.nextLoadPosition=W),B.readyState&&(this.warn("Playback: "+V.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+W.toFixed(3)),B.currentTime=W))}},a.alignPlaylists=function(m,x){var B=this.levels,W=this.levelLastLoaded,V=this.fragPrevious,K=W!==null?B[W]:null,P=m.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var N=m.fragments[0].start,$=!x,ne=m.alignedSliding&&Object(J.isFiniteNumber)(N);if($||!ne&&!N){Object(I.alignStream)(V,K,m);var ue=m.fragments[0].start;return this.log("Live playlist sliding: "+ue.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+m.startSN+" prev-sn: "+(V?V.sn:"na")+" fragments: "+P),ue}return N},a.waitForCdnTuneIn=function(m){var x=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*x)},a.setStartPosition=function(m,x){var B=this.startPosition;if(B<x&&(B=-1),B===-1||this.lastCurrentTime===-1){var W=m.startTimeOffset;Object(J.isFiniteNumber)(W)?(B=x+W,W<0&&(B+=m.totalduration),B=Math.min(Math.max(x,B),x+m.totalduration),this.log("Start time offset "+W+" found in playlist, adjust startPosition to "+B),this.startPosition=B):m.live?B=this.hls.liveSyncPosition||x:this.startPosition=B=0,this.lastCurrentTime=B}this.nextLoadPosition=B},a.getLoadPosition=function(){var m=this.media,x=0;return this.loadedmetadata&&m?x=m.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},a.handleFragLoadAborted=function(m,x){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(x?" part"+x.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=E.IDLE)},a.onFragmentOrKeyLoadError=function(m,x){if(x.fatal)return;var B=x.frag;if(!B||B.type!==m)return;var W=this.fragCurrent;console.assert(W&&B.sn===W.sn&&B.level===W.level&&B.urlId===W.urlId,"Frag load error must match current frag to retry");var V=this.config;if(this.fragLoadError+1<=V.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(B.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*V.fragLoadingRetryDelay,V.fragLoadingMaxRetryTimeout);this.warn("Fragment "+B.sn+" of "+m+" "+B.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(H.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},a.afterBufferFlushed=function(m,x,B){if(!m)return;var W=G.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(x,W,B),this.state===E.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[m].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(m,x,B,W){var V=this,K=B.details;console.assert(!!K,"level.details must be defined");var P=Object.keys(m.elementaryStreams).reduce(function(N,$){var ne=m.elementaryStreams[$];if(ne){var ue=ne.endPTS-ne.startPTS;if(ue<=0)return V.warn("Could not parse fragment "+m.sn+" "+$+" duration reliably ("+ue+") resetting transmuxer to fallback to playlist timing"),V.resetTransmuxer(),N||!1;var me=W?0:Object(w.updateFragPTSDTS)(K,m,ne.startPTS,ne.endPTS,ne.startDTS,ne.endDTS);return V.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:K,level:B,drift:me,type:$,frag:m,start:ne.startPTS,end:ne.endPTS}),!0}return N},!1);P?(this.state=E.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:m,part:x})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(u,[{key:"state",get:function(){return this._state},set:function(m){var x=this._state;x!==m&&(this._state=m,this.log(x+"->"+m))}}]),u}(U.default)},"./src/controller/buffer-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var J=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),R=O("./src/utils/logger.ts"),G=O("./src/errors.ts"),H=O("./src/utils/buffer-helper.ts"),M=O("./src/utils/mediasource-helper.ts"),_=O("./src/loader/fragment.ts"),b=O("./src/controller/buffer-operation-queue.ts"),A=Object(M.getMediaSource)(),I=/([ha]vc.)(?:\.[^.,]+)+/,k=function(){function w(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,h=o.media,T=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),h&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:h})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var C=w.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},C.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.onManifestParsed=function(o,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},C.onMediaAttaching=function(o,l){var h=this.media=l.media;if(h&&A){var T=this.mediaSource=new A;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(T),this._objectUrl=h.src}},C.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(R.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(T){R.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(h&&self.URL.revokeObjectURL(h),o.src===h?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},C.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var h=o.sourceBuffer[l];try{h&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(h),o.sourceBuffer[l]=void 0)}catch(T){R.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",T)}}),this._initSourceBuffer()},C.onBufferCodecs=function(o,l){var h=this,T=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(T){var g=h.tracks[v];if(g&&typeof g.buffer.changeType=="function"){var L=l[v],E=L.codec,p=L.levelCodec,c=L.container,u=(g.levelCodec||g.codec).replace(I,"$1"),a=(p||E).replace(I,"$1");if(u!==a){var y=c+";codecs="+(p||E);h.appendChangeType(v,y)}}}else h.pendingTracks[v]=l[v]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(o,l){var h=this,T=this.operationQueue,v={execute:function(){var L=h.sourceBuffer[o];L&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};T.append(v,o)},C.onBufferAppending=function(o,l){var h=this,T=this.hls,v=this.operationQueue,g=this.tracks,L=l.data,E=l.type,p=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[E],y=self.performance.now();a.start=y;var m=p.stats.buffering,x=c?c.stats.buffering:null;m.start===0&&(m.start=y),x&&x.start===0&&(x.start=y);var B=g.audio,W=E==="audio"&&u.id===1&&(B==null?void 0:B.container)==="audio/mpeg",V={execute:function(){if(a.executeStart=self.performance.now(),W){var P=h.sourceBuffer[E];if(P){var N=p.start-P.timestampOffset;Math.abs(N)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+N+") sn: "+p.sn+")"),P.timestampOffset=p.start)}}h.appendExecutor(L,E)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,m.first===0&&(m.first=P),x&&x.first===0&&(x.first=P);var N=h.sourceBuffer,$={};for(var ne in N)$[ne]=H.BufferHelper.getBuffered(N[ne]);h.appendError=0,h.hls.trigger(U.Events.BUFFER_APPENDED,{type:E,frag:p,part:c,chunkMeta:u,parent:p.type,timeRanges:$})},onError:function(P){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",P);var N={type:G.ErrorTypes.MEDIA_ERROR,parent:p.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=G.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,N.details=G.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>T.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),T.trigger(U.Events.ERROR,N)}};v.append(V,E)},C.onBufferFlushing=function(o,l){var h=this,T=this.operationQueue,v=function(L){return{execute:h.removeExecutor.bind(h,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(U.Events.BUFFER_FLUSHED,{type:L})},onError:function(p){R.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",p)}}};l.type?T.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(g){T.append(v(g),g)})},C.onFragParsed=function(o,l){var h=this,T=l.frag,v=l.part,g=[],L=v?v.elementaryStreams:T.elementaryStreams;L[_.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(L[_.ElementaryStreamTypes.AUDIO]&&g.push("audio"),L[_.ElementaryStreamTypes.VIDEO]&&g.push("video"));var E=function(){var c=self.performance.now();T.stats.buffering.end=c,v&&(v.stats.buffering.end=c);var u=v?v.stats:T.stats;h.hls.trigger(U.Events.FRAG_BUFFERED,{frag:T,part:v,stats:u,id:T.type})};g.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(E,g)},C.onFragChanged=function(o,l){this.flushBackBuffer()},C.onBufferEos=function(o,l){var h=this,T=this.getSourceBufferTypes().reduce(function(v,g){var L=h.sourceBuffer[g];return(!l.type||l.type===g)&&(L&&!L.ended&&(L.ended=!0,R.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),v&&!!(!L||L.ended)},!0);T&&this.blockBuffers(function(){var v=h.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},C.onLevelUpdated=function(o,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},C.flushBackBuffer=function(){var o=this.hls,l=this.details,h=this.media,T=this.sourceBuffer;if(!h||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var g=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(J.isFiniteNumber)(g)||g<0)return;var L=h.currentTime,E=l.levelTargetDuration,p=Math.max(g,E),c=Math.floor(L/E)*E-p;v.forEach(function(u){var a=T[u];if(a){var y=H.BufferHelper.getBuffered(a);y.length>0&&c>y.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,h=this.media,T=this.mediaSource,v=o.fragments[0].start+o.totalduration,g=h.duration,L=Object(J.isFiniteNumber)(T.duration)?T.duration:0;o.live&&l.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(v>L&&v>g||!Object(J.isFiniteNumber)(g))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),T.duration=v)},C.updateSeekableRange=function(o){var l=this.mediaSource,h=o.fragments,T=h.length;if(T&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,h[0].start),g=Math.max(v,v+o.totalduration);l.setLiveSeekableRange(v,g)}},C.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,T=Object.keys(h).length;if(T&&!o||T===2){this.createSourceBuffers(h),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(g){l.executeNext(g)})}},C.createSourceBuffers=function(o){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var v in o)if(!l[v]){var g=o[v];if(!g)throw Error("source buffer exists for track "+v+", however track does not");var L=g.levelCodec||g.codec,E=g.container+";codecs="+L;R.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var p=l[v]=h.addSourceBuffer(E),c=v;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[v]={buffer:p,codec:L,container:g.container,levelCodec:g.levelCodec,id:g.id},T++}catch(u){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:E})}}T&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(o){var l=this.operationQueue,h=l.current(o);h.onStart()},C._onSBUpdateEnd=function(o){var l=this.operationQueue,h=l.current(o);h.onComplete(),l.shiftAndExecuteNext(o)},C._onSBUpdateError=function(o,l){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(o);h&&h.onError(l)},C.removeExecutor=function(o,l,h){var T=this.media,v=this.mediaSource,g=this.operationQueue,L=this.sourceBuffer,E=L[o];if(!T||!v||!E){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(o);return}var p=Object(J.isFiniteNumber)(T.duration)?T.duration:Infinity,c=Object(J.isFiniteNumber)(v.duration)?v.duration:Infinity,u=Math.max(0,l),a=Math.min(h,p,c);a>u?(R.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!E.updating,o+" sourceBuffer must not be updating"),E.remove(u,a)):g.shiftAndExecuteNext(o)},C.appendExecutor=function(o,l){var h=this.operationQueue,T=this.sourceBuffer,v=T[l];if(!v){R.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(o)},C.blockBuffers=function(o,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,v=l.map(function(g){return T.appendBlocker(g)});Promise.all(v).then(function(){o(),l.forEach(function(g){var L=h.sourceBuffer[g];(!L||!L.updating)&&T.shiftAndExecuteNext(g)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(o,l,h){var T=this.sourceBuffer[o];if(!T)return;var v=h.bind(this,o);this.listeners[o].push({event:l,listener:v}),T.addEventListener(l,v)},C.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(h){l.removeEventListener(h.event,h.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return U});var J=O("./src/utils/logger.ts"),U=function(){function R(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var G=R.prototype;return G.append=function(M,_){var b=this.queues[_];b.push(M),b.length===1&&this.buffers[_]&&this.executeNext(_)},G.insertAbort=function(M,_){var b=this.queues[_];b.unshift(M),this.executeNext(_)},G.appendBlocker=function(M){var _,b=new Promise(function(I){_=I}),A={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,M),b},G.executeNext=function(M){var _=this.buffers,b=this.queues,A=_[M],I=b[M];if(I.length){var k=I[0];try{k.execute()}catch(w){J.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),k.onError(w),(!A||!A.updating)&&(I.shift(),this.executeNext(M))}}},G.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},G.current=function(M){return this.queues[M][0]},R}()},"./src/controller/cap-level-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts");function U(H,M){for(var _=0;_<M.length;_++){var b=M[_];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(H,b.key,b)}}function R(H,M,_){return M&&U(H.prototype,M),_&&U(H,_),H}var G=function(){function H(_){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=H.prototype;return M.setStreamController=function(b){this.streamController=b},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var b=this.hls;b.on(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var b=this.hls;b.off(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(b,A){H.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},M.onMediaAttaching=function(b,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},M.onManifestParsed=function(b,A){var I=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,I.config.capLevelToPlayerSize&&A.video&&this.startCapping()},M.onBufferCodecs=function(b,A){var I=this.hls;I.config.capLevelToPlayerSize&&A.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(b.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},M.getMaxLevel=function(b){var A=this,I=this.hls.levels;if(!I.length)return-1;var k=I.filter(function(w,C){return H.isLevelAllowed(C,A.restrictedLevels)&&C<=b});return this.clientRect=null,H.getMaxLevelByMediaSize(k,this.mediaWidth,this.mediaHeight)},M.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,A={width:0,height:0};if(b){var I=b.getBoundingClientRect();A.width=I.width,A.height=I.height,!A.width&&!A.height&&(A.width=I.right-I.left||b.width||0,A.height=I.bottom-I.top||b.height||0)}return this.clientRect=A,A},H.isLevelAllowed=function(b,A){return A===void 0&&(A=[]),A.indexOf(b)===-1},H.getMaxLevelByMediaSize=function(b,A,I){if(!b||!b.length)return-1;for(var k=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},w=b.length-1,C=0;C<b.length;C+=1){var d=b[C];if((d.width>=A||d.height>=I)&&k(d,b[C+1])){w=C;break}}return w},R(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 b=1;try{b=self.devicePixelRatio}catch(A){}return b}}]),H}();Z.default=G},"./src/controller/cmcd-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var J=O("./src/events.ts"),U=O("./src/types/cmcd.ts"),R=O("./src/utils/buffer-helper.ts"),G=O("./src/utils/logger.ts");function H(w,C){for(var d=0;d<C.length;d++){var o=C[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function M(w,C,d){return C&&H(w.prototype,C),d&&H(w,d),w}function _(w,C){var d=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(d)return(d=d.call(w)).next.bind(d);if(Array.isArray(w)||(d=b(w))||C&&w&&typeof w.length=="number"){d&&(w=d);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(w,C){if(!w)return;if(typeof w=="string")return A(w,C);var d=Object.prototype.toString.call(w).slice(8,-1);if(d==="Object"&&w.constructor&&(d=w.constructor.name),d==="Map"||d==="Set")return Array.from(w);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(w,C)}function A(w,C){(C==null||C>w.length)&&(C=w.length);for(var d=0,o=new Array(C);d<C;d++)o[d]=w[d];return o}function I(){return I=Object.assign||function(w){for(var C=1;C<arguments.length;C++){var d=arguments[C];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(w[o]=d[o])}return w},I.apply(this,arguments)}var k=function(){function w(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(T){try{o.apply(T,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){G.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(T){try{var v=T.frag,g=o.hls.levels[v.level],L=o.getObjectType(v),E={d:v.duration*1e3,ot:L};(L===U.CMCDObjectType.VIDEO||L===U.CMCDObjectType.AUDIO||L==U.CMCDObjectType.MUXED)&&(E.br=g.bitrate/1e3,E.tb=o.getTopBandwidth(L),E.bl=o.getBufferLength(L)),o.apply(T,E)}catch(p){G.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=d;var l=this.config=d.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||w.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var C=w.prototype;return C.registerListeners=function(){var o=this.hls;o.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(J.Events.BUFFER_CREATED,this.onBufferCreated,this)},C.unregisterListeners=function(){var o=this.hls;o.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(J.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(o,l){var h,T;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(T=l.tracks.video)===null||T===void 0?void 0:T.buffer},C.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},C.apply=function(o,l){l===void 0&&(l={}),I(l,this.createData());var h=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var T=w.toHeaders(l);if(!Object.keys(T).length)return;o.headers||(o.headers={}),I(o.headers,T)}else{var v=w.toQuery(l);if(!v)return;o.url=w.appendQueryToUri(o.url,v)}},C.getObjectType=function(o){var l=o.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},C.getTopBandwidth=function(o){for(var l=0,h=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=_(h),v;!(v=T()).done;){var g=v.value;g.bitrate>l&&(l=g.bitrate)}return l>0?l:NaN},C.getBufferLength=function(o){var l=this.hls.media,h=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var T=R.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return T.len*1e3},C.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,h=o||this.config.loader;return function(){function T(g){this.loader=void 0,this.loader=new h(g)}var v=T.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,E,p){l(L),this.loader.load(L,E,p)},M(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},C.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,h=o||this.config.loader;return function(){function T(g){this.loader=void 0,this.loader=new h(g)}var v=T.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,E,p){l(L),this.loader.load(L,E,p)},M(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},w.serialize=function(o){for(var l=[],h=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},T=function(W){return Math.round(W)},v=function(W){return T(W/100)*100},g=function(W){return encodeURIComponent(W)},L={br:T,d:T,bl:v,dl:v,mtp:v,nor:g,rtp:v,tb:T},E=Object.keys(o||{}).sort(),p=_(E),c;!(c=p()).done;){var u=c.value,a=o[u];if(!h(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var y=L[u];y&&(a=y(a));var m=typeof a,x=void 0;u==="ot"||u==="sf"||u==="st"?x=u+"="+a:m==="boolean"?x=u:m==="number"?x=u+"="+a:x=u+"="+JSON.stringify(a),l.push(x)}return l.join(",")},w.toHeaders=function(o){for(var l=Object.keys(o),h={},T=["Object","Request","Session","Status"],v=[{},{},{},{}],g={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,E=l;L<E.length;L++){var p=E[L],c=g[p]!=null?g[p]:1;v[c][p]=o[p]}for(var u=0;u<v.length;u++){var a=w.serialize(v[u]);a&&(h["CMCD-"+T[u]]=a)}return h},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,l){if(!l)return o;var h=o.includes("?")?"&":"?";return""+o+h+l},w}()},"./src/controller/eme-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),G=O("./src/utils/mediakeys-helper.ts");function H(k,w){for(var C=0;C<w.length;C++){var d=w[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(k,d.key,d)}}function M(k,w,C){return w&&H(k.prototype,w),C&&H(k,C),k}var _=3,b=function(w,C,d){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),C.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},A=function(w,C,d,o){switch(w){case G.KeySystems.WIDEVINE:return b(C,d,o);default:throw new Error("Unknown key-system: "+w)}},I=function(){function k(C){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=C,this._config=C.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var w=k.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(d){switch(d){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},w._attemptKeySystemAccess=function(d,o,l){var h=this,T=A(d,o,l,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(d,T);this.mediaKeysPromise=v.then(function(g){return h._onMediaKeySystemAccessObtained(d,g)}),v.catch(function(g){R.logger.error('Failed to obtain key-system "'+d+'" access:',g)})},w._onMediaKeySystemAccessObtained=function(d,o){var l=this;R.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return h.mediaKeys=v,R.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),v});return T.catch(function(v){R.logger.error("Failed to create media-keys:",v)}),T},w._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},w._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){R.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},w.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},w._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(d,o){var l=this,h=this._mediaKeysList[0];if(!h){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var T=h.mediaKeysSession;if(!T){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,T.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(v){R.logger.error("Error generating key-session request:",v),l.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(d,o,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,o,l);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,h,d),T=void 0}catch(v){R.logger.error(v)}try{h.readyState||h.open("POST",d,!0),T&&T.call(this.hls,h,d)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return h},w._onLicenseRequestReadyStageChange=function(d,o,l,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var T=d.response,v=this._licenseResponseCallback;if(v)try{T=v.call(this.hls,d,o)}catch(L){R.logger.error(L)}h(T)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=_-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(l,h)}break}},w._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},w._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),T=this._createLicenseXhr(h,d,o);R.logger.log("Sending license request to URL: "+h);var v=this._generateLicenseRequestChallenge(l,d);T.send(v)}catch(g){R.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),h=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,h)},M(k,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),k}();Z.default=I},"./src/controller/fps-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/utils/logger.ts"),R=function(){function G(M){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=M,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(_){this.streamController=_},H.registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(_,b){var A=this.hls.config;if(A.capLevelOnFPSDrop){var I=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=I,I&&typeof I.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(_,b,A){var I=performance.now();if(b){if(this.lastTime){var k=I-this.lastTime,w=A-this.lastDroppedFrames,C=b-this.lastDecodedFrames,d=1e3*w/k,o=this.hls;if(o.trigger(J.Events.FPS_DROP,{currentDropped:w,currentDecoded:C,totalDroppedFrames:A}),d>0&&w>o.config.fpsDroppedMonitoringThreshold*C){var l=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(J.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=I,this.lastDroppedFrames=A,this.lastDecodedFrames=b}},H.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var b=_.getVideoPlaybackQuality();this.checkFPS(_,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},G}();Z.default=R},"./src/controller/fragment-finders.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"findFragmentByPDT",function(){return R}),O.d(Z,"findFragmentByPTS",function(){return G}),O.d(Z,"fragmentWithinToleranceTest",function(){return H}),O.d(Z,"pdtWithinToleranceTest",function(){return M}),O.d(Z,"findFragWithCC",function(){return _});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/binary-search.ts");function R(b,A,I){if(A===null||!Array.isArray(b)||!b.length||!Object(J.isFiniteNumber)(A))return null;var k=b[0].programDateTime;if(A<(k||0))return null;var w=b[b.length-1].endProgramDateTime;if(A>=(w||0))return null;I=I||0;for(var C=0;C<b.length;++C){var d=b[C];if(M(A,I,d))return d}return null}function G(b,A,I,k){I===void 0&&(I=0),k===void 0&&(k=0);var w=null;if(b?w=A[b.sn-A[0].sn+1]||null:I===0&&A[0].start===0&&(w=A[0]),w&&H(I,k,w)===0)return w;var C=U.default.search(A,H.bind(null,I,k));return C||w}function H(b,A,I){b===void 0&&(b=0),A===void 0&&(A=0);var k=Math.min(A,I.duration+(I.deltaPTS?I.deltaPTS:0));return I.start+I.duration-k<=b?1:I.start-k>b&&I.start?-1:0}function M(b,A,I){var k=Math.min(A,I.duration+(I.deltaPTS?I.deltaPTS:0))*1e3,w=I.endProgramDateTime||0;return w-k>b}function _(b,A){return U.default.search(b,function(I){return I.cc<A?1:I.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"FragmentState",function(){return R}),O.d(Z,"FragmentTracker",function(){return G});var J=O("./src/events.ts"),U=O("./src/types/loader.ts"),R;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(R||(R={}));var G=function(){function _(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var b=_.prototype;return b._registerListeners=function(){var I=this.hls;I.on(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),I.on(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),I.on(J.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var I=this.hls;I.off(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),I.off(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),I.off(J.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(I,k){if(k===U.PlaylistLevelType.MAIN){var w=this.activeFragment,C=this.activeParts;if(!w)return null;if(C)for(var d=C.length;d--;){var o=C[d],l=o?o.end:w.appendedPTS;if(o.start<=I&&l!==void 0&&I<=l)return d>9&&(this.activeParts=C.slice(d-9)),o}else if(w.start<=I&&w.appendedPTS!==void 0&&I<=w.appendedPTS)return w}return this.getBufferedFrag(I,k)},b.getBufferedFrag=function(I,k){for(var w=this.fragments,C=Object.keys(w),d=C.length;d--;){var o=w[C[d]];if((o==null?void 0:o.body.type)===k&&o.buffered){var l=o.body;if(l.start<=I&&I<=l.end)return l}}return null},b.detectEvictedFragments=function(I,k,w){var C=this;Object.keys(this.fragments).forEach(function(d){var o=C.fragments[d];if(!o)return;if(!o.buffered){o.body.type===w&&C.removeFragment(o.body);return}var l=o.range[I];if(!l)return;l.time.some(function(h){var T=!C.isTimeBuffered(h.startPTS,h.endPTS,k);return T&&C.removeFragment(o.body),T})})},b.detectPartialFragments=function(I){var k=this,w=this.timeRanges,C=I.frag,d=I.part;if(!w||C.sn==="initSegment")return;var o=M(C),l=this.fragments[o];if(!l)return;Object.keys(w).forEach(function(h){var T=C.elementaryStreams[h];if(!T)return;var v=w[h],g=d!==null||T.partial===!0;l.range[h]=k.getBufferedTimes(C,d,g,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},b.fragBuffered=function(I){var k=M(I),w=this.fragments[k];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},b.getBufferedTimes=function(I,k,w,C){for(var d={time:[],partial:w},o=k?k.start:I.start,l=k?k.end:I.end,h=I.minEndPTS||l,T=I.maxStartPTS||o,v=0;v<C.length;v++){var g=C.start(v)-this.bufferPadding,L=C.end(v)+this.bufferPadding;if(T>=g&&h<=L){d.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(l,C.end(v))});break}else if(o<L&&l>g)d.partial=!0,d.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(l,C.end(v))});else if(l<=g)break}return d},b.getPartialFragment=function(I){var k=null,w,C,d,o=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(T){var v=h[T];if(!v)return;H(v)&&(C=v.body.start-l,d=v.body.end+l,I>=C&&I<=d&&(w=Math.min(I-C,d-I),o<=w&&(k=v.body,o=w)))}),k},b.getState=function(I){var k=M(I),w=this.fragments[k];return w?w.buffered?H(w)?R.PARTIAL:R.OK:w.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},b.backtrack=function(I,k){var w=M(I),C=this.fragments[w];if(!C||C.backtrack)return null;var d=C.backtrack=k||C.loaded;return C.loaded=null,d},b.getBacktrackData=function(I){var k=M(I),w=this.fragments[k];if(w){var C,d=w.backtrack;if(d!=null&&(C=d.payload)!==null&&C!==void 0&&C.byteLength)return d;this.removeFragment(I)}return null},b.isTimeBuffered=function(I,k,w){for(var C,d,o=0;o<w.length;o++){if(C=w.start(o)-this.bufferPadding,d=w.end(o)+this.bufferPadding,I>=C&&k<=d)return!0;if(k<=C)return!1}return!1},b.onFragLoaded=function(I,k){var w=k.frag,C=k.part;if(w.sn==="initSegment"||w.bitrateTest||C)return;var d=M(w);this.fragments[d]={body:w,loaded:k,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(I,k){var w=this,C=k.frag,d=k.part,o=k.timeRanges;if(C.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=C,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(h){var T=o[h];if(w.detectEvictedFragments(h,T),!d)for(var v=0;v<T.length;v++)C.appendedPTS=Math.max(T.end(v),C.appendedPTS||0)})},b.onFragBuffered=function(I,k){this.detectPartialFragments(k)},b.hasFragment=function(I){var k=M(I);return!!this.fragments[k]},b.removeFragmentsInRange=function(I,k,w){var C=this;Object.keys(this.fragments).forEach(function(d){var o=C.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===w&&l.start<k&&l.end>I&&C.removeFragment(l)}})},b.removeFragment=function(I){var k=M(I);I.stats.loaded=0,I.clearElementaryStreamInfo(),delete this.fragments[k]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function H(_){var b,A;return _.buffered&&(((b=_.range.video)===null||b===void 0?void 0:b.partial)||((A=_.range.audio)===null||A===void 0?void 0:A.partial))}function M(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),O.d(Z,"MAX_START_GAP_JUMP",function(){return M}),O.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),O.d(Z,"SKIP_BUFFER_RANGE_START",function(){return b}),O.d(Z,"default",function(){return A});var J=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),R=O("./src/events.ts"),G=O("./src/utils/logger.ts"),H=250,M=2,_=.1,b=.05,A=function(){function I(w,C,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=C,this.fragmentTracker=d,this.hls=o}var k=I.prototype;return k.destroy=function(){this.hls=this.fragmentTracker=this.media=null},k.poll=function(C){var d=this.config,o=this.media,l=this.stalled,h=o.currentTime,T=o.seeking,v=this.seeking&&!T,g=!this.seeking&&T;if(this.seeking=T,h!==C){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!J.BufferHelper.getBuffered(o).length)return;var E=J.BufferHelper.bufferInfo(o,h,0),p=E.len>0,c=E.nextStart||0;if(!p&&!c)return;if(T){var u=E.len>M,a=!c||c-h>M&&!this.fragmentTracker.getPartialFragment(h);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(c,E.start||0)-h,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=x==null||((y=x.details)===null||y===void 0)?void 0:y.live,W=B?x.details.targetduration*2:M;if(m>0&&m<=W){this._trySkipBufferHole(null);return}}var V=self.performance.now();if(l===null){this.stalled=V;return}var K=V-l;!T&&K>=H&&this._reportStall(E.len);var P=J.BufferHelper.bufferInfo(o,h,d.maxBufferHole);this._tryFixBufferStall(P,K)},k._tryFixBufferStall=function(C,d){var o=this.config,l=this.fragmentTracker,h=this.media,T=h.currentTime,v=l.getPartialFragment(T);if(v){var g=this._trySkipBufferHole(v);if(g)return}C.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},k._reportStall=function(C){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+C+")"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},k._trySkipBufferHole=function(C){for(var d=this.config,o=this.hls,l=this.media,h=l.currentTime,T=0,v=J.BufferHelper.getBuffered(l),g=0;g<v.length;g++){var L=v.start(g);if(h+d.maxBufferHole>=T&&h<L){var E=Math.max(L+b,l.currentTime+_);return G.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+E),this.moved=!0,this.stalled=null,l.currentTime=E,C&&o.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+E,frag:C}),E}T=v.end(g)}return 0},k._tryNudgeBuffer=function(){var C=this.config,d=this.hls,o=this.media,l=o.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<C.nudgeMaxRetry){var T=l+h*C.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+T),o.currentTime=T,d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+C.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},I}()},"./src/controller/id3-track-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),R=O("./src/demux/id3.ts"),G=.25,H=function(){function M(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var _=M.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var A=this.hls;A.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var A=this.hls;A.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(A,I){this.media=I.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(A){if(!this.media)return;for(var I=0;I<A.length;I++){var k=A[I];if(k.kind==="metadata"&&k.label==="id3")return Object(U.sendAddTrackEvent)(k,this.media),k}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(A,I){if(!this.media)return;var k=I.frag,w=I.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<w.length;d++){var o=R.getID3Frames(w[d].data);if(o){var l=w[d].pts,h=d<w.length-1?w[d+1].pts:k.end,T=h-l;T<=0&&(h=l+G);for(var v=0;v<o.length;v++){var g=o[v];if(!R.isTimeStampFrame(g)){var L=new C(l,h,"");L.value=g,this.id3Track.addCue(L)}}}}},_.onBufferFlushing=function(A,I){var k=I.startOffset,w=I.endOffset,C=I.type;if(!C||C==="audio"){var d=this.id3Track;d&&Object(U.removeCuesInRange)(d,k,w)}},M}();Z.default=H},"./src/controller/latency-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return M});var J=O("./src/errors.ts"),U=O("./src/events.ts"),R=O("./src/utils/logger.ts");function G(_,b){for(var A=0;A<b.length;A++){var I=b[A];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(_,I.key,I)}}function H(_,b,A){return b&&G(_.prototype,b),A&&G(_,A),_}var M=function(){function _(A){var I=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return I.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var b=_.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},b.onMediaAttached=function(I,k){this.media=k.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(I,k){var w=k.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(I,k){if(k.details!==J.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var I=this.media,k=this.levelDetails;if(!I||!k)return;this.currentTime=I.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var C=this.config,d=C.lowLatencyMode,o=C.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var h=w-l,T=Math.min(this.maxLatency,l+k.targetduration),v=h<T;if(k.live&&v&&h>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;I.playbackRate=Math.min(g,Math.max(1,L))}else I.playbackRate!==1&&I.playbackRate!==0&&(I.playbackRate=1)},b.estimateLiveEdge=function(){var I=this.levelDetails;return I===null?null:I.edge+I.age},b.computeLatency=function(){var I=this.estimateLiveEdge();return I===null?null:I-this.currentTime},H(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var I=this.config,k=this.levelDetails;return I.liveMaxLatencyDuration!==void 0?I.liveMaxLatencyDuration:k?I.liveMaxLatencyDurationCount*k.targetduration:0}},{key:"targetLatency",get:function(){var I=this.levelDetails;if(I===null)return null;var k=I.holdBack,w=I.partHoldBack,C=I.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,h=d.lowLatencyMode,T=this.hls.userConfig,v=h&&w||k;(T.liveSyncDuration||T.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*C);var g=C,L=1;return v+Math.min(this.stallCount*L,g)}},{key:"liveSyncPosition",get:function(){var I=this.estimateLiveEdge(),k=this.targetLatency,w=this.levelDetails;if(I===null||k===null||w===null)return null;var C=w.edge,d=I-k-this.edgeStalled,o=C-w.totalduration,l=C-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var I=this.levelDetails;return I===null?1:I.drift}},{key:"edgeStalled",get:function(){var I=this.levelDetails;if(I===null)return 0;var k=(this.config.lowLatencyMode&&I.partTarget||I.targetduration)*3;return Math.max(I.age-k,0)}},{key:"forwardBufferLength",get:function(){var I=this.media,k=this.levelDetails;if(!I||!k)return 0;var w=I.buffered.length;return w?I.buffered.end(w-1):k.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return d});var J=O("./src/types/level.ts"),U=O("./src/events.ts"),R=O("./src/errors.ts"),G=O("./src/utils/codecs.ts"),H=O("./src/controller/level-helper.ts"),M=O("./src/controller/base-playlist-controller.ts"),_=O("./src/types/loader.ts");function b(){return b=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(o[T]=h[T])}return o},b.apply(this,arguments)}function A(o,l){for(var h=0;h<l.length;h++){var T=l[h];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function I(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,w(o,l)}function w(o,l){return w=Object.setPrototypeOf||function(T,v){return T.__proto__=v,T},w(o,l)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){k(l,o);function l(T){var v;return v=o.call(this,T,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var h=l.prototype;return h._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},h.startLoad=function(){var v=this._levels;v.forEach(function(g){g.loadError=0}),o.prototype.startLoad.call(this)},h.onManifestLoaded=function(v,g){var L=[],E=[],p=[],c,u={},a,y=!1,m=!1,x=!1;if(g.levels.forEach(function(K){var P=K.attrs;y=y||!!(K.width&&K.height),m=m||!!K.videoCodec,x=x||!!K.audioCodec,C&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var N=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;a=u[N],a?a.url.push(K.url):(a=new J.Level(K),u[N]=a,L.push(a)),P&&(P.AUDIO&&Object(H.addGroupId)(a,"audio",P.AUDIO),P.SUBTITLES&&Object(H.addGroupId)(a,"text",P.SUBTITLES))}),(y||m)&&x&&(L=L.filter(function(K){var P=K.videoCodec,N=K.width,$=K.height;return!!P||!!(N&&$)})),L=L.filter(function(K){var P=K.audioCodec,N=K.videoCodec;return(!P||Object(G.isCodecSupportedInMp4)(P,"audio"))&&(!N||Object(G.isCodecSupportedInMp4)(N,"video"))}),g.audioTracks&&(E=g.audioTracks.filter(function(K){return!K.audioCodec||Object(G.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(E)),g.subtitles&&(p=g.subtitles,Object(H.assignTrackIdsByGroup)(p)),L.length>0){c=L[0].bitrate,L.sort(function(K,P){return K.bitrate-P.bitrate}),this._levels=L;for(var B=0;B<L.length;B++)if(L[B].bitrate===c){this._firstLevel=B,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var W=x&&!m,V={levels:L,audioTracks:E,subtitleTracks:p,firstLevel:this._firstLevel,stats:g.stats,audio:x,video:m,altAudio:!W&&E.some(function(K){return!!K.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,V),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(v,g){if(o.prototype.onError.call(this,v,g),g.fatal)return;var L=g.context,E=this._levels[this.currentLevelIndex];if(L&&(L.type===_.PlaylistContextType.AUDIO_TRACK&&E.audioGroupIds&&L.groupId===E.audioGroupIds[E.urlId]||L.type===_.PlaylistContextType.SUBTITLE_TRACK&&E.textGroupIds&&L.groupId===E.textGroupIds[E.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,c=!0,u;switch(g.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var a=this._levels[g.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=g.frag.level)):u=g.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),u=L.level),p=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:u=g.level,p=!0;break}u!==void 0&&this.recoverLevel(g,u,p,c)},h.recoverLevel=function(v,g,L,E){var p=v.details,c=this._levels[g];if(c.loadError++,L){var u=this.retryLoadingOrFail(v);if(u)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var a=c.url.length;if(a>1&&c.loadError<a)v.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var y=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(p+": switch to "+y),v.levelRetry=!0,this.hls.nextAutoLevel=y)}}},h.redundantFailover=function(v){var g=this._levels[v],L=g.url.length;if(L>1){var E=(g.urlId+1)%L;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(p){p.urlId=E}),this.level=v}},h.onFragLoaded=function(v,g){var L=g.frag;if(L!==void 0&&L.type===_.PlaylistLevelType.MAIN){var E=this._levels[L.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},h.onLevelLoaded=function(v,g){var L,E=g.level,p=g.details,c=this._levels[E];if(!c){var u;this.warn("Invalid level index "+E),(u=g.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(p.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(E,g,c.details)):(L=g.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(p.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(v,g){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var E=-1,p=this.hls.audioTracks[g.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===p){E=c;break}E!==L.urlId&&(L.urlId=E,this.startLoad())}},h.loadPlaylist=function(v){var g=this.currentLevelIndex,L=this._levels[g];if(this.canLoad&&L&&L.url.length>0){var E=L.urlId,p=L.url[E];if(v)try{p=v.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+g+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+E+" "+p),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:p,level:g,id:E,deliveryDirectives:v||null})}},h.removeLevel=function(v,g){var L=function(c,u){return u!==g},E=this._levels.filter(function(p,c){return c!==v?!0:p.url.length>1&&g!==void 0?(p.url=p.url.filter(L),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(L)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(L)),p.urlId=0,!0):!1}).map(function(p,c){var u=p.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),p});this._levels=E,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:E})},I(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var g,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===v&&(g=L[v])!==null&&g!==void 0&&g.details)return;if(v<0||v>=L.length){var E=v<0;if(this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:E,reason:"invalid level idx"}),E)return;v=Math.min(v,L.length-1)}this.clearTimer();var p=this.currentLevelIndex,c=L[p],u=L[v];this.log("switching to level "+v+" from "+p),this.currentLevelIndex=v;var a=b({},u,{level:v,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var y=u.details;if(!y||y.live){var m=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(M.default)},"./src/controller/level-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"addGroupId",function(){return R}),O.d(Z,"assignTrackIdsByGroup",function(){return G}),O.d(Z,"updatePTS",function(){return H}),O.d(Z,"updateFragPTSDTS",function(){return _}),O.d(Z,"mergeDetails",function(){return b}),O.d(Z,"mapPartIntersection",function(){return A}),O.d(Z,"mapFragmentIntersection",function(){return I}),O.d(Z,"adjustSliding",function(){return k}),O.d(Z,"addSliding",function(){return w}),O.d(Z,"computeReloadInterval",function(){return C}),O.d(Z,"getFragmentWithSN",function(){return d}),O.d(Z,"getPartWith",function(){return o});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts");function R(l,h,T){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(T);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(T);break}}function G(l){var h={};l.forEach(function(T){var v=T.groupId||"";T.id=h[v]=h[v]||0,h[v]++})}function H(l,h,T){var v=l[h],g=l[T];M(v,g)}function M(l,h){var T=h.startPTS;if(Object(J.isFiniteNumber)(T)){var v=0,g;h.sn>l.sn?(v=T-l.start,g=l):(v=l.start-T,g=h),g.duration!==v&&(g.duration=v)}else if(h.sn>l.sn){var L=l.cc===h.cc;L&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function _(l,h,T,v,g,L){var E=v-T;E<=0&&(U.logger.warn("Fragment should have a positive duration",h),v=T+h.duration,L=g+h.duration);var p=T,c=v,u=h.startPTS,a=h.endPTS;if(Object(J.isFiniteNumber)(u)){var y=Math.abs(u-T);Object(J.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(y,h.deltaPTS):h.deltaPTS=y,p=Math.max(T,u),T=Math.min(T,u),g=Math.min(g,h.startDTS),c=Math.min(v,a),v=Math.max(v,a),L=Math.max(L,h.endDTS)}h.duration=v-T;var m=T-h.start;h.appendedPTS=v,h.start=h.startPTS=T,h.maxStartPTS=p,h.startDTS=g,h.endPTS=v,h.minEndPTS=c,h.endDTS=L;var x=h.sn;if(!l||x<l.startSN||x>l.endSN)return 0;var B,W=x-l.startSN,V=l.fragments;for(V[W]=h,B=W;B>0;B--)M(V[B],V[B-1]);for(B=W;B<V.length-1;B++)M(V[B],V[B+1]);return l.fragmentHint&&M(V[V.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function b(l,h){for(var T=null,v=l.fragments,g=v.length-1;g>=0;g--){var L=v[g].initSegment;if(L){T=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var E=0,p;if(I(l,h,function(B,W){B.relurl&&(E=B.cc-W.cc),Object(J.isFiniteNumber)(B.startPTS)&&Object(J.isFiniteNumber)(B.endPTS)&&(W.start=W.startPTS=B.startPTS,W.startDTS=B.startDTS,W.appendedPTS=B.appendedPTS,W.maxStartPTS=B.maxStartPTS,W.endPTS=B.endPTS,W.endDTS=B.endDTS,W.minEndPTS=B.minEndPTS,W.duration=B.endPTS-B.startPTS,W.duration&&(p=W),h.PTSKnown=h.alignedSliding=!0),W.elementaryStreams=B.elementaryStreams,W.loader=B.loader,W.stats=B.stats,W.urlId=B.urlId,B.initSegment&&(W.initSegment=B.initSegment,T=B.initSegment)}),T){var c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;c.forEach(function(B){var W;(!B.initSegment||B.initSegment.relurl===((W=T)===null||W===void 0?void 0:W.relurl))&&(B.initSegment=T)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(B){return!B}),h.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=h.skippedSegments;u--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var a=h.fragments;if(E){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<a.length;y++)a[y].cc+=E}h.skippedSegments&&(h.startCC=h.fragments[0].cc),A(l.partList,h.partList,function(B,W){W.elementaryStreams=B.elementaryStreams,W.stats=B.stats}),p?_(h,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):k(l,h),a.length&&(h.totalduration=h.edge-a[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var x=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=x),h.driftEndTime=m,h.driftEnd=x}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function A(l,h,T){if(l&&h)for(var v=0,g=0,L=l.length;g<=L;g++){var E=l[g],p=h[g+v];E&&p&&E.index===p.index&&E.fragment.sn===p.fragment.sn?T(E,p):v--}}function I(l,h,T){for(var v=h.skippedSegments,g=Math.max(l.startSN,h.startSN)-h.startSN,L=(l.fragmentHint?1:0)+(v?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,E=h.startSN-l.startSN,p=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=g;u<=L;u++){var a=c[E+u],y=p[u];v&&!y&&u<v&&(y=h.fragments[u]=a),a&&y&&T(a,y)}}function k(l,h){var T=h.startSN+h.skippedSegments-l.startSN,v=l.fragments;if(T<0||T>=v.length)return;w(h,v[T].start)}function w(l,h){if(h){for(var T=l.fragments,v=l.skippedSegments;v<T.length;v++)T[v].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function C(l,h){var T=1e3*l.levelTargetDuration,v=T/2,g=l.age,L=g>0&&g<T*3,E=h.loading.end-h.loading.start,p,c=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;p=Math.max(Math.min(v,E*2),u),l.availabilityDelay=(l.availabilityDelay||0)+p}else p=v;else L?(c=Math.min(c||T/2,g),l.availabilityDelay=c,p=c+T-g):p=T-E;return Math.round(p)}function d(l,h,T){if(!l||!l.details)return null;var v=l.details,g=v.fragments[h-v.startSN];return g||(g=v.fragmentHint,g&&g.sn===h?g:h<v.startSN&&T&&T.sn===h?T:null)}function o(l,h,T){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var g=v.length;g--;){var L=v[g];if(L.index===T&&L.fragment.sn===h)return L}return null}},"./src/controller/stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return v});var J=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),R=O("./src/is-supported.ts"),G=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),M=O("./src/controller/fragment-tracker.ts"),_=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),A=O("./src/demux/transmuxer-interface.ts"),I=O("./src/types/transmuxer.ts"),k=O("./src/controller/gap-controller.ts"),w=O("./src/errors.ts"),C=O("./src/utils/logger.ts");function d(g,L){for(var E=0;E<L.length;E++){var p=L[E];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function o(g,L,E){return L&&d(g.prototype,L),E&&d(g,E),g}function l(g,L){g.prototype=Object.create(L.prototype),g.prototype.constructor=g,h(g,L)}function h(g,L){return h=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},h(g,L)}var T=100,v=function(g){l(L,g);function L(p,c){var u;return u=g.call(this,p,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var E=L.prototype;return E._registerListeners=function(){var c=this.hls;c.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(G.Events.ERROR,this.onError,this),c.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var c=this.hls;c.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(G.Events.ERROR,this.onError,this),c.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},E.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=a.startLevel;y===-1&&(a.config.testBandwidth?(y=0,this.bitrateTest=!0):y=a.nextAutoLevel),this.level=a.nextLoadLevel=y,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,y=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var m,x=self.performance.now(),B=this.retryDate;(!B||x>=B||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var c,u,a=this.hls,y=this.levelLastLoaded,m=this.levels,x=this.media,B=a.config,W=a.nextLoadLevel;if(y===null||!x&&(this.startFragRequested||!B.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[W])return;var V=m[W];this.level=a.nextLoadLevel=W;var K=V.details;if(!K||this.state===U.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==W){this.state=U.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,_.PlaylistLevelType.MAIN);if(P===null)return;var N=P.len,$=this.getMaxBufferLength(V.maxBitrate);if(N>=$)return;if(this._streamEnded(P,K)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ne),this.state=U.State.ENDED;return}var ue=P.end,me=this.getNextFragment(ue,K);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var ke=me.sn-K.startSN;ke>1&&(me=K.fragments[ke-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===M.FragmentState.OK&&this.nextLoadPosition>ue){var xe=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,xe,_.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,K)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((c=me.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=me.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(me,K):this.loadFragment(me,K,ue)},E.loadFragment=function(c,u,a){var y,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===M.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(c);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,g.prototype.loadFragment.call(this,c,u,a)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,_.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},E.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,_.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,y=this.getAppendedFrag(u.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!u.paused&&c){var m=this.hls.nextLoadLevel,x=c[m],B=this.fragLastKbps;B&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*B)+1:a=0}else a=0;var W=this.getBufferedFrag(u.currentTime+a);if(W){var V=this.followingBufferedFrag(W);if(V){this.abortCurrentFrag();var K=V.maxStartPTS?V.maxStartPTS:V.start,P=V.duration,N=Math.max(W.end,K+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(c,u){g.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},E.onMediaAttached=function(c,u){g.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new k.default(this.config,a,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),g.prototype.onMediaDetaching.call(this)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(J.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(c,u){var a=!1,y=!1,m;u.levels.forEach(function(x){m=x.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=a&&y&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},E.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var y=a[u.level];(!y.details||y.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(y.details))&&(this.state=U.State.WAITING_LEVEL)},E.onLevelLoaded=function(c,u){var a,y=this.levels,m=u.level,x=u.details,B=x.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+B);var W=this.fragCurrent;W&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==u.level&&W.loader&&(this.state=U.State.IDLE,W.loader.abort()));var V=y[m],K=0;if(x.live||(a=V.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;K=this.alignPlaylists(x,V.details)}if(V.details=x,this.levelLastLoaded=m,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:x,level:m}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=U.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,K),this.tick()},E._handleFragmentLoadProgress=function(c){var u,a=c.frag,y=c.part,m=c.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],W=B.details;if(!W){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var V=B.videoCodec,K=W.PTSKnown||!W.live,P=(u=a.initSegment)===null||u===void 0?void 0:u.data,N=this._getAudioCodec(B),$=this.transmuxer=this.transmuxer||new A.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=y?y.index:-1,ue=ne!==-1,me=new I.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,ne,ue),ke=this.initPTS[a.cc];$.push(m,P,N,V,a,y,W.totalduration,K,me,ke)},E.onAudioTrackSwitching=function(c,u){var a=this.altAudio,y=!!u.url,m=u.id;if(!y){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(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),B.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:m})}},E.onAudioTrackSwitched=function(c,u){var a=u.id,y=!!this.hls.audioTracks[a].url;if(y){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=y,this.tick()},E.onBufferCreated=function(c,u){var a=u.tracks,y,m,x=!1;for(var B in a){var W=a[B];if(W.id==="main"){if(m=B,y=W,B==="video"){var V=a[B];V&&(this.videoBuffer=V.buffer)}}else x=!0}x&&y?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(c,u){var a=u.frag,y=u.part;if(a&&a.type!==_.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(y?" p: "+y.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var m=y?y.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,y)},E.onError=function(c,u){switch(u.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,u);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=U.State.ERROR):!u.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,y=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);y&&y.len>.5&&(a=!this.reduceMaxBufferLength(y.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},E.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=H.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(c,u){var a=u.type;if(a!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(a===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,a,_.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(c,u){this.levels=u.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){C.logger.log("could not seek to "+a+", already seeking at "+u);return}var y=H.BufferHelper.getBuffered(c),m=y.length?y.start(0):0,x=m-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 "+u),c.currentTime=a}},E._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},E._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var y=u.hls;if(!a||y.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=U.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(G.Events.FRAG_LOADED,a)})},E._handleTransmuxComplete=function(c){var u,a="main",y=this.hls,m=c.remuxResult,x=c.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 W=B.frag,V=B.part,K=B.level,P=m.video,N=m.text,$=m.id3,ne=m.initSegment,ue=this.altAudio?void 0:m.audio;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,ne){ne.tracks&&(this._bufferInitSegment(K,ne.tracks,W,x),y.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:a,tracks:ne.tracks}));var me=ne.initPTS,ke=ne.timescale;Object(J.isFiniteNumber)(me)&&(this.initPTS[W.cc]=me,y.trigger(G.Events.INIT_PTS_FOUND,{frag:W,id:a,initPTS:me,timescale:ke}))}if(P&&m.independent!==!1){if(K.details){var xe=P.startPTS,Re=P.endPTS,Se=P.startDTS,Te=P.endDTS;if(V)V.elementaryStreams[P.type]={startPTS:xe,endPTS:Re,startDTS:Se,endDTS:Te};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var ye=this.getLoadPosition()+this.config.maxBufferHole;if(ye<xe){this.backtrack(W);return}W.setElementaryStreamInfo(P.type,W.start,Re,W.start,Te,!0)}W.setElementaryStreamInfo(P.type,xe,Re,Se,Te),this.bufferFragmentData(P,W,V,x)}}else if(m.independent===!1){this.backtrack(W);return}if(ue){var z=ue.startPTS,s=ue.endPTS,f=ue.startDTS,D=ue.endDTS;V&&(V.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:z,endPTS:s,startDTS:f,endDTS:D}),W.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,z,s,f,D),this.bufferFragmentData(ue,W,V,x)}if($!=null&&(u=$.samples)!==null&&u!==void 0&&u.length){var X={frag:W,id:a,samples:$.samples};y.trigger(G.Events.FRAG_PARSING_METADATA,X)}if(N){var F={frag:W,id:a,samples:N.samples};y.trigger(G.Events.FRAG_PARSING_USERDATA,F)}},E._bufferInitSegment=function(c,u,a,y){var m=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var x=u.audio,B=u.video,W=u.audiovideo;if(x){var V=c.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(V&&(V.indexOf("mp4a.40.5")!==-1?V="mp4a.40.2":V="mp4a.40.5"),x.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(V="mp4a.40.5")),K.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(V="mp4a.40.2",this.log("Android: force audio codec to "+V)),c.audioCodec&&c.audioCodec!==V&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+V+'"'),x.levelCodec=V,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(V||"")+"/"+(c.audioCodec||"")+"/"+x.codec+"]")}B&&(B.levelCodec=c.videoCodec,B.id="main",this.log("Init video buffer, container:"+B.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+B.codec+"]")),W&&this.log("Init audiovideo buffer, container:"+W.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+W.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(P){var N=u[P],$=N.initSegment;$!=null&&$.byteLength&&m.hls.trigger(G.Events.BUFFER_APPENDING,{type:P,data:$,frag:a,part:null,chunkMeta:y,parent:a.type})}),this.tick()},E.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},E.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(H.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):H.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var y=this.fragPlaying,m=u.level;(!y||u.sn!==y.sn||y.level!==m||u.urlId!==y.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:u}),(!y||y.level!==m)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=u)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"SubtitleStreamController",function(){return l});var J=O("./src/events.ts"),U=O("./src/utils/logger.ts"),R=O("./src/utils/buffer-helper.ts"),G=O("./src/controller/fragment-finders.ts"),H=O("./src/utils/discontinuities.ts"),M=O("./src/controller/level-helper.ts"),_=O("./src/controller/fragment-tracker.ts"),b=O("./src/controller/base-stream-controller.ts"),A=O("./src/types/loader.ts"),I=O("./src/types/level.ts");function k(h,T){for(var v=0;v<T.length;v++){var g=T[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}function w(h,T,v){return T&&k(h.prototype,T),v&&k(h,v),h}function C(h,T){h.prototype=Object.create(T.prototype),h.prototype.constructor=h,d(h,T)}function d(h,T){return d=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},d(h,T)}var o=500,l=function(h){C(T,h);function T(g,L){var E;return E=h.call(this,g,L,"[subtitle-stream-controller]")||this,E.levels=[],E.currentTrackId=-1,E.tracksBuffered=[],E.mainDetails=null,E._registerListeners(),E}var v=T.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var L=this.hls;L.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(J.Events.ERROR,this.onError,this),L.on(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var L=this.hls;L.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(J.Events.ERROR,this.onError,this),L.off(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(o),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(L,E){this.mainDetails=E.details},v.onSubtitleFragProcessed=function(L,E){var p=E.frag,c=E.success;if(this.fragPrevious=p,this.state=b.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,y=p.start,m=0;m<u.length;m++)if(y>=u[m].start&&y<=u[m].end){a=u[m];break}var x=p.start+p.duration;a?a.end=x:(a={start:y,end:x},u.push(a)),this.fragmentTracker.fragBuffered(p)},v.onBufferFlushing=function(L,E){var p=E.startOffset,c=E.endOffset;if(p===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var y=a[u].details,m=y.targetduration,x=c-m;if(x<=0)return;E.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(B){for(var W=0;W<B.length;){if(B[W].end<=x){B.shift();continue}else if(B[W].start<x)B[W].start=x;else break;W++}}),this.fragmentTracker.removeFragmentsInRange(p,x,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(L,E){var p,c=E.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},v.onSubtitleTracksUpdated=function(L,E){var p=this,c=E.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new I.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){p.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(L,E){if(this.currentTrackId=E.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(L,E){var p,c=E.details,u=E.id,a=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[a];if(u>=y.length||u!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(p=m.details)!==null&&p!==void 0&&p.live){var x=this.mainDetails;if(c.deltaUpdateFailed||!x)return;var B=x.fragments[0];if(!m.details)c.hasProgramDateTime&&x.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(c,x):B&&Object(M.addSliding)(c,B.start);else{var W=this.alignPlaylists(c,m.details);W===0&&B&&Object(M.addSliding)(c,B.start)}}if(m.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var V=Object(G.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);V||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(L){var E=L.frag,p=L.payload,c=E.decryptdata,u=this.hls;if(this.fragContextChanged(E))return;if(p&&p.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),c.key.buffer,c.iv.buffer).then(function(y){var m=performance.now();u.trigger(J.Events.FRAG_DECRYPTED,{frag:E,payload:y,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var L,E=this.currentTrackId,p=this.levels;if(!p.length||!p[E]||!p[E].details)return;var c=p[E].details,u=c.targetduration,a=this.config,y=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-u,a.maxBufferHole),x=m.end,B=m.len,W=this.getMaxBufferLength()+u;if(B>W)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var V=c.fragments,K=V.length,P=c.edge,N,$=this.fragPrevious;if(x<P){var ne=a.maxFragLookUpTolerance;$&&c.hasProgramDateTime&&(N=Object(G.findFragmentByPDT)(V,$.endProgramDateTime,ne)),N||(N=Object(G.findFragmentByPTS)($,V,x,ne),!N&&$&&$.start<V[0].start&&(N=V[0]))}else N=V[K-1];(L=N)!==null&&L!==void 0&&L.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(J.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===_.FragmentState.NOT_LOADED&&this.loadFragment(N,c,x)}},v.loadFragment=function(L,E,p){this.fragCurrent=L,h.prototype.loadFragment.call(this,L,E,p)},w(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(b.default)},"./src/controller/subtitle-track-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),R=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(k,w){for(var C=0;C<w.length;C++){var d=w[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(k,d.key,d)}}function M(k,w,C){return w&&H(k.prototype,w),C&&H(k,C),k}function _(k,w){k.prototype=Object.create(w.prototype),k.prototype.constructor=k,b(k,w)}function b(k,w){return b=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},b(k,w)}var A=function(k){_(w,k);function w(d){var o;return o=k.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var C=w.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,k.prototype.destroy.call(this)},C.registerListeners=function(){var o=this.hls;o.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(J.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var o=this.hls;o.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(J.Events.ERROR,this.onError,this)},C.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},C.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},C.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=I(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},C.onSubtitleTrackLoaded=function(o,l){var h=l.id,T=l.details,v=this.trackId,g=this.tracksInGroup[v];if(!g){this.warn("Invalid subtitle track id "+h);return}var L=g.details;g.details=l.details,this.log("subtitle track "+h+" loaded ["+T.startSN+"-"+T.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,L))},C.onLevelLoading=function(o,l){this.switchLevel(l.level)},C.onLevelSwitching=function(o,l){this.switchLevel(l.level)},C.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(E){return!h||E.groupId===h});this.tracksInGroup=v;var g=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=h;var L={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(J.Events.SUBTITLE_TRACKS_UPDATED,L),g!==-1&&this.setSubtitleTrack(g,T)}},C.findTrackId=function(o){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var T=l[h];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},C.onError=function(o,l){if(k.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},C.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,T=l.groupId,v=l.url;if(o)try{v=o.addDirectives(v)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(J.Events.SUBTITLE_TRACK_LOADING,{url:v,id:h,groupId:T,deliveryDirectives:o||null})}},C.toggleTrackModes=function(o){var l=this,h=this.media,T=this.subtitleDisplay,v=this.trackId;if(!h)return;var g=I(h.textTracks),L=g.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(g).forEach(function(c){c.mode="disabled"});else{var E=L[v];E&&(E.mode="disabled")}var p=L[o];p&&(p.mode=T?"showing":"hidden")},C.setSubtitleTrack=function(o,l){var h,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(h=T[o])!==null&&h!==void 0&&h.details)||o<-1||o>=T.length)return;this.clearTimer();var v=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var g=v.id,L=v.groupId,E=L===void 0?"":L,p=v.name,c=v.type,u=v.url;this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:E,name:p,type:c,url:u});var a=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:o})},C.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=I(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")o=h;else if(l[h].mode==="showing"){o=h;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},M(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),w}(R.default);function I(k){for(var w=[],C=0;C<k.length;C++){var d=k[C];d.kind==="subtitles"&&d.label&&w.push(k[C])}return w}Z.default=A},"./src/controller/timeline-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"TimelineController",function(){return I});var J=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),R=O("./src/utils/cea-608-parser.ts"),G=O("./src/utils/output-filter.ts"),H=O("./src/utils/webvtt-parser.ts"),M=O("./src/utils/texttrack-utils.ts"),_=O("./src/utils/imsc1-ttml-parser.ts"),b=O("./src/types/loader.ts"),A=O("./src/utils/logger.ts"),I=function(){function d(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new G.default(this,"textTrack1"),T=new G.default(this,"textTrack2"),v=new G.default(this,"textTrack3"),g=new G.default(this,"textTrack4");this.cea608Parser1=new R.default(1,h,T),this.cea608Parser2=new R.default(3,v,g)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(U.Events.FRAG_LOADING,this.onFragLoading,this),h.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(h,T,v,g,L){for(var E=!1,p=L.length;p--;){var c=L[p],u=w(c[0],c[1],T,v);if(u>=0&&(c[0]=Math.min(c[0],T),c[1]=Math.max(c[1],v),E=!0,u/(v-T)>.5))return}if(E||L.push([T,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[h];this.Cues.newCue(a,T,v,g)}else{var y=this.Cues.newCue(null,T,v,g);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:y,track:h})}},o.onInitPtsFound=function(h,T){var v=this,g=T.frag,L=T.id,E=T.initPTS,p=T.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[g.cc]=E,this.timescale[g.cc]=p),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){v.onFragLoaded(U.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(h){var T=this.media;if(T)for(var v=0;v<T.textTracks.length;v++){var g=T.textTracks[v];if(g[h])return g}return null},o.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},o.createNativeTrack=function(h){if(this.captionsTracks[h])return;var T=this.captionsProperties,v=this.captionsTracks,g=this.media,L=T[h],E=L.label,p=L.languageCode,c=this.getExistingTrack(h);if(c)v[h]=c,Object(M.clearCurrentCues)(v[h]),Object(M.sendAddTrackEvent)(v[h],g);else{var u=this.createTextTrack("captions",E,p);u&&(u[h]=!0,v[h]=u)}},o.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var T=this.captionsProperties[h];if(!T)return;var v=T.label,g={_id:h,label:v,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[h]=g,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},o.createTextTrack=function(h,T,v){var g=this.media;return g?g.addTextTrack(h,T,v):void 0},o.onMediaAttaching=function(h,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(T){Object(M.clearCurrentCues)(h[T]),delete h[T]}),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 h=this.media;if(!h)return;var T=h.textTracks;if(T)for(var v=0;v<T.length;v++)Object(M.clearCurrentCues)(T[v])},o.onSubtitleTracksUpdated=function(h,T){var v=this;this.textTracks=[];var g=T.subtitleTracks||[],L=g.some(function(u){return u.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var E=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var y;if(a<p.length){for(var m=null,x=0;x<p.length;x++)if(k(p[x],u)){m=p[x];break}m&&(y=m)}y?Object(M.clearCurrentCues)(y):(y=v.createTextTrack("subtitles",u.name,u.lang),y&&(y.mode="disabled")),y&&(y.groupId=u.groupId,v.textTracks.push(y))})}else if(!E&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(h,T){var v=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(g){var L=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!L)return;var E="textTrack"+L[1],p=v.captionsProperties[E];if(!p)return;p.label=g.name,g.lang&&(p.languageCode=g.lang),p.media=g})},o.onFragLoading=function(h,T){var v=this.cea608Parser1,g=this.cea608Parser2,L=this.lastSn,E=this.lastPartIndex;if(!this.enabled||!(v&&g))return;if(T.frag.type===b.PlaylistLevelType.MAIN){var p,c,u=T.frag.sn,a=(p=T==null||((c=T.part)===null||c===void 0)?void 0:c.index)!=null?p:-1;u===L+1||u===L&&a===E+1||(v.reset(),g.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(h,T){var v=T.frag,g=T.payload,L=this.initPTS,E=this.unparsedVttFrags;if(v.type===b.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(J.isFiniteNumber)(L[v.cc])){E.push(T),L.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var p=v.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var c=this.tracks[v.level],u=this.vttCCs;u[v.cc]||(u[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),c&&c.textCodec===_.IMSC1_CODEC?this._parseIMSC1(v,g):this._parseVTTs(v,g,u)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(h,T){var v=this,g=this.hls;Object(_.parseIMSC1)(T,this.initPTS[h.cc],this.timescale[h.cc],function(L){v._appendCues(L,h.level),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(L){A.logger.log("Failed to parse IMSC1: "+L),g.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:L})})},o._parseVTTs=function(h,T,v){var g=this,L=this.hls;Object(H.parseWebVTT)(T,this.initPTS[h.cc],this.timescale[h.cc],v,h.cc,h.start,function(E){g._appendCues(E,h.level),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(E){g._fallbackToIMSC1(h,T),A.logger.log("Failed to parse VTT cue: "+E),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:E})})},o._fallbackToIMSC1=function(h,T){var v=this,g=this.tracks[h.level];g.textCodec||Object(_.parseIMSC1)(T,this.initPTS[h.cc],this.timescale[h.cc],function(){g.textCodec=_.IMSC1_CODEC,v._parseIMSC1(h,T)},function(){g.textCodec="wvtt"})},o._appendCues=function(h,T){var v=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[T];if(g.mode==="disabled")return;h.forEach(function(p){return Object(M.addCueToTrack)(g,p)})}else{var L=this.tracks[T],E=L.default?"default":"subtitles"+T;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:h,track:E})}},o.onFragDecrypted=function(h,T){var v=T.frag;if(v.type===b.PlaylistLevelType.SUBTITLE){if(!Object(J.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(U.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(h,T){var v=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(v&&g))return;for(var L=0;L<T.samples.length;L++){var E=T.samples[L].bytes;if(E){var p=this.extractCea608Data(E);v.addData(T.samples[L].pts,p[0]),g.addData(T.samples[L].pts,p[1])}}},o.onBufferFlushing=function(h,T){var v=T.startOffset,g=T.endOffset,L=T.endOffsetSubtitles,E=T.type,p=this.media;if(!p||p.currentTime<g)return;if(!E||E==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(M.removeCuesInRange)(c[a],v,g)})}if(this.config.renderTextTracksNatively&&(v===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(M.removeCuesInRange)(u[a],v,L)})}},o.extractCea608Data=function(h){for(var T=h[0]&31,v=2,g=[[],[]],L=0;L<T;L++){var E=h[v++],p=127&h[v++],c=127&h[v++],u=(4&E)!==0,a=3&E;if(p===0&&c===0)continue;u&&((a===0||a===1)&&(g[a].push(p),g[a].push(c)))}return g},d}();function k(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function w(d,o,l,h){return Math.min(o,h)-Math.max(d,l)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function U(G,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=H}var R=U.prototype;return R.decrypt=function(H,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,H)},U}()},"./src/crypt/aes-decryptor.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"removePadding",function(){return U}),O.d(Z,"default",function(){return R});var J=O("./src/utils/typed-array.ts");function U(G){var H=G.byteLength,M=H&&new DataView(G.buffer).getUint8(H-1);return M?Object(J.sliceUint8)(G,0,H-M):G}var R=function(){function G(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=G.prototype;return H.uint8ArrayToUint32Array_=function(_){for(var b=new DataView(_),A=new Uint32Array(4),I=0;I<4;I++)A[I]=b.getUint32(I*4);return A},H.initTable=function(){var _=this.sBox,b=this.invSBox,A=this.subMix,I=A[0],k=A[1],w=A[2],C=A[3],d=this.invSubMix,o=d[0],l=d[1],h=d[2],T=d[3],v=new Uint32Array(256),g=0,L=0,E=0;for(E=0;E<256;E++)E<128?v[E]=E<<1:v[E]=E<<1^283;for(E=0;E<256;E++){var p=L^L<<1^L<<2^L<<3^L<<4;p=p>>>8^p&255^99,_[g]=p,b[p]=g;var c=v[g],u=v[c],a=v[u],y=v[p]*257^p*16843008;I[g]=y<<24|y>>>8,k[g]=y<<16|y>>>16,w[g]=y<<8|y>>>24,C[g]=y,y=a*16843009^u*65537^c*257^g*16843008,o[p]=y<<24|y>>>8,l[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,T[p]=y,g?(g=c^v[v[v[a^c]]],L^=v[v[L]]):g=L=1}},H.expandKey=function(_){for(var b=this.uint8ArrayToUint32Array_(_),A=!0,I=0;I<b.length&&A;)A=b[I]===this.key[I],I++;if(A)return;this.key=b;var k=this.keySize=b.length;if(k!==4&&k!==6&&k!==8)throw new Error("Invalid aes key size="+k);var w=this.ksRows=(k+6+1)*4,C,d,o=this.keySchedule=new Uint32Array(w),l=this.invKeySchedule=new Uint32Array(w),h=this.sBox,T=this.rcon,v=this.invSubMix,g=v[0],L=v[1],E=v[2],p=v[3],c,u;for(C=0;C<w;C++){if(C<k){c=o[C]=b[C];continue}u=c,C%k===0?(u=u<<8|u>>>24,u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255],u^=T[C/k|0]<<24):k>6&&C%k===4&&(u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255]),o[C]=c=(o[C-k]^u)>>>0}for(d=0;d<w;d++)C=w-d,d&3?u=o[C]:u=o[C-4],d<4||C<=4?l[d]=u:l[d]=g[h[u>>>24]]^L[h[u>>>16&255]]^E[h[u>>>8&255]]^p[h[u&255]],l[d]=l[d]>>>0},H.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},H.decrypt=function(_,b,A){for(var I=this.keySize+6,k=this.invKeySchedule,w=this.invSBox,C=this.invSubMix,d=C[0],o=C[1],l=C[2],h=C[3],T=this.uint8ArrayToUint32Array_(A),v=T[0],g=T[1],L=T[2],E=T[3],p=new Int32Array(_),c=new Int32Array(p.length),u,a,y,m,x,B,W,V,K,P,N,$,ne,ue,me=this.networkToHostOrderSwap;b<p.length;){for(K=me(p[b]),P=me(p[b+1]),N=me(p[b+2]),$=me(p[b+3]),x=K^k[0],B=$^k[1],W=N^k[2],V=P^k[3],ne=4,ue=1;ue<I;ue++)u=d[x>>>24]^o[B>>16&255]^l[W>>8&255]^h[V&255]^k[ne],a=d[B>>>24]^o[W>>16&255]^l[V>>8&255]^h[x&255]^k[ne+1],y=d[W>>>24]^o[V>>16&255]^l[x>>8&255]^h[B&255]^k[ne+2],m=d[V>>>24]^o[x>>16&255]^l[B>>8&255]^h[W&255]^k[ne+3],x=u,B=a,W=y,V=m,ne=ne+4;u=w[x>>>24]<<24^w[B>>16&255]<<16^w[W>>8&255]<<8^w[V&255]^k[ne],a=w[B>>>24]<<24^w[W>>16&255]<<16^w[V>>8&255]<<8^w[x&255]^k[ne+1],y=w[W>>>24]<<24^w[V>>16&255]<<16^w[x>>8&255]<<8^w[B&255]^k[ne+2],m=w[V>>>24]<<24^w[x>>16&255]<<16^w[B>>8&255]<<8^w[W&255]^k[ne+3],c[b]=me(u^v),c[b+1]=me(m^g),c[b+2]=me(y^L),c[b+3]=me(a^E),v=K,g=P,L=N,E=$,b=b+4}return c.buffer},G}()},"./src/crypt/decrypter.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return b});var J=O("./src/crypt/aes-crypto.ts"),U=O("./src/crypt/fast-aes-key.ts"),R=O("./src/crypt/aes-decryptor.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),M=O("./src/utils/typed-array.ts"),_=16,b=function(){function A(k,w,C){var d=C===void 0?{}:C,o=d.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=k,this.config=w,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var I=A.prototype;return I.destroy=function(){this.observer=null},I.isSync=function(){return this.config.enableSoftwareAES},I.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var C=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(C):C},I.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},I.decrypt=function(w,C,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),C,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),C,d).then(o)},I.softwareDecrypt=function(w,C,d){var o=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(w=Object(H.appendUint8Array)(h,w),this.remainderData=null);var T=this.getValidChunk(w);if(!T.length)return null;o&&(d=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new R.default),v.expandKey(C);var g=l;return this.currentResult=v.decrypt(T.buffer,0,d),this.currentIV=Object(M.sliceUint8)(T,-16).buffer,g||null},I.webCryptoDecrypt=function(w,C,d){var o=this,l=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new U.default(l,C)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var T=new J.default(l,d);return T.decrypt(w.buffer,h)}).catch(function(h){return o.onWebCryptoError(h,w,C,d)})},I.onWebCryptoError=function(w,C,d,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,d,o)},I.getValidChunk=function(w){var C=w,d=w.length-w.length%_;return d!==w.length&&(C=Object(M.sliceUint8)(w,0,d),this.remainderData=Object(M.sliceUint8)(w,d)),C},I.logOnce=function(w){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function U(G,H){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=H}var R=U.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/adts.ts"),R=O("./src/utils/logger.ts"),G=O("./src/demux/id3.ts");function H(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,M(b,A)}function M(b,A){return M=Object.setPrototypeOf||function(k,w){return k.__proto__=w,k},M(b,A)}var _=function(b){H(A,b);function A(k,w){var C;return C=b.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=k,C.config=w,C}var I=A.prototype;return I.resetInitSegment=function(w,C,d){b.prototype.resetInitSegment.call(this,w,C,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var C=G.getID3Data(w,0)||[],d=C.length,o=w.length;d<o;d++)if(U.probe(w,d))return R.logger.log("ADTS sync word found !"),!0;return!1},I.canParse=function(w,C){return U.canParse(w,C)},I.appendFrame=function(w,C,d){U.initTrackConfig(w,this.observer,C,d,w.manifestCodec);var o=U.appendFrame(w,C,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(J.default);_.minProbeByteLength=9,Z.default=_},"./src/demux/adts.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"getAudioConfig",function(){return G}),O.d(Z,"isHeaderPattern",function(){return H}),O.d(Z,"getHeaderLength",function(){return M}),O.d(Z,"getFullFrameLength",function(){return _}),O.d(Z,"canGetFrameLength",function(){return b}),O.d(Z,"isHeader",function(){return A}),O.d(Z,"canParse",function(){return I}),O.d(Z,"probe",function(){return k}),O.d(Z,"initTrackConfig",function(){return w}),O.d(Z,"getFrameDuration",function(){return C}),O.d(Z,"parseFrameHeader",function(){return d}),O.d(Z,"appendFrame",function(){return o});var J=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),R=O("./src/events.ts");function G(l,h,T,v){var g,L,E,p,c=navigator.userAgent.toLowerCase(),u=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((h[T+2]&192)>>>6)+1;var y=(h[T+2]&60)>>>2;if(y>a.length-1){l.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return E=(h[T+2]&1)<<2,E|=(h[T+3]&192)>>>6,J.logger.log("manifest codec:"+v+", ADTS type:"+g+", samplingIndex:"+y),/firefox/i.test(c)?y>=6?(g=5,p=new Array(4),L=y-3):(g=2,p=new Array(2),L=y):c.indexOf("android")!==-1?(g=2,p=new Array(2),L=y):(g=5,p=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&y>=6?L=y-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(y>=6&&E===1||/vivaldi/i.test(c))||!v&&E===1)&&(g=2,p=new Array(2)),L=y)),p[0]=g<<3,p[0]|=(y&14)>>1,p[1]|=(y&1)<<7,p[1]|=E<<3,g===5&&(p[1]|=(L&14)>>1,p[2]=(L&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[y],channelCount:E,codec:"mp4a.40."+g,manifestCodec:u}}function H(l,h){return l[h]===255&&(l[h+1]&246)===240}function M(l,h){return l[h+1]&1?7:9}function _(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function b(l,h){return h+5<l.length}function A(l,h){return h+1<l.length&&H(l,h)}function I(l,h){return b(l,h)&&H(l,h)&&_(l,h)<=l.length-h}function k(l,h){if(A(l,h)){var T=M(l,h);if(h+T>=l.length)return!1;var v=_(l,h);if(v<=T)return!1;var g=h+v;return g===l.length||A(l,g)}return!1}function w(l,h,T,v,g){if(!l.samplerate){var L=G(h,T,v,g);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,J.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function C(l){return 1024*9e4/l}function d(l,h,T,v,g){var L=M(l,h),E=_(l,h);if(E-=L,E>0){var p=T+v*g;return{headerLength:L,frameLength:E,stamp:p}}}function o(l,h,T,v,g){var L=C(l.samplerate),E=d(h,T,v,g,L);if(E){var p=E.frameLength,c=E.headerLength,u=E.stamp,a=c+p,y=Math.max(0,T+a-h.length),m;y?(m=new Uint8Array(a-c),m.set(h.subarray(T+c,h.length),0)):m=h.subarray(T+c,T+a);var x={unit:m,pts:u};return y||l.samples.push(x),{sample:x,length:a,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"initPTSFn",function(){return _});var J=O("./src/polyfills/number.ts"),U=O("./src/demux/id3.ts"),R=O("./src/demux/dummy-demuxed-track.ts"),G=O("./src/utils/mp4-tools.ts"),H=O("./src/utils/typed-array.ts"),M=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=b.prototype;return A.resetInitSegment=function(k,w,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(k,w){return!1},A.appendFrame=function(k,w,C){},A.demux=function(k,w){this.cachedData&&(k=Object(G.appendUint8Array)(this.cachedData,k),this.cachedData=null);var C=U.getID3Data(k,0),d=C?C.length:0,o,l,h=this._audioTrack,T=this._id3Track,v=C?U.getTimeStamp(C):void 0,g=k.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(v,w)),C&&C.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),l=this.initPTS;d<g;){if(this.canParse(k,d)){var L=this.appendFrame(h,k,d);L?(this.frameIndex++,l=L.sample.pts,d+=L.length,o=d):d=g}else U.canParse(k,d)?(C=U.getID3Data(k,d),T.samples.push({pts:l,dts:l,data:C}),d+=C.length,o=d):d++;if(d===g&&o!==g){var E=Object(H.sliceUint8)(k,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:h,avcTrack:Object(R.dummyTrack)(),id3Track:T,textTrack:Object(R.dummyTrack)()}},A.demuxSampleAes=function(k,w,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(k){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},A.destroy=function(){},b}(),_=function(A,I){return Object(J.isFiniteNumber)(A)?A*90:I*9e4};Z.default=M},"./src/demux/chunk-cache.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function R(){this.chunks=[],this.dataLength=0}var G=R.prototype;return G.push=function(M){this.chunks.push(M),this.dataLength+=M.length},G.flush=function(){var M=this.chunks,_=this.dataLength,b;if(M.length)M.length===1?b=M[0]:b=U(M,_);else return new Uint8Array(0);return this.reset(),b},G.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function U(R,G){for(var H=new Uint8Array(G),M=0,_=0;_<R.length;_++){var b=R[_];H.set(b,M),M+=b.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"dummyTrack",function(){return J});function J(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/logger.ts"),U=function(){function R(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var G=R.prototype;return G.loadWord=function(){var M=this.data,_=this.bytesAvailable,b=M.byteLength-_,A=new Uint8Array(4),I=Math.min(4,_);if(I===0)throw new Error("no bytes available");A.set(M.subarray(b,b+I)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=I*8,this.bytesAvailable-=I},G.skipBits=function(M){var _;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,_=M>>3,M-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},G.readBits=function(M){var _=Math.min(this.bitsAvailable,M),b=this.word>>>32-_;return M>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=M-_,_>0&&this.bitsAvailable?b<<_|this.readBits(_):b},G.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},G.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(M){for(var _=8,b=8,A,I=0;I<M;I++)b!==0&&(A=this.readEG(),b=(_+A+256)%256),_=b===0?_:b},G.readSPS=function(){var M=0,_=0,b=0,A=0,I,k,w,C=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),T=this.skipEG.bind(this),v=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);C();var L=C();if(d(5),h(3),C(),v(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var E=o();if(E===3&&h(1),v(),v(),h(1),l())for(k=E!==3?8:12,w=0;w<k;w++)l()&&(w<6?g(16):g(64))}v();var p=o();if(p===0)o();else if(p===1)for(h(1),T(),T(),I=o(),w=0;w<I;w++)T();v(),h(1);var c=o(),u=o(),a=d(1);a===0&&h(1),h(1),l()&&(M=o(),_=o(),b=o(),A=o());var y=[1,1];if(l()&&l()){var m=C();switch(m){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((c+1)*16-M*2-_*2),height:(2-a)*(u+1)*16-(a?2:4)*(b+A),pixelRatio:y}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();Z.default=U},"./src/demux/id3.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isHeader",function(){return J}),O.d(Z,"isFooter",function(){return U}),O.d(Z,"getID3Data",function(){return R}),O.d(Z,"canParse",function(){return H}),O.d(Z,"getTimeStamp",function(){return M}),O.d(Z,"isTimeStampFrame",function(){return _}),O.d(Z,"getID3Frames",function(){return A}),O.d(Z,"decodeFrame",function(){return I}),O.d(Z,"utf8ArrayToStr",function(){return o}),O.d(Z,"testables",function(){return l});var J=function(g,L){return L+10<=g.length&&(g[L]===73&&g[L+1]===68&&g[L+2]===51&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},U=function(g,L){return L+10<=g.length&&(g[L]===51&&g[L+1]===68&&g[L+2]===73&&(g[L+3]<255&&g[L+4]<255&&(g[L+6]<128&&g[L+7]<128&&g[L+8]<128&&g[L+9]<128)))},R=function(g,L){for(var E=L,p=0;J(g,L);){p+=10;var c=G(g,L+6);p+=c,U(g,L+10)&&(p+=10),L+=p}return p>0?g.subarray(E,E+p):void 0},G=function(g,L){var E=0;return E=(g[L]&127)<<21,E|=(g[L+1]&127)<<14,E|=(g[L+2]&127)<<7,E|=g[L+3]&127,E},H=function(g,L){return J(g,L)&&G(g,L+6)+10<=g.length-L},M=function(g){for(var L=A(g),E=0;E<L.length;E++){var p=L[E];if(_(p))return d(p)}return},_=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},b=function(g){var L=String.fromCharCode(g[0],g[1],g[2],g[3]),E=G(g,4),p=10;return{type:L,size:E,data:g.subarray(p,p+E)}},A=function(g){for(var L=0,E=[];J(g,L);){var p=G(g,L+6);L+=10;for(var c=L+p;L+8<c;){var u=b(g.subarray(L)),a=I(u);a&&E.push(a),L+=u.size+10}U(g,L)&&(L+=10)}return E},I=function(g){return g.type==="PRIV"?k(g):g.type[0]==="W"?C(g):w(g)},k=function(g){if(g.size<2)return;var L=o(g.data,!0),E=new Uint8Array(g.data.subarray(L.length+1));return{key:g.type,info:L,data:E.buffer}},w=function(g){if(g.size<2)return;if(g.type==="TXXX"){var L=1,E=o(g.data.subarray(L),!0);L+=E.length+1;var p=o(g.data.subarray(L));return{key:g.type,info:E,data:p}}var c=o(g.data.subarray(1));return{key:g.type,data:c}},C=function(g){if(g.type==="WXXX"){if(g.size<2)return;var L=1,E=o(g.data.subarray(L),!0);L+=E.length+1;var p=o(g.data.subarray(L));return{key:g.type,info:E,data:p}}var c=o(g.data);return{key:g.type,data:c}},d=function(g){if(g.data.byteLength===8){var L=new Uint8Array(g.data),E=L[3]&1,p=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return p/=45,E&&(p+=4772185884e-2),Math.round(p)}return},o=function(g,L){L===void 0&&(L=!1);var E=T();if(E){var p=E.decode(g);if(L){var c=p.indexOf("\0");return c!==-1?p.substring(0,c):p}return p.replace(/\0/g,"")}for(var u=g.length,a,y,m,x="",B=0;B<u;){if(a=g[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:y=g[B++],x+=String.fromCharCode((a&31)<<6|y&63);break;case 14:y=g[B++],m=g[B++],x+=String.fromCharCode((a&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return x},l={decodeTextFrame:w},h;function T(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/id3.ts"),R=O("./src/utils/logger.ts"),G=O("./src/demux/mpegaudio.ts");function H(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,M(b,A)}function M(b,A){return M=Object.setPrototypeOf||function(k,w){return k.__proto__=w,k},M(b,A)}var _=function(b){H(A,b);function A(){return b.apply(this,arguments)||this}var I=A.prototype;return I.resetInitSegment=function(w,C,d){b.prototype.resetInitSegment.call(this,w,C,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var C=U.getID3Data(w,0)||[],d=C.length,o=w.length;d<o;d++)if(G.probe(w,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},I.canParse=function(w,C){return G.canParse(w,C)},I.appendFrame=function(w,C,d){return this.initPTS===null?void 0:G.appendFrame(w,C,d,this.initPTS,this.frameIndex)},A}(J.default);_.minProbeByteLength=4,Z.default=_},"./src/demux/mp4demuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/mp4-tools.ts"),U=O("./src/demux/dummy-demuxed-track.ts"),R=function(){function G(M,_){this.remainderData=null,this.config=void 0,this.config=_}var H=G.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},G.probe=function(_){return Object(J.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},H.demux=function(_){var b=_,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(J.appendUint8Array)(this.remainderData,_));var I=Object(J.segmentValidRange)(b);this.remainderData=I.remainder,A.samples=I.valid||new Uint8Array}else A.samples=b;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.flush=function(){var _=Object(U.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:_,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(_,b,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},G}();R.minProbeByteLength=1024,Z.default=R},"./src/demux/mpegaudio.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"appendFrame",function(){return M}),O.d(Z,"parseHeader",function(){return _}),O.d(Z,"isHeaderPattern",function(){return b}),O.d(Z,"isHeader",function(){return A}),O.d(Z,"canParse",function(){return I}),O.d(Z,"probe",function(){return k});var J=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function M(w,C,d,o,l){if(d+24>C.length)return;var h=_(C,d);if(h&&d+h.frameLength<=C.length){var T=h.samplesPerFrame*9e4/h.sampleRate,v=o+l*T,g={unit:C.subarray(d,d+h.frameLength),pts:v,dts:v};return w.config=[],w.channelCount=h.channelCount,w.samplerate=h.sampleRate,w.samples.push(g),{sample:g,length:h.frameLength,missing:0}}}function _(w,C){var d=w[C+1]>>3&3,o=w[C+1]>>1&3,l=w[C+2]>>4&15,h=w[C+2]>>2&3;if(d!==1&&l!==0&&l!==15&&h!==3){var T=w[C+2]>>1&1,v=w[C+3]>>6,g=d===3?3-o:o===3?3:4,L=U[g*14+l-1]*1e3,E=d===3?0:d===2?1:2,p=R[E*3+h],c=v===3?1:2,u=G[d][o],a=H[o],y=u*8*a,m=Math.floor(u*L/p+T)*a;if(J===null){var x=navigator.userAgent||"",B=x.match(/Chrome\/(\d+)/i);J=B?parseInt(B[1]):0}var W=!!J&&J<=87;return W&&o===2&&L>=224e3&&v===0&&(w[C+3]=w[C+3]|128),{sampleRate:p,channelCount:c,frameLength:m,samplesPerFrame:y}}}function b(w,C){return w[C]===255&&(w[C+1]&224)===224&&(w[C+1]&6)!==0}function A(w,C){return C+1<w.length&&b(w,C)}function I(w,C){var d=4;return b(w,C)&&d<=w.length-C}function k(w,C){if(C+1<w.length&&b(w,C)){var d=4,o=_(w,C),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var h=C+l;return h===w.length||A(w,h)}return!1}},"./src/demux/sample-aes.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/crypt/decrypter.ts"),U=O("./src/demux/tsdemuxer.ts"),R=function(){function G(M,_,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new J.default(M,_,{removePKCS7Padding:!1})}var H=G.prototype;return H.decryptBuffer=function(_,b){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,b)},H.decryptAacSample=function(_,b,A,I){var k=_[b].unit,w=k.subarray(16,k.length-k.length%16),C=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),d=this;this.decryptBuffer(C,function(o){var l=new Uint8Array(o);k.set(l,16),I||d.decryptAacSamples(_,b+1,A)})},H.decryptAacSamples=function(_,b,A){for(;;b++){if(b>=_.length){A();return}if(_[b].unit.length<32)continue;var I=this.decrypter.isSync();if(this.decryptAacSample(_,b,A,I),!I)return}},H.getAvcEncryptedData=function(_){for(var b=Math.floor((_.length-48)/160)*16+16,A=new Int8Array(b),I=0,k=32;k<=_.length-16;k+=160,I+=16)A.set(_.subarray(k,k+16),I);return A},H.getAvcDecryptedUnit=function(_,b){for(var A=new Uint8Array(b),I=0,k=32;k<=_.length-16;k+=160,I+=16)_.set(A.subarray(I,I+16),k);return _},H.decryptAvcSample=function(_,b,A,I,k,w){var C=Object(U.discardEPB)(k.data),d=this.getAvcEncryptedData(C),o=this;this.decryptBuffer(d.buffer,function(l){k.data=o.getAvcDecryptedUnit(C,l),w||o.decryptAvcSamples(_,b,A+1,I)})},H.decryptAvcSamples=function(_,b,A,I){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,A=0){if(b>=_.length){I();return}for(var k=_[b].units;!(A>=k.length);A++){var w=k[A];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(_,b,A,I,w,C),!C)return}}},G}();Z.default=R},"./src/demux/transmuxer-interface.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k});var J=O("./node_modules/webworkify-webpack/index.js"),U=O.n(J),R=O("./src/events.ts"),G=O("./src/demux/transmuxer.ts"),H=O("./src/utils/logger.ts"),M=O("./src/errors.ts"),_=O("./src/utils/mediasource-helper.ts"),b=O("./node_modules/eventemitter3/index.js"),A=O.n(b),I=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},k=function(){function w(d,o,l,h){var T=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=h;var v=d.config,g=function(u,a){a=a||{},a.frag=T.frag,a.id=T.id,d.trigger(u,a)};this.observer=new b.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,g),this.observer.on(R.Events.ERROR,g);var L={mp4:I.isTypeSupported("video/mp4"),mpeg:I.isTypeSupported("audio/mpeg"),mp3:I.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var p;try{p=this.worker=J("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(c){d.trigger(R.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},p.postMessage({cmd:"init",typeSupported:L,vendor:E,id:o,config:JSON.stringify(v)})}catch(c){H.logger.warn("Error in worker:",c),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new G.default(this.observer,L,v,E,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,L,v,E,o)}var C=w.prototype;return C.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},C.push=function(o,l,h,T,v,g,L,E,p,c){var u=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,y=this.worker,m=g?g.start:v.start,x=v.decryptdata,B=this.frag,W=!(B&&v.cc===B.cc),V=!(B&&p.level===B.level),K=B?p.sn-B.sn:-1,P=this.part?p.part-this.part.index:1,N=!V&&(K===1||K===0&&P===1),$=self.performance.now();(V||K||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),g&&(P||!N)&&(g.stats.parsing.start=$);var ne=new G.TransmuxState(W,N,E,V,m);if(!N||W){H.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
|
|
discontinuity: `+W+`
|
|
trackSwitch: `+V+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+E+`
|
|
timeOffset: `+m);var ue=new G.TransmuxConfig(h,T,l,L,c);this.configureTransmuxer(ue)}if(this.frag=v,this.part=g,y)y.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:p,state:ne},o instanceof ArrayBuffer?[o]:[]);else if(a){var me=a.push(o,x,p,ne);Object(G.isPromise)(me)?me.then(function(ke){u.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(me)}},C.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var h=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(h){var v=h.flush(o);Object(G.isPromise)(v)?v.then(function(g){l.handleFlushResult(g,o)}):this.handleFlushResult(v,o)}},C.handleFlushResult=function(o,l){var h=this;o.forEach(function(T){h.handleTransmuxComplete(T)}),this.onFlush(l)},C.onWorkerMessage=function(o){var l=o.data,h=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,h.trigger(l.event,l.data);break}}},C.configureTransmuxer=function(o){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):h&&h.configure(o)},C.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return M});var J=O("./src/demux/transmuxer.ts"),U=O("./src/events.ts"),R=O("./src/utils/logger.ts"),G=O("./node_modules/eventemitter3/index.js"),H=O.n(G);function M(k){var w=new G.EventEmitter,C=function(o,l){k.postMessage({event:o,data:l})};w.on(U.Events.FRAG_DECRYPTED,C),w.on(U.Events.ERROR,C),k.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);k.transmuxer=new J.default(w,o.typeSupported,l,o.vendor,o.id),Object(R.enableLogs)(l.debug),C("init",null);break}case"configure":{k.transmuxer.configure(o.config);break}case"demux":{var h=k.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(J.isPromise)(h)?h.then(function(g){_(k,g)}):_(k,h);break}case"flush":{var T=o.chunkMeta,v=k.transmuxer.flush(T);Object(J.isPromise)(v)?v.then(function(g){A(k,g,T)}):A(k,v,T);break}default:break}})}function _(k,w){if(I(w.remuxResult))return;var C=[],d=w.remuxResult,o=d.audio,l=d.video;o&&b(C,o),l&&b(C,l),k.postMessage({event:"transmuxComplete",data:w},C)}function b(k,w){w.data1&&k.push(w.data1.buffer),w.data2&&k.push(w.data2.buffer)}function A(k,w,C){w.forEach(function(d){_(k,d)}),k.postMessage({event:"flush",data:C})}function I(k){return!k.audio&&!k.video&&!k.text&&!k.id3&&!k.initSegment}},"./src/demux/transmuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"isPromise",function(){return v}),O.d(Z,"TransmuxConfig",function(){return g}),O.d(Z,"TransmuxState",function(){return L});var J=O("./src/events.ts"),U=O("./src/errors.ts"),R=O("./src/crypt/decrypter.ts"),G=O("./src/demux/aacdemuxer.ts"),H=O("./src/demux/mp4demuxer.ts"),M=O("./src/demux/tsdemuxer.ts"),_=O("./src/demux/mp3demuxer.ts"),b=O("./src/remux/mp4-remuxer.ts"),A=O("./src/remux/passthrough-remuxer.ts"),I=O("./src/demux/chunk-cache.ts"),k=O("./src/utils/mp4-tools.ts"),w=O("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(E){w.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var d=[{demux:M.default,remux:b.default},{demux:H.default,remux:A.default},{demux:G.default,remux:b.default},{demux:_.default,remux:b.default}],o=1024;d.forEach(function(E){var p=E.demux;o=Math.max(o,p.minProbeByteLength)});var l=function(){function E(c,u,a,y,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new I.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=y,this.id=m}var p=E.prototype;return p.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},p.push=function(u,a,y,m){var x=this,B=y.transmuxing;B.executeStart=C();var W=new Uint8Array(u),V=this.cache,K=this.config,P=this.currentTransmuxState,N=this.transmuxConfig;m&&(this.currentTransmuxState=m);var $=h(W,a);if($&&$.method==="AES-128"){var ne=this.getDecrypter();if(K.enableSoftwareAES){var ue=ne.softwareDecrypt(W,$.key.buffer,$.iv.buffer);if(!ue)return B.executeEnd=C(),T(y);W=new Uint8Array(ue)}else return this.decryptionPromise=ne.webCryptoDecrypt(W,$.key.buffer,$.iv.buffer).then(function(be){var we=x.push(be,null,y);return x.decryptionPromise=null,we}),this.decryptionPromise}var me=m||P,ke=me.contiguous,xe=me.discontinuity,Re=me.trackSwitch,Se=me.accurateTimeOffset,Te=me.timeOffset,ye=N.audioCodec,z=N.videoCodec,s=N.defaultInitPts,f=N.duration,D=N.initSegmentData;if((xe||Re)&&this.resetInitSegment(D,ye,z,f),xe&&this.resetInitialTimestamp(s),ke||this.resetContiguity(),this.needsProbing(W,xe,Re)){if(V.dataLength){var X=V.flush();W=Object(k.appendUint8Array)(X,W)}this.configureTransmuxer(W,N)}var F=this.transmux(W,$,Te,Se,y),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,B.executeEnd=C(),F},p.flush=function(u){var a=this,y=u.transmuxing;y.executeStart=C();var m=this.decrypter,x=this.cache,B=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return a.flush(u)});var V=[],K=B.timeOffset;if(m){var P=m.flush();P&&V.push(this.push(P,null,u))}var N=x.dataLength;x.reset();var $=this.demuxer,ne=this.remuxer;if(!$||!ne)return N>=o&&this.observer.emit(J.Events.ERROR,J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=C(),[T(u)];var ue=$.flush(K);return v(ue)?ue.then(function(me){return a.flushRemux(V,me,u),V}):(this.flushRemux(V,ue,u),V)},p.flushRemux=function(u,a,y){var m=a.audioTrack,x=a.avcTrack,B=a.id3Track,W=a.textTrack,V=this.currentTransmuxState,K=V.accurateTimeOffset,P=V.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var N=this.remuxer.remux(m,x,B,W,P,K,!0,this.id);u.push({remuxResult:N,chunkMeta:y}),y.transmuxing.executeEnd=C()},p.resetInitialTimestamp=function(u){var a=this.demuxer,y=this.remuxer;if(!a||!y)return;a.resetTimeStamp(u),y.resetTimeStamp(u)},p.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(u,a,y,m){var x=this.demuxer,B=this.remuxer;if(!x||!B)return;x.resetInitSegment(a,y,m),B.resetInitSegment(u,a,y)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(u,a,y,m,x){var B;return a&&a.method==="SAMPLE-AES"?B=this.transmuxSampleAes(u,a,y,m,x):B=this.transmuxUnencrypted(u,y,m,x),B},p.transmuxUnencrypted=function(u,a,y,m){var x=this.demuxer.demux(u,a,!1,!this.config.progressive),B=x.audioTrack,W=x.avcTrack,V=x.id3Track,K=x.textTrack,P=this.remuxer.remux(B,W,V,K,a,y,!1,this.id);return{remuxResult:P,chunkMeta:m}},p.transmuxSampleAes=function(u,a,y,m,x){var B=this;return this.demuxer.demuxSampleAes(u,a,y).then(function(W){var V=B.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,y,m,!1,B.id);return{remuxResult:V,chunkMeta:x}})},p.configureTransmuxer=function(u,a){for(var y=this.config,m=this.observer,x=this.typeSupported,B=this.vendor,W=a.audioCodec,V=a.defaultInitPts,K=a.duration,P=a.initSegmentData,N=a.videoCodec,$,ne=0,ue=d.length;ne<ue;ne++)if(d[ne].demux.probe(u)){$=d[ne];break}$||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:H.default,remux:A.default});var me=this.demuxer,ke=this.remuxer,xe=$.remux,Re=$.demux;(!ke||!(ke instanceof xe))&&(this.remuxer=new xe(m,y,x,B)),(!me||!(me instanceof Re))&&(this.demuxer=new Re(m,y,x),this.probe=Re.probe),this.resetInitSegment(P,W,N,K),this.resetInitialTimestamp(V)},p.needsProbing=function(u,a,y){return!this.demuxer||!this.remuxer||a||y},p.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new R.default(this.observer,this.config)),u},E}();function h(E,p){var c=null;return E.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(c=p),c}var T=function(p){return{remuxResult:{},chunkMeta:p}};function v(E){return"then"in E&&E.then instanceof Function}var g=function(p,c,u,a,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=y},L=function(p,c,u,a,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"discardEPB",function(){return T});var J=O("./src/demux/adts.ts"),U=O("./src/demux/mpegaudio.ts"),R=O("./src/demux/exp-golomb.ts"),G=O("./src/demux/id3.ts"),H=O("./src/demux/sample-aes.ts"),M=O("./src/events.ts"),_=O("./src/utils/mp4-tools.ts"),b=O("./src/utils/logger.ts"),A=O("./src/errors.ts"),I={video:1,audio:2,id3:3,text:4},k=function(){function v(L,E,p){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=E,this.typeSupported=p}v.probe=function(E){var p=v.syncOffset(E);return p<0?!1:(p&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},v.syncOffset=function(E){for(var p=Math.min(1e3,E.length-3*188),c=0;c<p;){if(E[c]===71&&E[c+188]===71&&E[c+2*188]===71)return c;c++}return-1},v.createTrack=function(E,p){return{container:E==="video"||E==="audio"?"video/mp2t":void 0,type:E,id:I[E],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:E==="audio"?p:void 0}};var g=v.prototype;return g.resetInitSegment=function(E,p,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",c),this._audioTrack=v.createTrack("audio",c),this._id3Track=v.createTrack("id3",c),this._txtTrack=v.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=E,this.videoCodec=p,this._duration=c},g.resetTimeStamp=function(){},g.resetContiguity=function(){var E=this._audioTrack,p=this._avcTrack,c=this._id3Track;E&&(E.pesData=null),p&&(p.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(E,p,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,y=this._avcTrack,m=this._audioTrack,x=this._id3Track,B=y.pid,W=y.pesData,V=m.pid,K=x.pid,P=m.pesData,N=x.pesData,$=!1,ne=this.pmtParsed,ue=this._pmtId,me=E.length;if(this.remainderData&&(E=Object(_.appendUint8Array)(this.remainderData,E),me=E.length,this.remainderData=null),me<188&&!u)return this.remainderData=E,{audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};var ke=Math.max(0,v.syncOffset(E));me-=(me+ke)%188,me<E.byteLength&&!u&&(this.remainderData=new Uint8Array(E.buffer,me,E.buffer.byteLength-me));for(var xe=ke;xe<me;xe+=188)if(E[xe]===71){var Re=!!(E[xe+1]&64),Se=((E[xe+1]&31)<<8)+E[xe+2],Te=(E[xe+3]&48)>>4,ye=void 0;if(Te>1){if(ye=xe+5+E[xe+4],ye===xe+188)continue}else ye=xe+4;switch(Se){case B:Re&&(W&&(a=o(W))&&this.parseAVCPES(a,!1),W={data:[],size:0}),W&&(W.data.push(E.subarray(ye,xe+188)),W.size+=xe+188-ye);break;case V:Re&&(P&&(a=o(P))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(E.subarray(ye,xe+188)),P.size+=xe+188-ye);break;case K:Re&&(N&&(a=o(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(E.subarray(ye,xe+188)),N.size+=xe+188-ye);break;case 0:Re&&(ye+=E[ye]+1),ue=this._pmtId=C(E,ye);break;case ue:{Re&&(ye+=E[ye]+1);var z=d(E,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);B=z.avc,B>0&&(y.pid=B),V=z.audio,V>0&&(m.pid=V,m.isAAC=z.isAAC),K=z.id3,K>0&&(x.pid=K),$&&!ne&&(b.logger.log("reparse from beginning"),$=!1,xe=ke-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=W,m.pesData=P,x.pesData=N;var s={audioTrack:m,avcTrack:y,id3Track:x,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(s),s},g.flush=function(){var E=this.remainderData;this.remainderData=null;var p;return E?p=this.demux(E,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},g.extractRemainingSamples=function(E){var p=E.audioTrack,c=E.avcTrack,u=E.id3Track,a=c.pesData,y=p.pesData,m=u.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),c.pesData=null):c.pesData=a,y&&(x=o(y))?(p.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),p.pesData=null):(y!=null&&y.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=y),m&&(x=o(m))?(this.parseID3PES(x),u.pesData=null):u.pesData=m},g.demuxSampleAes=function(E,p,c){var u=this.demux(E,c,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,p);return this.decrypt(u,a)},g.decrypt=function(E,p){return new Promise(function(c){var u=E.audioTrack,a=E.avcTrack;u.samples&&u.isAAC?p.decryptAacSamples(u.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){c(E)}):c(E)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){c(E)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(E,p){var c=this,u=this._avcTrack,a=this.parseAVCNALu(E.data),y=!1,m=this.avcSample,x,B=!1;E.data=null,m&&a.length&&!u.audFound&&(l(m,u),m=this.avcSample=w(!1,E.pts,E.dts,"")),a.forEach(function(W){switch(W.type){case 1:{x=!0,m||(m=c.avcSample=w(!0,E.pts,E.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var V=W.data;if(B&&V.length>4){var K=new R.default(V).readSliceType();(K===2||K===4||K===7||K===9)&&(m.key=!0)}break}case 5:x=!0,m||(m=c.avcSample=w(!0,E.pts,E.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{x=!0,y&&m&&(m.debug+="SEI ");var P=new R.default(T(W.data));P.readUByte();for(var N=0,$=0,ne=!1,ue=0;!ne&&P.bytesAvailable>1;){N=0;do ue=P.readUByte(),N+=ue;while(ue===255);$=0;do ue=P.readUByte(),$+=ue;while(ue===255);if(N===4&&P.bytesAvailable!==0){ne=!0;var me=P.readUByte();if(me===181){var ke=P.readUShort();if(ke===49){var xe=P.readUInt();if(xe===1195456820){var Re=P.readUByte();if(Re===3){for(var Se=P.readUByte(),Te=P.readUByte(),ye=31&Se,z=[Se,Te],s=0;s<ye;s++)z.push(P.readUByte()),z.push(P.readUByte()),z.push(P.readUByte());h(c._txtTrack.samples,{type:3,pts:E.pts,bytes:z})}}}}}else if(N===5&&P.bytesAvailable!==0){if(ne=!0,$>16){for(var f=[],D=0;D<16;D++)f.push(P.readUByte().toString(16)),(D===3||D===5||D===7||D===9)&&f.push("-");for(var X=$-16,F=new Uint8Array(X),oe=0;oe<X;oe++)F[oe]=P.readUByte();h(c._txtTrack.samples,{pts:E.pts,payloadType:N,uuid:f.join(""),userData:Object(G.utf8ArrayToStr)(F),userDataBytes:F})}}else if($<P.bytesAvailable)for(var be=0;be<$;be++)P.readUByte()}break}case 7:if(x=!0,B=!0,y&&m&&(m.debug+="SPS "),!u.sps){var we=new R.default(W.data),Oe=we.readSPS();u.width=Oe.width,u.height=Oe.height,u.pixelRatio=Oe.pixelRatio,u.sps=[W.data],u.duration=c._duration;for(var Le=W.data.subarray(1,4),De="avc1.",_e=0;_e<3;_e++){var Ne=Le[_e].toString(16);Ne.length<2&&(Ne="0"+Ne),De+=Ne}u.codec=De}break;case 8:x=!0,y&&m&&(m.debug+="PPS "),u.pps||(u.pps=[W.data]);break;case 9:x=!1,u.audFound=!0,m&&l(m,u),m=c.avcSample=w(!1,E.pts,E.dts,y?"AUD ":"");break;case 12:x=!1;break;default:x=!1,m&&(m.debug+="unknown NAL "+W.type+" ");break}if(m&&x){var Ge=m.units;Ge.push(W)}}),p&&m&&(l(m,u),this.avcSample=null)},g.getLastNalUnit=function(){var E,p=this.avcSample,c;if(!p||p.units.length===0){var u=this._avcTrack.samples;p=u[u.length-1]}if((E=p)!==null&&E!==void 0&&E.units){var a=p.units;c=a[a.length-1]}return c},g.parseAVCNALu=function(E){var p=E.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,y=[],m=0,x,B,W,V=-1,K=0;for(u===-1&&(V=0,K=E[0]&31,u=0,m=1);m<p;){if(x=E[m++],!u){u=x?0:1;continue}if(u===1){u=x?0:2;continue}if(!x)u=3;else if(x===1){if(V>=0){var P={data:E.subarray(V,m-u-1),type:K};y.push(P)}else{var N=this.getLastNalUnit();if(N&&(a&&m<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),B=m-u-1,B>0)){var $=new Uint8Array(N.data.byteLength+B);$.set(N.data,0),$.set(E.subarray(0,B),N.data.byteLength),N.data=$,N.state=0}}m<p?(W=E[m]&31,V=m,K=W,u=0):u=-1}else u=0}if(V>=0&&u>=0){var ne={data:E.subarray(V,p),type:K,state:u};y.push(ne)}if(y.length===0){var ue=this.getLastNalUnit();if(ue){var me=new Uint8Array(ue.data.byteLength+E.byteLength);me.set(ue.data,0),me.set(E,ue.data.byteLength),ue.data=me}}return c.naluState=u,y},g.parseAACPES=function(E){var p=0,c=this._audioTrack,u=this.aacOverFlow,a=E.data;if(u){this.aacOverFlow=null;var y=u.sample.unit.byteLength,m=Math.min(u.missing,y),x=y-m;u.sample.unit.set(a.subarray(0,m),x),c.samples.push(u.sample),p=u.missing}var B,W;for(B=p,W=a.length;B<W-1&&!J.isHeader(a,B);B++);if(B!==p){var V,K;if(B<W-1?(V="AAC PES did not start with ADTS header,offset:"+B,K=!1):(V="no ADTS header found in AAC PES",K=!0),b.logger.warn("parsing error:"+V),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:V}),K)return}J.initTrackConfig(c,this.observer,a,B,this.audioCodec);var P;if(E.pts!==void 0)P=E.pts;else if(u){var N=J.getFrameDuration(c.samplerate);P=u.sample.pts+N}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;B<W;)if(J.isHeader(a,B)){if(B+5<W){var ne=J.appendFrame(c,a,B,P,$);if(ne)if(ne.missing)this.aacOverFlow=ne;else{B+=ne.length,$++;continue}}break}else B++},g.parseMPEGPES=function(E){var p=E.data,c=p.length,u=0,a=0,y=E.pts;if(y===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(U.isHeader(p,a)){var m=U.appendFrame(this._audioTrack,p,a,y,u);if(m)a+=m.length,u++;else break}else a++},g.parseID3PES=function(E){if(E.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(E)},v}();k.minProbeByteLength=188;function w(v,g,L,E){return{key:v,frame:!1,pts:g,dts:L,units:[],debug:E,length:0}}function C(v,g){return(v[g+10]&31)<<8|v[g+11]}function d(v,g,L,E){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(v[g+1]&15)<<8|v[g+2],u=g+3+c-4,a=(v[g+10]&15)<<8|v[g+11];for(g+=12+a;g<u;){var y=(v[g+1]&31)<<8|v[g+2];switch(v[g]){case 207:if(!E){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=y);break;case 21:p.id3===-1&&(p.id3=y);break;case 219:if(!E){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=y);break;case 3:case 4:L?p.audio===-1&&(p.audio=y,p.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((v[g+3]&15)<<8|v[g+4])+5}return p}function o(v){var g=0,L,E,p,c,u,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var y=new Uint8Array(a[0].length+a[1].length);y.set(a[0]),y.set(a[1],a[0].length),a[0]=y,a.splice(1,1)}L=a[0];var m=(L[0]<<16)+(L[1]<<8)+L[2];if(m===1){if(E=(L[4]<<8)+L[5],E&&E>v.size-6)return null;var x=L[7];x&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,x&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-u>60*9e4&&(b.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),p=L[8];var B=p+9;if(v.size<=B)return null;v.size-=B;for(var W=new Uint8Array(v.size),V=0,K=a.length;V<K;V++){L=a[V];var P=L.byteLength;if(B)if(B>P){B-=P;continue}else L=L.subarray(B),P-=B,B=0;W.set(L,g),g+=P}return E&&(E-=p+3),{data:W,pts:c,dts:u,len:E}}return null}function l(v,g){if(v.units.length&&v.frame){if(v.pts===void 0){var L=g.samples,E=L.length;if(E){var p=L[E-1];v.pts=p.pts,v.dts=p.dts}else{g.dropped++;return}}g.samples.push(v)}v.debug.length&&b.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function h(v,g){var L=v.length;if(L>0){if(g.pts>=v[L-1].pts)v.push(g);else for(var E=L-1;E>=0;E--)if(g.pts<v[E].pts){v.splice(E,0,g);break}}else v.push(g)}function T(v){for(var g=v.byteLength,L=[],E=1;E<g-2;)v[E]===0&&v[E+1]===0&&v[E+2]===3?(L.push(E+2),E+=2):E++;if(L.length===0)return v;var p=g-L.length,c=new Uint8Array(p),u=0;for(E=0;E<p;u++,E++)u===L[0]&&(u++,L.shift()),c[E]=v[u];return c}Z.default=k},"./src/errors.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"ErrorTypes",function(){return J}),O.d(Z,"ErrorDetails",function(){return U});var J;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(J||(J={}));var U;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"Events",function(){return J});var J;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(J||(J={}))},"./src/hls.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return v});var J=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(J),R=O("./src/loader/playlist-loader.ts"),G=O("./src/loader/key-loader.ts"),H=O("./src/controller/id3-track-controller.ts"),M=O("./src/controller/latency-controller.ts"),_=O("./src/controller/level-controller.ts"),b=O("./src/controller/fragment-tracker.ts"),A=O("./src/controller/stream-controller.ts"),I=O("./src/is-supported.ts"),k=O("./src/utils/logger.ts"),w=O("./src/config.ts"),C=O("./node_modules/eventemitter3/index.js"),d=O.n(C),o=O("./src/events.ts"),l=O("./src/errors.ts");function h(g,L){for(var E=0;E<L.length;E++){var p=L[E];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function T(g,L,E){return L&&h(g.prototype,L),E&&h(g,E),g}var v=function(){g.isSupported=function(){return Object(I.isSupported)()};function g(E){E===void 0&&(E={}),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 p=this.config=Object(w.mergeConfig)(g.DefaultConfig,E);this.userConfig=E,Object(k.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(w.enableStreamingMode)(p);var c=p.abrController,u=p.bufferController,a=p.capLevelController,y=p.fpsController,m=this.abrController=new c(this),x=this.bufferController=new u(this),B=this.capLevelController=new a(this),W=new y(this),V=new R.default(this),K=new G.default(this),P=new H.default(this),N=this.levelController=new _.default(this),$=new b.FragmentTracker(this),ne=this.streamController=new A.default(this,$);B.setStreamController(ne),W.setStreamController(ne);var ue=[N,ne];this.networkControllers=ue;var me=[V,K,m,x,B,W,P,$];this.audioTrackController=this.createController(p.audioTrackController,null,ue),this.createController(p.audioStreamController,$,ue),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,ue),this.createController(p.subtitleStreamController,$,ue),this.createController(p.timelineController,null,me),this.emeController=this.createController(p.emeController,null,me),this.cmcdController=this.createController(p.cmcdController,null,me),this.latencyController=this.createController(M.default,null,me),this.coreComponents=me}var L=g.prototype;return L.createController=function(p,c,u){if(p){var a=c?new p(this,c):new p(this);return u&&u.push(a),a}return null},L.on=function(p,c,u){u===void 0&&(u=this),this._emitter.on(p,c,u)},L.once=function(p,c,u){u===void 0&&(u=this),this._emitter.once(p,c,u)},L.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},L.off=function(p,c,u,a){u===void 0&&(u=this),this._emitter.off(p,c,u,a)},L.listeners=function(p){return this._emitter.listeners(p)},L.emit=function(p,c,u){return this._emitter.emit(p,c,u)},L.trigger=function(p,c){if(this.config.debug)return this.emit(p,p,c);try{return this.emit(p,p,c)}catch(u){k.logger.error("An internal error happened while handling event "+p+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:u})}return!1},L.listenerCount=function(p){return this._emitter.listenerCount(p)},L.destroy=function(){k.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},L.attachMedia=function(p){k.logger.log("attachMedia"),this._media=p,this.trigger(o.Events.MEDIA_ATTACHING,{media:p})},L.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(p){this.stopLoad();var c=this.media,u=this.url,a=this.url=J.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});k.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:p})},L.startLoad=function(p){p===void 0&&(p=-1),k.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(c){c.startLoad(p)})},L.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},L.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){k.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},L.removeLevel=function(p,c){c===void 0&&(c=0),this.levelController.removeLevel(p,c)},T(g,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){k.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){k.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){k.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){k.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){k.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var c=!!p;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(p){this._autoLevelCapping!==p&&(k.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,c=this.config.minAutoBitrate;if(!p)return 0;for(var u=p.length,a=0;a<u;a++)if(p[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,c=this.autoLevelCapping,u;return c===-1&&p&&p.length?u=p.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var c=this.audioTrackController;c&&(c.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:w.hlsDefaultConfig},set:function(p){g.defaultConfig=p}}]),g}();v.defaultConfig=void 0},"./src/is-supported.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isSupported",function(){return R}),O.d(Z,"changeTypeSupported",function(){return G});var J=O("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var H=Object(J.getMediaSource)();if(!H)return!1;var M=U(),_=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!_&&!!b}function G(){var H,M=U();return typeof(M==null||((H=M.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return k}),O.d(Z,"LoadError",function(){return C});var J=O("./src/polyfills/number.ts"),U=O("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,b(d,o)}function G(d){var o=typeof Map=="function"?new Map:void 0;return G=function(h){if(h===null||!_(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(h))return o.get(h);o.set(h,T)}function T(){return H(h,arguments,A(this).constructor)}return T.prototype=Object.create(h.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),b(T,h)},G(d)}function H(d,o,l){return M()?H=Reflect.construct:H=function(T,v,g){var L=[null];L.push.apply(L,v);var E=Function.bind.apply(T,L),p=new E;return g&&b(p,g.prototype),p},H.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function _(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function b(d,o){return b=Object.setPrototypeOf||function(h,T){return h.__proto__=T,h},b(d,o)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(d)}var I=Math.pow(2,17),k=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(h,T){var v=this,g=h.url;if(!g)return Promise.reject(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var L=this.config,E=L.fLoader,p=L.loader;return new Promise(function(c,u){v.loader&&v.loader.destroy();var a=v.loader=h.loader=E?new E(L):new p(L),y=w(h),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:I};h.stats=a.stats,a.load(y,m,{onSuccess:function(B,W,V,K){v.resetLoader(h,a),c({frag:h,part:null,payload:B.data,networkDetails:K})},onError:function(B,W,V){v.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:B,networkDetails:V}))},onAbort:function(B,W,V){v.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:V}))},onTimeout:function(B,W,V){v.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:V}))},onProgress:function(B,W,V,K){T&&T({frag:h,part:null,payload:V,networkDetails:K})}})})},o.loadPart=function(h,T,v){var g=this;this.abort();var L=this.config,E=L.fLoader,p=L.loader;return new Promise(function(c,u){g.loader&&g.loader.destroy();var a=g.loader=h.loader=E?new E(L):new p(L),y=w(h,T),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:I};T.stats=a.stats,a.load(y,m,{onSuccess:function(B,W,V,K){g.resetLoader(h,a),g.updateStatsFromPart(h,T);var P={frag:h,part:T,payload:B.data,networkDetails:K};v(P),c(P)},onError:function(B,W,V){g.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:T,response:B,networkDetails:V}))},onAbort:function(B,W,V){h.stats.aborted=T.stats.aborted,g.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:T,networkDetails:V}))},onTimeout:function(B,W,V){g.resetLoader(h,a),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:T,networkDetails:V}))}})})},o.updateStatsFromPart=function(h,T){var v=h.stats,g=T.stats,L=g.total;if(v.loaded+=g.loaded,L){var E=Math.round(h.duration/T.duration),p=Math.min(Math.round(v.loaded/L),E),c=E-p,u=c*Math.round(v.loaded/p);v.total=v.loaded+u}else v.total=Math.max(v.loaded,v.total);var a=v.loading,y=g.loading;a.start?a.first+=y.first-y.start:(a.start=y.start,a.first=y.first),a.end=y.end},o.resetLoader=function(h,T){h.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},d}();function w(d,o){o===void 0&&(o=null);var l=o||d,h={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},T=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(J.isFiniteNumber)(T)&&Object(J.isFiniteNumber)(v)&&(h.rangeStart=T,h.rangeEnd=v),h}var C=function(d){R(o,d);function o(l){for(var h,T=arguments.length,v=new Array(T>1?T-1:0),g=1;g<T;g++)v[g-1]=arguments[g];return h=d.call.apply(d,[this].concat(v))||this,h.data=void 0,h.data=l,h}return o}(G(Error))},"./src/loader/fragment.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"ElementaryStreamTypes",function(){return k}),O.d(Z,"BaseSegment",function(){return w}),O.d(Z,"Fragment",function(){return C}),O.d(Z,"Part",function(){return d});var J=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(U),G=O("./src/utils/logger.ts"),H=O("./src/loader/level-key.ts"),M=O("./src/loader/load-stats.ts");function _(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,b(o,l)}function b(o,l){return b=Object.setPrototypeOf||function(T,v){return T.__proto__=v,T},b(o,l)}function A(o,l){for(var h=0;h<l.length;h++){var T=l[h];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function I(o,l,h){return l&&A(o.prototype,l),h&&A(o,h),o}var k;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(k||(k={}));var w=function(){function o(h){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[k.AUDIO]=null,T[k.VIDEO]=null,T[k.AUDIOVIDEO]=null,T),this.baseurl=h}var l=o.prototype;return l.setByteRange=function(T,v){var g=T.split("@",2),L=[];g.length===1?L[0]=v?v.byteRangeEndOffset:0:L[0]=parseInt(g[1]),L[1]=parseInt(g[0])+L[0],this._byteRange=L},I(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),C=function(o){_(l,o);function l(T,v){var g;return g=o.call(this,v)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new M.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=T,g}var h=l.prototype;return h.createInitializationVector=function(v){for(var g=new Uint8Array(16),L=12;L<16;L++)g[L]=v>>8*(15-L)&255;return g},h.setDecryptDataFromLevelKey=function(v,g){var L=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(L=H.LevelKey.fromURI(v.uri),L.method=v.method,L.iv=this.createInitializationVector(g),L.keyFormat="identity"),L},h.setElementaryStreamInfo=function(v,g,L,E,p,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[v];if(!a){u[v]={startPTS:g,endPTS:L,startDTS:E,endDTS:p,partial:c};return}a.startPTS=Math.min(a.startPTS,g),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,E),a.endDTS=Math.max(a.endDTS,p)},h.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[k.AUDIO]=null,v[k.VIDEO]=null,v[k.AUDIOVIDEO]=null},I(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(J.isFiniteNumber)(this.programDateTime))return null;var v=Object(J.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(w),d=function(o){_(l,o);function l(h,T,v,g,L){var E;E=o.call(this,v)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new M.LoadStats,E.duration=h.decimalFloatingPoint("DURATION"),E.gap=h.bool("GAP"),E.independent=h.bool("INDEPENDENT"),E.relurl=h.enumeratedString("URI"),E.fragment=T,E.index=g;var p=h.enumeratedString("BYTERANGE");return p&&E.setByteRange(p,L),L&&(E.fragOffset=L.fragOffset+L.duration),E}return I(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),l}(w)},"./src/loader/key-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return G});var J=O("./src/events.ts"),U=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),G=function(){function H(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var M=H.prototype;return M._registerListeners=function(){this.hls.on(J.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(J.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var A=this.loaders[b];A&&A.destroy()}this.loaders={}},M.onKeyLoading=function(b,A){var I=A.frag,k=I.type,w=this.loaders[k];if(!I.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=I.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(w&&(R.logger.warn("abort previous key loader for type:"+k),w.abort()),!C){R.logger.warn("key uri is falsy");return}var o=d.loader,l=I.loader=this.loaders[k]=new o(d);this.decrypturl=C,this.decryptkey=null;var h={url:C,frag:I,responseType:"arraybuffer"},T={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,T,v)}else this.decryptkey&&(I.decryptdata.key=this.decryptkey,this.hls.trigger(J.Events.KEY_LOADED,{frag:I}))},M.loadsuccess=function(b,A,I){var k=I.frag;if(!k.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=k.decryptdata.key=new Uint8Array(b.data),k.loader=null,delete this.loaders[k.type],this.hls.trigger(J.Events.KEY_LOADED,{frag:k})},M.loaderror=function(b,A){var I=A.frag,k=I.loader;k&&k.abort(),delete this.loaders[I.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:I,response:b})},M.loadtimeout=function(b,A){var I=A.frag,k=I.loader;k&&k.abort(),delete this.loaders[I.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:I})},H}()},"./src/loader/level-details.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"LevelDetails",function(){return H});var J=O("./src/polyfills/number.ts");function U(M,_){for(var b=0;b<_.length;b++){var A=_[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(M,A.key,A)}}function R(M,_,b){return _&&U(M.prototype,_),b&&U(M,b),M}var G=10,H=function(){function M(b){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=b}var _=M.prototype;return _.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var I=this.lastPartSn-A.lastPartSn,k=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!k||!!I,this.advanced=this.endSN>A.endSN||I>0||I===0&&k>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},R(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(J.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var I=this.driftEnd-this.driftStart;return I*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"LevelKey",function(){return H});var J=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(J);function R(M,_){for(var b=0;b<_.length;b++){var A=_[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(M,A.key,A)}}function G(M,_,b){return _&&R(M.prototype,_),b&&R(M,b),M}var H=function(){M.fromURL=function(b,A){return new M(b,A)},M.fromURI=function(b){return new M(b)};function M(_,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(J.buildAbsoluteURL)(_,b,{alwaysNormalize:!0}):this._uri=_}return G(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"LoadStats",function(){return J});var J=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l});var J=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(U),G=O("./src/loader/fragment.ts"),H=O("./src/loader/level-details.ts"),M=O("./src/loader/level-key.ts"),_=O("./src/utils/attr-list.ts"),b=O("./src/utils/logger.ts"),A=O("./src/utils/codecs.ts"),I=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,k=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var E,p;return d.test((E=(p=U.parseURL(L))===null||p===void 0?void 0:p.path)!=null?E:"")}var l=function(){function L(){}return L.findGroup=function(p,c){for(var u=0;u<p.length;u++){var a=p[u];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(p){var c=p.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return p},L.resolve=function(p,c){return U.buildAbsoluteURL(c,p,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(p,c){var u=[],a={},y=!1;I.lastIndex=0;for(var m;(m=I.exec(p))!=null;)if(m[1]){var x=new _.AttrList(m[1]),B={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:L.resolve(m[2],c)},W=x.decimalResolution("RESOLUTION");W&&(B.width=W.width,B.height=W.height),h((x.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),B),B.videoCodec&&B.videoCodec.indexOf("avc1")!==-1&&(B.videoCodec=L.convertAVC1ToAVCOTI(B.videoCodec)),u.push(B)}else if(m[3]){var V=new _.AttrList(m[3]);V["DATA-ID"]&&(y=!0,a[V["DATA-ID"]]=V)}return{levels:u,sessionData:y?a:null}},L.parseMasterPlaylistMedia=function(p,c,u,a){a===void 0&&(a=[]);var y,m=[],x=0;for(k.lastIndex=0;(y=k.exec(p))!==null;){var B=new _.AttrList(y[1]);if(B.TYPE===u){var W={attrs:B,bitrate:0,id:x++,groupId:B["GROUP-ID"],instreamId:B["INSTREAM-ID"],name:B.NAME||B.LANGUAGE||"",type:u,default:B.bool("DEFAULT"),autoselect:B.bool("AUTOSELECT"),forced:B.bool("FORCED"),lang:B.LANGUAGE,url:B.URI?L.resolve(B.URI,c):""};if(a.length){var V=L.findGroup(a,W.groupId)||a[0];T(W,V,"audioCodec"),T(W,V,"textCodec")}m.push(W)}}return m},L.parseLevelPlaylist=function(p,c,u,a,y){var m=new H.LevelDetails(c),x=m.fragments,B=null,W=0,V=0,K=0,P=0,N=null,$=new G.Fragment(a,c),ne,ue,me,ke=-1,xe=!1;for(w.lastIndex=0,m.m3u8=p;(ne=w.exec(p))!==null;){xe&&(xe=!1,$=new G.Fragment(a,c),$.start=K,$.sn=W,$.cc=P,$.level=u,B&&($.initSegment=B,$.rawProgramDateTime=B.rawProgramDateTime));var Re=ne[1];if(Re){$.duration=parseFloat(Re);var Se=(" "+ne[2]).slice(1);$.title=Se||null,$.tagList.push(Se?["INF",Re,Se]:["INF",Re])}else if(ne[3])Object(J.isFiniteNumber)($.duration)&&($.start=K,me&&($.levelkey=me),$.sn=W,$.level=u,$.cc=P,$.urlId=y,x.push($),$.relurl=(" "+ne[3]).slice(1),g($,N),N=$,K+=$.duration,W++,V=0,xe=!0);else if(ne[4]){var Te=(" "+ne[4]).slice(1);N?$.setByteRange(Te,N):$.setByteRange(Te)}else if(ne[5])$.rawProgramDateTime=(" "+ne[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ke===-1&&(ke=x.length);else{if(ne=ne[0].match(C),!ne){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(ue=1;ue<ne.length&&!(typeof ne[ue]!="undefined");ue++);var ye=(" "+ne[ue]).slice(1),z=(" "+ne[ue+1]).slice(1),s=ne[ue+2]?(" "+ne[ue+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":m.type=z.toUpperCase();break;case"MEDIA-SEQUENCE":W=m.startSN=parseInt(z);break;case"SKIP":{var f=new _.AttrList(z),D=f.decimalInteger("SKIPPED-SEGMENTS");if(Object(J.isFiniteNumber)(D)){m.skippedSegments=D;for(var X=D;X--;)x.unshift(null);W+=D}var F=f.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(m.recentlyRemovedDateranges=F.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(z);break;case"VERSION":m.version=parseInt(z);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(z||s)&&$.tagList.push(s?[z,s]:[z]);break;case"DIS":P++;case"GAP":$.tagList.push([ye]);break;case"BITRATE":$.tagList.push([ye,z]);break;case"DISCONTINUITY-SEQ":P=parseInt(z);break;case"KEY":{var oe,be=new _.AttrList(z),we=be.enumeratedString("METHOD"),Oe=be.URI,Le=be.hexadecimalInteger("IV"),De=be.enumeratedString("KEYFORMATVERSIONS"),_e=be.enumeratedString("KEYID"),Ne=(oe=be.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Ge=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ge.indexOf(Ne)>-1){b.logger.warn("Keyformat "+Ne+" is not supported from the manifest");continue}else if(Ne!=="identity")continue;we&&(me=M.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(me.method=we,me.keyFormat=Ne,_e&&(me.keyID=_e),De&&(me.keyFormatVersions=De),me.iv=Le));break}case"START":{var He=new _.AttrList(z),ze=He.decimalFloatingPoint("TIME-OFFSET");Object(J.isFiniteNumber)(ze)&&(m.startTimeOffset=ze);break}case"MAP":{var nt=new _.AttrList(z);$.relurl=nt.URI,nt.BYTERANGE&&$.setByteRange(nt.BYTERANGE),$.level=u,$.sn="initSegment",me&&($.levelkey=me),$.initSegment=null,B=$,xe=!0;break}case"SERVER-CONTROL":{var Ye=new _.AttrList(z);m.canBlockReload=Ye.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Ye.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Ye.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Ye.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Ye.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new _.AttrList(z);m.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=m.partList;Pe||(Pe=m.partList=[]);var rt=V>0?Pe[Pe.length-1]:void 0,Qe=V++,se=new G.Part(new _.AttrList(z),$,c,Qe,rt);Pe.push(se),$.duration+=se.duration;break}case"PRELOAD-HINT":{var ee=new _.AttrList(z);m.preloadHint=ee;break}case"RENDITION-REPORT":{var q=new _.AttrList(z);m.renditionReports=m.renditionReports||[],m.renditionReports.push(q);break}default:b.logger.warn("line parsed but not handled: "+ne);break}}}N&&!N.relurl?(x.pop(),K-=N.duration,m.partList&&(m.fragmentHint=N)):m.partList&&(g($,N),$.cc=P,m.fragmentHint=$);var ae=x.length,le=x[0],te=x[ae-1];if(K+=m.skippedSegments*m.targetduration,K>0&&ae&&te){m.averagetargetduration=K/ae;var ie=te.sn;m.endSN=ie!=="initSegment"?ie:0,le&&(m.startCC=le.cc,le.initSegment||m.fragments.every(function(he){return he.relurl&&o(he.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,c),$.relurl=te.relurl,$.level=u,$.sn="initSegment",le.initSegment=$,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(K+=m.fragmentHint.duration),m.totalduration=K,m.endCC=P,ke>0&&v(x,ke),m},L}();function h(L,E){["video","audio","text"].forEach(function(p){var c=L.filter(function(a){return Object(A.isCodecType)(a,p)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});E[p+"Codec"]=u.length>0?u[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),E.unknownCodecs=L}function T(L,E,p){var c=E[p];c&&(L[p]=c)}function v(L,E){for(var p=L[E],c=E;c--;){var u=L[c];if(!u)return;u.programDateTime=p.programDateTime-u.duration*1e3,p=u}}function g(L,E){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):E!=null&&E.programDateTime&&(L.programDateTime=E.endProgramDateTime),Object(J.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),R=O("./src/errors.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/m3u8-parser.ts"),_=O("./src/types/loader.ts"),b=O("./src/utils/attr-list.ts");function A(w){var C=w.type;switch(C){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function I(w,C){var d=w.url;return(d===void 0||d.indexOf("data:")===0)&&(d=C.url),d}var k=function(){function w(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var C=w.prototype;return C.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.createInternalLoader=function(o){var l=this.hls.config,h=l.pLoader,T=l.loader,v=h||T,g=new v(l);return o.loader=g,this.loaders[o.type]=g,g},C.getInternalLoader=function(o){return this.loaders[o.type]},C.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},C.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(o,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},C.onLevelLoading=function(o,l){var h=l.id,T=l.level,v=l.url,g=l.deliveryDirectives;this.load({id:h,groupId:null,level:T,responseType:"text",type:_.PlaylistContextType.LEVEL,url:v,deliveryDirectives:g})},C.onAudioTrackLoading=function(o,l){var h=l.id,T=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:h,groupId:T,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:g})},C.onSubtitleTrackLoading=function(o,l){var h=l.id,T=l.groupId,v=l.url,g=l.deliveryDirectives;this.load({id:h,groupId:T,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:g})},C.load=function(o){var l,h=this.hls.config,T=this.getInternalLoader(o);if(T){var v=T.context;if(v&&v.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var g,L,E,p;switch(o.type){case _.PlaylistContextType.MANIFEST:g=h.manifestLoadingMaxRetry,L=h.manifestLoadingTimeOut,E=h.manifestLoadingRetryDelay,p=h.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:g=0,L=h.levelLoadingTimeOut;break;default:g=h.levelLoadingMaxRetry,L=h.levelLoadingTimeOut,E=h.levelLoadingRetryDelay,p=h.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===_.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===_.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===_.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(L=Math.min(Math.max(u*3,a*.8)*1e3,L))}}var y={timeout:L,maxRetry:g,retryDelay:E,maxRetryDelay:p,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,y,m)},C.loadsuccess=function(o,l,h,T){if(T===void 0&&(T=null),h.isSidxRequest){this.handleSidxRequest(o,h),this.handlePlaylistLoaded(o,l,h,T);return}this.resetInternalLoader(h.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,h,"no EXTM3U delimiter",T);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,h,T):this.handleMasterPlaylist(o,l,h,T)},C.loaderror=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,o)},C.loadtimeout=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},C.handleMasterPlaylist=function(o,l,h,T){var v=this.hls,g=o.data,L=I(o,h),E=M.default.parseMasterPlaylist(g,L),p=E.levels,c=E.sessionData;if(!p.length){this.handleManifestParsingError(o,h,"no level found in manifest",T);return}var u=p.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),a=p.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),y=M.default.parseMasterPlaylistMedia(g,L,"AUDIO",u),m=M.default.parseMasterPlaylistMedia(g,L,"SUBTITLES",a),x=M.default.parseMasterPlaylistMedia(g,L,"CLOSED-CAPTIONS");if(y.length){var B=y.some(function(W){return!W.url});!B&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:p,audioTracks:y,subtitles:m,captions:x,url:L,stats:l,networkDetails:T,sessionData:c})},C.handleTrackOrLevelPlaylist=function(o,l,h,T){var v=this.hls,g=h.id,L=h.level,E=h.type,p=I(o,h),c=Object(J.isFiniteNumber)(g)?g:0,u=Object(J.isFiniteNumber)(L)?L:c,a=A(h),y=M.default.parseLevelPlaylist(o.data,p,u,a,c);if(!y.fragments.length){v.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(E===_.PlaylistContextType.MANIFEST){var m={attrs:new b.AttrList({}),bitrate:0,details:y,name:"",url:p};v.trigger(U.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:p,stats:l,networkDetails:T,sessionData:null})}if(l.parsing.end=performance.now(),y.needSidxRanges){var x,B=(x=y.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:B,isSidxRequest:!0,type:E,level:L,levelDetails:y,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=y,this.handlePlaylistLoaded(o,l,h,T)},C.handleSidxRequest=function(o,l){var h=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!h)return;var T=h.references,v=l.levelDetails;T.forEach(function(g,L){var E=g.info,p=v.fragments[L];p.byteRange.length===0&&p.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),p.initSegment&&p.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(o,l,h,T){this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===_.PlaylistContextType.MANIFEST,url:o.url,reason:h,response:o,context:l,networkDetails:T})},C.handleNetworkError=function(o,l,h,T){h===void 0&&(h=!1),G.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=R.ErrorDetails.UNKNOWN,g=!1,L=this.getInternalLoader(o);switch(o.type){case _.PlaylistContextType.MANIFEST:v=h?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case _.PlaylistContextType.LEVEL:v=h?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case _.PlaylistContextType.AUDIO_TRACK:v=h?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:v=h?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}L&&this.resetInternalLoader(o.type);var E={type:R.ErrorTypes.NETWORK_ERROR,details:v,fatal:g,url:o.url,loader:L,context:o,networkDetails:l};T&&(E.response=T),this.hls.trigger(U.Events.ERROR,E)},C.handlePlaylistLoaded=function(o,l,h,T){var v=h.type,g=h.level,L=h.id,E=h.groupId,p=h.loader,c=h.levelDetails,u=h.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,h,"invalid target duration",T);return}if(!p)return;c.live&&(p.getCacheAge&&(c.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(v){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:g||0,id:L||0,stats:l,networkDetails:T,deliveryDirectives:u});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:E||"",stats:l,networkDetails:T,deliveryDirectives:u});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:E||"",stats:l,networkDetails:T,deliveryDirectives:u});break}},w}();Z.default=k},"./src/polyfills/number.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isFiniteNumber",function(){return J}),O.d(Z,"MAX_SAFE_INTEGER",function(){return U});var J=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(fe,Z,O){"use strict";O.r(Z);var J=function(){function U(){}return U.getSilentFrame=function(G,H){switch(G){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(H===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(H===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();Z.default=J},"./src/remux/mp4-generator.ts":function(fe,Z,O){"use strict";O.r(Z);var J=Math.pow(2,32)-1,U=function(){function R(){}return R.init=function(){R.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 R.types)R.types.hasOwnProperty(H)&&(R.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=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]);R.HDLR_TYPES={video:M,audio:_};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=A,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var I=new Uint8Array([105,115,111,109]),k=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,I,w,I,k),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,b))},R.box=function(H){for(var M=8,_=arguments.length,b=new Array(_>1?_-1:0),A=1;A<_;A++)b[A-1]=arguments[A];for(var I=b.length,k=I;I--;)M+=b[I].byteLength;var w=new Uint8Array(M);for(w[0]=M>>24&255,w[1]=M>>16&255,w[2]=M>>8&255,w[3]=M&255,w.set(H,4),I=0,M=8;I<k;I++)w.set(b[I],M),M+=b[I].byteLength;return w},R.hdlr=function(H){return R.box(R.types.hdlr,R.HDLR_TYPES[H])},R.mdat=function(H){return R.box(R.types.mdat,H)},R.mdhd=function(H,M){M*=H;var _=Math.floor(M/(J+1)),b=Math.floor(M%(J+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,_>>24,_>>16&255,_>>8&255,_&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},R.mdia=function(H){return R.box(R.types.mdia,R.mdhd(H.timescale,H.duration),R.hdlr(H.type),R.minf(H))},R.mfhd=function(H){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},R.minf=function(H){return H.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(H)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(H))},R.moof=function(H,M,_){return R.box(R.types.moof,R.mfhd(H),R.traf(_,M))},R.moov=function(H){for(var M=H.length,_=[];M--;)_[M]=R.trak(H[M]);return R.box.apply(null,[R.types.moov,R.mvhd(H[0].timescale,H[0].duration)].concat(_).concat(R.mvex(H)))},R.mvex=function(H){for(var M=H.length,_=[];M--;)_[M]=R.trex(H[M]);return R.box.apply(null,[R.types.mvex].concat(_))},R.mvhd=function(H,M){M*=H;var _=Math.floor(M/(J+1)),b=Math.floor(M%(J+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,_>>24,_>>16&255,_>>8&255,_&255,b>>24,b>>16&255,b>>8&255,b&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 R.box(R.types.mvhd,A)},R.sdtp=function(H){var M=H.samples||[],_=new Uint8Array(4+M.length),b,A;for(b=0;b<M.length;b++)A=M[b].flags,_[b+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return R.box(R.types.sdtp,_)},R.stbl=function(H){return R.box(R.types.stbl,R.stsd(H),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(H){var M=[],_=[],b,A,I;for(b=0;b<H.sps.length;b++)A=H.sps[b],I=A.byteLength,M.push(I>>>8&255),M.push(I&255),M=M.concat(Array.prototype.slice.call(A));for(b=0;b<H.pps.length;b++)A=H.pps[b],I=A.byteLength,_.push(I>>>8&255),_.push(I&255),_=_.concat(Array.prototype.slice.call(A));var k=R.box(R.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|H.sps.length].concat(M).concat([H.pps.length]).concat(_))),w=H.width,C=H.height,d=H.pixelRatio[0],o=H.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&255,C>>8&255,C&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),k,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(H){var M=H.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(H.config).concat([6,1,2]))},R.mp4a=function(H){var M=H.samplerate;return R.box(R.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,M>>8&255,M&255,0,0]),R.box(R.types.esds,R.esds(H)))},R.mp3=function(H){var M=H.samplerate;return R.box(R.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,M>>8&255,M&255,0,0]))},R.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(H)):R.box(R.types.stsd,R.STSD,R.mp4a(H)):R.box(R.types.stsd,R.STSD,R.avc1(H))},R.tkhd=function(H){var M=H.id,_=H.duration*H.timescale,b=H.width,A=H.height,I=Math.floor(_/(J+1)),k=Math.floor(_%(J+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,b>>8&255,b&255,0,0,A>>8&255,A&255,0,0]))},R.traf=function(H,M){var _=R.sdtp(H),b=H.id,A=Math.floor(M/(J+1)),I=Math.floor(M%(J+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,I>>24,I>>16&255,I>>8&255,I&255])),R.trun(H,_.length+16+20+8+16+8+8),_)},R.trak=function(H){return H.duration=H.duration||4294967295,R.box(R.types.trak,R.tkhd(H),R.mdia(H))},R.trex=function(H){var M=H.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(H,M){var _=H.samples||[],b=_.length,A=12+16*b,I=new Uint8Array(A),k,w,C,d,o,l;for(M+=8+A,I.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),k=0;k<b;k++)w=_[k],C=w.duration,d=w.size,o=w.flags,l=w.cts,I.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*k);return R.box(R.types.trun,I)},R.initSegment=function(H){R.types||R.init();var M=R.moov(H),_=new Uint8Array(R.FTYP.byteLength+M.byteLength);return _.set(R.FTYP),_.set(M,R.FTYP.byteLength),_},R}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,Z.default=U},"./src/remux/mp4-remuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"normalizePts",function(){return h});var J=O("./src/polyfills/number.ts"),U=O("./src/remux/aac-helper.ts"),R=O("./src/remux/mp4-generator.ts"),G=O("./src/events.ts"),H=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),_=O("./src/types/loader.ts"),b=O("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(L){for(var E=1;E<arguments.length;E++){var p=arguments[E];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(L[c]=p[c])}return L},A.apply(this,arguments)}var I=10*1e3,k=1024,w=1152,C=null,d=null,o=!1,l=function(){function L(p,c,u,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=p,this.config=c,this.typeSupported=u,this.ISGenerated=!1,C===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);C=m?parseInt(m[1]):0}if(d===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);d=x?parseInt(x[1]):0}o=!!C&&C<75||!!d&&d<600}var E=L.prototype;return E.destroy=function(){},E.resetTimeStamp=function(c){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},E.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},E.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},E.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(y,m){var x=m.pts-y;return x<-4294967296?(u=!0,h(y,m.pts)):x>0?y:m.pts},c[0].pts);return u&&M.logger.debug("PTS rollover detected"),a},E.remux=function(c,u,a,y,m,x,B,W){var V,K,P,N,$,ne,ue=m,me=m,ke=c.pid>-1,xe=u.pid>-1,Re=u.samples.length,Se=c.samples.length>0,Te=Re>1,ye=(!ke||Se)&&(!xe||Te)||this.ISGenerated||B;if(ye){this.ISGenerated||(P=this.generateIS(c,u,m));var z=this.isVideoContiguous,s=-1;if(Te&&(s=T(u.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,s>0){M.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+Re+" video samples due to a missing keyframe");var f=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(s),u.dropped+=s,me+=(u.samples[0].pts-f)/(u.timescale||9e4)}else s===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Re+" video samples"),ne=!1);if(this.ISGenerated){if(Se&&Te){var D=this.getVideoStartPts(u.samples),X=h(c.samples[0].pts,D)-D,F=X/u.inputTimeScale;ue+=Math.max(0,F),me+=Math.max(0,-F)}if(Se){if(c.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(c,u,m)),K=this.remuxAudio(c,ue,this.isAudioContiguous,x,xe||Te||W===_.PlaylistLevelType.AUDIO?me:void 0),Te){var oe=K?K.endPTS-K.startPTS:0;u.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(c,u,m)),V=this.remuxVideo(u,me,z,oe)}}else Te&&(V=this.remuxVideo(u,me,z,0));V&&(V.firstKeyFrame=s,V.independent=s!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,m)),y.samples.length&&(N=this.remuxText(y,m))),{audio:K,video:V,initSegment:P,independent:ne,text:N,id3:$}},E.generateIS=function(c,u,a){var y=c.samples,m=u.samples,x=this.typeSupported,B={},W=!Object(J.isFiniteNumber)(this._initPTS),V="audio/mp4",K,P,N;if(W&&(K=P=Infinity),c.config&&y.length&&(c.timescale=c.samplerate,c.isAAC||(x.mpeg?(V="audio/mpeg",c.codec=""):x.mp3&&(c.codec="mp3")),B.audio={id:"audio",container:V,codec:c.codec,initSegment:!c.isAAC&&x.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},W&&(N=c.inputTimeScale,K=P=y[0].pts-Math.round(N*a))),u.sps&&u.pps&&m.length&&(u.timescale=u.inputTimeScale,B.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:R.default.initSegment([u]),metadata:{width:u.width,height:u.height}},W)){N=u.inputTimeScale;var $=this.getVideoStartPts(m),ne=Math.round(N*a);P=Math.min(P,h(m[0].dts,$)-ne),K=Math.min(K,$-ne)}if(Object.keys(B).length)return this.ISGenerated=!0,W&&(this._initPTS=K,this._initDTS=P),{tracks:B,initPTS:K,timescale:N}},E.remuxVideo=function(c,u,a,y){var m=c.inputTimeScale,x=c.samples,B=[],W=x.length,V=this._initPTS,K=this.nextAvcDts,P=8,N,$,ne,ue=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,ke=0,xe=!1;if(!a||K===null){var Re=u*m,Se=x[0].pts-h(x[0].dts,x[0].pts);K=Re-Se}for(var Te=0;Te<W;Te++){var ye=x[Te];if(ye.pts=h(ye.pts-V,K),ye.dts=h(ye.dts-V,K),ye.dts>ye.pts){var z=9e4*.2;ke=Math.max(Math.min(ke,ye.pts-ye.dts),-1*z)}ye.dts<x[Te>0?Te-1:Te].dts&&(xe=!0)}xe&&x.sort(function(vt,ot){var it=vt.dts-ot.dts,wt=vt.pts-ot.pts;return it||wt}),$=x[0].dts,ne=x[x.length-1].dts;var s=Math.round((ne-$)/(W-1));if(ke<0){if(ke<s*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-s,!0)+" ms");for(var f=ke,D=0;D<W;D++)x[D].dts=f=Math.max(f,x[D].pts-s),x[D].pts=Math.max(f,x[D].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var X=0;X<W;X++)x[X].dts=x[X].dts+ke}$=x[0].dts}if(a){var F=$-K,oe=F>s,be=F<-1;if(oe||be){oe?M.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(F,!0)+" ms ("+F+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-F,!0)+" ms ("+F+"dts) overlapping between fragments detected"),$=K;var we=x[0].pts-F;x[0].dts=$,x[0].pts=we,M.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(we,!0)+"/"+Object(b.toMsFromMpegTsClock)($,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(F,!0)+" ms")}}o&&($=Math.max(0,$));for(var Oe=0,Le=0,De=0;De<W;De++){for(var _e=x[De],Ne=_e.units,Ge=Ne.length,He=0,ze=0;ze<Ge;ze++)He+=Ne[ze].data.length;Le+=He,Oe+=Ge,_e.length=He,_e.dts=Math.max(_e.dts,$),_e.pts=Math.max(_e.pts,_e.dts,0),ue=Math.min(_e.pts,ue),me=Math.max(_e.pts,me)}ne=x[W-1].dts;var nt=Le+4*Oe+8,Ye;try{Ye=new Uint8Array(nt)}catch(vt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:nt,reason:"fail allocating video mdat "+nt});return}var Xe=new DataView(Ye.buffer);Xe.setUint32(0,nt),Ye.set(R.default.types.mdat,4);for(var Pe=0;Pe<W;Pe++){for(var rt=x[Pe],Qe=rt.units,se=0,ee=0,q=Qe.length;ee<q;ee++){var ae=Qe[ee],le=ae.data,te=ae.data.byteLength;Xe.setUint32(P,te),P+=4,Ye.set(le,P),P+=te,se+=4+te}if(Pe<W-1)N=x[Pe+1].dts-rt.dts;else{var ie=this.config,he=rt.dts-x[Pe>0?Pe-1:Pe].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var ce=Math.floor(ie.maxBufferHole*m),ve=(y?ue+y*m:this.nextAudioPts)-rt.pts;ve>ce?(N=ve-he,N<0&&(N=he),M.logger.log("[mp4-remuxer]: It is approximately "+ve/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=he}else N=he}var Ee=Math.round(rt.pts-rt.dts);B.push(new v(rt.key,N,se,Ee))}if(B.length&&C&&C<70){var Me=B[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=ne+N,this.isVideoContiguous=!0;var We=R.default.moof(c.sequenceNumber++,$,A({},c,{samples:B})),qe="video",tt={data1:We,data2:Ye,startPTS:ue/m,endPTS:(me+N)/m,startDTS:$/m,endDTS:K/m,type:qe,hasAudio:!1,hasVideo:!0,nb:B.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ye.length,"MDAT length must not be zero"),tt},E.remuxAudio=function(c,u,a,y,m){var x=c.inputTimeScale,B=c.samplerate?c.samplerate:x,W=x/B,V=c.isAAC?k:w,K=V*W,P=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,$=[],ne=c.samples,ue=N?0:8,me=this.nextAudioPts||-1,ke=u*x;if(this.isAudioContiguous=a=a||ne.length&&me>0&&(y&&Math.abs(ke-me)<9e3||Math.abs(h(ne[0].pts-P,ke)-me)<20*K),ne.forEach(function(le){le.pts=h(le.pts-P,ke)}),!a||me<0){if(ne=ne.filter(function(le){return le.pts>=0}),!ne.length)return;m===0?me=0:y?me=Math.max(0,ke):me=ne[0].pts}if(c.isAAC)for(var xe=m!==void 0,Re=this.config.maxAudioFramesDrift,Se=0,Te=me;Se<ne.length;Se++){var ye=ne[Se],z=ye.pts,s=z-Te,f=Math.abs(1e3*s/x);if(s<=-Re*K&&xe)Se===0&&(M.logger.warn("Audio frame @ "+(z/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*s/x)+" ms."),this.nextAudioPts=me=Te=z);else if(s>=Re*K&&f<I&&xe){var D=Math.round(s/K);Te=z-D*K,Te<0&&(D--,Te+=K),Se===0&&(this.nextAudioPts=me=Te),M.logger.warn("[mp4-remuxer]: Injecting "+D+" audio frame @ "+(Te/x).toFixed(3)+"s due to "+Math.round(1e3*s/x)+" ms gap.");for(var X=0;X<D;X++){var F=Math.max(Te,0),oe=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);oe||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=ye.unit.subarray()),ne.splice(Se,0,{unit:oe,pts:F}),Te+=K,Se++}}ye.pts=Te,Te+=K}for(var be=null,we=null,Oe,Le=0,De=ne.length;De--;)Le+=ne[De].unit.byteLength;for(var _e=0,Ne=ne.length;_e<Ne;_e++){var Ge=ne[_e],He=Ge.unit,ze=Ge.pts;if(we!==null){var nt=$[_e-1];nt.duration=Math.round((ze-we)/W)}else if(a&&c.isAAC&&(ze=me),be=ze,Le>0){Le+=ue;try{Oe=new Uint8Array(Le)}catch(le){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Le,reason:"fail allocating audio mdat "+Le});return}if(!N){var Ye=new DataView(Oe.buffer);Ye.setUint32(0,Le),Oe.set(R.default.types.mdat,4)}}else return;Oe.set(He,ue);var Xe=He.byteLength;ue+=Xe,$.push(new v(!0,V,Xe,0)),we=ze}var Pe=$.length;if(!Pe)return;var rt=$[$.length-1];this.nextAudioPts=me=we+W*rt.duration;var Qe=N?new Uint8Array(0):R.default.moof(c.sequenceNumber++,be/W,A({},c,{samples:$}));c.samples=[];var se=be/x,ee=me/x,q="audio",ae={data1:Qe,data2:Oe,startPTS:se,endPTS:ee,startDTS:se,endDTS:ee,type:q,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ae},E.remuxEmptyAudio=function(c,u,a,y){var m=c.inputTimeScale,x=c.samplerate?c.samplerate:m,B=m/x,W=this.nextAudioPts,V=(W!==null?W:y.startDTS*m)+this._initDTS,K=y.endDTS*m+this._initDTS,P=B*k,N=Math.ceil((K-V)/P),$=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ne=[],ue=0;ue<N;ue++){var me=V+ue*P;ne.push({unit:$,pts:me,dts:me})}return c.samples=ne,this.remuxAudio(c,u,a,!1)},E.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var y=c.inputTimeScale,m=this._initPTS,x=this._initDTS,B=0;B<a;B++){var W=c.samples[B];W.pts=h(W.pts-m,u*y)/y,W.dts=h(W.dts-x,u*y)/y}var V=c.samples;return c.samples=[],{samples:V}},E.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var y=c.inputTimeScale,m=this._initPTS,x=0;x<a;x++){var B=c.samples[x];B.pts=h(B.pts-m,u*y)/y}c.samples.sort(function(V,K){return V.pts-K.pts});var W=c.samples;return c.samples=[],{samples:W}},L}();function h(L,E){var p;if(E===null)return L;for(E<L?p=-8589934592:p=8589934592;Math.abs(L-E)>4294967296;)L+=p;return L}function T(L){for(var E=0;E<L.length;E++)if(L[E].key)return E;return-1}var v=function(E,p,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=c,this.cts=u,this.flags=new g(E)},g=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},"./src/remux/passthrough-remuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/utils/mp4-tools.ts"),R=O("./src/loader/fragment.ts"),G=O("./src/utils/logger.ts"),H=function(){function b(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=b.prototype;return A.destroy=function(){},A.resetTimeStamp=function(k){this.initPTS=k,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(k,w,C){this.audioCodec=w,this.videoCodec=C,this.generateInitSegment(k),this.emitInitSegment=!0},A.generateInitSegment=function(k){var w=this.audioCodec,C=this.videoCodec;if(!k||!k.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(k);w||(w=_(d.audio,R.ElementaryStreamTypes.AUDIO)),C||(C=_(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:w+","+C,initSegment:k,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:w,initSegment:k,id:"audio"}:d.video?o.video={container:"video/mp4",codec:C,initSegment:k,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(k,w,C,d,o){var l=this.initPTS,h=this.lastEndDTS,T={audio:void 0,video:void 0,text:d,id3:C,initSegment:void 0};Object(J.isFiniteNumber)(h)||(h=this.lastEndDTS=o||0);var v=w.samples;if(!v||!v.length)return T;var g={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(v),L=this.initData),!L||!L.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(J.isFiniteNumber)(l)||(this.initPTS=g.initPTS=l=M(L,v,h));var E=Object(U.getDuration)(v,L),p=h,c=E+p;Object(U.offsetStartDTS)(L,v,l),E>0?this.lastEndDTS=c:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,a=!!L.video,y="";u&&(y+="audio"),a&&(y+="video");var m={data1:v,startPTS:p,startDTS:p,endPTS:c,endDTS:c,type:y,hasAudio:u,hasVideo:a,nb:1,dropped:0};return T.audio=m.type==="audio"?m:void 0,T.video=m.type!=="audio"?m:void 0,T.text=d,T.id3=C,T.initSegment=g,T},b}(),M=function(A,I,k){return Object(U.getStartDTS)(A,I)-k};function _(b,A){var I=b==null?void 0:b.codec;return I&&I.length>4?I:I==="hvc1"?"hvc1.1.c.L120.90":I==="av01"?"av01.0.04M.08":I==="avc1"||A===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=H},"./src/task-loop.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=U.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},U}()},"./src/types/cmcd.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"CMCDVersion",function(){return J}),O.d(Z,"CMCDObjectType",function(){return U}),O.d(Z,"CMCDStreamingFormat",function(){return R}),O.d(Z,"CMCDStreamType",function(){return G});var J=1,U;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(U||(U={}));var R;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(R||(R={}));var G;(function(H){H.VOD="v",H.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"HlsSkip",function(){return R}),O.d(Z,"getSkipValue",function(){return G}),O.d(Z,"HlsUrlParameters",function(){return H}),O.d(Z,"Level",function(){return M});function J(_,b){for(var A=0;A<b.length;A++){var I=b[A];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(_,I.key,I)}}function U(_,b,A){return b&&J(_.prototype,b),A&&J(_,A),_}var R;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(R||(R={}));function G(_,b){var A=_.canSkipUntil,I=_.canSkipDateRanges,k=_.endSN,w=b!==void 0?b-k:0;return A&&w<A?I?R.v2:R.Yes:R.No}var H=function(){function _(A,I,k){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=I,this.skip=k}var b=_.prototype;return b.addDirectives=function(I){var k=new self.URL(I);return this.msn!==void 0&&k.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&k.searchParams.set("_HLS_part",this.part.toString()),this.skip&&k.searchParams.set("_HLS_skip",this.skip),k.toString()},_}(),M=function(){function _(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(_,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var I=A%this.url.length;this._urlId!==I&&(this.details=void 0,this._urlId=I)}}]),_}()},"./src/types/loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"PlaylistContextType",function(){return J}),O.d(Z,"PlaylistLevelType",function(){return U});var J;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(J||(J={}));var U;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"ChunkMetadata",function(){return J});var J=function(G,H,M,_,b,A){_===void 0&&(_=0),b===void 0&&(b=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=G,this.sn=H,this.id=M,this.size=_,this.part=b,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"AttrList",function(){return R});var J=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function G(M){typeof M=="string"&&(M=G.parseAttrList(M));for(var _ in M)M.hasOwnProperty(_)&&(this[_]=M[_])}var H=G.prototype;return H.decimalInteger=function(_){var b=parseInt(this[_],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.hexadecimalInteger=function(_){if(this[_]){var b=(this[_]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var A=new Uint8Array(b.length/2),I=0;I<b.length/2;I++)A[I]=parseInt(b.slice(I*2,I*2+2),16);return A}else return null},H.hexadecimalIntegerAsNumber=function(_){var b=parseInt(this[_],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.decimalFloatingPoint=function(_){return parseFloat(this[_])},H.optionalFloat=function(_,b){var A=this[_];return A?parseFloat(A):b},H.enumeratedString=function(_){return this[_]},H.bool=function(_){return this[_]==="YES"},H.decimalResolution=function(_){var b=J.exec(this[_]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},G.parseAttrList=function(_){var b,A={},I='"';for(U.lastIndex=0;(b=U.exec(_))!==null;){var k=b[2];k.indexOf(I)===0&&k.lastIndexOf(I)===k.length-1&&(k=k.slice(1,-1)),A[b[1]]=k}return A},G}()},"./src/utils/binary-search.ts":function(fe,Z,O){"use strict";O.r(Z);var J={search:function(R,G){for(var H=0,M=R.length-1,_=null,b=null;H<=M;){_=(H+M)/2|0,b=R[_];var A=G(b);if(A>0)H=_+1;else if(A<0)M=_-1;else return b}return null}};Z.default=J},"./src/utils/buffer-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"BufferHelper",function(){return R});var J=O("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function G(){}return G.isBuffered=function(M,_){try{if(M){for(var b=G.getBuffered(M),A=0;A<b.length;A++)if(_>=b.start(A)&&_<=b.end(A))return!0}}catch(I){}return!1},G.bufferInfo=function(M,_,b){try{if(M){var A=G.getBuffered(M),I=[],k;for(k=0;k<A.length;k++)I.push({start:A.start(k),end:A.end(k)});return this.bufferedInfo(I,_,b)}}catch(w){}return{len:0,start:_,end:_,nextStart:void 0}},G.bufferedInfo=function(M,_,b){_=Math.max(0,_),M.sort(function(g,L){var E=g.start-L.start;return E||L.end-g.end});var A=[];if(b)for(var I=0;I<M.length;I++){var k=A.length;if(k){var w=A[k-1].end;M[I].start-w<b?M[I].end>w&&(A[k-1].end=M[I].end):A.push(M[I])}else A.push(M[I])}else A=M;for(var C=0,d,o=_,l=_,h=0;h<A.length;h++){var T=A[h].start,v=A[h].end;if(_+b>=T&&_<v)o=T,l=v,C=l-_;else if(_+b<T){d=T;break}}return{len:C,start:o||0,end:l||0,nextStart:d}},G.getBuffered=function(M){try{return M.buffered}catch(_){return J.logger.log("failed to get media.buffered",_),U}},G}()},"./src/utils/cea-608-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"Row",function(){return l}),O.d(Z,"CaptionScreen",function(){return h});var J=O("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(c){var u=c;return U.hasOwnProperty(c)&&(u=U[c]),String.fromCharCode(u)},G=15,H=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},I=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],k;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(k||(k={}));var w=function(){function p(){this.time=null,this.verboseLevel=k.ERROR}var c=p.prototype;return c.log=function(a,y){this.verboseLevel>=a&&J.logger.log(this.time+" ["+a+"] "+y)},p}(),C=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},d=function(){function p(u,a,y,m,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=y||!1,this.background=m||"black",this.flash=x||!1}var c=p.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var x=y[m];a.hasOwnProperty(x)&&(this[x]=a[x])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},p}(),o=function(){function p(u,a,y,m,x,B){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(a,y,m,x,B)}var c=p.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,y){this.uchar=a,this.penState.copy(y)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},p}(),l=function(){function p(u){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=u,this.pos=0,this.currPenState=new d}var c=p.prototype;return c.equals=function(a){for(var y=!0,m=0;m<H;m++)if(!this.chars[m].equals(a.chars[m])){y=!1;break}return y},c.copy=function(a){for(var y=0;y<H;y++)this.chars[y].copy(a.chars[y])},c.isEmpty=function(){for(var a=!0,y=0;y<H;y++)if(!this.chars[y].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(k.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(k.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},c.moveCursor=function(a){var y=this.pos+a;if(a>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var y=R(a);if(this.pos>=H){this.logger.log(k.ERROR,"Cannot insert "+a.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var y;for(y=a;y<H;y++)this.chars[y].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],y=!0,m=0;m<H;m++){var x=this.chars[m].uchar;x!==" "&&(y=!1),a.push(x)}return y?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var y=this.chars[this.pos];y.setPenState(this.currPenState)},p}(),h=function(){function p(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new l(u));this.logger=u,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=p.prototype;return c.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},c.equals=function(a){for(var y=!0,m=0;m<G;m++)if(!this.rows[m].equals(a.rows[m])){y=!1;break}return y},c.copy=function(a){for(var y=0;y<G;y++)this.rows[y].copy(a.rows[y])},c.isEmpty=function(){for(var a=!0,y=0;y<G;y++)if(!this.rows[y].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var y=this.rows[this.currRow];y.insertChar(a)},c.setPen=function(a){var y=this.rows[this.currRow];y.setPenStyles(a)},c.moveCursor=function(a){var y=this.rows[this.currRow];y.moveCursor(a)},c.setCursor=function(a){this.logger.log(k.INFO,"setCursor: "+a);var y=this.rows[this.currRow];y.setCursor(a)},c.setPAC=function(a){this.logger.log(k.INFO,"pacData = "+JSON.stringify(a));var y=a.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var m=0;m<G;m++)this.rows[m].clear();var x=this.currRow+1-this.nrRollUpRows,B=this.lastOutputScreen;if(B){var W=B.rows[x].cueStartTime,V=this.logger.time;if(W&&V!==null&&W<V)for(var K=0;K<this.nrRollUpRows;K++)this.rows[y-this.nrRollUpRows+K+1].copy(B.rows[x+K])}}this.currRow=y;var P=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,$=Math.max(N-1,0);P.setCursor(a.indent),a.color=P.chars[$].penState.foreground}var ne={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ne)},c.setBkgData=function(a){this.logger.log(k.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(k.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(k.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(a,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(k.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var y=[],m="",x=-1,B=0;B<G;B++){var W=this.rows[B].getTextString();W&&(x=B+1,a?y.push("Row "+x+": '"+W+"'"):y.push(W.trim()))}return y.length>0&&(a?m="["+y.join(" | ")+"]":m=y.join(`
|
|
`)),m},c.getTextAndFormat=function(){return this.rows},p}(),T=function(){function p(u,a,y){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=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new h(y),this.nonDisplayedMemory=new h(y),this.lastOutputScreen=new h(y),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var c=p.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(k.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var y=0;y<a.length;y++)this.writeScreen.insertChar(a[y]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(k.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(k.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(k.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(k.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(k.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(k.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(k.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(k.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(k.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(k.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(k.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(k.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(k.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(k.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(k.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(k.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var y={flash:!1};if(y.underline=a%2===1,y.italics=a>=46,y.italics)y.foreground="white";else{var m=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=x[m]}this.logger.log(k.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},p}(),v=function(){function p(u,a,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new w;this.channels=[null,new T(u,a,m),new T(u+1,y,m)],this.cmdHistory=E(),this.logger=m}var c=p.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,y){this.channels[a].setHandler(y)},c.addData=function(a,y){var m,x,B,W=!1;this.logger.time=a;for(var V=0;V<y.length;V+=2){if(x=y[V]&127,B=y[V+1]&127,x===0&&B===0)continue;if(this.logger.log(k.DATA,"["+C([y[V],y[V+1]])+"] -> ("+C([x,B])+")"),m=this.parseCmd(x,B),m||(m=this.parseMidrow(x,B)),m||(m=this.parsePAC(x,B)),m||(m=this.parseBackgroundAttributes(x,B)),!m&&(W=this.parseChars(x,B),W)){var K=this.currentChannel;if(K&&K>0){var P=this.channels[K];P.insertChars(W)}else this.logger.log(k.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!W&&this.logger.log(k.WARNING,"Couldn't parse cleaned data "+C([x,B])+" orig: "+C([y[V],y[V+1]]))}},c.parseCmd=function(a,y){var m=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&y>=32&&y<=47,B=(a===23||a===31)&&y>=33&&y<=35;if(!(x||B))return!1;if(L(a,y,m))return g(null,null,m),this.logger.log(k.DEBUG,"Repeated command ("+C([a,y])+") is dropped"),!0;var W=a===20||a===21||a===23?1:2,V=this.channels[W];return a===20||a===21||a===28||a===29?y===32?V.ccRCL():y===33?V.ccBS():y===34?V.ccAOF():y===35?V.ccAON():y===36?V.ccDER():y===37?V.ccRU(2):y===38?V.ccRU(3):y===39?V.ccRU(4):y===40?V.ccFON():y===41?V.ccRDC():y===42?V.ccTR():y===43?V.ccRTD():y===44?V.ccEDM():y===45?V.ccCR():y===46?V.ccENM():y===47&&V.ccEOC():V.ccTO(y-32),g(a,y,m),this.currentChannel=W,!0},c.parseMidrow=function(a,y){var m=0;if((a===17||a===25)&&y>=32&&y<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(k.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[m];return x?(x.ccMIDROW(y),this.logger.log(k.DEBUG,"MIDROW ("+C([a,y])+")"),!0):!1}return!1},c.parsePAC=function(a,y){var m,x=this.cmdHistory,B=(a>=17&&a<=23||a>=25&&a<=31)&&y>=64&&y<=127,W=(a===16||a===24)&&y>=64&&y<=95;if(!(B||W))return!1;if(L(a,y,x))return g(null,null,x),!0;var V=a<=23?1:2;y>=64&&y<=95?m=V===1?M[a]:b[a]:m=V===1?_[a]:A[a];var K=this.channels[V];return K?(K.setPAC(this.interpretPAC(m,y)),g(a,y,x),this.currentChannel=V,!0):!1},c.interpretPAC=function(a,y){var m,x={color:null,italics:!1,indent:null,underline:!1,row:a};return y>95?m=y-96:m=y-64,x.underline=(m&1)===1,m<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((m-16)/2)*4,x},c.parseChars=function(a,y){var m,x=null,B=null;if(a>=25?(m=2,B=a-8):(m=1,B=a),B>=17&&B<=19){var W;B===17?W=y+80:B===18?W=y+112:W=y+144,this.logger.log(k.INFO,"Special char '"+R(W)+"' in channel "+m),x=[W]}else a>=32&&a<=127&&(x=y===0?[a]:[a,y]);if(x){var V=C(x);this.logger.log(k.DEBUG,"Char codes = "+V.join(",")),g(a,y,this.cmdHistory)}return x},c.parseBackgroundAttributes=function(a,y){var m=(a===16||a===24)&&y>=32&&y<=47,x=(a===23||a===31)&&y>=45&&y<=47;if(!(m||x))return!1;var B,W={};a===16||a===24?(B=Math.floor((y-32)/2),W.background=I[B],y%2===1&&(W.background=W.background+"_semi")):y===45?W.background="transparent":(W.foreground="black",y===47&&(W.underline=!0));var V=a<=23?1:2,K=this.channels[V];return K.setBkgData(W),g(a,y,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var y=this.channels[a];y&&y.reset()}this.cmdHistory=E()},c.cueSplitAtTime=function(a){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(a)}},p}();function g(p,c,u){u.a=p,u.b=c}function L(p,c,u){return u.a===p&&u.b===c}function E(){return{a:null,b:null}}Z.default=v},"./src/utils/codecs.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isCodecType",function(){return U}),O.d(Z,"isCodecSupportedInMp4",function(){return R});var J={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(G,H){var M=J[H];return!!M&&M[G.slice(0,4)]===!0}function R(G,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/vttparser.ts"),U=O("./src/utils/webvtt-parser.ts"),R=O("./src/utils/texttrack-utils.ts"),G=/\s/,H={newCue:function(_,b,A,I){for(var k=[],w,C,d,o,l,h=self.VTTCue||self.TextTrackCue,T=0;T<I.rows.length;T++)if(w=I.rows[T],d=!0,o=0,l="",!w.isEmpty()){for(var v=0;v<w.chars.length;v++)G.test(w.chars[v].uchar)&&d?o++:(l+=w.chars[v].uchar,d=!1);w.cueStartTime=b,b===A&&(A+=1e-4),o>=16?o--:o++;var g=Object(J.fixLineBreaks)(l.trim()),L=Object(U.generateCueId)(b,A,g);(!_||!_.cues||!_.cues.getCueById(L))&&(C=new h(b,A,g),C.id=L,C.line=T+1,C.align="left",C.position=10+Math.min(80,Math.floor(o*8/32)*10),k.push(C))}return _&&k.length&&(k.sort(function(E,p){return E.line==="auto"||p.line==="auto"?0:E.line>8&&p.line>8?p.line-E.line:E.line-p.line}),k.forEach(function(E){return Object(R.addCueToTrack)(_,E)})),k}};Z.default=H},"./src/utils/discontinuities.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"findFirstFragWithCC",function(){return G}),O.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),O.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),O.d(Z,"adjustSlidingStart",function(){return b}),O.d(Z,"alignStream",function(){return A}),O.d(Z,"alignPDT",function(){return k}),O.d(Z,"alignFragmentByPDTDelta",function(){return w}),O.d(Z,"alignMediaPlaylistByPDT",function(){return C});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts"),R=O("./src/controller/level-helper.ts");function G(d,o){for(var l=null,h=0,T=d.length;h<T;h++){var v=d[h];if(v&&v.cc===o){l=v;break}}return l}function H(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function M(d,o){var l=d.fragments,h=o.fragments;if(!h.length||!l.length){U.logger.log("No fragments to align");return}var T=G(l,h[0].cc);if(!T||T&&!T.startPTS){U.logger.log("No frag in previous level to align on");return}return T}function _(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function b(d,o){for(var l=o.fragments,h=0,T=l.length;h<T;h++)_(l[h],d);o.fragmentHint&&_(o.fragmentHint,d),o.alignedSliding=!0}function A(d,o,l){if(!o)return;I(d,l,o),!l.alignedSliding&&o.details&&k(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(R.adjustSliding)(o.details,l)}function I(d,o,l){if(H(d,l,o)){var h=M(l.details,o);h&&Object(J.isFiniteNumber)(h.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),b(h.start,o))}}function k(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=d.fragments[0].programDateTime,T=(h-l)/1e3+o.fragments[0].start;T&&Object(J.isFiniteNumber)(T)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+T.toFixed(3)+" "+d.url+" "),b(T,d))}function w(d,o){var l=d.programDateTime;if(!l)return;var h=(l-o)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=o.fragments[0].start,T=l-h*1e3;d.fragments.forEach(function(v){w(v,T)}),d.fragmentHint&&w(d.fragmentHint,T),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/ewma.ts"),U=function(){function R(H,M,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new J.default(H),this.fast_=new J.default(M)}var G=R.prototype;return G.update=function(M,_){var b=this.slow_,A=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new J.default(M,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new J.default(_,A.getEstimate(),A.getTotalWeight()))},G.sample=function(M,_){M=Math.max(M,this.minDelayMs_);var b=8*_,A=M/1e3,I=b/A;this.fast_.sample(A,I),this.slow_.sample(A,I)},G.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},R}();Z.default=U},"./src/utils/ewma.ts":function(fe,Z,O){"use strict";O.r(Z);var J=function(){function U(G,H,M){H===void 0&&(H=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=H,this.totalWeight_=M}var R=U.prototype;return R.sample=function(H,M){var _=Math.pow(this.alpha_,H);this.estimate_=M*(1-_)+_*this.estimate_,this.totalWeight_+=H},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},U}();Z.default=J},"./src/utils/fetch-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"fetchSupported",function(){return w});var J=O("./src/polyfills/number.ts"),U=O("./src/loader/load-stats.ts"),R=O("./src/demux/chunk-cache.ts");function G(h,T){h.prototype=Object.create(T.prototype),h.prototype.constructor=h,A(h,T)}function H(h){var T=typeof Map=="function"?new Map:void 0;return H=function(g){if(g===null||!b(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(g))return T.get(g);T.set(g,L)}function L(){return M(g,arguments,I(this).constructor)}return L.prototype=Object.create(g.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),A(L,g)},H(h)}function M(h,T,v){return _()?M=Reflect.construct:M=function(L,E,p){var c=[null];c.push.apply(c,E);var u=Function.bind.apply(L,c),a=new u;return p&&A(a,p.prototype),a},M.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function b(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function A(h,T){return A=Object.setPrototypeOf||function(g,L){return g.__proto__=L,g},A(h,T)}function I(h){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},I(h)}function k(){return k=Object.assign||function(h){for(var T=1;T<arguments.length;T++){var v=arguments[T];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(h[g]=v[g])}return h},k.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var C=function(){function h(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var T=h.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(g,L,E){var p=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(g,this.controller.signal),a=E.onProgress,y=g.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=g,this.config=L,this.callbacks=E,this.request=this.fetchSetup(g,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),E.onTimeout(c,g,p.response)},L.timeout),self.fetch(this.request).then(function(x){if(p.response=p.loader=x,!x.ok){var B=x.status,W=x.statusText;throw new l(W||"fetch, bad network response",B,x)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(x.headers.get("Content-Length")||"0"),a&&Object(J.isFiniteNumber)(L.highWaterMark)?p.loadProgressively(x,c,g,L.highWaterMark,a):y?x.arrayBuffer():x.text()}).then(function(x){var B=p.response;self.clearTimeout(p.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=x[m];var W={url:B.url,data:x};a&&!Object(J.isFiniteNumber)(L.highWaterMark)&&a(c,g,x,B),E.onSuccess(W,c,g,B)}).catch(function(x){if(self.clearTimeout(p.requestTimeout),c.aborted)return;var B=x.code||0;E.onError({code:B,text:x.message},g,x.details)})},T.getCacheAge=function(){var g=null;if(this.response){var L=this.response.headers.get("age");g=L?parseFloat(L):null}return g},T.loadProgressively=function(g,L,E,p,c){p===void 0&&(p=0);var u=new R.default,a=g.body.getReader(),y=function m(){return a.read().then(function(x){if(x.done)return u.dataLength&&c(L,E,u.flush(),g),Promise.resolve(new ArrayBuffer(0));var B=x.value,W=B.length;return L.loaded+=W,W<p||u.dataLength?(u.push(B),u.dataLength>=p&&c(L,E,u.flush(),g)):c(L,E,B,g),m()}).catch(function(){return Promise.reject()})};return y()},h}();function d(h,T){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(k({},h.headers))};return h.rangeEnd&&v.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),v}function o(h,T){return new self.Request(h.url,T)}var l=function(h){G(T,h);function T(v,g,L){var E;return E=h.call(this,v)||this,E.code=void 0,E.details=void 0,E.code=g,E.details=L,E}return T}(H(Error));Z.default=C},"./src/utils/imsc1-ttml-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"IMSC1_CODEC",function(){return b}),O.d(Z,"parseIMSC1",function(){return w});var J=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/vttparser.ts"),R=O("./src/utils/vttcue.ts"),G=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),M=O("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(p[a]=u[a])}return p},_.apply(this,arguments)}var b="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,I=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,k={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(p,c,u,a,y){var m=Object(J.findBox)(new Uint8Array(p),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var x=m[0],B=Object(G.utf8ArrayToStr)(new Uint8Array(p,x.start,x.end-x.start)),W=Object(H.toTimescaleFromScale)(c,1,u);try{a(C(B,W))}catch(V){y(V)}}function C(p,c){var u=new DOMParser,a=u.parseFromString(p,"text/xml"),y=a.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(m).reduce(function(P,N){return P[N]=y.getAttribute("ttp:"+N)||m[N],P},{}),B=y.getAttribute("xml:space")!=="preserve",W=o(d(y,"styling","style")),V=o(d(y,"layout","region")),K=d(y,"body","[begin]");return[].map.call(K,function(P){var N=l(P,B);if(!N||!P.hasAttribute("begin"))return null;var $=g(P.getAttribute("begin"),x),ne=g(P.getAttribute("dur"),x),ue=g(P.getAttribute("end"),x);if($===null)throw v(P);if(ue===null){if(ne===null)throw v(P);ue=$+ne}var me=new R.default($-c,ue-c,N);me.id=Object(M.generateCueId)(me.startTime,me.endTime,me.text);var ke=V[P.getAttribute("region")],xe=W[P.getAttribute("style")];me.position=10,me.size=80;var Re=h(ke,xe),Se=Re.textAlign;if(Se){var Te=k[Se];Te&&(me.lineAlign=Te),me.align=Se}return _(me,Re),me}).filter(function(P){return P!==null})}function d(p,c,u){var a=p.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(p){return p.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(p,c){return[].slice.call(p.childNodes).reduce(function(u,a,y){var m;return a.nodeName==="br"&&y?u+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function h(p,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(y,m){var x=T(c,u,m)||T(p,u,m);return x&&(y[m]=x),y},{})}function T(p,c,u){return p.hasAttributeNS(c,u)?p.getAttributeNS(c,u):null}function v(p){return new Error("Could not parse ttml timestamp "+p)}function g(p,c){if(!p)return null;var u=Object(U.parseTimeStamp)(p);return u===null&&(A.test(p)?u=L(p,c):I.test(p)&&(u=E(p,c))),u}function L(p,c){var u=A.exec(p),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function E(p,c){var u=I.exec(p),a=Number(u[1]),y=u[2];switch(y){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"enableLogs",function(){return M}),O.d(Z,"logger",function(){return _});var J=function(){},U={trace:J,debug:J,log:J,warn:J,info:J,error:J},R=U;function G(b){var A=self.console[b];return A?A.bind(self.console,"["+b+"] >"):J}function H(b){for(var A=arguments.length,I=new Array(A>1?A-1:0),k=1;k<A;k++)I[k-1]=arguments[k];I.forEach(function(w){R[w]=b[w]?b[w].bind(b):G(w)})}function M(b){if(self.console&&b===!0||typeof b=="object"){H(b,"debug","log","info","warn","error");try{R.log()}catch(A){R=U}}else R=U}var _=R},"./src/utils/mediakeys-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"KeySystems",function(){return J}),O.d(Z,"requestMediaKeySystemAccess",function(){return U});var J;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(J||(J={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"getMediaSource",function(){return J});function J(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"bin2str",function(){return H}),O.d(Z,"readUint16",function(){return M}),O.d(Z,"readUint32",function(){return _}),O.d(Z,"writeUint32",function(){return b}),O.d(Z,"findBox",function(){return A}),O.d(Z,"parseSegmentIndex",function(){return I}),O.d(Z,"parseInitSegment",function(){return k}),O.d(Z,"getStartDTS",function(){return w}),O.d(Z,"getDuration",function(){return C}),O.d(Z,"computeRawDurationFromSamples",function(){return d}),O.d(Z,"offsetStartDTS",function(){return o}),O.d(Z,"segmentValidRange",function(){return l}),O.d(Z,"appendUint8Array",function(){return h});var J=O("./src/utils/typed-array.ts"),U=O("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,G=[].push;function H(T){return String.fromCharCode.apply(null,T)}function M(T,v){"data"in T&&(v+=T.start,T=T.data);var g=T[v]<<8|T[v+1];return g<0?65536+g:g}function _(T,v){"data"in T&&(v+=T.start,T=T.data);var g=T[v]<<24|T[v+1]<<16|T[v+2]<<8|T[v+3];return g<0?4294967296+g:g}function b(T,v,g){"data"in T&&(v+=T.start,T=T.data),T[v]=g>>24,T[v+1]=g>>16&255,T[v+2]=g>>8&255,T[v+3]=g&255}function A(T,v){var g=[];if(!v.length)return g;var L,E,p;"data"in T?(L=T.data,E=T.start,p=T.end):(L=T,E=0,p=L.byteLength);for(var c=E;c<p;){var u=_(L,c),a=H(L.subarray(c+4,c+8)),y=u>1?c+u:p;if(a===v[0])if(v.length===1)g.push({data:L,start:c+8,end:y});else{var m=A({data:L,start:c+8,end:y},v.slice(1));m.length&&G.apply(g,m)}c=y}return g}function I(T){var v=A(T,["moov"]),g=v[0],L=g?g.end:null,E=A(T,["sidx"]);if(!E||!E[0])return null;var p=[],c=E[0],u=c.data[0],a=u===0?8:16,y=_(c,a);a+=4;var m=0,x=0;u===0?a+=8:a+=16,a+=2;var B=c.end+x,W=M(c,a);a+=2;for(var V=0;V<W;V++){var K=a,P=_(c,K);K+=4;var N=P&2147483647,$=(P&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=_(c,K);K+=4,p.push({referenceSize:N,subsegmentDuration:ne,info:{duration:ne/y,start:B,end:B+N-1}}),B+=N,K+=4,a=K}return{earliestPresentationTime:m,timescale:y,version:u,referencesCount:W,references:p,moovEndOffset:L}}function k(T){for(var v=[],g=A(T,["moov","trak"]),L=0;L<g.length;L++){var E=g[L],p=A(E,["tkhd"])[0];if(p){var c=p.data[p.start],u=c===0?12:20,a=_(p,u),y=A(E,["mdia","mdhd"])[0];if(y){c=y.data[y.start],u=c===0?12:20;var m=_(y,u),x=A(E,["mdia","hdlr"])[0];if(x){var B=H(x.data.subarray(x.start+8,x.start+12)),W={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[B];if(W){var V=A(E,["mdia","minf","stbl","stsd"])[0],K=void 0;V&&(K=H(V.data.subarray(V.start+12,V.start+16))),v[a]={timescale:m,type:W},v[W]={timescale:m,id:a,codec:K}}}}}}var P=A(T,["moov","mvex","trex"]);return P.forEach(function(N){var $=_(N,4),ne=v[$];ne&&(ne.default={duration:_(N,12),flags:_(N,20)})}),v}function w(T,v){return A(v,["moof","traf"]).reduce(function(g,L){var E=A(L,["tfdt"])[0],p=E.data[E.start],c=A(L,["tfhd"]).reduce(function(u,a){var y=_(a,4),m=T[y];if(m){var x=_(E,4);p===1&&(x*=Math.pow(2,32),x+=_(E,8));var B=m.timescale||9e4,W=x/B;if(isFinite(W)&&(u===null||W<u))return W}return u},null);return c!==null&&isFinite(c)&&(g===null||c<g)?c:g},null)||0}function C(T,v){for(var g=0,L=0,E=0,p=A(T,["moof","traf"]),c=0;c<p.length;c++){var u=p[c],a=A(u,["tfhd"])[0],y=_(a,4),m=v[y];if(!m)continue;var x=m.default,B=_(a,0)|(x==null?void 0:x.flags),W=x==null?void 0:x.duration;B&8&&(B&2?W=_(a,12):W=_(a,8));for(var V=m.timescale||9e4,K=A(u,["trun"]),P=0;P<K.length;P++){if(W){var N=_(K[P],4);g=W*N}else g=d(K[P]);m.type===U.ElementaryStreamTypes.VIDEO?L+=g/V:m.type===U.ElementaryStreamTypes.AUDIO&&(E+=g/V)}}if(L===0&&E===0){var $=I(T);if($!=null&&$.references)return $.references.reduce(function(ne,ue){return ne+ue.info.duration||0},0)}return L||E}function d(T){var v=_(T,0),g=8;v&1&&(g+=4),v&4&&(g+=4);for(var L=0,E=_(T,4),p=0;p<E;p++){if(v&256){var c=_(T,g);L+=c,g+=4}v&512&&(g+=4),v&1024&&(g+=4),v&2048&&(g+=4)}return L}function o(T,v,g){A(v,["moof","traf"]).forEach(function(L){A(L,["tfhd"]).forEach(function(E){var p=_(E,4),c=T[p];if(!c)return;var u=c.timescale||9e4;A(L,["tfdt"]).forEach(function(a){var y=a.data[a.start],m=_(a,4);if(y===0)b(a,4,m-g*u);else{m*=Math.pow(2,32),m+=_(a,8),m-=g*u,m=Math.max(m,0);var x=Math.floor(m/(R+1)),B=Math.floor(m%(R+1));b(a,4,x),b(a,8,B)}})})})}function l(T){var v={valid:null,remainder:null},g=A(T,["moof"]);if(g){if(g.length<2)return v.remainder=T,v}else return v;var L=g[g.length-1];return v.valid=Object(J.sliceUint8)(T,0,L.start-8),v.remainder=Object(J.sliceUint8)(T,L.start-8),v}function h(T,v){var g=new Uint8Array(T.length+v.length);return g.set(T),g.set(v,T.length),g}},"./src/utils/output-filter.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function U(G,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=H}var R=U.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(H,M,_){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=M,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"sendAddTrackEvent",function(){return U}),O.d(Z,"addCueToTrack",function(){return R}),O.d(Z,"clearCurrentCues",function(){return G}),O.d(Z,"removeCuesInRange",function(){return H}),O.d(Z,"getCuesInRange",function(){return _});var J=O("./src/utils/logger.ts");function U(b,A){var I;try{I=new Event("addtrack")}catch(k){I=document.createEvent("Event"),I.initEvent("addtrack",!1,!1)}I.track=b,A.dispatchEvent(I)}function R(b,A){var I=b.mode;if(I==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(A.id))try{if(b.addCue(A),!b.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(w){J.logger.debug("[texttrack-utils]: "+w);var k=new self.TextTrackCue(A.startTime,A.endTime,A.text);k.id=A.id,b.addCue(k)}I==="disabled"&&(b.mode=I)}function G(b){var A=b.mode;if(A==="disabled"&&(b.mode="hidden"),b.cues)for(var I=b.cues.length;I--;)b.removeCue(b.cues[I]);A==="disabled"&&(b.mode=A)}function H(b,A,I){var k=b.mode;if(k==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var w=_(b.cues,A,I),C=0;C<w.length;C++)b.removeCue(w[C]);k==="disabled"&&(b.mode=k)}function M(b,A){if(A<b[0].startTime)return 0;var I=b.length-1;if(A>b[I].endTime)return-1;for(var k=0,w=I;k<=w;){var C=Math.floor((w+k)/2);if(A<b[C].startTime)w=C-1;else if(A>b[C].startTime&&k<I)k=C+1;else return C}return b[k].startTime-A<A-b[w].startTime?k:w}function _(b,A,I){var k=[],w=M(b,A);if(w>-1)for(var C=w,d=b.length;C<d;C++){var o=b[C];if(o.startTime>=A&&o.endTime<=I)k.push(o);else if(o.startTime>I)return k}return k}},"./src/utils/time-ranges.ts":function(fe,Z,O){"use strict";O.r(Z);var J={toString:function(R){for(var G="",H=R.length,M=0;M<H;M++)G+="["+R.start(M).toFixed(3)+","+R.end(M).toFixed(3)+"]";return G}};Z.default=J},"./src/utils/timescale-conversion.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"toTimescaleFromBase",function(){return U}),O.d(Z,"toTimescaleFromScale",function(){return R}),O.d(Z,"toMsFromMpegTsClock",function(){return G}),O.d(Z,"toMpegTsClockFromTimescale",function(){return H});var J=9e4;function U(M,_,b,A){b===void 0&&(b=1),A===void 0&&(A=!1);var I=M*_*b;return A?Math.round(I):I}function R(M,_,b,A){return b===void 0&&(b=1),A===void 0&&(A=!1),U(M,_,1/b,A)}function G(M,_){return _===void 0&&(_=!1),U(M,1e3,1/J,_)}function H(M,_){return _===void 0&&(_=1),U(M,J,1/_)}},"./src/utils/typed-array.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"sliceUint8",function(){return J});function J(U,R,G){return Uint8Array.prototype.slice?U.slice(R,G):new Uint8Array(Array.prototype.slice.call(U,R,G))}},"./src/utils/vttcue.ts":function(fe,Z,O){"use strict";O.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var J=["","lr","rl"],U=["start","middle","end","left","right"];function R(b,A){if(typeof A!="string")return!1;if(!Array.isArray(b))return!1;var I=A.toLowerCase();return~b.indexOf(I)?I:!1}function G(b){return R(J,b)}function H(b){return R(U,b)}function M(b){for(var A=arguments.length,I=new Array(A>1?A-1:0),k=1;k<A;k++)I[k-1]=arguments[k];for(var w=1;w<arguments.length;w++){var C=arguments[w];for(var d in C)b[d]=C[d]}return b}function _(b,A,I){var k=this,w={enumerable:!0};k.hasBeenReset=!1;var C="",d=!1,o=b,l=A,h=I,T=null,v="",g=!0,L="auto",E="start",p=50,c="middle",u=50,a="middle";Object.defineProperty(k,"id",M({},w,{get:function(){return C},set:function(m){C=""+m}})),Object.defineProperty(k,"pauseOnExit",M({},w,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(k,"startTime",M({},w,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"endTime",M({},w,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"text",M({},w,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(k,"region",M({},w,{get:function(){return T},set:function(m){T=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"vertical",M({},w,{get:function(){return v},set:function(m){var x=G(m);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"snapToLines",M({},w,{get:function(){return g},set:function(m){g=!!m,this.hasBeenReset=!0}})),Object.defineProperty(k,"line",M({},w,{get:function(){return L},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"lineAlign",M({},w,{get:function(){return E},set:function(m){var x=H(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");E=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"position",M({},w,{get:function(){return p},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");p=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"positionAlign",M({},w,{get:function(){return c},set:function(m){var x=H(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");c=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"size",M({},w,{get:function(){return u},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"align",M({},w,{get:function(){return a},set:function(m){var x=H(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),k.displayState=void 0}return _.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"parseTimeStamp",function(){return R}),O.d(Z,"fixLineBreaks",function(){return A}),O.d(Z,"VTTParser",function(){return I});var J=O("./src/utils/vttcue.ts"),U=function(){function k(){}var w=k.prototype;return w.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},k}();function R(k){function w(d,o,l,h){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(h||0)}var C=k.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?w(C[2],C[3],0,C[4]):w(C[1],C[2],C[3],C[4]):null}var G=function(){function k(){this.values=Object.create(null)}var w=k.prototype;return w.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},w.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},w.has=function(d){return d in this.values},w.alt=function(d,o,l){for(var h=0;h<l.length;++h)if(o===l[h]){this.set(d,o);break}},w.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},w.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},k}();function H(k,w,C,d){var o=d?k.split(d):[k];for(var l in o){if(typeof o[l]!="string")continue;var h=o[l].split(C);if(h.length!==2)continue;var T=h[0],v=h[1];w(T,v)}}var M=new J.default(0,0,""),_=M.align==="middle"?"middle":"center";function b(k,w,C){var d=k;function o(){var T=R(k);if(T===null)throw new Error("Malformed timestamp: "+d);return k=k.replace(/^[^\sa-zA-Z-]+/,""),T}function l(T,v){var g=new G;H(T,function(p,c){var u;switch(p){case"region":for(var a=C.length-1;a>=0;a--)if(C[a].id===c){g.set(p,C[a].region);break}break;case"vertical":g.alt(p,c,["rl","lr"]);break;case"line":u=c.split(","),g.integer(p,u[0]),g.percent(p,u[0])&&g.set("snapToLines",!1),g.alt(p,u[0],["auto"]),u.length===2&&g.alt("lineAlign",u[1],["start",_,"end"]);break;case"position":u=c.split(","),g.percent(p,u[0]),u.length===2&&g.alt("positionAlign",u[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":g.percent(p,c);break;case"align":g.alt(p,c,["start",_,"end","left","right"]);break}},/:/,/\s/),v.region=g.get("region",null),v.vertical=g.get("vertical","");var L=g.get("line","auto");L==="auto"&&M.line===-1&&(L=-1),v.line=L,v.lineAlign=g.get("lineAlign","start"),v.snapToLines=g.get("snapToLines",!0),v.size=g.get("size",100),v.align=g.get("align",_);var E=g.get("position","auto");E==="auto"&&M.position===50&&(E=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=E}function h(){k=k.replace(/^\s+/,"")}if(h(),w.startTime=o(),h(),k.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);k=k.substr(3),h(),w.endTime=o(),h(),l(k,w)}function A(k){return k.replace(/<br(?: \/)?>/gi,`
|
|
`)}var I=function(){function k(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=k.prototype;return w.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var E=o.buffer,p=0;for(E=A(E);p<E.length&&E[p]!=="\r"&&E[p]!==`
|
|
`;)++p;var c=E.substr(0,p);return E[p]==="\r"&&++p,E[p]===`
|
|
`&&++p,o.buffer=E.substr(p),c}function h(E){H(E,function(p,c){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=l();var v=T.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var g=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;g?g=!1:T=l();switch(o.state){case"HEADER":/:/.test(T)?h(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new J.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{b(T,o.cue,o.regionList)}catch(E){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=T.indexOf("-->")!==-1;if(!T||L&&(g=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(E){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},k}()},"./src/utils/webvtt-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"generateCueId",function(){return I}),O.d(Z,"parseWebVTT",function(){return w});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/vttparser.ts"),R=O("./src/demux/id3.ts"),G=O("./src/utils/timescale-conversion.ts"),H=O("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,_=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},b=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),T=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(J.isFiniteNumber)(o)||!Object(J.isFiniteNumber)(l)||!Object(J.isFiniteNumber)(h)||!Object(J.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*h,o+=60*60*1e3*T,o},A=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function I(C,d,o){return A(C.toString())+A(d.toString())+A(o)}var k=function(d,o,l){var h=d[o],T=d[h.prevCC];if(!T||!T.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(v=T)!==null&&v!==void 0&&v.new;){var v;d.ccOffset+=h.start-T.start,h.new=!1,h=T,T=d[h.prevCC]}d.presentationOffset=l};function w(C,d,o,l,h,T,v,g){var L=new U.VTTParser,E=Object(R.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(M,`
|
|
`).split(`
|
|
`),p=[],c=Object(G.toMpegTsClockFromTimescale)(d,o),u="00:00.000",a=0,y=0,m,x=!0,B=!1;L.oncue=function(W){var V=l[h],K=l.ccOffset,P=(a-c)/9e4;if(V!=null&&V.new&&(y!==void 0?K=l.ccOffset=V.start:k(l,h,P)),P&&(K=P-l.presentationOffset),B){var N=W.endTime-W.startTime,$=Object(H.normalizePts)((W.startTime+K-y)*9e4,T*9e4)/9e4;W.startTime=$,W.endTime=$+N}var ne=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ne)),W.id||(W.id=I(W.startTime,W.endTime,ne)),W.endTime>0&&p.push(W)},L.onparsingerror=function(W){m=W},L.onflush=function(){if(m){g(m);return}v(p)},E.forEach(function(W){if(x)if(_(W,"X-TIMESTAMP-MAP=")){x=!1,B=!0,W.substr(16).split(",").forEach(function(V){_(V,"LOCAL:")?u=V.substr(6):_(V,"MPEGTS:")&&(a=parseInt(V.substr(7)))});try{y=b(u)/1e3}catch(V){B=!1,m=V}return}else W===""&&(x=!1);L.parse(W+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/logger.ts"),U=O("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,G=function(){function H(_){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=_?_.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var M=H.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},M.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(b,A,I){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=A,this.callbacks=I,this.retryDelay=A.retryDelay,this.loadInternal()},M.loadInternal=function(){var b=this.config,A=this.context;if(!b)return;var I=this.loader=new self.XMLHttpRequest,k=this.stats;k.loading.first=0,k.loaded=0;var w=this.xhrSetup;try{if(w)try{w(I,A.url)}catch(o){I.open("GET",A.url,!0),w(I,A.url)}I.readyState||I.open("GET",A.url,!0);var C=this.context.headers;if(C)for(var d in C)I.setRequestHeader(d,C[d])}catch(o){this.callbacks.onError({code:I.status,text:o.message},A,I);return}A.rangeEnd&&I.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),I.onreadystatechange=this.readystatechange.bind(this),I.onprogress=this.loadprogress.bind(this),I.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),I.send()},M.readystatechange=function(){var b=this.context,A=this.loader,I=this.stats;if(!b||!A)return;var k=A.readyState,w=this.config;if(I.aborted)return;if(k>=2)if(self.clearTimeout(this.requestTimeout),I.loading.first===0&&(I.loading.first=Math.max(self.performance.now(),I.loading.start)),k===4){A.onreadystatechange=null,A.onprogress=null;var C=A.status;if(C>=200&&C<300){I.loading.end=Math.max(self.performance.now(),I.loading.first);var d,o;if(b.responseType==="arraybuffer"?(d=A.response,o=d.byteLength):(d=A.responseText,o=d.length),I.loaded=I.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(I,b,d,A),!this.callbacks)return;var h={url:A.responseURL,data:d};this.callbacks.onSuccess(h,I,b,A)}else I.retry>=w.maxRetry||C>=400&&C<499?(J.logger.error(C+" while loading "+b.url),this.callbacks.onError({code:C,text:A.statusText},b,A)):(J.logger.warn(C+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),I.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},M.loadtimeout=function(){J.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(b){var A=this.stats;A.loaded=b.loaded,b.lengthComputable&&(A.total=b.total)},M.getCacheAge=function(){var b=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");b=A?parseFloat(A):null}return b},H}();Z.default=G}}).default})},vHTk:function(dt,Je,de){dt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(dt,Je,de){"use strict";de.d(Je,"c",function(){return U}),de.d(Je,"b",function(){return R}),de.d(Je,"d",function(){return G}),de.d(Je,"a",function(){return M}),de.d(Je,"e",function(){return _});var fe=de("9og8"),Z=de("WmNS"),O=de.n(Z),J=de("ErOA");function U(b){return Object(J.c)("libraries/".concat(b,".json"))}function R(){return Object(J.c)("library_tags.json")}function G(b){return H.apply(this,arguments)}function H(){return H=Object(fe.a)(O.a.mark(function b(A){var I;return O.a.wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,Object(J.b)("attachments/".concat(A,".json"));case 2:return I=w.sent,w.abrupt("return",I.status===0);case 4:case"end":return w.stop()}},b)})),H.apply(this,arguments)}function M(b){return Object(J.f)("libraries.json",b)}function _(b,A){return Object(J.g)("libraries/".concat(b,".json"),A)}}}]);
|